Merge tag 'irq' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Jul 2012 00:36:02 +0000 (17:36 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Jul 2012 00:36:02 +0000 (17:36 -0700)
Pull arm-soc sparse IRQ conversion from Arnd Bergmann:
 "The I.MX platform is getting converted to use sparse IRQs.  We are
  doing this for all platforms over time, because this is one of the
  requirements for building a multiplatform kernel, and generally a good
  idea."

* tag 'irq' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
  ARM: imx: select USE_OF
  ARM: imx: Fix build error due to missing irqs.h include
  ARM: imx: enable SPARSE_IRQ for imx platform
  ARM: fiq: change FIQ_START to a variable
  tty: serial: imx: remove the use of MXC_INTERNAL_IRQS
  ARM: imx: remove unneeded mach/irq.h inclusion
  i2c: imx: remove unneeded mach/irqs.h inclusion
  ARM: imx: add a legacy irqdomain for mx31ads
  ARM: imx: add a legacy irqdomain for 3ds_debugboard
  ARM: imx: pass gpio than irq number into mxc_expio_init
  ARM: imx: leave irq_base of wm8350_platform_data uninitialized
  dma: ipu: remove the use of ipu_platform_data
  ARM: imx: move irq_domain_add_legacy call into avic driver
  ARM: imx: move irq_domain_add_legacy call into tzic driver
  gpio/mxc: move irq_domain_add_legacy call into gpio driver
  ARM: imx: eliminate macro IRQ_GPIOx()
  ARM: imx: eliminate macro IOMUX_TO_IRQ()
  ARM: imx: eliminate macro IMX_GPIO_TO_IRQ()

25 files changed:
1  2 
arch/arm/Kconfig
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/devices-imx31.h
arch/arm/mach-imx/devices-imx35.h
arch/arm/mach-imx/imx27-dt.c
arch/arm/mach-imx/mach-cpuimx27.c
arch/arm/mach-imx/mach-cpuimx35.c
arch/arm/mach-imx/mach-cpuimx51sd.c
arch/arm/mach-imx/mach-imx27_visstrim_m10.c
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-imx/mach-mx27_3ds.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-imx/mach-mx31_3ds.c
arch/arm/mach-imx/mach-mx31moboard.c
arch/arm/mach-imx/mach-mx35_3ds.c
arch/arm/mach-imx/mach-mx51_3ds.c
arch/arm/mach-imx/mach-mx53_ard.c
arch/arm/mach-imx/mach-pca100.c
arch/arm/mach-imx/mach-pcm037.c
arch/arm/mach-imx/mach-pcm038.c
arch/arm/mach-imx/mach-pcm043.c
arch/arm/mach-imx/mach-qong.c
arch/arm/mach-imx/mach-vpr200.c
arch/arm/mach-imx/mx31lite-db.c
drivers/gpio/gpio-mxc.c

diff --combined arch/arm/Kconfig
@@@ -250,25 -250,6 +250,25 @@@ choic
        prompt "ARM system type"
        default ARCH_VERSATILE
  
 +config ARCH_SOCFPGA
 +      bool "Altera SOCFPGA family"
 +      select ARCH_WANT_OPTIONAL_GPIOLIB
 +      select ARM_AMBA
 +      select ARM_GIC
 +      select CACHE_L2X0
 +      select CLKDEV_LOOKUP
 +      select COMMON_CLK
 +      select CPU_V7
 +      select DW_APB_TIMER
 +      select DW_APB_TIMER_OF
 +      select GENERIC_CLOCKEVENTS
 +      select GPIO_PL061 if GPIOLIB
 +      select HAVE_ARM_SCU
 +      select SPARSE_IRQ
 +      select USE_OF
 +      help
 +        This enables support for Altera SOCFPGA Cyclone V platform
 +
  config ARCH_INTEGRATOR
        bool "ARM Ltd. Integrator family"
        select ARM_AMBA
        select ICST
        select GENERIC_CLOCKEVENTS
        select PLAT_VERSATILE
 +      select PLAT_VERSATILE_CLOCK
        select PLAT_VERSATILE_FPGA_IRQ
        select NEED_MACH_IO_H
        select NEED_MACH_MEMORY_H
@@@ -297,7 -277,6 +297,7 @@@ config ARCH_REALVIE
        select GENERIC_CLOCKEVENTS
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select PLAT_VERSATILE
 +      select PLAT_VERSATILE_CLOCK
        select PLAT_VERSATILE_CLCD
        select ARM_TIMER_SP804
        select GPIO_PL061 if GPIOLIB
@@@ -316,7 -295,6 +316,7 @@@ config ARCH_VERSATIL
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select NEED_MACH_IO_H if PCI
        select PLAT_VERSATILE
 +      select PLAT_VERSATILE_CLOCK
        select PLAT_VERSATILE_CLCD
        select PLAT_VERSATILE_FPGA_IRQ
        select ARM_TIMER_SP804
@@@ -329,7 -307,7 +329,7 @@@ config ARCH_VEXPRES
        select ARM_AMBA
        select ARM_TIMER_SP804
        select CLKDEV_LOOKUP
 -      select HAVE_MACH_CLKDEV
 +      select COMMON_CLK
        select GENERIC_CLOCKEVENTS
        select HAVE_CLK
        select HAVE_PATA_PLATFORM
        select NO_IOPORT
        select PLAT_VERSATILE
        select PLAT_VERSATILE_CLCD
 +      select REGULATOR_FIXED_VOLTAGE if REGULATOR
        help
          This enables support for the ARM Ltd Versatile Express boards.
  
@@@ -470,6 -447,8 +470,8 @@@ config ARCH_MX
        select CLKSRC_MMIO
        select GENERIC_IRQ_CHIP
        select MULTI_IRQ_HANDLER
+       select SPARSE_IRQ
+       select USE_OF
        help
          Support for Freescale MXC/iMX-based family of processors
  
@@@ -556,18 -535,6 +558,18 @@@ config ARCH_IXP4X
        help
          Support for Intel's IXP4XX (XScale) family of processors.
  
 +config ARCH_MVEBU
 +      bool "Marvell SOCs with Device Tree support"
 +      select GENERIC_CLOCKEVENTS
 +      select MULTI_IRQ_HANDLER
 +      select SPARSE_IRQ
 +      select CLKSRC_MMIO
 +      select GENERIC_IRQ_CHIP
 +      select IRQ_DOMAIN
 +      select COMMON_CLK
 +      help
 +        Support for the Marvell SoC Family with device tree support
 +
  config ARCH_DOVE
        bool "Marvell Dove"
        select CPU_V7
@@@ -602,7 -569,6 +604,7 @@@ config ARCH_LPC32X
        select CLKDEV_LOOKUP
        select GENERIC_CLOCKEVENTS
        select USE_OF
 +      select HAVE_PWM
        help
          Support for the NXP LPC32XX family of processors
  
@@@ -683,7 -649,6 +685,7 @@@ config ARCH_TEGR
        select MIGHT_HAVE_CACHE_L2X0
        select NEED_MACH_IO_H if PCI
        select ARCH_HAS_CPUFREQ
 +      select USE_OF
        help
          This enables support for NVIDIA Tegra based systems (Tegra APX,
          Tegra 6xx and Tegra 2 series).
@@@ -695,7 -660,6 +697,7 @@@ config ARCH_PICOXCEL
        select ARM_VIC
        select CPU_V6K
        select DW_APB_TIMER
 +      select DW_APB_TIMER_OF
        select GENERIC_CLOCKEVENTS
        select GENERIC_GPIO
        select HAVE_TCM
@@@ -951,7 -915,7 +953,7 @@@ config ARCH_NOMADI
        select ARM_AMBA
        select ARM_VIC
        select CPU_ARM926T
 -      select CLKDEV_LOOKUP
 +      select COMMON_CLK
        select GENERIC_CLOCKEVENTS
        select PINCTRL
        select MIGHT_HAVE_CACHE_L2X0
@@@ -974,7 -938,6 +976,7 @@@ config ARCH_DAVINC
  
  config ARCH_OMAP
        bool "TI OMAP"
 +      depends on MMU
        select HAVE_CLK
        select ARCH_REQUIRE_GPIOLIB
        select ARCH_HAS_CPUFREQ
@@@ -1026,8 -989,6 +1028,8 @@@ endchoic
  # Kconfigs may be included either alphabetically (according to the
  # plat- suffix) or along side the corresponding mach-* source.
  #
 +source "arch/arm/mach-mvebu/Kconfig"
 +
  source "arch/arm/mach-at91/Kconfig"
  
  source "arch/arm/mach-bcmring/Kconfig"
@@@ -1062,6 -1023,8 +1064,6 @@@ source "arch/arm/mach-kirkwood/Kconfig
  
  source "arch/arm/mach-ks8695/Kconfig"
  
 -source "arch/arm/mach-lpc32xx/Kconfig"
 -
  source "arch/arm/mach-msm/Kconfig"
  
  source "arch/arm/mach-mv78xx0/Kconfig"
@@@ -1620,7 -1583,6 +1622,7 @@@ config ARCH_NR_GPI
        default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
        default 355 if ARCH_U8500
        default 264 if MACH_H4700
 +      default 512 if SOC_OMAP5
        default 0
        help
          Maximum number of GPIOs in the system.
@@@ -52,7 -52,6 +52,7 @@@ config SOC_IMX2
        select ARCH_MX25
        select COMMON_CLK
        select CPU_ARM926T
 +      select HAVE_CAN_FLEXCAN if CAN
        select ARCH_MXC_IOMUX_V3
        select MXC_AVIC
  
@@@ -74,13 -73,12 +74,13 @@@ config SOC_IMX3
  
  config SOC_IMX35
        bool
 -      select CPU_V6
 +      select CPU_V6K
        select ARCH_MXC_IOMUX_V3
        select COMMON_CLK
        select HAVE_EPIT
        select MXC_AVIC
        select SMP_ON_UP if SMP
 +      select HAVE_CAN_FLEXCAN if CAN
  
  config SOC_IMX5
        select CPU_V7
@@@ -107,7 -105,6 +107,7 @@@ config     SOC_IMX5
        select SOC_IMX5
        select ARCH_MX5
        select ARCH_MX53
 +      select HAVE_CAN_FLEXCAN if CAN
  
  if ARCH_IMX_V4_V5
  
@@@ -161,6 -158,7 +161,6 @@@ config MACH_MX25_3D
        select IMX_HAVE_PLATFORM_IMX2_WDT
        select IMX_HAVE_PLATFORM_IMXDI_RTC
        select IMX_HAVE_PLATFORM_IMX_I2C
 -      select IMX_HAVE_PLATFORM_IMX_SSI
        select IMX_HAVE_PLATFORM_IMX_FB
        select IMX_HAVE_PLATFORM_IMX_KEYPAD
        select IMX_HAVE_PLATFORM_IMX_UART
@@@ -382,7 -380,6 +382,6 @@@ config MACH_IMX27IPCA
  config MACH_IMX27_DT
        bool "Support i.MX27 platforms from device tree"
        select SOC_IMX27
-       select USE_OF
        help
          Include support for Freescale i.MX27 based platforms
          using the device tree for discovery
@@@ -559,14 -556,6 +558,14 @@@ config MACH_BU
          Include support for BUGBase 1.3 platform. This includes specific
          configurations for the board and its peripherals.
  
 +config MACH_IMX31_DT
 +      bool "Support i.MX31 platforms from device tree"
 +      select SOC_IMX31
 +      select USE_OF
 +      help
 +        Include support for Freescale i.MX31 based platforms
 +        using the device tree for discovery.
 +
  comment "MX35 platforms:"
  
  config MACH_PCM043
@@@ -599,7 -588,6 +598,7 @@@ config MACH_MX35_3D
        select IMX_HAVE_PLATFORM_IPU_CORE
        select IMX_HAVE_PLATFORM_MXC_EHCI
        select IMX_HAVE_PLATFORM_MXC_NAND
 +      select IMX_HAVE_PLATFORM_MXC_RTC
        select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
        help
          Include support for MX35PDK platform. This includes specific
@@@ -674,7 -662,6 +673,6 @@@ comment "i.MX51 machines:
  config MACH_IMX51_DT
        bool "Support i.MX51 platforms from device tree"
        select SOC_IMX51
-       select USE_OF
        select MACH_MX51_BABBAGE
        help
          Include support for Freescale i.MX51 based platforms
@@@ -770,7 -757,6 +768,6 @@@ comment "i.MX53 machines:
  config MACH_IMX53_DT
        bool "Support i.MX53 platforms from device tree"
        select SOC_IMX53
-       select USE_OF
        select MACH_MX53_ARD
        select MACH_MX53_EVK
        select MACH_MX53_LOCO
@@@ -837,15 -823,12 +834,14 @@@ config SOC_IMX6
        select COMMON_CLK
        select CPU_V7
        select HAVE_ARM_SCU
 +      select HAVE_CAN_FLEXCAN if CAN
        select HAVE_IMX_GPC
        select HAVE_IMX_MMDC
        select HAVE_IMX_SRC
        select HAVE_SMP
 +      select MFD_ANATOP
        select PINCTRL
        select PINCTRL_IMX6Q
-       select USE_OF
  
        help
          This enables support for Freescale i.MX6 Quad processor.
@@@ -14,7 -14,7 +14,7 @@@ extern const struct imx_fsl_usb2_udc_da
        imx_add_fsl_usb2_udc(&imx31_fsl_usb2_udc_data, pdata)
  
  extern const struct imx_imx2_wdt_data imx31_imx2_wdt_data;
 -#define imx31_add_imx2_wdt(pdata)       \
 +#define imx31_add_imx2_wdt()       \
        imx_add_imx2_wdt(&imx31_imx2_wdt_data)
  
  extern const struct imx_imx_i2c_data imx31_imx_i2c_data[];
@@@ -42,8 -42,8 +42,8 @@@ extern const struct imx_imx_uart_1irq_d
  #define imx31_add_imx_uart4(pdata)    imx31_add_imx_uart(4, pdata)
  
  extern const struct imx_ipu_core_data imx31_ipu_core_data;
- #define imx31_add_ipu_core(pdata)     \
-       imx_add_ipu_core(&imx31_ipu_core_data, pdata)
+ #define imx31_add_ipu_core()          \
+       imx_add_ipu_core(&imx31_ipu_core_data)
  #define imx31_alloc_mx3_camera(pdata) \
        imx_alloc_mx3_camera(&imx31_ipu_core_data, pdata)
  #define imx31_add_mx3_sdc_fb(pdata)   \
@@@ -65,11 -65,11 +65,11 @@@ extern const struct imx_mxc_nand_data i
        imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
  
  extern const struct imx_mxc_rtc_data imx31_mxc_rtc_data;
 -#define imx31_add_mxc_rtc(pdata)      \
 +#define imx31_add_mxc_rtc()   \
        imx_add_mxc_rtc(&imx31_mxc_rtc_data)
  
  extern const struct imx_mxc_w1_data imx31_mxc_w1_data;
 -#define imx31_add_mxc_w1(pdata)       \
 +#define imx31_add_mxc_w1()    \
        imx_add_mxc_w1(&imx31_mxc_w1_data)
  
  extern const struct imx_spi_imx_data imx31_cspi_data[];
@@@ -24,7 -24,7 +24,7 @@@ extern const struct imx_flexcan_data im
  #define imx35_add_flexcan1(pdata)     imx35_add_flexcan(1, pdata)
  
  extern const struct imx_imx2_wdt_data imx35_imx2_wdt_data;
 -#define imx35_add_imx2_wdt(pdata)       \
 +#define imx35_add_imx2_wdt()       \
        imx_add_imx2_wdt(&imx35_imx2_wdt_data)
  
  extern const struct imx_imx_i2c_data imx35_imx_i2c_data[];
@@@ -50,8 -50,8 +50,8 @@@ extern const struct imx_imx_uart_1irq_d
  #define imx35_add_imx_uart2(pdata)    imx35_add_imx_uart(2, pdata)
  
  extern const struct imx_ipu_core_data imx35_ipu_core_data;
- #define imx35_add_ipu_core(pdata)     \
-       imx_add_ipu_core(&imx35_ipu_core_data, pdata)
+ #define imx35_add_ipu_core()          \
+       imx_add_ipu_core(&imx35_ipu_core_data)
  #define imx35_alloc_mx3_camera(pdata) \
        imx_alloc_mx3_camera(&imx35_ipu_core_data, pdata)
  #define imx35_add_mx3_sdc_fb(pdata)   \
@@@ -68,12 -68,8 +68,12 @@@ extern const struct imx_mxc_nand_data i
  #define imx35_add_mxc_nand(pdata)     \
        imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
  
 +extern const struct imx_mxc_rtc_data imx35_mxc_rtc_data;
 +#define imx35_add_mxc_rtc()   \
 +      imx_add_mxc_rtc(&imx35_mxc_rtc_data)
 +
  extern const struct imx_mxc_w1_data imx35_mxc_w1_data;
 -#define imx35_add_mxc_w1(pdata)       \
 +#define imx35_add_mxc_w1()    \
        imx_add_mxc_w1(&imx35_mxc_w1_data)
  
  extern const struct imx_sdhci_esdhc_imx_data imx35_sdhci_esdhc_imx_data[];
@@@ -10,7 -10,6 +10,6 @@@
   */
  
  #include <linux/irq.h>
- #include <linux/irqdomain.h>
  #include <linux/of_irq.h>
  #include <linux/of_platform.h>
  #include <asm/mach/arch.h>
@@@ -33,35 -32,8 +32,8 @@@ static const struct of_dev_auxdata imx2
        { /* sentinel */ }
  };
  
- static int __init imx27_avic_add_irq_domain(struct device_node *np,
-                               struct device_node *interrupt_parent)
- {
-       irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL);
-       return 0;
- }
- static int __init imx27_gpio_add_irq_domain(struct device_node *np,
-                               struct device_node *interrupt_parent)
- {
-       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
-       gpio_irq_base -= 32;
-       irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops,
-                               NULL);
-       return 0;
- }
- static const struct of_device_id imx27_irq_match[] __initconst = {
-       { .compatible = "fsl,imx27-avic", .data = imx27_avic_add_irq_domain, },
-       { .compatible = "fsl,imx27-gpio", .data = imx27_gpio_add_irq_domain, },
-       { /* sentinel */ }
- };
  static void __init imx27_dt_init(void)
  {
-       of_irq_init(imx27_irq_match);
        of_platform_populate(NULL, of_default_bus_match_table,
                             imx27_auxdata_lookup, NULL);
  }
@@@ -75,7 -47,7 +47,7 @@@ static struct sys_timer imx27_timer = 
        .init = imx27_timer_init,
  };
  
 -static const char *imx27_dt_board_compat[] __initdata = {
 +static const char * const imx27_dt_board_compat[] __initconst = {
        "fsl,imx27",
        NULL
  };
@@@ -169,28 -169,28 +169,28 @@@ static struct i2c_board_info eukrea_cpu
  static struct plat_serial8250_port serial_platform_data[] = {
        {
                .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x200000),
-               .irq = IRQ_GPIOB(23),
+               /* irq number is run-time assigned */
                .uartclk = 14745600,
                .regshift = 1,
                .iotype = UPIO_MEM,
                .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
        }, {
                .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x400000),
-               .irq = IRQ_GPIOB(22),
+               /* irq number is run-time assigned */
                .uartclk = 14745600,
                .regshift = 1,
                .iotype = UPIO_MEM,
                .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
        }, {
                .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x800000),
-               .irq = IRQ_GPIOB(27),
+               /* irq number is run-time assigned */
                .uartclk = 14745600,
                .regshift = 1,
                .iotype = UPIO_MEM,
                .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
        }, {
                .mapbase = (unsigned long)(MX27_CS3_BASE_ADDR + 0x1000000),
-               .irq = IRQ_GPIOB(30),
+               /* irq number is run-time assigned */
                .uartclk = 14745600,
                .regshift = 1,
                .iotype = UPIO_MEM,
@@@ -233,18 -233,18 +233,18 @@@ static const struct fsl_usb2_platform_d
        .phy_mode       = FSL_USB2_PHY_ULPI,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init eukrea_cpuimx27_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", eukrea_cpuimx27_otg_mode);
  
@@@ -266,8 -266,8 +266,8 @@@ static void __init eukrea_cpuimx27_init
  
        imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 -      imx27_add_imx2_wdt(NULL);
 -      imx27_add_mxc_w1(NULL);
 +      imx27_add_imx2_wdt();
 +      imx27_add_mxc_w1();
  
  #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
        /* SDHC2 can be used for Wifi */
  #endif
  
  #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
+       serial_platform_data[0].irq = IMX_GPIO_NR(2, 23);
+       serial_platform_data[1].irq = IMX_GPIO_NR(2, 22);
+       serial_platform_data[2].irq = IMX_GPIO_NR(2, 27);
+       serial_platform_data[3].irq = IMX_GPIO_NR(2, 30);
        platform_device_register(&serial_device);
  #endif
  
@@@ -71,7 -71,7 +71,7 @@@ static struct i2c_board_info eukrea_cpu
        }, {
                I2C_BOARD_INFO("tsc2007", 0x48),
                .platform_data  = &tsc2007_info,
-               .irq            = IMX_GPIO_TO_IRQ(TSC2007_IRQGPIO),
+               /* irq number is run-time assigned */
        },
  };
  
@@@ -141,18 -141,18 +141,18 @@@ static const struct fsl_usb2_platform_d
        .workaround     = FLS_USB2_WORKAROUND_ENGCM09152,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init eukrea_cpuimx35_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", eukrea_cpuimx35_otg_mode);
  
@@@ -167,11 -167,12 +167,12 @@@ static void __init eukrea_cpuimx35_init
                        ARRAY_SIZE(eukrea_cpuimx35_pads));
  
        imx35_add_fec(NULL);
 -      imx35_add_imx2_wdt(NULL);
 +      imx35_add_imx2_wdt();
  
        imx35_add_imx_uart0(&uart_pdata);
        imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
  
+       eukrea_cpuimx35_i2c_devices[1].irq = gpio_to_irq(TSC2007_IRQGPIO);
        i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices,
                        ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
        imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
@@@ -217,18 -217,18 +217,18 @@@ static const struct mxc_usbh_platform_d
        .portsc = MXC_EHCI_MODE_ULPI,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init eukrea_cpuimx51sd_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", eukrea_cpuimx51sd_otg_mode);
  
@@@ -258,7 -258,7 +258,7 @@@ static struct spi_board_info cpuimx51sd
                .mode           = SPI_MODE_0,
                .chip_select     = 0,
                .platform_data   = &mcp251x_info,
-               .irq             = IMX_GPIO_TO_IRQ(CAN_IRQGPIO)
+               /* irq number is run-time assigned */
        },
  };
  
@@@ -292,7 -292,7 +292,7 @@@ static void __init eukrea_cpuimx51sd_in
  
        imx51_add_imx_uart(0, &uart_pdata);
        imx51_add_mxc_nand(&eukrea_cpuimx51sd_nand_board_info);
 -      imx51_add_imx2_wdt(0, NULL);
 +      imx51_add_imx2_wdt(0);
  
        gpio_request(ETH_RST, "eth_rst");
        gpio_set_value(ETH_RST, 1);
        msleep(20);
        gpio_set_value(CAN_RST, 1);
        imx51_add_ecspi(0, &cpuimx51sd_ecspi1_pdata);
+       cpuimx51sd_spi_device[0].irq = gpio_to_irq(CAN_IRQGPIO);
        spi_register_board_info(cpuimx51sd_spi_device,
                                ARRAY_SIZE(cpuimx51sd_spi_device));
  
@@@ -38,8 -38,9 +38,9 @@@
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/time.h>
 -#include <asm/system.h>
 +#include <asm/system_info.h>
  #include <mach/common.h>
+ #include <mach/hardware.h>
  #include <mach/iomux-mx27.h>
  
  #include "devices-imx27.h"
@@@ -47,7 -48,7 +48,7 @@@
  #define TVP5150_RSTN (GPIO_PORTC + 18)
  #define TVP5150_PWDN (GPIO_PORTC + 19)
  #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17)
- #define SDHC1_IRQ IRQ_GPIOB(25)
+ #define SDHC1_IRQ_GPIO IMX_GPIO_NR(2, 25)
  
  #define MOTHERBOARD_BIT2      (GPIO_PORTD + 31)
  #define MOTHERBOARD_BIT1      (GPIO_PORTD + 30)
@@@ -307,14 -308,14 +308,14 @@@ static int visstrim_m10_sdhc1_init(stru
  {
        int ret;
  
-       ret = request_irq(SDHC1_IRQ, detect_irq, IRQF_TRIGGER_FALLING,
-                               "mmc-detect", data);
+       ret = request_irq(gpio_to_irq(SDHC1_IRQ_GPIO), detect_irq,
+                         IRQF_TRIGGER_FALLING, "mmc-detect", data);
        return ret;
  }
  
  static void visstrim_m10_sdhc1_exit(struct device *dev, void *data)
  {
-       free_irq(SDHC1_IRQ, data);
+       free_irq(gpio_to_irq(SDHC1_IRQ_GPIO), data);
  }
  
  static const struct imxmmc_platform_data visstrim_m10_sdhc_pdata __initconst = {
@@@ -16,7 -16,6 +16,6 @@@
  #include <linux/init.h>
  #include <linux/io.h>
  #include <linux/irq.h>
- #include <linux/irqdomain.h>
  #include <linux/of.h>
  #include <linux/of_address.h>
  #include <linux/of_irq.h>
@@@ -24,7 -23,6 +23,7 @@@
  #include <linux/pinctrl/machine.h>
  #include <linux/phy.h>
  #include <linux/micrel_phy.h>
 +#include <linux/mfd/anatop.h>
  #include <asm/smp_twd.h>
  #include <asm/hardware/cache-l2x0.h>
  #include <asm/hardware/gic.h>
@@@ -114,45 -112,6 +113,45 @@@ static void __init imx6q_sabrelite_init
        imx6q_sabrelite_cko1_setup();
  }
  
 +static void __init imx6q_usb_init(void)
 +{
 +      struct device_node *np;
 +      struct platform_device *pdev = NULL;
 +      struct anatop *adata = NULL;
 +
 +      np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-anatop");
 +      if (np)
 +              pdev = of_find_device_by_node(np);
 +      if (pdev)
 +              adata = platform_get_drvdata(pdev);
 +      if (!adata) {
 +              if (np)
 +                      of_node_put(np);
 +              return;
 +      }
 +
 +#define HW_ANADIG_USB1_CHRG_DETECT            0x000001b0
 +#define HW_ANADIG_USB2_CHRG_DETECT            0x00000210
 +
 +#define BM_ANADIG_USB_CHRG_DETECT_EN_B                0x00100000
 +#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B  0x00080000
 +
 +      /*
 +       * The external charger detector needs to be disabled,
 +       * or the signal at DP will be poor
 +       */
 +      anatop_write_reg(adata, HW_ANADIG_USB1_CHRG_DETECT,
 +                      BM_ANADIG_USB_CHRG_DETECT_EN_B
 +                      | BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
 +                      ~0);
 +      anatop_write_reg(adata, HW_ANADIG_USB2_CHRG_DETECT,
 +                      BM_ANADIG_USB_CHRG_DETECT_EN_B |
 +                      BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B,
 +                      ~0);
 +
 +      of_node_put(np);
 +}
 +
  static void __init imx6q_init_machine(void)
  {
        /*
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
  
        imx6q_pm_init();
 +      imx6q_usb_init();
  }
  
  static void __init imx6q_map_io(void)
        imx6q_clock_map_io();
  }
  
- static int __init imx6q_gpio_add_irq_domain(struct device_node *np,
-                               struct device_node *interrupt_parent)
- {
-       static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS;
-       gpio_irq_base -= 32;
-       irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops,
-                             NULL);
-       return 0;
- }
  static const struct of_device_id imx6q_irq_match[] __initconst = {
        { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
-       { .compatible = "fsl,imx6q-gpio", .data = imx6q_gpio_add_irq_domain, },
        { /* sentinel */ }
  };
  
@@@ -40,7 -40,6 +40,6 @@@
  #include <mach/common.h>
  #include <mach/iomux-mx27.h>
  #include <mach/ulpi.h>
- #include <mach/irqs.h>
  #include <mach/3ds_debugboard.h>
  
  #include "devices-imx27.h"
@@@ -48,7 -47,6 +47,6 @@@
  #define SD1_EN_GPIO           IMX_GPIO_NR(2, 25)
  #define OTG_PHY_RESET_GPIO    IMX_GPIO_NR(2, 23)
  #define SPI2_SS0              IMX_GPIO_NR(4, 21)
- #define EXPIO_PARENT_INT      gpio_to_irq(IMX_GPIO_NR(3, 28))
  #define PMIC_INT              IMX_GPIO_NR(3, 14)
  #define SPI1_SS0              IMX_GPIO_NR(4, 28)
  #define SD1_CD                        IMX_GPIO_NR(2, 26)
@@@ -241,18 -239,18 +239,18 @@@ static const struct fsl_usb2_platform_d
        .phy_mode       = FSL_USB2_PHY_ULPI,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init mx27_3ds_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", mx27_3ds_otg_mode);
  
@@@ -445,7 -443,7 +443,7 @@@ static struct spi_board_info mx27_3ds_s
                .bus_num        = 1,
                .chip_select    = 0, /* SS0 */
                .platform_data  = &mc13783_pdata,
-               .irq = IMX_GPIO_TO_IRQ(PMIC_INT),
+               /* irq number is run-time assigned */
                .mode = SPI_CS_HIGH,
        }, {
                .modalias       = "l4f00242t03",
@@@ -480,7 -478,7 +478,7 @@@ static void __init mx27pdk_init(void
        imx27_add_fec(NULL);
        imx27_add_imx_keypad(&mx27_3ds_keymap_data);
        imx27_add_mxc_mmc(0, &sdhc1_pdata);
 -      imx27_add_imx2_wdt(NULL);
 +      imx27_add_imx2_wdt();
        otg_phy_init();
  
        if (otg_mode_host) {
  
        imx27_add_spi_imx1(&spi2_pdata);
        imx27_add_spi_imx0(&spi1_pdata);
+       mx27_3ds_spi_devs[0].irq = gpio_to_irq(PMIC_INT);
        spi_register_board_info(mx27_3ds_spi_devs,
                                                ARRAY_SIZE(mx27_3ds_spi_devs));
  
-       if (mxc_expio_init(MX27_CS5_BASE_ADDR, EXPIO_PARENT_INT))
+       if (mxc_expio_init(MX27_CS5_BASE_ADDR, IMX_GPIO_NR(3, 28)))
                pr_warn("Init of the debugboard failed, all devices on the debugboard are unusable.\n");
        imx27_add_imx_i2c(0, &mx27_3ds_i2c0_data);
        platform_add_devices(devices, ARRAY_SIZE(devices));
@@@ -246,25 -246,25 +246,25 @@@ static const struct imx_fb_platform_dat
  static int mx27ads_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
                              void *data)
  {
-       return request_irq(IRQ_GPIOE(21), detect_irq, IRQF_TRIGGER_RISING,
-                          "sdhc1-card-detect", data);
+       return request_irq(gpio_to_irq(IMX_GPIO_NR(5, 21)), detect_irq,
+                          IRQF_TRIGGER_RISING, "sdhc1-card-detect", data);
  }
  
  static int mx27ads_sdhc2_init(struct device *dev, irq_handler_t detect_irq,
                              void *data)
  {
-       return request_irq(IRQ_GPIOB(7), detect_irq, IRQF_TRIGGER_RISING,
-                          "sdhc2-card-detect", data);
+       return request_irq(gpio_to_irq(IMX_GPIO_NR(2, 7)), detect_irq,
+                          IRQF_TRIGGER_RISING, "sdhc2-card-detect", data);
  }
  
  static void mx27ads_sdhc1_exit(struct device *dev, void *data)
  {
-       free_irq(IRQ_GPIOE(21), data);
+       free_irq(gpio_to_irq(IMX_GPIO_NR(5, 21)), data);
  }
  
  static void mx27ads_sdhc2_exit(struct device *dev, void *data)
  {
-       free_irq(IRQ_GPIOB(7), data);
+       free_irq(gpio_to_irq(IMX_GPIO_NR(2, 7)), data);
  }
  
  static const struct imxmmc_platform_data sdhc1_pdata __initconst = {
@@@ -310,7 -310,7 +310,7 @@@ static void __init mx27ads_board_init(v
  
        imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 -      imx27_add_mxc_w1(NULL);
 +      imx27_add_mxc_w1();
  }
  
  static void __init mx27ads_timer_init(void)
@@@ -44,9 -44,6 +44,6 @@@
  
  #include "devices-imx31.h"
  
- /* CPLD IRQ line for external uart, external ethernet etc */
- #define EXPIO_PARENT_INT      IOMUX_TO_IRQ(MX31_PIN_GPIO1_1)
  static int mx31_3ds_pins[] = {
        /* UART1 */
        MX31_PIN_CTS1__CTS1,
@@@ -277,10 -274,6 +274,6 @@@ static const struct fb_videomode fb_mod
        },
  };
  
- static struct ipu_platform_data mx3_ipu_data = {
-       .irq_base = MXC_IPU_IRQ_START,
- };
  static struct mx3fb_platform_data mx3fb_pdata __initdata = {
        .name           = "Epson-VGA",
        .mode           = fb_modedb,
@@@ -317,7 -310,7 +310,7 @@@ static int mx31_3ds_sdhc1_init(struct d
                return ret;
        }
  
-       ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
+       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)),
                          detect_irq, IRQF_DISABLED |
                          IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
                          "sdhc1-detect", data);
@@@ -336,7 -329,7 +329,7 @@@ gpio_free
  
  static void mx31_3ds_sdhc1_exit(struct device *dev, void *data)
  {
-       free_irq(IOMUX_TO_IRQ(MX31_PIN_GPIO3_1), data);
+       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1)), data);
        gpio_free_array(mx31_3ds_sdhc1_gpios,
                         ARRAY_SIZE(mx31_3ds_sdhc1_gpios));
  }
@@@ -539,7 -532,7 +532,7 @@@ static struct spi_board_info mx31_3ds_s
                .bus_num        = 1,
                .chip_select    = 1, /* SS2 */
                .platform_data  = &mc13783_pdata,
-               .irq            = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
+               /* irq number is run-time assigned */
                .mode = SPI_CS_HIGH,
        }, {
                .modalias       = "l4f00242t03",
@@@ -671,18 -664,18 +664,18 @@@ static const struct fsl_usb2_platform_d
        .phy_mode       = FSL_USB2_PHY_ULPI,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init mx31_3ds_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", mx31_3ds_otg_mode);
  
@@@ -714,6 -707,7 +707,7 @@@ static void __init mx31_3ds_init(void
        imx31_add_mxc_nand(&mx31_3ds_nand_board_info);
  
        imx31_add_spi_imx1(&spi1_pdata);
+       mx31_3ds_spi_devs[0].irq = gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
        spi_register_board_info(mx31_3ds_spi_devs,
                                                ARRAY_SIZE(mx31_3ds_spi_devs));
  
        if (!otg_mode_host)
                imx31_add_fsl_usb2_udc(&usbotg_pdata);
  
-       if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT))
+       if (mxc_expio_init(MX31_CS5_BASE_ADDR, IOMUX_TO_GPIO(MX31_PIN_GPIO1_1)))
                printk(KERN_WARNING "Init of the debug board failed, all "
                                    "devices on the debug board are unusable.\n");
 -      imx31_add_imx2_wdt(NULL);
 +      imx31_add_imx2_wdt();
        imx31_add_imx_i2c0(&mx31_3ds_i2c0_data);
        imx31_add_mxc_mmc(0, &sdhc1_pdata);
  
        imx31_add_spi_imx0(&spi0_pdata);
-       imx31_add_ipu_core(&mx3_ipu_data);
+       imx31_add_ipu_core();
        imx31_add_mx3_sdc_fb(&mx3fb_pdata);
  
        /* CSI */
@@@ -303,7 -303,7 +303,7 @@@ static struct imx_ssi_platform_data mob
  static struct spi_board_info moboard_spi_board_info[] __initdata = {
        {
                .modalias = "mc13783",
-               .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
+               /* irq number is run-time assigned */
                .max_speed_hz = 300000,
                .bus_num = 1,
                .chip_select = 0,
@@@ -473,10 -473,6 +473,6 @@@ static const struct gpio_led_platform_d
        .leds           = mx31moboard_leds,
  };
  
- static const struct ipu_platform_data mx3_ipu_data __initconst = {
-       .irq_base = MXC_IPU_IRQ_START,
- };
  static struct platform_device *devices[] __initdata = {
        &mx31moboard_flash,
  };
@@@ -494,7 -490,7 +490,7 @@@ static int __init mx31moboard_init_cam(
        int dma, ret = -ENOMEM;
        struct platform_device *pdev;
  
-       imx31_add_ipu_core(&mx3_ipu_data);
+       imx31_add_ipu_core();
  
        pdev = imx31_alloc_mx3_camera(&camera_pdata);
        if (IS_ERR(pdev))
@@@ -544,7 -540,7 +540,7 @@@ static void __init mx31moboard_init(voi
        platform_add_devices(devices, ARRAY_SIZE(devices));
        gpio_led_register_device(-1, &mx31moboard_led_pdata);
  
 -      imx31_add_imx2_wdt(NULL);
 +      imx31_add_imx2_wdt();
  
        imx31_add_imx_uart0(&uart0_pdata);
        imx31_add_imx_uart4(&uart4_pdata);
  
        gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
        gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
+       moboard_spi_board_info[0].irq =
+                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
        spi_register_board_info(moboard_spi_board_info,
                ARRAY_SIZE(moboard_spi_board_info));
  
@@@ -46,7 -46,6 +46,6 @@@
  #include <mach/hardware.h>
  #include <mach/common.h>
  #include <mach/iomux-mx35.h>
- #include <mach/irqs.h>
  #include <mach/3ds_debugboard.h>
  #include <video/platform_lcd.h>
  
@@@ -80,10 -79,6 +79,6 @@@ static const struct fb_videomode fb_mod
         },
  };
  
- static const struct ipu_platform_data mx3_ipu_data __initconst = {
-       .irq_base = MXC_IPU_IRQ_START,
- };
  static struct mx3fb_platform_data mx3fb_pdata __initdata = {
        .name = "Ceramate-CLAA070VC01",
        .mode = fb_modedb,
@@@ -136,8 -131,6 +131,6 @@@ static struct platform_device mx35_3ds_
        .dev.platform_data = &mx35_3ds_lcd_data,
  };
  
- #define EXPIO_PARENT_INT      gpio_to_irq(IMX_GPIO_NR(1, 1))
  static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
  };
@@@ -297,10 -290,6 +290,6 @@@ err
        return ret;
  }
  
- static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = {
-       .irq_base = MXC_IPU_IRQ_START,
- };
  static struct i2c_board_info mx35_3ds_i2c_camera = {
        I2C_BOARD_INFO("ov2640", 0x30),
  };
@@@ -492,7 -481,7 +481,7 @@@ static struct i2c_board_info mx35_3ds_i
  
        I2C_BOARD_INFO("mc13892", 0x08),
        .platform_data = &mx35_3ds_mc13892_data,
-       .irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT),
+       /* irq number is run-time assigned */
  };
  
  static void __init imx35_3ds_init_mc13892(void)
                return;
        }
  
+       mx35_3ds_i2c_mc13892.irq = gpio_to_irq(GPIO_PMIC_INT);
        i2c_register_board_info(0, &mx35_3ds_i2c_mc13892, 1);
  }
  
@@@ -540,18 -530,18 +530,18 @@@ static const struct mxc_usbh_platform_d
        .portsc         = MXC_EHCI_MODE_SERIAL,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init mx35_3ds_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", mx35_3ds_otg_mode);
  
@@@ -571,8 -561,7 +561,8 @@@ static void __init mx35_3ds_init(void
        mxc_iomux_v3_setup_multiple_pads(mx35pdk_pads, ARRAY_SIZE(mx35pdk_pads));
  
        imx35_add_fec(NULL);
 -      imx35_add_imx2_wdt(NULL);
 +      imx35_add_imx2_wdt();
 +      imx35_add_mxc_rtc();
        platform_add_devices(devices, ARRAY_SIZE(devices));
  
        imx35_add_imx_uart0(&uart_pdata);
        imx35_add_mxc_nand(&mx35pdk_nand_board_info);
        imx35_add_sdhci_esdhc_imx(0, NULL);
  
-       if (mxc_expio_init(MX35_CS5_BASE_ADDR, EXPIO_PARENT_INT))
+       if (mxc_expio_init(MX35_CS5_BASE_ADDR, IMX_GPIO_NR(1, 1)))
                pr_warn("Init of the debugboard failed, all "
                                "devices on the debugboard are unusable.\n");
        imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
        i2c_register_board_info(
                0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds));
  
-       imx35_add_ipu_core(&mx35_3ds_ipu_data);
+       imx35_add_ipu_core();
        platform_device_register(&mx35_3ds_ov2640);
        imx35_3ds_init_camera();
  
@@@ -26,7 -26,6 +26,6 @@@
  
  #include "devices-imx51.h"
  
- #define EXPIO_PARENT_INT      gpio_to_irq(IMX_GPIO_NR(1, 6))
  #define MX51_3DS_ECSPI2_CS    (GPIO_PORTC + 28)
  
  static iomux_v3_cfg_t mx51_3ds_pads[] = {
@@@ -148,13 -147,13 +147,13 @@@ static void __init mx51_3ds_init(void
        spi_register_board_info(mx51_3ds_spi_nor_device,
                                ARRAY_SIZE(mx51_3ds_spi_nor_device));
  
-       if (mxc_expio_init(MX51_CS5_BASE_ADDR, EXPIO_PARENT_INT))
+       if (mxc_expio_init(MX51_CS5_BASE_ADDR, IMX_GPIO_NR(1, 6)))
                printk(KERN_WARNING "Init of the debugboard failed, all "
                                    "devices on the board are unusable.\n");
  
        imx51_add_sdhci_esdhc_imx(0, NULL);
        imx51_add_imx_keypad(&mx51_3ds_map_data);
 -      imx51_add_imx2_wdt(0, NULL);
 +      imx51_add_imx2_wdt(0);
  }
  
  static void __init mx51_3ds_timer_init(void)
@@@ -135,8 -135,7 +135,7 @@@ static struct resource ard_smsc911x_res
                .flags = IORESOURCE_MEM,
        },
        {
-               .start =  IMX_GPIO_TO_IRQ(ARD_ETHERNET_INT_B),
-               .end =  IMX_GPIO_TO_IRQ(ARD_ETHERNET_INT_B),
+               /* irq number is run-time assigned */
                .flags = IORESOURCE_IRQ,
        },
  };
@@@ -240,10 -239,12 +239,12 @@@ static void __init mx53_ard_board_init(
        imx53_ard_common_init();
        mx53_ard_io_init();
        regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
+       ard_smsc911x_resources[1].start = gpio_to_irq(ARD_ETHERNET_INT_B);
+       ard_smsc911x_resources[1].end = gpio_to_irq(ARD_ETHERNET_INT_B);
        platform_add_devices(devices, ARRAY_SIZE(devices));
  
        imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data);
 -      imx53_add_imx2_wdt(0, NULL);
 +      imx53_add_imx2_wdt(0);
        imx53_add_imx_i2c(1, &mx53_ard_i2c2_data);
        imx53_add_imx_i2c(2, &mx53_ard_i2c3_data);
        imx_add_gpio_keys(&ard_button_data);
@@@ -36,7 -36,6 +36,6 @@@
  #include <mach/hardware.h>
  #include <mach/iomux-mx27.h>
  #include <asm/mach/time.h>
- #include <mach/irqs.h>
  #include <mach/ulpi.h>
  
  #include "devices-imx27.h"
@@@ -245,7 -244,7 +244,7 @@@ static int pca100_sdhc2_init(struct dev
  {
        int ret;
  
-       ret = request_irq(IRQ_GPIOC(29), detect_irq,
+       ret = request_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), detect_irq,
                          IRQF_DISABLED | IRQF_TRIGGER_FALLING,
                          "imx-mmc-detect", data);
        if (ret)
  
  static void pca100_sdhc2_exit(struct device *dev, void *data)
  {
-       free_irq(IRQ_GPIOC(29), data);
+       free_irq(gpio_to_irq(IMX_GPIO_NR(3, 29)), data);
  }
  
  static const struct imxmmc_platform_data sdhc_pdata __initconst = {
@@@ -298,18 -297,18 +297,18 @@@ static const struct fsl_usb2_platform_d
        .phy_mode       = FSL_USB2_PHY_ULPI,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init pca100_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", pca100_otg_mode);
  
@@@ -408,8 -407,8 +407,8 @@@ static void __init pca100_init(void
        imx27_add_imx_fb(&pca100_fb_data);
  
        imx27_add_fec(NULL);
 -      imx27_add_imx2_wdt(NULL);
 -      imx27_add_mxc_w1(NULL);
 +      imx27_add_imx2_wdt();
 +      imx27_add_mxc_w1();
  }
  
  static void __init pca100_timer_init(void)
@@@ -225,8 -225,7 +225,7 @@@ static struct resource smsc911x_resourc
                .end            = MX31_CS1_BASE_ADDR + 0x300 + SZ_64K - 1,
                .flags          = IORESOURCE_MEM,
        }, {
-               .start          = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
-               .end            = IOMUX_TO_IRQ(MX31_PIN_GPIO3_1),
+               /* irq number is run-time assigned */
                .flags          = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
        },
  };
@@@ -371,7 -370,7 +370,7 @@@ static int pcm970_sdhc1_init(struct dev
        gpio_direction_input(SDHC1_GPIO_WP);
  #endif
  
-       ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), detect_irq,
+       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), detect_irq,
                        IRQF_DISABLED | IRQF_TRIGGER_FALLING,
                                "sdhc-detect", data);
        if (ret)
@@@ -391,7 -390,7 +390,7 @@@ err_gpio_free
  
  static void pcm970_sdhc1_exit(struct device *dev, void *data)
  {
-       free_irq(IOMUX_TO_IRQ(MX31_PIN_SCK6), data);
+       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_SCK6)), data);
        gpio_free(SDHC1_GPIO_DET);
        gpio_free(SDHC1_GPIO_WP);
  }
@@@ -442,10 -441,6 +441,6 @@@ static struct platform_device *devices[
        &pcm037_mt9v022,
  };
  
- static const struct ipu_platform_data mx3_ipu_data __initconst = {
-       .irq_base = MXC_IPU_IRQ_START,
- };
  static const struct fb_videomode fb_modedb[] = {
        {
                /* 240x320 @ 60 Hz Sharp */
@@@ -511,8 -506,7 +506,7 @@@ static struct resource pcm970_sja1000_r
                .end     = MX31_CS5_BASE_ADDR + 0x100 - 1,
                .flags   = IORESOURCE_MEM,
        }, {
-               .start   = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)),
-               .end     = IOMUX_TO_IRQ(IOMUX_PIN(48, 105)),
+               /* irq number is run-time assigned */
                .flags   = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
        },
  };
@@@ -557,18 -551,18 +551,18 @@@ static const struct fsl_usb2_platform_d
        .phy_mode       = FSL_USB2_PHY_ULPI,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init pcm037_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", pcm037_otg_mode);
  
@@@ -619,13 -613,13 +613,13 @@@ static void __init pcm037_init(void
  
        platform_add_devices(devices, ARRAY_SIZE(devices));
  
 -      imx31_add_imx2_wdt(NULL);
 +      imx31_add_imx2_wdt();
        imx31_add_imx_uart0(&uart_pdata);
        /* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */
        imx31_add_imx_uart1(&uart_pdata);
        imx31_add_imx_uart2(&uart_pdata);
  
 -      imx31_add_mxc_w1(NULL);
 +      imx31_add_mxc_w1();
  
        /* LAN9217 IRQ pin */
        ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1), "lan9217-irq");
                pr_warning("could not get LAN irq gpio\n");
        else {
                gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
+               smsc911x_resources[1].start =
+                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
+               smsc911x_resources[1].end =
+                       gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_GPIO3_1));
                platform_device_register(&pcm037_eth);
        }
  
  
        imx31_add_mxc_nand(&pcm037_nand_board_info);
        imx31_add_mxc_mmc(0, &sdhc_pdata);
-       imx31_add_ipu_core(&mx3_ipu_data);
+       imx31_add_ipu_core();
        imx31_add_mx3_sdc_fb(&mx3fb_pdata);
  
        /* CSI */
  
        pcm037_init_camera();
  
+       pcm970_sja1000_resources[1].start =
+                       gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
+       pcm970_sja1000_resources[1].end =
+                       gpio_to_irq(IOMUX_TO_GPIO(IOMUX_PIN(48, 105)));
        platform_device_register(&pcm970_sja1000);
  
        if (otg_mode_host) {
@@@ -27,6 -27,7 +27,7 @@@
  #include <linux/mfd/mc13783.h>
  #include <linux/spi/spi.h>
  #include <linux/irq.h>
+ #include <linux/gpio.h>
  
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
@@@ -274,7 -275,7 +275,7 @@@ static struct mc13xxx_platform_data pcm
  static struct spi_board_info pcm038_spi_board_info[] __initdata = {
        {
                .modalias = "mc13783",
-               .irq = IRQ_GPIOB(23),
+               /* irq number is run-time assigned */
                .max_speed_hz = 300000,
                .bus_num = 0,
                .chip_select = 0,
@@@ -325,6 -326,7 +326,7 @@@ static void __init pcm038_init(void
        mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN);
  
        imx27_add_spi_imx0(&pcm038_spi0_data);
+       pcm038_spi_board_info[0].irq = gpio_to_irq(IMX_GPIO_NR(2, 23));
        spi_register_board_info(pcm038_spi_board_info,
                                ARRAY_SIZE(pcm038_spi_board_info));
  
  
        imx27_add_fec(NULL);
        platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
 -      imx27_add_imx2_wdt(NULL);
 -      imx27_add_mxc_w1(NULL);
 +      imx27_add_imx2_wdt();
 +      imx27_add_mxc_w1();
  
  #ifdef CONFIG_MACH_PCM970_BASEBOARD
        pcm970_baseboard_init();
@@@ -76,10 -76,6 +76,6 @@@ static const struct fb_videomode fb_mod
        },
  };
  
- static const struct ipu_platform_data mx3_ipu_data __initconst = {
-       .irq_base = MXC_IPU_IRQ_START,
- };
  static struct mx3fb_platform_data mx3fb_pdata __initdata = {
        .name           = "Sharp-LQ035Q7",
        .mode           = fb_modedb,
@@@ -330,18 -326,18 +326,18 @@@ static const struct fsl_usb2_platform_d
        .phy_mode       = FSL_USB2_PHY_UTMI,
  };
  
 -static int otg_mode_host;
 +static bool otg_mode_host __initdata;
  
  static int __init pcm043_otg_mode(char *options)
  {
        if (!strcmp(options, "host"))
 -              otg_mode_host = 1;
 +              otg_mode_host = true;
        else if (!strcmp(options, "device"))
 -              otg_mode_host = 0;
 +              otg_mode_host = false;
        else
                pr_info("otg_mode neither \"host\" nor \"device\". "
                        "Defaulting to device\n");
 -      return 0;
 +      return 1;
  }
  __setup("otg_mode=", pcm043_otg_mode);
  
@@@ -363,7 -359,7 +359,7 @@@ static void __init pcm043_init(void
  
        imx35_add_fec(NULL);
        platform_add_devices(devices, ARRAY_SIZE(devices));
 -      imx35_add_imx2_wdt(NULL);
 +      imx35_add_imx2_wdt();
  
        imx35_add_imx_uart0(&uart_pdata);
        imx35_add_mxc_nand(&pcm037_nand_board_info);
  
        imx35_add_imx_i2c0(&pcm043_i2c0_data);
  
-       imx35_add_ipu_core(&mx3_ipu_data);
+       imx35_add_ipu_core();
        imx35_add_mx3_sdc_fb(&mx3fb_pdata);
  
        if (otg_mode_host) {
@@@ -22,7 -22,6 +22,6 @@@
  #include <linux/gpio.h>
  
  #include <mach/hardware.h>
- #include <mach/irqs.h>
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/time.h>
@@@ -51,8 -50,6 +50,6 @@@
        (QONG_FPGA_BASEADDR + QONG_DNET_ID * QONG_FPGA_PERIPH_SIZE)
  #define QONG_DNET_SIZE                0x00001000
  
- #define QONG_FPGA_IRQ         IOMUX_TO_IRQ(MX31_PIN_DTR_DCE1)
  static const struct imxuart_platform_data uart_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
  };
@@@ -78,8 -75,7 +75,7 @@@ static struct resource dnet_resources[
                .end    = QONG_DNET_BASEADDR + QONG_DNET_SIZE - 1,
                .flags  = IORESOURCE_MEM,
        }, {
-               .start  = QONG_FPGA_IRQ,
-               .end    = QONG_FPGA_IRQ,
+               /* irq number is run-time assigned */
                .flags  = IORESOURCE_IRQ,
        },
  };
@@@ -95,6 -91,10 +91,10 @@@ static int __init qong_init_dnet(void
  {
        int ret;
  
+       dnet_resources[1].start =
+               gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1));
+       dnet_resources[1].end =
+               gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1));
        ret = platform_device_register(&dnet_device);
        return ret;
  }
@@@ -252,7 -252,7 +252,7 @@@ static void __init qong_init(void
        mxc_init_imx_uart();
        qong_init_nor_mtd();
        qong_init_fpga();
 -      imx31_add_imx2_wdt(NULL);
 +      imx31_add_imx2_wdt();
  }
  
  static void __init qong_timer_init(void)
@@@ -31,7 -31,6 +31,6 @@@
  #include <mach/hardware.h>
  #include <mach/common.h>
  #include <mach/iomux-mx35.h>
- #include <mach/irqs.h>
  
  #include <linux/i2c.h>
  #include <linux/i2c/at24.h>
@@@ -87,10 -86,6 +86,6 @@@ static const struct fb_videomode fb_mod
        }
  };
  
- static const struct ipu_platform_data mx3_ipu_data __initconst = {
-       .irq_base = MXC_IPU_IRQ_START,
- };
  static struct mx3fb_platform_data mx3fb_pdata __initdata = {
        .name           = "PT0708048",
        .mode           = fb_modedb,
@@@ -162,7 -157,7 +157,7 @@@ static struct i2c_board_info vpr200_i2c
        }, {
                I2C_BOARD_INFO("mc13892", 0x08),
                .platform_data = &vpr200_pmic,
-               .irq = IMX_GPIO_TO_IRQ(GPIO_PMIC_INT),
+               /* irq number is run-time assigned */
        }
  };
  
@@@ -272,7 -267,7 +267,7 @@@ static void __init vpr200_board_init(vo
        mxc_iomux_v3_setup_multiple_pads(vpr200_pads, ARRAY_SIZE(vpr200_pads));
  
        imx35_add_fec(NULL);
 -      imx35_add_imx2_wdt(NULL);
 +      imx35_add_imx2_wdt();
        imx_add_gpio_keys(&vpr200_gpio_keys_data);
  
        platform_add_devices(devices, ARRAY_SIZE(devices));
        imx35_add_imx_uart0(NULL);
        imx35_add_imx_uart2(NULL);
  
-       imx35_add_ipu_core(&mx3_ipu_data);
+       imx35_add_ipu_core();
        imx35_add_mx3_sdc_fb(&mx3fb_pdata);
  
        imx35_add_fsl_usb2_udc(&otg_device_pdata);
        imx35_add_mxc_nand(&vpr200_nand_board_info);
        imx35_add_sdhci_esdhc_imx(0, NULL);
  
+       vpr200_i2c_devices[1].irq = gpio_to_irq(GPIO_PMIC_INT);
        i2c_register_board_info(0, vpr200_i2c_devices,
                        ARRAY_SIZE(vpr200_i2c_devices));
  
@@@ -116,7 -116,8 +116,8 @@@ static int mxc_mmc1_init(struct device 
        gpio_direction_input(gpio_det);
        gpio_direction_input(gpio_wp);
  
-       ret = request_irq(IOMUX_TO_IRQ(MX31_PIN_DCD_DCE1), detect_irq,
+       ret = request_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)),
+                         detect_irq,
                          IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
                          "MMC detect", data);
        if (ret)
@@@ -137,7 -138,7 +138,7 @@@ static void mxc_mmc1_exit(struct devic
  {
        gpio_free(gpio_det);
        gpio_free(gpio_wp);
-       free_irq(IOMUX_TO_IRQ(MX31_PIN_DCD_DCE1), data);
+       free_irq(gpio_to_irq(IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)), data);
  }
  
  static const struct imxmmc_platform_data mmc_pdata __initconst = {
@@@ -191,6 -192,6 +192,6 @@@ void __init mx31lite_db_init(void
        imx31_add_mxc_mmc(0, &mmc_pdata);
        imx31_add_spi_imx0(&spi0_pdata);
        gpio_led_register_device(-1, &litekit_led_platform_data);
 -      imx31_add_imx2_wdt(NULL);
 -      imx31_add_mxc_rtc(NULL);
 +      imx31_add_imx2_wdt();
 +      imx31_add_mxc_rtc();
  }
diff --combined drivers/gpio/gpio-mxc.c
@@@ -23,6 -23,7 +23,7 @@@
  #include <linux/interrupt.h>
  #include <linux/io.h>
  #include <linux/irq.h>
+ #include <linux/irqdomain.h>
  #include <linux/gpio.h>
  #include <linux/platform_device.h>
  #include <linux/slab.h>
@@@ -33,8 -34,6 +34,6 @@@
  #include <asm-generic/bug.h>
  #include <asm/mach/irq.h>
  
- #define irq_to_gpio(irq)      ((irq) - MXC_GPIO_IRQ_START)
  enum mxc_gpio_hwtype {
        IMX1_GPIO,      /* runs on i.mx1 */
        IMX21_GPIO,     /* runs on i.mx21 and i.mx27 */
@@@ -61,7 -60,7 +60,7 @@@ struct mxc_gpio_port 
        void __iomem *base;
        int irq;
        int irq_high;
-       int virtual_irq_start;
+       struct irq_domain *domain;
        struct bgpio_chip bgc;
        u32 both_edges;
  };
@@@ -144,14 -143,15 +143,15 @@@ static LIST_HEAD(mxc_gpio_ports)
  
  static int gpio_set_irq_type(struct irq_data *d, u32 type)
  {
-       u32 gpio = irq_to_gpio(d->irq);
        struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
        struct mxc_gpio_port *port = gc->private;
        u32 bit, val;
+       u32 gpio_idx = d->hwirq;
+       u32 gpio = port->bgc.gc.base + gpio_idx;
        int edge;
        void __iomem *reg = port->base;
  
-       port->both_edges &= ~(1 << (gpio & 31));
+       port->both_edges &= ~(1 << gpio_idx);
        switch (type) {
        case IRQ_TYPE_EDGE_RISING:
                edge = GPIO_INT_RISE_EDGE;
                        edge = GPIO_INT_HIGH_LEV;
                        pr_debug("mxc: set GPIO %d to high trigger\n", gpio);
                }
-               port->both_edges |= 1 << (gpio & 31);
+               port->both_edges |= 1 << gpio_idx;
                break;
        case IRQ_TYPE_LEVEL_LOW:
                edge = GPIO_INT_LOW_LEV;
                return -EINVAL;
        }
  
-       reg += GPIO_ICR1 + ((gpio & 0x10) >> 2); /* lower or upper register */
-       bit = gpio & 0xf;
+       reg += GPIO_ICR1 + ((gpio_idx & 0x10) >> 2); /* ICR1 or ICR2 */
+       bit = gpio_idx & 0xf;
        val = readl(reg) & ~(0x3 << (bit << 1));
        writel(val | (edge << (bit << 1)), reg);
-       writel(1 << (gpio & 0x1f), port->base + GPIO_ISR);
+       writel(1 << gpio_idx, port->base + GPIO_ISR);
  
        return 0;
  }
@@@ -217,15 -217,13 +217,13 @@@ static void mxc_flip_edge(struct mxc_gp
  /* handle 32 interrupts in one status register */
  static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat)
  {
-       u32 gpio_irq_no_base = port->virtual_irq_start;
        while (irq_stat != 0) {
                int irqoffset = fls(irq_stat) - 1;
  
                if (port->both_edges & (1 << irqoffset))
                        mxc_flip_edge(port, irqoffset);
  
-               generic_handle_irq(gpio_irq_no_base + irqoffset);
+               generic_handle_irq(irq_find_mapping(port->domain, irqoffset));
  
                irq_stat &= ~(1 << irqoffset);
        }
@@@ -276,10 -274,9 +274,9 @@@ static void mx2_gpio_irq_handler(u32 ir
   */
  static int gpio_set_wake_irq(struct irq_data *d, u32 enable)
  {
-       u32 gpio = irq_to_gpio(d->irq);
-       u32 gpio_idx = gpio & 0x1F;
        struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
        struct mxc_gpio_port *port = gc->private;
+       u32 gpio_idx = d->hwirq;
  
        if (enable) {
                if (port->irq_high && (gpio_idx >= 16))
        return 0;
  }
  
- static void __init mxc_gpio_init_gc(struct mxc_gpio_port *port)
+ static void __init mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
  {
        struct irq_chip_generic *gc;
        struct irq_chip_type *ct;
  
-       gc = irq_alloc_generic_chip("gpio-mxc", 1, port->virtual_irq_start,
+       gc = irq_alloc_generic_chip("gpio-mxc", 1, irq_base,
                                    port->base, handle_level_irq);
        gc->private = port;
  
@@@ -352,7 -349,7 +349,7 @@@ static int mxc_gpio_to_irq(struct gpio_
        struct mxc_gpio_port *port =
                container_of(bgc, struct mxc_gpio_port, bgc);
  
-       return port->virtual_irq_start + offset;
+       return irq_find_mapping(port->domain, offset);
  }
  
  static int __devinit mxc_gpio_probe(struct platform_device *pdev)
        struct device_node *np = pdev->dev.of_node;
        struct mxc_gpio_port *port;
        struct resource *iores;
+       int irq_base;
        int err;
  
        mxc_gpio_get_hw(pdev);
        writel(~0, port->base + GPIO_ISR);
  
        if (mxc_gpio_hwtype == IMX21_GPIO) {
 -              /* setup one handler for all GPIO interrupts */
 -              if (pdev->id == 0)
 -                      irq_set_chained_handler(port->irq,
 -                                              mx2_gpio_irq_handler);
 +              /*
 +               * Setup one handler for all GPIO interrupts. Actually setting
 +               * the handler is needed only once, but doing it for every port
 +               * is more robust and easier.
 +               */
 +              irq_set_chained_handler(port->irq, mx2_gpio_irq_handler);
        } else {
                /* setup one handler for each entry */
                irq_set_chained_handler(port->irq, mx3_gpio_irq_handler);
        if (err)
                goto out_bgpio_remove;
  
-       /*
-        * In dt case, we use gpio number range dynamically
-        * allocated by gpio core.
-        */
-       port->virtual_irq_start = MXC_GPIO_IRQ_START + (np ? port->bgc.gc.base :
-                                                            pdev->id * 32);
+       irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id());
+       if (irq_base < 0) {
+               err = irq_base;
+               goto out_gpiochip_remove;
+       }
+       port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
+                                            &irq_domain_simple_ops, NULL);
+       if (!port->domain) {
+               err = -ENODEV;
+               goto out_irqdesc_free;
+       }
  
        /* gpio-mxc can be a generic irq chip */
-       mxc_gpio_init_gc(port);
+       mxc_gpio_init_gc(port, irq_base);
  
        list_add_tail(&port->node, &mxc_gpio_ports);
  
        return 0;
  
+ out_irqdesc_free:
+       irq_free_descs(irq_base, 32);
+ out_gpiochip_remove:
+       WARN_ON(gpiochip_remove(&port->bgc.gc) < 0);
  out_bgpio_remove:
        bgpio_remove(&port->bgc);
  out_iounmap: