Skip to contentSkip to conversation

mx53ppd: Change UART clock divider for high baudrate

PATCH New Rick Bronson 3 participants 3 messages Feb 17, 2018 – Feb 18, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx53ppd: Change UART clock divider for high baudrate

Hi Fabio,

First a disclaimer. I no longer work for the client that had me
make this change. I also no longer have any iMX53 hardware to do any kind of tests. But I'm happy to help out with this email.

Quoted 9 lines

Hi Rick and Sebastian,

Quoted 3 lines · Sebastian Reichel

From: Rick Bronson <[email protected]>

Allow higher UART baud rates for communications to ACHC at 13.5 MBaud

What does ACHC mean?

ACHC is an product acronym, probably should change that sentence to:

Allow higher UART baud rates for communications up to 13.5 MBaud

Quoted 5 lines
Quoted 3 lines

Done in u-boot since it changes a divider common to all UARTs, including the console. If it were done in Linux we would get garbled characters during the handoff from u-boot to the kernel.

It would be nice to explain a bit how you achieve the higher baud rates.

Background: PLL2 runs at 400 MHz, PLL3 runs at 216 MHz. One of
these PLL's are fed to a UART divider, the output of which sets the maximum UART baud rates that are based on these rates divided by 16.

Before patch: PLL3 (400 MHz) for UART's, divide by 6, get 66.66 MHz
from it. Max baud rate is 4.166 MBaud.

After patch: PLL2 (216 MHz), divide by 1, get 216 MHz from it. Max
baud rate is 13.5 MBaud.

The last I saw this code was 2014 so it's a little fuzzy. Not sure
why I didn't keep PLL3 and just change the divider from 6 to 3, that would have allowed a max of 8.33 MBaud and at the time, I was just looking for at least 8 MBaud.

Quoted 2 lines

Looks like you don't use PLL2 as the UART clock anyomore.

That's correct, see above.

Quoted 10 lines

Please expland a bit further on the new UART clock sheme.

Review

Quoted 7 lines
---
 arch/arm/mach-imx/mx5/lowlevel_init.S | 4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/arch/arm/mach-imx/mx5/lowlevel_init.S

Quoted 7 lines
Quoted 7 lines

index f5bc6728b7c2..ee4c3afd2fed 100644

arch/arm/mach-imx/mx5/lowlevel_init.S +0 -0
@@ -319,11 +319,13 @@ setup_pll_func:
        ldr r1, =0x00016154
        str r1, [r0, #CLKCTL_CBCMR]
 
Quoted 5 lines

arch/arm/mach-imx/mx5/lowlevel_init.S setup_pll_func: · line 322

Quoted 1 line
arch/arm/mach-imx/mx5/lowlevel_init.S +1 -0
+#if !defined(CONFIG_TARGET_MX53PPD)

It would be better if this option could be a generic one, something like CONFIG_MX53_SERIAL_HIGHBAUD, so that other boads could use it if needed.

Yes it probably would.

Cheers,

Rick

#1 lore raw

PATCH 1/1 mx53ppd: Change UART clock divider for high baudrate

Hi Rick,

Quoted 11 lines · Rick Bronson
Quoted 1 line

It would be nice to explain a bit how you achieve the higher baud rates.

Background: PLL2 runs at 400 MHz, PLL3 runs at 216 MHz. One of
these PLL's are fed to a UART divider, the output of which sets the maximum UART baud rates that are based on these rates divided by 16.

Before patch: PLL3 (400 MHz) for UART's, divide by 6, get 66.66 MHz
from it. Max baud rate is 4.166 MBaud.

After patch: PLL2 (216 MHz), divide by 1, get 216 MHz from it. Max
baud rate is 13.5 MBaud.

Thanks for the clarification.

Maybe Sebastian can send a v2 with this explanation incorporated.

Regards,

Fabio Estevam

#2 lore raw

PATCH 1/1 mx53ppd: Change UART clock divider for high baudrate

In reply to Rick Bronson

Hi Rick,

Quoted 6 lines · Rick Bronson

Hi Fabio,

First a disclaimer. I no longer work for the client that had me
make this change. I also no longer have any iMX53 hardware to do any kind of tests. But I'm happy to help out with this email.

Thanks for your support !

Quoted 6 lines
Quoted 6 lines

Hi Rick and Sebastian,

Quoted 2 lines · Sebastian Reichel

From: Rick Bronson <[email protected]>

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Allow higher UART baud rates for communications to ACHC at 13.5 MBaud

What does ACHC mean?

ACHC is an product acronym, probably should change that sentence to:

Allow higher UART baud rates for communications up to 13.5 MBaud

ok, understood. The whole commit message is misleading, and it is not clear what the patch is supposed to address.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

Done in u-boot since it changes a divider common to all UARTs, including the console. If it were done in Linux we would get garbled characters during the handoff from u-boot to the kernel.

It would be nice to explain a bit how you achieve the higher baud rates.

Background: PLL2 runs at 400 MHz, PLL3 runs at 216 MHz. One of
these PLL's are fed to a UART divider, the output of which sets the maximum UART baud rates that are based on these rates divided by 16.

ok

Quoted 4 lines

Before patch: PLL3 (400 MHz) for UART's, divide by 6, get 66.66 MHz
from it. Max baud rate is 4.166 MBaud.

Generally enough for a console....

Quoted 7 lines

After patch: PLL2 (216 MHz), divide by 1, get 216 MHz from it. Max
baud rate is 13.5 MBaud.

The last I saw this code was 2014 so it's a little fuzzy. Not sure
why I didn't keep PLL3 and just change the divider from 6 to 3, that would have allowed a max of 8.33 MBaud and at the time, I was just looking for at least 8 MBaud.

ok, understood. In any case, it looks to me that this requirement is very specific to this target (even if I have not got why we cannot set the parent clock in the DT in linux, it would be my first choice). It should be implemented into board code, and not in lowlevelinit with some #ifdef. We already spent a lot of effort to reduce nasty compiler switch in common code.

Quoted 24 lines
Quoted 3 lines

Looks like you don't use PLL2 as the UART clock anyomore.

That's correct, see above.

Quoted 10 lines

Please expland a bit further on the new UART clock sheme.

Review

Quoted 7 lines
---
 arch/arm/mach-imx/mx5/lowlevel_init.S | 4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/arch/arm/mach-imx/mx5/lowlevel_init.S

Quoted 7 lines
Quoted 7 lines

index f5bc6728b7c2..ee4c3afd2fed 100644

arch/arm/mach-imx/mx5/lowlevel_init.S +0 -0
@@ -319,11 +319,13 @@ setup_pll_func:
        ldr r1, =0x00016154
        str r1, [r0, #CLKCTL_CBCMR]
 
Quoted 7 lines
Quoted 5 lines

arch/arm/mach-imx/mx5/lowlevel_init.S setup_pll_func: · line 322

Quoted 1 line
arch/arm/mach-imx/mx5/lowlevel_init.S +1 -0
+#if !defined(CONFIG_TARGET_MX53PPD)

It would be better if this option could be a generic one, something like CONFIG_MX53_SERIAL_HIGHBAUD, so that other boads could use it if needed.

Yes it probably would.

Anyway, I have doubt this is useful. U-Boot is just a bootloader, and the high baud protocol is running in Linux. It is not used in U-Boot, because U-Boot needs just a console. The well known approach in kernel is to not rely to the bootloader (I know there are some exceptions..). Kernel sets all peripherals and does not bother what the bootloader did or didn't. This is really a good approach and makes no sense to add some kind of dependency here.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================