diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/dts/testcases/tests-phandle.dtsi | 37 | ||||
-rw-r--r-- | arch/arm/boot/dts/testcases/tests.dtsi | 1 | ||||
-rw-r--r-- | arch/arm/boot/dts/versatile-pb.dts | 2 | ||||
-rw-r--r-- | arch/microblaze/kernel/reset.c | 43 | ||||
-rw-r--r-- | arch/powerpc/sysdev/qe_lib/gpio.c | 42 |
5 files changed, 50 insertions, 75 deletions
diff --git a/arch/arm/boot/dts/testcases/tests-phandle.dtsi b/arch/arm/boot/dts/testcases/tests-phandle.dtsi new file mode 100644 index 000000000000..ec0c4e6212c9 --- /dev/null +++ b/arch/arm/boot/dts/testcases/tests-phandle.dtsi | |||
@@ -0,0 +1,37 @@ | |||
1 | |||
2 | / { | ||
3 | testcase-data { | ||
4 | phandle-tests { | ||
5 | provider0: provider0 { | ||
6 | #phandle-cells = <0>; | ||
7 | }; | ||
8 | |||
9 | provider1: provider1 { | ||
10 | #phandle-cells = <1>; | ||
11 | }; | ||
12 | |||
13 | provider2: provider2 { | ||
14 | #phandle-cells = <2>; | ||
15 | }; | ||
16 | |||
17 | provider3: provider3 { | ||
18 | #phandle-cells = <3>; | ||
19 | }; | ||
20 | |||
21 | consumer-a { | ||
22 | phandle-list = <&provider1 1>, | ||
23 | <&provider2 2 0>, | ||
24 | <0>, | ||
25 | <&provider3 4 4 3>, | ||
26 | <&provider2 5 100>, | ||
27 | <&provider0>, | ||
28 | <&provider1 7>; | ||
29 | phandle-list-names = "first", "second", "third"; | ||
30 | |||
31 | phandle-list-bad-phandle = <12345678 0 0>; | ||
32 | phandle-list-bad-args = <&provider2 1 0>, | ||
33 | <&provider3 0>; | ||
34 | }; | ||
35 | }; | ||
36 | }; | ||
37 | }; | ||
diff --git a/arch/arm/boot/dts/testcases/tests.dtsi b/arch/arm/boot/dts/testcases/tests.dtsi new file mode 100644 index 000000000000..a7c5067622e8 --- /dev/null +++ b/arch/arm/boot/dts/testcases/tests.dtsi | |||
@@ -0,0 +1 @@ | |||
/include/ "tests-phandle.dtsi" | |||
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts index 8a614e398004..166461073b78 100644 --- a/arch/arm/boot/dts/versatile-pb.dts +++ b/arch/arm/boot/dts/versatile-pb.dts | |||
@@ -46,3 +46,5 @@ | |||
46 | }; | 46 | }; |
47 | }; | 47 | }; |
48 | }; | 48 | }; |
49 | |||
50 | /include/ "testcases/tests.dtsi" | ||
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c index bd8ccab5ceff..88a01636f785 100644 --- a/arch/microblaze/kernel/reset.c +++ b/arch/microblaze/kernel/reset.c | |||
@@ -19,50 +19,11 @@ | |||
19 | static int handle; /* reset pin handle */ | 19 | static int handle; /* reset pin handle */ |
20 | static unsigned int reset_val; | 20 | static unsigned int reset_val; |
21 | 21 | ||
22 | static int of_reset_gpio_handle(void) | ||
23 | { | ||
24 | int ret; /* variable which stored handle reset gpio pin */ | ||
25 | struct device_node *root; /* root node */ | ||
26 | struct device_node *gpio; /* gpio node */ | ||
27 | struct gpio_chip *gc; | ||
28 | u32 flags; | ||
29 | const void *gpio_spec; | ||
30 | |||
31 | /* find out root node */ | ||
32 | root = of_find_node_by_path("/"); | ||
33 | |||
34 | /* give me handle for gpio node to be possible allocate pin */ | ||
35 | ret = of_parse_phandles_with_args(root, "hard-reset-gpios", | ||
36 | "#gpio-cells", 0, &gpio, &gpio_spec); | ||
37 | if (ret) { | ||
38 | pr_debug("%s: can't parse gpios property\n", __func__); | ||
39 | goto err0; | ||
40 | } | ||
41 | |||
42 | gc = of_node_to_gpiochip(gpio); | ||
43 | if (!gc) { | ||
44 | pr_debug("%s: gpio controller %s isn't registered\n", | ||
45 | root->full_name, gpio->full_name); | ||
46 | ret = -ENODEV; | ||
47 | goto err1; | ||
48 | } | ||
49 | |||
50 | ret = gc->of_xlate(gc, root, gpio_spec, &flags); | ||
51 | if (ret < 0) | ||
52 | goto err1; | ||
53 | |||
54 | ret += gc->base; | ||
55 | err1: | ||
56 | of_node_put(gpio); | ||
57 | err0: | ||
58 | pr_debug("%s exited with status %d\n", __func__, ret); | ||
59 | return ret; | ||
60 | } | ||
61 | |||
62 | void of_platform_reset_gpio_probe(void) | 22 | void of_platform_reset_gpio_probe(void) |
63 | { | 23 | { |
64 | int ret; | 24 | int ret; |
65 | handle = of_reset_gpio_handle(); | 25 | handle = of_get_named_gpio(of_find_node_by_path("/"), |
26 | "hard-reset-gpios", 0); | ||
66 | 27 | ||
67 | if (!gpio_is_valid(handle)) { | 28 | if (!gpio_is_valid(handle)) { |
68 | printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n", | 29 | printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n", |
diff --git a/arch/powerpc/sysdev/qe_lib/gpio.c b/arch/powerpc/sysdev/qe_lib/gpio.c index e23f23cf9f5c..521e67a49dc4 100644 --- a/arch/powerpc/sysdev/qe_lib/gpio.c +++ b/arch/powerpc/sysdev/qe_lib/gpio.c | |||
@@ -139,14 +139,10 @@ struct qe_pin { | |||
139 | struct qe_pin *qe_pin_request(struct device_node *np, int index) | 139 | struct qe_pin *qe_pin_request(struct device_node *np, int index) |
140 | { | 140 | { |
141 | struct qe_pin *qe_pin; | 141 | struct qe_pin *qe_pin; |
142 | struct device_node *gpio_np; | ||
143 | struct gpio_chip *gc; | 142 | struct gpio_chip *gc; |
144 | struct of_mm_gpio_chip *mm_gc; | 143 | struct of_mm_gpio_chip *mm_gc; |
145 | struct qe_gpio_chip *qe_gc; | 144 | struct qe_gpio_chip *qe_gc; |
146 | int err; | 145 | int err; |
147 | int size; | ||
148 | const void *gpio_spec; | ||
149 | const u32 *gpio_cells; | ||
150 | unsigned long flags; | 146 | unsigned long flags; |
151 | 147 | ||
152 | qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL); | 148 | qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL); |
@@ -155,45 +151,25 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) | |||
155 | return ERR_PTR(-ENOMEM); | 151 | return ERR_PTR(-ENOMEM); |
156 | } | 152 | } |
157 | 153 | ||
158 | err = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index, | 154 | err = of_get_gpio(np, index); |
159 | &gpio_np, &gpio_spec); | 155 | if (err < 0) |
160 | if (err) { | 156 | goto err0; |
161 | pr_debug("%s: can't parse gpios property\n", __func__); | 157 | gc = gpio_to_chip(err); |
158 | if (WARN_ON(!gc)) | ||
162 | goto err0; | 159 | goto err0; |
163 | } | ||
164 | 160 | ||
165 | if (!of_device_is_compatible(gpio_np, "fsl,mpc8323-qe-pario-bank")) { | 161 | if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) { |
166 | pr_debug("%s: tried to get a non-qe pin\n", __func__); | 162 | pr_debug("%s: tried to get a non-qe pin\n", __func__); |
167 | err = -EINVAL; | 163 | err = -EINVAL; |
168 | goto err1; | 164 | goto err0; |
169 | } | ||
170 | |||
171 | gc = of_node_to_gpiochip(gpio_np); | ||
172 | if (!gc) { | ||
173 | pr_debug("%s: gpio controller %s isn't registered\n", | ||
174 | np->full_name, gpio_np->full_name); | ||
175 | err = -ENODEV; | ||
176 | goto err1; | ||
177 | } | ||
178 | |||
179 | gpio_cells = of_get_property(gpio_np, "#gpio-cells", &size); | ||
180 | if (!gpio_cells || size != sizeof(*gpio_cells) || | ||
181 | *gpio_cells != gc->of_gpio_n_cells) { | ||
182 | pr_debug("%s: wrong #gpio-cells for %s\n", | ||
183 | np->full_name, gpio_np->full_name); | ||
184 | err = -EINVAL; | ||
185 | goto err1; | ||
186 | } | 165 | } |
187 | 166 | ||
188 | err = gc->of_xlate(gc, np, gpio_spec, NULL); | ||
189 | if (err < 0) | ||
190 | goto err1; | ||
191 | |||
192 | mm_gc = to_of_mm_gpio_chip(gc); | 167 | mm_gc = to_of_mm_gpio_chip(gc); |
193 | qe_gc = to_qe_gpio_chip(mm_gc); | 168 | qe_gc = to_qe_gpio_chip(mm_gc); |
194 | 169 | ||
195 | spin_lock_irqsave(&qe_gc->lock, flags); | 170 | spin_lock_irqsave(&qe_gc->lock, flags); |
196 | 171 | ||
172 | err -= gc->base; | ||
197 | if (test_and_set_bit(QE_PIN_REQUESTED, &qe_gc->pin_flags[err]) == 0) { | 173 | if (test_and_set_bit(QE_PIN_REQUESTED, &qe_gc->pin_flags[err]) == 0) { |
198 | qe_pin->controller = qe_gc; | 174 | qe_pin->controller = qe_gc; |
199 | qe_pin->num = err; | 175 | qe_pin->num = err; |
@@ -206,8 +182,6 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) | |||
206 | 182 | ||
207 | if (!err) | 183 | if (!err) |
208 | return qe_pin; | 184 | return qe_pin; |
209 | err1: | ||
210 | of_node_put(gpio_np); | ||
211 | err0: | 185 | err0: |
212 | kfree(qe_pin); | 186 | kfree(qe_pin); |
213 | pr_debug("%s failed with status %d\n", __func__, err); | 187 | pr_debug("%s failed with status %d\n", __func__, err); |