
2016-11-30 5:05 GMT+01:00 Stephen Warren swarren@wwwdotorg.org:
On 11/27/2016 11:05 PM, Mirza Krak wrote:
From: Mirza Krak mirza.krak@gmail.com
Recently the default UART clock rate has been changed to 48 MHz on all pi`s in the firmware files, which broke UART support in u-boot.
Align configuration to boot firmware.
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
@@ -37,7 +37,7 @@ static const struct pl01x_serial_platdata serial_platdata = { .base = 0x20201000, #endif .type = TYPE_PL011,
.clock = 3000000,
.clock = 48000000,
I'm not sure this is the best fix, since it will prevent the latest U-Boot from working with the FW before the change.
Agree that there are better ways of doing this. My purpose with this was mainly bringing this problem to your attention as well.
Better would be:
a) Revert the change in the FW, since it violates the contract that previously existed between FW and OS, and will likely break UART usage on (almost?) all SW.
I am not really in position to tell anyone reverting anything. I am merely a user reporting a problem.
This does not break UART on Linux, if you skip U-boot. Because the FW patches the DT with the correct value. But it is a problem if you use U-boot and then load the DT from U-boot, then you will lose the "patched" DT and break UART on Linux as well.
Should be said that the "init_uart_clock" has always been a configurable option for raspberry pi, U-boot has never actually supported configuration of that property and hence there is a problem now when the default value of this property has changed. So the best solutions is probably supporting parsing the options from firmware to setup the UART clock rate correctly (DT or Mailbox).
Jumping to b1), for more text.
b) Detect the correct clock rate at run-time rather than hard-coding it.
b1) Perhaps the rate is available in the DT passed by the FW, which following http://patchwork.ozlabs.org/patch/690769/ "rpi: save firmware provided boot param for later use" should now be available within U-Boot to parse.
This is good to know that it is possible too do, since the FW provided DT does contain the correct value for UART clock and I think that this would be the best approach for solving this and also supporting any value that the user sees fit (by changing the init_uart_clock property).
b2) Perhaps query the rate from the FW via the mailbox API; see https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
Is this API implemented in u-boot? Could be even better to use this, then we are not depended on a DT file from firmware (which is my use case, where I do not provide a DT to the firmware at all).
Best Regards Mirza