diff mbox

[2/3] pwm: sunxi: Add A64 support

Message ID 20170225074216.64868-2-icenowy@aosc.xyz (mailing list archive)
State New, archived
Headers show

Commit Message

Icenowy Zheng Feb. 25, 2017, 7:42 a.m. UTC
A64 PWM controller has same register layout as sun4i driver, so it works
by adding A64 specific data.

Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
 drivers/pwm/pwm-sun4i.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Chen-Yu Tsai Feb. 25, 2017, 8:53 a.m. UTC | #1
On Sat, Feb 25, 2017 at 3:42 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> A64 PWM controller has same register layout as sun4i driver, so it works
> by adding A64 specific data.
>
> Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> ---
>  drivers/pwm/pwm-sun4i.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> index 1284ffa05921..ca3431e03fb8 100644
> --- a/drivers/pwm/pwm-sun4i.c
> +++ b/drivers/pwm/pwm-sun4i.c
> @@ -290,6 +290,12 @@ static const struct sun4i_pwm_data sun4i_pwm_data_h3 = {
>         .npwm = 1,
>  };
>
> +static const struct sun4i_pwm_data sun4i_pwm_data_a64 = {
> +       .has_prescaler_bypass = true,
> +       .has_rdy = true,
> +       .npwm = 1,
> +};
> +

This seems to be tha same as the H3. Any differences between the
H3 and A64? Otherwise please just use that compatible.

ChenYu

>  static const struct of_device_id sun4i_pwm_dt_ids[] = {
>         {
>                 .compatible = "allwinner,sun4i-a10-pwm",
> @@ -307,6 +313,9 @@ static const struct of_device_id sun4i_pwm_dt_ids[] = {
>                 .compatible = "allwinner,sun8i-h3-pwm",
>                 .data = &sun4i_pwm_data_h3,
>         }, {
> +               .compatible = "allwinner,sun50i-a64-pwm",
> +               .data = &sun4i_pwm_data_a64,
> +       }, {
>                 /* sentinel */
>         },
>  };
> --
> 2.11.1
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Icenowy Zheng Feb. 25, 2017, 9:23 a.m. UTC | #2
25.02.2017, 16:53, "Chen-Yu Tsai" <wens@csie.org>:
> On Sat, Feb 25, 2017 at 3:42 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
>>  A64 PWM controller has same register layout as sun4i driver, so it works
>>  by adding A64 specific data.
>>
>>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
>>  ---
>>   drivers/pwm/pwm-sun4i.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>>  diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
>>  index 1284ffa05921..ca3431e03fb8 100644
>>  --- a/drivers/pwm/pwm-sun4i.c
>>  +++ b/drivers/pwm/pwm-sun4i.c
>>  @@ -290,6 +290,12 @@ static const struct sun4i_pwm_data sun4i_pwm_data_h3 = {
>>          .npwm = 1,
>>   };
>>
>>  +static const struct sun4i_pwm_data sun4i_pwm_data_a64 = {
>>  + .has_prescaler_bypass = true,
>>  + .has_rdy = true,
>>  + .npwm = 1,
>>  +};
>>  +
>
> This seems to be tha same as the H3. Any differences between the
> H3 and A64? Otherwise please just use that compatible.

H3 is also same as A13...

See http://lists.infradead.org/pipermail/linux-arm-kernel/2017-February/486595.html

>
> ChenYu
>
>>   static const struct of_device_id sun4i_pwm_dt_ids[] = {
>>          {
>>                  .compatible = "allwinner,sun4i-a10-pwm",
>>  @@ -307,6 +313,9 @@ static const struct of_device_id sun4i_pwm_dt_ids[] = {
>>                  .compatible = "allwinner,sun8i-h3-pwm",
>>                  .data = &sun4i_pwm_data_h3,
>>          }, {
>>  + .compatible = "allwinner,sun50i-a64-pwm",
>>  + .data = &sun4i_pwm_data_a64,
>>  + }, {
>>                  /* sentinel */
>>          },
>>   };
>>  --
>>  2.11.1
>>
>>  --
>>  You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
>>  To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
>>  For more options, visit https://groups.google.com/d/optout.
Maxime Ripard Feb. 27, 2017, 7:44 a.m. UTC | #3
On Sat, Feb 25, 2017 at 05:23:09PM +0800, Icenowy Zheng wrote:
> 
> 
> 25.02.2017, 16:53, "Chen-Yu Tsai" <wens@csie.org>:
> > On Sat, Feb 25, 2017 at 3:42 PM, Icenowy Zheng <icenowy@aosc.xyz> wrote:
> >>  A64 PWM controller has same register layout as sun4i driver, so it works
> >>  by adding A64 specific data.
> >>
> >>  Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
> >>  ---
> >>   drivers/pwm/pwm-sun4i.c | 9 +++++++++
> >>   1 file changed, 9 insertions(+)
> >>
> >>  diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
> >>  index 1284ffa05921..ca3431e03fb8 100644
> >>  --- a/drivers/pwm/pwm-sun4i.c
> >>  +++ b/drivers/pwm/pwm-sun4i.c
> >>  @@ -290,6 +290,12 @@ static const struct sun4i_pwm_data sun4i_pwm_data_h3 = {
> >>          .npwm = 1,
> >>   };
> >>
> >>  +static const struct sun4i_pwm_data sun4i_pwm_data_a64 = {
> >>  + .has_prescaler_bypass = true,
> >>  + .has_rdy = true,
> >>  + .npwm = 1,
> >>  +};
> >>  +
> >
> > This seems to be tha same as the H3. Any differences between the
> > H3 and A64? Otherwise please just use that compatible.
> 
> H3 is also same as A13...
> 
> See http://lists.infradead.org/pipermail/linux-arm-kernel/2017-February/486595.html

What I meant was that you should have a compatible in your DT like this:

compatible = "allwinner,sun50i-a64-pwm", "allwinner,sun5i-a13-pwm".

There's no need to add a new one in the driver (for now).

And you still haven't fixed the size.

Maxime
diff mbox

Patch

diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
index 1284ffa05921..ca3431e03fb8 100644
--- a/drivers/pwm/pwm-sun4i.c
+++ b/drivers/pwm/pwm-sun4i.c
@@ -290,6 +290,12 @@  static const struct sun4i_pwm_data sun4i_pwm_data_h3 = {
 	.npwm = 1,
 };
 
+static const struct sun4i_pwm_data sun4i_pwm_data_a64 = {
+	.has_prescaler_bypass = true,
+	.has_rdy = true,
+	.npwm = 1,
+};
+
 static const struct of_device_id sun4i_pwm_dt_ids[] = {
 	{
 		.compatible = "allwinner,sun4i-a10-pwm",
@@ -307,6 +313,9 @@  static const struct of_device_id sun4i_pwm_dt_ids[] = {
 		.compatible = "allwinner,sun8i-h3-pwm",
 		.data = &sun4i_pwm_data_h3,
 	}, {
+		.compatible = "allwinner,sun50i-a64-pwm",
+		.data = &sun4i_pwm_data_a64,
+	}, {
 		/* sentinel */
 	},
 };