diff options
author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2012-12-15 17:50:43 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2013-01-24 19:24:20 -0500 |
commit | d4e62d0094e1b0f69946c3f16ce8ec882302a461 (patch) | |
tree | fd39f7a3ee241d0c8af31220143caebdafe45c7c /drivers/sh | |
parent | e62ebcdbce9eff4dc48168e86960c0dfcba086ea (diff) |
sh-pfc: Split platform data from the sh_pfc structure
Create a sh_pfc_platform_data structure to store platform data and
reference it from the core sh_pfc structure.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'drivers/sh')
-rw-r--r-- | drivers/sh/pfc/core.c | 89 | ||||
-rw-r--r-- | drivers/sh/pfc/gpio.c | 19 | ||||
-rw-r--r-- | drivers/sh/pfc/pinctrl.c | 27 |
3 files changed, 67 insertions, 68 deletions
diff --git a/drivers/sh/pfc/core.c b/drivers/sh/pfc/core.c index 68169373c98b..ecbe51d9f563 100644 --- a/drivers/sh/pfc/core.c +++ b/drivers/sh/pfc/core.c | |||
@@ -21,18 +21,13 @@ | |||
21 | #include <linux/ioport.h> | 21 | #include <linux/ioport.h> |
22 | #include <linux/pinctrl/machine.h> | 22 | #include <linux/pinctrl/machine.h> |
23 | 23 | ||
24 | static struct sh_pfc *sh_pfc __read_mostly; | 24 | static struct sh_pfc sh_pfc __read_mostly; |
25 | |||
26 | static inline bool sh_pfc_initialized(void) | ||
27 | { | ||
28 | return !!sh_pfc; | ||
29 | } | ||
30 | 25 | ||
31 | static void pfc_iounmap(struct sh_pfc *pfc) | 26 | static void pfc_iounmap(struct sh_pfc *pfc) |
32 | { | 27 | { |
33 | int k; | 28 | int k; |
34 | 29 | ||
35 | for (k = 0; k < pfc->num_resources; k++) | 30 | for (k = 0; k < pfc->pdata->num_resources; k++) |
36 | if (pfc->window[k].virt) | 31 | if (pfc->window[k].virt) |
37 | iounmap(pfc->window[k].virt); | 32 | iounmap(pfc->window[k].virt); |
38 | 33 | ||
@@ -45,16 +40,16 @@ static int pfc_ioremap(struct sh_pfc *pfc) | |||
45 | struct resource *res; | 40 | struct resource *res; |
46 | int k; | 41 | int k; |
47 | 42 | ||
48 | if (!pfc->num_resources) | 43 | if (!pfc->pdata->num_resources) |
49 | return 0; | 44 | return 0; |
50 | 45 | ||
51 | pfc->window = kzalloc(pfc->num_resources * sizeof(*pfc->window), | 46 | pfc->window = kzalloc(pfc->pdata->num_resources * sizeof(*pfc->window), |
52 | GFP_NOWAIT); | 47 | GFP_NOWAIT); |
53 | if (!pfc->window) | 48 | if (!pfc->window) |
54 | goto err1; | 49 | goto err1; |
55 | 50 | ||
56 | for (k = 0; k < pfc->num_resources; k++) { | 51 | for (k = 0; k < pfc->pdata->num_resources; k++) { |
57 | res = pfc->resource + k; | 52 | res = pfc->pdata->resource + k; |
58 | WARN_ON(resource_type(res) != IORESOURCE_MEM); | 53 | WARN_ON(resource_type(res) != IORESOURCE_MEM); |
59 | pfc->window[k].phys = res->start; | 54 | pfc->window[k].phys = res->start; |
60 | pfc->window[k].size = resource_size(res); | 55 | pfc->window[k].size = resource_size(res); |
@@ -79,7 +74,7 @@ static void __iomem *pfc_phys_to_virt(struct sh_pfc *pfc, | |||
79 | int k; | 74 | int k; |
80 | 75 | ||
81 | /* scan through physical windows and convert address */ | 76 | /* scan through physical windows and convert address */ |
82 | for (k = 0; k < pfc->num_resources; k++) { | 77 | for (k = 0; k < pfc->pdata->num_resources; k++) { |
83 | window = pfc->window + k; | 78 | window = pfc->window + k; |
84 | 79 | ||
85 | if (address < window->phys) | 80 | if (address < window->phys) |
@@ -232,8 +227,8 @@ static void write_config_reg(struct sh_pfc *pfc, | |||
232 | data &= mask; | 227 | data &= mask; |
233 | data |= value; | 228 | data |= value; |
234 | 229 | ||
235 | if (pfc->unlock_reg) | 230 | if (pfc->pdata->unlock_reg) |
236 | gpio_write_raw_reg(pfc_phys_to_virt(pfc, pfc->unlock_reg), | 231 | gpio_write_raw_reg(pfc_phys_to_virt(pfc, pfc->pdata->unlock_reg), |
237 | 32, ~data); | 232 | 32, ~data); |
238 | 233 | ||
239 | gpio_write_raw_reg(mapped_reg, crp->reg_width, data); | 234 | gpio_write_raw_reg(mapped_reg, crp->reg_width, data); |
@@ -241,16 +236,16 @@ static void write_config_reg(struct sh_pfc *pfc, | |||
241 | 236 | ||
242 | static int setup_data_reg(struct sh_pfc *pfc, unsigned gpio) | 237 | static int setup_data_reg(struct sh_pfc *pfc, unsigned gpio) |
243 | { | 238 | { |
244 | struct pinmux_gpio *gpiop = &pfc->gpios[gpio]; | 239 | struct pinmux_gpio *gpiop = &pfc->pdata->gpios[gpio]; |
245 | struct pinmux_data_reg *data_reg; | 240 | struct pinmux_data_reg *data_reg; |
246 | int k, n; | 241 | int k, n; |
247 | 242 | ||
248 | if (!enum_in_range(gpiop->enum_id, &pfc->data)) | 243 | if (!enum_in_range(gpiop->enum_id, &pfc->pdata->data)) |
249 | return -1; | 244 | return -1; |
250 | 245 | ||
251 | k = 0; | 246 | k = 0; |
252 | while (1) { | 247 | while (1) { |
253 | data_reg = pfc->data_regs + k; | 248 | data_reg = pfc->pdata->data_regs + k; |
254 | 249 | ||
255 | if (!data_reg->reg_width) | 250 | if (!data_reg->reg_width) |
256 | break; | 251 | break; |
@@ -279,12 +274,12 @@ static void setup_data_regs(struct sh_pfc *pfc) | |||
279 | struct pinmux_data_reg *drp; | 274 | struct pinmux_data_reg *drp; |
280 | int k; | 275 | int k; |
281 | 276 | ||
282 | for (k = pfc->first_gpio; k <= pfc->last_gpio; k++) | 277 | for (k = pfc->pdata->first_gpio; k <= pfc->pdata->last_gpio; k++) |
283 | setup_data_reg(pfc, k); | 278 | setup_data_reg(pfc, k); |
284 | 279 | ||
285 | k = 0; | 280 | k = 0; |
286 | while (1) { | 281 | while (1) { |
287 | drp = pfc->data_regs + k; | 282 | drp = pfc->pdata->data_regs + k; |
288 | 283 | ||
289 | if (!drp->reg_width) | 284 | if (!drp->reg_width) |
290 | break; | 285 | break; |
@@ -298,15 +293,15 @@ static void setup_data_regs(struct sh_pfc *pfc) | |||
298 | int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, | 293 | int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, |
299 | struct pinmux_data_reg **drp, int *bitp) | 294 | struct pinmux_data_reg **drp, int *bitp) |
300 | { | 295 | { |
301 | struct pinmux_gpio *gpiop = &pfc->gpios[gpio]; | 296 | struct pinmux_gpio *gpiop = &pfc->pdata->gpios[gpio]; |
302 | int k, n; | 297 | int k, n; |
303 | 298 | ||
304 | if (!enum_in_range(gpiop->enum_id, &pfc->data)) | 299 | if (!enum_in_range(gpiop->enum_id, &pfc->pdata->data)) |
305 | return -1; | 300 | return -1; |
306 | 301 | ||
307 | k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT; | 302 | k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT; |
308 | n = (gpiop->flags & PINMUX_FLAG_DBIT) >> PINMUX_FLAG_DBIT_SHIFT; | 303 | n = (gpiop->flags & PINMUX_FLAG_DBIT) >> PINMUX_FLAG_DBIT_SHIFT; |
309 | *drp = pfc->data_regs + k; | 304 | *drp = pfc->pdata->data_regs + k; |
310 | *bitp = n; | 305 | *bitp = n; |
311 | return 0; | 306 | return 0; |
312 | } | 307 | } |
@@ -323,7 +318,7 @@ static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, | |||
323 | 318 | ||
324 | k = 0; | 319 | k = 0; |
325 | while (1) { | 320 | while (1) { |
326 | config_reg = pfc->cfg_regs + k; | 321 | config_reg = pfc->pdata->cfg_regs + k; |
327 | 322 | ||
328 | r_width = config_reg->reg_width; | 323 | r_width = config_reg->reg_width; |
329 | f_width = config_reg->field_width; | 324 | f_width = config_reg->field_width; |
@@ -361,12 +356,12 @@ static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, | |||
361 | int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, | 356 | int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, |
362 | pinmux_enum_t *enum_idp) | 357 | pinmux_enum_t *enum_idp) |
363 | { | 358 | { |
364 | pinmux_enum_t enum_id = pfc->gpios[gpio].enum_id; | 359 | pinmux_enum_t enum_id = pfc->pdata->gpios[gpio].enum_id; |
365 | pinmux_enum_t *data = pfc->gpio_data; | 360 | pinmux_enum_t *data = pfc->pdata->gpio_data; |
366 | int k; | 361 | int k; |
367 | 362 | ||
368 | if (!enum_in_range(enum_id, &pfc->data)) { | 363 | if (!enum_in_range(enum_id, &pfc->pdata->data)) { |
369 | if (!enum_in_range(enum_id, &pfc->mark)) { | 364 | if (!enum_in_range(enum_id, &pfc->pdata->mark)) { |
370 | pr_err("non data/mark enum_id for gpio %d\n", gpio); | 365 | pr_err("non data/mark enum_id for gpio %d\n", gpio); |
371 | return -1; | 366 | return -1; |
372 | } | 367 | } |
@@ -377,7 +372,7 @@ int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, | |||
377 | return pos + 1; | 372 | return pos + 1; |
378 | } | 373 | } |
379 | 374 | ||
380 | for (k = 0; k < pfc->gpio_data_size; k++) { | 375 | for (k = 0; k < pfc->pdata->gpio_data_size; k++) { |
381 | if (data[k] == enum_id) { | 376 | if (data[k] == enum_id) { |
382 | *enum_idp = data[k + 1]; | 377 | *enum_idp = data[k + 1]; |
383 | return k + 1; | 378 | return k + 1; |
@@ -405,19 +400,19 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, | |||
405 | break; | 400 | break; |
406 | 401 | ||
407 | case PINMUX_TYPE_OUTPUT: | 402 | case PINMUX_TYPE_OUTPUT: |
408 | range = &pfc->output; | 403 | range = &pfc->pdata->output; |
409 | break; | 404 | break; |
410 | 405 | ||
411 | case PINMUX_TYPE_INPUT: | 406 | case PINMUX_TYPE_INPUT: |
412 | range = &pfc->input; | 407 | range = &pfc->pdata->input; |
413 | break; | 408 | break; |
414 | 409 | ||
415 | case PINMUX_TYPE_INPUT_PULLUP: | 410 | case PINMUX_TYPE_INPUT_PULLUP: |
416 | range = &pfc->input_pu; | 411 | range = &pfc->pdata->input_pu; |
417 | break; | 412 | break; |
418 | 413 | ||
419 | case PINMUX_TYPE_INPUT_PULLDOWN: | 414 | case PINMUX_TYPE_INPUT_PULLDOWN: |
420 | range = &pfc->input_pd; | 415 | range = &pfc->pdata->input_pd; |
421 | break; | 416 | break; |
422 | 417 | ||
423 | default: | 418 | default: |
@@ -437,7 +432,7 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, | |||
437 | break; | 432 | break; |
438 | 433 | ||
439 | /* first check if this is a function enum */ | 434 | /* first check if this is a function enum */ |
440 | in_range = enum_in_range(enum_id, &pfc->function); | 435 | in_range = enum_in_range(enum_id, &pfc->pdata->function); |
441 | if (!in_range) { | 436 | if (!in_range) { |
442 | /* not a function enum */ | 437 | /* not a function enum */ |
443 | if (range) { | 438 | if (range) { |
@@ -502,7 +497,7 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, | |||
502 | } | 497 | } |
503 | EXPORT_SYMBOL_GPL(sh_pfc_config_gpio); | 498 | EXPORT_SYMBOL_GPL(sh_pfc_config_gpio); |
504 | 499 | ||
505 | int register_sh_pfc(struct sh_pfc *pfc) | 500 | int register_sh_pfc(struct sh_pfc_platform_data *pdata) |
506 | { | 501 | { |
507 | int (*initroutine)(struct sh_pfc *) = NULL; | 502 | int (*initroutine)(struct sh_pfc *) = NULL; |
508 | int ret; | 503 | int ret; |
@@ -512,26 +507,28 @@ int register_sh_pfc(struct sh_pfc *pfc) | |||
512 | */ | 507 | */ |
513 | BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1)); | 508 | BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1)); |
514 | 509 | ||
515 | if (sh_pfc) | 510 | if (sh_pfc.pdata) |
516 | return -EBUSY; | 511 | return -EBUSY; |
517 | 512 | ||
518 | ret = pfc_ioremap(pfc); | 513 | sh_pfc.pdata = pdata; |
519 | if (unlikely(ret < 0)) | 514 | |
515 | ret = pfc_ioremap(&sh_pfc); | ||
516 | if (unlikely(ret < 0)) { | ||
517 | sh_pfc.pdata = NULL; | ||
520 | return ret; | 518 | return ret; |
519 | } | ||
521 | 520 | ||
522 | spin_lock_init(&pfc->lock); | 521 | spin_lock_init(&sh_pfc.lock); |
523 | 522 | ||
524 | pinctrl_provide_dummies(); | 523 | pinctrl_provide_dummies(); |
525 | setup_data_regs(pfc); | 524 | setup_data_regs(&sh_pfc); |
526 | |||
527 | sh_pfc = pfc; | ||
528 | 525 | ||
529 | /* | 526 | /* |
530 | * Initialize pinctrl bindings first | 527 | * Initialize pinctrl bindings first |
531 | */ | 528 | */ |
532 | initroutine = symbol_request(sh_pfc_register_pinctrl); | 529 | initroutine = symbol_request(sh_pfc_register_pinctrl); |
533 | if (initroutine) { | 530 | if (initroutine) { |
534 | ret = (*initroutine)(pfc); | 531 | ret = (*initroutine)(&sh_pfc); |
535 | symbol_put_addr(initroutine); | 532 | symbol_put_addr(initroutine); |
536 | 533 | ||
537 | if (unlikely(ret != 0)) | 534 | if (unlikely(ret != 0)) |
@@ -546,7 +543,7 @@ int register_sh_pfc(struct sh_pfc *pfc) | |||
546 | */ | 543 | */ |
547 | initroutine = symbol_request(sh_pfc_register_gpiochip); | 544 | initroutine = symbol_request(sh_pfc_register_gpiochip); |
548 | if (initroutine) { | 545 | if (initroutine) { |
549 | ret = (*initroutine)(pfc); | 546 | ret = (*initroutine)(&sh_pfc); |
550 | symbol_put_addr(initroutine); | 547 | symbol_put_addr(initroutine); |
551 | 548 | ||
552 | /* | 549 | /* |
@@ -560,13 +557,13 @@ int register_sh_pfc(struct sh_pfc *pfc) | |||
560 | } | 557 | } |
561 | } | 558 | } |
562 | 559 | ||
563 | pr_info("%s support registered\n", pfc->name); | 560 | pr_info("%s support registered\n", sh_pfc.pdata->name); |
564 | 561 | ||
565 | return 0; | 562 | return 0; |
566 | 563 | ||
567 | err: | 564 | err: |
568 | pfc_iounmap(pfc); | 565 | pfc_iounmap(&sh_pfc); |
569 | sh_pfc = NULL; | 566 | sh_pfc.pdata = NULL; |
570 | 567 | ||
571 | return ret; | 568 | return ret; |
572 | } | 569 | } |
diff --git a/drivers/sh/pfc/gpio.c b/drivers/sh/pfc/gpio.c index 6a24f07c2013..7597a024fac8 100644 --- a/drivers/sh/pfc/gpio.c +++ b/drivers/sh/pfc/gpio.c | |||
@@ -103,11 +103,11 @@ static int sh_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | |||
103 | if (pos <= 0 || !enum_id) | 103 | if (pos <= 0 || !enum_id) |
104 | break; | 104 | break; |
105 | 105 | ||
106 | for (i = 0; i < pfc->gpio_irq_size; i++) { | 106 | for (i = 0; i < pfc->pdata->gpio_irq_size; i++) { |
107 | enum_ids = pfc->gpio_irq[i].enum_ids; | 107 | enum_ids = pfc->pdata->gpio_irq[i].enum_ids; |
108 | for (k = 0; enum_ids[k]; k++) { | 108 | for (k = 0; enum_ids[k]; k++) { |
109 | if (enum_ids[k] == enum_id) | 109 | if (enum_ids[k] == enum_id) |
110 | return pfc->gpio_irq[i].irq; | 110 | return pfc->pdata->gpio_irq[i].irq; |
111 | } | 111 | } |
112 | } | 112 | } |
113 | } | 113 | } |
@@ -128,12 +128,12 @@ static void sh_pfc_gpio_setup(struct sh_pfc_chip *chip) | |||
128 | gc->set = sh_gpio_set; | 128 | gc->set = sh_gpio_set; |
129 | gc->to_irq = sh_gpio_to_irq; | 129 | gc->to_irq = sh_gpio_to_irq; |
130 | 130 | ||
131 | WARN_ON(pfc->first_gpio != 0); /* needs testing */ | 131 | WARN_ON(pfc->pdata->first_gpio != 0); /* needs testing */ |
132 | 132 | ||
133 | gc->label = pfc->name; | 133 | gc->label = pfc->pdata->name; |
134 | gc->owner = THIS_MODULE; | 134 | gc->owner = THIS_MODULE; |
135 | gc->base = pfc->first_gpio; | 135 | gc->base = pfc->pdata->first_gpio; |
136 | gc->ngpio = (pfc->last_gpio - pfc->first_gpio) + 1; | 136 | gc->ngpio = (pfc->pdata->last_gpio - pfc->pdata->first_gpio) + 1; |
137 | } | 137 | } |
138 | 138 | ||
139 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | 139 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc) |
@@ -154,7 +154,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc) | |||
154 | kfree(chip); | 154 | kfree(chip); |
155 | 155 | ||
156 | pr_info("%s handling gpio %d -> %d\n", | 156 | pr_info("%s handling gpio %d -> %d\n", |
157 | pfc->name, pfc->first_gpio, pfc->last_gpio); | 157 | pfc->pdata->name, pfc->pdata->first_gpio, |
158 | pfc->pdata->last_gpio); | ||
158 | 159 | ||
159 | return ret; | 160 | return ret; |
160 | } | 161 | } |
@@ -179,7 +180,7 @@ static int sh_pfc_gpio_probe(struct platform_device *pdev) | |||
179 | chip = gpio_to_pfc_chip(gc); | 180 | chip = gpio_to_pfc_chip(gc); |
180 | platform_set_drvdata(pdev, chip); | 181 | platform_set_drvdata(pdev, chip); |
181 | 182 | ||
182 | pr_info("attaching to GPIO chip %s\n", chip->pfc->name); | 183 | pr_info("attaching to GPIO chip %s\n", chip->pfc->pdata->name); |
183 | 184 | ||
184 | return 0; | 185 | return 0; |
185 | } | 186 | } |
diff --git a/drivers/sh/pfc/pinctrl.c b/drivers/sh/pfc/pinctrl.c index 4109b769eac0..3a2c77d3248f 100644 --- a/drivers/sh/pfc/pinctrl.c +++ b/drivers/sh/pfc/pinctrl.c | |||
@@ -140,7 +140,7 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset, | |||
140 | 140 | ||
141 | spin_lock_irqsave(&pfc->lock, flags); | 141 | spin_lock_irqsave(&pfc->lock, flags); |
142 | 142 | ||
143 | pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE; | 143 | pinmux_type = pfc->pdata->gpios[offset].flags & PINMUX_FLAG_TYPE; |
144 | 144 | ||
145 | /* | 145 | /* |
146 | * See if the present config needs to first be de-configured. | 146 | * See if the present config needs to first be de-configured. |
@@ -172,8 +172,8 @@ static int sh_pfc_reconfig_pin(struct sh_pfc *pfc, unsigned offset, | |||
172 | GPIO_CFG_REQ) != 0) | 172 | GPIO_CFG_REQ) != 0) |
173 | goto err; | 173 | goto err; |
174 | 174 | ||
175 | pfc->gpios[offset].flags &= ~PINMUX_FLAG_TYPE; | 175 | pfc->pdata->gpios[offset].flags &= ~PINMUX_FLAG_TYPE; |
176 | pfc->gpios[offset].flags |= new_type; | 176 | pfc->pdata->gpios[offset].flags |= new_type; |
177 | 177 | ||
178 | ret = 0; | 178 | ret = 0; |
179 | 179 | ||
@@ -195,7 +195,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev, | |||
195 | 195 | ||
196 | spin_lock_irqsave(&pfc->lock, flags); | 196 | spin_lock_irqsave(&pfc->lock, flags); |
197 | 197 | ||
198 | pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE; | 198 | pinmux_type = pfc->pdata->gpios[offset].flags & PINMUX_FLAG_TYPE; |
199 | 199 | ||
200 | switch (pinmux_type) { | 200 | switch (pinmux_type) { |
201 | case PINMUX_TYPE_FUNCTION: | 201 | case PINMUX_TYPE_FUNCTION: |
@@ -236,7 +236,7 @@ static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev, | |||
236 | 236 | ||
237 | spin_lock_irqsave(&pfc->lock, flags); | 237 | spin_lock_irqsave(&pfc->lock, flags); |
238 | 238 | ||
239 | pinmux_type = pfc->gpios[offset].flags & PINMUX_FLAG_TYPE; | 239 | pinmux_type = pfc->pdata->gpios[offset].flags & PINMUX_FLAG_TYPE; |
240 | 240 | ||
241 | sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE); | 241 | sh_pfc_config_gpio(pfc, offset, pinmux_type, GPIO_CFG_FREE); |
242 | 242 | ||
@@ -270,7 +270,7 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin, | |||
270 | struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); | 270 | struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); |
271 | struct sh_pfc *pfc = pmx->pfc; | 271 | struct sh_pfc *pfc = pmx->pfc; |
272 | 272 | ||
273 | *config = pfc->gpios[pin].flags & PINMUX_FLAG_TYPE; | 273 | *config = pfc->pdata->gpios[pin].flags & PINMUX_FLAG_TYPE; |
274 | 274 | ||
275 | return 0; | 275 | return 0; |
276 | } | 276 | } |
@@ -356,7 +356,7 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) | |||
356 | unsigned long flags; | 356 | unsigned long flags; |
357 | int i; | 357 | int i; |
358 | 358 | ||
359 | pmx->nr_pads = pfc->last_gpio - pfc->first_gpio + 1; | 359 | pmx->nr_pads = pfc->pdata->last_gpio - pfc->pdata->first_gpio + 1; |
360 | 360 | ||
361 | pmx->pads = kmalloc(sizeof(struct pinctrl_pin_desc) * pmx->nr_pads, | 361 | pmx->pads = kmalloc(sizeof(struct pinctrl_pin_desc) * pmx->nr_pads, |
362 | GFP_KERNEL); | 362 | GFP_KERNEL); |
@@ -375,9 +375,9 @@ static int sh_pfc_map_gpios(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) | |||
375 | */ | 375 | */ |
376 | for (i = 0; i < pmx->nr_pads; i++) { | 376 | for (i = 0; i < pmx->nr_pads; i++) { |
377 | struct pinctrl_pin_desc *pin = pmx->pads + i; | 377 | struct pinctrl_pin_desc *pin = pmx->pads + i; |
378 | struct pinmux_gpio *gpio = pfc->gpios + i; | 378 | struct pinmux_gpio *gpio = pfc->pdata->gpios + i; |
379 | 379 | ||
380 | pin->number = pfc->first_gpio + i; | 380 | pin->number = pfc->pdata->first_gpio + i; |
381 | pin->name = gpio->name; | 381 | pin->name = gpio->name; |
382 | 382 | ||
383 | /* XXX */ | 383 | /* XXX */ |
@@ -408,7 +408,7 @@ static int sh_pfc_map_functions(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx) | |||
408 | spin_lock_irqsave(&pmx->lock, flags); | 408 | spin_lock_irqsave(&pmx->lock, flags); |
409 | 409 | ||
410 | for (i = fn = 0; i < pmx->nr_pads; i++) { | 410 | for (i = fn = 0; i < pmx->nr_pads; i++) { |
411 | struct pinmux_gpio *gpio = pfc->gpios + i; | 411 | struct pinmux_gpio *gpio = pfc->pdata->gpios + i; |
412 | 412 | ||
413 | if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION) | 413 | if ((gpio->flags & PINMUX_FLAG_TYPE) == PINMUX_TYPE_FUNCTION) |
414 | pmx->functions[fn++] = gpio; | 414 | pmx->functions[fn++] = gpio; |
@@ -444,9 +444,10 @@ static int sh_pfc_pinctrl_probe(struct platform_device *pdev) | |||
444 | goto free_functions; | 444 | goto free_functions; |
445 | } | 445 | } |
446 | 446 | ||
447 | sh_pfc_gpio_range.npins = pfc->last_gpio - pfc->first_gpio + 1; | 447 | sh_pfc_gpio_range.npins = pfc->pdata->last_gpio |
448 | sh_pfc_gpio_range.base = pfc->first_gpio; | 448 | - pfc->pdata->first_gpio + 1; |
449 | sh_pfc_gpio_range.pin_base = pfc->first_gpio; | 449 | sh_pfc_gpio_range.base = pfc->pdata->first_gpio; |
450 | sh_pfc_gpio_range.pin_base = pfc->pdata->first_gpio; | ||
450 | 451 | ||
451 | pinctrl_add_gpio_range(sh_pfc_pmx->pctl, &sh_pfc_gpio_range); | 452 | pinctrl_add_gpio_range(sh_pfc_pmx->pctl, &sh_pfc_gpio_range); |
452 | 453 | ||