Calling clk_get() with NULL as the second argument will give us "ipg"
clock as a result. The actual clock feeding into the peripheral is "per"
and, depending on the SoC, "ipg" and "per" may be separated by a clock
divider, so querying "ipg"'s rate may not result in rate that does not
represent the actual peripheral clock rate.
Change the code to request "per" as our peripheral clock to avoid
aforementioned problem.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
CPU type is not a reliable indicator of the underlying type of IP core
used, since there's no 1:1 mapping between the two. As example of one
such violation consider Vybrid SoC which contains IP block from i.MX53.
Instead port feature flags from corresponding Linux kernel driver and
use the ones that are relevant.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Use read/write adapter functions instead of directly calling to
readb/writeb. This is needed to prepare driver code to support Vybrid
SoC's variant of this block.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add 'lpuart' serial driver, based on analogous driver from U-Boot
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Based on analogous code from Linux kernel
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Port imx_check_clocks() from Linux kernel.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Update clk-gate2 code to be able to accept arbitrary 'cgr' value and
introduce imx_clk_gate2_cgr() (Used by Vybrid clock tree)
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Move clk code from 'mach-imx' to 'drivers' to keep the code tree
structure closer to that of analogous one from Linux kernel and,
arguably although subjective, to keep 'mach-imx' less cluttered.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Port of_clk_set_defautls() from Linux kernel in order to support DT
configurations that require it (e. g. Vybrid).
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Character device flag was set for ubi static volumes to vary the device
file size. This is now done with the truncate option. So no need for
the character device flag. This makes it also possible to dump a image from
the static volume.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The size of static ubi volumes changes depending on the content.
Add truncate callback to handle resizes.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This looks nicer and reduces the time to transfer 40 MB at 50 MHz from
203 seconds to 87 seconds.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This optimization reduced the time to transfer 40 MB at 50 MHz from
214 seconds to 203 seconds.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
- Initialize pdiv in declaration
- fix format specifiers
- simplify range check, pdiv can never be > 7
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The function used a separate variable to hold the value calculated and
only used it for range checking but then didn't use it.
This fixes calculation for slow baud rate that require a divider > 15.
Additionally fix the rounding.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When a message transfer fails no further messages are transferred, but
the error value was not propagated to the caller.
Fixes: 5db1a578d6 ("spi: add Marvell MVEBU SoC SPI driver")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We add the da9052 compatible to get this driver probed by devicetree
users.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The driver has to reset the FAULTLOG register after every read by
writing the value back. In the current case the FALUTLOG register keep
its value over every software reset and will only reset on power-off.
This drives the reset-source value unreliable.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is a dummy commit log body because I consider the change to trivial
to write something sensible.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
If OF_DEVICE isn't enabled, of_alias_get returns NULL. Also xstrdup
returns NULL when NULL is passed as argument. This allows to simplify
accordingly.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch adds a callback to parsing devicetree options for MMC:
bus-width, etc..
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The latest kernel gpio-74x164 driver supports 74LVC594 IC ID.
Patch adds such ID to barebox driver.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Based on kernel commit 8a8e8d2fdbab ("ubi: Only read necessary size when reading
the VID header") by Sascha Hauer <s.hauer@pengutronix.de>:
When reading the vid hdr from the device UBI always reads a whole
page. Instead, read only the data we actually need and speed up
attachment of UBI devices by potentially making use of reading
subpages if the NAND driver supports it.
Since the VID header may be at offset vid_hdr_shift in the page and
we can only read from the beginning of a page we have to add that
offset to the read size.
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes:
drivers/input/input.c:46:17: warning: passing argument 2 of '__set_bit' from incompatible pointer type [-Wincompatible-pointer-types]
idev->keys is an array, so we don't need to take the address of it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Most recent device tree binding for that mux support specifying a GPIO
connected to a reset line of that chip. Add code to handle that binding
in order to be able to use the chip on boards that leverage
aforementioned functionality.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add a very abridged version of SX150x driver from Linux. New, "pinctrl"
version of the driver was used as a base. As it was already mentioned
this driver supports very limited amount of the original functionality,
and the following are the features that were dropped:
- Interrupt support
- Support for any chip other that SX150x (due to lack of HW to test
with)
- Any pinctlr-like functions: pull-up/pull-down, open-drain,
etc. configuration
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The RVT table contains the pointers to the HAB API functions and is
located at 0x00000100.
Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Without these, 'devinfo pwmX' will show enabled=0 even though the PWM
was enabled (for example by a pwm-backlight).
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
These flags are already parsed from DT, so we can just use them to
configure the timings correctly.
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add a driver compatible with "fsl,imx-parallel-display" in order
to enable parallel display with the i.MX IPUv3.
Signed-off-by: Philippe Leduc <ledphilippe@gmail.com>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In rare cases the controller is does not work right after probe. When
this happens the registers show that the TXFIFO contains words, but
the transfer is never started. We observed that on some boards which
boot from SPI NOR. The xload SPI code leaves the controller enabled,
so the SPI controller is enabled during probe(). Disabling it before
usage (and thus resetting it) helps. We haven't found out why exactly
this happens.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
EEPROM support is an optional feature and the driver should work
just fine without it.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
If the chosen node does not exist, of_add_initrd fails to pass the
initrd to the kernel. Instead it should create the chosen node, just
like of_fixup_bootargs does.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
There are two problems that made the driver choose the wrong baudrate
calculation algorithm:
a) The compatible used on 370/XP isn't marvell,armada-370-xp-spi but
marvell,armada-370-spi or marvell,armada-xp-spi respectively.
b) The probe function uses
match = of_match_node(mvebu_spi_dt_ids, dev->device_node);
to determine the right algorithm. As the devices are also compatible
to marvell,orion-spi and this comes first in mvebu_spi_dt_ids[]
it's always the older Orion algorithm that is used.
This patch fixes both problems.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
While being a bit more random this helps dt setups where the id of a
platform device cannot easily be fixed anyhow.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of using gpio_is_valid just check the return code of of_get_gpio
for being < 0. This fixes -EPROBE_DEFER handling as now this error code
is handed to the caller instead of -ENODEV. If the gpio returned by
of_get_gpio is an invalid number this isn't noticed by
of_i2c_gpio_probe, but then gpio_request later fails which is good
enough.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Port the clock dependency resolution algorithm utilized by Linux
kernel's version of of_clk_init(), to allow for SoCs whose DT clock
configuration reqires such behaviour for correct initialization (Vybrid
is one such example).
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Some SoC (of which Vybrid is a one example) relegate GPIO direction
control to their pinmux IP block, instead of having that functionality
within GPIO IP. Add provisions to control that aspect of pinmux to
support such SoCs.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The partitions now may be in a subnode of the actual device node.
Eventually go another step up in the hierarchy if required.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The new binding recommends to put the partitions into a subnode
with compatible "fixed-partitions". Add support for this binding.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This chip can be found in 4th generation Kindle devices
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When we want to detect if a mtd device contains an UBI image then
testing the first block is not enough since it can always happen that
UBI has just erased the block before the power failed during last boot.
Since UBI only ever erases one block at a time and directly writes the
ec header to it afterwards, it shouldn't be necessary to scan the whole
device for UBI data. Scan the first 64 blocks. The first non-empty block
then must contain UBI data, if instead we find foreign data we assume
that no UBI is on that mtd device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The Barebox recognized false bad erase blocks while booting from a
Spansion NAND (1). This error occurred due a to high clock. The
Kernel sets the default NAND clock to 22Mhz. So, to fix this error and
to be more identical with the Kernel, the Barebox should be too.
1: nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Tested-by: Stefan Lengfeld <s.lengfeld@phytec.de>
Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Driver "init" function might be called multiple times.
On every "init" Tx/Rx buffer descriptors are initialized: "descs_init"
-> "{tx|rx}_descs_init".
In its turn those init functions set MAC's "{tx|rx}desclistaddr" to
point on the first buffer descriptor in the list.
So CPU to start operation from the first buffer descriptor as well after
every "init" we have to reset "{tx|rx}_currdescnum".
[Original U-Boot patch by Alexey Brodkin <abrodkin@synopsys.com>]
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
"bus mode" register contains lots of fields and some of them don't
expect to be written with 0 (zero). So since we're only interested in
resetting MAC (which is done with setting the least significant bit of
this register with "0") I believe it's better to modify only 1 bit of
the register.
[Original U-Boot patch by Alexey Brodkin <abrodkin@synopsys.com>]
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Do not select MIIPORT for RGMII interface
[Original U-Boot patch by Vipin Kumar <vipin.kumar@st.com>]
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
There are a few registers where consecutive writes to the same location
should be avoided or have a delay.
According to Synopsys, here is a list of the registers and bit(s) where
consecutive writes should be avoided or a delay is required:
DMA Registers:
Register 0 Bit 7
Register 6 All bits except for 24, 16-13, 2-1.
GMAC Registers:
Registers 0-3 All bits
Registers 6-7 All bits
Register 10 All bits
Register 11 All bits except for 5-6.
Registers 16-47 All bits
Register 48 All bits except for 18-16, 14.
Register 448 Bit 4.
Register 459 Bits 0-3.
[Original U-Boot patch by Dinh Nguyen <dinguyen@altera.com>]
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ksz8021_config_init() unconditionally sets the KSZPHY_OMSO_RMII_OVERRIDE
bit. This is since the initial micrel phy commit, so it's not
reproducible where this comes from and why this is done. Neither U-Boot
nor the kernel ever touch this bit and so should we. Also, instead
of doing a write only operation, read/modify/write the bit we actually
want to change.
This fixes operation on a KSZ8081MLX which is a MII only phy.
KSZPHY_OMSO_RMII_OVERRIDE is reserved here and must be written to 0.
KSZPHY_OMSO_MII_OVERRIDE is default 1 and must be written as 1.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Port the linux v4.8-rc1 Synopsys DesignWare watchdog driver to barebox.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This gets rid of some of the special cases in the bus scanning function
by splitting hierarchy enumeration and configuration and the actual
device registration into 2 passes.
This ensures that the PCI hierarchy below a root port is completely
set up before any device driver is probed.
This simplifies the code and makes it less error prone, while moving
the PCI address space layout closer to the one used by Linux.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
PCI BARs require their address to be at least aligned to their
size, otherwise address decoding will fail as the base address
gets rounded down.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Otherwise we may end up with a too low base address and push
requests for the upstream bus onto the downstream side.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The memory type may include other flags, so just check for
the 64bit allocation flag to see if the BAR is a 64bit one.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This makes diagnosing problems in address space allocation
much easier.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This way the ethernet device will show up at the correct point
in the device hierarchy.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Don't mask out the remapping flag before checking the register offset,
otherwise none of the switch statements will ever match.
Fixes: ff6a64d42f (e1000: Consolidate register offset fixups)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
It's pin mpp57 that has function vdd/cpu2-3-pd
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
in __of_find_path it can happen that there is a device, but there
is no driver for this device because it hasn't been probed yet.
Return -ENODEV in this case to let the caller know that it has to
try later again.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When state_new_from_node() returns -ENODEV that means that there
is no device available for the node, so return -EPROBE_DEFER in this
case and hope a device is there later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Since "57cebc4 mtd: ubi: Fix scrubbing during attach" we make sure
that the wear level worker does not start too early. However, now
there are cases when the worker starts too late. When a ubi image is
freshly written a volume may be autoresized. This has to be done
after the wear level worker is started because otherwise the initial
fastmap update will not be able to find any anchor PEBs.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The mvebu socs support up to 8 chip selects. Make use of them.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Port the linux v4.8-rc1 reset-socfpga driver to barebox.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ensure_wear_leveling() is called at the end of ubi_wl_init() and may
come to the decision to scrub some blocks. In the Kernel this is done
in a separate thread, but in barebox we do this synchronously. The
problem is that during ubi_wl_init() the EBA system is not yet
initialized (ubi_eba_init() is not yet called), so the wear level worker
hits a NULL pointer deref when the fastmap needs to be updated and
ubi_write_fastmap() accesses vol->eba_tbl.
Solve this by honoring the ubi->thread_enabled flag which is only set
to true when UBI is sufficiently initialized. This means we now can
have multiple works queued, so we can no longer simply do one work when
queued, but instead have to continue to do work until all work is done.
The best place to do so is a ubi_thread() function which behaves similar
to the Kernel function with the same name, but is called synchronously
in barebox. To make sure that the initially queued works are done, the
call to (no-op) wake_up_process() at the end of ubi_attach_mtd_dev()
is replaced with a call to ubi_thread().
While at it also honor the ubi->ro_mode flag to make sure we do not do
any wear leveling work on readonly UBI devices.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
It was found that pin 63 also works as input and so the respective function
is renamed from "gpo" to "gpio". The respective commit in Linux is:
a526973e0291 ("pinctrl: mvebu: Fix mapping of pin 63 (gpo -> gpio)")
which appeared in v4.1-rc3. The devicetrees are fixed accordingly since
commit
ce5cad51f381 ("ARM: dts: armada-370: Update the mpp63 function in the device tree on Armada 370")
which appeared in v4.6-rc1.
This fixes a runtime warning on the affected machines
(globalscale-mirabox and netgear-rn104) and makes the pin functional
again.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Without first assigning to ret it doesn't make sense to check it.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The eDP part need to be able to read the panel EDID.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The DCC console uses coprocessor registers registers accesses, the
implementation of those for ARMv8 is currently missing.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The i.MX6 USB phy does not recognize disconnects of high speed
devices when the USBPHY_CTRL_ENHOSTDISCONDETECT is not set. The
phy does not work properly though when this bit is always set, so
implement the notify_(dis)concect() callbacks to set this bit
whenever a high speed device is connected and to clear it again
when the device is disconnected.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add a nop usb transcveiver driver. At the moment it does nothing,
so is nothing more than a driver to satisfy the device tree
dependencies. clk / vbus-regulator / vbus-detect-gpio support can be
added later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The generic phy support layer has the necessary list handling
and phy retrieval functions, so we should reuse them for usb
phys. This adds a phy_to_usbphy() conversion function which
drivers can implement which attach to the generic phy layer
and are really usb phys.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently generic phy support assumes that the standard phy binding from
dts/Bindings/phy/phy-bindings.txt is used. This adds a helper function
which can be used to retrieve a phy when this standard binding is not
used.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When writing to the USBPHY_CTRL register read/modify/write is unncessary
since we are writing to the associated bit set register anyway.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add a struct usb_phy * member to struct usb_host. Also, call
usb_phy_notify_connect() / usb_phy_notify_disconnect() when there
are connection changes on the root hub.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The only ioctl needed is the one to get the ubi_num from a file
descriptor. The remaining ioctls are now implemented as regular
function calls.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Remove dev_dbgs containing __FILE__ and __LINE__ and no other
interesting debug informations.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of using udelay and a countdown, use the is_timeout function.
Also, move the code closer to the kernel version, i.e. check for the
correct bank and clean the interrupt status.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The interrupt mask is incorrect in case of HW error correction.
The driver will time out waiting for the wrong interrupts.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Move v3 register definitions to include file so that they can
be reused for the early nand boot code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Code wishing to manipulate ubi devices from outside the ubi
layer needs the ubi_num as reference. Add an ioctl to get
the ubi_num from a filedescriptor.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Currently we use a ioctl API to create/remove ubi volumes. This
means we always have to carry all function code for ubi volume
manipulation when the ioctl is compiled in.
This adds a function API to create/remove volumes so that the linker
can throw the unused code away later.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This fixes tx error detection which triggered way too often because the
hardware doesn't seem to clear the error bits on success
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The i.MX50 SOC includes one ESDHCv3, three ESDHCv2, one cspi and
two ecspi instances which are supported by existing drivers.
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
According to the Linux kernel and the qemu code, the MMCIFIFOCNT contains
the remaining number of words to read, excluding those that are already in
the FIFO. So the current number of bytes in the FIFO is
host_remain - (readl(base + MMCIFIFOCNT) << 2).
Also writing to MMCIDATACTRL will reset the read counter. As a result,
MCI_DATABLOCKEND is never set and read_bytes() waits forever.
With this change, SD-Card support on qemu vexpress works correctly.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
edid_to_display_timings is called in drivers/video/imx-ipu-v3/imx-hdmi.c,
drivers/video/simple-panel.c, and drivers/video/edid.c with the struct
display_timings *timings parameter pointing to an embedded struct
display_timings inside a struct fb_info. The timings pointer is not to
be freed in the error path.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We only allow to setup the host/peripheral role once, when it's already
set then we return -EBUSY.
Return 0 instead when we set the same role again and only return -EBUSY
when we actually try to change the role.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixes: 87c6a88 video/backlight-pwm: fix the value of 'brightness_max'.
brightness_max should really contain the number of brightness steps, so
the number of elements in the brightness array.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The SDHC used in the RK2928 and RK3288 are compatible with each other.
Add a compatible string for RK3288's SDHC.
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Add clk driver for RK3288 SoC. This driver comes from the Linux kernel.
Based on kernel v4.4
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch adds support for the Toshiba TC358767 eDP bridge,
connected via DPI.
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The i.MX specific DI_MODE VPL ioctl already allows to query the encoder
input bus format. This patch also allows non-i.MX specific encoder drivers
to report their input bus format.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
V4L2 pixel formats are supposed to describe video frames in memory. To
describe the pixel format on the hardware bus between display interface
and encoders, use media bus formats, which are more expressive.
This allows to get rid of the custom GBR24 and LVDS666 fourccs.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The phy_device_create() function makes all necessary phydev initialization
so we can drop phydev->pause and phydev->link initialization in
the of_phy_register_fixed_link() function.
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
So far we relied on the clock rate as configured by reset default or
board code. Also we did not touch the symmetric mode bit. Use
the ONFI provided timing parameters to configure the clock rate for
the Nand controller. Also symmetric mode (EDO mode) when needed.
This is done for v2 controllers (i.MX25/35) only, other controllers
need other setup code.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
preset_v1_v2() still needs to distinguish between v1 and v2 and
the shared code is not very big. Since we need another v2 only
addtion in the next patch split the function into a v1 and a v2
specific function.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Ported from Linux commit 974647e:
| Add a converter to retrieve NAND timings from an ONFI NAND timing mode.
| At the moment, only SDR NAND timings are supported.
|
| Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
| Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
An MC13892CJ having REV[4:0]=0x14 can be found in the kindle-d01100.
Add the revision to the list to support this device.
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch is based on kernel patch 0691bb1b5a1865b3bbc9b7ce6e26eff546abb1cf
by Dinh Nguyen <dinguyen@altera.com>.
The C0(mpu_clk), C1(main_clk), and C2(dbg_base_clk) outputs from the main
PLL go through a pre-divider before coming into the system. These registers
were hidden for the CycloneV platform, but are now used for the ArriaV
platform.
This patch updates the clock driver to read the div-reg property for the
socfpga-periph-clk clocks.
Note: The registers used for the div-reg property are not documented but
set by the preloader.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The i.MX31 SPI interface was refered by freescale as spi_ver_0_4 in one
of their older vendor extended linux releases. spi_ver_0_4 differs only
in minor aspects to spi_ver_0_7 (i.MX35) which is already supported by
barebox.
Regarding barebox, the differences boil down to the location and length
of the CHIP SELECT and BIT COUNT/BURST LENGTH elements of CONREG. The
spi_ver_0_4 variant is limited to single word bursts with a maximum of
32 bits_per_word.
Add support for the i.MX31 SPI interface to the barebox spi_ver_0_7
implementation.
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The preset SPI frequency for mc13xxx PMIC introduced with patch 6e18b3a48e
("mc13xxx: Define maximum SPI clock frequency global to driver") is not
desirable or working on all boards. Provide a possibility to override
the default SPI max_speed_hz from board code.
Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The majority of the stuff currently in include/boot.h is about bootm
code implemented common/bootm.c. To be more consistent move it to a
new file include/bootm.h.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
ERR_CAST exists to return error pointers as error pointers without
casting them explicitly to the correct pointer type.
Also this Fixes:
In function 'alloc_nand_resource':
warning: return makes pointer from integer without a cast
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Xzalloc never returns NULL, so this check does not bring any value.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Follow Linux Kernel change introduced in
bdb0066df96e74a4002125467ebe459feff1ebef and avoid device/driver model
for DT-based platforms. See the original kernel commit for the rationale.
Also make syscon_base_lookup_by_pdevname() behave the same way as its
kernel counterpart in the case whern "property" argument is NULL.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
On platforms that mix dedicated IP block register space with
miscellaneous registers it is necessary to share register window between
syscon and dedicated IP block driver. Calling request_iomem_region()
implies exclusive ownership of the region, which, in the case above
could not happen.
This change also makes this driver's behaviour to that of its Linux
kernel counterpart.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Fixing the i.MX6 specific issue this way breaks things on CLPS711x
target. Better fix for the problem is to follow this patch.
This reverts commit c203958f3b.
Reported-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In case of an empty 'brightness-levels' array in the device tree or
a non empty one but containing only zeros the value of
'pwm_backlight->scale' would remain 0 possibly causing a division by zero
in the function compute_duty_cycle().
To fix it we check the computed value in case we actually have a 'brightness-levels'
array in the device tree otherwise we implicitly assume a simple array
of the form { 0, 1, 2, ..., 100 } and set the scale to 100.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We use the local variable 'length' instead of the lengthy
'pwm_backlight->backlight.brightness_max' within pwm_backlight_parse_dt().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The field pwm_backlight->backlight.brightness_max should be the maximum
allowed brightness value for the backlight, not the max index of the
array 'pwm_backlight->levels[]'.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
In the function pwm_backlight_parse_dt() the last iteration of the for
loop accessed memory past the end of the array 'pwm_backlight->levels[]'
because of a wrong test ( '<=' instead of '<').
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When no new packets have arrived we want to return to the caller
as soon as possible to give other network controllers the chance
to receive packets. With the current USB bulk message timeout of
one second other network controllers do not work properly whenever
the USB network controller is active.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This reverts commit 8a6896971d.
With this patch it's no longer possible to call detect on the
physical device which is necessary for example to make environment
on MMC work. Unlike the commit message for 8a6896971d claims
mci_detect_card() is not called from mci_register().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is necessary to prevent the imx_nand_bbm command to bail out
on ECC errors which leaves the device without BBT.
Also simplify buffer management: Use on-stack buffer instead of malloc.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The state framework grew organically over the time. Unfortunately the
architecture and abstractions disappeared during this period.
This patch refactors the framework to recreate the abstractions. The
main focus was the backend with its storage. The main use-case was to
offer better NAND support with less erase cycles and interchangeable
data formats (dtb,raw).
The general architecture now has a backend which consists of a data
format and storage. The storage consists of multiple storage buckets
each holding exactly one copy of the state data. A data format describes
a data serialization for the state framework. This can be either dtb or
raw. A storage bucket is a storage location which is used to store any
data. There is a (new) circular type which writes changes behind the
last written data and therefore reduces the number of erases. The other
type is a direct bucket which writes directly to a storage offset for
all non-erase storage.
Furthermore this patch splits up all classes into different files in a
subdirectory.
This is currently all in one patch as I can't see a good way to split
the changes up without having a non-working state framework in between.
The following diagram shows the new architecture roughly:
.----------.
| state |
'----------'
|
|
v
.----------------------------.
| state_backend |
|----------------------------|
| + state_load(*state); |
| + state_save(*state); |
| + state_backend_init(...); |
| |
| |
'----------------------------'
| | The format describes
| | how the state data
| '-------------> is serialized
| .--------------------------------------------.
| | state_backend_format <INTERFACE> |
| |--------------------------------------------|
| | + verify(*format, magic, *buf, len); |
| | + pack(*format, *state, **buf, len); |
| | + unpack(*format, *state, *buf, len); |
| | + get_packed_len(*format, *state); |
| | + free(*format); |
| '--------------------------------------------'
| ^ ^
| * *
| * *
| .--------------------. .--------------------.
| | backend_format_dtb | | backend_format_raw |
| '--------------------' '--------------------'
|
|
|
v
.----------------------------------------------------------.
| state_backend_storage |
|----------------------------------------------------------|
| + init(...); |
| + free(*storage); |
| + read(*storage, *format, magic, **buf, *len, len_hint); |
| + write(*storage, *buf, len); |
| + restore_consistency(*storage, *buf, len); |
'----------------------------------------------------------'
|
The backend storage is responsible to manage multiple
data copies and distribute them onto several buckets.
Read data is verified against the given format to
ensure that the read data is correct.
|
|
|
|
|
v
.------------------------------------------.
| state_backend_storage_bucket <INTERFACE> |
|------------------------------------------|
| + init(*bucket); |
| + write(*bucket, *buf, len); |
| + read(*bucket, **buf, len_hint); |
| + free(*bucket); |
'------------------------------------------'
^ ^ ^
* * *
* * *
A storage bucket represents*exactly one data copy at one
data location. A circular b*cket writes any new data to
the end of the bucket (for *educed erases on NAND). A
direct bucket directly writ*s at one location.
* * *
* * *
* * *
.-----------------------. * .-------------------------.
| backend_bucket_direct | * | backend_bucket_circular |
'-----------------------' * '-------------------------'
^ * ^
| * |
| * |
| * |
| .-----------------------. |
'--| backend_bucket_cached |---'
'-----------------------'
A backend_bucket_cached is a transparent
bucket that directly uses another bucket
as backend device and caches all accesses.
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
usb_control_msg() and usb_bulk_msg() have a timeout parameter. Honour
this in the ehci driver instead of using a default timeout.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch adds parsing basic devicetree options for the smc911x driver:
reg-io-width, reg-shift and smsc,force-(in/ex)ternal-phy, which makes
driver usable for most DTS-based boards.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
priv->buswidth expects IORESOURCE_MEM_* macros which are not
identical to the integer byte bus width, so calling
dm9000_setup_buswidth() for the platform_data case is wrong.
fixes: d818f02 net: dm9k: add device tree support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported by: 张忠山 <zzs213@126.com>
if (A) {
if (!B)
return C;
return D;
}
return C;
can be simplified to:
if (A && B)
return D;
return C;
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Move int_sqrt() out of drivers/video/edid.c so that it is availible to
other parts of Barebox.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Added support to update UBI static volumes in barebox.
This is mainly realized with adding the ioctl UBI_IOCVOLUP.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The actual work in the wear leveling code is done in a separate thread.
Since we do not have threading so far we did not do any of the queued
work. Change this by calling the worker function synchronously.
With this barebox now can write a fastmap on a freshly ubiformated
device.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When moving a PEB the leb_write_trylock() function is called.
As the function never returns 0 UBI will end up in an endless
loop.
Noticed the issue when fastmap has been enabled and data is beeing copied
several times to a UBI volume. When UBI tries to move the anchor PEB,
the issue comes up.
The leb_write_trylock() is now equal to the leb_write_lock().
But kept it for easier maintaince in future when syncing with
kernel.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
priv->buswidth expects IORESOURCE_MEM_* macros which are not
identical to the integer byte bus width, so calling
dm9000_setup_buswidth() for the platform_data case is wrong.
fixes: d818f02 net: dm9k: add device tree support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported by: 张忠山 <zzs213@126.com>
The "fsl,spi-num-chipselects" property will be marked obsolete soon.
This patch updates the driver to be ready to such changes.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
So far we relied on the default timing values which are rather slow.
This patch adds the timing setup functions from the kernel. Tested
on i.MX6 with a AMD/Spansion S34ML08G2 and a Micron MT29F32G08ABAAAWP.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Make the ONFI function hooks available after nand_scan_ident() but
before nand_scan_tail(). Based on the kernel commit:
4204ccc mtd: set ONFI nand's default hooks in nand_set_defaults()
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Commit 81737c1d43 (mtd: Fix erasing of devices >4GiB) changed the
prototype of the erase function, but fogot to fix up the stub function
used when no MTD write support is built in.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This driver uses private includes from the imx6 architecture.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This file doesn't hold any content any more, so there is no
need to include it.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
On some NAND chips the driver uses a ECC size that is not dividable by
the number of chunks per page which means a single chunk cannot be read.
Disable the subpage feature for these NANDs. This is quite unfortunate
since the subpage feature really speeds up scanning NAND chips.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>