PATCH[1/1] 8xx: Add clock-frequency to .dts brg entries
Subsystems (2)
cpm_uart_core has a dependency on fsl,cpm-brg/clock-frequency, this means that a .dts that uses the cpm uart driver needs to supply a clock-frequency entry for get_brgfreq to return a meaningful number.
Included is a patchset which adds the correct brgclk to the adder port - @ 50Mhz and also adds an entry for mpc885ads - which I've noticed is missing a clock-frequency entry.
Without an entry for clock-frequency in the .dts you'd get -1 as the return value brgclk !
---
(quoted diff) +0 -0
b/arch/powerpc/boot/dts/adder875-redboot.dts
index 7c25d96..975f3d4 100644
arch/powerpc/boot/dts/adder875-redboot.dts +1 -0
@@ -149,6 +149,7 @@ compatible = "fsl,mpc875-brg", "fsl,cpm1-brg", "fsl,cpm-brg"; + clock-frequency = <0x2faf080>; reg = <0x9f0 0x10>; };
(quoted diff) +0 -0
b/arch/powerpc/boot/dts/adder875-uboot.dts
index 605202f..18d6dd6 100644
arch/powerpc/boot/dts/adder875-uboot.dts +1 -0
@@ -148,6 +148,7 @@ compatible = "fsl,mpc875-brg", "fsl,cpm1-brg", "fsl,cpm-brg"; + clock-frequency = <0x2faf080>; reg = <0x9f0 0x10>; };
(quoted diff) +0 -0
b/arch/powerpc/boot/dts/mpc885ads.dts
index 8848e63..f2a437b 100644
arch/powerpc/boot/dts/mpc885ads.dts +1 -0
@@ -166,6 +166,7 @@ compatible = "fsl,mpc885-brg", "fsl,cpm1-brg", "fsl,cpm-brg"; + clock-frequency = <0>; reg = <9f0 10>; };
Quoted 7 lines · Bryan O'Donoghue
cpm_uart_corehas a dependency on fsl,cpm-brg/clock-frequency, this means that a .dts that uses the cpm uart driver needs to supply a clock-frequency entry forget_brgfreqto return a meaningful number.Included is a patchset which adds the correct brgclk to the adder port - @ 50Mhz and also adds an entry for mpc885ads - which I've noticed is missing a clock-frequency entry.
It's not missing -- it's added by the bootwrapper.
-Scott
Quoted 5 lines · Scott Wood
Quoted 4 lines · Bryan O'Donoghue
cpm_uart_corehas a dependency on fsl,cpm-brg/clock-frequency, this means that a .dts that uses the cpm uart driver needs to supply a clock-frequency entry forget_brgfreqto return a meaningful number.
Quoted 7 lines
Quoted 3 lines
Included is a patchset which adds the correct brgclk to the adder port - @ 50Mhz and also adds an entry for mpc885ads - which I've noticed is missing a clock-frequency entry.
It's not missing -- it's added by the bootwrapper.
-Scott
Hmm..
You mean that arch/powerpc/boot/mpc8xx.c mpc8xx_set_clocks is supposed to be adding this field ?
I see arch/powerpc/boot/wrapper.a has a reference to the function but - and this time I've checked all documentation - there's no mention of how to use this library at all... it _looks_ to me like this isn't being linked in any way.
It for sure is nowhere in the uImage - and I've taken the preferred route of making a uImage with .dtb - genreated from adder875-uboot.dts
dtc -O -o adder875-uboot.dtb arch/powerpc/boot/dts/adder875-uboot.dtb
cpm_uart depends on "fsl,cpm-brg" and a field called "clock-frequency"
as I understand it that's
fsl,cpm-brg
|_clock-frequency
whereas mpc8xx_set_clocks seems to add
/soc/cpm/brg
|_clock-frequency
So unless I'm not understanding the structure of the tree - possible - I don't see how /soc/cpm/brg => clock-frequency could /possibly/ satisfy get_brgfreq in fsl_soc.c
If there's something other then making a uImage and dtb and booting these from u-boot that I'm supposed to be doing here ... it'd help if you could say..
Otherwise in order to get the UART working using a uImage + dbt I've found it necessary to add this field to the .dts....
mpc866ads.dts - also has a "fsl,cpm-brg" => clock-frequency entry in
linux/arch/powerpc/boot/dts/mpc866ads.dts - and to me this looks like the correct approach for get_brgfreq to function properly...
What do you think ?
Quoted 2 lines · Bryan O'Donoghue
You mean that
arch/powerpc/boot/mpc8xx.cmpc8xx_set_clocksis supposed to be adding this field ?
Yes. Or u-boot, if you're not using the bootwrapper/cuImage.
Quoted 7 lines
I see
arch/powerpc/boot/wrapper.ahas a reference to the function but - and this time I've checked all documentation - there's no mention of how to use this library at all... it _looks_ to me like this isn't being linked in any way.It for sure is nowhere in the uImage - and I've taken the preferred route of making a uImage with .dtb - genreated from
adder875-uboot.dts
In that case, u-boot needs to add that property.
Quoted 1 line
dtc -O -o adder875-uboot.dtb
arch/powerpc/boot/dts/adder875-uboot.dtb
You'll want to use the -p option to add some extra space for u-boot to use.
Quoted 11 lines
cpm_uartdepends on "fsl,cpm-brg" and a field called "clock-frequency"as I understand it that's
fsl,cpm-brg
|_clock-frequencywhereas
mpc8xx_set_clocksseems to add/soc/cpm/brg
|_clock-frequency
The fsl,cpm-brg refers to the compatible property, not the node name.
Quoted 4 lines
mpc866ads.dts- also has a "fsl,cpm-brg" => clock-frequency entry in
linux/arch/powerpc/boot/dts/mpc866ads.dts- and to me this looks like the correct approach forget_brgfreqto function properly...
And it's zero, meaning that you still need u-boot or the bootwrapper to fill in the correct value. The only difference is whether there's a placeholder property -- they used to be required by older u-boots, but are no longer necessary.
-Scott
Quoted 5 lines · Scott Wood
Quoted 2 lines · Bryan O'Donoghue
You mean that
arch/powerpc/boot/mpc8xx.cmpc8xx_set_clocksis supposed to be adding this field ?Yes. Or u-boot, if you're not using the bootwrapper/cuImage.
Indeed - I have some patches to send to the u-boot mailing list to cover manipulation of the "fsl,cpm-brg" "clock-frequency" entry.
The previously sent patch will allow Linux to print stuff out the UART will the default brgclk - from a uImage and is the field that a future u-boot patchset would want to manipulate in order to tell Linux about the brgclk it should have.
I should be a bit clearer about that...
Quoted 10 lines
Quoted 8 lines
I see
arch/powerpc/boot/wrapper.ahas a reference to the function but - and this time I've checked all documentation - there's no mention of how to use this library at all... it _looks_ to me like this isn't being linked in any way.It for sure is nowhere in the uImage - and I've taken the preferred route of making a uImage with .dtb - genreated from
adder875-uboot.dtsIn that case, u-boot needs to add that property.
See above.
Quoted 4 lines
Quoted 1 line
dtc -O -o adder875-uboot.dtb
arch/powerpc/boot/dts/adder875-uboot.dtbYou'll want to use the -p option to add some extra space for u-boot to use.
Interesting - the u-boot end of this patch is something I'm still messing about with ... but, the addition of the default brgclk to the Linux dts is a useful addition - and AFAICT will be needed to allow a bootloader to manipulate the dts so that Linux will get the right brgclk.
Quoted 7 lines
Quoted 7 lines
cpm_uartdepends on "fsl,cpm-brg" and a field called "clock-frequency"as I understand it that's
fsl,cpm-brg
|_clock-frequency
Quoted 6 lines
Quoted 4 lines
whereas
mpc8xx_set_clocksseems to add/soc/cpm/brg
|_clock-frequencyThe fsl,cpm-brg refers to the compatible property, not the node name.
Indeed and the get_brgclk does a find_compatible() lookup of some sort... so I think that means this is the right field to add to allow a bootloader to manipulate the brgclk ... it's what the other stuff in u-boot for the mpc8xxx stuff does, so it follows to do the same thing for 8xx too.
Quoted 7 lines
Quoted 4 lines
mpc866ads.dts- also has a "fsl,cpm-brg" => clock-frequency entry in
linux/arch/powerpc/boot/dts/mpc866ads.dts- and to me this looks like the correct approach forget_brgfreqto function properly...And it's zero, meaning that you still need u-boot or the bootwrapper to fill in the correct value.
Indeed - I'm hoping I won't have too much trouble getting those patches applied...