diff options
| -rw-r--r-- | arch/arm/mach-msm/Kconfig | 4 | ||||
| -rw-r--r-- | arch/arm/mach-msm/Makefile | 8 | ||||
| -rw-r--r-- | arch/arm/mach-msm/gpio.c | 376 | ||||
| -rw-r--r-- | arch/arm/mach-msm/gpio_hw.h | 278 | ||||
| -rw-r--r-- | arch/arm/mach-msm/gpiomux.h | 17 | ||||
| -rw-r--r-- | arch/arm/mach-msm/include/mach/msm_gpiomux.h | 38 | ||||
| -rw-r--r-- | arch/arm/mach-msm/include/mach/msm_iomap-7x00.h | 10 | ||||
| -rw-r--r-- | arch/arm/mach-msm/include/mach/msm_iomap-7x30.h | 10 | ||||
| -rw-r--r-- | arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | 10 | ||||
| -rw-r--r-- | arch/arm/mach-msm/include/mach/msm_iomap.h | 2 | ||||
| -rw-r--r-- | arch/arm/mach-msm/io.c | 12 | ||||
| -rw-r--r-- | drivers/gpio/Kconfig | 16 | ||||
| -rw-r--r-- | drivers/gpio/Makefile | 2 | ||||
| -rw-r--r-- | drivers/gpio/gpio-ab8500.c | 2 | ||||
| -rw-r--r-- | drivers/gpio/gpio-msm-v1.c | 636 | ||||
| -rw-r--r-- | drivers/gpio/gpio-msm-v2.c (renamed from arch/arm/mach-msm/gpio-v2.c) | 4 | ||||
| -rw-r--r-- | drivers/of/gpio.c | 5 | ||||
| -rw-r--r-- | include/linux/of_gpio.h | 9 |
18 files changed, 732 insertions, 707 deletions
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig index 888e92502e15..ebde97f5d5f0 100644 --- a/arch/arm/mach-msm/Kconfig +++ b/arch/arm/mach-msm/Kconfig | |||
| @@ -11,6 +11,7 @@ config ARCH_MSM7X00A | |||
| 11 | select MSM_SMD | 11 | select MSM_SMD |
| 12 | select MSM_SMD_PKG3 | 12 | select MSM_SMD_PKG3 |
| 13 | select CPU_V6 | 13 | select CPU_V6 |
| 14 | select GPIO_MSM_V1 | ||
| 14 | select MSM_PROC_COMM | 15 | select MSM_PROC_COMM |
| 15 | select HAS_MSM_DEBUG_UART_PHYS | 16 | select HAS_MSM_DEBUG_UART_PHYS |
| 16 | 17 | ||
| @@ -22,6 +23,7 @@ config ARCH_MSM7X30 | |||
| 22 | select MSM_VIC | 23 | select MSM_VIC |
| 23 | select CPU_V7 | 24 | select CPU_V7 |
| 24 | select MSM_GPIOMUX | 25 | select MSM_GPIOMUX |
| 26 | select GPIO_MSM_V1 | ||
| 25 | select MSM_PROC_COMM | 27 | select MSM_PROC_COMM |
| 26 | select HAS_MSM_DEBUG_UART_PHYS | 28 | select HAS_MSM_DEBUG_UART_PHYS |
| 27 | 29 | ||
| @@ -33,6 +35,7 @@ config ARCH_QSD8X50 | |||
| 33 | select MSM_VIC | 35 | select MSM_VIC |
| 34 | select CPU_V7 | 36 | select CPU_V7 |
| 35 | select MSM_GPIOMUX | 37 | select MSM_GPIOMUX |
| 38 | select GPIO_MSM_V1 | ||
| 36 | select MSM_PROC_COMM | 39 | select MSM_PROC_COMM |
| 37 | select HAS_MSM_DEBUG_UART_PHYS | 40 | select HAS_MSM_DEBUG_UART_PHYS |
| 38 | 41 | ||
| @@ -44,6 +47,7 @@ config ARCH_MSM8X60 | |||
| 44 | select ARM_GIC | 47 | select ARM_GIC |
| 45 | select CPU_V7 | 48 | select CPU_V7 |
| 46 | select MSM_V2_TLMM | 49 | select MSM_V2_TLMM |
| 50 | select GPIO_MSM_V2 | ||
| 47 | select MSM_GPIOMUX | 51 | select MSM_GPIOMUX |
| 48 | select MSM_SCM if SMP | 52 | select MSM_SCM if SMP |
| 49 | 53 | ||
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile index b70658c5ae00..4285dfd80b6f 100644 --- a/arch/arm/mach-msm/Makefile +++ b/arch/arm/mach-msm/Makefile | |||
| @@ -29,11 +29,3 @@ obj-$(CONFIG_ARCH_MSM8960) += board-msm8960.o devices-msm8960.o | |||
| 29 | obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o | 29 | obj-$(CONFIG_ARCH_MSM7X30) += gpiomux-v1.o gpiomux.o |
| 30 | obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o | 30 | obj-$(CONFIG_ARCH_QSD8X50) += gpiomux-8x50.o gpiomux-v1.o gpiomux.o |
| 31 | obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o | 31 | obj-$(CONFIG_ARCH_MSM8X60) += gpiomux-8x60.o gpiomux-v2.o gpiomux.o |
| 32 | ifdef CONFIG_MSM_V2_TLMM | ||
| 33 | ifndef CONFIG_ARCH_MSM8960 | ||
| 34 | # TODO: TLMM Mapping issues need to be resolved | ||
| 35 | obj-y += gpio-v2.o | ||
| 36 | endif | ||
| 37 | else | ||
| 38 | obj-y += gpio.o | ||
| 39 | endif | ||
diff --git a/arch/arm/mach-msm/gpio.c b/arch/arm/mach-msm/gpio.c deleted file mode 100644 index 5ea273b00da8..000000000000 --- a/arch/arm/mach-msm/gpio.c +++ /dev/null | |||
| @@ -1,376 +0,0 @@ | |||
| 1 | /* linux/arch/arm/mach-msm/gpio.c | ||
| 2 | * | ||
| 3 | * Copyright (C) 2007 Google, Inc. | ||
| 4 | * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved. | ||
| 5 | * | ||
| 6 | * This software is licensed under the terms of the GNU General Public | ||
| 7 | * License version 2, as published by the Free Software Foundation, and | ||
| 8 | * may be copied, distributed, and modified under those terms. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include <linux/bitops.h> | ||
| 18 | #include <linux/gpio.h> | ||
| 19 | #include <linux/interrupt.h> | ||
| 20 | #include <linux/io.h> | ||
| 21 | #include <linux/irq.h> | ||
| 22 | #include <linux/module.h> | ||
| 23 | #include "gpio_hw.h" | ||
| 24 | #include "gpiomux.h" | ||
| 25 | |||
| 26 | #define FIRST_GPIO_IRQ MSM_GPIO_TO_INT(0) | ||
| 27 | |||
| 28 | #define MSM_GPIO_BANK(bank, first, last) \ | ||
| 29 | { \ | ||
| 30 | .regs = { \ | ||
| 31 | .out = MSM_GPIO_OUT_##bank, \ | ||
| 32 | .in = MSM_GPIO_IN_##bank, \ | ||
| 33 | .int_status = MSM_GPIO_INT_STATUS_##bank, \ | ||
| 34 | .int_clear = MSM_GPIO_INT_CLEAR_##bank, \ | ||
| 35 | .int_en = MSM_GPIO_INT_EN_##bank, \ | ||
| 36 | .int_edge = MSM_GPIO_INT_EDGE_##bank, \ | ||
| 37 | .int_pos = MSM_GPIO_INT_POS_##bank, \ | ||
| 38 | .oe = MSM_GPIO_OE_##bank, \ | ||
| 39 | }, \ | ||
| 40 | .chip = { \ | ||
| 41 | .base = (first), \ | ||
| 42 | .ngpio = (last) - (first) + 1, \ | ||
| 43 | .get = msm_gpio_get, \ | ||
| 44 | .set = msm_gpio_set, \ | ||
| 45 | .direction_input = msm_gpio_direction_input, \ | ||
| 46 | .direction_output = msm_gpio_direction_output, \ | ||
| 47 | .to_irq = msm_gpio_to_irq, \ | ||
| 48 | .request = msm_gpio_request, \ | ||
| 49 | .free = msm_gpio_free, \ | ||
| 50 | } \ | ||
| 51 | } | ||
| 52 | |||
| 53 | #define MSM_GPIO_BROKEN_INT_CLEAR 1 | ||
| 54 | |||
| 55 | struct msm_gpio_regs { | ||
| 56 | void __iomem *out; | ||
| 57 | void __iomem *in; | ||
| 58 | void __iomem *int_status; | ||
| 59 | void __iomem *int_clear; | ||
| 60 | void __iomem *int_en; | ||
| 61 | void __iomem *int_edge; | ||
| 62 | void __iomem *int_pos; | ||
| 63 | void __iomem *oe; | ||
| 64 | }; | ||
| 65 | |||
| 66 | struct msm_gpio_chip { | ||
| 67 | spinlock_t lock; | ||
| 68 | struct gpio_chip chip; | ||
| 69 | struct msm_gpio_regs regs; | ||
| 70 | #if MSM_GPIO_BROKEN_INT_CLEAR | ||
| 71 | unsigned int_status_copy; | ||
| 72 | #endif | ||
| 73 | unsigned int both_edge_detect; | ||
| 74 | unsigned int int_enable[2]; /* 0: awake, 1: sleep */ | ||
| 75 | }; | ||
| 76 | |||
| 77 | static int msm_gpio_write(struct msm_gpio_chip *msm_chip, | ||
| 78 | unsigned offset, unsigned on) | ||
| 79 | { | ||
| 80 | unsigned mask = BIT(offset); | ||
| 81 | unsigned val; | ||
| 82 | |||
| 83 | val = readl(msm_chip->regs.out); | ||
| 84 | if (on) | ||
| 85 | writel(val | mask, msm_chip->regs.out); | ||
| 86 | else | ||
| 87 | writel(val & ~mask, msm_chip->regs.out); | ||
| 88 | return 0; | ||
| 89 | } | ||
| 90 | |||
| 91 | static void msm_gpio_update_both_edge_detect(struct msm_gpio_chip *msm_chip) | ||
| 92 | { | ||
| 93 | int loop_limit = 100; | ||
| 94 | unsigned pol, val, val2, intstat; | ||
| 95 | do { | ||
| 96 | val = readl(msm_chip->regs.in); | ||
| 97 | pol = readl(msm_chip->regs.int_pos); | ||
| 98 | pol = (pol & ~msm_chip->both_edge_detect) | | ||
| 99 | (~val & msm_chip->both_edge_detect); | ||
| 100 | writel(pol, msm_chip->regs.int_pos); | ||
| 101 | intstat = readl(msm_chip->regs.int_status); | ||
| 102 | val2 = readl(msm_chip->regs.in); | ||
| 103 | if (((val ^ val2) & msm_chip->both_edge_detect & ~intstat) == 0) | ||
| 104 | return; | ||
| 105 | } while (loop_limit-- > 0); | ||
| 106 | printk(KERN_ERR "msm_gpio_update_both_edge_detect, " | ||
| 107 | "failed to reach stable state %x != %x\n", val, val2); | ||
| 108 | } | ||
| 109 | |||
| 110 | static int msm_gpio_clear_detect_status(struct msm_gpio_chip *msm_chip, | ||
| 111 | unsigned offset) | ||
| 112 | { | ||
| 113 | unsigned bit = BIT(offset); | ||
| 114 | |||
| 115 | #if MSM_GPIO_BROKEN_INT_CLEAR | ||
