From 0a27ab33c8ae4897b4a07eb9c78a54492898ace2 Mon Sep 17 00:00:00 2001 From: br Date: Fri, 18 Jul 2014 07:47:50 +0000 Subject: o Enable GPIO device driver for i.MX6. It was originally written for i.MX5 and compatible with newer chip. o Extend device tree information o style(9) fixes Discussed with: ian --- sys/arm/conf/IMX6 | 5 ++++- sys/arm/freescale/imx/files.imx6 | 3 +-- sys/arm/freescale/imx/imx51_gpio.c | 12 +++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'sys/arm') diff --git a/sys/arm/conf/IMX6 b/sys/arm/conf/IMX6 index 47819c4..50077a8 100644 --- a/sys/arm/conf/IMX6 +++ b/sys/arm/conf/IMX6 @@ -82,6 +82,9 @@ device miibus # Required for ethernet device bpf # Berkeley packet filter (required for DHCP) #device iomux # IO Multiplexor +# General-purpose input/output +device gpio + # Serial (COM) ports device uart # Multi-uart driver @@ -106,7 +109,7 @@ device u3g # USB modems #device ukbd # Allow keyboard like HIDs to control console #device ums # USB mouse -# USB Ethernet, requires miibus +# USB Ethernet, requires miibus #device aue # ADMtek USB Ethernet #device axe # ASIX Electronics USB Ethernet #device cdce # Generic USB over Ethernet diff --git a/sys/arm/freescale/imx/files.imx6 b/sys/arm/freescale/imx/files.imx6 index be9b8a3..d48d557 100644 --- a/sys/arm/freescale/imx/files.imx6 +++ b/sys/arm/freescale/imx/files.imx6 @@ -26,6 +26,7 @@ arm/freescale/imx/imx6_mp.c optional smp arm/freescale/imx/imx6_pl310.c standard arm/freescale/imx/imx_machdep.c standard arm/freescale/imx/imx_gpt.c standard +arm/freescale/imx/imx51_gpio.c optional gpio # # Optional devices. @@ -50,8 +51,6 @@ arm/freescale/imx/imx6_usbphy.c optional ehci # Not ready yet... # #arm/freescale/imx/imx51_iomux.c optional iomux -#arm/freescale/imx/imx51_gpio.c optional gpio #dev/ata/chipsets/ata-fsl.c optional imxata #arm/freescale/imx/i2c.c optional fsliic #arm/freescale/imx/imx51_ipuv3.c optional sc - diff --git a/sys/arm/freescale/imx/imx51_gpio.c b/sys/arm/freescale/imx/imx51_gpio.c index 8c43527..95e24ca 100644 --- a/sys/arm/freescale/imx/imx51_gpio.c +++ b/sys/arm/freescale/imx/imx51_gpio.c @@ -102,6 +102,13 @@ struct imx51_gpio_softc { struct gpio_pin gpio_pins[NGPIO]; }; +static struct ofw_compat_data compat_data[] = { + {"fsl,imx6q-gpio", 1}, + {"fsl,imx53-gpio", 1}, + {"fsl,imx51-gpio", 1}, + {NULL, 0} +}; + static struct resource_spec imx_gpio_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, @@ -373,9 +380,8 @@ imx51_gpio_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (ofw_bus_is_compatible(dev, "fsl,imx51-gpio") || - ofw_bus_is_compatible(dev, "fsl,imx53-gpio")) { - device_set_desc(dev, "i.MX515 GPIO Controller"); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "Freescale i.MX GPIO Controller"); return (BUS_PROBE_DEFAULT); } -- cgit v1.1