Commit b78d8e59 authored by Shawn Guo's avatar Shawn Guo Committed by Grant Likely

gpio/mxc: Change gpio-mxc into an upstanding gpio driver

The patch makes necessary changes on gpio-mxc as below to turn it
into an upstanding gpio driver.

 * Add a list to save all mx2 ports references, so that
   mx2_gpio_irq_handler can walk through all interrupt status
   registers

 * Use readl/writel to replace mach-specific accessors
   __raw_readl/__raw_writel

 * Change mxc_gpio_init into mxc_gpio_probe function

 * Move "struct mxc_gpio_port" into gpio-mxc.c, as it needs not to
   be public at all, and also make some other cleanup on
   plat-mxc/include/mach/gpio.h at the same time

And the patch then migrates mach-imx and mach-mx5 to the updated
driver by adding corresponding platform devices.
Signed-off-by: default avatarShawn Guo <shawn.guo@linaro.org>
Acked-by: default avatarOlof Johansson <olof@lixom.net>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent d37a65bb
...@@ -115,6 +115,8 @@ static struct platform_device *devices[] __initdata = { ...@@ -115,6 +115,8 @@ static struct platform_device *devices[] __initdata = {
static void __init apf9328_init(void) static void __init apf9328_init(void)
{ {
imx1_soc_init();
mxc_gpio_setup_multiple_pins(apf9328_pins, mxc_gpio_setup_multiple_pins(apf9328_pins,
ARRAY_SIZE(apf9328_pins), ARRAY_SIZE(apf9328_pins),
"APF9328"); "APF9328");
......
...@@ -490,6 +490,8 @@ static struct platform_device *devices[] __initdata = { ...@@ -490,6 +490,8 @@ static struct platform_device *devices[] __initdata = {
*/ */
static void __init armadillo5x0_init(void) static void __init armadillo5x0_init(void)
{ {
imx31_soc_init();
mxc_iomux_setup_multiple_pins(armadillo5x0_pins, mxc_iomux_setup_multiple_pins(armadillo5x0_pins,
ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0");
......
...@@ -42,6 +42,8 @@ static const unsigned int bug_pins[] __initconst = { ...@@ -42,6 +42,8 @@ static const unsigned int bug_pins[] __initconst = {
static void __init bug_board_init(void) static void __init bug_board_init(void)
{ {
imx31_soc_init();
mxc_iomux_setup_multiple_pins(bug_pins, mxc_iomux_setup_multiple_pins(bug_pins,
ARRAY_SIZE(bug_pins), "uart-4"); ARRAY_SIZE(bug_pins), "uart-4");
imx31_add_imx_uart4(&uart_pdata); imx31_add_imx_uart4(&uart_pdata);
......
...@@ -250,6 +250,8 @@ __setup("otg_mode=", eukrea_cpuimx27_otg_mode); ...@@ -250,6 +250,8 @@ __setup("otg_mode=", eukrea_cpuimx27_otg_mode);
static void __init eukrea_cpuimx27_init(void) static void __init eukrea_cpuimx27_init(void)
{ {
imx27_soc_init();
mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins, mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27"); ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
......
...@@ -156,6 +156,8 @@ __setup("otg_mode=", eukrea_cpuimx35_otg_mode); ...@@ -156,6 +156,8 @@ __setup("otg_mode=", eukrea_cpuimx35_otg_mode);
*/ */
static void __init eukrea_cpuimx35_init(void) static void __init eukrea_cpuimx35_init(void)
{ {
imx35_soc_init();
mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads, mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
ARRAY_SIZE(eukrea_cpuimx35_pads)); ARRAY_SIZE(eukrea_cpuimx35_pads));
......
...@@ -125,6 +125,8 @@ __setup("otg_mode=", eukrea_cpuimx25_otg_mode); ...@@ -125,6 +125,8 @@ __setup("otg_mode=", eukrea_cpuimx25_otg_mode);
static void __init eukrea_cpuimx25_init(void) static void __init eukrea_cpuimx25_init(void)
{ {
imx25_soc_init();
if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
ARRAY_SIZE(eukrea_cpuimx25_pads))) ARRAY_SIZE(eukrea_cpuimx25_pads)))
printk(KERN_ERR "error setting cpuimx25 pads !\n"); printk(KERN_ERR "error setting cpuimx25 pads !\n");
......
...@@ -231,6 +231,8 @@ static void __init visstrim_m10_board_init(void) ...@@ -231,6 +231,8 @@ static void __init visstrim_m10_board_init(void)
{ {
int ret; int ret;
imx27_soc_init();
ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins, ret = mxc_gpio_setup_multiple_pins(visstrim_m10_pins,
ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10"); ARRAY_SIZE(visstrim_m10_pins), "VISSTRIM_M10");
if (ret) if (ret)
......
...@@ -50,6 +50,8 @@ static const int mx27ipcam_pins[] __initconst = { ...@@ -50,6 +50,8 @@ static const int mx27ipcam_pins[] __initconst = {
static void __init mx27ipcam_init(void) static void __init mx27ipcam_init(void)
{ {
imx27_soc_init();
mxc_gpio_setup_multiple_pins(mx27ipcam_pins, ARRAY_SIZE(mx27ipcam_pins), mxc_gpio_setup_multiple_pins(mx27ipcam_pins, ARRAY_SIZE(mx27ipcam_pins),
"mx27ipcam"); "mx27ipcam");
......
...@@ -59,6 +59,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = { ...@@ -59,6 +59,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
static void __init mx27lite_init(void) static void __init mx27lite_init(void)
{ {
imx27_soc_init();
mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins), mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
"imx27lite"); "imx27lite");
imx27_add_imx_uart0(&uart_pdata); imx27_add_imx_uart0(&uart_pdata);
......
...@@ -223,6 +223,8 @@ static int kzm_pins[] __initdata = { ...@@ -223,6 +223,8 @@ static int kzm_pins[] __initdata = {
*/ */
static void __init kzm_board_init(void) static void __init kzm_board_init(void)
{ {
imx31_soc_init();
mxc_iomux_setup_multiple_pins(kzm_pins, mxc_iomux_setup_multiple_pins(kzm_pins,
ARRAY_SIZE(kzm_pins), "kzm"); ARRAY_SIZE(kzm_pins), "kzm");
kzm_init_ext_uart(); kzm_init_ext_uart();
......
...@@ -115,6 +115,8 @@ static struct i2c_board_info mx1ads_i2c_devices[] = { ...@@ -115,6 +115,8 @@ static struct i2c_board_info mx1ads_i2c_devices[] = {
*/ */
static void __init mx1ads_init(void) static void __init mx1ads_init(void)
{ {
imx1_soc_init();
mxc_gpio_setup_multiple_pins(mx1ads_pins, mxc_gpio_setup_multiple_pins(mx1ads_pins,
ARRAY_SIZE(mx1ads_pins), "mx1ads"); ARRAY_SIZE(mx1ads_pins), "mx1ads");
......
...@@ -279,6 +279,8 @@ static struct platform_device *platform_devices[] __initdata = { ...@@ -279,6 +279,8 @@ static struct platform_device *platform_devices[] __initdata = {
static void __init mx21ads_board_init(void) static void __init mx21ads_board_init(void)
{ {
imx21_soc_init();
mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins), mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins),
"mx21ads"); "mx21ads");
......
...@@ -219,6 +219,8 @@ static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = { ...@@ -219,6 +219,8 @@ static const struct esdhc_platform_data mx25pdk_esdhc_pdata __initconst = {
static void __init mx25pdk_init(void) static void __init mx25pdk_init(void)
{ {
imx25_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
ARRAY_SIZE(mx25pdk_pads)); ARRAY_SIZE(mx25pdk_pads));
......
...@@ -267,6 +267,8 @@ static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = { ...@@ -267,6 +267,8 @@ static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = {
static void __init mx27pdk_init(void) static void __init mx27pdk_init(void)
{ {
imx27_soc_init();
mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
"mx27pdk"); "mx27pdk");
mx27_3ds_sdhc1_enable_level_translator(); mx27_3ds_sdhc1_enable_level_translator();
......
...@@ -288,6 +288,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = { ...@@ -288,6 +288,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
static void __init mx27ads_board_init(void) static void __init mx27ads_board_init(void)
{ {
imx27_soc_init();
mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins), mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins),
"mx27ads"); "mx27ads");
......
...@@ -689,6 +689,8 @@ static void __init mx31_3ds_init(void) ...@@ -689,6 +689,8 @@ static void __init mx31_3ds_init(void)
{ {
int ret; int ret;
imx31_soc_init();
mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins), mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins),
"mx31_3ds"); "mx31_3ds");
......
...@@ -516,6 +516,8 @@ static void __init mx31ads_init_irq(void) ...@@ -516,6 +516,8 @@ static void __init mx31ads_init_irq(void)
static void __init mx31ads_init(void) static void __init mx31ads_init(void)
{ {
imx31_soc_init();
mxc_init_extuart(); mxc_init_extuart();
mxc_init_imx_uart(); mxc_init_imx_uart();
mxc_init_i2c(); mxc_init_i2c();
......
...@@ -243,6 +243,8 @@ core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444); ...@@ -243,6 +243,8 @@ core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
static void __init mx31lilly_board_init(void) static void __init mx31lilly_board_init(void)
{ {
imx31_soc_init();
switch (mx31lilly_baseboard) { switch (mx31lilly_baseboard) {
case MX31LILLY_NOBOARD: case MX31LILLY_NOBOARD:
break; break;
......
...@@ -230,6 +230,8 @@ static void __init mx31lite_init(void) ...@@ -230,6 +230,8 @@ static void __init mx31lite_init(void)
{ {
int ret; int ret;
imx31_soc_init();
switch (mx31lite_baseboard) { switch (mx31lite_baseboard) {
case MX31LITE_NOBOARD: case MX31LITE_NOBOARD:
break; break;
......
...@@ -507,6 +507,8 @@ core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444); ...@@ -507,6 +507,8 @@ core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
*/ */
static void __init mx31moboard_init(void) static void __init mx31moboard_init(void)
{ {
imx31_soc_init();
mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins), mxc_iomux_setup_multiple_pins(moboard_pins, ARRAY_SIZE(moboard_pins),
"moboard"); "moboard");
......
...@@ -179,6 +179,8 @@ static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = { ...@@ -179,6 +179,8 @@ static const struct imxi2c_platform_data mx35_3ds_i2c0_data __initconst = {
*/ */
static void __init mx35_3ds_init(void) static void __init mx35_3ds_init(void)
{ {
imx35_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads)); mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
imx35_add_fec(NULL); imx35_add_fec(NULL);
......
...@@ -233,6 +233,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = { ...@@ -233,6 +233,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
static void __init mxt_td60_board_init(void) static void __init mxt_td60_board_init(void)
{ {
imx27_soc_init();
mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins), mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins),
"MXT_TD60"); "MXT_TD60");
......
...@@ -357,6 +357,8 @@ static void __init pca100_init(void) ...@@ -357,6 +357,8 @@ static void __init pca100_init(void)
{ {
int ret; int ret;
imx27_soc_init();
/* SSI unit */ /* SSI unit */
mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0, mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
MXC_AUDMUX_V1_PCR_SYN | /* 4wire mode */ MXC_AUDMUX_V1_PCR_SYN | /* 4wire mode */
......
...@@ -576,6 +576,8 @@ static void __init pcm037_init(void) ...@@ -576,6 +576,8 @@ static void __init pcm037_init(void)
{ {
int ret; int ret;
imx31_soc_init();
mxc_iomux_set_gpr(MUX_PGP_UH2, 1); mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins), mxc_iomux_setup_multiple_pins(pcm037_pins, ARRAY_SIZE(pcm037_pins),
......
...@@ -295,6 +295,8 @@ static const struct mxc_usbh_platform_data usbh2_pdata __initconst = { ...@@ -295,6 +295,8 @@ static const struct mxc_usbh_platform_data usbh2_pdata __initconst = {
static void __init pcm038_init(void) static void __init pcm038_init(void)
{ {
imx27_soc_init();
mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins), mxc_gpio_setup_multiple_pins(pcm038_pins, ARRAY_SIZE(pcm038_pins),
"PCM038"); "PCM038");
......
...@@ -356,6 +356,8 @@ static struct esdhc_platform_data sd1_pdata = { ...@@ -356,6 +356,8 @@ static struct esdhc_platform_data sd1_pdata = {
*/ */
static void __init pcm043_init(void) static void __init pcm043_init(void)
{ {
imx35_soc_init();
mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads)); mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads));
mxc_audmux_v2_configure_port(3, mxc_audmux_v2_configure_port(3,
......
...@@ -244,6 +244,8 @@ static void __init qong_init_fpga(void) ...@@ -244,6 +244,8 @@ static void __init qong_init_fpga(void)
*/ */
static void __init qong_init(void) static void __init qong_init(void)
{ {
imx31_soc_init();
mxc_init_imx_uart(); mxc_init_imx_uart();
qong_init_nor_mtd(); qong_init_nor_mtd();
qong_init_fpga(); qong_init_fpga();
......
...@@ -129,6 +129,8 @@ static struct platform_device *devices[] __initdata = { ...@@ -129,6 +129,8 @@ static struct platform_device *devices[] __initdata = {
*/ */
static void __init scb9328_init(void) static void __init scb9328_init(void)
{ {
imx1_soc_init();
imx1_add_imx_uart0(&uart_pdata); imx1_add_imx_uart0(&uart_pdata);
printk(KERN_INFO"Scb9328: Adding devices\n"); printk(KERN_INFO"Scb9328: Adding devices\n");
......
...@@ -267,6 +267,8 @@ static struct platform_device *devices[] __initdata = { ...@@ -267,6 +267,8 @@ static struct platform_device *devices[] __initdata = {
*/ */
static void __init vpr200_board_init(void) static void __init vpr200_board_init(void)
{ {
imx35_soc_init();
mxc_iomux_v3_setup_multiple_pads(vpr200_pads, ARRAY_SIZE(vpr200_pads)); mxc_iomux_v3_setup_multiple_pads(vpr200_pads, ARRAY_SIZE(vpr200_pads));
imx35_add_fec(NULL); imx35_add_fec(NULL);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <mach/common.h> #include <mach/common.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/iomux-v1.h> #include <mach/iomux-v1.h>
...@@ -44,15 +43,15 @@ void __init imx1_init_early(void) ...@@ -44,15 +43,15 @@ void __init imx1_init_early(void)
MX1_NUM_GPIO_PORT); MX1_NUM_GPIO_PORT);
} }
static struct mxc_gpio_port imx1_gpio_ports[] = {
DEFINE_IMX_GPIO_PORT_IRQ(MX1, 0, 1, MX1_GPIO_INT_PORTA),
DEFINE_IMX_GPIO_PORT_IRQ(MX1, 1, 2, MX1_GPIO_INT_PORTB),
DEFINE_IMX_GPIO_PORT_IRQ(MX1, 2, 3, MX1_GPIO_INT_PORTC),
DEFINE_IMX_GPIO_PORT_IRQ(MX1, 3, 4, MX1_GPIO_INT_PORTD),
};
void __init mx1_init_irq(void) void __init mx1_init_irq(void)
{ {
mxc_init_irq(MX1_IO_ADDRESS(MX1_AVIC_BASE_ADDR)); mxc_init_irq(MX1_IO_ADDRESS(MX1_AVIC_BASE_ADDR));
mxc_gpio_init(imx1_gpio_ports, ARRAY_SIZE(imx1_gpio_ports)); }
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);
} }
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <mach/common.h> #include <mach/common.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/iomux-v1.h> #include <mach/iomux-v1.h>
...@@ -70,17 +69,17 @@ void __init imx21_init_early(void) ...@@ -70,17 +69,17 @@ void __init imx21_init_early(void)
MX21_NUM_GPIO_PORT); MX21_NUM_GPIO_PORT);
} }
static struct mxc_gpio_port imx21_gpio_ports[] = {
DEFINE_IMX_GPIO_PORT_IRQ(MX21, 0, 1, MX21_INT_GPIO),
DEFINE_IMX_GPIO_PORT(MX21, 1, 2),
DEFINE_IMX_GPIO_PORT(MX21, 2, 3),
DEFINE_IMX_GPIO_PORT(MX21, 3, 4),
DEFINE_IMX_GPIO_PORT(MX21, 4, 5),
DEFINE_IMX_GPIO_PORT(MX21, 5, 6),
};
void __init mx21_init_irq(void) void __init mx21_init_irq(void)
{ {
mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR)); mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR));
mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports)); }
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);
} }
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/mx25.h> #include <mach/mx25.h>
#include <mach/iomux-v3.h> #include <mach/iomux-v3.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
/* /*
...@@ -57,16 +56,15 @@ void __init imx25_init_early(void) ...@@ -57,16 +56,15 @@ void __init imx25_init_early(void)
mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR)); mxc_arch_reset_init(MX25_IO_ADDRESS(MX25_WDOG_BASE_ADDR));
} }
static struct mxc_gpio_port imx25_gpio_ports[] = {
DEFINE_IMX_GPIO_PORT_IRQ(MX25, 0, 1, MX25_INT_GPIO1),
DEFINE_IMX_GPIO_PORT_IRQ(MX25, 1, 2, MX25_INT_GPIO2),
DEFINE_IMX_GPIO_PORT_IRQ(MX25, 2, 3, MX25_INT_GPIO3),
DEFINE_IMX_GPIO_PORT_IRQ(MX25, 3, 4, MX25_INT_GPIO4),
};
void __init mx25_init_irq(void) void __init mx25_init_irq(void)
{ {
mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR)); mxc_init_irq(MX25_IO_ADDRESS(MX25_AVIC_BASE_ADDR));
mxc_gpio_init(imx25_gpio_ports, ARRAY_SIZE(imx25_gpio_ports));
} }
void __init imx25_soc_init(void)
{
mxc_register_gpio(0, MX25_GPIO1_BASE_ADDR, SZ_16K, MX25_INT_GPIO1, 0);
mxc_register_gpio(1, MX25_GPIO2_BASE_ADDR, SZ_16K, MX25_INT_GPIO2, 0);
mxc_register_gpio(2, MX25_GPIO3_BASE_ADDR, SZ_16K, MX25_INT_GPIO3, 0);
mxc_register_gpio(3, MX25_GPIO4_BASE_ADDR, SZ_16K, MX25_INT_GPIO4, 0);
}
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <mach/common.h> #include <mach/common.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/iomux-v1.h> #include <mach/iomux-v1.h>
...@@ -70,17 +69,17 @@ void __init imx27_init_early(void) ...@@ -70,17 +69,17 @@ void __init imx27_init_early(void)
MX27_NUM_GPIO_PORT); MX27_NUM_GPIO_PORT);
} }
static struct mxc_gpio_port imx27_gpio_ports[] = {
DEFINE_IMX_GPIO_PORT_IRQ(MX27, 0, 1, MX27_INT_GPIO),
DEFINE_IMX_GPIO_PORT(MX27, 1, 2),
DEFINE_IMX_GPIO_PORT(MX27, 2, 3),
DEFINE_IMX_GPIO_PORT(MX27, 3, 4),
DEFINE_IMX_GPIO_PORT(MX27, 4, 5),
DEFINE_IMX_GPIO_PORT(MX27, 5, 6),
};
void __init mx27_init_irq(void) void __init mx27_init_irq(void)
{ {
mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR)); mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR));
mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports)); }
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);
} }
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <mach/common.h> #include <mach/common.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/iomux-v3.h> #include <mach/iomux-v3.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
static struct map_desc mx31_io_desc[] __initdata = { static struct map_desc mx31_io_desc[] __initdata = {
...@@ -53,14 +52,14 @@ void __init imx31_init_early(void) ...@@ -53,14 +52,14 @@ void __init imx31_init_early(void)
mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
} }
static struct mxc_gpio_port imx31_gpio_ports[] = {
DEFINE_IMX_GPIO_PORT_IRQ(MX31, 0, 1, MX31_INT_GPIO1),
DEFINE_IMX_GPIO_PORT_IRQ(MX31, 1, 2, MX31_INT_GPIO2),
DEFINE_IMX_GPIO_PORT_IRQ(MX31, 2, 3, MX31_INT_GPIO3),
};
void __init mx31_init_irq(void) void __init mx31_init_irq(void)
{ {
mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR)); mxc_init_irq(MX31_IO_ADDRESS(MX31_AVIC_BASE_ADDR));
mxc_gpio_init(imx31_gpio_ports, ARRAY_SIZE(imx31_gpio_ports)); }
void __init imx31_soc_init(void)
{
mxc_register_gpio(0, MX31_GPIO1_BASE_ADDR, SZ_16K, MX31_INT_GPIO1, 0);
mxc_register_gpio(1, MX31_GPIO2_BASE_ADDR, SZ_16K, MX31_INT_GPIO2, 0);
mxc_register_gpio(2, MX31_GPIO3_BASE_ADDR, SZ_16K, MX31_INT_GPIO3, 0);
} }
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <mach/common.h> #include <mach/common.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/iomux-v3.h> #include <mach/iomux-v3.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
static struct map_desc mx35_io_desc[] __initdata = { static struct map_desc mx35_io_desc[] __initdata = {
...@@ -50,14 +49,14 @@ void __init imx35_init_early(void) ...@@ -50,14 +49,14 @@ void __init imx35_init_early(void)
mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
} }
static struct mxc_gpio_port imx35_gpio_ports[] = {
DEFINE_IMX_GPIO_PORT_IRQ(MX35, 0, 1, MX35_INT_GPIO1),
DEFINE_IMX_GPIO_PORT_IRQ(MX35, 1, 2, MX35_INT_GPIO2),
DEFINE_IMX_GPIO_PORT_IRQ(MX35, 2, 3, MX35_INT_GPIO3),
};
void __init mx35_init_irq(void) void __init mx35_init_irq(void)
{ {
mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR)); mxc_init_irq(MX35_IO_ADDRESS(MX35_AVIC_BASE_ADDR));
mxc_gpio_init(imx35_gpio_ports, ARRAY_SIZE(imx35_gpio_ports)); }
void __init imx35_soc_init(void)
{
mxc_register_gpio(0, MX35_GPIO1_BASE_ADDR, SZ_16K, MX35_INT_GPIO1, 0);
mxc_register_gpio(1, MX35_GPIO2_BASE_ADDR, SZ_16K, MX35_INT_GPIO2, 0);
mxc_register_gpio(2, MX35_GPIO3_BASE_ADDR, SZ_16K, MX35_INT_GPIO3, 0);
} }
...@@ -245,6 +245,8 @@ __setup("otg_mode=", eukrea_cpuimx51_otg_mode); ...@@ -245,6 +245,8 @@ __setup("otg_mode=", eukrea_cpuimx51_otg_mode);
*/ */
static void __init eukrea_cpuimx51_init(void) static void __init eukrea_cpuimx51_init(void)
{ {
imx51_soc_init();
mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads, mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
ARRAY_SIZE(eukrea_cpuimx51_pads)); ARRAY_SIZE(eukrea_cpuimx51_pads));
......
...@@ -264,6 +264,8 @@ static struct platform_device *platform_devices[] __initdata = { ...@@ -264,6 +264,8 @@ static struct platform_device *platform_devices[] __initdata = {
static void __init eukrea_cpuimx51sd_init(void) static void __init eukrea_cpuimx51sd_init(void)
{ {
imx51_soc_init();
mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads, mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51sd_pads,
ARRAY_SIZE(eukrea_cpuimx51sd_pads)); ARRAY_SIZE(eukrea_cpuimx51sd_pads));
......
...@@ -192,6 +192,8 @@ static const struct imxi2c_platform_data i2c_data __initconst = { ...@@ -192,6 +192,8 @@ static const struct imxi2c_platform_data i2c_data __initconst = {
*/ */
static void __init mx50_rdp_board_init(void) static void __init mx50_rdp_board_init(void)
{ {
imx50_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx50_rdp_pads, mxc_iomux_v3_setup_multiple_pads(mx50_rdp_pads,
ARRAY_SIZE(mx50_rdp_pads)); ARRAY_SIZE(mx50_rdp_pads));
......
...@@ -135,6 +135,8 @@ static struct spi_board_info mx51_3ds_spi_nor_device[] = { ...@@ -135,6 +135,8 @@ static struct spi_board_info mx51_3ds_spi_nor_device[] = {
*/ */
static void __init mx51_3ds_init(void) static void __init mx51_3ds_init(void)
{ {
imx51_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads, mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads,
ARRAY_SIZE(mx51_3ds_pads)); ARRAY_SIZE(mx51_3ds_pads));
......
...@@ -340,6 +340,8 @@ static void __init mx51_babbage_init(void) ...@@ -340,6 +340,8 @@ static void __init mx51_babbage_init(void)
iomux_v3_cfg_t power_key = _MX51_PAD_EIM_A27__GPIO2_21 | iomux_v3_cfg_t power_key = _MX51_PAD_EIM_A27__GPIO2_21 |
MUX_PAD_CTRL(PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP); MUX_PAD_CTRL(PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP);
imx51_soc_init();
#if defined(CONFIG_CPU_FREQ_IMX) #if defined(CONFIG_CPU_FREQ_IMX)
get_cpu_op = mx51_get_cpu_op; get_cpu_op = mx51_get_cpu_op;
#endif #endif
......
...@@ -236,6 +236,8 @@ late_initcall(mx51_efikamx_power_init); ...@@ -236,6 +236,8 @@ late_initcall(mx51_efikamx_power_init);
static void __init mx51_efikamx_init(void) static void __init mx51_efikamx_init(void)
{ {
imx51_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads, mxc_iomux_v3_setup_multiple_pads(mx51efikamx_pads,
ARRAY_SIZE(mx51efikamx_pads)); ARRAY_SIZE(mx51efikamx_pads));
efika_board_common_init(); efika_board_common_init();
......
...@@ -248,6 +248,8 @@ static void __init mx51_efikasb_board_id(void) ...@@ -248,6 +248,8 @@ static void __init mx51_efikasb_board_id(void)
static void __init efikasb_board_init(void) static void __init efikasb_board_init(void)
{ {
imx51_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx51efikasb_pads, mxc_iomux_v3_setup_multiple_pads(mx51efikasb_pads,
ARRAY_SIZE(mx51efikasb_pads)); ARRAY_SIZE(mx51efikasb_pads));
efika_board_common_init(); efika_board_common_init();
......
...@@ -117,6 +117,8 @@ static const struct spi_imx_master mx53_evk_spi_data __initconst = { ...@@ -117,6 +117,8 @@ static const struct spi_imx_master mx53_evk_spi_data __initconst = {
static void __init mx53_evk_board_init(void) static void __init mx53_evk_board_init(void)
{ {
imx53_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads, mxc_iomux_v3_setup_multiple_pads(mx53_evk_pads,
ARRAY_SIZE(mx53_evk_pads)); ARRAY_SIZE(mx53_evk_pads));
mx53_evk_init_uart(); mx53_evk_init_uart();
......
...@@ -227,6 +227,8 @@ static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = { ...@@ -227,6 +227,8 @@ static const struct imxi2c_platform_data mx53_loco_i2c_data __initconst = {
static void __init mx53_loco_board_init(void) static void __init mx53_loco_board_init(void)
{ {
imx53_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads, mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
ARRAY_SIZE(mx53_loco_pads)); ARRAY_SIZE(mx53_loco_pads));
imx53_add_imx_uart(0, NULL); imx53_add_imx_uart(0, NULL);
......
...@@ -113,6 +113,8 @@ static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = { ...@@ -113,6 +113,8 @@ static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = {
static void __init mx53_smd_board_init(void) static void __init mx53_smd_board_init(void)
{ {
imx53_soc_init();
mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads, mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
ARRAY_SIZE(mx53_smd_pads)); ARRAY_SIZE(mx53_smd_pads));
mx53_smd_init_uart(); mx53_smd_init_uart();
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/gpio.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/imx-uart.h> #include <mach/imx-uart.h>
#include <mach/irqs.h> #include <mach/irqs.h>
...@@ -119,66 +118,3 @@ struct platform_device mxc_usbh2_device = { ...@@ -119,66 +118,3 @@ struct platform_device mxc_usbh2_device = {
.coherent_dma_mask = DMA_BIT_MASK(32), .coherent_dma_mask = DMA_BIT_MASK(32),
}, },
}; };
static struct mxc_gpio_port mxc_gpio_ports[] = {
{
.chip.label = "gpio-0",
.base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR),
.irq = MX51_MXC_INT_GPIO1_LOW,
.irq_high = MX51_MXC_INT_GPIO1_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START
},
{
.chip.label = "gpio-1",
.base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR),
.irq = MX51_MXC_INT_GPIO2_LOW,
.irq_high = MX51_MXC_INT_GPIO2_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1
},
{
.chip.label = "gpio-2",
.base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR),
.irq = MX51_MXC_INT_GPIO3_LOW,
.irq_high = MX51_MXC_INT_GPIO3_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2
},
{
.chip.label = "gpio-3",
.base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR),
.irq = MX51_MXC_INT_GPIO4_LOW,
.irq_high = MX51_MXC_INT_GPIO4_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3
},
{
.chip.label = "gpio-4",
.base = MX53_IO_ADDRESS(MX53_GPIO5_BASE_ADDR),
.irq = MX53_INT_GPIO5_LOW,
.irq_high = MX53_INT_GPIO5_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 4
},
{
.chip.label = "gpio-5",
.base = MX53_IO_ADDRESS(MX53_GPIO6_BASE_ADDR),
.irq = MX53_INT_GPIO6_LOW,
.irq_high = MX53_INT_GPIO6_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 5
},
{
.chip.label = "gpio-6",
.base = MX53_IO_ADDRESS(MX53_GPIO7_BASE_ADDR),
.irq = MX53_INT_GPIO7_LOW,
.irq_high = MX53_INT_GPIO7_HIGH,
.virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 6
},
};
int __init imx51_register_gpios(void)
{
return mxc_gpio_init(mxc_gpio_ports, 4);
}
int __init imx53_register_gpios(void)
{
return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
}
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <mach/hardware.h> #include <mach/hardware.h>
#include <mach/common.h> #include <mach/common.h>
#include <mach/iomux-v3.h> #include <mach/iomux-v3.h>
#include <mach/gpio.h>
#include <mach/irqs.h> #include <mach/irqs.h>
/* /*
...@@ -56,17 +55,17 @@ void __init imx50_init_early(void) ...@@ -56,17 +55,17 @@ void __init imx50_init_early(void)
mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR)); mxc_arch_reset_init(MX50_IO_ADDRESS(MX50_WDOG_BASE_ADDR));
} }
static struct mxc_gpio_port imx50_gpio_ports[] = {
DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 0, 1, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH),
DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 1, 2, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH),
DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 2, 3, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 3, 4, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 4, 5, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
DEFINE_IMX_GPIO_PORT_IRQ_HIGH(MX50, 5, 6, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH),
};
void __init mx50_init_irq(void) void __init mx50_init_irq(void)
{ {
tzic_init_irq(MX50_IO_ADDRESS(MX50_TZIC_BASE_ADDR)); tzic_init_irq(MX50_IO_ADDRESS(MX50_TZIC_BASE_ADDR));
mxc_gpio_init(imx50_gpio_ports, ARRAY_SIZE(imx50_gpio_ports)); }
void __init imx50_soc_init(void)
{
mxc_register_gpio(0, MX50_GPIO1_BASE_ADDR, SZ_16K, MX50_INT_GPIO1_LOW, MX50_INT_GPIO1_HIGH);
mxc_register_gpio(1, MX50_GPIO2_BASE_ADDR, SZ_16K, MX50_INT_GPIO2_LOW, MX50_INT_GPIO2_HIGH);
mxc_register_gpio(2, MX50_GPIO3_BASE_ADDR, SZ_16K, MX50_INT_GPIO3_LOW, MX50_INT_GPIO3_HIGH);
mxc_register_gpio(3, MX50_GPIO4_BASE_ADDR, SZ_16K, MX50_INT_GPIO4_LOW, MX50_INT_GPIO4_HIGH);
mxc_register_gpio(4, MX50_GPIO5_BASE_ADDR, SZ_16K, MX50_INT_GPIO5_LOW, MX50_INT_GPIO5_HIGH);
mxc_register_gpio(5, MX50_GPIO6_BASE_ADDR, SZ_16K, MX50_INT_GPIO6_LOW, MX50_INT_GPIO6_HIGH);
} }
...@@ -69,8 +69,6 @@ void __init imx53_init_early(void) ...@@ -69,8 +69,6 @@ void __init imx53_init_early(void)
mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR)); mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR));
} }
int imx51_register_gpios(void);
void __init mx51_init_irq(void) void __init mx51_init_irq(void)
{ {
unsigned long tzic_addr; unsigned long tzic_addr;
...@@ -86,11 +84,8 @@ void __init mx51_init_irq(void) ...@@ -86,11 +84,8 @@ void __init mx51_init_irq(void)
panic("unable to map TZIC interrupt controller\n"); panic("unable to map TZIC interrupt controller\n");
tzic_init_irq(tzic_virt); tzic_init_irq(tzic_virt);
imx51_register_gpios();
} }
int imx53_register_gpios(void);
void __init mx53_init_irq(void) void __init mx53_init_irq(void)
{ {
unsigned long tzic_addr; unsigned long tzic_addr;
...@@ -103,5 +98,23 @@ void __init mx53_init_irq(void) ...@@ -103,5 +98,23 @@ void __init mx53_init_irq(void)
panic("unable to map TZIC interrupt controller\n"); panic("unable to map TZIC interrupt controller\n");
tzic_init_irq(tzic_virt); tzic_init_irq(tzic_virt);
imx53_register_gpios(); }
void __init imx51_soc_init(void)
{
mxc_register_gpio(0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO1_LOW, MX51_MXC_INT_GPIO1_HIGH);
mxc_register_gpio(1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO2_LOW, MX51_MXC_INT_GPIO2_HIGH);
mxc_register_gpio(2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO3_LOW, MX51_MXC_INT_GPIO3_HIGH);
mxc_register_gpio(3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_MXC_INT_GPIO4_LOW, MX51_MXC_INT_GPIO4_HIGH);
}
void __init imx53_soc_init(void)
{
mxc_register_gpio(0, MX53_GPIO1_BASE_ADDR, SZ_16K, MX53_INT_GPIO1_LOW, MX53_INT_GPIO1_HIGH);
mxc_register_gpio(1, MX53_GPIO2_BASE_ADDR, SZ_16K, MX53_INT_GPIO2_LOW, MX53_INT_GPIO2_HIGH);
mxc_register_gpio(2, MX53_GPIO3_BASE_ADDR, SZ_16K, MX53_INT_GPIO3_LOW, MX53_INT_GPIO3_HIGH);
mxc_register_gpio(3, MX53_GPIO4_BASE_ADDR, SZ_16K, MX53_INT_GPIO4_LOW, MX53_INT_GPIO4_HIGH);
mxc_register_gpio(4, MX53_GPIO5_BASE_ADDR, SZ_16K, MX53_INT_GPIO5_LOW, MX53_INT_GPIO5_HIGH);
mxc_register_gpio(5, MX53_GPIO6_BASE_ADDR, SZ_16K, MX53_INT_GPIO6_LOW, MX53_INT_GPIO6_HIGH);
mxc_register_gpio(6, MX53_GPIO7_BASE_ADDR, SZ_16K, MX53_INT_GPIO7_LOW, MX53_INT_GPIO7_HIGH);
} }
...@@ -89,3 +89,14 @@ struct platform_device *__init imx_add_platform_device_dmamask( ...@@ -89,3 +89,14 @@ struct platform_device *__init imx_add_platform_device_dmamask(
return pdev; return pdev;
} }
struct device mxc_aips_bus = {
.init_name = "mxc_aips",
.parent = &platform_bus,
};
static int __init mxc_device_init(void)
{
return device_register(&mxc_aips_bus);
}
core_initcall(mxc_device_init);
...@@ -2,6 +2,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o ...@@ -2,6 +2,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
obj-y += platform-gpio-mxc.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o
......
/*
* Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
* Copyright 2011 Linaro Limited
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 2 as published by the
* Free Software Foundation.
*/
#include <mach/devices-common.h>
struct platform_device *__init mxc_register_gpio(int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high)
{
struct resource res[] = {
{
.start = iobase,
.end = iobase + iosize - 1,
.flags = IORESOURCE_MEM,
}, {
.start = irq,
.end = irq,
.flags = IORESOURCE_IRQ,
}, {
.start = irq_high,
.end = irq_high,
.flags = IORESOURCE_IRQ,
},
};
return platform_device_register_resndata(&mxc_aips_bus,
"gpio-mxc", id, res, ARRAY_SIZE(res), NULL, 0);
}
...@@ -43,6 +43,15 @@ extern void mx35_init_irq(void); ...@@ -43,6 +43,15 @@ extern void mx35_init_irq(void);
extern void mx50_init_irq(void); extern void mx50_init_irq(void);
extern void mx51_init_irq(void); extern void mx51_init_irq(void);
extern void mx53_init_irq(void); extern void mx53_init_irq(void);
extern void imx1_soc_init(void);
extern void imx21_soc_init(void);
extern void imx25_soc_init(void);
extern void imx27_soc_init(void);
extern void imx31_soc_init(void);
extern void imx35_soc_init(void);
extern void imx50_soc_init(void);
extern void imx51_soc_init(void);
extern void imx53_soc_init(void);
extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq); extern void epit_timer_init(struct clk *timer_clk, void __iomem *base, int irq);
extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int); extern void mxc_timer_init(struct clk *timer_clk, void __iomem *, int);
extern int mx1_clocks_init(unsigned long fref); extern int mx1_clocks_init(unsigned long fref);
...@@ -55,7 +64,8 @@ extern int mx51_clocks_init(unsigned long ckil, unsigned long osc, ...@@ -55,7 +64,8 @@ extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
unsigned long ckih1, unsigned long ckih2); unsigned long ckih1, unsigned long ckih2);
extern int mx53_clocks_init(unsigned long ckil, unsigned long osc, extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
unsigned long ckih1, unsigned long ckih2); unsigned long ckih1, unsigned long ckih2);
extern int mxc_register_gpios(void); extern struct platform_device *mxc_register_gpio(int id,
resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
extern int mxc_register_device(struct platform_device *pdev, void *data); extern int mxc_register_device(struct platform_device *pdev, void *data);
extern void mxc_set_cpu_type(unsigned int type); extern void mxc_set_cpu_type(unsigned int type);
extern void mxc_arch_reset_init(void __iomem *); extern void mxc_arch_reset_init(void __iomem *);
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/init.h> #include <linux/init.h>
extern struct device mxc_aips_bus;
struct platform_device *imx_add_platform_device_dmamask( struct platform_device *imx_add_platform_device_dmamask(
const char *name, int id, const char *name, int id,
const struct resource *res, unsigned int num_resources, const struct resource *res, unsigned int num_resources,
......
...@@ -36,31 +36,4 @@ ...@@ -36,31 +36,4 @@
#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio)) #define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio))
#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) #define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
struct mxc_gpio_port {
void __iomem *base;
int irq;
int irq_high;
int virtual_irq_start;
struct gpio_chip chip;
u32 both_edges;
spinlock_t lock;
};
#define DEFINE_IMX_GPIO_PORT_IRQ_HIGH(soc, _id, _hwid, _irq, _irq_high) \
{ \
.chip.label = "gpio-" #_id, \
.irq = _irq, \
.irq_high = _irq_high, \
.base = soc ## _IO_ADDRESS( \
soc ## _GPIO ## _hwid ## _BASE_ADDR), \
.virtual_irq_start = MXC_GPIO_IRQ_START + (_id) * 32, \
}
#define DEFINE_IMX_GPIO_PORT_IRQ(soc, _id, _hwid, _irq) \
DEFINE_IMX_GPIO_PORT_IRQ_HIGH(soc, _id, _hwid, _irq, 0)
#define DEFINE_IMX_GPIO_PORT(soc, _id, _hwid) \
DEFINE_IMX_GPIO_PORT_IRQ(soc, _id, _hwid, 0)
int mxc_gpio_init(struct mxc_gpio_port*, int);
#endif #endif
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment