mx51: Add mx51 processor to the pwm driver
Subsystems (3)
PATCH 3/5 mx51: Add mx51 processor to the pwm driver
---
arch/arm/plat-mxc/pwm.c |? ? 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
arch/arm/plat-mxc/pwm.c +5 -3
@@ -26,7 +26,7 @@#define MX1_PWMP ? ? 0x08???/* PWM Period Register */ -/* i.MX27, i.MX31, i.MX35 share the same PWM function block: */ +/* i.MX25/27/31/35/51 share the same PWM function block: */ #define MX3_PWMCR ? ? ? ? ? ? ? ???0x00? ?/* PWM Control Register */ #define MX3_PWMSAR ? ? ? ? ? ? ? ? 0x0C? ?/* PWM Sample Register */
@@ -57,7 +57,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ??? if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) ??? ??? return -EINVAL; -??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { +??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) { ??? ??? unsigned long long c; ??? ??? unsigned long period_cycles, duty_cycles, prescale; ??? ??? u32 cr;
@@ -79,7 +79,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ??? ??? cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN; -??? ??? if (cpu_is_mx25()) +??? ??? if (cpu_is_mx25() || cpu_is_mx51()) ??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG; ??? ??? else ??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG_HIGH;
@@ -198,6 +198,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? if (IS_ERR(pwm->clk)) { ??? ??? ret = PTR_ERR(pwm->clk); +??? ??? dev_err(&pdev->dev, "can't get PWM clock\n"); ??? ??? goto err_free; ??? }
@@ -233,6 +234,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? mutex_unlock(&pwm_lock); ??? platform_set_drvdata(pdev, pwm); +??? dev_info(&pdev->dev, "i.MX PWM Driver Enabled\n"); ??? return 0; err_free_mem:
Signature · 1 line
1.6.0.4
PATCH 3/5 mx51: Add mx51 processor to the pwm driver
Quoted 10 lines · Fabio Estevam
Signed-off-by Fabio Estevam <[email protected]>---
arch/arm/plat-mxc/pwm.c|? ? 8 +++++---1 files changed, 5 insertions(+), 3 deletions(-)arch/arm/plat-mxc/pwm.c +0
-0
arch/arm/plat-mxc/pwm.c line 29
Quoted 5 lines
arch/arm/plat-mxc/pwm.c +1
-1@@ -26,7 +26,7 @@#define MX1_PWMP ? ? 0x08???/* PWM Period Register */ -/* i.MX27, i.MX31, i.MX35 share the same PWM function block: */ +/* i.MX25/27/31/35/51 share the same PWM function block: */
If this is correct, ...
Quoted 13 lines
arch/arm/plat-mxc/pwm.c +1
-1#define MX3_PWMCR ? ? ? ? ? ? ? ???0x00? ?/* PWM Control Register */ #define MX3_PWMSAR ? ? ? ? ? ? ? ? 0x0C? ?/* PWM Sample Register */ @@ -57,7 +57,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ??? if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) ??? ??? return -EINVAL; -??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { +??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) { ??? ??? unsigned long long c; ??? ??? unsigned long period_cycles, duty_cycles, prescale; ??? ??? u32 cr;
arch/arm/plat-mxc/pwm.c int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) · line 82
Quoted 5 lines
arch/arm/plat-mxc/pwm.c +1
-1@@ -79,7 +79,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ??? ??? cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN; -??? ??? if (cpu_is_mx25()) +??? ??? if (cpu_is_mx25() || cpu_is_mx51())
I wonder why mx27 and mx3 are missing here.
Quoted 12 lines
arch/arm/plat-mxc/pwm.c +1
-0??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG; ??? ??? else ??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG_HIGH;@@ -198,6 +198,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? if (IS_ERR(pwm->clk)) { ??? ??? ret = PTR_ERR(pwm->clk); +??? ??? dev_err(&pdev->dev, "can't get PWM clock\n"); ??? ??? goto err_free; ??? }
arch/arm/plat-mxc/pwm.c static int __devinit mxc_pwm_probe(struct platform_device *pdev) · line 240
Quoted 7 lines
arch/arm/plat-mxc/pwm.c +1
-0@@ -233,6 +234,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? mutex_unlock(&pwm_lock); ??? platform_set_drvdata(pdev, pwm); +??? dev_info(&pdev->dev, "i.MX PWM Driver Enabled\n"); ??? return 0; err_free_mem:
Some general comments for this driver:
- should move to drivers/something
- IMHO should use platform ids to get rid of the cpu_is_ stuff
(And BTW, you forgot to use --thread making your mails being spread in (at least my) lakml folder.)
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
Sascha Hauer
maintainerPATCH 3/5 mx51: Add mx51 processor to the pwm driver
Quoted 31 lines · Uwe Kleine-K?nig
Quoted 10 lines · Fabio Estevam
Signed-off-by Fabio Estevam <[email protected]>---
arch/arm/plat-mxc/pwm.c|? ? 8 +++++---1 files changed, 5 insertions(+), 3 deletions(-)arch/arm/plat-mxc/pwm.c +0
-0arch/arm/plat-mxc/pwm.c line 29
Quoted 5 lines
arch/arm/plat-mxc/pwm.c +1
-1@@ -26,7 +26,7 @@#define MX1_PWMP ? ? 0x08???/* PWM Period Register */ -/* i.MX27, i.MX31, i.MX35 share the same PWM function block: */ +/* i.MX25/27/31/35/51 share the same PWM function block: */ If this is correct, ...
Quoted 14 lines
arch/arm/plat-mxc/pwm.c +1
-1#define MX3_PWMCR ? ? ? ? ? ? ? ???0x00? ?/* PWM Control Register */ #define MX3_PWMSAR ? ? ? ? ? ? ? ? 0x0C? ?/* PWM Sample Register */ @@ -57,7 +57,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ??? if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) ??? ??? return -EINVAL; -??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { +??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) { ??? ??? unsigned long long c; ??? ??? unsigned long period_cycles, duty_cycles, prescale; ??? ??? u32 cr;@@ -79,7 +79,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
Quoted 5 lines
arch/arm/plat-mxc/pwm.c int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) · line 82
Quoted 4 lines
arch/arm/plat-mxc/pwm.c +1
-1??? ??? cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN; -??? ??? if (cpu_is_mx25()) +??? ??? if (cpu_is_mx25() || cpu_is_mx51())I wonder why mx27 and mx3 are missing here.
Look at the code. We are already inside a mx27/3/25 block and we have to do this only on mx25.
Quoted 19 lines
Quoted 19 lines
arch/arm/plat-mxc/pwm.c +2
-0??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG; ??? ??? else ??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG_HIGH;@@ -198,6 +198,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? if (IS_ERR(pwm->clk)) { ??? ??? ret = PTR_ERR(pwm->clk); +??? ??? dev_err(&pdev->dev, "can't get PWM clock\n"); ??? ??? goto err_free; ??? }@@ -233,6 +234,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? mutex_unlock(&pwm_lock); ??? platform_set_drvdata(pdev, pwm); +??? dev_info(&pdev->dev, "i.MX PWM Driver Enabled\n"); ??? return 0;
Quoted 5 lines
arch/arm/plat-mxc/pwm.c static int __devinit mxc_pwm_probe(struct platform_device *pdev) · line 240
Quoted 1 line
arch/arm/plat-mxc/pwm.c +0
-0err_free_mem:Some general comments for this driver:
- should move to
drivers/something
- IMHO should use platform ids to get rid of thecpu_is_stuff
Agreed, but this of course should be the scope of another patch.
Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH 3/5 mx51: Add mx51 processor to the pwm driver
Quoted 32 lines · Sascha Hauer
Quoted 31 lines · Uwe Kleine-K?nig
Quoted 10 lines · Fabio Estevam
Signed-off-by Fabio Estevam <[email protected]>---
arch/arm/plat-mxc/pwm.c|? ? 8 +++++---1 files changed, 5 insertions(+), 3 deletions(-)arch/arm/plat-mxc/pwm.c +0
-0arch/arm/plat-mxc/pwm.c line 29
Quoted 5 lines
arch/arm/plat-mxc/pwm.c +1
-1@@ -26,7 +26,7 @@#define MX1_PWMP ? ? 0x08???/* PWM Period Register */ -/* i.MX27, i.MX31, i.MX35 share the same PWM function block: */ +/* i.MX25/27/31/35/51 share the same PWM function block: */ If this is correct, ...
Quoted 14 lines
arch/arm/plat-mxc/pwm.c +1
-1#define MX3_PWMCR ? ? ? ? ? ? ? ???0x00? ?/* PWM Control Register */ #define MX3_PWMSAR ? ? ? ? ? ? ? ? 0x0C? ?/* PWM Sample Register */ @@ -57,7 +57,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ??? if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) ??? ??? return -EINVAL; -??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { +??? if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) { ??? ??? unsigned long long c; ??? ??? unsigned long period_cycles, duty_cycles, prescale; ??? ??? u32 cr;@@ -79,7 +79,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
Quoted 8 lines
Quoted 5 lines
arch/arm/plat-mxc/pwm.c int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) · line 82
Quoted 4 lines
arch/arm/plat-mxc/pwm.c +1
-1??? ??? cr = MX3_PWMCR_PRESCALER(prescale) | MX3_PWMCR_EN; -??? ??? if (cpu_is_mx25()) +??? ??? if (cpu_is_mx25() || cpu_is_mx51())I wonder why mx27 and mx3 are missing here.
Look at the code. We are already inside a mx27/3/25 block and we have to do this only on mx25.
My intention was to point out, that the statement above "i.MX25/27/31/35/51 share the same PWM function block" isn't correct.
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
arch/arm/plat-mxc/pwm.c +2
-0??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG; ??? ??? else ??? ??? ??? cr |= MX3_PWMCR_CLKSRC_IPG_HIGH;@@ -198,6 +198,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? if (IS_ERR(pwm->clk)) { ??? ??? ret = PTR_ERR(pwm->clk); +??? ??? dev_err(&pdev->dev, "can't get PWM clock\n"); ??? ??? goto err_free; ??? }@@ -233,6 +234,7 @@ static int __devinit mxc_pwm_probe(struct platform_device *pdev) ??? mutex_unlock(&pwm_lock); ??? platform_set_drvdata(pdev, pwm); +??? dev_info(&pdev->dev, "i.MX PWM Driver Enabled\n"); ??? return 0;
Quoted 7 lines
Quoted 5 lines
arch/arm/plat-mxc/pwm.c static int __devinit mxc_pwm_probe(struct platform_device *pdev) · line 240
Quoted 1 line
arch/arm/plat-mxc/pwm.c +0
-0err_free_mem:Some general comments for this driver:
- should move to
drivers/something
- IMHO should use platform ids to get rid of thecpu_is_stuffAgreed, but this of course should be the scope of another patch.
Ack, that's why I called it "general comments for this driver" :-)
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |