Skip to content

Commit

Permalink
ARM: pxa: remove cpu_is_xxx in gpio driver
Browse files Browse the repository at this point in the history
Avoid to use cpu_is_xxx() in pxa gpio driver. Use platform_device_id
to identify the difference.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Haojian Zhuang committed Apr 11, 2013
1 parent 31880c3 commit 2cab029
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 56 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/clock-mmp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static struct clk_lookup mmp2_clkregs[] = {
INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", 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_sdh1, "sdhci-pxav3.1", "PXA-SDHCLK"),
INIT_CLKREG(&clk_sdh2, "sdhci-pxav3.2", "PXA-SDHCLK"),
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/clock-pxa168.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static struct clk_lookup pxa168_clkregs[] = {
INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
INIT_CLKREG(&clk_nand, "pxa3xx-nand", 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_eth, "pxa168-eth", "MFUCLK"),
INIT_CLKREG(&clk_usb, NULL, "PXA168-USBCLK"),
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/clock-pxa910.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static struct clk_lookup pxa910_clkregs[] = {
INIT_CLKREG(&clk_pwm3, "pxa910-pwm.2", NULL),
INIT_CLKREG(&clk_pwm4, "pxa910-pwm.3", 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_rtc, "sa1100-rtc", NULL),
};
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-mmp/mmp-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-twsi", 0xd4011000, "pxa2xx-i2c.0", 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("mrvl,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
{}
};
Expand All @@ -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-twsi", 0xd4011000, "pxa2xx-i2c.0", 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("mrvl,mmp-gpio", 0xd4019000, "mmp-gpio", NULL),
OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
{}
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/mmp2-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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-twsi", 0xd4011000, "pxa2xx-i2c.0", 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("mrvl,mmp-gpio", 0xd4019000, "mmp2-gpio", NULL),
OF_DEV_AUXDATA("mrvl,mmp-rtc", 0xd4010000, "sa1100-rtc", NULL),
{}
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/mmp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ struct resource mmp2_resource_gpio[] = {
};

struct platform_device mmp2_device_gpio = {
.name = "pxa-gpio",
.name = "mmp2-gpio",
.id = -1,
.num_resources = ARRAY_SIZE(mmp2_resource_gpio),
.resource = mmp2_resource_gpio,
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/pxa168.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct resource pxa168_resource_gpio[] = {
};

struct platform_device pxa168_device_gpio = {
.name = "pxa-gpio",
.name = "mmp-gpio",
.id = -1,
.num_resources = ARRAY_SIZE(pxa168_resource_gpio),
.resource = pxa168_resource_gpio,
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-mmp/pxa910.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct resource pxa910_resource_gpio[] = {
};

struct platform_device pxa910_device_gpio = {
.name = "pxa-gpio",
.name = "mmp-gpio",
.id = -1,
.num_resources = ARRAY_SIZE(pxa910_resource_gpio),
.resource = pxa910_resource_gpio,
Expand Down
29 changes: 27 additions & 2 deletions arch/arm/mach-pxa/devices.c
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,33 @@ struct resource pxa_resource_gpio[] = {
},
};

struct platform_device pxa_device_gpio = {
.name = "pxa-gpio",
struct platform_device pxa25x_device_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,
.num_resources = ARRAY_SIZE(pxa_resource_gpio),
.resource = pxa_resource_gpio,
Expand Down
6 changes: 5 additions & 1 deletion arch/arm/mach-pxa/devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ extern struct platform_device pxa_device_ficp;
extern struct platform_device sa1100_device_rtc;
extern struct platform_device pxa_device_rtc;
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_ohci;
Expand Down Expand Up @@ -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_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);
8 changes: 6 additions & 2 deletions arch/arm/mach-pxa/pxa25x.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@ static struct clk_lookup pxa25x_clkregs[] = {
INIT_CLKREG(&clk_pxa25x_gpio11, NULL, "GPIO11_CLK"),
INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
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),
};

Expand Down Expand Up @@ -375,7 +379,7 @@ static int __init pxa25x_init(void)
register_syscore_ops(&pxa2xx_mfp_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,
ARRAY_SIZE(pxa25x_devices));
if (ret)
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-pxa/pxa27x.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static struct clk_lookup pxa27x_clkregs[] = {
INIT_CLKREG(&clk_pxa27x_im, NULL, "IMCLK"),
INIT_CLKREG(&clk_pxa27x_memc, NULL, "MEMCLK"),
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),
};

Expand Down Expand Up @@ -470,7 +470,7 @@ static int __init pxa27x_init(void)
register_syscore_ops(&pxa2xx_mfp_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));
}

Expand Down
14 changes: 10 additions & 4 deletions arch/arm/mach-pxa/pxa3xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ static struct clk_lookup pxa3xx_clkregs[] = {
INIT_CLKREG(&clk_pxa3xx_mmc1, "pxa2xx-mci.0", NULL),
INIT_CLKREG(&clk_pxa3xx_mmc2, "pxa2xx-mci.1", 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),
};

Expand Down Expand Up @@ -436,7 +437,6 @@ void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info)
}

static struct platform_device *devices[] __initdata = {
&pxa_device_gpio,
&pxa27x_device_udc,
&pxa_device_pmu,
&pxa_device_i2s,
Expand Down Expand Up @@ -482,8 +482,14 @@ static int __init pxa3xx_init(void)
register_syscore_ops(&pxa3xx_mfp_syscore_ops);
register_syscore_ops(&pxa3xx_clock_syscore_ops);

if (!of_have_populated_dt())
ret = platform_add_devices(devices, ARRAY_SIZE(devices));
if (of_have_populated_dt())
return 0;

ret = platform_add_devices(devices, ARRAY_SIZE(devices));
if (ret)
return ret;
if (cpu_is_pxa300() || cpu_is_pxa310() || cpu_is_pxa320())
ret = platform_device_register(&pxa3xx_device_gpio);
}

return ret;
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/mach-pxa/pxa930.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

#include <mach/pxa930.h>

#include "devices.h"

static struct mfp_addr_map pxa930_mfp_addr_map[] __initdata = {

MFP_ADDR(GPIO0, 0x02e0),
Expand Down Expand Up @@ -192,9 +194,12 @@ static struct mfp_addr_map pxa935_mfp_addr_map[] __initdata = {

static int __init pxa930_init(void)
{
int ret = 0;

if (cpu_is_pxa93x()) {
mfp_init_base(io_p2v(MFPR_BASE));
mfp_init_addr(pxa930_mfp_addr_map);
ret = platform_device_register(&pxa93x_device_gpio);
}

if (cpu_is_pxa935())
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/mmp/clk-mmp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void __init mmp2_clk_init(void)

clk = mmp_clk_register_apbc("gpio", "vctcxo",
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",
apbc_base + APBC_KPC, 10, 0, &clk_lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/mmp/clk-pxa168.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void __init pxa168_clk_init(void)

clk = mmp_clk_register_apbc("gpio", "vctcxo",
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",
apbc_base + APBC_KPC, 10, 0, &clk_lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/mmp/clk-pxa910.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void __init pxa910_clk_init(void)

clk = mmp_clk_register_apbc("gpio", "vctcxo",
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",
apbc_base + APBC_KPC, 10, 0, &clk_lock);
Expand Down
Loading

0 comments on commit 2cab029

Please sign in to comment.