9
0
Fork 0
Commit Graph

4339 Commits

Author SHA1 Message Date
Andrey Smirnov 05f625a9e1 i.MX: esdhc: Request "per" clock explicitly
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 39f7a7ee8b i.MX: esdhc: Do not rely on CPU type for quirks
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 4ed5b778a5 i.MX: i2c: Add Vybrid support
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-11 08:07:00 +01:00
Andrey Smirnov a6cf6b3ff0 i.MX: i2c: Use read/write adapter functions
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 9d0b248bc4 i.MX: Add 'lpuart' serial driver
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 12a5342b02 i.MX: Add VF610 clock tree initialization code
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 674015bf83 i.MX: clk: Port imx_clk_mux_flags from Linux
Port imx_clk_mux_flags from Linux, to simplify clock code porting.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-11 08:07:00 +01:00
Andrey Smirnov c30a463d64 i.MX: clk: Port imx_check_clocks()
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 385bfcc86f i.MX: clk: Add IMX_PLLV3_USB_VF610 support
Add IMX_PLLV3_USB_VF610 PLLv3 types support clk-pllv3.c

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 3ae4754b51 i.MX: clk: Port imx_clk_gate2_cgr()
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov e187942b9a i.MX: Move clk code from 'mach-imx' to 'drivers'
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>
2017-01-11 08:07:00 +01:00
Andrey Smirnov 10a7436e51 clk: Port of_clk_set_defaults()
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>
2017-01-11 08:07:00 +01:00
Teresa Remmet fa9cc22e29 ubi: barebox: Remove character device flag from static volumes
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>
2017-01-11 08:06:48 +01:00
Teresa Remmet 55513dcec5 ubi: Add truncate callback
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>
2017-01-11 08:06:48 +01:00
Uwe Kleine-König 2862f95263 spi: mvebu: improve error reporting
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:53 +01:00
Uwe Kleine-König 7251966266 spi: mvebu: add LSB support
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:53 +01:00
Uwe Kleine-König 34e083ea64 spi: mvebu: use wait_on_timeout instead of a loop with udelay.
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>
2017-01-10 08:27:53 +01:00
Uwe Kleine-König dcb880cb85 spi: mvebu: only read from bus when data is needed
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>
2017-01-10 08:27:53 +01:00
Uwe Kleine-König 45791cc9db spi: mvebu: various non-critical improvements to armada_370_xp_spi_set_baudrate
- 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>
2017-01-10 08:27:53 +01:00
Uwe Kleine-König 1548f21bd2 spi: mvebu: make sure the value calculated for PSCL is also used
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>
2017-01-10 08:27:53 +01:00
Uwe Kleine-König 84d7f7d877 spi: mvebu: fix register macros for Armada 370/XP clock divider
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:53 +01:00
Uwe Kleine-König ef66d906a6 spi: mvebu: fix error handling for transfer problems
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>
2017-01-10 08:27:53 +01:00
Michael Grzeschik 5e887fa7a7 da9053: add dt_ids to be probed by devicetree
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>
2017-01-10 08:27:33 +01:00
Michael Grzeschik 6f20bcdb7b da9053: reset FAULTLOG after read
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>
2017-01-10 08:27:33 +01:00
Uwe Kleine-König 5c8251315b ata/ahci: simplify ahci_read_id
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>
2017-01-10 08:27:33 +01:00
Uwe Kleine-König fb28915aac ata: pata-imx: simplify assignment of device name
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>
2017-01-10 08:27:33 +01:00
Alexander Shiyan ba414897e8 mci: omap: Add devicetree options parsing by MCI core.
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>
2017-01-10 08:27:33 +01:00
Alexander Shiyan d5ceee45a3 gpio: gpio-74164: Add 74lvc594 ID
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>
2017-01-10 08:27:33 +01:00
Uwe Kleine-König d6fd3d914a mtd: m25p80: add support for Everspin MR25H40
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:33 +01:00
Ulrich Ölmann 520ac28b41 ubi: Only read necessary size when reading the VID header
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>
2017-01-10 08:27:33 +01:00
Sascha Hauer 9fe05e5ebc of: Use %pa to print resource_size_t type
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:33 +01:00
Sascha Hauer a478be1d5a mtd: peb: Fix format specifier
The correct format specifier for size_t is %zu. Use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:33 +01:00
Sascha Hauer fda5f54de8 mtd: peb: fix usage of uninitialized variable
'read' is used in an error message but never assigned a value to. Remove
the variable.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:33 +01:00
Sascha Hauer 0dff3e4627 input: Fix compiler warning
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>
2017-01-10 08:27:33 +01:00
Andrey Smirnov 28dde40d1a i2c-mux-pca954x: Add code to control reset line
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>
2017-01-10 08:27:33 +01:00
Andrey Smirnov c97fc31b8d gpio: Port SX150x driver from Linux
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>
2017-01-10 08:27:33 +01:00
Andrey Smirnov 8f154474fa regmap: Add regmap_write_bits() function
Add code implementing a simple version of regmap_write_bits().

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:33 +01:00
Christian Hemp 3807409640 mci: imx: Add imx6sx compatible
To let the driver probe on i.MX6SX and i.MX6UL.

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2017-01-10 08:27:23 +01:00
Jan Remmet 6ea19861a4 i.MX habv4: add RVT address for i.MX6UL
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>
2017-01-10 08:27:23 +01:00
Jan Luebbe 782f63f792 PWM: update enable status when using the internal API
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>
2017-01-10 08:27:23 +01:00
Jan Luebbe 34babf2121 video: IPU framebuffer: honor clock and enable polarities
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>
2017-01-10 08:27:23 +01:00
Philippe Leduc c6b10f69a9 i.MX: IPUv3: Add parallel display support
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>
2017-01-10 08:27:23 +01:00
Sascha Hauer 9da7e18573 spi: i.MX: reset controller on init
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>
2017-01-10 08:27:23 +01:00
Lucas Stach e9be2ee4cb net: e1000: don't try to register eeprom if MTD support is missing
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>
2017-01-09 13:41:12 +01:00
Philipp Zabel f49b415b92 of: base: add chosen node if it does not exist when adding initrd
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>
2017-01-09 13:41:12 +01:00
Uwe Kleine-König 76fd7b6404 spi: mvebu: fix baudrate selection for Armada 370/XP
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>
2016-12-07 18:21:21 +01:00
Uwe Kleine-König c524f7d1bb i2c: gpio: use dynamic bus number unconditionally
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>
2016-11-17 07:58:51 +01:00
Uwe Kleine-König 8303208e95 i2c: gpio: fix handling of return code of of_get_gpio
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>
2016-11-17 07:58:51 +01:00
Sascha Hauer 8eb1fb3519 Merge branch 'for-next/vybrid' 2016-11-14 12:37:20 +01:00
Sascha Hauer f55e379fca Merge branch 'for-next/state' 2016-11-14 12:35:52 +01:00
Sascha Hauer e173424741 Merge branch 'for-next/socfpga' 2016-11-14 12:35:50 +01:00
Sascha Hauer 2133f5b86f Merge branch 'for-next/pci' 2016-11-14 12:35:50 +01:00
Sascha Hauer efbcbb2193 Merge branch 'for-next/net' 2016-11-14 12:35:50 +01:00
Sascha Hauer bedee27beb Merge branch 'for-next/mvebu' 2016-11-14 12:35:50 +01:00
Sascha Hauer f772aa92c2 Merge branch 'for-next/misc' 2016-11-14 12:35:49 +01:00
Sascha Hauer 6b00efcb0f Merge branch 'for-next/imx' 2016-11-14 12:35:47 +01:00
Andrey Smirnov 764f84809f clk: Port clock dependency resolution code
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>
2016-11-14 08:58:01 +01:00
Andrey Smirnov 49877e3125 i.MX: Add pinctrl driver for VF610
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-14 08:58:01 +01:00
Andrey Smirnov a4e1f15b6b pinctrl: Add provisions to control GPIO pin direction
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>
2016-11-14 08:57:57 +01:00
Sascha Hauer f160f8636e of: of_find_path: Add support for new partition binding
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>
2016-11-11 09:54:42 +01:00
Sascha Hauer 1f2f980373 of: partitions: Support new binding
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>
2016-11-11 09:54:42 +01:00
Alexander Kurz 1c7cf80f75 mtd: spi-nor: add MX25U2033E
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>
2016-11-11 09:54:42 +01:00
Christian Hemp 7159d9d8e9 mtd: nand: nand_mxs: Fix readtotal calculation
The calculation of readtotal must be bit alligend. If not the bch core
finds bit flips in every page, because readtotal is too small.
This bug was mostly introduced since commit "51061a9 mtd: nand: nand_mxs:
Add subpage read support".

Tested with:
nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
S34ML08G2), 1024MiB, page size: 2048, OOB size: 128

nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron
MT29F4G08ABADAWP), 512MiB, page size: 2048, OOB size: 64

nand: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND
1GiB 3,3V 8-bit), 1024MiB, page size: 2048, OOB size: 64

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-11 09:54:42 +01:00
Sascha Hauer 0d68468c96 mtd: Make UBI detection more robust
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>
2016-11-11 09:54:42 +01:00
Daniel Schultz 6f58e5cac9 nand: imx6: Changed default NAND clock
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>
2016-11-11 09:54:13 +01:00
Ian Abbott c1c0203b68 net/designware: add explicit reset of {tx|rx}_currdescnum
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>
2016-11-09 09:09:14 +01:00
Ian Abbott 184ef5a1ff net: designware: Respect "bus mode" register contents on SW reset
"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>
2016-11-09 09:09:14 +01:00
Ian Abbott b0fabc5297 net/designware: Do not select MIIPORT for RGMII interface
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>
2016-11-09 09:09:14 +01:00
Ian Abbott db62ca84fb net/designware: Consecutive writes to the same register to be avoided
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>
2016-11-09 09:09:14 +01:00
Sascha Hauer ee69c58841 clk: add clock command completion
This adds tab completion for the clk_* commands.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-08 18:34:23 +01:00
Sascha Hauer aed902c6ee serial: i.MX: Add i.MX6ul support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-08 14:43:43 +01:00
Sascha Hauer 068267d554 pinmux: imx-iomux-v3: Add i.MX6ul support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-11-08 14:43:42 +01:00
Sascha Hauer 9549b10a7e net: phy: micrel: Do not overwrite reserved bits
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>
2016-11-08 12:54:21 +01:00
Steffen Trumtrar 9ec4f328f6 watchdog: add designware driver
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>
2016-11-03 07:13:18 +01:00
Lucas Stach 046c5fd251 PCI: split PCI hierarchy enumeration and config from device registration
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>
2016-11-03 07:12:10 +01:00
Lucas Stach 589b62ac9c PCI: align BAR address to BAR size
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>
2016-11-03 07:12:10 +01:00
Lucas Stach 18ee9aade8 PCI: align address range before scanning bridge
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>
2016-11-03 07:12:10 +01:00
Lucas Stach 9c29edf10b PCI: only check specific flag for 64bit BAR
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>
2016-11-03 07:12:10 +01:00
Lucas Stach a793b694be PCI: add some useful debug output
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>
2016-11-03 07:12:10 +01:00
Lucas Stach 86b716c06a net: e1000: set edev parent pointer
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>
2016-11-03 07:10:50 +01:00
Lucas Stach 8ecc3823cd net: e1000: fix i210 register remapping
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>
2016-11-03 07:08:28 +01:00
Uwe Kleine-König 6d6d5314fe pinctrl: mvebu: fix a comment about mv78460
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>
2016-10-21 09:18:37 +02:00
Sascha Hauer 82eb3dff10 of_path: handle no driver for device
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>
2016-10-20 09:31:15 +02:00
Sascha Hauer 70af08d863 state: driver: handle EPROBE_DEFER
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>
2016-10-20 09:31:11 +02:00
Uwe Kleine-König 11b7b33971 pinctrl: mvebu: sync mpp names to Linux 4.9-rc1
Linux changed several mpp names in commits:

	438881dfddb9 (pinctrl: mvebu: armada-370: fix spi0 pin description)
	bc99357f3690 (pinctrl: mvebu: armada-xp: remove non-existing NAND pins)
	80b3d04feab5 (pinctrl: mvebu: armada-xp: remove non-existing VDD cpu_pd functions)
	100dc5d84095 (pinctrl: mvebu: armada-{38x,39x,xp}: normalize naming of DRAM functions)
	7bd6a26db6f9 (pinctrl: mvebu: armada-{370,375,38x,39x}: normalize dev pins)
	dae5597f253a (pinctrl: mvebu: armada-{370,375,38x,39x,xp}: normalize TDM pins)
	d4974c16ed22 (pinctrl: mvebu: armada-{370,375}: normalize PCIe pins)
	f32f01e1ba6b (pinctrl: mvebu: armada-{370,375}: normalize audio pins)
	a361cbc575d6 (pinctrl: mvebu: armada-{370,xp}: normalize ethernet txclkout pins)
	bfacb5669474 (pinctrl: mvebu: armada-370: align VDD cpu-pd pin naming with datasheet)
	9e05db29e2ac (pinctrl: mvebu: armada-370: align spi1 clock pin naming)
	50a7d13d2410 (pinctrl: mvebu: armada-xp: rename spi to spi0)
	88b355f1e4e5 (pinctrl: mvebu: armada-xp: add spi1 function)
	fb53b61d7768 (pinctrl: mvebu: armada-xp: add nand rb function)
	b19bf3797679 (pinctrl: mvebu: armada-xp: add dram functions)

Adapt the barebox mvebu drivers accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-19 15:53:23 +02:00
Sascha Hauer 75ee6ab076 mtd: ubi: enable thread earlier
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>
2016-10-19 14:49:10 +02:00
Uwe Kleine-König 27974c3bae spi: mvebu: make more than one device on a bus work
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>
2016-10-19 12:13:49 +02:00
Antony Pavlov 9c4e30e445 of: fix typos
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-18 07:39:51 +02:00
Steffen Trumtrar bff18c2671 reset: import socfpga-reset driver from linux
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>
2016-10-18 07:39:02 +02:00
Yegor Yefremov 655b16187d ubi: fix spelling
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-12 08:51:54 +02:00
Sascha Hauer 57cebc46f7 mtd: ubi: Fix scrubbing during attach
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>
2016-10-11 08:44:12 +02:00
Sascha Hauer 440783f886 Merge branch 'for-next/usb' 2016-10-10 08:31:08 +02:00
Sascha Hauer 385c95c60b Merge branch 'for-next/ubi' 2016-10-10 08:31:08 +02:00
Sascha Hauer 64b164356a Merge branch 'for-next/mvebu' 2016-10-10 08:31:08 +02:00
Sascha Hauer b85e0cba7d Merge branch 'for-next/mtd' 2016-10-10 08:31:07 +02:00
Sascha Hauer bfdb14c7da Merge branch 'for-next/misc' 2016-10-10 08:31:07 +02:00
Sascha Hauer df75f19871 Merge branch 'for-next/imx' 2016-10-10 08:31:07 +02:00
Uwe Kleine-König 8aed8106c2 pinctrl: mvebu: armada-370 fix gpio name for mpp63
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>
2016-10-04 21:14:20 +02:00
Uwe Kleine-König 44eeb85eb1 pinctrl: mvebu: add newline to error message
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-04 21:14:20 +02:00
Uwe Kleine-König 84a4369d33 net/phy: marvell: fix error handling
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>
2016-10-04 08:15:01 +02:00
Lucas Stach efe3b512e5 video: tc358767: depend on EDID helpers
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>
2016-10-04 08:12:19 +02:00
Lucas Stach 5d60df68a0 mfd: syscon: drop EXPORT_SYMBOL for static function
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-04 08:12:18 +02:00
Lucas Stach 166709ab51 serial: arm_dcc: depend on !CPU_V8
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>
2016-10-04 08:12:18 +02:00
Sascha Hauer e21ddc6ec0 usb: imx-us-phy: implement notify_(dis)concect
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>
2016-09-29 14:30:48 +02:00
Sascha Hauer a44f222e09 usb: imx-us-phy: Convert driver to generic phy support
The generic phy layer now supports USB phys, so convert
the driver over to use it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-29 14:29:16 +02:00
Sascha Hauer 068bc903c1 phy: Add usb-nop-xceiv support
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>
2016-09-29 14:27:06 +02:00
Sascha Hauer 081554dca9 phy: Introduce to_usbphy conversion function
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>
2016-09-29 14:00:33 +02:00
Sascha Hauer 850557842f phy: Introduce of_phy_get_by_phandle
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>
2016-09-29 13:58:32 +02:00
Sascha Hauer 4ed80f0643 usb: imx-usb-phy: Drop unnecessary read/modify/write
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>
2016-09-29 13:57:37 +02:00
Sascha Hauer 7c9708a5c6 usb: ehci: forward phy given in registration data to host
Allow to pass a phy in the registration data and forward it to
the usb_host structure.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-29 13:57:14 +02:00
Sascha Hauer 0408cb01fa usb: Add usb phy to usb host
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>
2016-09-29 13:57:14 +02:00
Sascha Hauer 8ac094d346 usb: Use standard debug macro
Use standard pr_debug instead of homebrew USB_PRINTF

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-28 15:34:15 +02:00
Giorgio Dal Molin fc428987c8 mtd: ubi: add API call to rename volumes.
Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-27 08:15:32 +02:00
Sascha Hauer 29c844b965 mtd: ubi: remove now unused ioctls
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>
2016-09-27 08:15:32 +02:00
Uwe Kleine-König a1e19c94d1 firmware: altera-serial: simplify handling of optional gpio
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-27 08:10:10 +02:00
Uwe Kleine-König eb2b96d68a firmware: altera-serial: Make the driver match the dt binding documentation
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-27 08:10:10 +02:00
Steffen Trumtrar f89f1017a0 nand: denali: get rid of compile-time debug information
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>
2016-09-26 08:03:34 +02:00
Steffen Trumtrar a6c453168c nand: denali: use is_timeout in while loop
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>
2016-09-26 08:03:34 +02:00
Steffen Trumtrar acc6cc82a1 nand: denali: use correct interrupts in read_page
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>
2016-09-26 08:03:34 +02:00
Sascha Hauer 3209e4eaa8 mtd: imx-nand: Move v3 register definitions to include file
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>
2016-09-22 11:20:52 +02:00
Sascha Hauer 0f5b72a110 mtd: ubi: introduce barebox specific ioctl to get ubi_num
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>
2016-09-22 09:42:02 +02:00
Sascha Hauer 85dccb9298 mtd: ubi: Add API calls to create/remove volumes
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>
2016-09-22 09:39:55 +02:00
Uwe Kleine-König 1a43860506 net: mvneta: clean txdesc before usage
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>
2016-09-16 09:35:34 +02:00
Sascha Hauer f4714e5f6a Merge branch 'for-next/video' 2016-09-13 14:56:07 +02:00
Sascha Hauer 074a8fdc92 Merge branch 'for-next/socfpga' 2016-09-13 14:56:06 +02:00
Sascha Hauer 0e1892b2e9 Merge branch 'for-next/rockchip' 2016-09-13 14:56:05 +02:00
Sascha Hauer dd534571bd Merge branch 'for-next/misc' 2016-09-13 14:56:05 +02:00
Sascha Hauer b2c398f440 Merge branch 'for-next/imx' 2016-09-13 14:56:04 +02:00
Alexander Kurz 25be41232b ARM: i.MX drivers: enable i.MX50 where already supported
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>
2016-09-12 08:23:09 +02:00
Michael Olbrich faf2ec64e7 mci: mmci: Fix read FIFO handling
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>
2016-09-05 08:53:24 +02:00
Sascha Hauer b5952e8304 usb: i.MX chipidea: Enable VBUS regulator when needed
We should enable VBUS only in host mode, not unconditionally
during probe(). Fix that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-09-05 08:52:56 +02:00
Philipp Zabel 6ed5b755ba video/edid: Fix edid_to_display_timings error path
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>
2016-09-05 08:27:02 +02:00
Sascha Hauer b82ae64e47 usb: chipidea i.MX: Do not return unnecessary error
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>
2016-08-29 17:37:41 +02:00
Sascha Hauer ac20c4f03b video: backlight: fix the value of 'brightness_max'
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>
2016-08-29 17:36:36 +02:00
Wadim Egorov 62c8ce6c42 mci: dw_mmc: Add RK3288 compatible string
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>
2016-08-26 07:28:31 +02:00
Wadim Egorov 70abe9e13f clk: Add RK3288 clock driver
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>
2016-08-26 07:28:31 +02:00
Wadim Egorov 413a35395a clocksource: Add rk3288 timer driver
This driver comes from the u-boot (v2016.01).

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-26 07:28:31 +02:00
Andrey Gusakov 46e30c9ac0 video: tc358767: add eDP video encoder driver
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>
2016-08-25 08:28:40 +02:00
Philipp Zabel da03ce9c18 video: add VPL ioctl to get bus format
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>
2016-08-25 08:28:40 +02:00
Philipp Zabel 1be6d321ef video: switch to media bus formats
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>
2016-08-25 08:28:40 +02:00
Antony Pavlov d97eeac4e2 net: phy: of_phy_register_fixed_link(): drop redundant initialization
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>
2016-08-22 07:46:52 +02:00
Sascha Hauer a2b88410ea mtd: nand-imx: Optimize timing for i.MX25
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>
2016-08-18 16:17:04 +02:00
Sascha Hauer 5a9a69155c mtd: nand-imx: split preset_v1_v2 into two functions
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>
2016-08-18 16:17:03 +02:00
Sascha Hauer cae9515d05 mtd: nand: add ONFI timing mode to nand_timings converter
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>
2016-08-18 16:16:27 +02:00
Alexander Kurz d3c3e40355 mfd mc13xxx: add MC13892_REVISION_2_4
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>
2016-08-18 09:15:28 +02:00
Enrico Jorns 5679e3296f clk: socfpga: add divider registers to the main pll outputs
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>
2016-08-18 08:19:45 +02:00
Sascha Hauer 20eabbf251 Merge branch 'for-next/video-backlight' 2016-08-03 08:08:23 +02:00
Sascha Hauer 984f9c9925 Merge branch 'for-next/syscon' 2016-08-03 08:08:23 +02:00
Sascha Hauer 7a51da5ff1 Merge branch 'for-next/net' 2016-08-03 08:08:23 +02:00
Sascha Hauer b927df0329 Merge branch 'for-next/misc' 2016-08-03 08:08:23 +02:00
Sascha Hauer 14e04d019b Merge branch 'for-next/imx' 2016-08-03 08:08:23 +02:00
Sascha Hauer 94e7bdcd9a Merge branch 'for-next/boot' 2016-08-03 08:08:22 +02:00
Alexander Kurz 28a0baffb9 ARM i.MX31: add SPI support
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>
2016-08-03 07:30:41 +02:00
Alexander Kurz d8a7c4580b mc13xxx: make driver-provided SPI frequency overridable
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>
2016-08-03 07:30:40 +02:00
Alexander Kurz 741642a862 mtd: spi-nor: add new variants
Read access tested on W25Q20BW and MX25U4035.

Signed-off-by: Alexander Kurz <akurz@blala.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-08-03 07:28:58 +02:00
Sascha Hauer 4d85cb974a include: Move bulk of boot.h to bootm.h
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>
2016-07-26 08:31:31 +02:00
Sascha Hauer 370e90bac9 nand: mrvl: use ERR_CAST() for returning error pointers
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>
2016-07-25 10:26:50 +02:00
Andrey Smirnov 6f239e487c mfd: syscon: Use IOMEM instead of explicit cast
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-19 06:49:50 +02:00
Andrey Smirnov a3eae6db13 mfd: syscon: Don't check xzalloc return for NULL
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>
2016-07-19 06:49:50 +02:00
Andrey Smirnov b313346b1a mfd: syscon: Decouple syscon interface from platform devices
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>
2016-07-19 06:49:50 +02:00
Andrey Smirnov 2ccd60013d mfd: syscon: Don't call request_iomem_region()
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>
2016-07-19 06:49:20 +02:00
Andrey Smirnov 26384d071d Revert "syscon: Decrease driver registration priority"
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>
2016-07-19 06:49:20 +02:00
iw3gtf@arcor.de 832f9fec6a video/backlight-pwm: properly handle the case of an empty 'brightness-levels' in the device tree.
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>
2016-07-15 08:07:14 +02:00
iw3gtf@arcor.de ca497ce66d video/backlight-pwm: code readability improvement.
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>
2016-07-15 08:07:14 +02:00
iw3gtf@arcor.de 87c6a88f2a video/backlight-pwm: fix the value of 'brightness_max'.
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>
2016-07-15 08:07:14 +02:00
iw3gtf@arcor.de c27b1a93ce video/backlight-pwm: fixed a loop index going out of range.
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>
2016-07-15 08:07:14 +02:00
Andrey Smirnov 1f3b611979 imx_thermal: Remove leftover debug output
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-15 08:00:36 +02:00
Sascha Hauer ffc5fe0723 net: usb: use minimum timeout when polling for new packets
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>
2016-07-14 22:18:45 +02:00
Sascha Hauer 7be6d29724 Revert "mci: imx-esdhc: Remove excess function"
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>
2016-07-14 14:37:51 +02:00
Sascha Hauer ca95c2bab9 Merge branch 'for-next/video' 2016-07-11 07:58:34 +02:00
Sascha Hauer 50543054eb Merge branch 'for-next/ubi' 2016-07-11 07:58:34 +02:00
Sascha Hauer e77acea709 Merge branch 'for-next/state' 2016-07-11 07:58:34 +02:00
Sascha Hauer bb73cb9427 Merge branch 'for-next/mtd' 2016-07-11 07:58:33 +02:00
Sascha Hauer f64075972b Merge branch 'for-next/misc' 2016-07-11 07:58:33 +02:00
Sascha Hauer e54183d6d4 Merge branch 'for-next/mips' 2016-07-11 07:58:33 +02:00
Sascha Hauer e2da792a52 Merge branch 'for-next/imx' 2016-07-11 07:58:33 +02:00
Uwe Kleine-König 034c16f54e mtd: nand: imx-bbm: use raw reading when checking for factory BBM
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>
2016-07-11 07:48:42 +02:00
Markus Pargmann c999b507da state: Refactor state framework
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>
2016-07-08 08:59:31 +02:00
Lucas Stach 5455354846 clk: fix misleading indenting
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-07 09:36:49 +02:00
Lucas Stach 81a54afd22 USB: gadget: composite: avoid possible NULL ptr dereference
Check if g is valid before trying to dereference it.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-07 09:35:53 +02:00
Antony Pavlov adce981d24 of: base: import of_get_cpu_node() from linux-v4.7-rc2
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-07 09:29:54 +02:00
Sascha Hauer 04f3cde151 usb: ehci: honour timeout value
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>
2016-07-06 11:15:39 +02:00
Alexander Shiyan e5c6340f42 net: smc911x: Add parsing devicetree options
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>
2016-07-05 09:02:41 +02:00
Sascha Hauer 992794d0d4 eeprom: at24: Use xasprintf for small allocation
The code for error checking shouldn't be bigger than the allocated
string.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-05 09:02:40 +02:00
Sascha Hauer 3b393a43af net: dm9k: Fix buswidth setting for platform data probe
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>
2016-07-05 09:02:40 +02:00
Uwe Kleine-König c4fa1cb0f6 mtd: nand: simplify nand_block_checkbad
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>
2016-07-05 09:02:40 +02:00
Alexander Shiyan c672fda23a input: Compile keymap only if necessary
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-05 09:02:37 +02:00
Andrey Smirnov aa750244ee video/edid: Move int_sqrt() out
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>
2016-06-30 08:33:53 +02:00
Sascha Hauer a7f955fc98 eeprom: at24: fix discarding const qualifier
fixes:
at24.c:434:10: warning: assignment discards 'const' qualifier from pointer
target type

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-28 07:43:35 +02:00
Teresa Remmet c087e0804f mtd: UBI: Add support for updating static volumes
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>
2016-06-28 07:31:37 +02:00
Sascha Hauer 94d8236556 mtd: ubi: actually do work in wear leveling code
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>
2016-06-28 07:30:04 +02:00
Teresa Remmet 8b765bebb6 mtd: ubi: Fix endless loop when moving PEB
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>
2016-06-28 07:30:00 +02:00
Sascha Hauer 1ebb663db9 net: dm9k: Fix buswidth setting for platform data probe
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>
2016-06-28 07:27:08 +02:00
Alexander Shiyan d479f15f24 spi: imx: Remove the use of property "fsl, spi-num-chipselects"
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>
2016-06-27 08:45:49 +02:00
Sascha Hauer 1daa3bc8dc mtd: nand_mxs: Setup timing
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>
2016-06-24 11:44:26 +02:00
Sascha Hauer 6a175cb3ff mtd: nand: Set ONFI function hooks earlier
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>
2016-06-24 11:44:26 +02:00
Lucas Stach 8ef4478c37 mtd: fix mtdraw_erase stub signature
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>
2016-06-24 08:23:33 +02:00
Lucas Stach ed9e5ff965 aiodev: imx_thermal: depend on MACH_IMX6
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>
2016-06-23 08:15:10 +02:00
Lucas Stach f569157cbf aiodev: imx_thermal: remove empty include
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>
2016-06-23 08:15:10 +02:00
Sascha Hauer 13ef2b2490 mtd: nand: gpmi: Use subpage reads only on suitable NAND chips
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>
2016-06-22 08:45:45 +02:00