linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN Controller
       [not found]   ` <20220702164018.ztizq3ftto4lsabr@pengutronix.de>
@ 2022-07-03  7:15     ` Biju Das
  2022-07-03  8:14       ` Uwe Kleine-König
  0 siblings, 1 reply; 3+ messages in thread
From: Biju Das @ 2022-07-03  7:15 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wolfgang Grandegger, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-can, netdev,
	Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc,
	ukl, linux-clk, linux-kernel

Hi Marc and Uwe,

> Subject: Re: [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN
> Controller
> 
> On 02.07.2022 15:01:30, Biju Das wrote:
> > The SJA1000 CAN controller on RZ/N1 SoC has some differences compared
> > to others like it has no clock divider register (CDR) support and it
> > has no HW loopback(HW doesn't see tx messages on rx).
> >
> > This patch adds support for RZ/N1 SJA1000 CAN Controller.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/net/can/sja1000/sja1000_platform.c | 34
> > ++++++++++++++++++----
> >  1 file changed, 29 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/net/can/sja1000/sja1000_platform.c
> > b/drivers/net/can/sja1000/sja1000_platform.c
> > index 5f3d362e0da5..8e63af76a013 100644
> > --- a/drivers/net/can/sja1000/sja1000_platform.c
> > +++ b/drivers/net/can/sja1000/sja1000_platform.c
> [...]
> > @@ -262,6 +276,16 @@ static int sp_probe(struct platform_device *pdev)
> >  	priv->reg_base = addr;
> >
> >  	if (of) {
> > +		clk = devm_clk_get_optional(&pdev->dev, "can_clk");
> > +		if (IS_ERR(clk))
> > +			return dev_err_probe(&pdev->dev, PTR_ERR(clk), "no CAN
> clk");
> > +
> > +		if (clk) {
> > +			priv->can.clock.freq  = clk_get_rate(clk) / 2;
> > +			if (!priv->can.clock.freq)
> > +				return dev_err_probe(&pdev->dev, -EINVAL, "Zero
> CAN clk rate");
> > +		}
> 
> There's no clk_prepare_enable in the driver. You might go the quick and
> dirty way an enable the clock right here. IIRC there's a new convenience
> function to get and enable a clock, managed bei devm. Uwe (Cc'ed) can
> point you in the right direction.

 + clk

As per the patch history devm version for clk_prepare_enable is rejected[1], so the individual drivers implemented the same using devm_add_action_or_reset [2].
So shall I implement devm version here as well?

[1]https://lkml.iu.edu/hypermail/linux/kernel/2103.1/01556.html

[2] https://elixir.bootlin.com/linux/v5.19-rc4/source/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c#L266

Cheers,
Biju

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN Controller
  2022-07-03  7:15     ` [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN Controller Biju Das
@ 2022-07-03  8:14       ` Uwe Kleine-König
  2022-07-03 10:08         ` Biju Das
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2022-07-03  8:14 UTC (permalink / raw)
  To: Biju Das
  Cc: Marc Kleine-Budde, Wolfgang Grandegger, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-can, netdev,
	Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc,
	linux-clk, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2454 bytes --]

On Sun, Jul 03, 2022 at 07:15:16AM +0000, Biju Das wrote:
> Hi Marc and Uwe,
> 
> > Subject: Re: [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN
> > Controller
> > 
> > On 02.07.2022 15:01:30, Biju Das wrote:
> > > The SJA1000 CAN controller on RZ/N1 SoC has some differences compared
> > > to others like it has no clock divider register (CDR) support and it
> > > has no HW loopback(HW doesn't see tx messages on rx).
> > >
> > > This patch adds support for RZ/N1 SJA1000 CAN Controller.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > >  drivers/net/can/sja1000/sja1000_platform.c | 34
> > > ++++++++++++++++++----
> > >  1 file changed, 29 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/net/can/sja1000/sja1000_platform.c
> > > b/drivers/net/can/sja1000/sja1000_platform.c
> > > index 5f3d362e0da5..8e63af76a013 100644
> > > --- a/drivers/net/can/sja1000/sja1000_platform.c
> > > +++ b/drivers/net/can/sja1000/sja1000_platform.c
> > [...]
> > > @@ -262,6 +276,16 @@ static int sp_probe(struct platform_device *pdev)
> > >  	priv->reg_base = addr;
> > >
> > >  	if (of) {
> > > +		clk = devm_clk_get_optional(&pdev->dev, "can_clk");
> > > +		if (IS_ERR(clk))
> > > +			return dev_err_probe(&pdev->dev, PTR_ERR(clk), "no CAN
> > clk");
> > > +
> > > +		if (clk) {
> > > +			priv->can.clock.freq  = clk_get_rate(clk) / 2;
> > > +			if (!priv->can.clock.freq)
> > > +				return dev_err_probe(&pdev->dev, -EINVAL, "Zero
> > CAN clk rate");
> > > +		}
> > 
> > There's no clk_prepare_enable in the driver. You might go the quick and
> > dirty way an enable the clock right here. IIRC there's a new convenience
> > function to get and enable a clock, managed bei devm. Uwe (Cc'ed) can
> > point you in the right direction.
> 
>  + clk
> 
> As per the patch history devm version for clk_prepare_enable is rejected[1], so the individual drivers implemented the same using devm_add_action_or_reset [2].
> So shall I implement devm version here as well?

You want to make use of 7ef9651e9792b08eb310c6beb202cbc947f43cab (which
is currently in next). If you cherry-pick this to an older kernel
version, make sure to also pick
8b3d743fc9e2542822826890b482afabf0e7522a.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN Controller
  2022-07-03  8:14       ` Uwe Kleine-König
@ 2022-07-03 10:08         ` Biju Das
  0 siblings, 0 replies; 3+ messages in thread
From: Biju Das @ 2022-07-03 10:08 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Marc Kleine-Budde, Wolfgang Grandegger, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, linux-can, netdev,
	Geert Uytterhoeven, Chris Paterson, Biju Das, linux-renesas-soc,
	linux-clk, linux-kernel

Hi Uwe,

Thanks for the feedback.

> Subject: Re: [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN
> Controller
> 
> On Sun, Jul 03, 2022 at 07:15:16AM +0000, Biju Das wrote:
> > Hi Marc and Uwe,
> >
> > > Subject: Re: [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000
> > > CAN Controller
> > >
> > > On 02.07.2022 15:01:30, Biju Das wrote:
> > > > The SJA1000 CAN controller on RZ/N1 SoC has some differences
> > > > compared to others like it has no clock divider register (CDR)
> > > > support and it has no HW loopback(HW doesn't see tx messages on
> rx).
> > > >
> > > > This patch adds support for RZ/N1 SJA1000 CAN Controller.
> > > >
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > ---
> > > >  drivers/net/can/sja1000/sja1000_platform.c | 34
> > > > ++++++++++++++++++----
> > > >  1 file changed, 29 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/net/can/sja1000/sja1000_platform.c
> > > > b/drivers/net/can/sja1000/sja1000_platform.c
> > > > index 5f3d362e0da5..8e63af76a013 100644
> > > > --- a/drivers/net/can/sja1000/sja1000_platform.c
> > > > +++ b/drivers/net/can/sja1000/sja1000_platform.c
> > > [...]
> > > > @@ -262,6 +276,16 @@ static int sp_probe(struct platform_device
> *pdev)
> > > >  	priv->reg_base = addr;
> > > >
> > > >  	if (of) {
> > > > +		clk = devm_clk_get_optional(&pdev->dev, "can_clk");
> > > > +		if (IS_ERR(clk))
> > > > +			return dev_err_probe(&pdev->dev, PTR_ERR(clk),
> "no CAN
> > > clk");
> > > > +
> > > > +		if (clk) {
> > > > +			priv->can.clock.freq  = clk_get_rate(clk) / 2;
> > > > +			if (!priv->can.clock.freq)
> > > > +				return dev_err_probe(&pdev->dev, -EINVAL,
> "Zero
> > > CAN clk rate");
> > > > +		}
> > >
> > > There's no clk_prepare_enable in the driver. You might go the quick
> > > and dirty way an enable the clock right here. IIRC there's a new
> > > convenience function to get and enable a clock, managed bei devm.
> > > Uwe (Cc'ed) can point you in the right direction.
> >
> >  + clk
> >
> > As per the patch history devm version for clk_prepare_enable is
> rejected[1], so the individual drivers implemented the same using
> devm_add_action_or_reset [2].
> > So shall I implement devm version here as well?
> 
> You want to make use of 7ef9651e9792b08eb310c6beb202cbc947f43cab (which
> is currently in next). If you cherry-pick this to an older kernel
> version, make sure to also pick
> 8b3d743fc9e2542822826890b482afabf0e7522a.

Ok will use "devm_clk_get_optional_enabled" and send  V2.

Cheers,
Biju



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-03 10:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220702140130.218409-1-biju.das.jz@bp.renesas.com>
     [not found] ` <20220702140130.218409-7-biju.das.jz@bp.renesas.com>
     [not found]   ` <20220702164018.ztizq3ftto4lsabr@pengutronix.de>
2022-07-03  7:15     ` [PATCH 6/6] can: sja1000: Add support for RZ/N1 SJA1000 CAN Controller Biju Das
2022-07-03  8:14       ` Uwe Kleine-König
2022-07-03 10:08         ` Biju Das

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).