* [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property
@ 2021-05-31 8:44 Marc Kleine-Budde
2021-05-31 8:44 ` [PATCH v3 2/2] can: mcp251xfd: Fix header block to clarify independence from OF Marc Kleine-Budde
2021-05-31 10:09 ` [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property Andy Shevchenko
0 siblings, 2 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2021-05-31 8:44 UTC (permalink / raw)
To: linux-can; +Cc: Andy Shevchenko, Marc Kleine-Budde
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
In some configurations, mainly ACPI-based, the clock frequency of the
device is supplied by very well established 'clock-frequency'
property. Hence, try to get it from the property at last if no other
providers are available.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
v3: - only read clock-frequency property if no clk is found
- add error handling to device_property_read_u32()
v2: new patch
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index 47c3f408a799..c8f8bdfc1bfb 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -2883,11 +2883,19 @@ static int mcp251xfd_probe(struct spi_device *spi)
return dev_err_probe(&spi->dev, PTR_ERR(reg_xceiver),
"Failed to get Transceiver regulator!\n");
- clk = devm_clk_get(&spi->dev, NULL);
+ clk = devm_clk_get_optional(&spi->dev, NULL);
if (IS_ERR(clk))
return dev_err_probe(&spi->dev, PTR_ERR(clk),
"Failed to get Oscillator (clock)!\n");
- freq = clk_get_rate(clk);
+ if (clk) {
+ freq = clk_get_rate(clk);
+ } else {
+ err = device_property_read_u32(&spi->dev, "clock-frequency",
+ &freq);
+ if (err)
+ return dev_err_probe(&spi->dev, err,
+ "Failed to get clock-frequency!\n");
+ }
/* Sanity check */
if (freq < MCP251XFD_SYSCLOCK_HZ_MIN ||
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/2] can: mcp251xfd: Fix header block to clarify independence from OF
2021-05-31 8:44 [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property Marc Kleine-Budde
@ 2021-05-31 8:44 ` Marc Kleine-Budde
2021-05-31 10:09 ` [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property Andy Shevchenko
1 sibling, 0 replies; 6+ messages in thread
From: Marc Kleine-Budde @ 2021-05-31 8:44 UTC (permalink / raw)
To: linux-can; +Cc: Andy Shevchenko, Marc Kleine-Budde
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
The driver is neither dependent on OF, nor it requires any OF headers.
Fix header block to clarify independence from OF.
Link: https://lore.kernel.org/r/20210526193327.70468-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
v3: no change
v2: included property.h
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
index c8f8bdfc1bfb..0aaac3f8b9b2 100644
--- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
+++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
@@ -15,10 +15,10 @@
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/device.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/pm_runtime.h>
+#include <linux/property.h>
#include <asm/unaligned.h>
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property
2021-05-31 8:44 [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property Marc Kleine-Budde
2021-05-31 8:44 ` [PATCH v3 2/2] can: mcp251xfd: Fix header block to clarify independence from OF Marc Kleine-Budde
@ 2021-05-31 10:09 ` Andy Shevchenko
2021-07-06 10:10 ` Andy Shevchenko
1 sibling, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-05-31 10:09 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
On Mon, May 31, 2021 at 10:44:43AM +0200, Marc Kleine-Budde wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> In some configurations, mainly ACPI-based, the clock frequency of the
> device is supplied by very well established 'clock-frequency'
> property. Hence, try to get it from the property at last if no other
> providers are available.
Oops, I have answered to v2 before looking for new version from you,
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> v3: - only read clock-frequency property if no clk is found
> - add error handling to device_property_read_u32()
> v2: new patch
>
> drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> index 47c3f408a799..c8f8bdfc1bfb 100644
> --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> @@ -2883,11 +2883,19 @@ static int mcp251xfd_probe(struct spi_device *spi)
> return dev_err_probe(&spi->dev, PTR_ERR(reg_xceiver),
> "Failed to get Transceiver regulator!\n");
>
> - clk = devm_clk_get(&spi->dev, NULL);
> + clk = devm_clk_get_optional(&spi->dev, NULL);
> if (IS_ERR(clk))
> return dev_err_probe(&spi->dev, PTR_ERR(clk),
> "Failed to get Oscillator (clock)!\n");
> - freq = clk_get_rate(clk);
> + if (clk) {
This check basically only for property case, clk_get_rate() has it.
That's why I have different flow, but this one also will work, thanks!
> + freq = clk_get_rate(clk);
> + } else {
> + err = device_property_read_u32(&spi->dev, "clock-frequency",
> + &freq);
> + if (err)
> + return dev_err_probe(&spi->dev, err,
> + "Failed to get clock-frequency!\n");
> + }
>
> /* Sanity check */
> if (freq < MCP251XFD_SYSCLOCK_HZ_MIN ||
> --
> 2.30.2
>
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property
2021-05-31 10:09 ` [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property Andy Shevchenko
@ 2021-07-06 10:10 ` Andy Shevchenko
2021-07-06 10:14 ` Marc Kleine-Budde
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2021-07-06 10:10 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
On Mon, May 31, 2021 at 01:09:41PM +0300, Andy Shevchenko wrote:
> On Mon, May 31, 2021 at 10:44:43AM +0200, Marc Kleine-Budde wrote:
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >
> > In some configurations, mainly ACPI-based, the clock frequency of the
> > device is supplied by very well established 'clock-frequency'
> > property. Hence, try to get it from the property at last if no other
> > providers are available.
Is this series missed merge window?
I never saw it in Linux Next and nor in vanilla...
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property
2021-07-06 10:10 ` Andy Shevchenko
@ 2021-07-06 10:14 ` Marc Kleine-Budde
2021-07-22 18:52 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Marc Kleine-Budde @ 2021-07-06 10:14 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 994 bytes --]
On 06.07.2021 13:10:59, Andy Shevchenko wrote:
> On Mon, May 31, 2021 at 01:09:41PM +0300, Andy Shevchenko wrote:
> > On Mon, May 31, 2021 at 10:44:43AM +0200, Marc Kleine-Budde wrote:
> > > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > >
> > > In some configurations, mainly ACPI-based, the clock frequency of the
> > > device is supplied by very well established 'clock-frequency'
> > > property. Hence, try to get it from the property at last if no other
> > > providers are available.
>
> Is this series missed merge window?
> I never saw it in Linux Next and nor in vanilla...
Yes, I missed the merge window. Will send a pull request after -rc1
(when net-next is open again).
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property
2021-07-06 10:14 ` Marc Kleine-Budde
@ 2021-07-22 18:52 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2021-07-22 18:52 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
On Tue, Jul 06, 2021 at 12:14:21PM +0200, Marc Kleine-Budde wrote:
> On 06.07.2021 13:10:59, Andy Shevchenko wrote:
> > On Mon, May 31, 2021 at 01:09:41PM +0300, Andy Shevchenko wrote:
> > > On Mon, May 31, 2021 at 10:44:43AM +0200, Marc Kleine-Budde wrote:
> > > > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > >
> > > > In some configurations, mainly ACPI-based, the clock frequency of the
> > > > device is supplied by very well established 'clock-frequency'
> > > > property. Hence, try to get it from the property at last if no other
> > > > providers are available.
> >
> > Is this series missed merge window?
> > I never saw it in Linux Next and nor in vanilla...
>
> Yes, I missed the merge window. Will send a pull request after -rc1
> (when net-next is open again).
Still no sign of them anywhere. Please, proceed with them!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-07-22 18:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 8:44 [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property Marc Kleine-Budde
2021-05-31 8:44 ` [PATCH v3 2/2] can: mcp251xfd: Fix header block to clarify independence from OF Marc Kleine-Budde
2021-05-31 10:09 ` [PATCH v3 1/2] can: mcp251xfd: mcp251xfd_probe(): try to get crystal clock rate from property Andy Shevchenko
2021-07-06 10:10 ` Andy Shevchenko
2021-07-06 10:14 ` Marc Kleine-Budde
2021-07-22 18:52 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.