diff options
author | Sangsu Park <sangsu4u.park@samsung.com> | 2012-03-12 19:23:33 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2012-03-14 09:51:29 -0400 |
commit | a9696d840ed503da6458335bdcd4defbeb480ea7 (patch) | |
tree | b0141eb5d50008261689fbb16b611c658db9fc8e /drivers/gpio/gpio-samsung.c | |
parent | bcdc87b594e779b6aa753c912fa4a14942edb01e (diff) |
gpio/samsung: add support GPIOlib for EXYNOS5250
This patch adds gpio_chips for EXYNOS5250 and replaces
exynos4_xxx() with exynos_xxx() and variables to support
exynos4 and exynos5 together.
In addition, use ioreamp() for base address of gpios.
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.c | 439 |
1 files changed, 411 insertions, 28 deletions
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 0a79a1167a25..d6cfdee7f8b7 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -169,7 +169,7 @@ int s3c24xx_gpio_setpull_1down(struct samsung_gpio_chip *chip, | |||
169 | return s3c24xx_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_DOWN); | 169 | return s3c24xx_gpio_setpull_1(chip, off, pull, S3C_GPIO_PULL_DOWN); |
170 | } | 170 | } |
171 | 171 | ||
172 | static int exynos4_gpio_setpull(struct samsung_gpio_chip *chip, | 172 | static int exynos_gpio_setpull(struct samsung_gpio_chip *chip, |
173 | unsigned int off, samsung_gpio_pull_t pull) | 173 | unsigned int off, samsung_gpio_pull_t pull) |
174 | { | 174 | { |
175 | if (pull == S3C_GPIO_PULL_UP) | 175 | if (pull == S3C_GPIO_PULL_UP) |
@@ -178,7 +178,7 @@ static int exynos4_gpio_setpull(struct samsung_gpio_chip *chip, | |||
178 | return samsung_gpio_setpull_updown(chip, off, pull); | 178 | return samsung_gpio_setpull_updown(chip, off, pull); |
179 | } | 179 | } |
180 | 180 | ||
181 | static samsung_gpio_pull_t exynos4_gpio_getpull(struct samsung_gpio_chip *chip, | 181 | static samsung_gpio_pull_t exynos_gpio_getpull(struct samsung_gpio_chip *chip, |
182 | unsigned int off) | 182 | unsigned int off) |
183 | { | 183 | { |
184 | samsung_gpio_pull_t pull; | 184 | samsung_gpio_pull_t pull; |
@@ -452,9 +452,9 @@ static struct samsung_gpio_cfg s3c24xx_gpiocfg_banka = { | |||
452 | }; | 452 | }; |
453 | #endif | 453 | #endif |
454 | 454 | ||
455 | static struct samsung_gpio_cfg exynos4_gpio_cfg = { | 455 | static struct samsung_gpio_cfg exynos_gpio_cfg = { |
456 | .set_pull = exynos4_gpio_setpull, | 456 | .set_pull = exynos_gpio_setpull, |
457 | .get_pull = exynos4_gpio_getpull, | 457 | .get_pull = exynos_gpio_getpull, |
458 | .set_config = samsung_gpio_setcfg_4bit, | 458 | .set_config = samsung_gpio_setcfg_4bit, |
459 | .get_config = samsung_gpio_getcfg_4bit, | 459 | .get_config = samsung_gpio_getcfg_4bit, |
460 | }; | 460 | }; |
@@ -502,13 +502,13 @@ static struct samsung_gpio_cfg samsung_gpio_cfgs[] = { | |||
502 | .get_config = samsung_gpio_getcfg_2bit, | 502 | .get_config = samsung_gpio_getcfg_2bit, |
503 | }, | 503 | }, |
504 | [8] = { | 504 | [8] = { |
505 | .set_pull = exynos4_gpio_setpull, | 505 | .set_pull = exynos_gpio_setpull, |
506 | .get_pull = exynos4_gpio_getpull, | 506 | .get_pull = exynos_gpio_getpull, |
507 | }, | 507 | }, |
508 | [9] = { | 508 | [9] = { |
509 | .cfg_eint = 0x3, | 509 | .cfg_eint = 0x3, |
510 | .set_pull = exynos4_gpio_setpull, | 510 | .set_pull = exynos_gpio_setpull, |
511 | .get_pull = exynos4_gpio_getpull, | 511 | .get_pull = exynos_gpio_getpull, |
512 | } | 512 | } |
513 | }; | 513 | }; |
514 | 514 | ||
@@ -2113,10 +2113,10 @@ static struct samsung_gpio_chip s5pv210_gpios_4bit[] = { | |||
2113 | }; | 2113 | }; |
2114 | 2114 | ||
2115 | /* | 2115 | /* |
2116 | * Followings are the gpio banks in EXYNOS4210 | 2116 | * Followings are the gpio banks in EXYNOS SoCs |
2117 | * | 2117 | * |
2118 | * The 'config' member when left to NULL, is initialized to the default | 2118 | * The 'config' member when left to NULL, is initialized to the default |
2119 | * structure samsung_gpio_cfgs[3] in the init function below. | 2119 | * structure exynos_gpio_cfg in the init function below. |
2120 | * | 2120 | * |
2121 | * The 'base' member is also initialized in the init function below. | 2121 | * The 'base' member is also initialized in the init function below. |
2122 | * Note: The initialization of 'base' member of samsung_gpio_chip structure | 2122 | * Note: The initialization of 'base' member of samsung_gpio_chip structure |
@@ -2386,8 +2386,280 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
2386 | #endif | 2386 | #endif |
2387 | }; | 2387 | }; |
2388 | 2388 | ||
2389 | #if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) | 2389 | static struct samsung_gpio_chip exynos5_gpios_1[] = { |
2390 | static int exynos4_gpio_xlate(struct gpio_chip *gc, | 2390 | #ifdef CONFIG_ARCH_EXYNOS5 |
2391 | { | ||
2392 | .chip = { | ||
2393 | .base = EXYNOS5_GPA0(0), | ||
2394 | .ngpio = EXYNOS5_GPIO_A0_NR, | ||
2395 | .label = "GPA0", | ||
2396 | }, | ||
2397 | }, { | ||
2398 | .chip = { | ||
2399 | .base = EXYNOS5_GPA1(0), | ||
2400 | .ngpio = EXYNOS5_GPIO_A1_NR, | ||
2401 | .label = "GPA1", | ||
2402 | }, | ||
2403 | }, { | ||
2404 | .chip = { | ||
2405 | .base = EXYNOS5_GPA2(0), | ||
2406 | .ngpio = EXYNOS5_GPIO_A2_NR, | ||
2407 | .label = "GPA2", | ||
2408 | }, | ||
2409 | }, { | ||
2410 | .chip = { | ||
2411 | .base = EXYNOS5_GPB0(0), | ||
2412 | .ngpio = EXYNOS5_GPIO_B0_NR, | ||
2413 | .label = "GPB0", | ||
2414 | }, | ||
2415 | }, { | ||
2416 | .chip = { | ||
2417 | .base = EXYNOS5_GPB1(0), | ||
2418 | .ngpio = EXYNOS5_GPIO_B1_NR, | ||
2419 | .label = "GPB1", | ||
2420 | }, | ||
2421 | }, { | ||
2422 | .chip = { | ||
2423 | .base = EXYNOS5_GPB2(0), | ||
2424 | .ngpio = EXYNOS5_GPIO_B2_NR, | ||
2425 | .label = "GPB2", | ||
2426 | }, | ||
2427 | }, { | ||
2428 | .chip = { | ||
2429 | .base = EXYNOS5_GPB3(0), | ||
2430 | .ngpio = EXYNOS5_GPIO_B3_NR, | ||
2431 | .label = "GPB3", | ||
2432 | }, | ||
2433 | }, { | ||
2434 | .chip = { | ||
2435 | .base = EXYNOS5_GPC0(0), | ||
2436 | .ngpio = EXYNOS5_GPIO_C0_NR, | ||
2437 | .label = "GPC0", | ||
2438 | }, | ||
2439 | }, { | ||
2440 | .chip = { | ||
2441 | .base = EXYNOS5_GPC1(0), | ||
2442 | .ngpio = EXYNOS5_GPIO_C1_NR, | ||
2443 | .label = "GPC1", | ||
2444 | }, | ||
2445 | }, { | ||
2446 | .chip = { | ||
2447 | .base = EXYNOS5_GPC2(0), | ||
2448 | .ngpio = EXYNOS5_GPIO_C2_NR, | ||
2449 | .label = "GPC2", | ||
2450 | }, | ||
2451 | }, { | ||
2452 | .chip = { | ||
2453 | .base = EXYNOS5_GPC3(0), | ||
2454 | .ngpio = EXYNOS5_GPIO_C3_NR, | ||
2455 | .label = "GPC3", | ||
2456 | }, | ||
2457 | }, { | ||
2458 | .chip = { | ||
2459 | .base = EXYNOS5_GPD0(0), | ||
2460 | .ngpio = EXYNOS5_GPIO_D0_NR, | ||
2461 | .label = "GPD0", | ||
2462 | }, | ||
2463 | }, { | ||
2464 | .chip = { | ||
2465 | .base = EXYNOS5_GPD1(0), | ||
2466 | .ngpio = EXYNOS5_GPIO_D1_NR, | ||
2467 | .label = "GPD1", | ||
2468 | }, | ||
2469 | }, { | ||
2470 | .chip = { | ||
2471 | .base = EXYNOS5_GPY0(0), | ||
2472 | .ngpio = EXYNOS5_GPIO_Y0_NR, | ||
2473 | .label = "GPY0", | ||
2474 | }, | ||
2475 | }, { | ||
2476 | .chip = { | ||
2477 | .base = EXYNOS5_GPY1(0), | ||
2478 | .ngpio = EXYNOS5_GPIO_Y1_NR, | ||
2479 | .label = "GPY1", | ||
2480 | }, | ||
2481 | }, { | ||
2482 | .chip = { | ||
2483 | .base = EXYNOS5_GPY2(0), | ||
2484 | .ngpio = EXYNOS5_GPIO_Y2_NR, | ||
2485 | .label = "GPY2", | ||
2486 | }, | ||
2487 | }, { | ||
2488 | .chip = { | ||
2489 | .base = EXYNOS5_GPY3(0), | ||
2490 | .ngpio = EXYNOS5_GPIO_Y3_NR, | ||
2491 | .label = "GPY3", | ||
2492 | }, | ||
2493 | }, { | ||
2494 | .chip = { | ||
2495 | .base = EXYNOS5_GPY4(0), | ||
2496 | .ngpio = EXYNOS5_GPIO_Y4_NR, | ||
2497 | .label = "GPY4", | ||
2498 | }, | ||
2499 | }, { | ||
2500 | .chip = { | ||
2501 | .base = EXYNOS5_GPY5(0), | ||
2502 | .ngpio = EXYNOS5_GPIO_Y5_NR, | ||
2503 | .label = "GPY5", | ||
2504 | }, | ||
2505 | }, { | ||
2506 | .chip = { | ||
2507 | .base = EXYNOS5_GPY6(0), | ||
2508 | .ngpio = EXYNOS5_GPIO_Y6_NR, | ||
2509 | .label = "GPY6", | ||
2510 | }, | ||
2511 | }, { | ||
2512 | .config = &samsung_gpio_cfgs[9], | ||
2513 | .irq_base = IRQ_EINT(0), | ||
2514 | .chip = { | ||
2515 | .base = EXYNOS5_GPX0(0), | ||
2516 | .ngpio = EXYNOS5_GPIO_X0_NR, | ||
2517 | .label = "GPX0", | ||
2518 | .to_irq = samsung_gpiolib_to_irq, | ||
2519 | }, | ||
2520 | }, { | ||
2521 | .config = &samsung_gpio_cfgs[9], | ||
2522 | .irq_base = IRQ_EINT(8), | ||
2523 | .chip = { | ||
2524 | .base = EXYNOS5_GPX1(0), | ||
2525 | .ngpio = EXYNOS5_GPIO_X1_NR, | ||
2526 | .label = "GPX1", | ||
2527 | .to_irq = samsung_gpiolib_to_irq, | ||
2528 | }, | ||
2529 | }, { | ||
2530 | .config = &samsung_gpio_cfgs[9], | ||
2531 | .irq_base = IRQ_EINT(16), | ||
2532 | .chip = { | ||
2533 | .base = EXYNOS5_GPX2(0), | ||
2534 | .ngpio = EXYNOS5_GPIO_X2_NR, | ||
2535 | .label = "GPX2", | ||
2536 | .to_irq = samsung_gpiolib_to_irq, | ||
2537 | }, | ||
2538 | }, { | ||
2539 | .config = &samsung_gpio_cfgs[9], | ||
2540 | .irq_base = IRQ_EINT(24), | ||
2541 | .chip = { | ||
2542 | .base = EXYNOS5_GPX3(0), | ||
2543 | .ngpio = EXYNOS5_GPIO_X3_NR, | ||
2544 | .label = "GPX3", | ||
2545 | .to_irq = samsung_gpiolib_to_irq, | ||
2546 | }, | ||
2547 | }, | ||
2548 | #endif | ||
2549 | }; | ||
2550 | |||
2551 | static struct samsung_gpio_chip exynos5_gpios_2[] = { | ||
2552 | #ifdef CONFIG_ARCH_EXYNOS5 | ||
2553 | { | ||
2554 | .chip = { | ||
2555 | .base = EXYNOS5_GPE0(0), | ||
2556 | .ngpio = EXYNOS5_GPIO_E0_NR, | ||
2557 | .label = "GPE0", | ||
2558 | }, | ||
2559 | }, { | ||
2560 | .chip = { | ||
2561 | .base = EXYNOS5_GPE1(0), | ||
2562 | .ngpio = EXYNOS5_GPIO_E1_NR, | ||
2563 | .label = "GPE1", | ||
2564 | }, | ||
2565 | }, { | ||
2566 | .chip = { | ||
2567 | .base = EXYNOS5_GPF0(0), | ||
2568 | .ngpio = EXYNOS5_GPIO_F0_NR, | ||
2569 | .label = "GPF0", | ||
2570 | }, | ||
2571 | }, { | ||
2572 | .chip = { | ||
2573 | .base = EXYNOS5_GPF1(0), | ||
2574 | .ngpio = EXYNOS5_GPIO_F1_NR, | ||
2575 | .label = "GPF1", | ||
2576 | }, | ||
2577 | }, { | ||
2578 | .chip = { | ||
2579 | .base = EXYNOS5_GPG0(0), | ||
2580 | .ngpio = EXYNOS5_GPIO_G0_NR, | ||
2581 | .label = "GPG0", | ||
2582 | }, | ||
2583 | }, { | ||
2584 | .chip = { | ||
2585 | .base = EXYNOS5_GPG1(0), | ||
2586 | .ngpio = EXYNOS5_GPIO_G1_NR, | ||
2587 | .label = "GPG1", | ||
2588 | }, | ||
2589 | }, { | ||
2590 | .chip = { | ||
2591 | .base = EXYNOS5_GPG2(0), | ||
2592 | .ngpio = EXYNOS5_GPIO_G2_NR, | ||
2593 | .label = "GPG2", | ||
2594 | }, | ||
2595 | }, { | ||
2596 | .chip = { | ||
2597 | .base = EXYNOS5_GPH0(0), | ||
2598 | .ngpio = EXYNOS5_GPIO_H0_NR, | ||
2599 | .label = "GPH0", | ||
2600 | }, | ||
2601 | }, { | ||
2602 | .chip = { | ||
2603 | .base = EXYNOS5_GPH1(0), | ||
2604 | .ngpio = EXYNOS5_GPIO_H1_NR, | ||
2605 | .label = "GPH1", | ||
2606 | |||
2607 | }, | ||
2608 | }, | ||
2609 | #endif | ||
2610 | }; | ||
2611 | |||
2612 | static struct samsung_gpio_chip exynos5_gpios_3[] = { | ||
2613 | #ifdef CONFIG_ARCH_EXYNOS5 | ||
2614 | { | ||
2615 | .chip = { | ||
2616 | .base = EXYNOS5_GPV0(0), | ||
2617 | .ngpio = EXYNOS5_GPIO_V0_NR, | ||
2618 | .label = "GPV0", | ||
2619 | }, | ||
2620 | }, { | ||
2621 | .chip = { | ||
2622 | .base = EXYNOS5_GPV1(0), | ||
2623 | .ngpio = EXYNOS5_GPIO_V1_NR, | ||
2624 | .label = "GPV1", | ||
2625 | }, | ||
2626 | }, { | ||
2627 | .chip = { | ||
2628 | .base = EXYNOS5_GPV2(0), | ||
2629 | .ngpio = EXYNOS5_GPIO_V2_NR, | ||
2630 | .label = "GPV2", | ||
2631 | }, | ||
2632 | }, { | ||
2633 | .chip = { | ||
2634 | .base = EXYNOS5_GPV3(0), | ||
2635 | .ngpio = EXYNOS5_GPIO_V3_NR, | ||
2636 | .label = "GPV3", | ||
2637 | }, | ||
2638 | }, { | ||
2639 | .chip = { | ||
2640 | .base = EXYNOS5_GPV4(0), | ||
2641 | .ngpio = EXYNOS5_GPIO_V4_NR, | ||
2642 | .label = "GPV4", | ||
2643 | }, | ||
2644 | }, | ||
2645 | #endif | ||
2646 | }; | ||
2647 | |||
2648 | static struct samsung_gpio_chip exynos5_gpios_4[] = { | ||
2649 | #ifdef CONFIG_ARCH_EXYNOS5 | ||
2650 | { | ||
2651 | .chip = { | ||
2652 | .base = EXYNOS5_GPZ(0), | ||
2653 | .ngpio = EXYNOS5_GPIO_Z_NR, | ||
2654 | .label = "GPZ", | ||
2655 | }, | ||
2656 | }, | ||
2657 | #endif | ||
2658 | }; | ||
2659 | |||
2660 | |||
2661 | #if defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) | ||
2662 | static int exynos_gpio_xlate(struct gpio_chip *gc, | ||
2391 | const struct of_phandle_args *gpiospec, u32 *flags) | 2663 | const struct of_phandle_args *gpiospec, u32 *flags) |
2392 | { | 2664 | { |
2393 | unsigned int pin; | 2665 | unsigned int pin; |
@@ -2413,13 +2685,13 @@ static int exynos4_gpio_xlate(struct gpio_chip *gc, | |||
2413 | return gpiospec->args[0]; | 2685 | return gpiospec->args[0]; |
2414 | } | 2686 | } |
2415 | 2687 | ||
2416 | static const struct of_device_id exynos4_gpio_dt_match[] __initdata = { | 2688 | static const struct of_device_id exynos_gpio_dt_match[] __initdata = { |
2417 | { .compatible = "samsung,exynos4-gpio", }, | 2689 | { .compatible = "samsung,exynos4-gpio", }, |
2418 | {} | 2690 | {} |
2419 | }; | 2691 | }; |
2420 | 2692 | ||
2421 | static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip, | 2693 | static __init void exynos_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip, |
2422 | u64 base, u64 offset) | 2694 | u64 base, u64 offset) |
2423 | { | 2695 | { |
2424 | struct gpio_chip *gc = &chip->chip; | 2696 | struct gpio_chip *gc = &chip->chip; |
2425 | u64 address; | 2697 | u64 address; |
@@ -2429,28 +2701,29 @@ static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip, | |||
2429 | 2701 | ||
2430 | address = chip->base ? base + ((u32)chip->base & 0xfff) : base + offset; | 2702 | address = chip->base ? base + ((u32)chip->base & 0xfff) : base + offset; |
2431 | gc->of_node = of_find_matching_node_by_address(NULL, | 2703 | gc->of_node = of_find_matching_node_by_address(NULL, |
2432 | exynos4_gpio_dt_match, address); | 2704 | exynos_gpio_dt_match, address); |
2433 | if (!gc->of_node) { | 2705 | if (!gc->of_node) { |
2434 | pr_info("gpio: device tree node not found for gpio controller" | 2706 | pr_info("gpio: device tree node not found for gpio controller" |
2435 | " with base address %08llx\n", address); | 2707 | " with base address %08llx\n", address); |
2436 | return; | 2708 | return; |
2437 | } | 2709 | } |
2438 | gc->of_gpio_n_cells = 4; | 2710 | gc->of_gpio_n_cells = 4; |
2439 | gc->of_xlate = exynos4_gpio_xlate; | 2711 | gc->of_xlate = exynos_gpio_xlate; |
2440 | } | 2712 | } |
2441 | #elif defined(CONFIG_ARCH_EXYNOS4) | 2713 | #elif defined(CONFIG_ARCH_EXYNOS) |
2442 | static __init void exynos4_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip, | 2714 | static __init void exynos_gpiolib_attach_ofnode(struct samsung_gpio_chip *chip, |
2443 | u64 base, u64 offset) | 2715 | u64 base, u64 offset) |
2444 | { | 2716 | { |
2445 | return; | 2717 | return; |
2446 | } | 2718 | } |
2447 | #endif /* defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) */ | 2719 | #endif /* defined(CONFIG_ARCH_EXYNOS) && defined(CONFIG_OF) */ |
2448 | 2720 | ||
2449 | /* TODO: cleanup soc_is_* */ | 2721 | /* TODO: cleanup soc_is_* */ |
2450 | static __init int samsung_gpiolib_init(void) | 2722 | static __init int samsung_gpiolib_init(void) |
2451 | { | 2723 | { |
2452 | struct samsung_gpio_chip *chip; | 2724 | struct samsung_gpio_chip *chip; |
2453 | int i, nr_chips; | 2725 | int i, nr_chips; |
2726 | void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4; | ||
2454 | int group = 0; | 2727 | int group = 0; |
2455 | 2728 | ||
2456 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); | 2729 | samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); |
@@ -2524,11 +2797,11 @@ static __init int samsung_gpiolib_init(void) | |||
2524 | 2797 | ||
2525 | for (i = 0; i < nr_chips; i++, chip++) { | 2798 | for (i = 0; i < nr_chips; i++, chip++) { |
2526 | if (!chip->config) { | 2799 | if (!chip->config) { |
2527 | chip->config = &exynos4_gpio_cfg; | 2800 | chip->config = &exynos_gpio_cfg; |
2528 | chip->group = group++; | 2801 | chip->group = group++; |
2529 | } | 2802 | } |
2530 | #ifdef CONFIG_CPU_EXYNOS4210 | 2803 | #ifdef CONFIG_CPU_EXYNOS4210 |
2531 | exynos4_gpiolib_attach_ofnode(chip, | 2804 | exynos_gpiolib_attach_ofnode(chip, |
2532 | EXYNOS4_PA_GPIO1, i * 0x20); | 2805 | EXYNOS4_PA_GPIO1, i * 0x20); |
2533 | #endif | 2806 | #endif |
2534 | } | 2807 | } |
@@ -2540,11 +2813,11 @@ static __init int samsung_gpiolib_init(void) | |||
2540 | 2813 | ||
2541 | for (i = 0; i < nr_chips; i++, chip++) { | 2814 | for (i = 0; i < nr_chips; i++, chip++) { |
2542 | if (!chip->config) { | 2815 | if (!chip->config) { |
2543 | chip->config = &exynos4_gpio_cfg; | 2816 | chip->config = &exynos_gpio_cfg; |
2544 | chip->group = group++; | 2817 | chip->group = group++; |
2545 | } | 2818 | } |
2546 | #ifdef CONFIG_CPU_EXYNOS4210 | 2819 | #ifdef CONFIG_CPU_EXYNOS4210 |
2547 | exynos4_gpiolib_attach_ofnode(chip, | 2820 | exynos_gpiolib_attach_ofnode(chip, |
2548 | EXYNOS4_PA_GPIO2, i * 0x20); | 2821 | EXYNOS4_PA_GPIO2, i * 0x20); |
2549 | #endif | 2822 | #endif |
2550 | } | 2823 | } |
@@ -2556,11 +2829,11 @@ static __init int samsung_gpiolib_init(void) | |||
2556 | 2829 | ||
2557 | for (i = 0; i < nr_chips; i++, chip++) { | 2830 | for (i = 0; i < nr_chips; i++, chip++) { |
2558 | if (!chip->config) { | 2831 | if (!chip->config) { |
2559 | chip->config = &exynos4_gpio_cfg; | 2832 | chip->config = &exynos_gpio_cfg; |
2560 | chip->group = group++; | 2833 | chip->group = group++; |
2561 | } | 2834 | } |
2562 | #ifdef CONFIG_CPU_EXYNOS4210 | 2835 | #ifdef CONFIG_CPU_EXYNOS4210 |
2563 | exynos4_gpiolib_attach_ofnode(chip, | 2836 | exynos_gpiolib_attach_ofnode(chip, |
2564 | EXYNOS4_PA_GPIO3, i * 0x20); | 2837 | EXYNOS4_PA_GPIO3, i * 0x20); |
2565 | #endif | 2838 | #endif |
2566 | } | 2839 | } |
@@ -2570,12 +2843,122 @@ static __init int samsung_gpiolib_init(void) | |||
2570 | s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS); | 2843 | s5p_register_gpioint_bank(IRQ_GPIO_XA, 0, IRQ_GPIO1_NR_GROUPS); |
2571 | s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS); | 2844 | s5p_register_gpioint_bank(IRQ_GPIO_XB, IRQ_GPIO1_NR_GROUPS, IRQ_GPIO2_NR_GROUPS); |
2572 | #endif | 2845 | #endif |
2846 | } else if (soc_is_exynos5250()) { | ||
2847 | #ifdef CONFIG_SOC_EXYNOS5250 | ||
2848 | void __iomem *gpx_base; | ||
2849 | |||
2850 | /* gpio part1 */ | ||
2851 | gpio_base1 = ioremap(EXYNOS5_PA_GPIO1, SZ_4K); | ||
2852 | if (gpio_base1 == NULL) { | ||
2853 | pr_err("unable to ioremap for gpio_base1\n"); | ||
2854 | goto err_ioremap1; | ||
2855 | } | ||
2856 | |||
2857 | /* need to set base address for gpx */ | ||
2858 | chip = &exynos5_gpios_1[20]; | ||
2859 | gpx_base = gpio_base1 + 0xC00; | ||
2860 | for (i = 0; i < 4; i++, chip++, gpx_base += 0x20) | ||
2861 | chip->base = gpx_base; | ||
2862 | |||
2863 | chip = exynos5_gpios_1; | ||
2864 | nr_chips = ARRAY_SIZE(exynos5_gpios_1); | ||
2865 | |||
2866 | for (i = 0; i < nr_chips; i++, chip++) { | ||
2867 | if (!chip->config) { | ||
2868 | chip->config = &exynos_gpio_cfg; | ||
2869 | chip->group = group++; | ||
2870 | } | ||
2871 | exynos_gpiolib_attach_ofnode(chip, | ||
2872 | EXYNOS5_PA_GPIO1, i * 0x20); | ||
2873 | } | ||
2874 | samsung_gpiolib_add_4bit_chips(exynos5_gpios_1, | ||
2875 | nr_chips, gpio_base1); | ||
2876 | |||
2877 | /* gpio part2 */ | ||
2878 | gpio_base2 = ioremap(EXYNOS5_PA_GPIO2, SZ_4K); | ||
2879 | if (gpio_base2 == NULL) { | ||
2880 | pr_err("unable to ioremap for gpio_base2\n"); | ||
2881 | goto err_ioremap2; | ||
2882 | } | ||
2883 | |||
2884 | chip = exynos5_gpios_2; | ||
2885 | nr_chips = ARRAY_SIZE(exynos5_gpios_2); | ||
2886 | |||
2887 | for (i = 0; i < nr_chips; i++, chip++) { | ||
2888 | if (!chip->config) { | ||
2889 | chip->config = &exynos_gpio_cfg; | ||
2890 | chip->group = group++; | ||
2891 | } | ||
2892 | exynos_gpiolib_attach_ofnode(chip, | ||
2893 | EXYNOS5_PA_GPIO2, i * 0x20); | ||
2894 | } | ||
2895 | samsung_gpiolib_add_4bit_chips(exynos5_gpios_2, | ||
2896 | nr_chips, gpio_base2); | ||
2897 | |||
2898 | /* gpio part3 */ | ||
2899 | gpio_base3 = ioremap(EXYNOS5_PA_GPIO3, SZ_4K); | ||
2900 | if (gpio_base3 == NULL) { | ||
2901 | pr_err("unable to ioremap for gpio_base3\n"); | ||
2902 | goto err_ioremap3; | ||
2903 | } | ||
2904 | |||
2905 | /* need to set base address for gpv */ | ||
2906 | exynos5_gpios_3[0].base = gpio_base3; | ||
2907 | exynos5_gpios_3[1].base = gpio_base3 + 0x20; | ||
2908 | exynos5_gpios_3[2].base = gpio_base3 + 0x60; | ||
2909 | exynos5_gpios_3[3].base = gpio_base3 + 0x80; | ||
2910 | exynos5_gpios_3[4].base = gpio_base3 + 0xC0; | ||
2911 | |||
2912 | chip = exynos5_gpios_3; | ||
2913 | nr_chips = ARRAY_SIZE(exynos5_gpios_3); | ||
2914 | |||
2915 | for (i = 0; i < nr_chips; i++, chip++) { | ||
2916 | if (!chip->config) { | ||
2917 | chip->config = &exynos_gpio_cfg; | ||
2918 | chip->group = group++; | ||
2919 | } | ||
2920 | exynos_gpiolib_attach_ofnode(chip, | ||
2921 | EXYNOS5_PA_GPIO3, i * 0x20); | ||
2922 | } | ||
2923 | samsung_gpiolib_add_4bit_chips(exynos5_gpios_3, | ||
2924 | nr_chips, gpio_base3); | ||
2925 | |||
2926 | /* gpio part4 */ | ||
2927 | gpio_base4 = ioremap(EXYNOS5_PA_GPIO4, SZ_4K); | ||
2928 | if (gpio_base4 == NULL) { | ||
2929 | pr_err("unable to ioremap for gpio_base4\n"); | ||
2930 | goto err_ioremap4; | ||
2931 | } | ||
2932 | |||
2933 | chip = exynos5_gpios_4; | ||
2934 | nr_chips = ARRAY_SIZE(exynos5_gpios_4); | ||
2935 | |||
2936 | for (i = 0; i < nr_chips; i++, chip++) { | ||
2937 | if (!chip->config) { | ||
2938 | chip->config = &exynos_gpio_cfg; | ||
2939 | chip->group = group++; | ||
2940 | } | ||
2941 | exynos_gpiolib_attach_ofnode(chip, | ||
2942 | EXYNOS5_PA_GPIO4, i * 0x20); | ||
2943 | } | ||
2944 | samsung_gpiolib_add_4bit_chips(exynos5_gpios_4, | ||
2945 | nr_chips, gpio_base4); | ||
2946 | #endif /* CONFIG_SOC_EXYNOS5250 */ | ||
2573 | } else { | 2947 | } else { |
2574 | WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n"); | 2948 | WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n"); |
2575 | return -ENODEV; | 2949 | return -ENODEV; |
2576 | } | 2950 | } |
2577 | 2951 | ||
2578 | return 0; | 2952 | return 0; |
2953 | |||
2954 | err_ioremap4: | ||
2955 | iounmap(gpio_base3); | ||
2956 | err_ioremap3: | ||
2957 | iounmap(gpio_base2); | ||
2958 | err_ioremap2: | ||
2959 | iounmap(gpio_base1); | ||
2960 | err_ioremap1: | ||
2961 | return -ENOMEM; | ||
2579 | } | 2962 | } |
2580 | core_initcall(samsung_gpiolib_init); | 2963 | core_initcall(samsung_gpiolib_init); |
2581 | 2964 | ||