ARM: imx2: Fix GPIO iosize
Subsystems (3)
PATCH 1/3 ARM: imx2: Fix GPIO iosize
On MX1, MX21 and MX27 each GPIO port has an address space of 256 bytes.
Fix the iosize for these platforms.
Tested on a mx27_3ds board that can boot fine after this change.
---
This applies on Sascha's for-next branch
arch/arm/mach-imx/mm-imx1.c | 12 ++++++++---- arch/arm/mach-imx/mm-imx21.c | 12 ++++++------ arch/arm/mach-imx/mm-imx27.c | 12 ++++++------ 3 files changed, 20 insertions(+), 16 deletions(-)
arch/arm/mach-imx/mm-imx1.c +8 -4
@@ -50,8 +50,12 @@ void __init mx1_init_irq(void)void __init imx1_soc_init (void ) { -mxc_register_gpio (0 ,MX1_GPIO1_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTA ,0 ); -mxc_register_gpio (1 ,MX1_GPIO2_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTB ,0 ); -mxc_register_gpio (2 ,MX1_GPIO3_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTC ,0 ); -mxc_register_gpio (3 ,MX1_GPIO4_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTD ,0 ); +mxc_register_gpio (0 ,MX1_GPIO1_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTA ,0 ); +mxc_register_gpio (1 ,MX1_GPIO2_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTB ,0 ); +mxc_register_gpio (2 ,MX1_GPIO3_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTC ,0 ); +mxc_register_gpio (3 ,MX1_GPIO4_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTD ,0 ); }
arch/arm/mach-imx/mm-imx21.c +6 -6
@@ -76,10 +76,10 @@ void __init mx21_init_irq(void)void __init imx21_soc_init (void ) { -mxc_register_gpio (0 ,MX21_GPIO1_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (1 ,MX21_GPIO2_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (2 ,MX21_GPIO3_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (3 ,MX21_GPIO4_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (4 ,MX21_GPIO5_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (5 ,MX21_GPIO6_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (0 ,MX21_GPIO1_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (1 ,MX21_GPIO2_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (2 ,MX21_GPIO3_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (3 ,MX21_GPIO4_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (4 ,MX21_GPIO5_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (5 ,MX21_GPIO6_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); }
arch/arm/mach-imx/mm-imx27.c +6 -6
@@ -76,10 +76,10 @@ void __init mx27_init_irq(void)void __init imx27_soc_init (void ) { -mxc_register_gpio (0 ,MX27_GPIO1_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (1 ,MX27_GPIO2_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (2 ,MX27_GPIO3_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (3 ,MX27_GPIO4_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (4 ,MX27_GPIO5_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (5 ,MX27_GPIO6_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (0 ,MX27_GPIO1_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (1 ,MX27_GPIO2_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (2 ,MX27_GPIO3_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (3 ,MX27_GPIO4_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (4 ,MX27_GPIO5_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (5 ,MX27_GPIO6_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); }
Signature · 1 line
1.6.0.4
PATCH 2/3 ARM: mach-imx/scb9328: Make the UART gpio setup simpler
Place the UART gpio initialization inside the scb9328_init function as it is done on other i.MX boards.
--- arch/arm/mach-imx/mach-scb9328.c | 17 +++-------------- 1 files changed, 3 insertions(+), 14 deletions(-)
arch/arm/mach-imx/mach-scb9328.c +3 -14
@@ -101,21 +101,7 @@ static const int mxc_uart1_pins[] = { PC12_PF_UART1_RXD, }; -static int uart1_mxc_init (struct platform_device *pdev) -{ -return mxc_gpio_setup_multiple_pins (mxc_uart1_pins, -ARRAY_SIZE (mxc_uart1_pins),"UART1" ); -} - -static void uart1_mxc_exit (struct platform_device *pdev) -{ -mxc_gpio_release_multiple_pins (mxc_uart1_pins, -ARRAY_SIZE (mxc_uart1_pins)); -} -static const struct imxuart_platform_data uart_pdata__initconst = { - .init = uart1_mxc_init, - .exit = uart1_mxc_exit, .flags =IMXUART_HAVE_RTSCTS , };
@@ -130,6 +116,9 @@ static struct platform_device *devices[] __initdata = {static void __init scb9328_init (void ) {imx1_soc_init (); + +mxc_gpio_setup_multiple_pins (mxc_uart1_pins, +ARRAY_SIZE (mxc_uart1_pins),"UART1" );imx1_add_imx_uart0 (&uart_pdata);
Signature · 1 line
1.6.0.4
PATCH 3/3 mxc: iomuxv1: Do not use gpio_request when setting the pin as GPIO
When setting the IOMUX of multiple pins via mxc_gpio_setup_multiple_pins, gpio_request is called and this prevents subsequent calls of gpio_request done by drivers to succeed.
Remove gpio_request call from mxc_gpio_setup_multiple_pins function.
As gpio_request is removed from mxc_gpio_setup_multiple_pins, there is no need to have mxc_gpio_release_multiple_pins anymore, so remove this function.
Tested on a mx27_3ds board and after applying this patch it is possible to define all the IOMUX setup in a static array
--- arch/arm/plat-mxc/include/mach/iomux-v1.h | 1 - arch/arm/plat-mxc/iomux-v1.c | 32 ----------------------------- 2 files changed, 0 insertions(+), 33 deletions(-)
arch/arm/plat-mxc/include/mach/iomux-v1.h +0 -1
@@ -95,7 +95,6 @@extern int mxc_gpio_mode (int gpio_mode);extern int mxc_gpio_setup_multiple_pins (const int *pin_list,unsigned count,const char *label); -extern void mxc_gpio_release_multiple_pins (const int *pin_list,int count);extern int __init imx_iomuxv1_init (void __iomem *base,int numports);
arch/arm/plat-mxc/iomux-v1.c +0 -32
@@ -172,45 +172,13 @@ static int imx_iomuxv1_setup_multiple(const int *list, unsigned count)int mxc_gpio_setup_multiple_pins (const int *pin_list,unsigned count,const char *label) { -size_t i;int ret; -for (i =0 ; i < count; ++i) { -unsigned gpio = pin_list[i] & (GPIO_PIN_MASK |GPIO_PORT_MASK ); - - ret =gpio_request (gpio, label); -if (ret) - goto err_gpio_request; - } - ret =imx_iomuxv1_setup_multiple (pin_list, count); -if (ret) - goto err_setup; - -return 0 ; - -err_setup: -BUG_ON (i != count); - -err_gpio_request: -mxc_gpio_release_multiple_pins (pin_list, i); -return ret; }EXPORT_SYMBOL (mxc_gpio_setup_multiple_pins); -void mxc_gpio_release_multiple_pins (const int *pin_list,int count) -{ -size_t i; - -for (i =0 ; i < count; ++i) { -unsigned gpio = pin_list[i] & (GPIO_PIN_MASK |GPIO_PORT_MASK ); - -gpio_free (gpio); - } -} -EXPORT_SYMBOL (mxc_gpio_release_multiple_pins); -int __init imx_iomuxv1_init (void __iomem *base,int numports) { imx_iomuxv1_baseaddr = base;
Signature · 1 line
1.6.0.4
Sascha Hauer
maintainerPATCH 1/3 ARM: imx2: Fix GPIO iosize
In reply to Fabio EstevamAll applied for next.
Sascha
Quoted 84 lines · Fabio Estevam
On MX1, MX21 and MX27 each GPIO port has an address space of 256 bytes.
Fix the iosize for these platforms.
Tested on a
mx27_3dsboard that can boot fine after this change.Cc Shawn Guo <[email protected]>Signed-off-by Fabio Estevam <[email protected]>---
This applies on Sascha's for-next brancharch/arm/mach-imx/mm-imx1.c | 12 ++++++++---- arch/arm/mach-imx/mm-imx21.c | 12 ++++++------ arch/arm/mach-imx/mm-imx27.c | 12 ++++++------ 3 files changed, 20 insertions(+), 16 deletions(-)arch/arm/mach-imx/mm-imx1.c +8
-4@@ -50,8 +50,12 @@ void __init mx1_init_irq(void)void __init imx1_soc_init (void ) { -mxc_register_gpio (0 ,MX1_GPIO1_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTA ,0 ); -mxc_register_gpio (1 ,MX1_GPIO2_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTB ,0 ); -mxc_register_gpio (2 ,MX1_GPIO3_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTC ,0 ); -mxc_register_gpio (3 ,MX1_GPIO4_BASE_ADDR ,SZ_4K ,MX1_GPIO_INT_PORTD ,0 ); +mxc_register_gpio (0 ,MX1_GPIO1_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTA ,0 ); +mxc_register_gpio (1 ,MX1_GPIO2_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTB ,0 ); +mxc_register_gpio (2 ,MX1_GPIO3_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTC ,0 ); +mxc_register_gpio (3 ,MX1_GPIO4_BASE_ADDR ,SZ_256 , +MX1_GPIO_INT_PORTD ,0 ); }arch/arm/mach-imx/mm-imx21.c +6
-6@@ -76,10 +76,10 @@ void __init mx21_init_irq(void)void __init imx21_soc_init (void ) { -mxc_register_gpio (0 ,MX21_GPIO1_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (1 ,MX21_GPIO2_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (2 ,MX21_GPIO3_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (3 ,MX21_GPIO4_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (4 ,MX21_GPIO5_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); -mxc_register_gpio (5 ,MX21_GPIO6_BASE_ADDR ,SZ_4K ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (0 ,MX21_GPIO1_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (1 ,MX21_GPIO2_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (2 ,MX21_GPIO3_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (3 ,MX21_GPIO4_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (4 ,MX21_GPIO5_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); +mxc_register_gpio (5 ,MX21_GPIO6_BASE_ADDR ,SZ_256 ,MX21_INT_GPIO ,0 ); }arch/arm/mach-imx/mm-imx27.c +6
-6@@ -76,10 +76,10 @@ void __init mx27_init_irq(void)void __init imx27_soc_init (void ) { -mxc_register_gpio (0 ,MX27_GPIO1_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (1 ,MX27_GPIO2_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (2 ,MX27_GPIO3_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (3 ,MX27_GPIO4_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (4 ,MX27_GPIO5_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); -mxc_register_gpio (5 ,MX27_GPIO6_BASE_ADDR ,SZ_4K ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (0 ,MX27_GPIO1_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (1 ,MX27_GPIO2_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (2 ,MX27_GPIO3_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (3 ,MX27_GPIO4_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (4 ,MX27_GPIO5_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); +mxc_register_gpio (5 ,MX27_GPIO6_BASE_ADDR ,SZ_256 ,MX27_INT_GPIO ,0 ); }Signature · 1 line
1.6.0.4
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |