RobertCNelson / dtb-rebuilder

Other
52 stars 60 forks source link

Always suppose a 24MHz clock on board regardless of CPU config pins #4

Closed nunojpg closed 9 years ago

nunojpg commented 9 years ago

Cape pins at boot can touch CPU config pins and signal another clock on board. BBW and BBB always have a 24MHz clock so it is safe to ignore it.

Signed-off-by: Nuno Goncalves nunojpg@gmail.com

RobertCNelson commented 9 years ago

yeah, sorry nak.. Those are just phandles to link possible clocks.

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/clock/ti/mux.txt

Regards,

nunojpg commented 9 years ago

I didn't understand your explanation...

The idea is to override the definition at am33xx-clocks.dtsi:

&scm_clocks {
    sys_clkin_ck: sys_clkin_ck {
        #clock-cells = <0>;
        compatible = "ti,mux-clock";
        clocks = <&virt_19200000_ck>, <&virt_24000000_ck>, <&virt_25000000_ck>, <&virt_26000000_ck>;
        ti,bit-shift = <22>;
        reg = <0x0040>;
    };

With this patch, regardless of the content of reg = <0x0040>, we always assume a 24MHz clock.

RobertCNelson commented 9 years ago

Correct, I know you are overriding sys_clkin_ck, for the bone's.. But what's the real point and reason you wish to do this?

btw, tiwi-r2 cape for the BeagleBone (not black) needs the 19.2Mhz reference to generate 38.4Mhz..

RobertCNelson commented 9 years ago

btw, the "real" 24Mhz clock in is here: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/am33xx-clocks.dtsi#n303

Regards,

nunojpg commented 9 years ago

This is related to the CPU configuration by SYSBOOT pins.

SYSBOOT[15:0] terminals are respectively LCD_DATA[15:0] inputs, latched on the rising edge of PWRONRSTn. [1]

SYSBOOT (LCD_DATA) 15:14 are used to inform the CPU which clock is connected to OSC0.

00b = 19.2MHz 01b = 24MHz 10b = 25MHz 11b = 26MHz

The am3xxx driver use this configuration information to set the appropriate clock divider.

But there is a 24MHz XTAL on the BB, so we don't need to rely on the SYSBOOT information.

Otherwise If a cape during boot touches SYSBOOT (LCD_DATA) 15:14, the CPU can be told a wrong information and have the system clock ticking faster or slower (+25%,-4%,-7,7%).

This only needs to be changed if the XTAL chip is physically replaced on the board.

AFAIK, nothing of this is related to the "tiwi-r2 cape" or "clk_24mhz: clk_24mhz".

[1] http://www.ti.com/lit/ug/spruh73l/spruh73l.pdf

RobertCNelson commented 9 years ago

Okay, that needs to be added to the message in the patch. Please post to linux-omap cc'ing Tero Kristo t-kristo@ti.com

Regards,