Commit 70384d3f authored by Olof Johansson's avatar Olof Johansson

Merge branch 'armsoc/pxa' of git://github.com/hzhuang1/linux into next/boards

A series dealing with gpio configuration cleanup from Haojian Zhuang.

* 'armsoc/pxa' of git://github.com/hzhuang1/linux:
  ARM: pxa: move debug uart code
  ARM: pxa: select PXA935 on saar & tavorevb
  ARM: mmp: add more compatible names in gpio driver
  ARM: pxa: move PXA_GPIO_TO_IRQ macro
  ARM: pxa: remove cpu_is_xxx in gpio driver
Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
parents 67028154 0a43cd3b
* Marvell PXA GPIO controller * Marvell PXA GPIO controller
Required properties: Required properties:
- compatible : Should be "mrvl,pxa-gpio" or "mrvl,mmp-gpio" - compatible : Should be "intel,pxa25x-gpio", "intel,pxa26x-gpio",
"intel,pxa27x-gpio", "intel,pxa3xx-gpio",
"marvell,pxa93x-gpio", "marvell,mmp-gpio" or
"marvell,mmp2-gpio".
- reg : Address and length of the register set for the device - reg : Address and length of the register set for the device
- interrupts : Should be the port interrupt shared by all gpio pins. - interrupts : Should be the port interrupt shared by all gpio pins.
There're three gpio interrupts in arch-pxa, and they're gpio0, There're three gpio interrupts in arch-pxa, and they're gpio0,
...@@ -18,7 +21,7 @@ Required properties: ...@@ -18,7 +21,7 @@ Required properties:
Example: Example:
gpio: gpio@d4019000 { gpio: gpio@d4019000 {
compatible = "mrvl,mmp-gpio"; compatible = "marvell,mmp-gpio";
reg = <0xd4019000 0x1000>; reg = <0xd4019000 0x1000>;
interrupts = <49>; interrupts = <49>;
interrupt-name = "gpio_mux"; interrupt-name = "gpio_mux";
......
...@@ -312,6 +312,13 @@ choice ...@@ -312,6 +312,13 @@ choice
Say Y here if you want kernel low-level debugging support Say Y here if you want kernel low-level debugging support
on PicoXcell based platforms. on PicoXcell based platforms.
config DEBUG_PXA_UART1
depends on ARCH_PXA
bool "Use PXA UART1 for low-level debug"
help
Say Y here if you want kernel low-level debugging support
on PXA UART1.
config DEBUG_REALVIEW_STD_PORT config DEBUG_REALVIEW_STD_PORT
bool "RealView Default UART" bool "RealView Default UART"
depends on ARCH_REALVIEW depends on ARCH_REALVIEW
...@@ -593,6 +600,8 @@ config DEBUG_LL_INCLUDE ...@@ -593,6 +600,8 @@ config DEBUG_LL_INCLUDE
default "debug/mvebu.S" if DEBUG_MVEBU_UART default "debug/mvebu.S" if DEBUG_MVEBU_UART
default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART default "debug/picoxcell.S" if DEBUG_PICOXCELL_UART
default "debug/pxa.S" if DEBUG_PXA_UART1 || DEBUG_MMP_UART2 || \
DEBUG_MMP_UART3
default "debug/socfpga.S" if DEBUG_SOCFPGA_UART default "debug/socfpga.S" if DEBUG_SOCFPGA_UART
default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1 default "debug/sunxi.S" if DEBUG_SUNXI_UART0 || DEBUG_SUNXI_UART1
default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \ default "debug/vexpress.S" if DEBUG_VEXPRESS_UART0_DETECT || \
......
...@@ -160,7 +160,7 @@ uart4: uart@d4016000 { ...@@ -160,7 +160,7 @@ uart4: uart@d4016000 {
}; };
gpio@d4019000 { gpio@d4019000 {
compatible = "mrvl,mmp-gpio"; compatible = "marvell,mmp2-gpio";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
reg = <0xd4019000 0x1000>; reg = <0xd4019000 0x1000>;
......
...@@ -77,7 +77,7 @@ uart3: uart@d4026000 { ...@@ -77,7 +77,7 @@ uart3: uart@d4026000 {
}; };
gpio@d4019000 { gpio@d4019000 {
compatible = "mrvl,mmp-gpio"; compatible = "marvell,mmp-gpio";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
reg = <0xd4019000 0x1000>; reg = <0xd4019000 0x1000>;
......
...@@ -89,7 +89,7 @@ uart3: uart@d4036000 { ...@@ -89,7 +89,7 @@ uart3: uart@d4036000 {
}; };
gpio@d4019000 { gpio@d4019000 {
compatible = "mrvl,mmp-gpio"; compatible = "marvell,mmp-gpio";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
reg = <0xd4019000 0x1000>; reg = <0xd4019000 0x1000>;
......
/* arch/arm/mach-mmp/include/mach/debug-macro.S /*
* Early serial output macro for Marvell PXA/MMP SoC
* *
* Debugging macro include header * Copyright (C) 1994-1999 Russell King
* Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
* *
* Copied from arch/arm/mach-pxa/include/mach/debug.S * Copyright (C) 2013 Haojian Zhuang
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#if defined(CONFIG_DEBUG_MMP_UART2) #if defined(CONFIG_DEBUG_PXA_UART1)
#define MMP_UART_OFFSET 0x00017000 #define PXA_UART_REG_PHYS_BASE 0x40100000
#define PXA_UART_REG_VIRT_BASE 0xf2100000
#elif defined(CONFIG_DEBUG_MMP_UART2)
#define PXA_UART_REG_PHYS_BASE 0xd4017000
#define PXA_UART_REG_VIRT_BASE 0xfe017000
#elif defined(CONFIG_DEBUG_MMP_UART3) #elif defined(CONFIG_DEBUG_MMP_UART3)
#define MMP_UART_OFFSET 0x00018000 #define PXA_UART_REG_PHYS_BASE 0xd4018000
#define PXA_UART_REG_VIRT_BASE 0xfe018000
#else #else
#error "Select uart for DEBUG_LL" #error "Select uart for DEBUG_LL"
#endif #endif
#include <mach/addr-map.h>
.macro addruart, rp, rv, tmp .macro addruart, rp, rv, tmp
ldr \rp, =APB_PHYS_BASE @ physical ldr \rp, =PXA_UART_REG_PHYS_BASE
ldr \rv, =APB_VIRT_BASE @ virtual ldr \rv, =PXA_UART_REG_VIRT_BASE
orr \rp, \rp, #MMP_UART_OFFSET
orr \rv, \rv, #MMP_UART_OFFSET
.endm .endm
#define UART_SHIFT 2 #define UART_SHIFT 2
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* publishhed by the Free Software Foundation. * publishhed by the Free Software Foundation.
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio-pxa.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -110,6 +111,10 @@ static unsigned long common_pin_config[] __initdata = { ...@@ -110,6 +111,10 @@ static unsigned long common_pin_config[] __initdata = {
GPIO121_KP_MKIN4, GPIO121_KP_MKIN4,
}; };
static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static struct smc91x_platdata smc91x_info = { static struct smc91x_platdata smc91x_info = {
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
}; };
...@@ -248,6 +253,8 @@ static void __init common_init(void) ...@@ -248,6 +253,8 @@ static void __init common_init(void)
pxa168_add_nand(&aspenite_nand_info); pxa168_add_nand(&aspenite_nand_info);
pxa168_add_fb(&aspenite_lcd_info); pxa168_add_fb(&aspenite_lcd_info);
pxa168_add_keypad(&aspenite_keypad_info); pxa168_add_keypad(&aspenite_keypad_info);
platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&pxa168_device_gpio); platform_device_register(&pxa168_device_gpio);
/* off-chip devices */ /* off-chip devices */
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/gpio-pxa.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -32,12 +33,18 @@ static unsigned long avengers_lite_pin_config_V16F[] __initdata = { ...@@ -32,12 +33,18 @@ static unsigned long avengers_lite_pin_config_V16F[] __initdata = {
GPIO89_UART2_RXD, GPIO89_UART2_RXD,
}; };
static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static void __init avengers_lite_init(void) static void __init avengers_lite_init(void)
{ {
mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F)); mfp_config(ARRAY_AND_SIZE(avengers_lite_pin_config_V16F));
/* on-chip devices */ /* on-chip devices */
pxa168_add_uart(2); pxa168_add_uart(2);
platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&pxa168_device_gpio); platform_device_register(&pxa168_device_gpio);
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio-pxa.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/regulator/max8649.h> #include <linux/regulator/max8649.h>
#include <linux/regulator/fixed.h> #include <linux/regulator/fixed.h>
...@@ -104,6 +105,10 @@ static unsigned long brownstone_pin_config[] __initdata = { ...@@ -104,6 +105,10 @@ static unsigned long brownstone_pin_config[] __initdata = {
GPIO89_GPIO, GPIO89_GPIO,
}; };
static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static struct regulator_consumer_supply max8649_supply[] = { static struct regulator_consumer_supply max8649_supply[] = {
REGULATOR_SUPPLY("vcc_core", NULL), REGULATOR_SUPPLY("vcc_core", NULL),
}; };
...@@ -202,6 +207,8 @@ static void __init brownstone_init(void) ...@@ -202,6 +207,8 @@ static void __init brownstone_init(void)
/* on-chip devices */ /* on-chip devices */
mmp2_add_uart(1); mmp2_add_uart(1);
mmp2_add_uart(3); mmp2_add_uart(3);
platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&mmp2_device_gpio); platform_device_register(&mmp2_device_gpio);
mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info)); mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(brownstone_twsi1_info));
mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
......
...@@ -98,7 +98,7 @@ static struct clk_lookup mmp2_clkregs[] = { ...@@ -98,7 +98,7 @@ static struct clk_lookup mmp2_clkregs[] = {
INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL), INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL), INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL),
INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), INIT_CLKREG(&clk_gpio, "mmp2-gpio", NULL),
INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"), INIT_CLKREG(&clk_sdh0, "sdhci-pxav3.0", "PXA-SDHCLK"),
INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"), INIT_CLKREG(&clk_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"),
INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"), INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"),
......
...@@ -78,7 +78,7 @@ static struct clk_lookup pxa168_clkregs[] = { ...@@ -78,7 +78,7 @@ static struct clk_lookup pxa168_clkregs[] = {
INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL), INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL), INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), INIT_CLKREG(&clk_gpio, "mmp-gpio", NULL),
INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"), INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"),
......
...@@ -56,7 +56,7 @@ static struct clk_lookup pxa910_clkregs[] = { ...@@ -56,7 +56,7 @@ static struct clk_lookup pxa910_clkregs[] = {
INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL), INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL), INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", NULL),
INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL), INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
INIT_CLKREG(&clk_gpio, "pxa-gpio", NULL), INIT_CLKREG(&clk_gpio, "mmp-gpio", NULL),
INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"), INIT_CLKREG(&clk_u2o, NULL, "U2OCLK"),
INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL), INIT_CLKREG(&clk_rtc, "sa1100-rtc", NULL),
}; };
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/smc91x.h> #include <linux/smc91x.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio-pxa.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -77,6 +78,10 @@ static unsigned long flint_pin_config[] __initdata = { ...@@ -77,6 +78,10 @@ static unsigned long flint_pin_config[] __initdata = {
GPIO160_ND_RDY1, GPIO160_ND_RDY1,
}; };
static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static struct smc91x_platdata flint_smc91x_info = { static struct smc91x_platdata flint_smc91x_info = {
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
}; };
...@@ -111,6 +116,8 @@ static void __init flint_init(void) ...@@ -111,6 +116,8 @@ static void __init flint_init(void)
/* on-chip devices */ /* on-chip devices */
mmp2_add_uart(1); mmp2_add_uart(1);
mmp2_add_uart(2); mmp2_add_uart(2);
platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&mmp2_device_gpio); platform_device_register(&mmp2_device_gpio);
/* off-chip devices */ /* off-chip devices */
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio-pxa.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
...@@ -128,6 +129,10 @@ static unsigned long gplugd_pin_config[] __initdata = { ...@@ -128,6 +129,10 @@ static unsigned long gplugd_pin_config[] __initdata = {
GPIO116_I2S_TXD GPIO116_I2S_TXD
}; };
static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static struct i2c_board_info gplugd_i2c_board_info[] = { static struct i2c_board_info gplugd_i2c_board_info[] = {
{ {
.type = "isl1208", .type = "isl1208",
...@@ -186,6 +191,8 @@ static void __init gplugd_init(void) ...@@ -186,6 +191,8 @@ static void __init gplugd_init(void)
pxa168_add_uart(3); pxa168_add_uart(3);
pxa168_add_ssp(1); pxa168_add_ssp(1);
pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info)); pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(gplugd_i2c_board_info));
platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&pxa168_device_gpio); platform_device_register(&pxa168_device_gpio);
pxa168_add_eth(&gplugd_eth_platform_data); pxa168_add_eth(&gplugd_eth_platform_data);
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/gpio-pxa.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
...@@ -99,6 +100,10 @@ static unsigned long jasper_pin_config[] __initdata = { ...@@ -99,6 +100,10 @@ static unsigned long jasper_pin_config[] __initdata = {
GPIO151_MMC3_CLK, GPIO151_MMC3_CLK,
}; };
static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static struct regulator_consumer_supply max8649_supply[] = { static struct regulator_consumer_supply max8649_supply[] = {
REGULATOR_SUPPLY("vcc_core", NULL), REGULATOR_SUPPLY("vcc_core", NULL),
}; };
...@@ -165,6 +170,9 @@ static void __init jasper_init(void) ...@@ -165,6 +170,9 @@ static void __init jasper_init(void)
mmp2_add_uart(1); mmp2_add_uart(1);
mmp2_add_uart(3); mmp2_add_uart(3);
mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info)); mmp2_add_twsi(1, NULL, ARRAY_AND_SIZE(jasper_twsi1_info));
platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&mmp2_device_gpio);
mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */ mmp2_add_sdhost(0, &mmp2_sdh_platdata_mmc0); /* SD/MMC */
regulator_has_full_constraints(); regulator_has_full_constraints();
......
...@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = { ...@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa168_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL), OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4026000, "pxa2xx-uart.2", NULL),
OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL), OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
{} {}
}; };
...@@ -39,7 +39,7 @@ static const struct of_dev_auxdata pxa910_auxdata_lookup[] __initconst = { ...@@ -39,7 +39,7 @@ static const struct of_dev_auxdata pxa910_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL), OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4036000, "pxa2xx-uart.2", NULL),
OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL), OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4037000, "pxa2xx-i2c.1", NULL),
OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
{} {}
}; };
......
...@@ -31,7 +31,7 @@ static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = { ...@@ -31,7 +31,7 @@ static const struct of_dev_auxdata mmp2_auxdata_lookup[] __initconst = {
OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL), OF_DEV_AUXDATA("mrvl,mmp-uart", 0xd4016000, "pxa2xx-uart.3", NULL),
OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL), OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4011000, "pxa2xx-i2c.0", NULL),
OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL), OF_DEV_AUXDATA("mrvl,mmp-twsi", 0xd4025000, "pxa2xx-i2c.1", NULL),
OF_DEV_AUXDATA("mrvl,mmp-gpio", 0xd4019000, "pxa-gpio", NULL), OF_DEV_AUXDATA("marvell,mmp-gpio", 0xd4019000, "mmp2-gpio", NULL),
OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL), OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
{} {}
}; };
......
...@@ -164,7 +164,7 @@ struct resource mmp2_resource_gpio[] = { ...@@ -164,7 +164,7 @@ struct resource mmp2_resource_gpio[] = {
}; };
struct platform_device mmp2_device_gpio = { struct platform_device mmp2_device_gpio = {
.name = "pxa-gpio", .name = "mmp2-gpio",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(mmp2_resource_gpio), .num_resources = ARRAY_SIZE(mmp2_resource_gpio),
.resource = mmp2_resource_gpio, .resource = mmp2_resource_gpio,
......
...@@ -125,7 +125,7 @@ struct resource pxa168_resource_gpio[] = { ...@@ -125,7 +125,7 @@ struct resource pxa168_resource_gpio[] = {
}; };
struct platform_device pxa168_device_gpio = { struct platform_device pxa168_device_gpio = {
.name = "pxa-gpio", .name = "mmp-gpio",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(pxa168_resource_gpio), .num_resources = ARRAY_SIZE(pxa168_resource_gpio),
.resource = pxa168_resource_gpio, .resource = pxa168_resource_gpio,
......
...@@ -152,7 +152,7 @@ struct resource pxa910_resource_gpio[] = { ...@@ -152,7 +152,7 @@ struct resource pxa910_resource_gpio[] = {
}; };
struct platform_device pxa910_device_gpio = { struct platform_device pxa910_device_gpio = {
.name = "pxa-gpio", .name = "mmp-gpio",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(pxa910_resource_gpio), .num_resources = ARRAY_SIZE(pxa910_resource_gpio),
.resource = pxa910_resource_gpio, .resource = pxa910_resource_gpio,
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
* publishhed by the Free Software Foundation. * publishhed by the Free Software Foundation.
*/ */
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio-pxa.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -60,6 +61,10 @@ static unsigned long tavorevb_pin_config[] __initdata = { ...@@ -60,6 +61,10 @@ static unsigned long tavorevb_pin_config[] __initdata = {
DF_RDY0_DF_RDY0, DF_RDY0_DF_RDY0,
}; };
static struct pxa_gpio_platform_data pxa910_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static struct smc91x_platdata tavorevb_smc91x_info = { static struct smc91x_platdata tavorevb_smc91x_info = {
.flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
}; };
...@@ -93,6 +98,8 @@ static void __init tavorevb_init(void) ...@@ -93,6 +98,8 @@ static void __init tavorevb_init(void)
/* on-chip devices */ /* on-chip devices */
pxa910_add_uart(1); pxa910_add_uart(1);
platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&pxa910_device_gpio); platform_device_register(&pxa910_device_gpio);
/* off-chip devices */ /* off-chip devices */
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio-pxa.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/platform_data/keypad-pxa27x.h> #include <linux/platform_data/keypad-pxa27x.h>
#include <linux/i2c.h> #include <linux/i2c.h>
...@@ -49,6 +50,10 @@ static unsigned long teton_bga_pin_config[] __initdata = { ...@@ -49,6 +50,10 @@ static unsigned long teton_bga_pin_config[] __initdata = {
GPIO78_GPIO, GPIO78_GPIO,
}; };
static struct pxa_gpio_platform_data pxa168_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static unsigned int teton_bga_matrix_key_map[] = { static unsigned int teton_bga_matrix_key_map[] = {
KEY(0, 6, KEY_ESC), KEY(0, 6, KEY_ESC),
KEY(0, 7, KEY_ENTER), KEY(0, 7, KEY_ENTER),
...@@ -79,6 +84,8 @@ static void __init teton_bga_init(void) ...@@ -79,6 +84,8 @@ static void __init teton_bga_init(void)
pxa168_add_uart(1); pxa168_add_uart(1);
pxa168_add_keypad(&teton_bga_keypad_info); pxa168_add_keypad(&teton_bga_keypad_info);
pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info)); pxa168_add_twsi(0, NULL, ARRAY_AND_SIZE(teton_bga_i2c_info));
platform_device_add_data(&pxa168_device_gpio, &pxa168_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_device_register(&pxa168_device_gpio); platform_device_register(&pxa168_device_gpio);
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/i2c/pca953x.h> #include <linux/i2c/pca953x.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio-pxa.h>
#include <linux/mfd/88pm860x.h> #include <linux/mfd/88pm860x.h>
#include <linux/platform_data/mv_usb.h> #include <linux/platform_data/mv_usb.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
...@@ -75,6 +76,10 @@ static unsigned long ttc_dkb_pin_config[] __initdata = { ...@@ -75,6 +76,10 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
DF_RDY0_DF_RDY0, DF_RDY0_DF_RDY0,
}; };
static struct pxa_gpio_platform_data pxa910_gpio_pdata = {
.irq_base = MMP_GPIO_TO_IRQ(0),
};
static struct mtd_partition ttc_dkb_onenand_partitions[] = { static struct mtd_partition ttc_dkb_onenand_partitions[] = {
{ {
.name = "bootloader", .name = "bootloader",
...@@ -284,6 +289,8 @@ static void __init ttc_dkb_init(void) ...@@ -284,6 +289,8 @@ static void __init ttc_dkb_init(void)
/* off-chip devices */ /* off-chip devices */
pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info)); pxa910_add_twsi(0, NULL, ARRAY_AND_SIZE(ttc_dkb_i2c_info));
platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
sizeof(struct pxa_gpio_platform_data));
platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices)); platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
#ifdef CONFIG_USB_MV_UDC #ifdef CONFIG_USB_MV_UDC
......
...@@ -51,11 +51,13 @@ config MACH_LITTLETON ...@@ -51,11 +51,13 @@ config MACH_LITTLETON
config MACH_TAVOREVB config MACH_TAVOREVB
bool "PXA930 Evaluation Board (aka TavorEVB)" bool "PXA930 Evaluation Board (aka TavorEVB)"
select CPU_PXA930 select CPU_PXA930
select CPU_PXA935
select PXA3xx select PXA3xx
config MACH_SAAR config MACH_SAAR
bool "PXA930 Handheld Platform (aka SAAR)" bool "PXA930 Handheld Platform (aka SAAR)"
select CPU_PXA930 select CPU_PXA930
select CPU_PXA935
select PXA3xx select PXA3xx
comment "Third Party Dev Platforms (sorted by vendor name)" comment "Third Party Dev Platforms (sorted by vendor name)"
......
...@@ -1107,8 +1107,33 @@ struct resource pxa_resource_gpio[] = { ...@@ -1107,8 +1107,33 @@ struct resource pxa_resource_gpio[] = {
}, },
}; };
struct platform_device pxa_device_gpio = { struct platform_device pxa25x_device_gpio = {
.name = "pxa-gpio", #ifdef CONFIG_CPU_PXA26x
.name = "pxa26x-gpio",
#else
.name = "pxa25x-gpio",
#endif
.id = -1,
.num_resources = ARRAY_SIZE(pxa_resource_gpio),
.resource = pxa_resource_gpio,
};
struct platform_device pxa27x_device_gpio = {
.name = "pxa27x-gpio",
.id = -1,
.num_resources = ARRAY_SIZE(pxa_resource_gpio),
.resource = pxa_resource_gpio,
};
struct platform_device pxa3xx_device_gpio = {
.name = "pxa3xx-gpio",
.id = -1,
.num_resources = ARRAY_SIZE(pxa_resource_gpio),
.resource = pxa_resource_gpio,
};
struct platform_device pxa93x_device_gpio = {
.name = "pxa93x-gpio",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(pxa_resource_gpio), .num_resources = ARRAY_SIZE(pxa_resource_gpio),
.resource = pxa_resource_gpio, .resource = pxa_resource_gpio,
......
...@@ -16,7 +16,6 @@ extern struct platform_device pxa_device_ficp; ...@@ -16,7 +16,6 @@ extern struct platform_device pxa_device_ficp;
extern struct platform_device sa1100_device_rtc; extern struct platform_device sa1100_device_rtc;
extern struct platform_device pxa_device_rtc; extern struct platform_device pxa_device_rtc;
extern struct platform_device pxa_device_ac97; extern struct platform_device pxa_device_ac97;
extern struct platform_device pxa_device_gpio;
extern struct platform_device pxa27x_device_i2c_power; extern struct platform_device pxa27x_device_i2c_power;
extern struct platform_device pxa27x_device_ohci; extern struct platform_device pxa27x_device_ohci;
...@@ -46,4 +45,9 @@ extern struct platform_device pxa_device_asoc_ssp2; ...@@ -46,4 +45,9 @@ extern struct platform_device pxa_device_asoc_ssp2;
extern struct platform_device pxa_device_asoc_ssp3; extern struct platform_device pxa_device_asoc_ssp3;
extern struct platform_device pxa_device_asoc_ssp4; extern struct platform_device pxa_device_asoc_ssp4;
extern struct platform_device pxa25x_device_gpio;
extern struct platform_device pxa27x_device_gpio;
extern struct platform_device pxa3xx_device_gpio;
extern struct platform_device pxa93x_device_gpio;
void __init pxa_register_device(struct platform_device *dev, void *data); void __init pxa_register_device(struct platform_device *dev, void *data);
/* arch/arm/mach-pxa/include/mach/debug-macro.S
*
* Debugging macro include header
*
* Copyright (C) 1994-1999 Russell King
* Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
*
* 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 "hardware.h"
.macro addruart, rp, rv, tmp
mov \rp, #0x00100000
orr \rv, \rp, #io_p2v(0x40000000) @ virtual
orr \rp, \rp, #0x40000000 @ physical
.endm
#define UART_SHIFT 2
#include <asm/hardware/debug-8250.S>
...@@ -208,7 +208,11 @@ static struct clk_lookup pxa25x_clkregs[] = { ...@@ -208,7 +208,11 @@ static struct clk_lookup pxa25x_clkregs[] = {
INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"), INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL),
INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), #ifdef CONFIG_CPU_PXA26x
INIT_CLKREG(&clk_dummy, "pxa26x-gpio", NULL),
#else
INIT_CLKREG(&clk_dummy, "pxa25x-gpio", NULL),
#endif
INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
}; };
...@@ -340,6 +344,7 @@ void __init pxa25x_map_io(void) ...@@ -340,6 +344,7 @@ void __init pxa25x_map_io(void)
} }
static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = { static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = {
.irq_base = PXA_GPIO_TO_IRQ(0),
.gpio_set_wake = gpio_set_wake, .gpio_set_wake = gpio_set_wake,
}; };
...@@ -375,7 +380,7 @@ static int __init pxa25x_init(void) ...@@ -375,7 +380,7 @@ static int __init pxa25x_init(void)
register_syscore_ops(&pxa2xx_mfp_syscore_ops); register_syscore_ops(&pxa2xx_mfp_syscore_ops);
register_syscore_ops(&pxa2xx_clock_syscore_ops); register_syscore_ops(&pxa2xx_clock_syscore_ops);
pxa_register_device(&pxa_device_gpio, &pxa25x_gpio_info); pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info);
ret = platform_add_devices(pxa25x_devices, ret = platform_add_devices(pxa25x_devices,
ARRAY_SIZE(pxa25x_devices)); ARRAY_SIZE(pxa25x_devices));
if (ret) if (ret)
......
...@@ -237,7 +237,7 @@ static struct clk_lookup pxa27x_clkregs[] = { ...@@ -237,7 +237,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"), INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"), INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL), INIT_CLKREG(&clk_pxa27x_mem, "pxa2xx-pcmcia", NULL),
INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), INIT_CLKREG(&clk_dummy, "pxa27x-gpio", NULL),
INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
}; };
...@@ -431,6 +431,7 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info) ...@@ -431,6 +431,7 @@ void __init pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info)
} }
static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = { static struct pxa_gpio_platform_data pxa27x_gpio_info __initdata = {
.irq_base = PXA_GPIO_TO_IRQ(0),
.gpio_set_wake = gpio_set_wake, .gpio_set_wake = gpio_set_wake,
}; };
...@@ -470,7 +471,7 @@ static int __init pxa27x_init(void) ...@@ -470,7 +471,7 @@ static int __init pxa27x_init(void)
register_syscore_ops(&pxa2xx_mfp_syscore_ops); register_syscore_ops(&pxa2xx_mfp_syscore_ops);
register_syscore_ops(&pxa2xx_clock_syscore_ops); register_syscore_ops(&pxa2xx_clock_syscore_ops);
pxa_register_device(&pxa_device_gpio, &pxa27x_gpio_info); pxa_register_device(&pxa27x_device_gpio, &pxa27x_gpio_info);
ret = platform_add_devices(devices, ARRAY_SIZE(devices)); ret = platform_add_devices(devices, ARRAY_SIZE(devices));
} }
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/gpio-pxa.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/irq.h> #include <linux/irq.h>
...@@ -92,7 +93,8 @@ static struct clk_lookup pxa3xx_clkregs[] = { ...@@ -92,7 +93,8 @@ static struct clk_lookup pxa3xx_clkregs[] = {
INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL), INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL), INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", NULL),
INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL), INIT_CLKREG(&clk_pxa3xx_smemc, "pxa2xx-pcmcia", NULL),
INIT_CLKREG(&clk_pxa3xx_gpio, "pxa-gpio", NULL), INIT_CLKREG(&clk_pxa3xx_gpio, "pxa3xx-gpio", NULL),
INIT_CLKREG(&clk_pxa3xx_gpio, "pxa93x-gpio", NULL),
INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL), INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
}; };
...@@ -435,8 +437,11 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info) ...@@ -435,8 +437,11 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
pxa_register_device(&pxa3xx_device_i2c_power, info); pxa_register_device(&pxa3xx_device_i2c_power, info);
} }
static struct pxa_gpio_platform_data pxa3xx_gpio_pdata = {
.irq_base = PXA_GPIO_TO_IRQ(0),
};
static struct platform_device *devices[] __initdata = { static struct platform_device *devices[] __initdata = {
&pxa_device_gpio,
&pxa27x_device_udc, &pxa27x_device_udc,
&pxa_device_pmu, &pxa_device_pmu,
&pxa_device_i2s, &pxa_device_i2s,
...@@ -482,8 +487,18 @@ static int __init pxa3xx_init(void) ...@@ -482,8 +487,18 @@ static int __init pxa3xx_init(void)
register_syscore_ops(&pxa3xx_mfp_syscore_ops); register_syscore_ops(&pxa3xx_mfp_syscore_ops);
register_syscore_ops(&pxa3xx_clock_syscore_ops); register_syscore_ops(&pxa3xx_clock_syscore_ops);
if (!of_have_populated_dt()) if (of_have_populated_dt())
return 0;
ret = platform_add_devices(devices, ARRAY_SIZE(devices)); ret = platform_add_devices(devices, ARRAY_SIZE(devices));
if (ret)
return ret;
if (cpu_is_pxa300() || cpu_is_pxa310() || cpu_is_pxa320()) {
platform_device_add_data(&pxa3xx_device_gpio,
&pxa3xx_gpio_pdata,
sizeof(pxa3xx_gpio_pdata));
ret = platform_device_register(&pxa3xx_device_gpio);
}
} }
return ret; return ret;
......
...@@ -12,12 +12,15 @@ ...@@ -12,12 +12,15 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/irq.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/irq.h>
#include <linux/gpio-pxa.h>
#include <linux/platform_device.h>
#include <mach/pxa930.h> #include <mach/pxa930.h>
#include "devices.h"
static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = { static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = {
MFP_ADDR(GPIO0, 0x02e0), MFP_ADDR(GPIO0, 0x02e0),
...@@ -190,11 +193,21 @@ static struct mfp_addr_map pxa935_mfp_addr_map[] __initdata = { ...@@ -190,11 +193,21 @@ static struct mfp_addr_map pxa935_mfp_addr_map[] __initdata = {
MFP_ADDR_END, MFP_ADDR_END,
}; };
static struct pxa_gpio_platform_data pxa93x_gpio_pdata = {
.irq_base = PXA_GPIO_TO_IRQ(0),
};
static int __init pxa930_init(void) static int __init pxa930_init(void)
{ {
int ret = 0;
if (cpu_is_pxa93x()) { if (cpu_is_pxa93x()) {
mfp_init_base(io_p2v(MFPR_BASE)); mfp_init_base(io_p2v(MFPR_BASE));
mfp_init_addr(pxa930_mfp_addr_map); mfp_init_addr(pxa930_mfp_addr_map);
platform_device_add_data(&pxa93x_device_gpio,
&pxa93x_gpio_pdata,
sizeof(pxa93x_gpio_pdata));
ret = platform_device_register(&pxa93x_device_gpio);
} }
if (cpu_is_pxa935()) if (cpu_is_pxa935())
......
...@@ -221,7 +221,7 @@ void __init mmp2_clk_init(void) ...@@ -221,7 +221,7 @@ void __init mmp2_clk_init(void)
clk = mmp_clk_register_apbc("gpio", "vctcxo", clk = mmp_clk_register_apbc("gpio", "vctcxo",
apbc_base + APBC_GPIO, 10, 0, &clk_lock); apbc_base + APBC_GPIO, 10, 0, &clk_lock);
clk_register_clkdev(clk, NULL, "pxa-gpio"); clk_register_clkdev(clk, NULL, "mmp2-gpio");
clk = mmp_clk_register_apbc("kpc", "clk32", clk = mmp_clk_register_apbc("kpc", "clk32",
apbc_base + APBC_KPC, 10, 0, &clk_lock); apbc_base + APBC_KPC, 10, 0, &clk_lock);
......
...@@ -172,7 +172,7 @@ void __init pxa168_clk_init(void) ...@@ -172,7 +172,7 @@ void __init pxa168_clk_init(void)
clk = mmp_clk_register_apbc("gpio", "vctcxo", clk = mmp_clk_register_apbc("gpio", "vctcxo",
apbc_base + APBC_GPIO, 10, 0, &clk_lock); apbc_base + APBC_GPIO, 10, 0, &clk_lock);
clk_register_clkdev(clk, NULL, "pxa-gpio"); clk_register_clkdev(clk, NULL, "mmp-gpio");
clk = mmp_clk_register_apbc("kpc", "clk32", clk = mmp_clk_register_apbc("kpc", "clk32",
apbc_base + APBC_KPC, 10, 0, &clk_lock); apbc_base + APBC_KPC, 10, 0, &clk_lock);
......
...@@ -177,7 +177,7 @@ void __init pxa910_clk_init(void) ...@@ -177,7 +177,7 @@ void __init pxa910_clk_init(void)
clk = mmp_clk_register_apbc("gpio", "vctcxo", clk = mmp_clk_register_apbc("gpio", "vctcxo",
apbc_base + APBC_GPIO, 10, 0, &clk_lock); apbc_base + APBC_GPIO, 10, 0, &clk_lock);
clk_register_clkdev(clk, NULL, "pxa-gpio"); clk_register_clkdev(clk, NULL, "mmp-gpio");
clk = mmp_clk_register_apbc("kpc", "clk32", clk = mmp_clk_register_apbc("kpc", "clk32",
apbc_base + APBC_KPC, 10, 0, &clk_lock); apbc_base + APBC_KPC, 10, 0, &clk_lock);
......
...@@ -86,20 +86,61 @@ struct pxa_gpio_chip { ...@@ -86,20 +86,61 @@ struct pxa_gpio_chip {
#endif #endif
}; };
enum { enum pxa_gpio_type {
PXA25X_GPIO = 0, PXA25X_GPIO = 0,
PXA26X_GPIO, PXA26X_GPIO,
PXA27X_GPIO, PXA27X_GPIO,
PXA3XX_GPIO, PXA3XX_GPIO,
PXA93X_GPIO, PXA93X_GPIO,
MMP_GPIO = 0x10, MMP_GPIO = 0x10,
MMP2_GPIO,
};
struct pxa_gpio_id {
enum pxa_gpio_type type;
int gpio_nums;
}; };
static DEFINE_SPINLOCK(gpio_lock); static DEFINE_SPINLOCK(gpio_lock);
static struct pxa_gpio_chip *pxa_gpio_chips; static struct pxa_gpio_chip *pxa_gpio_chips;
static int gpio_type; static enum pxa_gpio_type gpio_type;
static void __iomem *gpio_reg_base; static void __iomem *gpio_reg_base;
static struct pxa_gpio_id pxa25x_id = {
.type = PXA25X_GPIO,
.gpio_nums = 85,
};
static struct pxa_gpio_id pxa26x_id = {
.type = PXA26X_GPIO,
.gpio_nums = 90,
};
static struct pxa_gpio_id pxa27x_id = {
.type = PXA27X_GPIO,
.gpio_nums = 121,
};
static struct pxa_gpio_id pxa3xx_id = {
.type = PXA3XX_GPIO,
.gpio_nums = 128,
};
static struct pxa_gpio_id pxa93x_id = {
.type = PXA93X_GPIO,
.gpio_nums = 192,
};
static struct pxa_gpio_id mmp_id = {
.type = MMP_GPIO,
.gpio_nums = 128,
};
static struct pxa_gpio_id mmp2_id = {
.type = MMP2_GPIO,
.gpio_nums = 192,
};
#define for_each_gpio_chip(i, c) \ #define for_each_gpio_chip(i, c) \
for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++) for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
...@@ -432,47 +473,39 @@ static struct irq_chip pxa_muxed_gpio_chip = { ...@@ -432,47 +473,39 @@ static struct irq_chip pxa_muxed_gpio_chip = {
.irq_set_wake = pxa_gpio_set_wake, .irq_set_wake = pxa_gpio_set_wake,
}; };
static int pxa_gpio_nums(void) static int pxa_gpio_nums(struct platform_device *pdev)
{ {
const struct platform_device_id *id = platform_get_device_id(pdev);
struct pxa_gpio_id *pxa_id = (struct pxa_gpio_id *)id->driver_data;
int count = 0; int count = 0;
#ifdef CONFIG_ARCH_PXA switch (pxa_id->type) {
if (cpu_is_pxa25x()) { case PXA25X_GPIO:
#ifdef CONFIG_CPU_PXA26x case PXA26X_GPIO:
count = 89; case PXA27X_GPIO:
gpio_type = PXA26X_GPIO; case PXA3XX_GPIO:
#elif defined(CONFIG_PXA25x) case PXA93X_GPIO:
count = 84; case MMP_GPIO:
gpio_type = PXA26X_GPIO; case MMP2_GPIO:
#endif /* CONFIG_CPU_PXA26x */ gpio_type = pxa_id->type;
} else if (cpu_is_pxa27x()) { count = pxa_id->gpio_nums - 1;
count = 120; break;
gpio_type = PXA27X_GPIO; default:
} else if (cpu_is_pxa93x()) { count = -EINVAL;
count = 191; break;
gpio_type = PXA93X_GPIO;
} else if (cpu_is_pxa3xx()) {
count = 127;
gpio_type = PXA3XX_GPIO;
}
#endif /* CONFIG_ARCH_PXA */
#ifdef CONFIG_ARCH_MMP
if (cpu_is_pxa168() || cpu_is_pxa910()) {
count = 127;
gpio_type = MMP_GPIO;
} else if (cpu_is_mmp2()) {
count = 191;
gpio_type = MMP_GPIO;
} }
#endif /* CONFIG_ARCH_MMP */
return count; return count;
} }
#ifdef CONFIG_OF #ifdef CONFIG_OF
static struct of_device_id pxa_gpio_dt_ids[] = { static struct of_device_id pxa_gpio_dt_ids[] = {
{ .compatible = "mrvl,pxa-gpio" }, { .compatible = "intel,pxa25x-gpio", .data = &pxa25x_id, },
{ .compatible = "mrvl,mmp-gpio", .data = (void *)MMP_GPIO }, { .compatible = "intel,pxa26x-gpio", .data = &pxa26x_id, },
{ .compatible = "intel,pxa27x-gpio", .data = &pxa27x_id, },
{ .compatible = "intel,pxa3xx-gpio", .data = &pxa3xx_id, },
{ .compatible = "marvell,pxa93x-gpio", .data = &pxa93x_id, },
{ .compatible = "marvell,mmp-gpio", .data = &mmp_id, },
{ .compatible = "marvell,mmp2-gpio", .data = &mmp2_id, },
{} {}
}; };
...@@ -492,16 +525,18 @@ const struct irq_domain_ops pxa_irq_domain_ops = { ...@@ -492,16 +525,18 @@ const struct irq_domain_ops pxa_irq_domain_ops = {
static int pxa_gpio_probe_dt(struct platform_device *pdev) static int pxa_gpio_probe_dt(struct platform_device *pdev)
{ {
int ret, nr_banks, nr_gpios; int ret, nr_gpios;
struct device_node *prev, *next, *np = pdev->dev.of_node; struct device_node *prev, *next, *np = pdev->dev.of_node;
const struct of_device_id *of_id = const struct of_device_id *of_id =
of_match_device(pxa_gpio_dt_ids, &pdev->dev); of_match_device(pxa_gpio_dt_ids, &pdev->dev);
const struct pxa_gpio_id *gpio_id;
if (!of_id) { if (!of_id || !of_id->data) {
dev_err(&pdev->dev, "Failed to find gpio controller\n"); dev_err(&pdev->dev, "Failed to find gpio controller\n");
return -EFAULT; return -EFAULT;
} }
gpio_type = (int)of_id->data; gpio_id = of_id->data;
gpio_type = gpio_id->type;
next = of_get_next_child(np, NULL); next = of_get_next_child(np, NULL);
prev = next; prev = next;
...@@ -510,14 +545,8 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev) ...@@ -510,14 +545,8 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev)
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
} }
for (nr_banks = 1; ; nr_banks++) {
next = of_get_next_child(np, prev);
if (!next)
break;
prev = next;
}
of_node_put(prev); of_node_put(prev);
nr_gpios = nr_banks << 5; nr_gpios = gpio_id->gpio_nums;
pxa_last_gpio = nr_gpios - 1; pxa_last_gpio = nr_gpios - 1;
irq_base = irq_alloc_descs(-1, 0, nr_gpios, 0); irq_base = irq_alloc_descs(-1, 0, nr_gpios, 0);
...@@ -546,19 +575,18 @@ static int pxa_gpio_probe(struct platform_device *pdev) ...@@ -546,19 +575,18 @@ static int pxa_gpio_probe(struct platform_device *pdev)
int gpio, irq, ret, use_of = 0; int gpio, irq, ret, use_of = 0;
int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
ret = pxa_gpio_probe_dt(pdev); info = dev_get_platdata(&pdev->dev);
if (ret < 0) { if (info) {
pxa_last_gpio = pxa_gpio_nums(); irq_base = info->irq_base;
#ifdef CONFIG_ARCH_PXA if (irq_base <= 0)
if (gpio_is_pxa_type(gpio_type)) return -EINVAL;
irq_base = PXA_GPIO_TO_IRQ(0); pxa_last_gpio = pxa_gpio_nums(pdev);
#endif
#ifdef CONFIG_ARCH_MMP
if (gpio_is_mmp_type(gpio_type))
irq_base = MMP_GPIO_TO_IRQ(0);
#endif
} else { } else {
irq_base = 0;
use_of = 1; use_of = 1;
ret = pxa_gpio_probe_dt(pdev);
if (ret < 0)
return -EINVAL;
} }
if (!pxa_last_gpio) if (!pxa_last_gpio)
...@@ -595,7 +623,6 @@ static int pxa_gpio_probe(struct platform_device *pdev) ...@@ -595,7 +623,6 @@ static int pxa_gpio_probe(struct platform_device *pdev)
} }
/* Initialize GPIO chips */ /* Initialize GPIO chips */
info = dev_get_platdata(&pdev->dev);
pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL); pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL);
/* clear all GPIO edge detects */ /* clear all GPIO edge detects */
...@@ -635,12 +662,24 @@ static int pxa_gpio_probe(struct platform_device *pdev) ...@@ -635,12 +662,24 @@ static int pxa_gpio_probe(struct platform_device *pdev)
return 0; return 0;
} }
static const struct platform_device_id gpio_id_table[] = {
{ "pxa25x-gpio", (unsigned long)&pxa25x_id },
{ "pxa26x-gpio", (unsigned long)&pxa26x_id },
{ "pxa27x-gpio", (unsigned long)&pxa27x_id },
{ "pxa3xx-gpio", (unsigned long)&pxa3xx_id },
{ "pxa93x-gpio", (unsigned long)&pxa93x_id },
{ "mmp-gpio", (unsigned long)&mmp_id },
{ "mmp2-gpio", (unsigned long)&mmp2_id },
{ },
};
static struct platform_driver pxa_gpio_driver = { static struct platform_driver pxa_gpio_driver = {
.probe = pxa_gpio_probe, .probe = pxa_gpio_probe,
.driver = { .driver = {
.name = "pxa-gpio", .name = "pxa-gpio",
.of_match_table = of_match_ptr(pxa_gpio_dt_ids), .of_match_table = of_match_ptr(pxa_gpio_dt_ids),
}, },
.id_table = gpio_id_table,
}; };
module_platform_driver(pxa_gpio_driver); module_platform_driver(pxa_gpio_driver);
......
...@@ -14,6 +14,7 @@ extern int pxa_last_gpio; ...@@ -14,6 +14,7 @@ extern int pxa_last_gpio;
extern int pxa_irq_to_gpio(int irq); extern int pxa_irq_to_gpio(int irq);
struct pxa_gpio_platform_data { struct pxa_gpio_platform_data {
int irq_base;
int (*gpio_set_wake)(unsigned int gpio, unsigned int on); int (*gpio_set_wake)(unsigned int gpio, unsigned int on);
}; };
......
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