@@ -9,11 +9,6 @@
#ifndef _BCM2835_GPIO_H_
#define _BCM2835_GPIO_H_
-#ifdef CONFIG_BCM2836
-#define BCM2835_GPIO_BASE 0x3f200000
-#else
-#define BCM2835_GPIO_BASE 0x20200000
-#endif
#define BCM2835_GPIO_COUNT 54
#define BCM2835_GPIO_FSEL_MASK 0x7
@@ -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;
@@ -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),
We can rely on the device tree to provide the GPIO information. Signed-off-by: Simon Glass <sjg@chromium.org> --- Changes in v3: None Changes in v2: None arch/arm/mach-bcm283x/include/mach/gpio.h | 5 ----- board/raspberrypi/rpi/rpi.c | 9 --------- drivers/gpio/bcm2835_gpio.c | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+), 14 deletions(-)