[U-Boot] [PATCH 18/20] arm: rpi: Drop the GPIO platform data

Simon Glass sjg at chromium.org
Wed Jul 8 04:53:50 CEST 2015


We can rely on the device tree to provide the GPIO information.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/arm/mach-bcm283x/include/mach/gpio.h |  2 --
 board/raspberrypi/rpi/rpi.c               |  9 ---------
 drivers/gpio/bcm2835_gpio.c               | 20 ++++++++++++++++++++
 include/configs/rpi-common.h              |  2 --
 4 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-bcm283x/include/mach/gpio.h b/arch/arm/mach-bcm283x/include/mach/gpio.h
index c8ef8f5..b020ead 100644
--- a/arch/arm/mach-bcm283x/include/mach/gpio.h
+++ b/arch/arm/mach-bcm283x/include/mach/gpio.h
@@ -11,8 +11,6 @@
 
 #ifdef CONFIG_BCM2836
 #define BCM2835_GPIO_BASE		0x3f200000
-#else
-#define BCM2835_GPIO_BASE		0x20200000
 #endif
 #define BCM2835_GPIO_COUNT		54
 
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 7de1921..39f451f 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -19,15 +19,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static const struct bcm2835_gpio_platdata gpio_platdata = {
-	.base = BCM2835_GPIO_BASE,
-};
-
-U_BOOT_DEVICE(bcm2835_gpios) = {
-	.name = "gpio_bcm2835",
-	.platdata = &gpio_platdata,
-};
-
 struct msg_get_arm_mem {
 	struct bcm2835_mbox_hdr hdr;
 	struct bcm2835_mbox_tag_get_arm_mem get_arm_mem;
diff --git a/drivers/gpio/bcm2835_gpio.c b/drivers/gpio/bcm2835_gpio.c
index fbc641d..f571b0b 100644
--- a/drivers/gpio/bcm2835_gpio.c
+++ b/drivers/gpio/bcm2835_gpio.c
@@ -114,9 +114,29 @@ static int bcm2835_gpio_probe(struct udevice *dev)
 	return 0;
 }
 
+#ifdef CONFIG_OF_CONTROL
+static int bcm2835_gpio_ofdata_to_platdata(struct udevice *dev)
+{
+	struct bcm2835_gpio_platdata *plat = dev_get_platdata(dev);
+
+	plat->base = dev_get_addr(dev);
+	if (plat->base == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	return 0;
+}
+
+static const struct udevice_id bcm2835_gpio_id[] = {
+	{.compatible = "brcm,bcm2835-gpio"},
+	{}
+};
+#endif
+
 U_BOOT_DRIVER(gpio_bcm2835) = {
 	.name	= "gpio_bcm2835",
 	.id	= UCLASS_GPIO,
+	.of_match = of_match_ptr(bcm2835_gpio_id),
+	.ofdata_to_platdata = of_match_ptr(bcm2835_gpio_ofdata_to_platdata),
 	.ops	= &gpio_bcm2835_ops,
 	.probe	= bcm2835_gpio_probe,
 	.priv_auto_alloc_size = sizeof(struct bcm2835_gpios),
diff --git a/include/configs/rpi-common.h b/include/configs/rpi-common.h
index bfbd32b..d015a8e 100644
--- a/include/configs/rpi-common.h
+++ b/include/configs/rpi-common.h
@@ -83,8 +83,6 @@
 #define CONFIG_USB_DWC2
 #ifdef CONFIG_BCM2836
 #define CONFIG_USB_DWC2_REG_ADDR 0x3f980000
-#else
-#define CONFIG_USB_DWC2_REG_ADDR 0x20980000
 #endif
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_HOST_ETHER
-- 
2.4.3.573.g4eafbef



More information about the U-Boot mailing list