tqma6: improvements and cleanup
cover tqma6: improvements and cleanup
From: Markus Niebel <[email protected]>
This series contains some cosmetic and code cleanups. No functional changes.
resend because of typo in Mailaddress.
Markus Niebel (4):
tqma6: (cosmetic) remove CONFIG_FLASH_SECTOR_SIZE
tqma6: add missing include
tqma6: add warning on failed setup_i2c
tqma6: use imx_ddr_size
board/tqc/tqma6/tqma6.c | 13 ++++++++++--- board/tqc/tqma6/tqma6_mba6.c | 10 ++++++++-- include/configs/tqma6.h | 28 ++++++++++++++-------------- 3 files changed, 32 insertions(+), 19 deletions(-)
Signature · 1 line
2.1.1
PATCH 1/4 tqma6: (cosmetic) remove CONFIG_FLASH_SECTOR_SIZE
From: Markus Niebel <[email protected]>
This is nowhere documented and only used
by two other boards. Replace it withTQMA6_SPI_FLASH_SECTOR_SIZE.
--- include/configs/tqma6.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
include/configs/tqma6.h +14 -14
@@ -68,6 +68,8 @@#define CONFIG_SPI_FLASH #define CONFIG_SPI_FLASH_STMICRO +#define TQMA6_SPI_FLASH_SECTOR_SIZE SZ_64K +#define CONFIG_CMD_SF #define CONFIG_SF_DEFAULT_BUS 0#define CONFIG_SF_DEFAULT_CS 0
@@ -275,12 +277,10 @@#elif defined(CONFIG_TQMA6X_SPI_BOOT ) -#define CONFIG_FLASH_SECTOR_SIZE 0x10000 -#define TQMA6_UBOOT_OFFSET 0x400#define TQMA6_UBOOT_SECTOR_START 0x0/* max u-boot size: 512k */ -#define TQMA6_UBOOT_SECTOR_SIZE CONFIG_FLASH_SECTOR_SIZE +#define TQMA6_UBOOT_SECTOR_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE#define TQMA6_UBOOT_SECTOR_COUNT 0x8#define TQMA6_UBOOT_SIZE (TQMA6_UBOOT_SECTOR_SIZE * \ TQMA6_UBOOT_SECTOR_COUNT)
@@ -288,7 +288,7 @@#define CONFIG_ENV_IS_IN_SPI_FLASH #define CONFIG_SYS_REDUNDAND_ENVIRONMENT #define CONFIG_ENV_OFFSET (TQMA6_UBOOT_SIZE) -#define CONFIG_ENV_SECT_SIZE CONFIG_FLASH_SECTOR_SIZE +#define CONFIG_ENV_SECT_SIZE TQMA6_SPI_FLASH_SECTOR_SIZE#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + \ CONFIG_ENV_SECT_SIZE)
@@ -299,7 +299,7 @@#define TQMA6_FDT_OFFSET (CONFIG_ENV_OFFSET_REDUND + \ CONFIG_ENV_SECT_SIZE) -#define TQMA6_FDT_SECT_SIZE (CONFIG_FLASH_SECTOR_SIZE) +#define TQMA6_FDT_SECT_SIZE (TQMA6_SPI_FLASH_SECTOR_SIZE)#define TQMA6_FDT_SECTOR_START 0x0a/* 8 Sector u-boot, 2 Sector env */ #define TQMA6_FDT_SECTOR_COUNT 0x01
@@ -320,7 +320,7 @@"setexpr blkc ${filesize} + " \ __stringify(TQMA6_UBOOT_OFFSET) "; " \"setexpr size ${uboot_sectors} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"if itest ${blkc} <= ${size}; then " \"sf probe; " \"sf erase 0 ${size}; " \
@@ -332,9 +332,9 @@"update_kernel=run kernel_name; if tftp ${kernel}; then " \"if itest ${filesize} > 0; then " \"setexpr size ${kernel_sectors} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"setexpr offset ${kernel_start} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"if itest ${filesize} <= ${size}; then " \"sf probe; " \"sf erase ${offset} ${size}; " \
@@ -346,9 +346,9 @@"update_fdt=if tftp ${fdt_file}; then " \"if itest ${filesize} > 0; then " \"setexpr size ${fdt_sectors} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"setexpr offset ${fdt_start} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"if itest ${filesize} <= ${size}; then " \"sf probe; " \"sf erase ${offset} ${size}; " \
@@ -359,16 +359,16 @@"setenv filesize 0; setenv size ; setenv offset\0" \"loadimage=sf probe; " \"setexpr size ${kernel_sectors} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"setexpr offset ${kernel_start} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"sf read ${loadaddr} ${offset} ${size}; " \"setenv size ; setenv offset\0" \"loadfdt=sf probe; " \"setexpr size ${fdt_sectors} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"setexpr offset ${fdt_start} * " \ - __stringify(CONFIG_FLASH_SECTOR_SIZE)"; " \ + __stringify(TQMA6_SPI_FLASH_SECTOR_SIZE)"; " \"sf read ${${fdt_addr}} ${offset} ${size}; " \"setenv size ; setenv offset\0" \
Signature · 1 line
2.1.1
PATCH 1/4 tqma6: (cosmetic) remove CONFIG_FLASH_SECTOR_SIZE
Quoted 8 lines · Markus Niebel
From: Markus Niebel <[email protected]>
This is nowhere documented and only used
by two other boards. Replace it withTQMA6_SPI_FLASH_SECTOR_SIZE.Signed-off-by Markus Niebel <[email protected]>---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 2/4 tqma6: add missing include
In reply to Markus NiebelFrom: Markus Niebel <[email protected]>
Add include needed to have prototype for board_spi_cs_gpio
--- board/tqc/tqma6/tqma6.c | 1 + 1 file changed, 1 insertion(+)
board/tqc/tqma6/tqma6.c +1 -0
@@ -17,6 +17,7 @@#include <asm/gpio.h> #include <asm/io.h> #include <asm/imx-common/mxc_i2c.h> +#include <asm/imx-common/spi.h> #include <common.h> #include <fsl_esdhc.h> #include <libfdt.h>
Signature · 1 line
2.1.1
PATCH 2/4 tqma6: add missing include
Quoted 15 lines · Markus Niebel
From: Markus Niebel <[email protected]>
Add include needed to have prototype for
board_spi_cs_gpioSigned-off-by Markus Niebel <[email protected]>--- board/tqc/tqma6/tqma6.c | 1 + 1 file changed, 1 insertion(+)board/tqc/tqma6/tqma6.c +0
-0
board/tqc/tqma6/tqma6.c line 23
Quoted 7 lines
board/tqc/tqma6/tqma6.c +1
-0@@ -17,6 +17,7 @@#include <asm/gpio.h> #include <asm/io.h> #include <asm/imx-common/mxc_i2c.h> +#include <asm/imx-common/spi.h> #include <common.h> #include <fsl_esdhc.h> #include <libfdt.h>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 3/4 tqma6: add warning on failed setup_i2c
In reply to Markus NiebelFrom: Markus Niebel <[email protected]>
setup_i2c has a return value. Use it to give feedback on error.
--- board/tqc/tqma6/tqma6.c | 10 ++++++++-- board/tqc/tqma6/tqma6_mba6.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
board/tqc/tqma6/tqma6.c +8 -2
@@ -181,8 +181,14 @@ static struct i2c_pads_info tqma6_i2c3_pads = {static void tqma6_setup_i2c (void ) { -/* use logical index for bus, e.g. I2C1 -> 0 */ -setup_i2c (2 ,CONFIG_SYS_I2C_SPEED ,0x7f , &tqma6_i2c3_pads); +int ret; +/* +* use logical index for bus, e.g. I2C1 -> 0 +* warn on error +*/ + ret =setup_i2c (2 ,CONFIG_SYS_I2C_SPEED ,0x7f , &tqma6_i2c3_pads); +if (ret) +printf ("setup I2C3 failed: %d\n" , ret); }int board_early_init_f (void )
board/tqc/tqma6/tqma6_mba6.c +8 -2
@@ -224,8 +224,14 @@ static struct i2c_pads_info mba6_i2c1_pads = {static void mba6_setup_i2c (void ) { -/* use logical index for bus, e.g. I2C1 -> 0 */ -setup_i2c (0 ,CONFIG_SYS_I2C_SPEED ,0x7f , &mba6_i2c1_pads); +int ret; +/* +* use logical index for bus, e.g. I2C1 -> 0 +* warn on error +*/ + ret =setup_i2c (0 ,CONFIG_SYS_I2C_SPEED ,0x7f , &mba6_i2c1_pads); +if (ret) +printf ("setup I2C1 failed: %d\n" , ret); }
Signature · 1 line
2.1.1
PATCH 3/4 tqma6: add warning on failed setup_i2c
Quoted 7 lines · Markus Niebel
From: Markus Niebel <[email protected]>
setup_i2chas a return value. Use it to give feedback on error.Signed-off-by Markus Niebel <[email protected]>---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 4/4 tqma6: use imx_ddr_size
In reply to Markus NiebelFrom: Markus Niebel <[email protected]>
--- board/tqc/tqma6/tqma6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/tqc/tqma6/tqma6.c +1 -1
@@ -51,7 +51,7 @@ DECLARE_GLOBAL_DATA_PTR;int dram_init (void ) { - gd->ram_size =get_ram_size ((void *)PHYS_SDRAM ,PHYS_SDRAM_SIZE ); + gd->ram_size =imx_ddr_size ();return 0 ; }
Signature · 1 line
2.1.1
PATCH 4/4 tqma6: use imx_ddr_size
Quoted 4 lines · Markus Niebel
From: Markus Niebel <[email protected]>
Signed-off-by Markus Niebel <[email protected]>---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
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-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================