Skip to contentSkip to conversation

dm: omap: Provide access to driver model for am335x, and move boards

PATCH New Simon Glass 3 participants 38 messages Sep 22, 2014 – Oct 24, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover dm: omap: Provide access to driver model for am335x, and move boards

This series adjusts the serial and GPIO drivers, used by Beaglebone for example, to work with driver model. Since there are still boards using these drivers but not driver model, this adds new functionality rather than replacing what exists.

Several patches tweak and fix the existing driver model serial and GPIO implementation.

There are two Beaglebone Black configurations:

- Device tree control with verified boot
- No device tree control

The first uses device tree to select the serial console and provide information needed by the serial driver (similar to how things work on Tegra). The second uses platform data provided by a common board file.

Both are converted, so this is a good example of how to support both device tree and platform data if needed.

Simon Glass (14):
dm: gpio: Support numbered GPIOs
dm: serial: Reset the watchdog while waiting in getc()
dm: serial: ns16550: Correct logic for checking for character
dm: ns16550: Use an address instead of a pointer for the uart base
dm: ns16550: Correct the probe logic for platform data
dm: serial: Support CONFIG_CONS_INDEX if available
dm: dts: omap: Select correct console for beaglebone
dm: omap: gpio: Put _get_gpio_value() logic into its own function
dm: omap: gpio: Support driver model
dm: am33xx: Provide platform data for GPIOs
dm: am33xx: Provide platform data for serial
dm: omap: serial: Add driver model support
dm: am335x: Remove serial options from CONFIG_SYS_EXTRA_OPTIONS
dm: am33xx: Move to driver model for GPIO and serial

 arch/arm/cpu/armv7/am33xx/board.c        |  61 +++++++
 arch/arm/dts/am335x-bone-common.dtsi     |   4 +
 arch/arm/include/asm/omap_gpio.h         |  19 +-
 configs/am335x_boneblack_defconfig       |   2 +-
 configs/am335x_boneblack_vboot_defconfig |   2 +-
 drivers/gpio/gpio-uclass.c               |  37 ++--
 drivers/gpio/omap_gpio.c                 | 297 +++++++++++++++++++++++++++----
 drivers/mmc/omap_hsmmc.c                 |  15 +-
 drivers/serial/Makefile                  |   1 +
 drivers/serial/ns16550.c                 |  13 +-
 drivers/serial/serial-uclass.c           |  16 +-
 drivers/serial/serial_omap.c             |  49 +++++
 include/configs/ti_am335x_common.h       |  11 ++
 include/ns16550.h                        |   2 +-
 14 files changed, 465 insertions(+), 64 deletions(-)
 create mode 100644 drivers/serial/serial_omap.c
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#1 lore raw

PATCH 1/14 dm: gpio: Support numbered GPIOs

At present banks must be named and it is not possible to refer to GPIOs by number in driver model. Some boards use numbering - e.g. OMAP. It is fairly easy to support by detecting the absense of a bank name (which starts with a letter).

Add support for numbered GPIOs in addition to the existing bank support.

---

 drivers/gpio/gpio-uclass.c | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)
drivers/gpio/gpio-uclass.c +25 -12
index f1bbc58..a5ffd85 100644
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <asm/gpio.h>
+#include <linux/ctype.h>
 
 /**
  * gpio_to_device() - Convert global GPIO number to device, number
@@ -43,35 +44,47 @@ static int gpio_to_device(unsigned int gpio, struct udevice **devp,
 int gpio_lookup_name(const char *name, struct udevice **devp,
 		     unsigned int *offsetp, unsigned int *gpiop)
 {
-	struct gpio_dev_priv *uc_priv;
+	struct gpio_dev_priv *uc_priv = NULL;
 	struct udevice *dev;
+	ulong offset;
+	int numeric;
 	int ret;
 
 	if (devp)
 		*devp = NULL;
+	numeric = isdigit(*name) ? simple_strtoul(name, NULL, 10) : -1;
 	for (ret = uclass_first_device(UCLASS_GPIO, &dev);
 	     dev;
 	     ret = uclass_next_device(&dev)) {
-		ulong offset;
 		int len;
 
 		uc_priv = dev->uclass_priv;
+		if (numeric != -1) {
+			offset = numeric - uc_priv->gpio_base;
+			/* Allow GPIOs to be numbered from 0 */
+			if (offset >= 0 && offset < uc_priv->gpio_count)
+				break;
+		}
+
 		len = uc_priv->bank_name ? strlen(uc_priv->bank_name) : 0;
 
 		if (!strncasecmp(name, uc_priv->bank_name, len)) {
-			if (strict_strtoul(name + len, 10, &offset))
-				continue;
-			if (devp)
-				*devp = dev;
-			if (offsetp)
-				*offsetp = offset;
-			if (gpiop)
-				*gpiop = uc_priv->gpio_base + offset;
-			return 0;
+			if (!strict_strtoul(name + len, 10, &offset))
+				break;
 		}
 	}
 
-	return ret ? ret : -EINVAL;
+	if (!dev)
+		return ret ? ret : -EINVAL;
+
+	if (devp)
+		*devp = dev;
+	if (offsetp)
+		*offsetp = offset;
+	if (gpiop)
+		*gpiop = uc_priv->gpio_base + offset;
+
+	return 0;
 }
 
 /**
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#2 lore raw

PATCH 1/14 dm: gpio: Support numbered GPIOs

Quoted 8 lines · Simon Glass

At present banks must be named and it is not possible to refer to GPIOs by number in driver model. Some boards use numbering - e.g. OMAP. It is fairly easy to support by detecting the absense of a bank name (which starts with a letter).

Add support for numbered GPIOs in addition to the existing bank support.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/9bead7aa/attachment.pgp>
#3 lore raw

PATCH 2/14 dm: serial: Reset the watchdog while waiting in getc()

In reply to Simon Glass

We have moved the busy-wait loop out of drivers and into the uclass. This means that we must reset the watchdog when busy-waiting.

Note: some drivers may still have a busy-wait even with driver model, as a transition mechanism. Driver model will tolerate this, and is can be cleaned up when all users of the driver use driver model. An example is ns16550.

---

 drivers/serial/serial-uclass.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/serial/serial-uclass.c +5 -0
index e93c624..aeaf2d2 100644
@@ -11,9 +11,12 @@
 #include <os.h>
 #include <serial.h>
 #include <stdio_dev.h>
+#include <watchdog.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
 
+#include <ns16550.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /* The currently-selected console serial device */
@@ -119,6 +122,8 @@ static int serial_getc_dev(struct udevice *dev)
 
 	do {
 		err = ops->getc(dev);
+		if (err == -EAGAIN)
+			WATCHDOG_RESET();
 	} while (err == -EAGAIN);
 
 	return err >= 0 ? err : 0;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#4 lore raw

PATCH 2/14 dm: serial: Reset the watchdog while waiting in getc()

Quoted 9 lines · Simon Glass

We have moved the busy-wait loop out of drivers and into the uclass. This means that we must reset the watchdog when busy-waiting.

Note: some drivers may still have a busy-wait even with driver model, as a transition mechanism. Driver model will tolerate this, and is can be cleaned up when all users of the driver use driver model. An example is ns16550.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/496b88ed/attachment.pgp>
#5 lore raw

PATCH 3/14 dm: serial: ns16550: Correct logic for checking for character

In reply to Simon Glass

There is a bug in the logic which checks for an available character. This can cause invalid characters to be received - this was noticed on beaglebone. Fix it.

---

 drivers/serial/ns16550.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/serial/ns16550.c +1 -1
index 63a9ef6..fe6cc26 100644
@@ -253,7 +253,7 @@ static int ns16550_serial_getc(struct udevice *dev)
 {
 	struct NS16550 *const com_port = dev_get_priv(dev);
 
-	if (!serial_in(&com_port->lsr) & UART_LSR_DR)
+	if (!(serial_in(&com_port->lsr) & UART_LSR_DR))
 		return -EAGAIN;
 
 	return serial_in(&com_port->rbr);
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#6 lore raw

PATCH 3/14 dm: serial: ns16550: Correct logic for checking for character

Quoted 5 lines · Simon Glass

There is a bug in the logic which checks for an available character. This can cause invalid characters to be received - this was noticed on beaglebone. Fix it.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/3de7d873/attachment.pgp>
#7 lore raw

PATCH 4/14 dm: ns16550: Use an address instead of a pointer for the uart base

In reply to Simon Glass

It is inconvenient to have to use casts when specifying platform data. Also it is not strictly correct, since we should use map_sysmem() to convert an address to a pointer.

Adjust the platform data to use an address.

---

 drivers/serial/ns16550.c | 6 +++---
 include/ns16550.h        | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/serial/ns16550.c +3 -3
index fe6cc26..2301f0a 100644
@@ -61,7 +61,7 @@ static void ns16550_writeb(NS16550_t port, int offset, int value)
 	unsigned char *addr;
 
 	offset *= 1 << plat->reg_shift;
-	addr = plat->base + offset;
+	addr = map_sysmem(plat->base, 0) + offset;
 	/*
 	 * As far as we know it doesn't make sense to support selection of
 	 * these options at run-time, so use the existing CONFIG options.
@@ -85,7 +85,7 @@ static int ns16550_readb(NS16550_t port, int offset)
 	unsigned char *addr;
 
 	offset *= 1 << plat->reg_shift;
-	addr = plat->base + offset;
+	addr = map_sysmem(plat->base, 0) + offset;
 #ifdef CONFIG_SYS_NS16550_PORT_MAPPED
 	return inb(addr);
 #elif defined(CONFIG_SYS_NS16550_MEM32) && !defined(CONFIG_SYS_BIG_ENDIAN)
@@ -291,7 +291,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 	if (addr == FDT_ADDR_T_NONE)
 		return -EINVAL;
 
-	plat->base = (unsigned char *)addr;
+	plat->base = addr;
 	plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
 					 "reg-shift", 1);
 	com_port->plat = plat;
include/ns16550.h +1 -1
index 5784cfd..0607379 100644
@@ -53,7 +53,7 @@
  * @clock:		UART base clock speed in Hz
  */
 struct ns16550_platdata {
-	unsigned char *base;
+	unsigned long base;
 	int reg_shift;
 	int clock;
 };
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#8 lore raw

PATCH 4/14 dm: ns16550: Use an address instead of a pointer for the uart base

Quoted 7 lines · Simon Glass

It is inconvenient to have to use casts when specifying platform data. Also it is not strictly correct, since we should use map_sysmem() to convert an address to a pointer.

Adjust the platform data to use an address.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/9da395ca/attachment.pgp>
#9 lore raw

PATCH 5/14 dm: ns16550: Correct the probe logic for platform data

In reply to Simon Glass

The probe logic sets up the pointer to the platform data in the device tree decode method. It should be done in the probe() method, and anyway the device tree decode method can't be used when CONFIG_OF_CONTROL is not enabled.

Fix these two problems.

---

 drivers/serial/ns16550.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/serial/ns16550.c +3 -2
index 2301f0a..0799aa4 100644
@@ -276,14 +276,15 @@ int ns16550_serial_probe(struct udevice *dev)
 {
 	struct NS16550 *const com_port = dev_get_priv(dev);
 
+	com_port->plat = dev_get_platdata(dev);
 	NS16550_init(com_port, -1);
 
 	return 0;
 }
 
+#ifdef CONFIG_OF_CONTROL
 int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 {
-	struct NS16550 *const com_port = dev_get_priv(dev);
 	struct ns16550_platdata *plat = dev->platdata;
 	fdt_addr_t addr;
 
@@ -294,10 +295,10 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 	plat->base = addr;
 	plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
 					 "reg-shift", 1);
-	com_port->plat = plat;
 
 	return 0;
 }
+#endif
 
 const struct dm_serial_ops ns16550_serial_ops = {
 	.putc = ns16550_serial_putc,
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#10 lore raw

PATCH 5/14 dm: ns16550: Correct the probe logic for platform data

Quoted 8 lines · Simon Glass

The probe logic sets up the pointer to the platform data in the device tree decode method. It should be done in the probe() method, and anyway the device tree decode method can't be used when CONFIG_OF_CONTROL is not enabled.

Fix these two problems.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/0db85a5b/attachment.pgp>
#11 lore raw

PATCH 6/14 dm: serial: Support CONFIG_CONS_INDEX if available

In reply to Simon Glass

Try to use this option to select the correct uart for the console. This mimics the behaviour of drivers/serial.c.

---

 drivers/serial/serial-uclass.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/serial/serial-uclass.c +10 -1
index aeaf2d2..522e551 100644
@@ -50,13 +50,22 @@ static void serial_find_console_or_panic(void)
 	}
 #endif
 	/*
+	 * Try to use CONFIG_CONS_INDEX is available (it is numbered from 1!).
+	 *
 	 * Failing that, get the device with sequence number 0, or in extremis
 	 * just the first serial device we can find. But we insist on having
 	 * a console (even if it is silent).
 	 */
-	if (uclass_get_device_by_seq(UCLASS_SERIAL, 0, &cur_dev) &&
+#ifdef CONFIG_CONS_INDEX
+#define INDEX (CONFIG_CONS_INDEX - 1)
+#else
+#define INDEX 0
+#endif
+	if (uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &cur_dev) &&
+	    uclass_get_device(UCLASS_SERIAL, INDEX, &cur_dev) &&
 	    (uclass_first_device(UCLASS_SERIAL, &cur_dev) || !cur_dev))
 		panic("No serial driver found");
+#undef INDEX
 }
 
 /* Called prior to relocation */
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#12 lore raw

PATCH 6/14 dm: serial: Support CONFIG_CONS_INDEX if available

Quoted 14 lines · Simon Glass

Try to use this option to select the correct uart for the console. This mimics the behaviour of drivers/serial.c.

---

 drivers/serial/serial-uclass.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/serial/serial-uclass.c +0 -0
index aeaf2d2..522e551 100644

drivers/serial/serial-uclass.c static void serial_find_console_or_panic(void) · line 53

Quoted 4 lines
drivers/serial/serial-uclass.c +1 -0
@@ -50,13 +50,22 @@ static void serial_find_console_or_panic(void)
 	}
 #endif
 	/*
+	 * Try to use CONFIG_CONS_INDEX is available (it is numbered from 1!).

"if it is available" or "if available". Otherwise:

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/f43bfbe5/attachment.pgp>
#13 lore raw

PATCH 7/14 dm: dts: omap: Select correct console for beaglebone

In reply to Simon Glass

Select serial0 as the console.

---

 arch/arm/dts/am335x-bone-common.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/am335x-bone-common.dtsi +4 -0
index 2f66ded..e70b4d1 100644
@@ -10,6 +10,10 @@
 	model = "TI AM335x BeagleBone";
 	compatible = "ti,am335x-bone", "ti,am33xx";
 
+	chosen {
+		stdout-path = &uart0;
+	};
+
 	cpus {
 		cpu at 0 {
 			cpu0-supply = <&dcdc2_reg>;
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#14 lore raw

PATCH 7/14 dm: dts: omap: Select correct console for beaglebone

Quoted 13 lines · Simon Glass

Select serial0 as the console.

---

 arch/arm/dts/am335x-bone-common.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/am335x-bone-common.dtsi +0 -0
index 2f66ded..e70b4d1 100644

arch/arm/dts/am335x-bone-common.dtsi line 19

Quoted 10 lines
arch/arm/dts/am335x-bone-common.dtsi +4 -0
@@ -10,6 +10,10 @@
 	model = "TI AM335x BeagleBone";
 	compatible = "ti,am335x-bone", "ti,am33xx";
 
+	chosen {
+		stdout-path = &uart0;
+	};
+
 	cpus {
 		cpu at 0 {
 			cpu0-supply = <&dcdc2_reg>;

So here's where I worry. The reason we have a Kconfig for CONS_INDEX is that there are boards it's NOT uart0. Setting aside the people with a "uart cape" (or otherwise breadboarding out another uart to a real connector), the industrial EVM is uart2 I want to say and we had been happily supporting this board with just a different build target (then defconfig). What can we do here? And yes, I see this is the bone DT not the EVM dt, but I'd rather not have to, if we don't have to at least, default to just not supporting the board (which is at least on the table, there's no DT for it in the kernel either).

As it stands however, it's right for what it's modifying so:

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/ed6eb92c/attachment.pgp>
#15 lore raw

PATCH 7/14 dm: dts: omap: Select correct console for beaglebone

Hi Tom,

Quoted 27 lines · Tom Rini
Quoted 13 lines · Simon Glass

Select serial0 as the console.

---

 arch/arm/dts/am335x-bone-common.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/am335x-bone-common.dtsi +0 -0
index 2f66ded..e70b4d1 100644

arch/arm/dts/am335x-bone-common.dtsi line 19

Quoted 10 lines
arch/arm/dts/am335x-bone-common.dtsi +4 -0
@@ -10,6 +10,10 @@
      model = "TI AM335x BeagleBone";
      compatible = "ti,am335x-bone", "ti,am33xx";
 
+     chosen {
+             stdout-path = &uart0;
+     };
+
      cpus {
              cpu at 0 {
                      cpu0-supply = <&dcdc2_reg>;

So here's where I worry. The reason we have a Kconfig for CONS_INDEX is

Quoted 8 lines

that there are boards it's NOT uart0. Setting aside the people with a "uart cape" (or otherwise breadboarding out another uart to a real connector), the industrial EVM is uart2 I want to say and we had been happily supporting this board with just a different build target (then defconfig). What can we do here? And yes, I see this is the bone DT not the EVM dt, but I'd rather not have to, if we don't have to at least, default to just not supporting the board (which is at least on the table, there's no DT for it in the kernel either).

I think we are looking for a build-time way to change the console. Is that right? I suppose we could use a #define in the device tree, set from some sort of include file / option, but that seems pretty ugly.

It would not be hard to modify the DT in the binary after it is built, if that helps.

We can certainly support a different build target with a different 'default' device tree. We would then have several .dts files all including the .dtsi for their main body.

Also there is a patch that I have not tidied/sent yet which builds all the .dtb files for a class of boards, so you can add the .dtb that you prefer to U-Boot with 'cat'.

I'm open to various options here, but I'm not sure which is best for this use case.

I wonder how the kernel deals with this issue?

Quoted 7 lines

As it stands however, it's right for what it's modifying so:

--
Tom

Regards,
Simon

#16 lore raw

PATCH 7/14 dm: dts: omap: Select correct console for beaglebone

Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 27 lines · Tom Rini
Quoted 13 lines · Simon Glass

Select serial0 as the console.

---

 arch/arm/dts/am335x-bone-common.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/am335x-bone-common.dtsi +0 -0
index 2f66ded..e70b4d1 100644

arch/arm/dts/am335x-bone-common.dtsi line 19

Quoted 10 lines
arch/arm/dts/am335x-bone-common.dtsi +4 -0
@@ -10,6 +10,10 @@
      model = "TI AM335x BeagleBone";
      compatible = "ti,am335x-bone", "ti,am33xx";
 
+     chosen {
+             stdout-path = &uart0;
+     };
+
      cpus {
              cpu at 0 {
                      cpu0-supply = <&dcdc2_reg>;

So here's where I worry. The reason we have a Kconfig for CONS_INDEX is

Quoted 8 lines

that there are boards it's NOT uart0. Setting aside the people with a "uart cape" (or otherwise breadboarding out another uart to a real connector), the industrial EVM is uart2 I want to say and we had been happily supporting this board with just a different build target (then defconfig). What can we do here? And yes, I see this is the bone DT not the EVM dt, but I'd rather not have to, if we don't have to at least, default to just not supporting the board (which is at least on the table, there's no DT for it in the kernel either).

Quoted 3 lines

I think we are looking for a build-time way to change the console. Is that right? I suppose we could use a #define in the device tree, set from some sort of include file / option, but that seems pretty ugly.

It does, yeah.

Quoted 10 lines

It would not be hard to modify the DT in the binary after it is built, if that helps.

We can certainly support a different build target with a different 'default' device tree. We would then have several .dts files all including the .dtsi for their main body.

Also there is a patch that I have not tidied/sent yet which builds all the .dtb files for a class of boards, so you can add the .dtb that you prefer to U-Boot with 'cat'.

We'll need that at some point, sooner rather than later since "am335x_evm" works on 4 distinct platforms, not counting the one where console is on a different UART than expected.

Quoted 4 lines

I'm open to various options here, but I'm not sure which is best for this use case.

I wonder how the kernel deals with this issue?

I think the answer for how the kernel deals with it is "out of tree". Maybe that's the good enough for now answer here too. It's just a matter of providing the correct device tree for the EVM in question, so maybe we just punt.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141023/f093947a/attachment.pgp>
#17 lore raw

PATCH 7/14 dm: dts: omap: Select correct console for beaglebone

Hi Tom,

Quoted 53 lines · Tom Rini
Quoted 39 lines · Simon Glass

Hi Tom,

Quoted 27 lines · Tom Rini
Quoted 13 lines · Simon Glass

Select serial0 as the console.

---

 arch/arm/dts/am335x-bone-common.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/am335x-bone-common.dtsi +0 -0
index 2f66ded..e70b4d1 100644

arch/arm/dts/am335x-bone-common.dtsi line 19

Quoted 10 lines
arch/arm/dts/am335x-bone-common.dtsi +4 -0
@@ -10,6 +10,10 @@
      model = "TI AM335x BeagleBone";
      compatible = "ti,am335x-bone", "ti,am33xx";
 
+     chosen {
+             stdout-path = &uart0;
+     };
+
      cpus {
              cpu at 0 {
                      cpu0-supply = <&dcdc2_reg>;

So here's where I worry. The reason we have a Kconfig for CONS_INDEX is

Quoted 8 lines

that there are boards it's NOT uart0. Setting aside the people with a "uart cape" (or otherwise breadboarding out another uart to a real connector), the industrial EVM is uart2 I want to say and we had been happily supporting this board with just a different build target (then defconfig). What can we do here? And yes, I see this is the bone DT not the EVM dt, but I'd rather not have to, if we don't have to at least, default to just not supporting the board (which is at least on the table, there's no DT for it in the kernel either).

Quoted 3 lines

I think we are looking for a build-time way to change the console. Is that right? I suppose we could use a #define in the device tree, set from some sort of include file / option, but that seems pretty ugly.

It does, yeah.

Quoted 7 lines

It would not be hard to modify the DT in the binary after it is built, if that helps.

We can certainly support a different build target with a different 'default' device tree. We would then have several .dts files all including the .dtsi for their main body.

Quoted 7 lines
Quoted 3 lines

Also there is a patch that I have not tidied/sent yet which builds all the .dtb files for a class of boards, so you can add the .dtb that you prefer to U-Boot with 'cat'.

We'll need that at some point, sooner rather than later since "am335x_evm" works on 4 distinct platforms, not counting the one where console is on a different UART than expected.

OK I'll see what I can do with this.

Quoted 10 lines
Quoted 5 lines

I'm open to various options here, but I'm not sure which is best for this use case.

I wonder how the kernel deals with this issue?

I think the answer for how the kernel deals with it is "out of tree". Maybe that's the good enough for now answer here too. It's just a matter of providing the correct device tree for the EVM in question, so maybe we just punt.

Well let's see if multi-dtb gets us somewhere towards the goal and then revisit it.

Regards,
Simon

#18 lore raw

PATCH 8/14 dm: omap: gpio: Put _get_gpio_value() logic into its own function

In reply to Simon Glass

Add a separate internal helper function to get a GPIO value, so that we will be able to call it with the driver model version and avoid code duplication.

Also move gpio_get_bank() and check_gpio() down below the helper functions as these won't be needed with driver model.

---

 drivers/gpio/omap_gpio.c | 78 ++++++++++++++++++++++++++----------------------
 1 file changed, 42 insertions(+), 36 deletions(-)
drivers/gpio/omap_gpio.c +42 -36
index 13dcf79..d2d2640 100644
@@ -26,11 +26,6 @@
 #define OMAP_GPIO_DIR_OUT	0
 #define OMAP_GPIO_DIR_IN	1
 
-static inline const struct gpio_bank *get_gpio_bank(int gpio)
-{
-	return &omap_gpio_bank[gpio >> 5];
-}
-
 static inline int get_gpio_index(int gpio)
 {
 	return gpio & 0x1f;
@@ -41,15 +36,6 @@ int gpio_is_valid(int gpio)
 	return (gpio >= 0) && (gpio < OMAP_MAX_GPIO);
 }
 
-static int check_gpio(int gpio)
-{
-	if (!gpio_is_valid(gpio)) {
-		printf("ERROR : check_gpio: invalid GPIO %d\n", gpio);
-		return -1;
-	}
-	return 0;
-}
-
 static void _set_gpio_direction(const struct gpio_bank *bank, int gpio,
 				int is_input)
 {
@@ -118,6 +104,46 @@ static void _set_gpio_dataout(const struct gpio_bank *bank, int gpio,
 	__raw_writel(l, reg);
 }
 
+static int _get_gpio_value(const struct gpio_bank *bank, int gpio)
+{
+	void *reg = bank->base;
+	int input;
+
+	switch (bank->method) {
+	case METHOD_GPIO_24XX:
+		input = _get_gpio_direction(bank, gpio);
+		switch (input) {
+		case OMAP_GPIO_DIR_IN:
+			reg += OMAP_GPIO_DATAIN;
+			break;
+		case OMAP_GPIO_DIR_OUT:
+			reg += OMAP_GPIO_DATAOUT;
+			break;
+		default:
+			return -1;
+		}
+		break;
+	default:
+		return -1;
+	}
+
+	return (__raw_readl(reg) & (1 << gpio)) != 0;
+}
+
+static inline const struct gpio_bank *get_gpio_bank(int gpio)
+{
+	return &omap_gpio_bank[gpio >> 5];
+}
+
+static int check_gpio(int gpio)
+{
+	if (!gpio_is_valid(gpio)) {
+		printf("ERROR : check_gpio: invalid GPIO %d\n", gpio);
+		return -1;
+	}
+	return 0;
+}
+
 /**
  * Set value of the specified gpio
  */
@@ -139,32 +165,12 @@ int gpio_set_value(unsigned gpio, int value)
 int gpio_get_value(unsigned gpio)
 {
 	const struct gpio_bank *bank;
-	void *reg;
-	int input;
 
 	if (check_gpio(gpio) < 0)
 		return -1;
 	bank = get_gpio_bank(gpio);
-	reg = bank->base;
-	switch (bank->method) {
-	case METHOD_GPIO_24XX:
-		input = _get_gpio_direction(bank, get_gpio_index(gpio));
-		switch (input) {
-		case OMAP_GPIO_DIR_IN:
-			reg += OMAP_GPIO_DATAIN;
-			break;
-		case OMAP_GPIO_DIR_OUT:
-			reg += OMAP_GPIO_DATAOUT;
-			break;
-		default:
-			return -1;
-		}
-		break;
-	default:
-		return -1;
-	}
-	return (__raw_readl(reg)
-			& (1 << get_gpio_index(gpio))) != 0;
+
+	return _get_gpio_value(bank, get_gpio_index(gpio));
 }
 
 /**
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#19 lore raw

PATCH 8/14 dm: omap: gpio: Put _get_gpio_value() logic into its own function

Quoted 8 lines · Simon Glass

Add a separate internal helper function to get a GPIO value, so that we will be able to call it with the driver model version and avoid code duplication.

Also move gpio_get_bank() and check_gpio() down below the helper functions as these won't be needed with driver model.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/c19d79f5/attachment.pgp>
#20 lore raw

PATCH 9/14 dm: omap: gpio: Support driver model

In reply to Simon Glass

Add driver model support to this driver, while retaining support for the legacy system. Driver model GPIO support is enabled with CONFIG_DM_GPIO as usual.

Since gpio_is_valid() no longer exists, we can use the -EINVAL error returned from gpio_request().

---

 arch/arm/include/asm/omap_gpio.h |  19 +++-
 drivers/gpio/omap_gpio.c         | 221 +++++++++++++++++++++++++++++++++++++++
 drivers/mmc/omap_hsmmc.c         |  15 ++-
 3 files changed, 248 insertions(+), 7 deletions(-)
arch/arm/include/asm/omap_gpio.h +17 -2
index 5d25d04..839af54 100644
@@ -23,6 +23,21 @@
 
 #include <asm/arch/cpu.h>
 
+enum gpio_method {
+	METHOD_GPIO_24XX	= 4,
+};
+
+#ifdef CONFIG_DM_GPIO
+
+/* Information about a GPIO bank */
+struct omap_gpio_platdata {
+	int bank_index;
+	ulong base;	/* address of registers in physical memory */
+	enum gpio_method method;
+};
+
+#else
+
 struct gpio_bank {
 	void *base;
 	int method;
@@ -30,8 +45,6 @@ struct gpio_bank {
 
 extern const struct gpio_bank *const omap_gpio_bank;
 
-#define METHOD_GPIO_24XX	4
-
 /**
  * Check if gpio is valid.
  *
@@ -39,4 +52,6 @@ extern const struct gpio_bank *const omap_gpio_bank;
  * @return 1 if ok, 0 on error
  */
 int gpio_is_valid(int gpio);
+#endif
+
 #endif /* _GPIO_H_ */
drivers/gpio/omap_gpio.c +221 -0

242 lines not on this page · raw message

drivers/mmc/omap_hsmmc.c +10 -5
index 5b0c302..ef2cbf9 100644
@@ -67,14 +67,19 @@ static int mmc_write_data(struct hsmmc *mmc_base, const char *buf,
 #ifdef OMAP_HSMMC_USE_GPIO
 static int omap_mmc_setup_gpio_in(int gpio, const char *label)
 {
-	if (!gpio_is_valid(gpio))
-		return -1;
+	int ret;
 
-	if (gpio_request(gpio, label) < 0)
+#ifndef CONFIG_DM_GPIO
+	if (!gpio_is_valid(gpio))
 		return -1;
+#endif
+	ret = gpio_request(gpio, label);
+	if (ret)
+		return ret;
 
-	if (gpio_direction_input(gpio) < 0)
-		return -1;
+	ret = gpio_direction_input(gpio);
+	if (ret)
+		return ret;
 
 	return gpio;
 }
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#21 lore raw

PATCH 9/14 dm: omap: gpio: Support driver model

Quoted 8 lines · Simon Glass

Add driver model support to this driver, while retaining support for the legacy system. Driver model GPIO support is enabled with CONFIG_DM_GPIO as usual.

Since gpio_is_valid() no longer exists, we can use the -EINVAL error returned from gpio_request().

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/78c06ad5/attachment.pgp>
#22 lore raw

PATCH 10/14 dm: am33xx: Provide platform data for GPIOs

In reply to Simon Glass

Provide suitable platform data for am33xx boards, so that these boards can use driver model for GPIO access.

---

 arch/arm/cpu/armv7/am33xx/board.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
arch/arm/cpu/armv7/am33xx/board.c +28 -0
index 828d10b..7aa8198 100644
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <dm.h>
 #include <errno.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
@@ -36,6 +37,31 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#ifdef CONFIG_DM_GPIO
+static const struct omap_gpio_platdata am33xx_gpio[] = {
+	{ 0, AM33XX_GPIO0_BASE, METHOD_GPIO_24XX },
+	{ 1, AM33XX_GPIO1_BASE, METHOD_GPIO_24XX },
+	{ 2, AM33XX_GPIO2_BASE, METHOD_GPIO_24XX },
+	{ 3, AM33XX_GPIO3_BASE, METHOD_GPIO_24XX },
+#ifdef CONFIG_AM43XX
+	{ 4, AM33XX_GPIO4_BASE, METHOD_GPIO_24XX },
+	{ 5, AM33XX_GPIO5_BASE, METHOD_GPIO_24XX },
+#endif
+};
+
+U_BOOT_DEVICES(am33xx_gpios) = {
+	{ "gpio_omap", &am33xx_gpio[0] },
+	{ "gpio_omap", &am33xx_gpio[1] },
+	{ "gpio_omap", &am33xx_gpio[2] },
+	{ "gpio_omap", &am33xx_gpio[3] },
+#ifdef CONFIG_AM43XX
+	{ "gpio_omap", &am33xx_gpio[4] },
+	{ "gpio_omap", &am33xx_gpio[5] },
+#endif
+};
+
+#else
+
 static const struct gpio_bank gpio_bank_am33xx[] = {
 	{ (void *)AM33XX_GPIO0_BASE, METHOD_GPIO_24XX },
 	{ (void *)AM33XX_GPIO1_BASE, METHOD_GPIO_24XX },
@@ -49,6 +75,8 @@ static const struct gpio_bank gpio_bank_am33xx[] = {
 
 const struct gpio_bank *const omap_gpio_bank = gpio_bank_am33xx;
 
+#endif
+
 #if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
 int cpu_mmc_init(bd_t *bis)
 {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#23 lore raw

PATCH 10/14 dm: am33xx: Provide platform data for GPIOs

Quoted 4 lines · Simon Glass

Provide suitable platform data for am33xx boards, so that these boards can use driver model for GPIO access.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/0627804e/attachment.pgp>
#24 lore raw

PATCH 11/14 dm: am33xx: Provide platform data for serial

In reply to Simon Glass

Provide suitable platform data for am33xx boards, so that these boards can use driver model for serial.

---

 arch/arm/cpu/armv7/am33xx/board.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/cpu/armv7/am33xx/board.c +33 -0
index 7aa8198..29b1d73 100644
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <ns16550.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
@@ -60,6 +61,38 @@ U_BOOT_DEVICES(am33xx_gpios) = {
 #endif
 };
 
+# ifndef CONFIG_OF_CONTROL
+/*
+ * TODO(sjg at chromium.org): When we can move SPL serial to DM, we can remove
+ * the CONFIGs. At the same time, we should move this to the board files.
+ */
+static const struct ns16550_platdata am33xx_serial[] = {
+	{ CONFIG_SYS_NS16550_COM1, 2, CONFIG_SYS_NS16550_CLK },
+#  ifdef CONFIG_SYS_NS16550_COM2
+	{ CONFIG_SYS_NS16550_COM2, 2, CONFIG_SYS_NS16550_CLK },
+#   ifdef CONFIG_SYS_NS16550_COM3
+	{ CONFIG_SYS_NS16550_COM3, 2, CONFIG_SYS_NS16550_CLK },
+	{ CONFIG_SYS_NS16550_COM4, 2, CONFIG_SYS_NS16550_CLK },
+	{ CONFIG_SYS_NS16550_COM5, 2, CONFIG_SYS_NS16550_CLK },
+	{ CONFIG_SYS_NS16550_COM6, 2, CONFIG_SYS_NS16550_CLK },
+#   endif
+#  endif
+};
+
+U_BOOT_DEVICES(am33xx_uarts) = {
+	{ "serial_omap", &am33xx_serial[0] },
+#  ifdef CONFIG_SYS_NS16550_COM2
+	{ "serial_omap", &am33xx_serial[1] },
+#   ifdef CONFIG_SYS_NS16550_COM3
+	{ "serial_omap", &am33xx_serial[2] },
+	{ "serial_omap", &am33xx_serial[3] },
+	{ "serial_omap", &am33xx_serial[4] },
+	{ "serial_omap", &am33xx_serial[5] },
+#   endif
+#  endif
+};
+# endif
+
 #else
 
 static const struct gpio_bank gpio_bank_am33xx[] = {
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#25 lore raw

PATCH 11/14 dm: am33xx: Provide platform data for serial

Quoted 4 lines · Simon Glass

Provide suitable platform data for am33xx boards, so that these boards can use driver model for serial.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/a2a5e086/attachment.pgp>
#26 lore raw

PATCH 12/14 dm: omap: serial: Add driver model support

In reply to Simon Glass

Add driver model support to this driver, while retaining support for the legacy system. Driver model serial support is enabled with CONFIG_DM_SERIAL as usual.

---

 drivers/serial/Makefile      |  1 +
 drivers/serial/serial_omap.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 drivers/serial/serial_omap.c
drivers/serial/Makefile +1 -0
index 853a8c6..9ac3496 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
 obj-$(CONFIG_MXS_AUART) += mxs_auart.o
 obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
 obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
+obj-$(CONFIG_OMAP_SERIAL) += serial_omap.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_USB_TTY) += usbtty.o
drivers/serial/serial_omap.c new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
2.1.0.rc2.206.gedb03e5
#27 lore raw

PATCH 12/14 dm: omap: serial: Add driver model support

Hi Simon,

One minor comment from me.

Quoted 4 lines · On Mon, 22 Sep 2014 09:48:52 -0600 Simon Glass <[email protected]> wrote:
drivers/serial/serial_omap.c new file +4 -0
+
+U_BOOT_DRIVER(serial_omap_ns16550) = {
+	.name	= "serial_omap",
+	.id	= UCLASS_SERIAL,

drivers/serial/serial_omap.c line 49

Quoted 10 lines
drivers/serial/serial_omap.c new file +10 -0
+#ifdef CONFIG_OF_CONTROL
+	.of_match = omap_serial_ids,
+	.ofdata_to_platdata = omap_serial_ofdata_to_platdata,
+#endif
+	.platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
+	.priv_auto_alloc_size = sizeof(struct NS16550),
+	.probe = ns16550_serial_probe,
+	.ops	= &ns16550_serial_ops,
+	.flags	= DM_FLAG_PRE_RELOC,
+};
U_BOOT_DRIVER(serial_omap_ns16550) = {
	.name	= "serial_omap",
	.id	= UCLASS_SERIAL,
	.of_match = of_match_ptr(omap_serial_ids),
	.ofdata_to_platdata = of_match_ptr(omap_serial_ofdata_to_platdata),
	.platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
	.priv_auto_alloc_size = sizeof(struct NS16550),
	.probe = ns16550_serial_probe,
	.ops	= &ns16550_serial_ops,
	.flags	= DM_FLAG_PRE_RELOC,
};

is cleaner
though you need to apply the following first:
http://patchwork.ozlabs.org/patch/397088/

Best Regards
Masahiro Yamada

#28 lore raw

PATCH 12/14 dm: omap: serial: Add driver model support

In reply to Simon Glass
Quoted 5 lines · Simon Glass

Add driver model support to this driver, while retaining support for the legacy system. Driver model serial support is enabled with CONFIG_DM_SERIAL as usual.

Assuming you'll make the change Masahiro pointed out,

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/3943d3b0/attachment.pgp>
#29 lore raw

PATCH 13/14 dm: am335x: Remove serial options from CONFIG_SYS_EXTRA_OPTIONS

In reply to Simon Glass

With these options in place it is not possible to change the serial port using 'make menuconfig' or similar. It seems to result in duplicate defines.

For example:

In file included from include/linux/kconfig.h:4:0,

                 from <command-line>:0:

include/generated/autoconf.h:20:0: note: this is the location of the previous definition
#define CONFIG_CONS_INDEX 2
^

The default option seems to be 1 anyway, in board/ti/am335x/Kconfig.

Remove the options so that we can adjust the serial port if required.

---

 configs/am335x_boneblack_defconfig       | 2 +-
 configs/am335x_boneblack_vboot_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configs/am335x_boneblack_defconfig +1 -1
index 38450c0..b631c41 100644
@@ -1,4 +1,4 @@
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1,EMMC_BOOT"
+CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT"
 +S:CONFIG_ARM=y
 +S:CONFIG_TARGET_AM335X_EVM=y
configs/am335x_boneblack_vboot_defconfig +1 -1
index 00317c4..e6c5ee3 100644
@@ -1,4 +1,4 @@
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1,EMMC_BOOT,ENABLE_VBOOT"
+CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT,ENABLE_VBOOT"
 +S:CONFIG_ARM=y
 +S:CONFIG_TARGET_AM335X_EVM=y
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#30 lore raw

PATCH 13/14 dm: am335x: Remove serial options from CONFIG_SYS_EXTRA_OPTIONS

Quoted 38 lines · Simon Glass

With these options in place it is not possible to change the serial port using 'make menuconfig' or similar. It seems to result in duplicate defines.

For example:

In file included from include/linux/kconfig.h:4:0,

                 from <command-line>:0:

include/generated/autoconf.h:20:0: note: this is the location of the previous definition
#define CONFIG_CONS_INDEX 2
^

The default option seems to be 1 anyway, in board/ti/am335x/Kconfig.

Remove the options so that we can adjust the serial port if required.

---

 configs/am335x_boneblack_defconfig       | 2 +-
 configs/am335x_boneblack_vboot_defconfig | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configs/am335x_boneblack_defconfig +1 -1
index 38450c0..b631c41 100644
@@ -1,4 +1,4 @@
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1,EMMC_BOOT"
+CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT"
 +S:CONFIG_ARM=y
 +S:CONFIG_TARGET_AM335X_EVM=y
configs/am335x_boneblack_vboot_defconfig +0 -0
index 00317c4..e6c5ee3 100644

configs/am335x_boneblack_vboot_defconfig line 4

Quoted 5 lines
configs/am335x_boneblack_vboot_defconfig +1 -1
@@ -1,4 +1,4 @@
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1,EMMC_BOOT,ENABLE_VBOOT"
+CONFIG_SYS_EXTRA_OPTIONS="EMMC_BOOT,ENABLE_VBOOT"
 +S:CONFIG_ARM=y
 +S:CONFIG_TARGET_AM335X_EVM=y

Whoops, those should have been deleted when I deleted the rest of them from am335x*.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/47b88414/attachment.pgp>
#31 lore raw

PATCH 14/14 dm: am33xx: Move to driver model for GPIO and serial

In reply to Simon Glass

Adjust the configuration for the am33xx boards, including beaglebone black to use driver model.

This can be extended to other OMAP boards once platform data is provided for them.

---

 include/configs/ti_am335x_common.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
include/configs/ti_am335x_common.h +11 -0
index 80976e7..5ed86d9 100644
@@ -19,12 +19,23 @@
 #define CONFIG_SYS_TIMERBASE		0x48040000	/* Use Timer2 */
 #define CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC
 
+#ifndef CONFIG_SPL_BUILD
+# define CONFIG_DM
+# define CONFIG_CMD_DM
+# define CONFIG_DM_GPIO
+# define CONFIG_DM_SERIAL
+# define CONFIG_OMAP_SERIAL
+# define CONFIG_SYS_MALLOC_F_LEN	(1 << 10)
+#endif
+
 #include <asm/arch/omap.h>
 
 /* NS16550 Configuration */
 #define CONFIG_SYS_NS16550
+#ifdef CONFIG_SPL_BUILD
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
+#endif
 #define CONFIG_SYS_NS16550_CLK		48000000
 
 /* Network defines. */
Signature · 1 line
2.1.0.rc2.206.gedb03e5
#32 lore raw

PATCH 14/14 dm: am33xx: Move to driver model for GPIO and serial

Quoted 7 lines · Simon Glass

Adjust the configuration for the am33xx boards, including beaglebone black to use driver model.

This can be extended to other OMAP boards once platform data is provided for them.

What's missing for doing this in SPL as well?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/b91c0316/attachment.pgp>
#33 lore raw

PATCH 14/14 dm: am33xx: Move to driver model for GPIO and serial

Hi Tom,

Quoted 11 lines · Tom Rini
Quoted 7 lines · Simon Glass

Adjust the configuration for the am33xx boards, including beaglebone black to use driver model.

This can be extended to other OMAP boards once platform data is provided for them.

What's missing for doing this in SPL as well?

The SPL series has been sent but not enabled for OMAP yet. I'll need to look at it, but it should be minor.

Regards,
Simon

#34 lore raw

PATCH 14/14 dm: am33xx: Move to driver model for GPIO and serial

Quoted 11 lines · Simon Glass

Hi Tom,

Quoted 8 lines · Tom Rini
Quoted 6 lines · Simon Glass

Adjust the configuration for the am33xx boards, including beaglebone black to use driver model.

This can be extended to other OMAP boards once platform data is provided for them.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

What's missing for doing this in SPL as well?

The SPL series has been sent but not enabled for OMAP yet. I'll need to look at it, but it should be minor.

OK, thanks.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141022/f3fb829f/attachment.pgp>
#35 lore raw

cover dm: omap: Provide access to driver model for am335x, and move boards

In reply to Simon Glass

Hi,

Quoted 13 lines · Simon Glass

This series adjusts the serial and GPIO drivers, used by Beaglebone for example, to work with driver model. Since there are still boards using these drivers but not driver model, this adds new functionality rather than replacing what exists.

Several patches tweak and fix the existing driver model serial and GPIO implementation.

There are two Beaglebone Black configurations:

- Device tree control with verified boot
- No device tree control

Quoted 6 lines

The first uses device tree to select the serial console and provide information needed by the serial driver (similar to how things work on Tegra). The second uses platform data provided by a common board file.

Both are converted, so this is a good example of how to support both device tree and platform data if needed.

Are there any comments on this series please?

Regards,
Simon

#36 lore raw

cover dm: omap: Provide access to driver model for am335x, and move boards

Quoted 16 lines · Simon Glass

Hi,

Quoted 13 lines · Simon Glass

This series adjusts the serial and GPIO drivers, used by Beaglebone for example, to work with driver model. Since there are still boards using these drivers but not driver model, this adds new functionality rather than replacing what exists.

Several patches tweak and fix the existing driver model serial and GPIO implementation.

There are two Beaglebone Black configurations:

- Device tree control with verified boot
- No device tree control

Quoted 8 lines
Quoted 6 lines

The first uses device tree to select the serial console and provide information needed by the serial driver (similar to how things work on Tegra). The second uses platform data provided by a common board file.

Both are converted, so this is a good example of how to support both device tree and platform data if needed.

Are there any comments on this series please?

As part of settling back into the groove, I need to fire these up on my am335x boards and go from there.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141020/dc7f7af0/attachment.pgp>
#37 lore raw

cover dm: omap: Provide access to driver model for am335x, and move boards

Hi Tom,

Quoted 21 lines · Tom Rini
Quoted 20 lines · Simon Glass

Hi,

Quoted 17 lines · Simon Glass

This series adjusts the serial and GPIO drivers, used by Beaglebone for example, to work with driver model. Since there are still boards using these drivers but not driver model, this adds new functionality rather than replacing what exists.

Several patches tweak and fix the existing driver model serial and GPIO implementation.

There are two Beaglebone Black configurations:

- Device tree control with verified boot
- No device tree control

The first uses device tree to select the serial console and provide information needed by the serial driver (similar to how things work on Tegra). The second uses platform data provided by a common board file.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Both are converted, so this is a good example of how to support both device tree and platform data if needed.

Are there any comments on this series please?

As part of settling back into the groove, I need to fire these up on my am335x boards and go from there.

Thanks for the comments. I plan to apply the v2 series to dm/master soon.

Regards,
Simon