All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation
@ 2014-08-27  9:43 Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-27  9:43 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm
  Cc: Pramod Gurav, Linus Walleij, Bjorn Andersson, Ivan T. Ivanov,
	Stephen Boyd, Andy Gross

This adds a function ps_hold (Power Suppy Hold Signal) in pinctrl-ap8064
documentation which was missing. This function is used to reset the targets
with apq8064 soc.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
CC: Stephen Boyd <sboyd@codeaurora.org>
CC: Andy Gross <agross@codeaurora.org>

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt      |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index 0211c6d..ca5bfa5 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -50,7 +50,7 @@ Valid values for function are:
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
-  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic,
+  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic, ps_hold
 
 Example:
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation
  2014-08-29  3:22   ` Pramod Gurav
@ 2014-08-29  0:32     ` Bjorn Andersson
  -1 siblings, 0 replies; 19+ messages in thread
From: Bjorn Andersson @ 2014-08-29  0:32 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Linus Walleij,
	Ivan T. Ivanov, Stephen Boyd, Andy Gross

On Thu 28 Aug 20:22 PDT 2014, Pramod Gurav wrote:

> This adds a function ps_hold (Power Suppy Hold Signal) in pinctrl-ap8064
> documentation which was missing. This function is used to reset the targets
> with apq8064 soc.
> 
> CC: Linus Walleij <linus.walleij@linaro.org>
> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation
@ 2014-08-29  0:32     ` Bjorn Andersson
  0 siblings, 0 replies; 19+ messages in thread
From: Bjorn Andersson @ 2014-08-29  0:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu 28 Aug 20:22 PDT 2014, Pramod Gurav wrote:

> This adds a function ps_hold (Power Suppy Hold Signal) in pinctrl-ap8064
> documentation which was missing. This function is used to reset the targets
> with apq8064 soc.
> 
> CC: Linus Walleij <linus.walleij@linaro.org>
> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064
  2014-08-29  3:22   ` Pramod Gurav
@ 2014-08-29  1:28     ` Bjorn Andersson
  -1 siblings, 0 replies; 19+ messages in thread
From: Bjorn Andersson @ 2014-08-29  1:28 UTC (permalink / raw)
  To: Pramod Gurav
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Linus Walleij,
	Ivan T. Ivanov, Stephen Boyd, Andy Gross

On Thu 28 Aug 20:22 PDT 2014, Pramod Gurav wrote:

> This patch adds support for reset functions to reboot the boards
> with soc apq8064.
> 
> CC: Linus Walleij <linus.walleij@linaro.org>
> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> CC: Stephen Boyd <sboyd@codeaurora.org>
> CC: Andy Gross <agross@codeaurora.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
>  drivers/pinctrl/qcom/pinctrl-apq8064.c |    7 +++++-
>  drivers/pinctrl/qcom/pinctrl-msm.c     |   38 ++++++++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
> index feb6f15..ef1263c 100644
> --- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
> +++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
> @@ -324,6 +324,7 @@ enum apq8064_functions {
>  	APQ_MUX_tsif1,
>  	APQ_MUX_tsif2,
>  	APQ_MUX_usb2_hsic,
> +	APQ_MUX_ps_hold,
>  	APQ_MUX_NA,
>  };
>  
> @@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
>  	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
>  	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
>  };
> +static const char * const ps_hold_groups[] = {
> +	"gpio78"
> +};
>  static const char * const gsbi1_groups[] = {
>  	"gpio18", "gpio19", "gpio20", "gpio21"
>  };
> @@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
>  	FUNCTION(tsif1),
>  	FUNCTION(tsif2),
>  	FUNCTION(usb2_hsic),
> +	FUNCTION(ps_hold),
>  };
>  
>  static const struct msm_pingroup apq8064_groups[] = {
> @@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
>  	PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
> -	PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
> +	PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	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 2738108..be43e7a 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -12,6 +12,7 @@
>   * GNU General Public License for more details.
>   */
>  
> +#include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> @@ -27,12 +28,17 @@
>  #include <linux/interrupt.h>
>  #include <linux/spinlock.h>
>  
> +#include <asm/system_misc.h>
> +
>  #include "../core.h"
>  #include "../pinconf.h"
>  #include "pinctrl-msm.h"
>  #include "../pinctrl-utils.h"
>  
>  #define MAX_NR_GPIO 300
> +#define PS_HOLD_OFFSET 0x820
> +
> +static void __iomem *msm_ps_hold;
>  
>  /**
>   * struct msm_pinctrl - state for a pinctrl-msm device
> @@ -848,10 +854,31 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
>  	return 0;
>  }
>  
> +static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)

This doesn't follow the naming used in this.

> +{
> +	writel(0, msm_ps_hold);
> +	mdelay(10000);

Why 10 seconds? What happens after that?

> +}
> +
> +const struct msm_function
> +*find_pshold_function(const struct msm_function *functions,
> +					unsigned nfunctions, const char *name)

This should be static. But that would cause a compile warning on non-ARM
platforms, see below.

> +{
> +	int i = 0;
> +	const struct msm_function *func;
> +
> +	for (func = functions; i <= nfunctions; func++, i++)

Why do you have 'func' and why do you iterate over that and i?

for (i = 0; i < nfunctions; i++)
	if (strcmp(functions[i]->name, name) == 0)
		return true; (or &functions[i] if you really need it)

But as you only uses this once I would prefer if you just merge in the setting
of msm_ps_hold and arm_pm_restart here as well, see below.

> +		if (!strcmp(func->name, name))
> +			return func;
> +
> +	return NULL;
> +}
> +
>  int msm_pinctrl_probe(struct platform_device *pdev,
>  		      const struct msm_pinctrl_soc_data *soc_data)
>  {
>  	struct msm_pinctrl *pctrl;
> +	const struct msm_function *func;
>  	struct resource *res;
>  	int ret;
>  
> @@ -871,6 +898,17 @@ int msm_pinctrl_probe(struct platform_device *pdev,
>  	if (IS_ERR(pctrl->regs))
>  		return PTR_ERR(pctrl->regs);
>  
> +#ifdef CONFIG_ARM
> +	func = find_pshold_function(soc_data->functions,
> +					soc_data->nfunctions, "ps_hold");
> +	if (func) {
> +		dev_dbg(&pdev->dev, "Found Function %s\n", func->name);

Guess what, it will print "ps_hold" here. I would prefer if you just skip this
line, as this will always be true on 8960 and 8064.

> +		msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
> +		arm_pm_restart = qcom_reset;
> +	}
> +#else
> +#error "not supported on this arch"

There is no reason for you to break compilation of this driver on non-ARM
platforms. This #else/#error should be removed.

I would prefer if you did not #ifdef at all within the function, but rather
merge this piece of logic with the search above into a static function that's
surrounded by a check for CONFIG_ARM - providing a no-op for non-arm boards.

I.e

#ifdef CONFIG_ARM
static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
{
	...
}

static void msm_pinctrl_setup_pm_reset(pctrl)
{
	...
}
#else
static void msm_pinctrl_setup_pm_reset(pctrl) {}
#endif

> +#endif

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064
@ 2014-08-29  1:28     ` Bjorn Andersson
  0 siblings, 0 replies; 19+ messages in thread
From: Bjorn Andersson @ 2014-08-29  1:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu 28 Aug 20:22 PDT 2014, Pramod Gurav wrote:

> This patch adds support for reset functions to reboot the boards
> with soc apq8064.
> 
> CC: Linus Walleij <linus.walleij@linaro.org>
> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> CC: Stephen Boyd <sboyd@codeaurora.org>
> CC: Andy Gross <agross@codeaurora.org>
> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
> ---
>  drivers/pinctrl/qcom/pinctrl-apq8064.c |    7 +++++-
>  drivers/pinctrl/qcom/pinctrl-msm.c     |   38 ++++++++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
> index feb6f15..ef1263c 100644
> --- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
> +++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
> @@ -324,6 +324,7 @@ enum apq8064_functions {
>  	APQ_MUX_tsif1,
>  	APQ_MUX_tsif2,
>  	APQ_MUX_usb2_hsic,
> +	APQ_MUX_ps_hold,
>  	APQ_MUX_NA,
>  };
>  
> @@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
>  	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
>  	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
>  };
> +static const char * const ps_hold_groups[] = {
> +	"gpio78"
> +};
>  static const char * const gsbi1_groups[] = {
>  	"gpio18", "gpio19", "gpio20", "gpio21"
>  };
> @@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
>  	FUNCTION(tsif1),
>  	FUNCTION(tsif2),
>  	FUNCTION(usb2_hsic),
> +	FUNCTION(ps_hold),
>  };
>  
>  static const struct msm_pingroup apq8064_groups[] = {
> @@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
>  	PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
> -	PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
> +	PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>  	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 2738108..be43e7a 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
> @@ -12,6 +12,7 @@
>   * GNU General Public License for more details.
>   */
>  
> +#include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> @@ -27,12 +28,17 @@
>  #include <linux/interrupt.h>
>  #include <linux/spinlock.h>
>  
> +#include <asm/system_misc.h>
> +
>  #include "../core.h"
>  #include "../pinconf.h"
>  #include "pinctrl-msm.h"
>  #include "../pinctrl-utils.h"
>  
>  #define MAX_NR_GPIO 300
> +#define PS_HOLD_OFFSET 0x820
> +
> +static void __iomem *msm_ps_hold;
>  
>  /**
>   * struct msm_pinctrl - state for a pinctrl-msm device
> @@ -848,10 +854,31 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
>  	return 0;
>  }
>  
> +static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)

This doesn't follow the naming used in this.

> +{
> +	writel(0, msm_ps_hold);
> +	mdelay(10000);

Why 10 seconds? What happens after that?

> +}
> +
> +const struct msm_function
> +*find_pshold_function(const struct msm_function *functions,
> +					unsigned nfunctions, const char *name)

This should be static. But that would cause a compile warning on non-ARM
platforms, see below.

> +{
> +	int i = 0;
> +	const struct msm_function *func;
> +
> +	for (func = functions; i <= nfunctions; func++, i++)

Why do you have 'func' and why do you iterate over that and i?

for (i = 0; i < nfunctions; i++)
	if (strcmp(functions[i]->name, name) == 0)
		return true; (or &functions[i] if you really need it)

But as you only uses this once I would prefer if you just merge in the setting
of msm_ps_hold and arm_pm_restart here as well, see below.

> +		if (!strcmp(func->name, name))
> +			return func;
> +
> +	return NULL;
> +}
> +
>  int msm_pinctrl_probe(struct platform_device *pdev,
>  		      const struct msm_pinctrl_soc_data *soc_data)
>  {
>  	struct msm_pinctrl *pctrl;
> +	const struct msm_function *func;
>  	struct resource *res;
>  	int ret;
>  
> @@ -871,6 +898,17 @@ int msm_pinctrl_probe(struct platform_device *pdev,
>  	if (IS_ERR(pctrl->regs))
>  		return PTR_ERR(pctrl->regs);
>  
> +#ifdef CONFIG_ARM
> +	func = find_pshold_function(soc_data->functions,
> +					soc_data->nfunctions, "ps_hold");
> +	if (func) {
> +		dev_dbg(&pdev->dev, "Found Function %s\n", func->name);

Guess what, it will print "ps_hold" here. I would prefer if you just skip this
line, as this will always be true on 8960 and 8064.

> +		msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
> +		arm_pm_restart = qcom_reset;
> +	}
> +#else
> +#error "not supported on this arch"

There is no reason for you to break compilation of this driver on non-ARM
platforms. This #else/#error should be removed.

I would prefer if you did not #ifdef at all within the function, but rather
merge this piece of logic with the search above into a static function that's
surrounded by a check for CONFIG_ARM - providing a no-op for non-arm boards.

I.e

#ifdef CONFIG_ARM
static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
{
	...
}

static void msm_pinctrl_setup_pm_reset(pctrl)
{
	...
}
#else
static void msm_pinctrl_setup_pm_reset(pctrl) {}
#endif

> +#endif

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 0/4] Add reset support for apq8064
@ 2014-08-29  3:22 ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-arm-kernel; +Cc: Pramod Gurav

The reset on apq8064 is provided on gpio78 function1. We need to configure
gpio78 to function as ps_hold and write to base of the register to get the
device rebooted. 

First two patches in this patchset adds necessary DT support for apq8064-pinctrl
and DT support to mux gpio_78 as ps_hold function.

Third patch documents the ps_hold function in apq8064-pinctrl DT binding

Fourth implements the actual reset by initialising arm_pm_restart to a reset
function if ps_hold function is programmed in the pinctrl driver.

This is v2 with below changes since v1:
1. Added #error log as suggested by Kumar Gala 
2. Correct interrupts in DT from 32 to 16 based on Bjorn's new patch in bindings
3. Replaced hardcoding in DT with IRQ_TYPE_LEVEL_HIGH for interrupt level type

Pramod Gurav (4):
  ARM: DT: APQ8064: Add pinctrl support
  ARM: DT: APQ8064: Add node for ps_hold function in pinctrl
  pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding
    documentation
  pinctrl: qcom: Add support for reset for apq8064

 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt      |    2 +-
 arch/arm/boot/dts/qcom-apq8064.dtsi                |   21 +++++++++++
 drivers/pinctrl/qcom/pinctrl-apq8064.c             |    7 +++-
 drivers/pinctrl/qcom/pinctrl-msm.c                 |   38 ++++++++++++++++++++
 4 files changed, 66 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 0/4] Add reset support for apq8064
@ 2014-08-29  3:22 ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-arm-kernel

The reset on apq8064 is provided on gpio78 function1. We need to configure
gpio78 to function as ps_hold and write to base of the register to get the
device rebooted. 

First two patches in this patchset adds necessary DT support for apq8064-pinctrl
and DT support to mux gpio_78 as ps_hold function.

Third patch documents the ps_hold function in apq8064-pinctrl DT binding

Fourth implements the actual reset by initialising arm_pm_restart to a reset
function if ps_hold function is programmed in the pinctrl driver.

This is v2 with below changes since v1:
1. Added #error log as suggested by Kumar Gala 
2. Correct interrupts in DT from 32 to 16 based on Bjorn's new patch in bindings
3. Replaced hardcoding in DT with IRQ_TYPE_LEVEL_HIGH for interrupt level type

Pramod Gurav (4):
  ARM: DT: APQ8064: Add pinctrl support
  ARM: DT: APQ8064: Add node for ps_hold function in pinctrl
  pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding
    documentation
  pinctrl: qcom: Add support for reset for apq8064

 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt      |    2 +-
 arch/arm/boot/dts/qcom-apq8064.dtsi                |   21 +++++++++++
 drivers/pinctrl/qcom/pinctrl-apq8064.c             |    7 +++-
 drivers/pinctrl/qcom/pinctrl-msm.c                 |   38 ++++++++++++++++++++
 4 files changed, 66 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/4] ARM: DT: APQ8064: Add pinctrl support
  2014-08-29  3:22 ` Pramod Gurav
@ 2014-08-29  3:22   ` Pramod Gurav
  -1 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-arm-kernel
  Cc: Pramod Gurav, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, devicetree

This patch adds device tree nodes to support pinctrl for apq8064 SOC

CC: Rob Herring <robh+dt@kernel.org>
CC: Pawel Moll <pawel.moll@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
CC: Ian Campbell <ijc+devicetree@hellion.org.uk>
CC: Kumar Gala <galak@codeaurora.org>
CC: devicetree@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 arch/arm/boot/dts/qcom-apq8064.dtsi |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index d66fb25..e23303e 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -73,6 +73,17 @@
 		ranges;
 		compatible = "simple-bus";
 
+		msm_gpio: pinctrl@800000 {
+			compatible = "qcom,apq8064-pinctrl";
+			reg = <0x800000 0x4000>;
+
+			gpio-controller;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			interrupts = <0 16 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		intc: interrupt-controller@2000000 {
 			compatible = "qcom,msm-qgic2";
 			interrupt-controller;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 1/4] ARM: DT: APQ8064: Add pinctrl support
@ 2014-08-29  3:22   ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds device tree nodes to support pinctrl for apq8064 SOC

CC: Rob Herring <robh+dt@kernel.org>
CC: Pawel Moll <pawel.moll@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
CC: Ian Campbell <ijc+devicetree@hellion.org.uk>
CC: Kumar Gala <galak@codeaurora.org>
CC: devicetree at vger.kernel.org
CC: linux-arm-kernel at lists.infradead.org

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 arch/arm/boot/dts/qcom-apq8064.dtsi |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index d66fb25..e23303e 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -73,6 +73,17 @@
 		ranges;
 		compatible = "simple-bus";
 
+		msm_gpio: pinctrl at 800000 {
+			compatible = "qcom,apq8064-pinctrl";
+			reg = <0x800000 0x4000>;
+
+			gpio-controller;
+			#gpio-cells = <2>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			interrupts = <0 16 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
 		intc: interrupt-controller at 2000000 {
 			compatible = "qcom,msm-qgic2";
 			interrupt-controller;
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/4] ARM: DT: APQ8064: Add node for ps_hold function in pinctrl
  2014-08-29  3:22 ` Pramod Gurav
@ 2014-08-29  3:22   ` Pramod Gurav
  -1 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-arm-kernel
  Cc: Pramod Gurav, Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
	Kumar Gala, devicetree

This patch adds DT support to configure GPIO_78 as function ps_hold
on apq8064.

CC: Rob Herring <robh+dt@kernel.org>
CC: Pawel Moll <pawel.moll@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
CC: Ian Campbell <ijc+devicetree@hellion.org.uk>
CC: Kumar Gala <galak@codeaurora.org>
CC: devicetree@vger.kernel.org
CC: linux-arm-kernel@lists.infradead.org

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 arch/arm/boot/dts/qcom-apq8064.dtsi |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index e23303e..35c1907 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -82,6 +82,16 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 			interrupts = <0 16 IRQ_TYPE_LEVEL_HIGH>;
+
+			pinctrl-names = "default";
+			pinctrl-0 = <&ps_hold>;
+
+			ps_hold: ps_hold {
+				mux {
+					pins = "gpio78";
+					function = "ps_hold";
+				};
+			};
 		};
 
 		intc: interrupt-controller@2000000 {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/4] ARM: DT: APQ8064: Add node for ps_hold function in pinctrl
@ 2014-08-29  3:22   ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds DT support to configure GPIO_78 as function ps_hold
on apq8064.

CC: Rob Herring <robh+dt@kernel.org>
CC: Pawel Moll <pawel.moll@arm.com>
CC: Mark Rutland <mark.rutland@arm.com>
CC: Ian Campbell <ijc+devicetree@hellion.org.uk>
CC: Kumar Gala <galak@codeaurora.org>
CC: devicetree at vger.kernel.org
CC: linux-arm-kernel at lists.infradead.org

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 arch/arm/boot/dts/qcom-apq8064.dtsi |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index e23303e..35c1907 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -82,6 +82,16 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 			interrupts = <0 16 IRQ_TYPE_LEVEL_HIGH>;
+
+			pinctrl-names = "default";
+			pinctrl-0 = <&ps_hold>;
+
+			ps_hold: ps_hold {
+				mux {
+					pins = "gpio78";
+					function = "ps_hold";
+				};
+			};
 		};
 
 		intc: interrupt-controller at 2000000 {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation
  2014-08-29  3:22 ` Pramod Gurav
  (?)
@ 2014-08-29  3:22   ` Pramod Gurav
  -1 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-arm-kernel
  Cc: Pramod Gurav, Linus Walleij, Bjorn Andersson, Stephen Boyd,
	Ivan T. Ivanov, Andy Gross

This adds a function ps_hold (Power Suppy Hold Signal) in pinctrl-ap8064
documentation which was missing. This function is used to reset the targets
with apq8064 soc.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
CC: Stephen Boyd <sboyd@codeaurora.org>
CC: Andy Gross <agross@codeaurora.org>

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index 0211c6d..ca5bfa5 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -50,7 +50,7 @@ Valid values for function are:
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
-  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic,
+  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic, ps_hold
 
 Example:
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation
@ 2014-08-29  3:22   ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-arm-kernel

This adds a function ps_hold (Power Suppy Hold Signal) in pinctrl-ap8064
documentation which was missing. This function is used to reset the targets
with apq8064 soc.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
CC: Stephen Boyd <sboyd@codeaurora.org>
CC: Andy Gross <agross@codeaurora.org>

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index 0211c6d..ca5bfa5 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -50,7 +50,7 @@ Valid values for function are:
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
-  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic,
+  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic, ps_hold
 
 Example:
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation
@ 2014-08-29  3:22   ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-arm-kernel
  Cc: Pramod Gurav, Linus Walleij, Bjorn Andersson, Ivan T. Ivanov,
	Stephen Boyd, Andy Gross

This adds a function ps_hold (Power Suppy Hold Signal) in pinctrl-ap8064
documentation which was missing. This function is used to reset the targets
with apq8064 soc.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
CC: Stephen Boyd <sboyd@codeaurora.org>
CC: Andy Gross <agross@codeaurora.org>

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 .../bindings/pinctrl/qcom,apq8064-pinctrl.txt      |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
index 0211c6d..ca5bfa5 100644
--- a/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,apq8064-pinctrl.txt
@@ -50,7 +50,7 @@ Valid values for function are:
   gsbi4_cam_i2c, gsbi5, gsbi5_spi_cs1, gsbi5_spi_cs2, gsbi5_spi_cs3, gsbi6,
   gsbi6_spi_cs1, gsbi6_spi_cs2, gsbi6_spi_cs3, gsbi7, gsbi7_spi_cs1,
   gsbi7_spi_cs2, gsbi7_spi_cs3, gsbi_cam_i2c, hdmi, mi2s, riva_bt, riva_fm,
-  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic,
+  riva_wlan, sdc2, sdc4, slimbus, spkr_i2s, tsif1, tsif2, usb2_hsic, ps_hold
 
 Example:
 
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064
  2014-08-29  3:22 ` Pramod Gurav
  (?)
@ 2014-08-29  3:22   ` Pramod Gurav
  -1 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-arm-kernel
  Cc: Pramod Gurav, Linus Walleij, Bjorn Andersson, Stephen Boyd,
	Ivan T. Ivanov, Andy Gross

This patch adds support for reset functions to reboot the boards
with soc apq8064.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
CC: Stephen Boyd <sboyd@codeaurora.org>
CC: Andy Gross <agross@codeaurora.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/pinctrl/qcom/pinctrl-apq8064.c |    7 +++++-
 drivers/pinctrl/qcom/pinctrl-msm.c     |   38 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index feb6f15..ef1263c 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -324,6 +324,7 @@ enum apq8064_functions {
 	APQ_MUX_tsif1,
 	APQ_MUX_tsif2,
 	APQ_MUX_usb2_hsic,
+	APQ_MUX_ps_hold,
 	APQ_MUX_NA,
 };
 
@@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
 	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
 	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
 };
+static const char * const ps_hold_groups[] = {
+	"gpio78"
+};
 static const char * const gsbi1_groups[] = {
 	"gpio18", "gpio19", "gpio20", "gpio21"
 };
@@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
 	FUNCTION(tsif1),
 	FUNCTION(tsif2),
 	FUNCTION(usb2_hsic),
+	FUNCTION(ps_hold),
 };
 
 static const struct msm_pingroup apq8064_groups[] = {
@@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
 	PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-	PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+	PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	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 2738108..be43e7a 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -12,6 +12,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/module.h>
@@ -27,12 +28,17 @@
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 
+#include <asm/system_misc.h>
+
 #include "../core.h"
 #include "../pinconf.h"
 #include "pinctrl-msm.h"
 #include "../pinctrl-utils.h"
 
 #define MAX_NR_GPIO 300
+#define PS_HOLD_OFFSET 0x820
+
+static void __iomem *msm_ps_hold;
 
 /**
  * struct msm_pinctrl - state for a pinctrl-msm device
@@ -848,10 +854,31 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
 	return 0;
 }
 
+static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
+{
+	writel(0, msm_ps_hold);
+	mdelay(10000);
+}
+
+const struct msm_function
+*find_pshold_function(const struct msm_function *functions,
+					unsigned nfunctions, const char *name)
+{
+	int i = 0;
+	const struct msm_function *func;
+
+	for (func = functions; i <= nfunctions; func++, i++)
+		if (!strcmp(func->name, name))
+			return func;
+
+	return NULL;
+}
+
 int msm_pinctrl_probe(struct platform_device *pdev,
 		      const struct msm_pinctrl_soc_data *soc_data)
 {
 	struct msm_pinctrl *pctrl;
+	const struct msm_function *func;
 	struct resource *res;
 	int ret;
 
@@ -871,6 +898,17 @@ int msm_pinctrl_probe(struct platform_device *pdev,
 	if (IS_ERR(pctrl->regs))
 		return PTR_ERR(pctrl->regs);
 
+#ifdef CONFIG_ARM
+	func = find_pshold_function(soc_data->functions,
+					soc_data->nfunctions, "ps_hold");
+	if (func) {
+		dev_dbg(&pdev->dev, "Found Function %s\n", func->name);
+		msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
+		arm_pm_restart = qcom_reset;
+	}
+#else
+#error "not supported on this arch"
+#endif
 	pctrl->irq = platform_get_irq(pdev, 0);
 	if (pctrl->irq < 0) {
 		dev_err(&pdev->dev, "No interrupt defined for msmgpio\n");
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064
@ 2014-08-29  3:22   ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-arm-kernel

This patch adds support for reset functions to reboot the boards
with soc apq8064.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
CC: Stephen Boyd <sboyd@codeaurora.org>
CC: Andy Gross <agross@codeaurora.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/pinctrl/qcom/pinctrl-apq8064.c |    7 +++++-
 drivers/pinctrl/qcom/pinctrl-msm.c     |   38 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index feb6f15..ef1263c 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -324,6 +324,7 @@ enum apq8064_functions {
 	APQ_MUX_tsif1,
 	APQ_MUX_tsif2,
 	APQ_MUX_usb2_hsic,
+	APQ_MUX_ps_hold,
 	APQ_MUX_NA,
 };
 
@@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
 	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
 	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
 };
+static const char * const ps_hold_groups[] = {
+	"gpio78"
+};
 static const char * const gsbi1_groups[] = {
 	"gpio18", "gpio19", "gpio20", "gpio21"
 };
@@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
 	FUNCTION(tsif1),
 	FUNCTION(tsif2),
 	FUNCTION(usb2_hsic),
+	FUNCTION(ps_hold),
 };
 
 static const struct msm_pingroup apq8064_groups[] = {
@@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
 	PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-	PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+	PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	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 2738108..be43e7a 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -12,6 +12,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/module.h>
@@ -27,12 +28,17 @@
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 
+#include <asm/system_misc.h>
+
 #include "../core.h"
 #include "../pinconf.h"
 #include "pinctrl-msm.h"
 #include "../pinctrl-utils.h"
 
 #define MAX_NR_GPIO 300
+#define PS_HOLD_OFFSET 0x820
+
+static void __iomem *msm_ps_hold;
 
 /**
  * struct msm_pinctrl - state for a pinctrl-msm device
@@ -848,10 +854,31 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
 	return 0;
 }
 
+static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
+{
+	writel(0, msm_ps_hold);
+	mdelay(10000);
+}
+
+const struct msm_function
+*find_pshold_function(const struct msm_function *functions,
+					unsigned nfunctions, const char *name)
+{
+	int i = 0;
+	const struct msm_function *func;
+
+	for (func = functions; i <= nfunctions; func++, i++)
+		if (!strcmp(func->name, name))
+			return func;
+
+	return NULL;
+}
+
 int msm_pinctrl_probe(struct platform_device *pdev,
 		      const struct msm_pinctrl_soc_data *soc_data)
 {
 	struct msm_pinctrl *pctrl;
+	const struct msm_function *func;
 	struct resource *res;
 	int ret;
 
@@ -871,6 +898,17 @@ int msm_pinctrl_probe(struct platform_device *pdev,
 	if (IS_ERR(pctrl->regs))
 		return PTR_ERR(pctrl->regs);
 
+#ifdef CONFIG_ARM
+	func = find_pshold_function(soc_data->functions,
+					soc_data->nfunctions, "ps_hold");
+	if (func) {
+		dev_dbg(&pdev->dev, "Found Function %s\n", func->name);
+		msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
+		arm_pm_restart = qcom_reset;
+	}
+#else
+#error "not supported on this arch"
+#endif
 	pctrl->irq = platform_get_irq(pdev, 0);
 	if (pctrl->irq < 0) {
 		dev_err(&pdev->dev, "No interrupt defined for msmgpio\n");
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064
@ 2014-08-29  3:22   ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29  3:22 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm, linux-arm-kernel
  Cc: Pramod Gurav, Linus Walleij, Bjorn Andersson, Ivan T. Ivanov,
	Stephen Boyd, Andy Gross

This patch adds support for reset functions to reboot the boards
with soc apq8064.

CC: Linus Walleij <linus.walleij@linaro.org>
CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
CC: Stephen Boyd <sboyd@codeaurora.org>
CC: Andy Gross <agross@codeaurora.org>
Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
---
 drivers/pinctrl/qcom/pinctrl-apq8064.c |    7 +++++-
 drivers/pinctrl/qcom/pinctrl-msm.c     |   38 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
index feb6f15..ef1263c 100644
--- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
+++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
@@ -324,6 +324,7 @@ enum apq8064_functions {
 	APQ_MUX_tsif1,
 	APQ_MUX_tsif2,
 	APQ_MUX_usb2_hsic,
+	APQ_MUX_ps_hold,
 	APQ_MUX_NA,
 };
 
@@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
 	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
 	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
 };
+static const char * const ps_hold_groups[] = {
+	"gpio78"
+};
 static const char * const gsbi1_groups[] = {
 	"gpio18", "gpio19", "gpio20", "gpio21"
 };
@@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
 	FUNCTION(tsif1),
 	FUNCTION(tsif2),
 	FUNCTION(usb2_hsic),
+	FUNCTION(ps_hold),
 };
 
 static const struct msm_pingroup apq8064_groups[] = {
@@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
 	PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
-	PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
+	PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
 	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 2738108..be43e7a 100644
--- a/drivers/pinctrl/qcom/pinctrl-msm.c
+++ b/drivers/pinctrl/qcom/pinctrl-msm.c
@@ -12,6 +12,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/module.h>
@@ -27,12 +28,17 @@
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 
+#include <asm/system_misc.h>
+
 #include "../core.h"
 #include "../pinconf.h"
 #include "pinctrl-msm.h"
 #include "../pinctrl-utils.h"
 
 #define MAX_NR_GPIO 300
+#define PS_HOLD_OFFSET 0x820
+
+static void __iomem *msm_ps_hold;
 
 /**
  * struct msm_pinctrl - state for a pinctrl-msm device
@@ -848,10 +854,31 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
 	return 0;
 }
 
+static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
+{
+	writel(0, msm_ps_hold);
+	mdelay(10000);
+}
+
+const struct msm_function
+*find_pshold_function(const struct msm_function *functions,
+					unsigned nfunctions, const char *name)
+{
+	int i = 0;
+	const struct msm_function *func;
+
+	for (func = functions; i <= nfunctions; func++, i++)
+		if (!strcmp(func->name, name))
+			return func;
+
+	return NULL;
+}
+
 int msm_pinctrl_probe(struct platform_device *pdev,
 		      const struct msm_pinctrl_soc_data *soc_data)
 {
 	struct msm_pinctrl *pctrl;
+	const struct msm_function *func;
 	struct resource *res;
 	int ret;
 
@@ -871,6 +898,17 @@ int msm_pinctrl_probe(struct platform_device *pdev,
 	if (IS_ERR(pctrl->regs))
 		return PTR_ERR(pctrl->regs);
 
+#ifdef CONFIG_ARM
+	func = find_pshold_function(soc_data->functions,
+					soc_data->nfunctions, "ps_hold");
+	if (func) {
+		dev_dbg(&pdev->dev, "Found Function %s\n", func->name);
+		msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
+		arm_pm_restart = qcom_reset;
+	}
+#else
+#error "not supported on this arch"
+#endif
 	pctrl->irq = platform_get_irq(pdev, 0);
 	if (pctrl->irq < 0) {
 		dev_err(&pdev->dev, "No interrupt defined for msmgpio\n");
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064
  2014-08-29  1:28     ` Bjorn Andersson
@ 2014-08-29 13:32       ` Pramod Gurav
  -1 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29 13:32 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, Linus Walleij,
	Ivan T. Ivanov, Stephen Boyd, Andy Gross

Hi Bjorn,

On 29-08-2014 06:58 AM, Bjorn Andersson wrote:
> On Thu 28 Aug 20:22 PDT 2014, Pramod Gurav wrote:
> 
>> This patch adds support for reset functions to reboot the boards
>> with soc apq8064.
>>
>> CC: Linus Walleij <linus.walleij@linaro.org>
>> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
>> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>> CC: Stephen Boyd <sboyd@codeaurora.org>
>> CC: Andy Gross <agross@codeaurora.org>
>> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
>> ---
>>  drivers/pinctrl/qcom/pinctrl-apq8064.c |    7 +++++-
>>  drivers/pinctrl/qcom/pinctrl-msm.c     |   38 ++++++++++++++++++++++++++++++++
>>  2 files changed, 44 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
>> index feb6f15..ef1263c 100644
>> --- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
>> +++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
>> @@ -324,6 +324,7 @@ enum apq8064_functions {
>>  	APQ_MUX_tsif1,
>>  	APQ_MUX_tsif2,
>>  	APQ_MUX_usb2_hsic,
>> +	APQ_MUX_ps_hold,
>>  	APQ_MUX_NA,
>>  };
>>  
>> @@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
>>  	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
>>  	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
>>  };
>> +static const char * const ps_hold_groups[] = {
>> +	"gpio78"
>> +};
>>  static const char * const gsbi1_groups[] = {
>>  	"gpio18", "gpio19", "gpio20", "gpio21"
>>  };
>> @@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
>>  	FUNCTION(tsif1),
>>  	FUNCTION(tsif2),
>>  	FUNCTION(usb2_hsic),
>> +	FUNCTION(ps_hold),
>>  };
>>  
>>  static const struct msm_pingroup apq8064_groups[] = {
>> @@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
>>  	PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>> -	PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>> +	PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	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 2738108..be43e7a 100644
>> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
>> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
>> @@ -12,6 +12,7 @@
>>   * GNU General Public License for more details.
>>   */
>>  
>> +#include <linux/delay.h>
>>  #include <linux/err.h>
>>  #include <linux/io.h>
>>  #include <linux/module.h>
>> @@ -27,12 +28,17 @@
>>  #include <linux/interrupt.h>
>>  #include <linux/spinlock.h>
>>  
>> +#include <asm/system_misc.h>
>> +
>>  #include "../core.h"
>>  #include "../pinconf.h"
>>  #include "pinctrl-msm.h"
>>  #include "../pinctrl-utils.h"
>>  
>>  #define MAX_NR_GPIO 300
>> +#define PS_HOLD_OFFSET 0x820
>> +
>> +static void __iomem *msm_ps_hold;
>>  
>>  /**
>>   * struct msm_pinctrl - state for a pinctrl-msm device
>> @@ -848,10 +854,31 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
>>  	return 0;
>>  }
>>  
>> +static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
> 
> This doesn't follow the naming used in this.
> 
>> +{
>> +	writel(0, msm_ps_hold);
>> +	mdelay(10000);
> 
> Why 10 seconds? What happens after that?

This I copied from existing msm-poweroff.c driver for apq8074. Not sure
why such a long delay. I will exclude this from mine as I have no valid
reason.

> 
>> +}
>> +
>> +const struct msm_function
>> +*find_pshold_function(const struct msm_function *functions,
>> +					unsigned nfunctions, const char *name)
> 
> This should be static. But that would cause a compile warning on non-ARM
> platforms, see below.
> 
>> +{
>> +	int i = 0;
>> +	const struct msm_function *func;
>> +
>> +	for (func = functions; i <= nfunctions; func++, i++)
> 
> Why do you have 'func' and why do you iterate over that and i?
> 
> for (i = 0; i < nfunctions; i++)
> 	if (strcmp(functions[i]->name, name) == 0)
> 		return true; (or &functions[i] if you really need it)
> 
> But as you only uses this once I would prefer if you just merge in the setting
> of msm_ps_hold and arm_pm_restart here as well, see below.
> 
>> +		if (!strcmp(func->name, name))
>> +			return func;
>> +
>> +	return NULL;
>> +}
>> +
>>  int msm_pinctrl_probe(struct platform_device *pdev,
>>  		      const struct msm_pinctrl_soc_data *soc_data)
>>  {
>>  	struct msm_pinctrl *pctrl;
>> +	const struct msm_function *func;
>>  	struct resource *res;
>>  	int ret;
>>  
>> @@ -871,6 +898,17 @@ int msm_pinctrl_probe(struct platform_device *pdev,
>>  	if (IS_ERR(pctrl->regs))
>>  		return PTR_ERR(pctrl->regs);
>>  
>> +#ifdef CONFIG_ARM
>> +	func = find_pshold_function(soc_data->functions,
>> +					soc_data->nfunctions, "ps_hold");
>> +	if (func) {
>> +		dev_dbg(&pdev->dev, "Found Function %s\n", func->name);
> 
> Guess what, it will print "ps_hold" here. I would prefer if you just skip this
> line, as this will always be true on 8960 and 8064.
> 
>> +		msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
>> +		arm_pm_restart = qcom_reset;
>> +	}
>> +#else
>> +#error "not supported on this arch"
> 
> There is no reason for you to break compilation of this driver on non-ARM
> platforms. This #else/#error should be removed.
> 
> I would prefer if you did not #ifdef at all within the function, but rather
> merge this piece of logic with the search above into a static function that's
> surrounded by a check for CONFIG_ARM - providing a no-op for non-arm boards.
> 
> I.e
> 
> #ifdef CONFIG_ARM
> static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
> {
> 	...
> }
> 
> static void msm_pinctrl_setup_pm_reset(pctrl)
> {
> 	...
> }
> #else
> static void msm_pinctrl_setup_pm_reset(pctrl) {}
> #endif

Will put this in a single function which takes pctrl and address you
comments there in v3.
Thanks for review. :-)
> 
>> +#endif
> 
> Regards,
> Bjorn
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064
@ 2014-08-29 13:32       ` Pramod Gurav
  0 siblings, 0 replies; 19+ messages in thread
From: Pramod Gurav @ 2014-08-29 13:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Bjorn,

On 29-08-2014 06:58 AM, Bjorn Andersson wrote:
> On Thu 28 Aug 20:22 PDT 2014, Pramod Gurav wrote:
> 
>> This patch adds support for reset functions to reboot the boards
>> with soc apq8064.
>>
>> CC: Linus Walleij <linus.walleij@linaro.org>
>> CC: Bjorn Andersson <bjorn.andersson@sonymobile.com>
>> CC: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>> CC: Stephen Boyd <sboyd@codeaurora.org>
>> CC: Andy Gross <agross@codeaurora.org>
>> Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
>> ---
>>  drivers/pinctrl/qcom/pinctrl-apq8064.c |    7 +++++-
>>  drivers/pinctrl/qcom/pinctrl-msm.c     |   38 ++++++++++++++++++++++++++++++++
>>  2 files changed, 44 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/pinctrl/qcom/pinctrl-apq8064.c b/drivers/pinctrl/qcom/pinctrl-apq8064.c
>> index feb6f15..ef1263c 100644
>> --- a/drivers/pinctrl/qcom/pinctrl-apq8064.c
>> +++ b/drivers/pinctrl/qcom/pinctrl-apq8064.c
>> @@ -324,6 +324,7 @@ enum apq8064_functions {
>>  	APQ_MUX_tsif1,
>>  	APQ_MUX_tsif2,
>>  	APQ_MUX_usb2_hsic,
>> +	APQ_MUX_ps_hold,
>>  	APQ_MUX_NA,
>>  };
>>  
>> @@ -351,6 +352,9 @@ static const char * const gpio_groups[] = {
>>  	"gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
>>  	"gpio85", "gpio86", "gpio87", "gpio88", "gpio89"
>>  };
>> +static const char * const ps_hold_groups[] = {
>> +	"gpio78"
>> +};
>>  static const char * const gsbi1_groups[] = {
>>  	"gpio18", "gpio19", "gpio20", "gpio21"
>>  };
>> @@ -477,6 +481,7 @@ static const struct msm_function apq8064_functions[] = {
>>  	FUNCTION(tsif1),
>>  	FUNCTION(tsif2),
>>  	FUNCTION(usb2_hsic),
>> +	FUNCTION(ps_hold),
>>  };
>>  
>>  static const struct msm_pingroup apq8064_groups[] = {
>> @@ -558,7 +563,7 @@ static const struct msm_pingroup apq8064_groups[] = {
>>  	PINGROUP(75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(76, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(77, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>> -	PINGROUP(78, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>> +	PINGROUP(78, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(79, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	PINGROUP(80, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
>>  	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 2738108..be43e7a 100644
>> --- a/drivers/pinctrl/qcom/pinctrl-msm.c
>> +++ b/drivers/pinctrl/qcom/pinctrl-msm.c
>> @@ -12,6 +12,7 @@
>>   * GNU General Public License for more details.
>>   */
>>  
>> +#include <linux/delay.h>
>>  #include <linux/err.h>
>>  #include <linux/io.h>
>>  #include <linux/module.h>
>> @@ -27,12 +28,17 @@
>>  #include <linux/interrupt.h>
>>  #include <linux/spinlock.h>
>>  
>> +#include <asm/system_misc.h>
>> +
>>  #include "../core.h"
>>  #include "../pinconf.h"
>>  #include "pinctrl-msm.h"
>>  #include "../pinctrl-utils.h"
>>  
>>  #define MAX_NR_GPIO 300
>> +#define PS_HOLD_OFFSET 0x820
>> +
>> +static void __iomem *msm_ps_hold;
>>  
>>  /**
>>   * struct msm_pinctrl - state for a pinctrl-msm device
>> @@ -848,10 +854,31 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl)
>>  	return 0;
>>  }
>>  
>> +static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
> 
> This doesn't follow the naming used in this.
> 
>> +{
>> +	writel(0, msm_ps_hold);
>> +	mdelay(10000);
> 
> Why 10 seconds? What happens after that?

This I copied from existing msm-poweroff.c driver for apq8074. Not sure
why such a long delay. I will exclude this from mine as I have no valid
reason.

> 
>> +}
>> +
>> +const struct msm_function
>> +*find_pshold_function(const struct msm_function *functions,
>> +					unsigned nfunctions, const char *name)
> 
> This should be static. But that would cause a compile warning on non-ARM
> platforms, see below.
> 
>> +{
>> +	int i = 0;
>> +	const struct msm_function *func;
>> +
>> +	for (func = functions; i <= nfunctions; func++, i++)
> 
> Why do you have 'func' and why do you iterate over that and i?
> 
> for (i = 0; i < nfunctions; i++)
> 	if (strcmp(functions[i]->name, name) == 0)
> 		return true; (or &functions[i] if you really need it)
> 
> But as you only uses this once I would prefer if you just merge in the setting
> of msm_ps_hold and arm_pm_restart here as well, see below.
> 
>> +		if (!strcmp(func->name, name))
>> +			return func;
>> +
>> +	return NULL;
>> +}
>> +
>>  int msm_pinctrl_probe(struct platform_device *pdev,
>>  		      const struct msm_pinctrl_soc_data *soc_data)
>>  {
>>  	struct msm_pinctrl *pctrl;
>> +	const struct msm_function *func;
>>  	struct resource *res;
>>  	int ret;
>>  
>> @@ -871,6 +898,17 @@ int msm_pinctrl_probe(struct platform_device *pdev,
>>  	if (IS_ERR(pctrl->regs))
>>  		return PTR_ERR(pctrl->regs);
>>  
>> +#ifdef CONFIG_ARM
>> +	func = find_pshold_function(soc_data->functions,
>> +					soc_data->nfunctions, "ps_hold");
>> +	if (func) {
>> +		dev_dbg(&pdev->dev, "Found Function %s\n", func->name);
> 
> Guess what, it will print "ps_hold" here. I would prefer if you just skip this
> line, as this will always be true on 8960 and 8064.
> 
>> +		msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET;
>> +		arm_pm_restart = qcom_reset;
>> +	}
>> +#else
>> +#error "not supported on this arch"
> 
> There is no reason for you to break compilation of this driver on non-ARM
> platforms. This #else/#error should be removed.
> 
> I would prefer if you did not #ifdef at all within the function, but rather
> merge this piece of logic with the search above into a static function that's
> surrounded by a check for CONFIG_ARM - providing a no-op for non-arm boards.
> 
> I.e
> 
> #ifdef CONFIG_ARM
> static void qcom_reset(enum reboot_mode reboot_mode, const char *cmd)
> {
> 	...
> }
> 
> static void msm_pinctrl_setup_pm_reset(pctrl)
> {
> 	...
> }
> #else
> static void msm_pinctrl_setup_pm_reset(pctrl) {}
> #endif

Will put this in a single function which takes pctrl and address you
comments there in v3.
Thanks for review. :-)
> 
>> +#endif
> 
> Regards,
> Bjorn
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2014-08-29 13:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-29  3:22 [PATCH 0/4] Add reset support for apq8064 Pramod Gurav
2014-08-29  3:22 ` Pramod Gurav
2014-08-29  3:22 ` [PATCH 1/4] ARM: DT: APQ8064: Add pinctrl support Pramod Gurav
2014-08-29  3:22   ` Pramod Gurav
2014-08-29  3:22 ` [PATCH 2/4] ARM: DT: APQ8064: Add node for ps_hold function in pinctrl Pramod Gurav
2014-08-29  3:22   ` Pramod Gurav
2014-08-29  3:22 ` [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation Pramod Gurav
2014-08-29  3:22   ` Pramod Gurav
2014-08-29  3:22   ` Pramod Gurav
2014-08-29  0:32   ` Bjorn Andersson
2014-08-29  0:32     ` Bjorn Andersson
2014-08-29  3:22 ` [PATCH 4/4] pinctrl: qcom: Add support for reset for apq8064 Pramod Gurav
2014-08-29  3:22   ` Pramod Gurav
2014-08-29  3:22   ` Pramod Gurav
2014-08-29  1:28   ` Bjorn Andersson
2014-08-29  1:28     ` Bjorn Andersson
2014-08-29 13:32     ` Pramod Gurav
2014-08-29 13:32       ` Pramod Gurav
  -- strict thread matches above, loose matches on Subject: below --
2014-08-27  9:43 [PATCH 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation Pramod Gurav

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.