[U-Boot] [PATCH v2 1/2] m68k: add malloc memory for early malloc

To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
Signed-off-by: Angelo Dureghello angelo@sysam.it
---
Changes in v2: None
arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ arch/m68k/include/asm/config.h | 2 -- 9 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/arch/m68k/cpu/mcf5227x/start.S b/arch/m68k/cpu/mcf5227x/start.S index 23024f9..bcb5611 100644 --- a/arch/m68k/cpu/mcf5227x/start.S +++ b/arch/m68k/cpu/mcf5227x/start.S @@ -379,6 +379,14 @@ _start:
move.l #__got_start, %a5 /* put relocation table address to a5 */
+ /* Allocate and zero GD, update SP */ + move.l %sp,-(%sp) + bsr board_init_f_mem + + /* Update stack- and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + bsr cpu_init_f /* run low-level CPU init code (from flash) */ bsr board_init_f /* run low-level board init code (from flash) */
diff --git a/arch/m68k/cpu/mcf523x/start.S b/arch/m68k/cpu/mcf523x/start.S index 8a23e72..14b3025 100644 --- a/arch/m68k/cpu/mcf523x/start.S +++ b/arch/m68k/cpu/mcf523x/start.S @@ -141,6 +141,14 @@ _start:
move.l #__got_start, %a5 /* put relocation table address to a5 */
+ /* Allocate and zero GD, update SP */ + move.l %sp,-(%sp) + bsr board_init_f_mem + + /* Update stack- and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + bsr cpu_init_f /* run low-level CPU init code (from flash) */ bsr board_init_f /* run low-level board init code (from flash) */
diff --git a/arch/m68k/cpu/mcf52x2/start.S b/arch/m68k/cpu/mcf52x2/start.S index 8a59496..abb9291 100644 --- a/arch/m68k/cpu/mcf52x2/start.S +++ b/arch/m68k/cpu/mcf52x2/start.S @@ -198,6 +198,14 @@ _after_flashbar_copy:
move.l #__got_start, %a5 /* put relocation table address to a5 */
+ /* Allocate and zero GD, update SP */ + move.l %sp,-(%sp) + bsr board_init_f_mem + + /* Update stack- and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + bsr cpu_init_f /* run low-level CPU init code (from flash) */ bsr board_init_f /* run low-level board init code (from flash) */
diff --git a/arch/m68k/cpu/mcf530x/cpu_init.c b/arch/m68k/cpu/mcf530x/cpu_init.c index 80dc239..b09eed8 100644 --- a/arch/m68k/cpu/mcf530x/cpu_init.c +++ b/arch/m68k/cpu/mcf530x/cpu_init.c @@ -142,7 +142,7 @@ int cpu_init_r(void) return 0; }
-void uart_port_conf(void) +void uart_port_conf(int port) { }
diff --git a/arch/m68k/cpu/mcf530x/start.S b/arch/m68k/cpu/mcf530x/start.S index 097958a..d9034e1 100644 --- a/arch/m68k/cpu/mcf530x/start.S +++ b/arch/m68k/cpu/mcf530x/start.S @@ -137,6 +137,14 @@ _start: /* put relocation table address to a5 */ move.l #__got_start, %a5
+ /* Allocate and zero GD, update SP */ + move.l %sp,-(%sp) + bsr board_init_f_mem + + /* Update stack- and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + /* run low-level CPU init code (from flash) */ bsr cpu_init_f
diff --git a/arch/m68k/cpu/mcf532x/start.S b/arch/m68k/cpu/mcf532x/start.S index 3b9ede0..98a5401 100644 --- a/arch/m68k/cpu/mcf532x/start.S +++ b/arch/m68k/cpu/mcf532x/start.S @@ -155,6 +155,14 @@ _start:
move.l #__got_start, %a5 /* put relocation table address to a5 */
+ /* Allocate and zero GD, update SP */ + move.l %sp,-(%sp) + bsr board_init_f_mem + + /* Update stack- and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + bsr cpu_init_f /* run low-level CPU init code (from flash) */ bsr board_init_f /* run low-level board init code (from flash) */
diff --git a/arch/m68k/cpu/mcf5445x/start.S b/arch/m68k/cpu/mcf5445x/start.S index 979eb5a..340ab84 100644 --- a/arch/m68k/cpu/mcf5445x/start.S +++ b/arch/m68k/cpu/mcf5445x/start.S @@ -664,6 +664,14 @@ _start:
move.l #__got_start, %a5 /* put relocation table address to a5 */
+ /* Allocate and zero GD, update SP */ + move.l %sp,-(%sp) + bsr board_init_f_mem + + /* Update stack- and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + bsr cpu_init_f /* run low-level CPU init code (from flash) */ bsr board_init_f /* run low-level board init code (from flash) */
diff --git a/arch/m68k/cpu/mcf547x_8x/start.S b/arch/m68k/cpu/mcf547x_8x/start.S index 75de22d..0468d1a 100644 --- a/arch/m68k/cpu/mcf547x_8x/start.S +++ b/arch/m68k/cpu/mcf547x_8x/start.S @@ -148,6 +148,14 @@ _start:
move.l #__got_start, %a5 /* put relocation table address to a5 */
+ /* Allocate and zero GD, update SP */ + move.l %sp,-(%sp) + bsr board_init_f_mem + + /* Update stack- and frame-pointers */ + move.l %d0, %sp + move.l %sp, %fp + jbsr cpu_init_f /* run low-level CPU init code (from flash) */ jbsr board_init_f /* run low-level board init code (from flash) */
diff --git a/arch/m68k/include/asm/config.h b/arch/m68k/include/asm/config.h index e1458ac..9c4d3fb 100644 --- a/arch/m68k/include/asm/config.h +++ b/arch/m68k/include/asm/config.h @@ -7,8 +7,6 @@ #ifndef _ASM_CONFIG_H_ #define _ASM_CONFIG_H_
-#define CONFIG_SYS_GENERIC_GLOBAL_DATA - #define CONFIG_NEEDS_MANUAL_RELOC
#define CONFIG_LMB

Boards can now use DM serial driver, or still legacy mcf uart driver version.
Signed-off-by: Angelo Dureghello angelo@sysam.it
---
Changes in v2: - remove while loops in putc and getc, replacing with return -EAGAIN - remove unneeded ifdef
drivers/serial/mcfuart.c | 188 ++++++++++++++++++++++------- include/dm/platform_data/serial_coldfire.h | 23 ++++ 2 files changed, 167 insertions(+), 44 deletions(-) create mode 100644 include/dm/platform_data/serial_coldfire.h
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c index 407354f..059cb0f 100644 --- a/drivers/serial/mcfuart.c +++ b/drivers/serial/mcfuart.c @@ -2,6 +2,9 @@ * (C) Copyright 2004-2007 Freescale Semiconductor, Inc. * TsiChung Liew, Tsi-Chung.Liew@freescale.com. * + * Modified to add device model (DM) support + * (C) Copyright 2015 Angelo Dureghello angelo@sysam.it + * * SPDX-License-Identifier: GPL-2.0+ */
@@ -11,9 +14,10 @@ */
#include <common.h> +#include <dm.h> +#include <dm/platform_data/serial_coldfire.h> #include <serial.h> #include <linux/compiler.h> - #include <asm/immap.h> #include <asm/uart.h>
@@ -21,91 +25,110 @@ DECLARE_GLOBAL_DATA_PTR;
extern void uart_port_conf(int port);
-static int mcf_serial_init(void) +static int mcf_serial_init_common(uart_t *uart, int port_idx, int baudrate) { - volatile uart_t *uart; u32 counter;
- uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE); - - uart_port_conf(CONFIG_SYS_UART_PORT); + uart_port_conf(port_idx);
/* write to SICR: SIM2 = uart mode,dcd does not affect rx */ - uart->ucr = UART_UCR_RESET_RX; - uart->ucr = UART_UCR_RESET_TX; - uart->ucr = UART_UCR_RESET_ERROR; - uart->ucr = UART_UCR_RESET_MR; + writeb(UART_UCR_RESET_RX, &uart->ucr); + writeb(UART_UCR_RESET_TX, &uart->ucr); + writeb(UART_UCR_RESET_ERROR, &uart->ucr); + writeb(UART_UCR_RESET_MR, &uart->ucr); __asm__("nop");
- uart->uimr = 0; + writeb(0, &uart->uimr);
/* write to CSR: RX/TX baud rate from timers */ - uart->ucsr = (UART_UCSR_RCS_SYS_CLK | UART_UCSR_TCS_SYS_CLK); + writeb(UART_UCSR_RCS_SYS_CLK | UART_UCSR_TCS_SYS_CLK, &uart->ucsr);
- uart->umr = (UART_UMR_BC_8 | UART_UMR_PM_NONE); - uart->umr = UART_UMR_SB_STOP_BITS_1; + writeb(UART_UMR_BC_8 | UART_UMR_PM_NONE, &uart->umr); + writeb(UART_UMR_SB_STOP_BITS_1, &uart->umr);
/* Setting up BaudRate */ - counter = (u32) ((gd->bus_clk / 32) + (gd->baudrate / 2)); - counter = counter / gd->baudrate; + counter = (u32) ((gd->bus_clk / 32) + (baudrate / 2)); + counter = counter / baudrate;
/* write to CTUR: divide counter upper byte */ - uart->ubg1 = (u8) ((counter & 0xff00) >> 8); + writeb((u8)((counter & 0xff00) >> 8), &uart->ubg1); /* write to CTLR: divide counter lower byte */ - uart->ubg2 = (u8) (counter & 0x00ff); + writeb((u8)(counter & 0x00ff), &uart->ubg2);
- uart->ucr = (UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED); + writeb(UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED, &uart->ucr);
return (0); }
+static void mcf_serial_setbrg_common(uart_t *uart, int baudrate) +{ + u32 counter; + + /* Setting up BaudRate */ + counter = (u32) ((gd->bus_clk / 32) + (baudrate / 2)); + counter = counter / baudrate; + + /* write to CTUR: divide counter upper byte */ + writeb(((counter & 0xff00) >> 8), &uart->ubg1); + /* write to CTLR: divide counter lower byte */ + writeb((counter & 0x00ff), &uart->ubg2); + + writeb(UART_UCR_RESET_RX, &uart->ucr); + writeb(UART_UCR_RESET_TX, &uart->ucr); + + writeb(UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED, &uart->ucr); +} + +#ifndef CONFIG_DM_SERIAL + +static int mcf_serial_init(void) +{ + uart_t *uart_base; + int port_idx; + + uart_base = (uart_t *)CONFIG_SYS_UART_BASE; + port_idx = CONFIG_SYS_UART_PORT; + + return mcf_serial_init_common(uart_base, port_idx, gd->baudrate); +} + static void mcf_serial_putc(const char c) { - volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE); + uart_t *uart = (uart_t *)CONFIG_SYS_UART_BASE;
if (c == '\n') serial_putc('\r');
/* Wait for last character to go. */ - while (!(uart->usr & UART_USR_TXRDY)) ; + while (!(readb(&uart->usr) & UART_USR_TXRDY)) + ;
- uart->utb = c; + writeb(c, &uart->utb); }
static int mcf_serial_getc(void) { - volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE); + uart_t *uart = (uart_t *)CONFIG_SYS_UART_BASE;
/* Wait for a character to arrive. */ - while (!(uart->usr & UART_USR_RXRDY)) ; - return uart->urb; -} - -static int mcf_serial_tstc(void) -{ - volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE); + while (!(readb(&uart->usr) & UART_USR_RXRDY)) + ;
- return (uart->usr & UART_USR_RXRDY); + return readb(&uart->urb); }
static void mcf_serial_setbrg(void) { - volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE); - u32 counter; - - /* Setting up BaudRate */ - counter = (u32) ((gd->bus_clk / 32) + (gd->baudrate / 2)); - counter = counter / gd->baudrate; + uart_t *uart = (uart_t *)CONFIG_SYS_UART_BASE;
- /* write to CTUR: divide counter upper byte */ - uart->ubg1 = ((counter & 0xff00) >> 8); - /* write to CTLR: divide counter lower byte */ - uart->ubg2 = (counter & 0x00ff); + mcf_serial_setbrg_common(uart, gd->baudrate); +}
- uart->ucr = UART_UCR_RESET_RX; - uart->ucr = UART_UCR_RESET_TX; +static int mcf_serial_tstc(void) +{ + uart_t *uart = (uart_t *)CONFIG_SYS_UART_BASE;
- uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED; + return readb(&uart->usr) & UART_USR_RXRDY; }
static struct serial_device mcf_serial_drv = { @@ -128,3 +151,80 @@ __weak struct serial_device *default_serial_console(void) { return &mcf_serial_drv; } + +#endif + +#ifdef CONFIG_DM_SERIAL + +static int coldfire_serial_probe(struct udevice *dev) +{ + struct coldfire_serial_platdata *plat = dev->platdata; + + return mcf_serial_init_common((uart_t *)plat->base, + plat->port, plat->baudrate); +} + +static int coldfire_serial_putc(struct udevice *dev, const char ch) +{ + struct coldfire_serial_platdata *plat = dev->platdata; + uart_t *uart = (uart_t *)plat->base; + + /* Wait for last character to go. */ + if (!(readb(&uart->usr) & UART_USR_TXRDY)) + return -EAGAIN; + + writeb(ch, &uart->utb); + + return 0; +} + +static int coldfire_serial_getc(struct udevice *dev) +{ + struct coldfire_serial_platdata *plat = dev->platdata; + uart_t *uart = (uart_t *)(plat->base); + + /* Wait for a character to arrive. */ + if (!(readb(&uart->usr) & UART_USR_RXRDY)) + return -EAGAIN; + + return readb(&uart->urb); +} + +int coldfire_serial_setbrg(struct udevice *dev, int baudrate) +{ + struct coldfire_serial_platdata *plat = dev->platdata; + uart_t *uart = (uart_t *)(plat->base); + + mcf_serial_setbrg_common(uart, baudrate); + + return 0; +} + +static int coldfire_serial_pending(struct udevice *dev, bool input) +{ + struct coldfire_serial_platdata *plat = dev->platdata; + uart_t *uart = (uart_t *)(plat->base); + + if (input) + return readb(&uart->usr) & UART_USR_RXRDY ? 1 : 0; + else + return readb(&uart->usr) & UART_USR_TXRDY ? 0 : 1; + + return 0; +} + +static const struct dm_serial_ops coldfire_serial_ops = { + .putc = coldfire_serial_putc, + .pending = coldfire_serial_pending, + .getc = coldfire_serial_getc, + .setbrg = coldfire_serial_setbrg, +}; + +U_BOOT_DRIVER(serial_coldfire) = { + .name = "serial_coldfire", + .id = UCLASS_SERIAL, + .probe = coldfire_serial_probe, + .ops = &coldfire_serial_ops, + .flags = DM_FLAG_PRE_RELOC, +}; +#endif diff --git a/include/dm/platform_data/serial_coldfire.h b/include/dm/platform_data/serial_coldfire.h new file mode 100644 index 0000000..fc1ad71 --- /dev/null +++ b/include/dm/platform_data/serial_coldfire.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2015 Angelo Dureghello angelo@sysam.it + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __serial_coldfire_h +#define __serial_coldfire_h + +/* + * struct coldfire_serial_platdata - information about a coldfire port + * + * @base: Uart port base register address + * @port: Uart port index, for cpu with pinmux for uart / gpio + * baudrtatre: Uart port baudrate + */ +struct coldfire_serial_platdata { + unsigned long base; + int port; + int baudrate; +}; + +#endif /* __serial_coldfire_h */

On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote:
Boards can now use DM serial driver, or still legacy mcf uart driver version.
Signed-off-by: Angelo Dureghello angelo@sysam.it
Changes in v2:
- remove while loops in putc and getc, replacing with return -EAGAIN
- remove unneeded ifdef
drivers/serial/mcfuart.c | 188 ++++++++++++++++++++++------- include/dm/platform_data/serial_coldfire.h | 23 ++++ 2 files changed, 167 insertions(+), 44 deletions(-) create mode 100644 include/dm/platform_data/serial_coldfire.h
Reviewed-by: Simon Glass sjg@chromium.org

On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote:
To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
Signed-off-by: Angelo Dureghello angelo@sysam.it
Changes in v2: None
arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ arch/m68k/include/asm/config.h | 2 -- 9 files changed, 57 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

Hi Angelo,
On 27 December 2015 at 21:22, Simon Glass sjg@chromium.org wrote:
On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote:
To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
Signed-off-by: Angelo Dureghello angelo@sysam.it
Changes in v2: None
arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ arch/m68k/include/asm/config.h | 2 -- 9 files changed, 57 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Unfortunately this breaks a lot of boards so I cannot apply it:
22: m68k: add malloc memory for early malloc m68k: + M5475FFE M5475GFE M5485AFE M5475BFE M52277EVB M5485FFE M54451EVB M54418TWR_nand_rmii M54418TWR_serial_mii M5475EFE M5485CFE M54451EVB_stmicro M5485BFE M5485HFE M54418TWR_serial_rmii M5475DFE M52277EVB_stmicro M5475AFE M5485GFE M54418TWR_nand_mii eb_cpu5282_internal amcore M53017EVB M54418TWR_nand_rmii_lowfreq M54418TWR M5475CFE M5485EFE M5485DFE eb_cpu5282 +arch/m68k/cpu/mcf547x_8x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf547x_8x/start.S:153: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf547x_8x/start.S:153:(.text+0x470): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 +arch/m68k/cpu/mcf5227x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5227x/start.S:384: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf5445x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5445x/start.S:669: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf5445x/start.S:669:(.text+0x41c): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +build/../arch/m68k/cpu/mcf5227x/start.S:384:(.text+0x44a): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_after_flashbar_copy': +build/../arch/m68k/cpu/mcf52x2/start.S:203: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x494): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf530x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf530x/start.S:142: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf530x/start.S:142:(.text+0x45e): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf532x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf532x/start.S:160: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_start': +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x456): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem'
Regards, Simon

Hi Simon,
On 15/04/2016 16:14, Simon Glass wrote:
Hi Angelo,
On 27 December 2015 at 21:22, Simon Glass sjg@chromium.org wrote:
On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote:
To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
Signed-off-by: Angelo Dureghello angelo@sysam.it
Changes in v2: None
arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ arch/m68k/include/asm/config.h | 2 -- 9 files changed, 57 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Unfortunately this breaks a lot of boards so I cannot apply it:
22: m68k: add malloc memory for early malloc m68k: + M5475FFE M5475GFE M5485AFE M5475BFE M52277EVB M5485FFE M54451EVB M54418TWR_nand_rmii M54418TWR_serial_mii M5475EFE M5485CFE M54451EVB_stmicro M5485BFE M5485HFE M54418TWR_serial_rmii M5475DFE M52277EVB_stmicro M5475AFE M5485GFE M54418TWR_nand_mii eb_cpu5282_internal amcore M53017EVB M54418TWR_nand_rmii_lowfreq M54418TWR M5475CFE M5485EFE M5485DFE eb_cpu5282 +arch/m68k/cpu/mcf547x_8x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf547x_8x/start.S:153: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf547x_8x/start.S:153:(.text+0x470): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 +arch/m68k/cpu/mcf5227x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5227x/start.S:384: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf5445x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5445x/start.S:669: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf5445x/start.S:669:(.text+0x41c): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +build/../arch/m68k/cpu/mcf5227x/start.S:384:(.text+0x44a): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_after_flashbar_copy': +build/../arch/m68k/cpu/mcf52x2/start.S:203: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x494): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf530x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf530x/start.S:142: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf530x/start.S:142:(.text+0x45e): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf532x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf532x/start.S:160: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_start': +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x456): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem'
Issue was not there at that submit time, now it seems due to growing of u-boot size.
The "truncated to fit" issue is fixed with this patch.
https://patchwork.ozlabs.org/patch/609150/
So if you apply the above, and then this current, all should work.
Regards, Angelo
Regards, Simon

Hi Angelo,
On 15 April 2016 at 08:42, Angelo Dureghello angelo@sysam.it wrote:
Hi Simon,
On 15/04/2016 16:14, Simon Glass wrote:
Hi Angelo,
On 27 December 2015 at 21:22, Simon Glass sjg@chromium.org wrote:
On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote:
To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
Signed-off-by: Angelo Dureghello angelo@sysam.it
Changes in v2: None
arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ arch/m68k/include/asm/config.h | 2 -- 9 files changed, 57 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Unfortunately this breaks a lot of boards so I cannot apply it:
22: m68k: add malloc memory for early malloc m68k: + M5475FFE M5475GFE M5485AFE M5475BFE M52277EVB M5485FFE M54451EVB M54418TWR_nand_rmii M54418TWR_serial_mii M5475EFE M5485CFE M54451EVB_stmicro M5485BFE M5485HFE M54418TWR_serial_rmii M5475DFE M52277EVB_stmicro M5475AFE M5485GFE M54418TWR_nand_mii eb_cpu5282_internal amcore M53017EVB M54418TWR_nand_rmii_lowfreq M54418TWR M5475CFE M5485EFE M5485DFE eb_cpu5282 +arch/m68k/cpu/mcf547x_8x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf547x_8x/start.S:153: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf547x_8x/start.S:153:(.text+0x470): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 +arch/m68k/cpu/mcf5227x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5227x/start.S:384: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf5445x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5445x/start.S:669: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf5445x/start.S:669:(.text+0x41c): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +build/../arch/m68k/cpu/mcf5227x/start.S:384:(.text+0x44a): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_after_flashbar_copy': +build/../arch/m68k/cpu/mcf52x2/start.S:203: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x494): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf530x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf530x/start.S:142: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf530x/start.S:142:(.text+0x45e): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf532x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf532x/start.S:160: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_start': +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x456): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem'
Issue was not there at that submit time, now it seems due to growing of u-boot size.
The "truncated to fit" issue is fixed with this patch.
https://patchwork.ozlabs.org/patch/609150/
So if you apply the above, and then this current, all should work.
There is mention of a v2 patch there - is it coming?
Regards, Simon

Hi Simon,
On 15/04/2016 17:23, Simon Glass wrote:
Hi Angelo,
On 15 April 2016 at 08:42, Angelo Dureghello angelo@sysam.it wrote:
Hi Simon,
On 15/04/2016 16:14, Simon Glass wrote:
Hi Angelo,
On 27 December 2015 at 21:22, Simon Glass sjg@chromium.org wrote:
On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote:
To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
Signed-off-by: Angelo Dureghello angelo@sysam.it
Changes in v2: None
arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ arch/m68k/include/asm/config.h | 2 -- 9 files changed, 57 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Unfortunately this breaks a lot of boards so I cannot apply it:
22: m68k: add malloc memory for early malloc m68k: + M5475FFE M5475GFE M5485AFE M5475BFE M52277EVB M5485FFE M54451EVB M54418TWR_nand_rmii M54418TWR_serial_mii M5475EFE M5485CFE M54451EVB_stmicro M5485BFE M5485HFE M54418TWR_serial_rmii M5475DFE M52277EVB_stmicro M5475AFE M5485GFE M54418TWR_nand_mii eb_cpu5282_internal amcore M53017EVB M54418TWR_nand_rmii_lowfreq M54418TWR M5475CFE M5485EFE M5485DFE eb_cpu5282 +arch/m68k/cpu/mcf547x_8x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf547x_8x/start.S:153: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf547x_8x/start.S:153:(.text+0x470): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 +arch/m68k/cpu/mcf5227x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5227x/start.S:384: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf5445x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5445x/start.S:669: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf5445x/start.S:669:(.text+0x41c): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +build/../arch/m68k/cpu/mcf5227x/start.S:384:(.text+0x44a): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_after_flashbar_copy': +build/../arch/m68k/cpu/mcf52x2/start.S:203: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x494): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf530x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf530x/start.S:142: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf530x/start.S:142:(.text+0x45e): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf532x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf532x/start.S:160: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_start': +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x456): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem'
Issue was not there at that submit time, now it seems due to growing of u-boot size.
The "truncated to fit" issue is fixed with this patch.
https://patchwork.ozlabs.org/patch/609150/
So if you apply the above, and then this current, all should work.
There is mention of a v2 patch there - is it coming?
No, v2 was an attempt to fix the issue trough the linker script, but was too complex. So this is the definitive patch.
Regards, Simon
Regards, Angelo

Hi Angelo,
On 15 April 2016 at 10:38, Angelo Dureghello angelo@sysam.it wrote:
Hi Simon,
On 15/04/2016 17:23, Simon Glass wrote:
Hi Angelo,
On 15 April 2016 at 08:42, Angelo Dureghello angelo@sysam.it wrote:
Hi Simon,
On 15/04/2016 16:14, Simon Glass wrote:
Hi Angelo,
On 27 December 2015 at 21:22, Simon Glass sjg@chromium.org wrote:
On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote:
To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and call to board_init_f_mem() is added for all cpu's.
Signed-off-by: Angelo Dureghello angelo@sysam.it
Changes in v2: None
arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ arch/m68k/include/asm/config.h | 2 -- 9 files changed, 57 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Unfortunately this breaks a lot of boards so I cannot apply it:
22: m68k: add malloc memory for early malloc m68k: + M5475FFE M5475GFE M5485AFE M5475BFE M52277EVB M5485FFE M54451EVB M54418TWR_nand_rmii M54418TWR_serial_mii M5475EFE M5485CFE M54451EVB_stmicro M5485BFE M5485HFE M54418TWR_serial_rmii M5475DFE M52277EVB_stmicro M5475AFE M5485GFE M54418TWR_nand_mii eb_cpu5282_internal amcore M53017EVB M54418TWR_nand_rmii_lowfreq M54418TWR M5475CFE M5485EFE M5485DFE eb_cpu5282 +arch/m68k/cpu/mcf547x_8x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf547x_8x/start.S:153: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf547x_8x/start.S:153:(.text+0x470): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 +arch/m68k/cpu/mcf5227x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5227x/start.S:384: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf5445x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5445x/start.S:669: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf5445x/start.S:669:(.text+0x41c): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +build/../arch/m68k/cpu/mcf5227x/start.S:384:(.text+0x44a): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_after_flashbar_copy': +build/../arch/m68k/cpu/mcf52x2/start.S:203: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x494): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf530x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf530x/start.S:142: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf530x/start.S:142:(.text+0x45e): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf532x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf532x/start.S:160: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_start': +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x456): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem'
Issue was not there at that submit time, now it seems due to growing of u-boot size.
The "truncated to fit" issue is fixed with this patch.
https://patchwork.ozlabs.org/patch/609150/
So if you apply the above, and then this current, all should work.
There is mention of a v2 patch there - is it coming?
No, v2 was an attempt to fix the issue trough the linker script, but was too complex. So this is the definitive patch.
I'm not really sure what to do here - the patches do not apply cleanly to mainline. Can you please point me to the patches that should be applied, and the order? Or perhaps resend if necessary. I am trying this:
http://patchwork.ozlabs.org/bundle/sjg/dm6/
Regards, Simon

Hi Simon,
On 22/04/2016 20:33, Simon Glass wrote:
Hi Angelo,
On 15 April 2016 at 10:38, Angelo Dureghello angelo@sysam.it wrote:
Hi Simon,
On 15/04/2016 17:23, Simon Glass wrote:
Hi Angelo,
On 15 April 2016 at 08:42, Angelo Dureghello angelo@sysam.it wrote:
Hi Simon,
On 15/04/2016 16:14, Simon Glass wrote:
Hi Angelo,
On 27 December 2015 at 21:22, Simon Glass sjg@chromium.org wrote:
On 20 December 2015 at 08:54, Angelo Dureghello angelo@sysam.it wrote: > > > To use serial uclass and DM, CONFIG_SYS_MALLOC_F must be used. > So CONFIG_SYS_GENERIC_GLOBAL_DATA has been undefined and > call to board_init_f_mem() is added for all cpu's. > > Signed-off-by: Angelo Dureghello angelo@sysam.it > > --- > > Changes in v2: None > > arch/m68k/cpu/mcf5227x/start.S | 8 ++++++++ > arch/m68k/cpu/mcf523x/start.S | 8 ++++++++ > arch/m68k/cpu/mcf52x2/start.S | 8 ++++++++ > arch/m68k/cpu/mcf530x/cpu_init.c | 2 +- > arch/m68k/cpu/mcf530x/start.S | 8 ++++++++ > arch/m68k/cpu/mcf532x/start.S | 8 ++++++++ > arch/m68k/cpu/mcf5445x/start.S | 8 ++++++++ > arch/m68k/cpu/mcf547x_8x/start.S | 8 ++++++++ > arch/m68k/include/asm/config.h | 2 -- > 9 files changed, 57 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Unfortunately this breaks a lot of boards so I cannot apply it:
22: m68k: add malloc memory for early malloc m68k: + M5475FFE M5475GFE M5485AFE M5475BFE M52277EVB M5485FFE M54451EVB M54418TWR_nand_rmii M54418TWR_serial_mii M5475EFE M5485CFE M54451EVB_stmicro M5485BFE M5485HFE M54418TWR_serial_rmii M5475DFE M52277EVB_stmicro M5475AFE M5485GFE M54418TWR_nand_mii eb_cpu5282_internal amcore M53017EVB M54418TWR_nand_rmii_lowfreq M54418TWR M5475CFE M5485EFE M5485DFE eb_cpu5282 +arch/m68k/cpu/mcf547x_8x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf547x_8x/start.S:153: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf547x_8x/start.S:153:(.text+0x470): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 +arch/m68k/cpu/mcf5227x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5227x/start.S:384: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf5445x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf5445x/start.S:669: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf5445x/start.S:669:(.text+0x41c): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +build/../arch/m68k/cpu/mcf5227x/start.S:384:(.text+0x44a): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_after_flashbar_copy': +build/../arch/m68k/cpu/mcf52x2/start.S:203: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x494): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf530x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf530x/start.S:142: undefined reference to `board_init_f_mem' +build/../arch/m68k/cpu/mcf530x/start.S:142:(.text+0x45e): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem' +arch/m68k/cpu/mcf532x/start.o: In function `_start': +build/../arch/m68k/cpu/mcf532x/start.S:160: undefined reference to `board_init_f_mem' +arch/m68k/cpu/mcf52x2/start.o: In function `_start': +build/../arch/m68k/cpu/mcf52x2/start.S:203:(.text+0x456): relocation truncated to fit: R_68K_PC16 against undefined symbol `board_init_f_mem'
Issue was not there at that submit time, now it seems due to growing of u-boot size.
The "truncated to fit" issue is fixed with this patch.
https://patchwork.ozlabs.org/patch/609150/
So if you apply the above, and then this current, all should work.
There is mention of a v2 patch there - is it coming?
No, v2 was an attempt to fix the issue trough the linker script, but was too complex. So this is the definitive patch.
I'm not really sure what to do here - the patches do not apply cleanly to mainline. Can you please point me to the patches that should be applied, and the order? Or perhaps resend if necessary. I am trying this:
1) http://patchwork.ozlabs.org/patch/609150/ has already been applied to master, just tried buildman and all boards compile.
------------------------------------------------------------------------
2) http://patchwork.ozlabs.org/patch/559343/ can't apply correctly anymore due to the patch 1 above, i'll resend a new updated version.
3) http://patchwork.ozlabs.org/patch/559344/ It applies as is. But it is the 2/2 of the patch 2 above (559343), so i resend in short a patch v3 including both patches (559343 and 559344).
So you don't need to do nothing until i send v.3.
Regards, Angelo Dureghello
Regards, Simon
participants (2)
-
Angelo Dureghello
-
Simon Glass