overo: Code cleanup and reduce the size of MLO binary.
cover overo: Code cleanup and reduce the size of MLO binary.
Hi,
This set of two patches attempts to cleanup the code for board/overo.
The first patch separates the SPL-specific code from the u-boot-specific code. This prevents the unnecessary compilation of u-boot-related code in the SPL binary due to this bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54303
The resulting bloated MLO did not fit in the SRAM and hence failed
to boot. This patch reduces the MLO binary size from 60kB to 50kB.
The second patch is a fix to allow SPL to load on Overo boards with revision number >= 2410 which has been broken after v2410.10, more specifically, after the commit a6b541b09022acb6f7c2754100ae26bd44eed1d9
Arun Bharadwaj (2):
This separates the SPL-specific code from the u-boot-specific code
for the Overo board following the discussion at
http://lists.denx.de/pipermail/u-boot/2015-April/211622.html
u-boot breaks for the Overo boards since the following commit:
a6b541b09022acb6f7c2754100ae26bd44eed1d9
board/overo/Makefile | 6 +- board/overo/common.c | 310 +++++++++++++++++++++++++++++++++++++++++++++++++++ board/overo/overo.c | 119 +------------------- board/overo/overo.h | 264 ------------------------------------------- board/overo/spl.c | 94 ++++++++++++++++ 5 files changed, 412 insertions(+), 381 deletions(-) create mode 100644 board/overo/common.c create mode 100644 board/overo/spl.c
Signature · 1 line
1.9.1
PATCH 1/2 overo: Code cleanup; split into SPL-specific and u-boot-specific code
This separates the SPL-specific code from the u-boot-specific code for the Overo board following the discussion at
http://lists.denx.de/pipermail/u-boot/2015-April/211622.html
The code is split up into spl.c, overo.c and common.c (which has the code common to both)
--- board/overo/Makefile | 6 +- board/overo/common.c | 310 +++++++++++++++++++++++++++++++++++++++++++++++++++ board/overo/overo.c | 119 +------------------- board/overo/overo.h | 264 ------------------------------------------- board/overo/spl.c | 108 ++++++++++++++++++ 5 files changed, 426 insertions(+), 381 deletions(-) create mode 100644 board/overo/common.c create mode 100644 board/overo/spl.c
board/overo/Makefile +5 -1
@@ -5,4 +5,8 @@ # SPDX-License-Identifier: GPL-2.0+ # -obj-y := overo.o +ifdef CONFIG_SPL_BUILD +obj-y := spl.o common.o +else +obj-y := overo.o common.o +endif
board/overo/common.c new file +310 -0
310 lines not on this page · raw message
board/overo/overo.c +3 -116
149 lines not on this page · raw message
board/overo/overo.h +0 -264
270 lines not on this page · raw message
board/overo/spl.c new file +108 -0
108 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 1/2 overo: Code cleanup; split into SPL-specific and u-boot-specific code
Quoted 1 line · Arun Bharadwaj
-
printf("Board revision: %d\n", get_board_revision());
It is still very useful to report the board revision on boot. Could you restore this? The printf in get_board_revision doesn't appear (too early in the boot perhaps?).
--Ash
PATCH 1/2 overo: Code cleanup; split into SPL-specific and u-boot-specific code
Yes, I can move get_board_revision into common.c. Then we can retain the earlier printf.
Quoted 8 lines · Ash Charles
Quoted 1 line · Arun Bharadwaj
-
printf("Board revision: %d\n", get_board_revision());It is still very useful to report the board revision on boot. Could you restore this? The printf in
get_board_revisiondoesn't appear (too early in the boot perhaps?).--Ash
PATCH 2/2 overo: u-boot breaks for the Overo boards after v2014.10
In reply to Arun Bharadwaju-boot breaks for the Overo boards since the following
commit: a6b541b09022acb6f7c2754100ae26bd44eed1d9
This is because the gd pointer is not set early enough anymore, such that the i2c_set_bus_num in get_board_revision can safely execute. This results in a console hang at SPL and the boot does not proceed.
This piece of code is anyway necessary only for really old Overo boards with revision numbers <= 2410 and not required for the newer boards. For these older boards, u-boot v2014.10 still works fine.
--- board/overo/spl.c | 14 -------------- 1 file changed, 14 deletions(-)
board/overo/spl.c +0 -14
@@ -29,20 +29,6 @@ int get_board_revision(void) {int revision; -#ifdef CONFIG_SYS_I2C_OMAP34XX -unsigned char data; - -/* board revisions <= R2410 connect 4030 irq_1 to gpio112 */ -/* these boards should return a revision number of 0 */ -/* the code below forces a 4030 RTC irq to ensure that gpio112 is low */ -i2c_set_bus_num (TWL4030_I2C_BUS ); - data =0x01 ; -i2c_write (0x4B ,0x29 ,1 , &data,1 ); - data =0x0c ; -i2c_write (0x4B ,0x2b ,1 , &data,1 ); -i2c_read (0x4B ,0x2a ,1 , &data,1 ); -#endif -if (!gpio_request (112 ,"" ) && !gpio_request (113 ,"" ) && !gpio_request (115 ,"" )) {
Signature · 1 line
1.9.1
PATCH 2/2 overo: u-boot breaks for the Overo boards after v2014.10
Hi Arun,
I gave this patch a whirl and it works for me. As such:
--Ash
Quoted 45 lines · Arun Bharadwaj
u-boot breaks for the Overo boards since the following
commit:a6b541b09022acb6f7c2754100ae26bd44eed1d9This is because the gd pointer is not set early enough anymore, such that the
i2c_set_bus_numinget_board_revisioncan safely execute. This results in a console hang at SPL and the boot does not proceed.This piece of code is anyway necessary only for really old Overo boards with revision numbers <= 2410 and not required for the newer boards. For these older boards, u-boot v2014.10 still works fine.
Signed-off-by Arun Bharadwaj <[email protected]>--- board/overo/spl.c | 14 -------------- 1 file changed, 14 deletions(-)board/overo/spl.c +0
-15@@ -29,20 +29,6 @@ int get_board_revision(void) {int revision; -#ifdef CONFIG_SYS_I2C_OMAP34XX -unsigned char data; - -/* board revisions <= R2410 connect 4030 irq_1 to gpio112 */ -/* these boards should return a revision number of 0 */ -/* the code below forces a 4030 RTC irq to ensure that gpio112 is low */ -i2c_set_bus_num (TWL4030_I2C_BUS ); - data =0x01 ; -i2c_write (0x4B ,0x29 ,1 , &data,1 ); - data =0x0c ; -i2c_write (0x4B ,0x2b ,1 , &data,1 ); -i2c_read (0x4B ,0x2a ,1 , &data,1 ); -#endif -if (!gpio_request (112 ,"" ) && !gpio_request (113 ,"" ) && !gpio_request (115 ,"" )) { --1.9.1