aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-w90x900/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-w90x900/gpio.c')
-rw-r--r--arch/arm/mach-w90x900/gpio.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/arch/arm/mach-w90x900/gpio.c b/arch/arm/mach-w90x900/gpio.c
index c72e0dfa182..ba05aec7ea4 100644
--- a/arch/arm/mach-w90x900/gpio.c
+++ b/arch/arm/mach-w90x900/gpio.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-w90p910/gpio.c 2 * linux/arch/arm/mach-w90x900/gpio.c
3 * 3 *
4 * Generic w90p910 GPIO handling 4 * Generic nuc900 GPIO handling
5 * 5 *
6 * Wan ZongShun <mcuos.com@gmail.com> 6 * Wan ZongShun <mcuos.com@gmail.com>
7 * 7 *
@@ -30,31 +30,31 @@
30#define GPIO_IN (0x0C) 30#define GPIO_IN (0x0C)
31#define GROUPINERV (0x10) 31#define GROUPINERV (0x10)
32#define GPIO_GPIO(Nb) (0x00000001 << (Nb)) 32#define GPIO_GPIO(Nb) (0x00000001 << (Nb))
33#define to_w90p910_gpio_chip(c) container_of(c, struct w90p910_gpio_chip, chip) 33#define to_nuc900_gpio_chip(c) container_of(c, struct nuc900_gpio_chip, chip)
34 34
35#define W90P910_GPIO_CHIP(name, base_gpio, nr_gpio) \ 35#define NUC900_GPIO_CHIP(name, base_gpio, nr_gpio) \
36 { \ 36 { \
37 .chip = { \ 37 .chip = { \
38 .label = name, \ 38 .label = name, \
39 .direction_input = w90p910_dir_input, \ 39 .direction_input = nuc900_dir_input, \
40 .direction_output = w90p910_dir_output, \ 40 .direction_output = nuc900_dir_output, \
41 .get = w90p910_gpio_get, \ 41 .get = nuc900_gpio_get, \
42 .set = w90p910_gpio_set, \ 42 .set = nuc900_gpio_set, \
43 .base = base_gpio, \ 43 .base = base_gpio, \
44 .ngpio = nr_gpio, \ 44 .ngpio = nr_gpio, \
45 } \ 45 } \
46 } 46 }
47 47
48struct w90p910_gpio_chip { 48struct nuc900_gpio_chip {
49 struct gpio_chip chip; 49 struct gpio_chip chip;
50 void __iomem *regbase; /* Base of group register*/ 50 void __iomem *regbase; /* Base of group register*/
51 spinlock_t gpio_lock; 51 spinlock_t gpio_lock;
52}; 52};
53 53
54static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset) 54static int nuc900_gpio_get(struct gpio_chip *chip, unsigned offset)
55{ 55{
56 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 56 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
57 void __iomem *pio = w90p910_gpio->regbase + GPIO_IN; 57 void __iomem *pio = nuc900_gpio->regbase + GPIO_IN;
58 unsigned int regval; 58 unsigned int regval;
59 59
60 regval = __raw_readl(pio); 60 regval = __raw_readl(pio);
@@ -63,14 +63,14 @@ static int w90p910_gpio_get(struct gpio_chip *chip, unsigned offset)
63 return (regval != 0); 63 return (regval != 0);
64} 64}
65 65
66static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val) 66static void nuc900_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
67{ 67{
68 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 68 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
69 void __iomem *pio = w90p910_gpio->regbase + GPIO_OUT; 69 void __iomem *pio = nuc900_gpio->regbase + GPIO_OUT;
70 unsigned int regval; 70 unsigned int regval;
71 unsigned long flags; 71 unsigned long flags;
72 72
73 spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); 73 spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
74 74
75 regval = __raw_readl(pio); 75 regval = __raw_readl(pio);
76 76
@@ -81,36 +81,36 @@ static void w90p910_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
81 81
82 __raw_writel(regval, pio); 82 __raw_writel(regval, pio);
83 83
84 spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); 84 spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
85} 85}
86 86
87static int w90p910_dir_input(struct gpio_chip *chip, unsigned offset) 87static int nuc900_dir_input(struct gpio_chip *chip, unsigned offset)
88{ 88{
89 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 89 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
90 void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; 90 void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR;
91 unsigned int regval; 91 unsigned int regval;
92 unsigned long flags; 92 unsigned long flags;
93 93
94 spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); 94 spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
95 95
96 regval = __raw_readl(pio); 96 regval = __raw_readl(pio);
97 regval &= ~GPIO_GPIO(offset); 97 regval &= ~GPIO_GPIO(offset);
98 __raw_writel(regval, pio); 98 __raw_writel(regval, pio);
99 99
100 spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); 100 spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
101 101
102 return 0; 102 return 0;
103} 103}
104 104
105static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val) 105static int nuc900_dir_output(struct gpio_chip *chip, unsigned offset, int val)
106{ 106{
107 struct w90p910_gpio_chip *w90p910_gpio = to_w90p910_gpio_chip(chip); 107 struct nuc900_gpio_chip *nuc900_gpio = to_nuc900_gpio_chip(chip);
108 void __iomem *outreg = w90p910_gpio->regbase + GPIO_OUT; 108 void __iomem *outreg = nuc900_gpio->regbase + GPIO_OUT;
109 void __iomem *pio = w90p910_gpio->regbase + GPIO_DIR; 109 void __iomem *pio = nuc900_gpio->regbase + GPIO_DIR;
110 unsigned int regval; 110 unsigned int regval;
111 unsigned long flags; 111 unsigned long flags;
112 112
113 spin_lock_irqsave(&w90p910_gpio->gpio_lock, flags); 113 spin_lock_irqsave(&nuc900_gpio->gpio_lock, flags);
114 114
115 regval = __raw_readl(pio); 115 regval = __raw_readl(pio);
116 regval |= GPIO_GPIO(offset); 116 regval |= GPIO_GPIO(offset);
@@ -125,28 +125,28 @@ static int w90p910_dir_output(struct gpio_chip *chip, unsigned offset, int val)
125 125
126 __raw_writel(regval, outreg); 126 __raw_writel(regval, outreg);
127 127
128 spin_unlock_irqrestore(&w90p910_gpio->gpio_lock, flags); 128 spin_unlock_irqrestore(&nuc900_gpio->gpio_lock, flags);
129 129
130 return 0; 130 return 0;
131} 131}
132 132
133static struct w90p910_gpio_chip w90p910_gpio[] = { 133static struct nuc900_gpio_chip nuc900_gpio[] = {
134 W90P910_GPIO_CHIP("GROUPC", 0, 16), 134 NUC900_GPIO_CHIP("GROUPC", 0, 16),
135 W90P910_GPIO_CHIP("GROUPD", 16, 10), 135 NUC900_GPIO_CHIP("GROUPD", 16, 10),
136 W90P910_GPIO_CHIP("GROUPE", 26, 14), 136 NUC900_GPIO_CHIP("GROUPE", 26, 14),
137 W90P910_GPIO_CHIP("GROUPF", 40, 10), 137 NUC900_GPIO_CHIP("GROUPF", 40, 10),
138 W90P910_GPIO_CHIP("GROUPG", 50, 17), 138 NUC900_GPIO_CHIP("GROUPG", 50, 17),
139 W90P910_GPIO_CHIP("GROUPH", 67, 8), 139 NUC900_GPIO_CHIP("GROUPH", 67, 8),
140 W90P910_GPIO_CHIP("GROUPI", 75, 17), 140 NUC900_GPIO_CHIP("GROUPI", 75, 17),
141}; 141};
142 142
143void __init w90p910_init_gpio(int nr_group) 143void __init nuc900_init_gpio(int nr_group)
144{ 144{
145 unsigned i; 145 unsigned i;
146 struct w90p910_gpio_chip *gpio_chip; 146 struct nuc900_gpio_chip *gpio_chip;
147 147
148 for (i = 0; i < nr_group; i++) { 148 for (i = 0; i < nr_group; i++) {
149 gpio_chip = &w90p910_gpio[i]; 149 gpio_chip = &nuc900_gpio[i];
150 spin_lock_init(&gpio_chip->gpio_lock); 150 spin_lock_init(&gpio_chip->gpio_lock);
151 gpio_chip->regbase = GPIO_BASE + i * GROUPINERV; 151 gpio_chip->regbase = GPIO_BASE + i * GROUPINERV;
152 gpiochip_add(&gpio_chip->chip); 152 gpiochip_add(&gpio_chip->chip);