Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On Wed, Oct 24, 2012 at 07:51:37AM +0200, Thierry Reding wrote: > On Mon, Oct 22, 2012 at 04:36:41PM +0530, Shiraz Hashim wrote: > [...] > > +struct spear_pwm_chip { > > + void __iomem *mmio_base; > > + struct clk *clk; > > + struct pwm_chip chip; > > My editor shows a tab between pwm_chip and chip. This should really be a > space. > > > + ret = pwmchip_add(>chip); > > + if (ret < 0) { > > + dev_err(>dev, "pwmchip_add() failed: %d\n", ret); > > + return ret; > > + } > > + > > + ret = clk_prepare_enable(pc->clk); > > + if (ret < 0) > > + return pwmchip_remove(>chip); > > I think in order to fix the potential race condition that Viresh > mentioned we should move the clk_prepare_enable() before the > pwmchip_add(), but don't forget to disable and unprepare the clock if > pwmchip_add() fails. > > Actually, can't we make it a clk_prepare() only at this point and move > the clk_enable() and clk_disable() into the if block below? In case the > compatible value is not "st,spear1340-pwm" we don't need the clock > enabled. > > > + > > + if (of_device_is_compatible(np, "st,spear1340-pwm")) { > > + /* > > +* Following enables PWM chip, channels would still be > > +* enabled individually through their control register > > +*/ > > + val = readl_relaxed(pc->mmio_base + PWMMCR); > > + val |= PWMMCR_PWM_ENABLE; > > + writel_relaxed(val, pc->mmio_base + PWMMCR); > > + > > Oh, and a spurious newline here... =) > > > + } > > + > > + /* only disable the clk and leave it prepared */ > > + clk_disable(pc->clk); > > This can go into the if block to match the clk_enable(). All suggestions would be included in V5. I hope this would be the last one :). -- regards Shiraz -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On 24 October 2012 11:21, Thierry Reding wrote: > On Mon, Oct 22, 2012 at 04:36:41PM +0530, Shiraz Hashim wrote: >> + ret = pwmchip_add(>chip); >> + if (ret < 0) { >> + dev_err(>dev, "pwmchip_add() failed: %d\n", ret); >> + return ret; >> + } >> + >> + ret = clk_prepare_enable(pc->clk); >> + if (ret < 0) >> + return pwmchip_remove(>chip); > > I think in order to fix the potential race condition that Viresh > mentioned we should move the clk_prepare_enable() before the > pwmchip_add(), but don't forget to disable and unprepare the clock if > pwmchip_add() fails. > > Actually, can't we make it a clk_prepare() only at this point and move > the clk_enable() and clk_disable() into the if block below? In case the > compatible value is not "st,spear1340-pwm" we don't need the clock > enabled. We should. I should have given this comment earlier. -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On 24 October 2012 11:21, Thierry Reding thierry.red...@avionic-design.de wrote: On Mon, Oct 22, 2012 at 04:36:41PM +0530, Shiraz Hashim wrote: + ret = pwmchip_add(pc-chip); + if (ret 0) { + dev_err(pdev-dev, pwmchip_add() failed: %d\n, ret); + return ret; + } + + ret = clk_prepare_enable(pc-clk); + if (ret 0) + return pwmchip_remove(pc-chip); I think in order to fix the potential race condition that Viresh mentioned we should move the clk_prepare_enable() before the pwmchip_add(), but don't forget to disable and unprepare the clock if pwmchip_add() fails. Actually, can't we make it a clk_prepare() only at this point and move the clk_enable() and clk_disable() into the if block below? In case the compatible value is not st,spear1340-pwm we don't need the clock enabled. We should. I should have given this comment earlier. -- viresh -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On Wed, Oct 24, 2012 at 07:51:37AM +0200, Thierry Reding wrote: On Mon, Oct 22, 2012 at 04:36:41PM +0530, Shiraz Hashim wrote: [...] +struct spear_pwm_chip { + void __iomem *mmio_base; + struct clk *clk; + struct pwm_chip chip; My editor shows a tab between pwm_chip and chip. This should really be a space. + ret = pwmchip_add(pc-chip); + if (ret 0) { + dev_err(pdev-dev, pwmchip_add() failed: %d\n, ret); + return ret; + } + + ret = clk_prepare_enable(pc-clk); + if (ret 0) + return pwmchip_remove(pc-chip); I think in order to fix the potential race condition that Viresh mentioned we should move the clk_prepare_enable() before the pwmchip_add(), but don't forget to disable and unprepare the clock if pwmchip_add() fails. Actually, can't we make it a clk_prepare() only at this point and move the clk_enable() and clk_disable() into the if block below? In case the compatible value is not st,spear1340-pwm we don't need the clock enabled. + + if (of_device_is_compatible(np, st,spear1340-pwm)) { + /* +* Following enables PWM chip, channels would still be +* enabled individually through their control register +*/ + val = readl_relaxed(pc-mmio_base + PWMMCR); + val |= PWMMCR_PWM_ENABLE; + writel_relaxed(val, pc-mmio_base + PWMMCR); + Oh, and a spurious newline here... =) + } + + /* only disable the clk and leave it prepared */ + clk_disable(pc-clk); This can go into the if block to match the clk_enable(). All suggestions would be included in V5. I hope this would be the last one :). -- regards Shiraz -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On Mon, Oct 22, 2012 at 04:36:41PM +0530, Shiraz Hashim wrote: [...] > +struct spear_pwm_chip { > + void __iomem *mmio_base; > + struct clk *clk; > + struct pwm_chip chip; My editor shows a tab between pwm_chip and chip. This should really be a space. > + ret = pwmchip_add(>chip); > + if (ret < 0) { > + dev_err(>dev, "pwmchip_add() failed: %d\n", ret); > + return ret; > + } > + > + ret = clk_prepare_enable(pc->clk); > + if (ret < 0) > + return pwmchip_remove(>chip); I think in order to fix the potential race condition that Viresh mentioned we should move the clk_prepare_enable() before the pwmchip_add(), but don't forget to disable and unprepare the clock if pwmchip_add() fails. Actually, can't we make it a clk_prepare() only at this point and move the clk_enable() and clk_disable() into the if block below? In case the compatible value is not "st,spear1340-pwm" we don't need the clock enabled. > + > + if (of_device_is_compatible(np, "st,spear1340-pwm")) { > + /* > + * Following enables PWM chip, channels would still be > + * enabled individually through their control register > + */ > + val = readl_relaxed(pc->mmio_base + PWMMCR); > + val |= PWMMCR_PWM_ENABLE; > + writel_relaxed(val, pc->mmio_base + PWMMCR); > + Oh, and a spurious newline here... =) > + } > + > + /* only disable the clk and leave it prepared */ > + clk_disable(pc->clk); This can go into the if block to match the clk_enable(). Thierry pgpaMIyao45I9.pgp Description: PGP signature
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On Mon, Oct 22, 2012 at 07:25:45PM +0530, Viresh Kumar wrote: > On 22 October 2012 16:36, Shiraz Hashim wrote: > > Add support for PWM chips present on SPEAr platforms. These PWM > > chips support 4 channel output with programmable duty cycle and > > frequency. > > > > More details on these PWM chips can be obtained from relevant > > chapter of reference manual, present at following[1] location. > > > > 1. http://www.st.com/internet/mcu/product/251211.jsp > > > > Cc: Thierry Reding > > Signed-off-by: Shiraz Hashim > > Signed-off-by: Viresh Kumar > > Reviewed-by: Vipin Kumar > > Acked-by: Viresh Kumar > > > diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c > > +static int spear_pwm_probe(struct platform_device *pdev) > > +{ > > > + ret = pwmchip_add(>chip); > > + if (ret < 0) { > > + dev_err(>dev, "pwmchip_add() failed: %d\n", ret); > > + return ret; > > + } > > Sorry couldn't think of this complex situation earlier :( > > Can it happen that we get a request for a pwm here and its config or enable > gets called...? > > If yes, then we must call clk_prepare() before doing pwmchip_add?? Otherwise > you will see a crash :) > > @Thierry: Can this happen? Yeah, it's very unlikely to happen, but it could. See my reply to the patch. Thierry pgprkqPNAr0tc.pgp Description: PGP signature
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On Mon, Oct 22, 2012 at 07:25:45PM +0530, Viresh Kumar wrote: On 22 October 2012 16:36, Shiraz Hashim shiraz.has...@st.com wrote: Add support for PWM chips present on SPEAr platforms. These PWM chips support 4 channel output with programmable duty cycle and frequency. More details on these PWM chips can be obtained from relevant chapter of reference manual, present at following[1] location. 1. http://www.st.com/internet/mcu/product/251211.jsp Cc: Thierry Reding thierry.red...@avionic-design.de Signed-off-by: Shiraz Hashim shiraz.has...@st.com Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Reviewed-by: Vipin Kumar vipin.ku...@st.com Acked-by: Viresh Kumar viresh.ku...@linaro.org diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c +static int spear_pwm_probe(struct platform_device *pdev) +{ + ret = pwmchip_add(pc-chip); + if (ret 0) { + dev_err(pdev-dev, pwmchip_add() failed: %d\n, ret); + return ret; + } Sorry couldn't think of this complex situation earlier :( Can it happen that we get a request for a pwm here and its config or enable gets called...? If yes, then we must call clk_prepare() before doing pwmchip_add?? Otherwise you will see a crash :) @Thierry: Can this happen? Yeah, it's very unlikely to happen, but it could. See my reply to the patch. Thierry pgprkqPNAr0tc.pgp Description: PGP signature
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On Mon, Oct 22, 2012 at 04:36:41PM +0530, Shiraz Hashim wrote: [...] +struct spear_pwm_chip { + void __iomem *mmio_base; + struct clk *clk; + struct pwm_chip chip; My editor shows a tab between pwm_chip and chip. This should really be a space. + ret = pwmchip_add(pc-chip); + if (ret 0) { + dev_err(pdev-dev, pwmchip_add() failed: %d\n, ret); + return ret; + } + + ret = clk_prepare_enable(pc-clk); + if (ret 0) + return pwmchip_remove(pc-chip); I think in order to fix the potential race condition that Viresh mentioned we should move the clk_prepare_enable() before the pwmchip_add(), but don't forget to disable and unprepare the clock if pwmchip_add() fails. Actually, can't we make it a clk_prepare() only at this point and move the clk_enable() and clk_disable() into the if block below? In case the compatible value is not st,spear1340-pwm we don't need the clock enabled. + + if (of_device_is_compatible(np, st,spear1340-pwm)) { + /* + * Following enables PWM chip, channels would still be + * enabled individually through their control register + */ + val = readl_relaxed(pc-mmio_base + PWMMCR); + val |= PWMMCR_PWM_ENABLE; + writel_relaxed(val, pc-mmio_base + PWMMCR); + Oh, and a spurious newline here... =) + } + + /* only disable the clk and leave it prepared */ + clk_disable(pc-clk); This can go into the if block to match the clk_enable(). Thierry pgpaMIyao45I9.pgp Description: PGP signature
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On 22 October 2012 16:36, Shiraz Hashim wrote: > Add support for PWM chips present on SPEAr platforms. These PWM > chips support 4 channel output with programmable duty cycle and > frequency. > > More details on these PWM chips can be obtained from relevant > chapter of reference manual, present at following[1] location. > > 1. http://www.st.com/internet/mcu/product/251211.jsp > > Cc: Thierry Reding > Signed-off-by: Shiraz Hashim > Signed-off-by: Viresh Kumar > Reviewed-by: Vipin Kumar Acked-by: Viresh Kumar > diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c > +static int spear_pwm_probe(struct platform_device *pdev) > +{ > + ret = pwmchip_add(>chip); > + if (ret < 0) { > + dev_err(>dev, "pwmchip_add() failed: %d\n", ret); > + return ret; > + } Sorry couldn't think of this complex situation earlier :( Can it happen that we get a request for a pwm here and its config or enable gets called...? If yes, then we must call clk_prepare() before doing pwmchip_add?? Otherwise you will see a crash :) @Thierry: Can this happen? > + ret = clk_prepare_enable(pc->clk); > + if (ret < 0) > + return pwmchip_remove(>chip); -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH V4] PWM: Add SPEAr PWM chip driver support
Add support for PWM chips present on SPEAr platforms. These PWM chips support 4 channel output with programmable duty cycle and frequency. More details on these PWM chips can be obtained from relevant chapter of reference manual, present at following[1] location. 1. http://www.st.com/internet/mcu/product/251211.jsp Cc: Thierry Reding Signed-off-by: Shiraz Hashim Signed-off-by: Viresh Kumar Reviewed-by: Vipin Kumar --- Changes:- V3 --> V4: * simplify remove * maintain alphabetical order in Makefile * donot check for device node in probe * move few assignment lines in probe V2 --> V3: * remove "disabled" line from pwm dt binding documentation * remove un-necessary check on pwm chip (for NULL) in remove. V1 --> V2: * make proper reference to pwm and pwm chip * take care to capitalize PWM at appropriate places * fix compatible string to the SoC where pwm chip was introduced * Rename the documentation file to the name of driver * Fix cosmetic changes like names, function name alignment, paragraph formating, comments placement and formating, etc. * Group and associate the bit field definitions to their registers * Fix kerneldoc for structure definition * Use chip to name pwm device and pwm for the channel instance * Remove init section qualifiers * Remove ifdefs around device tree from code and add dependency on CONFIG_OF * prepare/unprepare clock once in probe/remove and just enable/disable at rest of the places. * Use _relaxed for readl/writel. * Fix pwm disable part in remove .../devicetree/bindings/pwm/spear-pwm.txt | 18 ++ drivers/pwm/Kconfig| 11 + drivers/pwm/Makefile |1 + drivers/pwm/pwm-spear.c| 273 4 files changed, 303 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/spear-pwm.txt create mode 100644 drivers/pwm/pwm-spear.c diff --git a/Documentation/devicetree/bindings/pwm/spear-pwm.txt b/Documentation/devicetree/bindings/pwm/spear-pwm.txt new file mode 100644 index 000..3ac779d --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/spear-pwm.txt @@ -0,0 +1,18 @@ +== ST SPEAr SoC PWM controller == + +Required properties: +- compatible: should be one of: + - "st,spear320-pwm" + - "st,spear1340-pwm" +- reg: physical base address and length of the controller's registers +- #pwm-cells: number of cells used to specify PWM which is fixed to 2 on + SPEAr. The first cell specifies the per-chip index of the PWM to use and + the second cell is the period in nanoseconds. + +Example: + +pwm: pwm@a800 { +compatible ="st,spear320-pwm"; +reg = <0xa800 0x1000>; +#pwm-cells = <2>; +}; diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index ed81720..6e556c7 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -112,6 +112,17 @@ config PWM_SAMSUNG To compile this driver as a module, choose M here: the module will be called pwm-samsung. +config PWM_SPEAR + tristate "STMicroelectronics SPEAr PWM support" + depends on PLAT_SPEAR + depends on OF + help + Generic PWM framework driver for the PWM controller on ST + SPEAr SoCs. + + To compile this driver as a module, choose M here: the module + will be called pwm-spear. + config PWM_TEGRA tristate "NVIDIA Tegra PWM support" depends on ARCH_TEGRA diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index acfe482..3b3f4c9a 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_PWM_MXS) += pwm-mxs.o obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o obj-$(CONFIG_PWM_PXA) += pwm-pxa.o obj-$(CONFIG_PWM_SAMSUNG) += pwm-samsung.o +obj-$(CONFIG_PWM_SPEAR)+= pwm-spear.o obj-$(CONFIG_PWM_TEGRA)+= pwm-tegra.o obj-$(CONFIG_PWM_TIECAP) += pwm-tiecap.o obj-$(CONFIG_PWM_TIEHRPWM) += pwm-tiehrpwm.o diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c new file mode 100644 index 000..35124a01 --- /dev/null +++ b/drivers/pwm/pwm-spear.c @@ -0,0 +1,273 @@ +/* + * ST Microelectronics SPEAr Pulse Width Modulator driver + * + * Copyright (C) 2012 ST Microelectronics + * Shiraz Hashim + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define NUM_PWM4 + +/* PWM registers and bits definitions */ +#define PWMCR 0x00/* Control Register */ +#define PWMCR_PWM_ENABLE 0x1 +#define PWMCR_PRESCALE_SHIFT 2 +#define PWMCR_MIN_PRESCALE 0x00 +#define
[PATCH V4] PWM: Add SPEAr PWM chip driver support
Add support for PWM chips present on SPEAr platforms. These PWM chips support 4 channel output with programmable duty cycle and frequency. More details on these PWM chips can be obtained from relevant chapter of reference manual, present at following[1] location. 1. http://www.st.com/internet/mcu/product/251211.jsp Cc: Thierry Reding thierry.red...@avionic-design.de Signed-off-by: Shiraz Hashim shiraz.has...@st.com Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Reviewed-by: Vipin Kumar vipin.ku...@st.com --- Changes:- V3 -- V4: * simplify remove * maintain alphabetical order in Makefile * donot check for device node in probe * move few assignment lines in probe V2 -- V3: * remove disabled line from pwm dt binding documentation * remove un-necessary check on pwm chip (for NULL) in remove. V1 -- V2: * make proper reference to pwm and pwm chip * take care to capitalize PWM at appropriate places * fix compatible string to the SoC where pwm chip was introduced * Rename the documentation file to the name of driver * Fix cosmetic changes like names, function name alignment, paragraph formating, comments placement and formating, etc. * Group and associate the bit field definitions to their registers * Fix kerneldoc for structure definition * Use chip to name pwm device and pwm for the channel instance * Remove init section qualifiers * Remove ifdefs around device tree from code and add dependency on CONFIG_OF * prepare/unprepare clock once in probe/remove and just enable/disable at rest of the places. * Use _relaxed for readl/writel. * Fix pwm disable part in remove .../devicetree/bindings/pwm/spear-pwm.txt | 18 ++ drivers/pwm/Kconfig| 11 + drivers/pwm/Makefile |1 + drivers/pwm/pwm-spear.c| 273 4 files changed, 303 insertions(+) create mode 100644 Documentation/devicetree/bindings/pwm/spear-pwm.txt create mode 100644 drivers/pwm/pwm-spear.c diff --git a/Documentation/devicetree/bindings/pwm/spear-pwm.txt b/Documentation/devicetree/bindings/pwm/spear-pwm.txt new file mode 100644 index 000..3ac779d --- /dev/null +++ b/Documentation/devicetree/bindings/pwm/spear-pwm.txt @@ -0,0 +1,18 @@ +== ST SPEAr SoC PWM controller == + +Required properties: +- compatible: should be one of: + - st,spear320-pwm + - st,spear1340-pwm +- reg: physical base address and length of the controller's registers +- #pwm-cells: number of cells used to specify PWM which is fixed to 2 on + SPEAr. The first cell specifies the per-chip index of the PWM to use and + the second cell is the period in nanoseconds. + +Example: + +pwm: pwm@a800 { +compatible =st,spear320-pwm; +reg = 0xa800 0x1000; +#pwm-cells = 2; +}; diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index ed81720..6e556c7 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -112,6 +112,17 @@ config PWM_SAMSUNG To compile this driver as a module, choose M here: the module will be called pwm-samsung. +config PWM_SPEAR + tristate STMicroelectronics SPEAr PWM support + depends on PLAT_SPEAR + depends on OF + help + Generic PWM framework driver for the PWM controller on ST + SPEAr SoCs. + + To compile this driver as a module, choose M here: the module + will be called pwm-spear. + config PWM_TEGRA tristate NVIDIA Tegra PWM support depends on ARCH_TEGRA diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index acfe482..3b3f4c9a 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_PWM_MXS) += pwm-mxs.o obj-$(CONFIG_PWM_PUV3) += pwm-puv3.o obj-$(CONFIG_PWM_PXA) += pwm-pxa.o obj-$(CONFIG_PWM_SAMSUNG) += pwm-samsung.o +obj-$(CONFIG_PWM_SPEAR)+= pwm-spear.o obj-$(CONFIG_PWM_TEGRA)+= pwm-tegra.o obj-$(CONFIG_PWM_TIECAP) += pwm-tiecap.o obj-$(CONFIG_PWM_TIEHRPWM) += pwm-tiehrpwm.o diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c new file mode 100644 index 000..35124a01 --- /dev/null +++ b/drivers/pwm/pwm-spear.c @@ -0,0 +1,273 @@ +/* + * ST Microelectronics SPEAr Pulse Width Modulator driver + * + * Copyright (C) 2012 ST Microelectronics + * Shiraz Hashim shiraz.has...@st.com + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed as is without any + * warranty of any kind, whether express or implied. + */ + +#include linux/clk.h +#include linux/err.h +#include linux/io.h +#include linux/ioport.h +#include linux/kernel.h +#include linux/math64.h +#include linux/module.h +#include linux/of.h +#include linux/platform_device.h +#include linux/pwm.h +#include linux/slab.h +#include linux/types.h + +#define NUM_PWM
Re: [PATCH V4] PWM: Add SPEAr PWM chip driver support
On 22 October 2012 16:36, Shiraz Hashim shiraz.has...@st.com wrote: Add support for PWM chips present on SPEAr platforms. These PWM chips support 4 channel output with programmable duty cycle and frequency. More details on these PWM chips can be obtained from relevant chapter of reference manual, present at following[1] location. 1. http://www.st.com/internet/mcu/product/251211.jsp Cc: Thierry Reding thierry.red...@avionic-design.de Signed-off-by: Shiraz Hashim shiraz.has...@st.com Signed-off-by: Viresh Kumar viresh.ku...@linaro.org Reviewed-by: Vipin Kumar vipin.ku...@st.com Acked-by: Viresh Kumar viresh.ku...@linaro.org diff --git a/drivers/pwm/pwm-spear.c b/drivers/pwm/pwm-spear.c +static int spear_pwm_probe(struct platform_device *pdev) +{ + ret = pwmchip_add(pc-chip); + if (ret 0) { + dev_err(pdev-dev, pwmchip_add() failed: %d\n, ret); + return ret; + } Sorry couldn't think of this complex situation earlier :( Can it happen that we get a request for a pwm here and its config or enable gets called...? If yes, then we must call clk_prepare() before doing pwmchip_add?? Otherwise you will see a crash :) @Thierry: Can this happen? + ret = clk_prepare_enable(pc-clk); + if (ret 0) + return pwmchip_remove(pc-chip); -- viresh -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/