aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl
diff options
context:
space:
mode:
authorPramod Gurav <pramod.gurav@smartplayin.com>2014-08-29 10:30:59 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-09-02 08:34:11 -0400
commit327455817a92522e669d2d11367e42af5956a8ed (patch)
treef76a087d3d76484521d88020cd3973c056b5380d /drivers/pinctrl
parent79c62cdd0760fb43acf680c89dc508b41a60d222 (diff)
pinctrl: qcom: Add support for reset for apq8064
This patch adds support for reset functions to reboot the boards with soc apq8064. Cc: Linus Walleij <linus.walleij@linaro.org> Cc: "Ivan T. Ivanov" <iivanov@mm-sol.com> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Andy Gross <agross@codeaurora.org> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r--drivers/pinctrl/qcom/pinctrl-apq8064.c7
-rw-r--r--drivers/pinctrl/qcom/pinctrl-msm.c30
2 files changed, 36 insertions, 1 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index feb6f152f9b7..ef1263c7bdde 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -324,6 +324,7 @@ enum apq8064_functions {
324 APQ_MUX_tsif1, 324 APQ_MUX_tsif1,
325 APQ_MUX_tsif2, 325 APQ_MUX_tsif2,
326 APQ_MUX_usb2_hsic, 326 APQ_MUX_usb2_hsic,
327 APQ_MUX_ps_hold,
327 APQ_MUX_NA, 328 APQ_MUX_NA,
328}; 329};
329 330
@@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
351 "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84", 352 "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
352 "gpio85", "gpio86", "gpio87", "gpio88", "gpio89" 353 "gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
353}; 354};
355static const char * const ps_hold_groups[] = {
356 "gpio78"
357};
354static const char * const gsbi1_groups[] = { 358static const char * const gsbi1_groups[] = {
355 "gpio18", "gpio19", "gpio20", "gpio21" 359 "gpio18", "gpio19", "gpio20", "gpio21"
356}; 360};
@@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
477 FUNCTION(tsif1), 481 FUNCTION(tsif1),
478 FUNCTION(tsif2), 482 FUNCTION(tsif2),
479 FUNCTION(usb2_hsic), 483 FUNCTION(usb2_hsic),
484 FUNCTION(ps_hold),
480}; 485};
481 486
482static const struct msm_pingroup apq8064_groups[] = { 487static const struct msm_pingroup apq8064_groups[] = {
@@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
558 PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 563 PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
559 PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 564 PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
560 PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 565 PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
561 PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 566 PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
562 PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 567 PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
563 PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 568 PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
564 PINGROUP(81, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 569 PINGROUP(81, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c
index 9175bbc298c7..80a64cad907d 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -12,6 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 */ 13 */
14 14
15#include <linux/delay.h>
15#include <linux/err.h> 16#include <linux/err.h>
16#include <linux/io.h> 17#include <linux/io.h>
17#include <linux/module.h> 18#include <linux/module.h>
@@ -27,12 +28,15 @@
27#include <linux/interrupt.h> 28#include <linux/interrupt.h>
28#include <linux/spinlock.h> 29#include <linux/spinlock.h>
29 30
31#include <asm/system_misc.h>
32
30#include "../core.h" 33#include "../core.h"
31#include "../pinconf.h" 34#include "../pinconf.h"
32#include "pinctrl-msm.h" 35#include "pinctrl-msm.h"
33#include "../pinctrl-utils.h" 36#include "../pinctrl-utils.h"
34 37
35#define MAX_NR_GPIO 300 38#define MAX_NR_GPIO 300
39#define PS_HOLD_OFFSET 0x820
36 40
37/** 41/**
38 * struct msm_pinctrl - state for a pinctrl-msm device 42 * struct msm_pinctrl - state for a pinctrl-msm device
@@ -850,6 +854,30 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
850 return 0; 854 return 0;
851} 855}
852 856
857#ifdef CONFIG_ARM
858static void __iomem *msm_ps_hold;
859
860static void msm_reset(enum reboot_mode reboot_mode, const char *cmd)
861{
862 writel(0, msm_ps_hold);
863 mdelay(10000);
864}
865
866static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl)
867{
868 int i = 0;
869 const struct msm_function *func = pctrl->soc->functions;
870
871 for (; i <= pctrl->soc->nfunctions; i++)
872 if (!strcmp(func[i].name, "ps_hold")) {
873 msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
874 arm_pm_restart = msm_reset;
875 }
876}
877#else
878static void msm_pinctrl_setup_pm_reset(const struct msm_pinctrl *pctrl) {}
879#endif
880
853int msm_pinctrl_probe(struct platform_device *pdev, 881int msm_pinctrl_probe(struct platform_device *pdev,
854 const struct msm_pinctrl_soc_data *soc_data) 882 const struct msm_pinctrl_soc_data *soc_data)
855{ 883{
@@ -873,6 +901,8 @@ int msm_pinctrl_probe(struct platform_device *pdev,
873 if (IS_ERR(pctrl->regs)) 901 if (IS_ERR(pctrl->regs))
874 return PTR_ERR(pctrl->regs); 902 return PTR_ERR(pctrl->regs);
875 903
904 msm_pinctrl_setup_pm_reset(pctrl);
905
876 pctrl->irq = platform_get_irq(pdev, 0); 906 pctrl->irq = platform_get_irq(pdev, 0);
877 if (pctrl->irq < 0) { 907 if (pctrl->irq < 0) {
878 dev_err(&pdev->dev, "No interrupt defined for msmgpio\n"); 908 dev_err(&pdev->dev, "No interrupt defined for msmgpio\n");