Re: mcp251x: read oscillator frequency?

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

 



On Mon, Nov 11, 2019 at 10:23:46PM +0100, Marc Kleine-Budde wrote:
> On 11/11/19 7:39 PM, Drew Fustini wrote:
> >> I assume you get the 8MHz clock rate from the "ip" output, right?
> 
> > I added printk to output the value of:
> > freq = clk_get_rate(clk);
> > 
> > which is from line 1041:
> > https://elixir.bootlin.com/linux/latest/source/drivers/net/can/spi/mcp251x.c#L1041
> > 
> > which shows:
> > mcp251x_can_probe: clk_get_rate(clk)=8000000
> 
> Ok, then let's check if the device tree contains the correct value. Can
> you send the output of:
> 
>     dtc -I fs -O dts /proc/device-tree
> 


/dts-v1/;

/ {
        compatible = "ti,am335x-pocketbeagle", "ti,am335x-bone", "ti,am33xx";
        serial-number = "1740GPB21127";
        model = "TI AM335x PocketBeagle";
        interrupt-parent = <0x1>;
        #address-cells = <0x1>;
        #size-cells = <0x1>;

        mcp2515_clock {
                compatible = "fixed-clock";
                #clock-cells = <0x0>;
                phandle = <0x21a>;
                clock-frequency = <0xf42400>;
                linux,phandle = <0x21a>;
        };

<snip>

                        mcp2515@1 {
                                compatible = "microchip,mcp2515";
                                clocks = <0x21a>;
                                mcp251x,irq-gpios = <0x196 0x1c 0x0>;
                                mcp251x,stay-awake = <0x1>;
                                mcp251x,oscillator-frequency = <0xf42400>;
                                status = "okay";
                                interrupt-parent = <0x196>;
                                interrupts = <0x1c 0x2>;
                                mcp251x,enable-clkout = <0x1>;
                                phandle = <0x21b>;
                                reg = <0x1>;
                                pinctrl-0 = <0x219>;
                                linux,phandle = <0x21b>;
                                spi-max-frequency = <0x989680>;
                                pinctrl-names = "default";
                        };


0xf42400 is 16MHz so it does look like device tree has the correct value.

Maybe I am not defining the clock correctly?

It doesn't appear that the call clk_get_rate(clk) returns the value defined in DT.


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