Re: mcp251x: read oscillator frequency?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 11, 2019 at 12:00 PM Drew Fustini <drew@xxxxxxxx> wrote:
>
> On Mon, Nov 11, 2019 at 11:28:14AM +0100, Marc Kleine-Budde wrote:
> > I successfully got a mcp25625 (which is basically a mcp2515 with
> > internal phy) running on a rapsi using the frequency printed on the
> > oscillator in the DT-overlay.
>
> I came across this patch by Andy on the linux-can archives:
>
> [PATCH v2] can: mcp251x: Get rid of legacy platform data
> https://www.spinics.net/lists/linux-can/msg02407.html
>
> The description:
> Instead of using legacy platform data, switch to use device properties.
> For clock frequency we are using well established clock-frequency property.
>
> I reads the clock-frequency property from device tree:
>
>         freq = clk_get_rate(clk);
> -       if (freq == 0 && pdata)
> -               freq = pdata->oscillator_frequency;
> +       if (freq == 0)
> +               device_property_read_u32(&spi->dev, "clock-frequency", &freq);
>
>
> I feel like this is currently missing from mcp251x.c.  I don't see how it is
> reading the clock frequency from Device Tree as I don't see any code in the
> current mcp251x.c to read device tree properties.
>
> I would appreciate any insights to improve my understanding.

Also, I meant to ask as to why the clock for MCP2515 Oscillator comes
from the spi device:
clk = devm_clk_get(&spi->dev, NULL);

line 1034 from:
https://elixir.bootlin.com/linux/latest/source/drivers/net/can/spi/mcp251x.c#L1034

It seem like there should be separate clocks for the SPI frequency and
the MCP2515 oscillator frequency.

Am I missing something?

Thanks,
Drew



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux