* [PATCH v3 0/4] Add reset support for apq8064 @ 2014-08-29 14:30 Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 1/4] ARM: DT: APQ8064: Add pinctrl support Pramod Gurav ` (3 more replies) 0 siblings, 4 replies; 15+ messages in thread From: Pramod Gurav @ 2014-08-29 14:30 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. Changes since v2 to v3: 1. As per Bjorn's review suggestions consolidated all code which detects ps_hold function and initializes arm_pm_restart in a single function named msm_pinctrl_setup_pm_reset under #ifdef CONFIG_ARM 2. Removed 10 second delay after carrying out reset which was copied by mistake 3. Renamed pinctl DT node to tlmm_pinumux from msm_gpio Changes since v1 to v2: 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 | 30 ++++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 1/4] ARM: DT: APQ8064: Add pinctrl support 2014-08-29 14:30 [PATCH v3 0/4] Add reset support for apq8064 Pramod Gurav @ 2014-08-29 14:30 ` Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 2/4] ARM: DT: APQ8064: Add node for ps_hold function in pinctrl Pramod Gurav ` (2 subsequent siblings) 3 siblings, 0 replies; 15+ messages in thread From: Pramod Gurav @ 2014-08-29 14:30 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"; + tlmm_pinmux: 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] 15+ messages in thread
* [PATCH v3 2/4] ARM: DT: APQ8064: Add node for ps_hold function in pinctrl 2014-08-29 14:30 [PATCH v3 0/4] Add reset support for apq8064 Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 1/4] ARM: DT: APQ8064: Add pinctrl support Pramod Gurav @ 2014-08-29 14:30 ` Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 Pramod Gurav 3 siblings, 0 replies; 15+ messages in thread From: Pramod Gurav @ 2014-08-29 14:30 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] 15+ messages in thread
* [PATCH v3 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation 2014-08-29 14:30 [PATCH v3 0/4] Add reset support for apq8064 Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 1/4] ARM: DT: APQ8064: Add pinctrl support Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 2/4] ARM: DT: APQ8064: Add node for ps_hold function in pinctrl Pramod Gurav @ 2014-08-29 14:30 ` Pramod Gurav 2014-09-02 12:31 ` Linus Walleij 2014-08-29 14:30 ` [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 Pramod Gurav 3 siblings, 1 reply; 15+ messages in thread From: Pramod Gurav @ 2014-08-29 14:30 UTC (permalink / raw) To: linux-kernel, linux-arm-msm, linux-arm-kernel Cc: Pramod Gurav, Linus Walleij, 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> Acked-by: 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] 15+ messages in thread
* Re: [PATCH v3 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation 2014-08-29 14:30 ` [PATCH v3 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation Pramod Gurav @ 2014-09-02 12:31 ` Linus Walleij 0 siblings, 0 replies; 15+ messages in thread From: Linus Walleij @ 2014-09-02 12:31 UTC (permalink / raw) To: Pramod Gurav Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Ivan T. Ivanov, Stephen Boyd, Andy Gross On Fri, Aug 29, 2014 at 4:30 PM, Pramod Gurav <pramod.gurav@smartplayin.com> 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> > Acked-by: 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> Patch applied. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2014-08-29 14:30 [PATCH v3 0/4] Add reset support for apq8064 Pramod Gurav ` (2 preceding siblings ...) 2014-08-29 14:30 ` [PATCH v3 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation Pramod Gurav @ 2014-08-29 14:30 ` Pramod Gurav 2014-08-29 18:42 ` Bjorn Andersson ` (2 more replies) 3 siblings, 3 replies; 15+ messages in thread From: Pramod Gurav @ 2014-08-29 14:30 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 | 30 ++++++++++++++++++++++++++++++ 2 files changed, 36 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 9175bbc..80a64ca 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,15 @@ #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 /** * struct msm_pinctrl - state for a pinctrl-msm device @@ -850,6 +854,30 @@ static int msm_gpio_init(struct msm_pinctrl *pctrl) return 0; } +#ifdef CONFIG_ARM +static void __iomem *msm_ps_hold; + +static void msm_reset(enum reboot_mode reboot_mode, const char *cmd) +{ + writel(0, msm_ps_hold); + mdelay(10000); +} + +static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) +{ + int i = 0; + const struct msm_function *func = pctrl->soc->functions; + + for (; i <= pctrl->soc->nfunctions; i++) + if (!strcmp(func[i].name, "ps_hold")) { + msm_ps_hold = pctrl->regs + PS_HOLD_OFFSET; + arm_pm_restart = msm_reset; + } +} +#else +static void msm_pinctrl_setup_pm_reset(const struct msm_pinctrl *pctrl) {} +#endif + int msm_pinctrl_probe(struct platform_device *pdev, const struct msm_pinctrl_soc_data *soc_data) { @@ -873,6 +901,8 @@ int msm_pinctrl_probe(struct platform_device *pdev, if (IS_ERR(pctrl->regs)) return PTR_ERR(pctrl->regs); + msm_pinctrl_setup_pm_reset(pctrl); + 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] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2014-08-29 14:30 ` [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 Pramod Gurav @ 2014-08-29 18:42 ` Bjorn Andersson 2014-08-30 5:08 ` Pramod Gurav 2014-09-02 12:36 ` Linus Walleij 2015-01-14 23:38 ` Timur Tabi 2 siblings, 1 reply; 15+ messages in thread From: Bjorn Andersson @ 2014-08-29 18:42 UTC (permalink / raw) To: Pramod Gurav Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Linus Walleij, Ivan T. Ivanov, Stephen Boyd, Andy Gross On Fri 29 Aug 07:30 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> Thanks for the rework, that was fast :) Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2014-08-29 18:42 ` Bjorn Andersson @ 2014-08-30 5:08 ` Pramod Gurav 0 siblings, 0 replies; 15+ messages in thread From: Pramod Gurav @ 2014-08-30 5:08 UTC (permalink / raw) To: Bjorn Andersson Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Linus Walleij, Ivan T. Ivanov, Stephen Boyd, Andy Gross Bjorn, Thanks for review. :) On 30-08-2014 12:12 AM, Bjorn Andersson wrote: > On Fri 29 Aug 07:30 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> > > Thanks for the rework, that was fast :) > > Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2014-08-29 14:30 ` [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 Pramod Gurav 2014-08-29 18:42 ` Bjorn Andersson @ 2014-09-02 12:36 ` Linus Walleij 2014-09-02 17:06 ` Bjorn Andersson 2015-01-14 23:38 ` Timur Tabi 2 siblings, 1 reply; 15+ messages in thread From: Linus Walleij @ 2014-09-02 12:36 UTC (permalink / raw) To: Pramod Gurav Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Bjorn Andersson, Ivan T. Ivanov, Stephen Boyd, Andy Gross On Fri, Aug 29, 2014 at 4:30 PM, Pramod Gurav <pramod.gurav@smartplayin.com> 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> OK patch applied with Björn's ACK. A bit dirty to have this in this driver, but who cares. Does the APQ8064 accompanying PMIC also have the ability to completely shut the system down? Yours, Linus Walleij ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2014-09-02 12:36 ` Linus Walleij @ 2014-09-02 17:06 ` Bjorn Andersson 0 siblings, 0 replies; 15+ messages in thread From: Bjorn Andersson @ 2014-09-02 17:06 UTC (permalink / raw) To: Linus Walleij Cc: Pramod Gurav, linux-kernel, linux-arm-msm, linux-arm-kernel, Ivan T. Ivanov, Stephen Boyd, Andy Gross On Tue 02 Sep 05:36 PDT 2014, Linus Walleij wrote: > A bit dirty to have this in this driver, but who cares. > Indeed, but we figured the taint was small enough to justify not creating cross-references to a separate driver. > Does the APQ8064 accompanying PMIC also have the ability to > completely shut the system down? > Upon flipping pshold the PMIC will perform either a reset or a shutdown of the system. Per Stephen's suggestion we can hook the control of this up with a reboot_notifier in a pmic driver, hence saving ourselves of a reference to (or from) the PMIC here. Regards, Bjorn ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2014-08-29 14:30 ` [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 Pramod Gurav 2014-08-29 18:42 ` Bjorn Andersson 2014-09-02 12:36 ` Linus Walleij @ 2015-01-14 23:38 ` Timur Tabi 2015-01-14 23:44 ` Stephen Boyd 2 siblings, 1 reply; 15+ messages in thread From: Timur Tabi @ 2015-01-14 23:38 UTC (permalink / raw) To: Pramod Gurav Cc: lkml, linux-arm-msm, linux-arm-kernel, Linus Walleij, Bjorn Andersson, Stephen Boyd, Ivan T. Ivanov, Andy Gross On Fri, Aug 29, 2014 at 9:30 AM, Pramod Gurav <pramod.gurav@smartplayin.com> wrote: > > +static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) > +{ > + int i = 0; > + const struct msm_function *func = pctrl->soc->functions; > + > + for (; i <= pctrl->soc->nfunctions; i++) Shouldn't this be i < pctrl->soc->nfunctions As it stands, if nfunctions == 0, this function crashes. -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2015-01-14 23:38 ` Timur Tabi @ 2015-01-14 23:44 ` Stephen Boyd 2015-01-14 23:54 ` Timur Tabi 0 siblings, 1 reply; 15+ messages in thread From: Stephen Boyd @ 2015-01-14 23:44 UTC (permalink / raw) To: Timur Tabi, Pramod Gurav Cc: lkml, linux-arm-msm, linux-arm-kernel, Linus Walleij, Bjorn Andersson, Ivan T. Ivanov, Andy Gross On 01/14/2015 03:38 PM, Timur Tabi wrote: > On Fri, Aug 29, 2014 at 9:30 AM, Pramod Gurav > <pramod.gurav@smartplayin.com> wrote: >> +static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) >> +{ >> + int i = 0; >> + const struct msm_function *func = pctrl->soc->functions; >> + >> + for (; i <= pctrl->soc->nfunctions; i++) > Shouldn't this be > > i < pctrl->soc->nfunctions > > As it stands, if nfunctions == 0, this function crashes. > I think so. Can you send a patch? Plus it would be nice to move i = 0 in the for loop at the same time. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2015-01-14 23:44 ` Stephen Boyd @ 2015-01-14 23:54 ` Timur Tabi 2015-01-15 0:23 ` Stephen Boyd 0 siblings, 1 reply; 15+ messages in thread From: Timur Tabi @ 2015-01-14 23:54 UTC (permalink / raw) To: Stephen Boyd Cc: Timur Tabi, Pramod Gurav, Bjorn Andersson, linux-arm-msm, Linus Walleij, lkml, Ivan T. Ivanov, Andy Gross, linux-arm-kernel On Wed, Jan 14, 2015 at 5:44 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: > > I think so. Can you send a patch? Plus it would be nice to move i = 0 in > the for loop at the same time. Sadly, Qualcomm policy makes that very cumbersome for me. I won't be able to send a patch any time soon. -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2015-01-14 23:54 ` Timur Tabi @ 2015-01-15 0:23 ` Stephen Boyd 2015-01-19 10:18 ` Linus Walleij 0 siblings, 1 reply; 15+ messages in thread From: Stephen Boyd @ 2015-01-15 0:23 UTC (permalink / raw) To: Timur Tabi Cc: Pramod Gurav, Bjorn Andersson, linux-arm-msm, Linus Walleij, lkml, Ivan T. Ivanov, Andy Gross, linux-arm-kernel On 01/14/2015 03:54 PM, Timur Tabi wrote: > On Wed, Jan 14, 2015 at 5:44 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: >> I think so. Can you send a patch? Plus it would be nice to move i = 0 in >> the for loop at the same time. > Sadly, Qualcomm policy makes that very cumbersome for me. I won't be > able to send a patch any time soon. > Hm... we'll have to figure out that part. Anyway here's the patch. ---8<---- From: Stephen Boyd <sboyd@codeaurora.org> Subject: [PATCH] pinctrl: qcom: Don't iterate past end of function array Timur reports that this code crashes if nfunctions is 0. Fix the loop iteration to only consider valid elements of the functions array. Reported-by: Timur Tabi <timur@codeaurora.org> Cc: Pramod Gurav <pramod.gurav@smartplayin.com> Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com> Cc: Ivan T. Ivanov <iivanov@mm-sol.com> Cc: Andy Gross <agross@codeaurora.org> Fixes: 327455817a92 "pinctrl: qcom: Add support for reset for apq8064" Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> --- drivers/pinctrl/qcom/pinctrl-msm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c index e730935fa457..ed7017df065d 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -865,10 +865,10 @@ static int msm_ps_hold_restart(struct notifier_block *nb, unsigned long action, static void msm_pinctrl_setup_pm_reset(struct msm_pinctrl *pctrl) { - int i = 0; + int i; const struct msm_function *func = pctrl->soc->functions; - for (; i <= pctrl->soc->nfunctions; i++) + for (i = 0; i < pctrl->soc->nfunctions; i++) if (!strcmp(func[i].name, "ps_hold")) { pctrl->restart_nb.notifier_call = msm_ps_hold_restart; pctrl->restart_nb.priority = 128; -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 2015-01-15 0:23 ` Stephen Boyd @ 2015-01-19 10:18 ` Linus Walleij 0 siblings, 0 replies; 15+ messages in thread From: Linus Walleij @ 2015-01-19 10:18 UTC (permalink / raw) To: Stephen Boyd Cc: Timur Tabi, Pramod Gurav, Bjorn Andersson, linux-arm-msm, lkml, Ivan T. Ivanov, Andy Gross, linux-arm-kernel On Thu, Jan 15, 2015 at 1:23 AM, Stephen Boyd <sboyd@codeaurora.org> wrote: > On 01/14/2015 03:54 PM, Timur Tabi wrote: >> On Wed, Jan 14, 2015 at 5:44 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: >>> I think so. Can you send a patch? Plus it would be nice to move i = 0 in >>> the for loop at the same time. >> Sadly, Qualcomm policy makes that very cumbersome for me. I won't be >> able to send a patch any time soon. >> > > Hm... we'll have to figure out that part. Anyway here's the patch. > > ---8<---- > From: Stephen Boyd <sboyd@codeaurora.org> > Subject: [PATCH] pinctrl: qcom: Don't iterate past end of function array > > Timur reports that this code crashes if nfunctions is 0. Fix the > loop iteration to only consider valid elements of the functions > array. > > Reported-by: Timur Tabi <timur@codeaurora.org> > Cc: Pramod Gurav <pramod.gurav@smartplayin.com> > Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com> > Cc: Ivan T. Ivanov <iivanov@mm-sol.com> > Cc: Andy Gross <agross@codeaurora.org> > Fixes: 327455817a92 "pinctrl: qcom: Add support for reset for apq8064" > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> This patch applied for fixes. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2015-01-19 10:18 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-08-29 14:30 [PATCH v3 0/4] Add reset support for apq8064 Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 1/4] ARM: DT: APQ8064: Add pinctrl support Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 2/4] ARM: DT: APQ8064: Add node for ps_hold function in pinctrl Pramod Gurav 2014-08-29 14:30 ` [PATCH v3 3/4] pinctrl: msm: Add ps_hold function in pinctrl-apq8064 binding documentation Pramod Gurav 2014-09-02 12:31 ` Linus Walleij 2014-08-29 14:30 ` [PATCH v3 4/4] pinctrl: qcom: Add support for reset for apq8064 Pramod Gurav 2014-08-29 18:42 ` Bjorn Andersson 2014-08-30 5:08 ` Pramod Gurav 2014-09-02 12:36 ` Linus Walleij 2014-09-02 17:06 ` Bjorn Andersson 2015-01-14 23:38 ` Timur Tabi 2015-01-14 23:44 ` Stephen Boyd 2015-01-14 23:54 ` Timur Tabi 2015-01-15 0:23 ` Stephen Boyd 2015-01-19 10:18 ` Linus Walleij
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).