9
0
Fork 0
Commit Graph

3377 Commits

Author SHA1 Message Date
Harald Welte 862064ee4f eeprom/at25: parse partitions from device tree
Unlike at24 (I2C), the at25 (spi) EEPROM driver doesn't check if the
device tree node contains partition definitions.  This means that one
for example cannot have bootstate partitions on an at25 EEPROM, while it
works on an at24 EEPROM.

This patch adds device tree based partition support to the at25 driver.

Signed-off-by: Harald Welte <laforge@gnumonks.org>
2016-02-17 20:04:16 +01:00
Harald Welte 4e4776272a OWHW: Support AT24CM02 EEPROM 2015-11-01 23:19:08 +01:00
Jan Luebbe 8d95a37cae fixup! davinci_nand: add support for the NAND controller 2015-07-30 17:20:33 +02:00
Jan Luebbe fdb5835c72 fixup! watchdog: add davinci watchdog driver 2015-07-30 17:20:32 +02:00
Jan Luebbe 7a526685a8 i2c: gpio: add bus recovery support
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-30 16:46:27 +02:00
Jan Luebbe 39e4db8376 i2c: algo-bit: check if the bus is busy
If we have a timeout while waiting, try to recover.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-30 16:46:27 +02:00
Jan Luebbe 8127dfdaa1 i2c: algo-bit: fix debug code
Replace jiffies from kernel code with get_time_ns. The flags variable
used in the readbytes debug output does not exist.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-30 16:46:27 +02:00
Jan Luebbe af26985016 i2c-omap: add bus recovery support
This is based on commit 9dcb0e7b999db6c420c70fd32497a979a044fcdf from
the kernel with some additional fixes.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-30 16:46:27 +02:00
Jan Luebbe 96617c5ef3 i2c-omap: clear ARDY twice
This implements the fix from the kernel commit
4cdbf7d346e7461c3b93a26707c852e2c9db3753.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-30 16:46:27 +02:00
Jan Luebbe 21203581e7 i2c: add bus recovery infrastructure
This is based on the code introduced to the kernel in
5f9296ba21b3c395e53dd84e7ff9578f97f24295.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-30 16:46:27 +02:00
Jan Luebbe d7c8571e2e at24: support write-protect GPIO
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-07-03 14:41:47 +02:00
Jan Luebbe 7bd41df8cd spi: only register enabled child nodes
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-06-14 12:17:09 +02:00
Jan Luebbe cda1089054 i2c: only register enabled child nodes
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-06-14 12:17:09 +02:00
Jan Luebbe 5471ece663 of/base: fix typo
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-06-14 12:17:08 +02:00
Jan Luebbe 1fa39e6c9d davinci_emac: add support for version 1 2015-06-14 12:17:07 +02:00
Jan Luebbe f6e1175934 davinci_nand: add support for the NAND controller
This driver is based on the Linux driver (v4.0).

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-06-14 12:17:07 +02:00
Jan Luebbe d24cfe2728 watchdog: add davinci watchdog driver
This driver is based on the Linux driver (v4.0).

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-06-14 12:17:07 +02:00
Jan Luebbe f14b51e950 partition: do not overwrite an existing DT node pointer
This is necessary to find EEPROM devices using the device tree nodes.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
2015-06-14 12:17:07 +02:00
Sascha Hauer 9ffd3d0376 mtd: ubi: create device with persistent names
UBI devices used to show up with a dynamically assigned number
which is bad for scripting. After a 'ubiattach' a script cannot
know the number of the ubi to continue with. Change this to use
the parent mtd name and extend it with ".ubi".

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:42:33 +02:00
Sascha Hauer db0d4ccd56 mtd: ubi: Let ubidetach take mtd as argument
The ubi number is a dynamically assigned number, so once multiple
ubis are attached, scripts cannot know the ubi number they want
to detach anymore. Convert the ubidetach command to take the mtd
device file instead which is the same argument that was previously
passed to ubiattach.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:42:33 +02:00
Uwe Kleine-König 25ce695b54 bootstate: probe bootstate later
state must be loaded after the nand driver, otherwise it fails because the
backend is missing. For similar reasons bootstate must come after state.
Move them to the late stage until barebox can do deferred probing.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-10 13:42:33 +02:00
Marc Kleine-Budde 6a11cd1539 bootstate: add framework for redundant boot scenarios
There are several use cases where a redundant Linux system is needed. The
barebox,bootstate framework provides the building blocks to model different
use cases without the need to start from the scratch over and over again.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-06-10 13:42:33 +02:00
Sascha Hauer e4cabc3d89 blspec: automatically append bootargs
When bootloader spec is used to boot devices it is often desirable
to boot the same image from different media. Since the fs images
need to contain the root= parameters to tell Linux where to boot
from the images can't be identical on different media.

This patch changes this by introducing a 'appendroot' option for
bootloader spec. If set to true, barebox will construct a Linux
commandline option for the device the bootloader spec entry is found
on.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:42:33 +02:00
Uwe Kleine-König 57bce3d6cb state: return -EPROBE_DEFER if the backend isn't available 2015-06-10 13:36:21 +02:00
Marc Kleine-Budde 827421e7d5 state: backend: support phandle and of_path references
This patch improves the backend property, it can be either a phandle or a
of_path. During probe() of the state driver the backend property is
dereferenced and the resulting of_path is saved in the state context. In a
later patch it will be used to generate a phandle reference to the backend
during DT fixup.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-10 13:35:26 +02:00
Robert Schwebel 92b7939211 i2c: omap: fix i2c bus number output
When probing from devicetree, the output for several i2c host
controllers prints out a bus number of -1:

i2c-omap 44e0b000.i2c: bus -1 rev0.11 at 400 kHz
i2c-omap 4802a000.i2c: bus -1 rev0.11 at 400 kHz
i2c-omap 4819c000.i2c: bus -1 rev0.11 at 400 kHz

The call to i2c_add_numbered_adapter() in probe finds out the next free
bus number, so we move the output to a location where the number is
already determined.

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-03 09:56:07 +02:00
Jan Luebbe 9bf7d3b281 gpio-davinci: gpio get should return 0 or 1
Returning other values causes problems for client code which wants to
perform calculations with the returned value.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-01 14:07:29 +02:00
Sascha Hauer f13f1c269e Merge branch 'pu/am335x' 2015-05-28 08:27:02 +02:00
Sascha Hauer 4de5f732c0 Merge branch 'for-next/of-device-id' 2015-05-06 21:36:13 +02:00
Sascha Hauer 67e4e8c056 Merge branch 'for-next/mvebu' 2015-05-06 21:36:13 +02:00
Sascha Hauer 3975737a7d Merge branch 'for-next/misc' 2015-05-06 21:36:13 +02:00
Sascha Hauer 4a854c9f49 Merge branch 'for-next/imx' 2015-05-06 21:36:12 +02:00
Sascha Hauer 389218585a Merge branch 'for-next/defer' 2015-05-06 21:36:12 +02:00
Sascha Hauer c05380f61e net: phy: Do not double remove phy device
This fixes: 80264a8 driver: Call bus->remove instead of driver->remove

On mvebu it happens that:

Upon device shutdown, when iterating through the active device list,
the phy0 device is removed before mdio-mvebu. Then, when the mdio bus
device is removed, the phy0 device is removed again, here:

mdio_bus_remove(on mdio-mvebu)
  mvebu_mdio_remove
    mdiobus_unregister
      unregister_device
        mdio_bus_remove(on phy0)

Fix this by setting the mdio busses phy_map[phy->addr] to NULL when
unregistering the phy device, so that mdiobus_unregister no longer
finds a valid phy_device when iterating over the busses device list.

Reported-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
2015-05-05 13:53:15 +02:00
Steffen Trumtrar 10bb13e7fd usb: increase USB_CNTL_TIMEOUT to match linux
USB requests should be processed within a timeframe of 5s.
The linux kernel also uses this timeout value for the control packets.

For the musb the increase in timeout helps successfully probing USB devices
(at least on one test hardware), but on the other hand doesn't slow down the
system, if there are no devices, i.e. the timeout never hits. That means,
that the USB core correctly aborts instead of timing out.
Why and how the 100ms was chosen in the first place, can not be deduced from
the git history, just that it seems to work fine for most boards.

Change USB_CNTL_TIMEOUT to 5000ms and replace all occurences of
	`USB_CNTL_TIMEOUT * x`
with just
	`USB_CNTL_TIMEOUT`,
as the timeout is now large enough without it.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-04 09:23:08 +02:00
Marc Kleine-Budde 6da925f87c mtd: of_mtd_fixup(): fix given DT not the default one
We have to start searching for the mtd node starting in the given root node not
the defaukt (= barebox internal) one. This means the internal DT is always
fixed up. This leads to booting not fixed up DT when using external DTs.

This patch fixes the problem.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-01 08:40:44 +02:00
Markus Pargmann d098f2cf6f net: fec: Fix RGMII-ID
RGMII-ID just defines transmitter internal delays. Otherwise it is the
same as RGMII. As the differences only influence the behaviour of the
phy, the fec driver should handle it the same way as RGMII.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-01 08:38:42 +02:00
Lucas Stach f6842f2e8b PCI: imx6: simplify config access code
The PCI core fills in the primary bus number, so there is no
need to walk up the PCI hierarchy in the driver manually.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-01 08:37:40 +02:00
Lucas Stach cbc2492621 PCI: fill in bus primary field
This was erroneously left uninitialzed as nothing was using it.
The i.MX6 PCI driver needs this to be filled properly to decide
if a config space access is allowed for a specific devfn.

This fixes PCI enumeration on the Gateworks GW54xx board.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-01 08:37:19 +02:00
Lucas Stach 2a8bc957a7 PCI: register and active bridge device before proceeding to scan
The bridge device needs to be registered and activated before
the scanning can proceed, as the bridge is the parent for other
devices.

This fixes a NULL ptr derefernce when scanning PCI hierarchies
with bridges behind bridges.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-01 08:37:19 +02:00
Antony Pavlov 377d261708 of: use 'const void *' for struct of_device_id.data
Since 2011 barebox' of_device_id struct uses unsigned long type for data field:

    struct of_device_id {
            char *compatible;
            unsigned long data;
    };

Almost always struct of_device_id.data field are used as pointer
and need 'unsigned long' casting.

E.g. see 'git grep -A 4 of_device_id drivers/' output:

    drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = {
    drivers/ata/sata-imx.c- {
    drivers/ata/sata-imx.c-         .compatible = "fsl,imx6q-ahci",
    drivers/ata/sata-imx.c-         .data = (unsigned long)&data_imx6,
    drivers/ata/sata-imx.c- }, {

Here is of_device_id struct in linux kernel v4.0:

    struct of_device_id {
            char name[32];
            char type[32];
            char compatible[128];
            const void *data;
    };

Changing of_device_id.data type to 'const void *data' will increase
barebox' linux kernel compatibility and decrease number of 'unsigned
long' casts.

Part of the patch was done using the 'coccinelle' tool with the
following semantic patch:

    @rule1@
    identifier dev;
    identifier type;
    identifier func;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type)
    + dev_get_drvdata(dev, (const void **)&type)
    ...>
    }
    @rule2@
    identifier dev;
    identifier type;
    identifier func;
    identifier data;
    @@
    func(...) {
    <...
    - dev_get_drvdata(dev, (unsigned long *)&type->data)
    + dev_get_drvdata(dev, (const void **)&type->data)
    ...>
    }

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-30 08:12:57 +02:00
Antony Pavlov 92207cde49 net: e1000: add HAS_DMA dependency
The e1000 driver uses the dma coherent functions
and thus can only be build for architectures implementing them.

Here is mips malta build error log:

  drivers/built-in.o: In function `e1000_transmit':
  drivers/net/e1000.c:(.text.e1000_transmit+0x80): undefined reference to
  `dma_sync_single_for_device'
  drivers/built-in.o: In function `e1000_poll':
  drivers/net/e1000.c:(.text.e1000_poll+0x60): undefined reference to
  `dma_sync_single_for_cpu'

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 20:03:48 +02:00
Sascha Hauer 0706fd366f net: cpsw: unregister device on remove callback
The CPSW uses DMA, so we should quiesce the device before leaving
barebox. This patch unregisters the CPSW properly on the device
remove callback. To do this we have to fix the error path in
cpsw_slave_setup, since this function can fail and we need a
known slave status in the remove function.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 12:59:44 +02:00
Sascha Hauer efe0fa9e92 net: phy: Add missing phy_unregister_device
The counterpart of phy_register_device is missing. Add it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 12:40:49 +02:00
Sascha Hauer e8388cbb37 usb: musb: set controller->priv pointer
This is used by the detect callback but never initialized.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 11:46:57 +02:00
Sascha Hauer 15e121ada5 usb: musb: dsps: Do not use priv pointer
Use container_of instead of dev->priv pointer. dev->priv is
used by the musb core layer (which maybe should not be the
case, but using container_of is good anyway).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 11:43:06 +02:00
Sascha Hauer 10e6930323 mtd: partition: Fix OF partition fixup
To get the number of address cells and size cells we have to use
the newly created partition node, not the parent device node. The
parent device node returns the address/size cells of the controller
node, not the partition node.

On an am335x machine this fixes the device tree passed to Linux.
The situation there is:
	...
	gpmc@50000000 {
		...
		#address-cells = <0x2>;
		#size-cells = <0x1>;
		ranges = <0x0 0x0 0x8000000 0x10000000>;
		...
		nand@0,0 {
			reg = <0x0 0x0 0x0>;
			#address-cells = <0x1>;
			#size-cells = <0x1>;
			...
			partition@7 {
				label = "system";
				reg = <0x220000 0x7de0000>;
			};
		};
	};

and without this patch barebox passes three bytes for
partition@7's reg property instead of only two which naturally
confuses Linux and yields to the system partition to start at 0
with a size of 0x220000.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2015-04-28 09:09:46 +02:00
Mayur Nande f25c987459 net: usb: asix: Add D-link DUB-E100 H/W Ver C1 support
Hello!

This patch adds support for USB ethernet adapter D-Link DUB-E100 H/W Rev C1. I tested this on
Beagleboneblack Rev A6A and our custom h/w based on i.mx6 Phytec phycore module. More
information about the adapter is here:
http://us.dlink.com/products/connect/high-speed-usb-2-0-fast-ethernet-adapter/

Signed-off-by: Mayur Nande <mayur.nande@medel.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-28 08:54:34 +02:00
Sebastian Hesselbarth 60f947b494 bus: mvebu-mbus: Convert mbus platform driver to direct driver
Registering mbus driver as platform driver is a little late for
some register accesses to work. We have to make sure boot-up
mbus windows are disabled early, so call mbus driver directly
from SoC init.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-27 08:09:35 +02:00
Sebastian Hesselbarth 5e58563159 bus: mvebu-mbus: Drop device reference
Prior converting mbus driver from a platform device back to directly
called SoC driver, drop the device_d reference and covert dev_foo to
pr_foo.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-27 08:09:35 +02:00