aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh/pfc/core.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2012-12-15 17:50:46 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-01-24 19:24:21 -0500
commit6f6a4a683be97837f3baae443aacd2b0e6162b10 (patch)
treef1a3970e00dfd46df21769c11c7d795ebd192c25 /drivers/sh/pfc/core.c
parentf9492fda70c87b410e61675095212dc806bdf615 (diff)
sh-pfc: Merge PFC core and gpio
The PFC core calls the gpio module gpiochip registration in its register_sh_pfc() function, itself called at arch initialization time. If the gpio module isn't present then the gpiochip will never be registered. As the gpio module can only be present at arch initialization time if it's builtin, there's no point in allowing to build it as a module. Make it a boolean option, and initialize it synchronously with the core if selected. 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/pfc/core.c')
-rw-r--r--drivers/sh/pfc/core.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/sh/pfc/core.c b/drivers/sh/pfc/core.c
index 30e33db7a2dc..541099613a21 100644
--- a/drivers/sh/pfc/core.c
+++ b/drivers/sh/pfc/core.c
@@ -149,7 +149,6 @@ int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos)
149 149
150 return (gpio_read_raw_reg(dr->mapped_reg, dr->reg_width) >> pos) & 1; 150 return (gpio_read_raw_reg(dr->mapped_reg, dr->reg_width) >> pos) & 1;
151} 151}
152EXPORT_SYMBOL_GPL(sh_pfc_read_bit);
153 152
154void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos, 153void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
155 unsigned long value) 154 unsigned long value)
@@ -169,7 +168,6 @@ void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
169 168
170 gpio_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow); 169 gpio_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow);
171} 170}
172EXPORT_SYMBOL_GPL(sh_pfc_write_bit);
173 171
174static void config_reg_helper(struct sh_pfc *pfc, 172static void config_reg_helper(struct sh_pfc *pfc,
175 struct pinmux_cfg_reg *crp, 173 struct pinmux_cfg_reg *crp,
@@ -307,7 +305,6 @@ int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
307 *bitp = n; 305 *bitp = n;
308 return 0; 306 return 0;
309} 307}
310EXPORT_SYMBOL_GPL(sh_pfc_get_data_reg);
311 308
312static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, 309static int get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id,
313 struct pinmux_cfg_reg **crp, 310 struct pinmux_cfg_reg **crp,
@@ -384,7 +381,6 @@ int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
384 pr_err("cannot locate data/mark enum_id for gpio %d\n", gpio); 381 pr_err("cannot locate data/mark enum_id for gpio %d\n", gpio);
385 return -1; 382 return -1;
386} 383}
387EXPORT_SYMBOL_GPL(sh_pfc_gpio_to_enum);
388 384
389int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, 385int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
390 int cfg_mode) 386 int cfg_mode)
@@ -500,7 +496,6 @@ int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
500 496
501int register_sh_pfc(struct sh_pfc_platform_data *pdata) 497int register_sh_pfc(struct sh_pfc_platform_data *pdata)
502{ 498{
503 int (*initroutine)(struct sh_pfc *) = NULL;
504 int ret; 499 int ret;
505 500
506 /* 501 /*
@@ -531,24 +526,20 @@ int register_sh_pfc(struct sh_pfc_platform_data *pdata)
531 if (unlikely(ret != 0)) 526 if (unlikely(ret != 0))
532 goto err; 527 goto err;
533 528
529#ifdef CONFIG_GPIO_SH_PFC
534 /* 530 /*
535 * Then the GPIO chip 531 * Then the GPIO chip
536 */ 532 */
537 initroutine = symbol_request(sh_pfc_register_gpiochip); 533 ret = sh_pfc_register_gpiochip(&sh_pfc);
538 if (initroutine) { 534 if (unlikely(ret != 0)) {
539 ret = (*initroutine)(&sh_pfc);
540 symbol_put_addr(initroutine);
541
542 /* 535 /*
543 * If the GPIO chip fails to come up we still leave the 536 * If the GPIO chip fails to come up we still leave the
544 * PFC state as it is, given that there are already 537 * PFC state as it is, given that there are already
545 * extant users of it that have succeeded by this point. 538 * extant users of it that have succeeded by this point.
546 */ 539 */
547 if (unlikely(ret != 0)) { 540 pr_notice("failed to init GPIO chip, ignoring...\n");
548 pr_notice("failed to init GPIO chip, ignoring...\n");
549 ret = 0;
550 }
551 } 541 }
542#endif
552 543
553 pr_info("%s support registered\n", sh_pfc.pdata->name); 544 pr_info("%s support registered\n", sh_pfc.pdata->name);
554 545
@@ -560,3 +551,7 @@ err:
560 551
561 return ret; 552 return ret;
562} 553}
554
555MODULE_AUTHOR("Magnus Damm, Paul Mundt, Laurent Pinchart");
556MODULE_DESCRIPTION("Pin Control and GPIO driver for SuperH pin function controller");
557MODULE_LICENSE("GPL v2");