]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mpc83xx: Replace CONFIG_83XX_CLKIN in calculations
authorMario Six <mario.six@gdsys.cc>
Mon, 21 Jan 2019 08:17:52 +0000 (09:17 +0100)
committerMario Six <mario.six@gdsys.cc>
Tue, 21 May 2019 05:51:40 +0000 (07:51 +0200)
CONFIG_SYS_CLK_FREQ is the standard way to set the system clock
frequency. On MPC83xx, CONFIG_83XX_CLKIN is used for this purpose.
Hence, the obvious way is to replace CONFIG_83XX_CLKIN with
CONFIG_SYS_CLK_FREQ.

A few MPC83xx boards use the CONFIG_83XX_CLKIN variable for computing
CONFIG_SYS_NS16550_CLK. This makes it harder to replace
CONFIG_83XX_CLKIN.

But the value of the multiplicator can be read from the SPMR register.

Hence, replace the static calculations with a call to a new get_bus_freq
function, as other architectures do.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
arch/powerpc/cpu/mpc83xx/spl_minimal.c
include/configs/MPC8315ERDB.h
include/configs/ids8313.h

index 746f1febba0c050820f757565115bc447caad4e0..3315ee05e113142f22cb82be304fbe4ea68b7cd2 100644 (file)
@@ -89,3 +89,11 @@ void puts(const char *str)
        while (*str)
                putc(*str++);
 }
+
+ulong get_bus_freq(ulong dummy)
+{
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
+       u8 spmf = (im->clk.spmr & SPMR_SPMF) >> SPMR_SPMF_SHIFT;
+
+       return CONFIG_83XX_CLKIN * spmf;
+}
index c373a0ab4c1725995fe8da34f43fe3c447ee5e21..adb2bb6c2d8a152299abd0da06d96bb2a092bc14 100644 (file)
  */
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE    1
-#define CONFIG_SYS_NS16550_CLK         (CONFIG_83XX_CLKIN * 2)
+#define CONFIG_SYS_NS16550_CLK         (get_bus_freq(0))
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
                {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
index caa3dd1f1a6bf831e1ef8cd26bc5de2c4e79d7bf..4b0ec273fb7d1c71ddd5fe8dc11dbe0071dac2b6 100644 (file)
        {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200}
 #define CONFIG_SYS_NS16550_COM1        (CONFIG_SYS_IMMR + 0x4500)
 #define CONFIG_SYS_NS16550_COM2        (CONFIG_SYS_IMMR + 0x4600)
-#define CONFIG_SYS_NS16550_CLK         (CONFIG_83XX_CLKIN * 2)
+#define CONFIG_SYS_NS16550_CLK         (get_bus_freq(0))
 
 #define CONFIG_HAS_FSL_DR_USB
 #define CONFIG_SYS_SCCR_USBDRCM        3