aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-samsung.c
diff options
context:
space:
mode:
authorSangsu Park <sangsu4u.park@samsung.com>2012-03-12 19:23:33 -0400
committerKukjin Kim <kgene.kim@samsung.com>2012-03-14 09:51:35 -0400
commitd39c815278bef7ce896100d8b385c81ed5cac015 (patch)
tree997fb400741a1a42828e0d57a2db67d7fb40d1db /drivers/gpio/gpio-samsung.c
parenta9696d840ed503da6458335bdcd4defbeb480ea7 (diff)
gpio/samsung: use ioremap() for EXYNOS4 GPIOlib
This patch changes to use ioremap() for EXYNOS4210 so that we can drop the static mapping for EXYNOS SoCs. Note: Will be updated for all of Samsung GPIOlibs to use ioremap() next time. Signed-off-by: Sangsu Park <sangsu4u.park@samsung.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'drivers/gpio/gpio-samsung.c')
-rw-r--r--drivers/gpio/gpio-samsung.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index d6cfdee7f8b7..46277877b7ec 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -2331,7 +2331,6 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
2331 .label = "GPY6", 2331 .label = "GPY6",
2332 }, 2332 },
2333 }, { 2333 }, {
2334 .base = (S5P_VA_GPIO2 + 0xC00),
2335 .config = &samsung_gpio_cfgs[9], 2334 .config = &samsung_gpio_cfgs[9],
2336 .irq_base = IRQ_EINT(0), 2335 .irq_base = IRQ_EINT(0),
2337 .chip = { 2336 .chip = {
@@ -2341,7 +2340,6 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
2341 .to_irq = samsung_gpiolib_to_irq, 2340 .to_irq = samsung_gpiolib_to_irq,
2342 }, 2341 },
2343 }, { 2342 }, {
2344 .base = (S5P_VA_GPIO2 + 0xC20),
2345 .config = &samsung_gpio_cfgs[9], 2343 .config = &samsung_gpio_cfgs[9],
2346 .irq_base = IRQ_EINT(8), 2344 .irq_base = IRQ_EINT(8),
2347 .chip = { 2345 .chip = {
@@ -2351,7 +2349,6 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
2351 .to_irq = samsung_gpiolib_to_irq, 2349 .to_irq = samsung_gpiolib_to_irq,
2352 }, 2350 },
2353 }, { 2351 }, {
2354 .base = (S5P_VA_GPIO2 + 0xC40),
2355 .config = &samsung_gpio_cfgs[9], 2352 .config = &samsung_gpio_cfgs[9],
2356 .irq_base = IRQ_EINT(16), 2353 .irq_base = IRQ_EINT(16),
2357 .chip = { 2354 .chip = {
@@ -2361,7 +2358,6 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
2361 .to_irq = samsung_gpiolib_to_irq, 2358 .to_irq = samsung_gpiolib_to_irq,
2362 }, 2359 },
2363 }, { 2360 }, {
2364 .base = (S5P_VA_GPIO2 + 0xC60),
2365 .config = &samsung_gpio_cfgs[9], 2361 .config = &samsung_gpio_cfgs[9],
2366 .irq_base = IRQ_EINT(24), 2362 .irq_base = IRQ_EINT(24),
2367 .chip = { 2363 .chip = {
@@ -2789,9 +2785,16 @@ static __init int samsung_gpiolib_init(void)
2789 s5p_register_gpioint_bank(IRQ_GPIOINT, 0, S5P_GPIOINT_GROUP_MAXNR); 2785 s5p_register_gpioint_bank(IRQ_GPIOINT, 0, S5P_GPIOINT_GROUP_MAXNR);
2790#endif 2786#endif
2791 } else if (soc_is_exynos4210()) { 2787 } else if (soc_is_exynos4210()) {
2792 group = 0; 2788#ifdef CONFIG_CPU_EXYNOS4210
2789 void __iomem *gpx_base;
2793 2790
2794 /* gpio part1 */ 2791 /* gpio part1 */
2792 gpio_base1 = ioremap(EXYNOS4_PA_GPIO1, SZ_4K);
2793 if (gpio_base1 == NULL) {
2794 pr_err("unable to ioremap for gpio_base1\n");
2795 goto err_ioremap1;
2796 }
2797
2795 chip = exynos4_gpios_1; 2798 chip = exynos4_gpios_1;
2796 nr_chips = ARRAY_SIZE(exynos4_gpios_1); 2799 nr_chips = ARRAY_SIZE(exynos4_gpios_1);
2797 2800
@@ -2800,14 +2803,25 @@ static __init int samsung_gpiolib_init(void)
2800 chip->config = &exynos_gpio_cfg; 2803 chip->config = &exynos_gpio_cfg;
2801 chip->group = group++; 2804 chip->group = group++;
2802 } 2805 }
2803#ifdef CONFIG_CPU_EXYNOS4210
2804 exynos_gpiolib_attach_ofnode(chip, 2806 exynos_gpiolib_attach_ofnode(chip,
2805 EXYNOS4_PA_GPIO1, i * 0x20); 2807 EXYNOS4_PA_GPIO1, i * 0x20);
2806#endif
2807 } 2808 }
2808 samsung_gpiolib_add_4bit_chips(exynos4_gpios_1, nr_chips, S5P_VA_GPIO1); 2809 samsung_gpiolib_add_4bit_chips(exynos4_gpios_1,
2810 nr_chips, gpio_base1);
2809 2811
2810 /* gpio part2 */ 2812 /* gpio part2 */
2813 gpio_base2 = ioremap(EXYNOS4_PA_GPIO2, SZ_4K);
2814 if (gpio_base2 == NULL) {
2815 pr_err("unable to ioremap for gpio_base2\n");
2816 goto err_ioremap2;
2817 }
2818
2819 /* need to set base address for gpx */
2820 chip = &exynos4_gpios_2[16];
2821 gpx_base = gpio_base2 + 0xC00;
2822 for (i = 0; i < 4; i++, chip++, gpx_base += 0x20)
2823 chip->base = gpx_base;
2824
2811 chip = exynos4_gpios_2; 2825 chip = exynos4_gpios_2;
2812 nr_chips = ARRAY_SIZE(exynos4_gpios_2); 2826 nr_chips = ARRAY_SIZE(exynos4_gpios_2);
2813 2827
@@ -2816,14 +2830,19 @@ static __init int samsung_gpiolib_init(void)
2816 chip->config = &exynos_gpio_cfg; 2830 chip->config = &exynos_gpio_cfg;
2817 chip->group = group++; 2831 chip->group = group++;
2818 } 2832 }
2819#ifdef CONFIG_CPU_EXYNOS4210
2820 exynos_gpiolib_attach_ofnode(chip, 2833 exynos_gpiolib_attach_ofnode(chip,
2821 EXYNOS4_PA_GPIO2, i * 0x20); 2834 EXYNOS4_PA_GPIO2, i * 0x20);
2822#endif
2823 } 2835 }
2824 samsung_gpiolib_add_4bit_chips(exynos4_gpios_2, nr_chips, S5P_VA_GPIO2); 2836 samsung_gpiolib_add_4bit_chips(exynos4_gpios_2,
2837 nr_chips, gpio_base2);
2825 2838
2826 /* gpio part3 */ 2839 /* gpio part3 */
2840 gpio_base3 = ioremap(EXYNOS4_PA_GPIO3, SZ_256);
2841 if (gpio_base3 == NULL) {
2842 pr_err("unable to ioremap for gpio_base3\n");
2843 goto err_ioremap3;
2844 }
2845
2827 chip = exynos4_gpios_3; 2846 chip = exynos4_gpios_3;
2828 nr_chips = ARRAY_SIZE(exynos4_gpios_3); 2847 nr_chips = ARRAY_SIZE(exynos4_gpios_3);
2829 2848
@@ -2832,17 +2851,18 @@ static __init int samsung_gpiolib_init(void)
2832 chip->config = &exynos_gpio_cfg; 2851 chip->config = &exynos_gpio_cfg;
2833 chip->group = group++; 2852 chip->group = group++;
2834 } 2853 }
2835#ifdef CONFIG_CPU_EXYNOS4210
2836 exynos_gpiolib_attach_ofnode(chip, 2854 exynos_gpiolib_attach_ofnode(chip,
2837 EXYNOS4_PA_GPIO3, i * 0x20); 2855 EXYNOS4_PA_GPIO3, i * 0x20);
2838#endif
2839 } 2856 }
2840 samsung_gpiolib_add_4bit_chips(exynos4_gpios_3, nr_chips, S5P_VA_GPIO3); 2857 samsung_gpiolib_add_4bit_chips(exynos4_gpios_3,
2858 nr_chips, gpio_base3);
2841 2859
2842#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_S5P_GPIO_INT) 2860#if defined(CONFIG_CPU_EXYNOS4210) && defined(CONFIG_S5P_GPIO_INT)
2843 s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS); 2861 s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS);
2844 s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS); 2862 s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS);
2845#endif 2863#endif
2864
2865#endif /* CONFIG_CPU_EXYNOS4210 */
2846 } else if (soc_is_exynos5250()) { 2866 } else if (soc_is_exynos5250()) {
2847#ifdef CONFIG_SOC_EXYNOS5250 2867#ifdef CONFIG_SOC_EXYNOS5250
2848 void __iomem *gpx_base; 2868 void __iomem *gpx_base;