ppc4xx: Correct UART input clock calculation and passing to fdt
We now use a value in the gd (global data) structure for the UART input frequency, since the PPC4xx_SYS_INFO struct is always rewritten completely in get_sys_info(). Signed-off-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
353f2688b4
commit
f10493c6d7
|
@ -192,9 +192,9 @@ static void serial_init_common(u32 base, u32 udiv, u16 bdiv)
|
||||||
* the UART divisor is available
|
* the UART divisor is available
|
||||||
*/
|
*/
|
||||||
#ifdef CFG_EXT_SERIAL_CLOCK
|
#ifdef CFG_EXT_SERIAL_CLOCK
|
||||||
sys_info.freqUART = CFG_EXT_SERIAL_CLOCK;
|
gd->uart_clk = CFG_EXT_SERIAL_CLOCK;
|
||||||
#else
|
#else
|
||||||
sys_info.freqUART = sys_info.freqUART / udiv;
|
gd->uart_clk = sys_info.freqUART / udiv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
out_8((u8 *)base + UART_LCR, 0x80); /* set DLAB bit */
|
out_8((u8 *)base + UART_LCR, 0x80); /* set DLAB bit */
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#include <libfdt.h>
|
#include <libfdt.h>
|
||||||
#include <libfdt_env.h>
|
#include <libfdt_env.h>
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
static void do_fixup(void *fdt, const char *node, const char *prop,
|
static void do_fixup(void *fdt, const char *node, const char *prop,
|
||||||
const void *val, int len, int create)
|
const void *val, int len, int create)
|
||||||
{
|
{
|
||||||
|
@ -44,7 +46,7 @@ static void do_fixup(void *fdt, const char *node, const char *prop,
|
||||||
debug("Updating property '%s/%s' = ", node, prop);
|
debug("Updating property '%s/%s' = ", node, prop);
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
debug(" %.2x", *(u8*)(val+i));
|
debug(" %.2x", *(u8*)(val+i));
|
||||||
debug("\n");
|
debug("(%d)\n", *(u32 *)val);
|
||||||
#endif
|
#endif
|
||||||
int rc = fdt_find_and_setprop(fdt, node, prop, val, len, create);
|
int rc = fdt_find_and_setprop(fdt, node, prop, val, len, create);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
@ -83,9 +85,9 @@ static void do_fixup_uart(void *fdt, int offset, int i, bd_t *bd)
|
||||||
|
|
||||||
get_sys_info(&sys_info);
|
get_sys_info(&sys_info);
|
||||||
|
|
||||||
debug("Updating node UART%d\n", i);
|
debug("Updating node UART%d: clock-frequency=%d\n", i, gd->uart_clk);
|
||||||
|
|
||||||
val = cpu_to_fdt32(sys_info.freqUART);
|
val = cpu_to_fdt32(gd->uart_clk);
|
||||||
rc = fdt_setprop(fdt, offset, "clock-frequency", &val, 4);
|
rc = fdt_setprop(fdt, offset, "clock-frequency", &val, 4);
|
||||||
if (rc)
|
if (rc)
|
||||||
printf("Unable to update node UART, err=%s\n", fdt_strerror(rc));
|
printf("Unable to update node UART, err=%s\n", fdt_strerror(rc));
|
||||||
|
|
|
@ -107,6 +107,9 @@ typedef struct global_data {
|
||||||
unsigned int dp_alloc_base;
|
unsigned int dp_alloc_base;
|
||||||
unsigned int dp_alloc_top;
|
unsigned int dp_alloc_top;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(CONFIG_4xx)
|
||||||
|
u32 uart_clk;
|
||||||
|
#endif /* CONFIG_4xx */
|
||||||
#if defined(CFG_GT_6426x)
|
#if defined(CFG_GT_6426x)
|
||||||
unsigned int mirror_hack[16];
|
unsigned int mirror_hack[16];
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue