diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-08-14 09:30:38 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-08-14 09:56:08 +0200 |
commit | 23f988e8d9e1f9480adeefc4f5b585f3ec15913f (patch) | |
tree | 704de01dbc2b8524a1810d387932c7a4940cf582 /drivers/pinctrl | |
parent | 909934e3a76d665b55565e4f87b1a10c8a3e4b0e (diff) | |
download | barebox-23f988e8d9e1f9480adeefc4f5b585f3ec15913f.tar.gz barebox-23f988e8d9e1f9480adeefc4f5b585f3ec15913f.tar.xz |
pinctrl: i.MX iomux-v1: Make base address initialization unnecessary
So far we have imx_gpio_mode() to configure a pinmux entry for the older
i.MX pinmuxes. For this to work imx_iomuxv1_init() must be called
beforehand to configure the base address. Simplify this by introducing
SoC specific variants of imx_gpio_mode() which also pass the base
address. This makes initialization of the base address unnecessary and
the functions usable for PBL. Consequently also compile the code for
PBL.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/Makefile | 2 | ||||
-rw-r--r-- | drivers/pinctrl/imx-iomux-v1.c | 28 |
2 files changed, 11 insertions, 19 deletions
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index 9cb5e99477..e311df7103 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile @@ -1,7 +1,7 @@ obj-$(CONFIG_PINCTRL) += pinctrl.o obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o obj-$(CONFIG_PINCTRL_BCM283X) += pinctrl-bcm2835.o -obj-$(CONFIG_PINCTRL_IMX_IOMUX_V1) += imx-iomux-v1.o +obj-pbl-$(CONFIG_PINCTRL_IMX_IOMUX_V1) += imx-iomux-v1.o obj-$(CONFIG_PINCTRL_IMX_IOMUX_V2) += imx-iomux-v2.o obj-$(CONFIG_PINCTRL_IMX_IOMUX_V3) += imx-iomux-v3.o obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o diff --git a/drivers/pinctrl/imx-iomux-v1.c b/drivers/pinctrl/imx-iomux-v1.c index 61e8f9680f..d0136f931e 100644 --- a/drivers/pinctrl/imx-iomux-v1.c +++ b/drivers/pinctrl/imx-iomux-v1.c @@ -31,26 +31,21 @@ #define SWR 0x3c #define PUEN 0x40 -static void __iomem *iomuxv1_base; - struct imx_iomux_v1 { void __iomem *base; struct pinctrl_device pinctrl; }; -void imx_gpio_mode(int gpio_mode) +void imx_gpio_mode(void __iomem *base, int gpio_mode) { unsigned int pin = gpio_mode & GPIO_PIN_MASK; unsigned int port = (gpio_mode & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; unsigned int ocr = (gpio_mode & GPIO_OCR_MASK) >> GPIO_OCR_SHIFT; unsigned int aout = (gpio_mode & GPIO_AOUT_MASK) >> GPIO_AOUT_SHIFT; unsigned int bout = (gpio_mode & GPIO_BOUT_MASK) >> GPIO_BOUT_SHIFT; - void __iomem *portbase = iomuxv1_base + port * 0x100; + void __iomem *portbase = base + port * 0x100; uint32_t val; - if (!iomuxv1_base) - return; - /* Pullup enable */ val = readl(portbase + PUEN); if (gpio_mode & GPIO_PUEN) @@ -119,10 +114,7 @@ void imx_gpio_mode(int gpio_mode) } } -void imx_iomuxv1_init(void __iomem *base) -{ - iomuxv1_base = base; -} +#ifndef __PBL__ /* * MUX_ID format defines @@ -280,18 +272,16 @@ static int imx_pinctrl_dt(struct device_d *dev, void __iomem *base) static int imx_iomux_v1_probe(struct device_d *dev) { int ret = 0; + void __iomem *base; - if (iomuxv1_base) - return -EBUSY; - - iomuxv1_base = dev_get_mem_region(dev, 0); - if (IS_ERR(iomuxv1_base)) - return PTR_ERR(iomuxv1_base); + base = dev_get_mem_region(dev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); ret = of_platform_populate(dev->device_node, NULL, NULL); if (IS_ENABLED(CONFIG_PINCTRL) && dev->device_node) - ret = imx_pinctrl_dt(dev, iomuxv1_base); + ret = imx_pinctrl_dt(dev, base); return ret; } @@ -315,3 +305,5 @@ static int imx_iomux_v1_init(void) return platform_driver_register(&imx_iomux_v1_driver); } core_initcall(imx_iomux_v1_init); + +#endif
\ No newline at end of file |