diff mbox

[3/3] pwm: ftm-pwm: Add big-endian support

Message ID 1395377590-23537-4-git-send-email-Li.Xiubo@freescale.com
State Rejected
Headers show

Commit Message

Xiubo Li March 21, 2014, 4:53 a.m. UTC
Now for the following scenarios:

     SoC     |  CPU   | FTM-PWM | 'big-endian' property is needed?
-------------|--------|---------|---------------------------------
    Vybird   |  LE    |   LE    |     No
     LS1     |  LE    |   BE    |     Yes
     LS2     |  LE    |   LE    |     No

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 drivers/pwm/pwm-fsl-ftm.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Thierry Reding April 28, 2014, 3:02 p.m. UTC | #1
On Fri, Mar 21, 2014 at 12:53:10PM +0800, Xiubo Li wrote:
> Now for the following scenarios:
> 
>      SoC     |  CPU   | FTM-PWM | 'big-endian' property is needed?
> -------------|--------|---------|---------------------------------
>     Vybird   |  LE    |   LE    |     No
>      LS1     |  LE    |   BE    |     Yes
>      LS2     |  LE    |   LE    |     No
> 
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
>  drivers/pwm/pwm-fsl-ftm.c | 6 ++++++
>  1 file changed, 6 insertions(+)

And this should probably describe in text what happens. The table may
look good, but you don't give a real description of what the change
does.

Oh, and doesn't this change need to update the device tree binding since
you now have an additional property?

Thierry
Xiubo Li April 28, 2014, 3:11 p.m. UTC | #2
> > Now for the following scenarios:
> >
> >      SoC     |  CPU   | FTM-PWM | 'big-endian' property is needed?
> > -------------|--------|---------|---------------------------------
> >     Vybird   |  LE    |   LE    |     No
> >     LS1     |  LE    |   BE    |     Yes
> >     LS2     |  LE    |   LE    |     No
> >
> > Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> > ---
> >  drivers/pwm/pwm-fsl-ftm.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> 
> And this should probably describe in text what happens. The table may
> look good, but you don't give a real description of what the change
> does.
> 

I will follow your advice.


> Oh, and doesn't this change need to update the device tree binding since
> you now have an additional property?
>

Yes, you are right. I just forgot it.

I will add update it.

Thanks very much.

BRs
XIubo

--
To unsubscribe from this list: send the line "unsubscribe linux-pwm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pwm/pwm-fsl-ftm.c b/drivers/pwm/pwm-fsl-ftm.c
index 5d999c1..9a82741 100644
--- a/drivers/pwm/pwm-fsl-ftm.c
+++ b/drivers/pwm/pwm-fsl-ftm.c
@@ -409,6 +409,7 @@  static struct regmap_config fsl_pwm_regmap_config = {
 
 static int fsl_pwm_probe(struct platform_device *pdev)
 {
+	struct device_node *np = pdev->dev.of_node;
 	struct fsl_pwm_chip *fpc;
 	struct resource *res;
 	void __iomem *base;
@@ -422,6 +423,11 @@  static int fsl_pwm_probe(struct platform_device *pdev)
 
 	fpc->chip.dev = &pdev->dev;
 
+	if (of_property_read_bool(np, "big-endian"))
+		fsl_pwm_regmap_config.val_format_endian = REGMAP_ENDIAN_BIG;
+	else
+		fsl_pwm_regmap_config.val_format_endian = REGMAP_ENDIAN_NATIVE;
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(base))