spl: add ymodem support
Subsystems (2)
PATCH 1/3 spl: add ymodem support
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
--- arch/arm/cpu/arm926ejs/davinci/spl.c | 25 +++++++++++++++ common/Makefile | 4 ++- common/xyzModem.c | 55 ++++++++++++++++++++++++++++++++++ include/xyzModem.h | 5 +++ lib/Makefile | 1 + 5 files changed, 89 insertions(+), 1 deletions(-)
arch/arm/cpu/arm926ejs/davinci/spl.c +25 -0
@@ -28,6 +28,7 @@#include <ns16550.h> #include <malloc.h> #include <spi_flash.h> +#include <xyzModem.h> #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
@@ -93,4 +94,28 @@ void board_init_r(gd_t *id, ulong dummy)puts ("SPI boot...\n" );spi_boot ();#endif +#ifdef CONFIG_SPL_YMODEM_LOAD +mem_malloc_init (CONFIG_SYS_TEXT_BASE -CONFIG_SYS_MALLOC_LEN , +CONFIG_SYS_MALLOC_LEN ); + + gd = &gdata; + gd->bd = &bdata; + gd->flags |=GD_FLG_RELOC ; + gd->baudrate =CONFIG_BAUDRATE ; +serial_init ();/* serial communications setup */ + gd->have_console =1 ; + +while (1 ){ +char ch; + +while (!tstc ()){ +puts ("Ymodem boot: press Enter to continue...\n" ); +mdelay (1000 ); + } + ch =getc (); +if ((ch =='\r' ) || (ch =='\n' ))break ; + } +puts ("Ymodem boot...\n" ); +ymodem_boot (); +#endif }
common/Makefile +3 -1
@@ -188,7 +188,9 @@ COBJS-y += console.o COBJS-y += dlmalloc.o COBJS-y += memsize.o COBJS-y += stdio.o - +ifdef CONFIG_SPL_BUILD +COBJS-$(CONFIG_SPL_YMODEM_LOAD) += xyzModem.o +endif COBJS := $(sort $(COBJS-y)) XCOBJS := $(sort $(XCOBJS-y))
common/xyzModem.c +55 -0
58 lines not on this page · raw message
include/xyzModem.h +5 -0
@@ -58,6 +58,9 @@#ifndef _XYZMODEM_H_#define _XYZMODEM_H_ +#include <linux/types.h> +#include <linux/compiler.h> +#define xyzModem_xmodem 1#define xyzModem_ymodem 2/* Don't define this until the protocol support is in place */
@@ -114,4 +117,6 @@ void xyzModem_stream_terminate(bool method, int (*getc)(void));int xyzModem_stream_read (char *buf,int size,int *err);char *xyzModem_error (int err); +void ymodem_boot (void )__noreturn ; +#endif /* _XYZMODEM_H_ */
lib/Makefile +1 -0
@@ -52,6 +52,7 @@ COBJS-$(CONFIG_SHA256) += sha256.o COBJS-y += strmhz.o COBJS-$(CONFIG_RBTREE) += rbtree.o else +COBJS-$(CONFIG_SPL_YMODEM_LOAD) += crc16.o COBJS-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += display_options.o endif
Signature · 1 line
1.7.9.1
PATCH 2/3 ns16550 has a different register layout on SOC_DA8XX
also fix NS16550_init() as we need 16x divider
--- drivers/serial/ns16550.c | 2 +- include/ns16550.h | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletions(-)
drivers/serial/ns16550.c +1 -1
@@ -52,7 +52,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)serial_out ((baud_divisor >>8 ) &0xff , &com_port->dlm);serial_out (UART_LCRVAL , &com_port->lcr);#if (defined(CONFIG_OMAP ) && !defined(CONFIG_OMAP3_ZOOM2 )) || \ - defined(CONFIG_AM33XX ) + defined(CONFIG_AM33XX ) || defined(CONFIG_SOC_DA8XX )#if defined(CONFIG_APTIX )/* /13 mode so Aptix 6MHz can hit 115200 */
include/ns16550.h +9 -0
@@ -46,6 +46,14 @@ struct NS16550 {UART_REG (lsr);/* 5 */ UART_REG (msr);/* 6 */ UART_REG (spr);/* 7 */ +#ifdef CONFIG_SOC_DA8XX +UART_REG (reg8);/* 8 */ +UART_REG (reg9);/* 9 */ +UART_REG (revid1);/* A */ +UART_REG (revid2);/* B */ +UART_REG (pwr_mgmt);/* C */ +UART_REG (mdr1);/* D */ +#else UART_REG (mdr1);/* 8 */ UART_REG (reg9);/* 9 */ UART_REG (regA);/* A */
@@ -58,6 +66,7 @@ struct NS16550 {UART_REG (ssr);/* 11*/ UART_REG (reg12);/* 12*/ UART_REG (osc_12m_sel);/* 13*/ +#endif };#define thr rbr
Signature · 1 line
1.7.9.1
PATCH 3/3 arm/davinci/da850: add uart0 pinmux
In reply to Mikhail Kshevetskiy--- arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c | 5 +++++ arch/arm/include/asm/arch-davinci/hardware.h | 1 + arch/arm/include/asm/arch-davinci/pinmux_defs.h | 1 + 3 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/davinci/da850_pinmux.c +5 -0
@@ -35,6 +35,11 @@ const struct pinmux_config spi1_pins_scs0[] = { };/* UART pin muxer settings */ +const struct pinmux_config uart0_pins_txrx[] = { + {pinmux (3 ),2 ,4 },/* UART0_RXD */ + {pinmux (3 ),2 ,5 },/* UART0_TXD */ +}; +const struct pinmux_config uart1_pins_txrx[] = { {pinmux (4 ),2 ,6 },/* UART1_RXD */ {pinmux (4 ),2 ,7 },/* UART1_TXD */
arch/arm/include/asm/arch-davinci/hardware.h +1 -0
@@ -447,6 +447,7 @@ struct davinci_pllc_regs {/* Clock IDs */ enum davinci_clk_ids {DAVINCI_SPI0_CLKID =2 , +DAVINCI_UART0_CLKID =2 ,DAVINCI_UART2_CLKID =2 ,DAVINCI_MMC_CLKID =2 ,DAVINCI_MDIO_CLKID =4 ,
arch/arm/include/asm/arch-davinci/pinmux_defs.h +1 -0
@@ -28,6 +28,7 @@ extern const struct pinmux_config spi1_pins_base[3];extern const struct pinmux_config spi1_pins_scs0[1 ];/* UART pin muxer settings */ +extern const struct pinmux_config uart0_pins_txrx[2 ];extern const struct pinmux_config uart1_pins_txrx[2 ];extern const struct pinmux_config uart2_pins_txrx[2 ];extern const struct pinmux_config uart2_pins_rtscts[2 ];
Signature · 1 line
1.7.9.1
PATCH 1/3 spl: add ymodem support
In reply to Mikhail KshevetskiyQuoted 5 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
---
Quoted 8 lines
?arch/arm/cpu/arm926ejs/davinci/spl.c | ? 25 +++++++++++++++ ?common/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?4 ++- ?common/xyzModem.c ? ? ? ? ? ? ? ? ? ?| ? 55 ++++++++++++++++++++++++++++++++++ ?include/xyzModem.h ? ? ? ? ? ? ? ? ? | ? ?5 +++ ?lib/Makefile ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +?5 files changed, 89 insertions(+), 1 deletions(-)
Signed-off-by Mikhail Kshevetskiy <[email protected]>
Your Signed-off-by line should be placed above the --- line.
Same applies for the other patches.
PATCH 1/3 spl: add ymodem support
Quoted 14 lines · On Tue, 6 Mar 2012 18:34:05 -0300 Fabio Estevam <[email protected]> wrote:
Quoted 12 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
---?arch/arm/cpu/arm926ejs/davinci/spl.c | ? 25 +++++++++++++++ ?common/Makefile ? ? ? ? ? ? ? ? ? ? ?| ? ?4 ++- ?common/xyzModem.c ? ? ? ? ? ? ? ? ? ?| ? 55 ++++++++++++++++++++++++++++++++++ ?include/xyzModem.h ? ? ? ? ? ? ? ? ? | ? ?5 +++ ?lib/Makefile ? ? ? ? ? ? ? ? ? ? ? ? | ? ?1 +?5 files changed, 89 insertions(+), 1 deletions(-)
Quoted 5 lines
Quoted 1 line
Signed-off-by Mikhail Kshevetskiy <[email protected]>Your Signed-off-by line should be placed above the --- line.
Same applies for the other patches.
fix and resend?
PATCH 1/3 spl: add ymodem support
In reply to Mikhail KshevetskiyQuoted 4 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
Dear Mikhail,
I am asking mainly out of curiousity, rather than giving feedback on the patch, but the OMAP-L138 boot ROM has the capability to load both SPL and U-Boot into empty SPI flash using the UART and sfh program or equivalent. (sfh is "serial flash host" for those following along, a program to talk to the boot ROM over the UART and download some code that the boot ROM can burn into SPI flash).
What is the advantage in allowing the SPL to flash U-Boot also?
Many thanks, and bye for now,
Signature · 3 lines
Laurence Withers, <[email protected]> http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: <[email protected]> CMG-DCM CMG-EAM CMG-NAM
PATCH 1/3 spl: add ymodem support
Quoted 8 lines · On Tue, 6 Mar 2012 22:28:46 +0000 Laurence Withers <[email protected]> wrote:
Quoted 4 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
Dear Mikhail,
Quoted 8 lines
I am asking mainly out of curiousity, rather than giving feedback on the patch, but the OMAP-L138 boot ROM has the capability to load both SPL and U-Boot into empty SPI flash using the UART and sfh program or equivalent. (sfh is "serial flash host" for those following along, a program to talk to the boot ROM over the UART and download some code that the boot ROM can burn into SPI flash).
What is the advantage in allowing the SPL to flash U-Boot also?
sfh and boot rom does not understand our flash.
Quoted 6 lines
Many thanks, and bye for now,
Signature · 3 lines
Laurence Withers, <[email protected]> http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: <[email protected]> CMG-DCM CMG-EAM CMG-NAM
PATCH 1/3 spl: add ymodem support
In reply to Mikhail KshevetskiyQuoted 4 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
This conflicts a bit with the SPL ymodem support that's now in u-boot-arm/master and making its way into mainline. Please rebase (and perhaps play some Makefile magic games to get arch/arm/cpu/armv7/omap-common/spl_ymodem.c available to davinci, and yes, we all know we need to unify more of the SPL codebase).
Signature · 1 line
Tom
PATCH 1/3 spl: add ymodem support
Quoted 7 lines · On Wed, 7 Mar 2012 08:25:39 -0700 Tom Rini <[email protected]> wrote:
Quoted 4 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
Quoted 5 lines
This conflicts a bit with the SPL ymodem support that's now in u-boot-arm/master and making its way into mainline. Please rebase (and perhaps play some
Makefilemagic games to getarch/arm/cpu/armv7/omap-common/spl_ymodem.cavailable to davinci, and yes, we all know we need to unify more of the SPL codebase).
Hm, spl_ymodem_load_image() should be arch independent, so I suggest moving it and getcymodem() out from arch/arm/cpu/armv7/omap-common/spl_ymodem.c to common/xyzModem.c (similarly to my patch).
any comments, suggestions?
Mikhail
Quoted 3 lines
Signature · 2 lines
-- Tom
PATCH 1/3 spl: add ymodem support
Quoted 16 lines · Mikhail Kshevetskiy
Quoted 7 lines · On Wed, 7 Mar 2012 08:25:39 -0700 Tom Rini <[email protected]> wrote:
Quoted 4 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
Quoted 5 lines
This conflicts a bit with the SPL ymodem support that's now in u-boot-arm/master and making its way into mainline. ?Please rebase (and perhaps play some
Makefilemagic games to getarch/arm/cpu/armv7/omap-common/spl_ymodem.cavailable to davinci, and yes, we all know we need to unify more of the SPL codebase).
Quoted 5 lines
Hm,
spl_ymodem_load_image()should be arch independent, so I suggest moving it andgetcymodem()out fromarch/arm/cpu/armv7/omap-common/spl_ymodem.ctocommon/xyzModem.c(similarly to my patch).any comments, suggestions?
Stefano is working on trying to unify SPL, but the first step is getting the SPL loads Linux patch series in.
Signature · 1 line
Tom
PATCH 1/3 spl: add ymodem support
Hi,
Quoted 9 lines · Mikhail Kshevetskiy
Quoted 6 lines · On Tue, 6 Mar 2012 22:28:46 +0000 Laurence Withers <[email protected]> wrote:
Quoted 4 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
Quoted 6 lines
Quoted 6 lines
Dear Mikhail,
I am asking mainly out of curiousity, rather than giving feedback on the patch, but the OMAP-L138 boot ROM has the capability to load both SPL and U-Boot into empty SPI flash using the UART and sfh program or equivalent. (sfh is "serial flash host" for those following along, a program to talk
to
Quoted 1 line
Quoted 1 line
the boot ROM over the UART and download some code that the boot ROM can
burn
Quoted 2 lines
Quoted 2 lines
into SPI flash).
It's a combination of boot ROM and a programmer code (sfh) that is downloaded to the SoC and does the actual lowlevel config of the chip and the programming to flash. This code must be adapted (and maintained) for custom boards.
Quoted 4 lines
Quoted 1 line
What is the advantage in allowing the SPL to flash U-Boot also?
sfh and boot rom does not understand our flash.
So there is also another advantage: You can use the same lowlevel initialization code for downloading code and for normal operation, you will only need to maintain u-boot for your board.
Christian
PATCH 1/3 spl: add ymodem support
In reply to Tom RiniQuoted 18 lines · Tom Rini
Quoted 16 lines · Mikhail Kshevetskiy
Quoted 12 lines · On Wed, 7 Mar 2012 08:25:39 -0700 Tom Rini <[email protected]> wrote:
Quoted 4 lines · Mikhail Kshevetskiy
We have an omap l138 based board without jtag and empty spi flash. UART is an only way to load something on this board, so we are using uart to load spl image u-boot and then we are using ymodem to load the rest part of u-boot.
This conflicts a bit with the SPL ymodem support that's now in u-boot-arm/master and making its way into mainline. Please rebase (and perhaps play some
Makefilemagic games to getarch/arm/cpu/armv7/omap-common/spl_ymodem.cavailable to davinci, and yes, we all know we need to unify more of the SPL codebase).
Quoted 8 lines
Quoted 5 lines
Hm,
spl_ymodem_load_image()should be arch independent, so I suggest moving it andgetcymodem()out fromarch/arm/cpu/armv7/omap-common/spl_ymodem.ctocommon/xyzModem.c(similarly to my patch).any comments, suggestions?
Stefano is working on trying to unify SPL, but the first step is getting the SPL loads Linux patch series in.
Yes - I have already tried to factorize SPL to make it common for all SOCs, but I broke some boards and discussing with Tom we decided that it is better to proceed step by step.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================