* [U-Boot] [PATCH 0/3] cm-fx6 updates for Utilite
@ 2015-09-02 16:05 Nikita Kiryanov
2015-09-02 16:05 ` [U-Boot] [PATCH 1/3] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Nikita Kiryanov @ 2015-09-02 16:05 UTC (permalink / raw)
To: u-boot
This series provides a fix necessary for early models of Utilite, a miniature
desktop based on CM-FX6. It implements a dynamic modification to the device tree
that is necessary for mmc boot.
Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Nikita Kiryanov (3):
compulab: eeprom: select i2c bus when querying for board rev
compulab: eeprom: add support for obtaining product name
arm: mx6: cm-fx6: modify device tree for old revisions of utilite
board/compulab/cm_fx6/cm_fx6.c | 18 +++++++++++++++++-
board/compulab/cm_t35/cm_t35.c | 2 +-
board/compulab/common/eeprom.c | 23 +++++++++++++++++++++--
board/compulab/common/eeprom.h | 9 +++++++--
4 files changed, 46 insertions(+), 6 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [U-Boot] [PATCH 1/3] compulab: eeprom: select i2c bus when querying for board rev 2015-09-02 16:05 [U-Boot] [PATCH 0/3] cm-fx6 updates for Utilite Nikita Kiryanov @ 2015-09-02 16:05 ` Nikita Kiryanov 2015-09-03 8:35 ` Igor Grinberg 2015-09-02 16:05 ` [U-Boot] [PATCH 2/3] compulab: eeprom: add support for obtaining product name Nikita Kiryanov 2015-09-02 16:05 ` [U-Boot] [PATCH 3/3] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov 2 siblings, 1 reply; 7+ messages in thread From: Nikita Kiryanov @ 2015-09-02 16:05 UTC (permalink / raw) To: u-boot Add support for selecting which eeprom is queried for board revision by extending cl_eeprom_get_board_rev() to accept an i2c bus number. Cc: Stefano Babic <sbabic@denx.de> Cc: Igor Grinberg <grinberg@compulab.co.il> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> --- board/compulab/cm_fx6/cm_fx6.c | 2 +- board/compulab/cm_t35/cm_t35.c | 2 +- board/compulab/common/eeprom.c | 4 ++-- board/compulab/common/eeprom.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c index 3ad1216..572111d 100644 --- a/board/compulab/cm_fx6/cm_fx6.c +++ b/board/compulab/cm_fx6/cm_fx6.c @@ -708,7 +708,7 @@ int dram_init(void) u32 get_board_rev(void) { - return cl_eeprom_get_board_rev(); + return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS); } static struct mxc_serial_platdata cm_fx6_mxc_serial_plat = { diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c index 398c573..26c6a81 100644 --- a/board/compulab/cm_t35/cm_t35.c +++ b/board/compulab/cm_t35/cm_t35.c @@ -105,7 +105,7 @@ int board_init(void) */ u32 get_board_rev(void) { - return cl_eeprom_get_board_rev(); + return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS); }; int misc_init_r(void) diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c index 77bcea4..aaacd2e 100644 --- a/board/compulab/common/eeprom.c +++ b/board/compulab/common/eeprom.c @@ -121,7 +121,7 @@ static u32 board_rev; * Routine: cl_eeprom_get_board_rev * Description: read system revision from eeprom */ -u32 cl_eeprom_get_board_rev(void) +u32 cl_eeprom_get_board_rev(uint eeprom_bus) { char str[5]; /* Legacy representation can contain at most 4 digits */ uint offset = BOARD_REV_OFFSET_LEGACY; @@ -129,7 +129,7 @@ u32 cl_eeprom_get_board_rev(void) if (board_rev) return board_rev; - if (cl_eeprom_setup(CONFIG_SYS_I2C_EEPROM_BUS)) + if (cl_eeprom_setup(eeprom_bus)) return 0; if (cl_eeprom_layout != LAYOUT_LEGACY) diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h index 50c6b02..e74c379 100644 --- a/board/compulab/common/eeprom.h +++ b/board/compulab/common/eeprom.h @@ -12,13 +12,13 @@ #ifdef CONFIG_SYS_I2C int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus); -u32 cl_eeprom_get_board_rev(void); +u32 cl_eeprom_get_board_rev(uint eeprom_bus); #else static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) { return 1; } -static inline u32 cl_eeprom_get_board_rev(void) +static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus) { return 0; } -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/3] compulab: eeprom: select i2c bus when querying for board rev 2015-09-02 16:05 ` [U-Boot] [PATCH 1/3] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov @ 2015-09-03 8:35 ` Igor Grinberg 0 siblings, 0 replies; 7+ messages in thread From: Igor Grinberg @ 2015-09-03 8:35 UTC (permalink / raw) To: u-boot Hi Nikita, On 09/02/15 19:05, Nikita Kiryanov wrote: > Add support for selecting which eeprom is queried for board revision by > extending cl_eeprom_get_board_rev() to accept an i2c bus number. > > Cc: Stefano Babic <sbabic@denx.de> > Cc: Igor Grinberg <grinberg@compulab.co.il> > Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Acked-by: Igor Grinberg <grinberg@compulab.co.il> > --- > board/compulab/cm_fx6/cm_fx6.c | 2 +- > board/compulab/cm_t35/cm_t35.c | 2 +- > board/compulab/common/eeprom.c | 4 ++-- > board/compulab/common/eeprom.h | 4 ++-- > 4 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c > index 3ad1216..572111d 100644 > --- a/board/compulab/cm_fx6/cm_fx6.c > +++ b/board/compulab/cm_fx6/cm_fx6.c > @@ -708,7 +708,7 @@ int dram_init(void) > > u32 get_board_rev(void) > { > - return cl_eeprom_get_board_rev(); > + return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS); > } > > static struct mxc_serial_platdata cm_fx6_mxc_serial_plat = { > diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c > index 398c573..26c6a81 100644 > --- a/board/compulab/cm_t35/cm_t35.c > +++ b/board/compulab/cm_t35/cm_t35.c > @@ -105,7 +105,7 @@ int board_init(void) > */ > u32 get_board_rev(void) > { > - return cl_eeprom_get_board_rev(); > + return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS); > }; > > int misc_init_r(void) > diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c > index 77bcea4..aaacd2e 100644 > --- a/board/compulab/common/eeprom.c > +++ b/board/compulab/common/eeprom.c > @@ -121,7 +121,7 @@ static u32 board_rev; > * Routine: cl_eeprom_get_board_rev > * Description: read system revision from eeprom > */ > -u32 cl_eeprom_get_board_rev(void) > +u32 cl_eeprom_get_board_rev(uint eeprom_bus) > { > char str[5]; /* Legacy representation can contain at most 4 digits */ > uint offset = BOARD_REV_OFFSET_LEGACY; > @@ -129,7 +129,7 @@ u32 cl_eeprom_get_board_rev(void) > if (board_rev) > return board_rev; > > - if (cl_eeprom_setup(CONFIG_SYS_I2C_EEPROM_BUS)) > + if (cl_eeprom_setup(eeprom_bus)) > return 0; > > if (cl_eeprom_layout != LAYOUT_LEGACY) > diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h > index 50c6b02..e74c379 100644 > --- a/board/compulab/common/eeprom.h > +++ b/board/compulab/common/eeprom.h > @@ -12,13 +12,13 @@ > > #ifdef CONFIG_SYS_I2C > int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus); > -u32 cl_eeprom_get_board_rev(void); > +u32 cl_eeprom_get_board_rev(uint eeprom_bus); > #else > static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) > { > return 1; > } > -static inline u32 cl_eeprom_get_board_rev(void) > +static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus) > { > return 0; > } > -- Regards, Igor. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/3] compulab: eeprom: add support for obtaining product name 2015-09-02 16:05 [U-Boot] [PATCH 0/3] cm-fx6 updates for Utilite Nikita Kiryanov 2015-09-02 16:05 ` [U-Boot] [PATCH 1/3] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov @ 2015-09-02 16:05 ` Nikita Kiryanov 2015-09-03 8:45 ` Igor Grinberg 2015-09-02 16:05 ` [U-Boot] [PATCH 3/3] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov 2 siblings, 1 reply; 7+ messages in thread From: Nikita Kiryanov @ 2015-09-02 16:05 UTC (permalink / raw) To: u-boot Introduce cl_eeprom_get_product_name() for obtaining product name from the eeprom. Cc: Stefano Babic <sbabic@denx.de> Cc: Igor Grinberg <grinberg@compulab.co.il> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> --- board/compulab/common/eeprom.c | 19 +++++++++++++++++++ board/compulab/common/eeprom.h | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c index aaacd2e..a48da93 100644 --- a/board/compulab/common/eeprom.c +++ b/board/compulab/common/eeprom.c @@ -25,6 +25,8 @@ #define BOARD_REV_OFFSET 0 #define BOARD_REV_OFFSET_LEGACY 6 #define BOARD_REV_SIZE 2 +#define BOARD_PRODUCT_NAME_OFFSET 128 +#define BOARD_PRODUCT_NAME_SIZE 16 #define MAC_ADDR_OFFSET 4 #define MAC_ADDR_OFFSET_LEGACY 0 @@ -149,3 +151,20 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus) return board_rev; }; + +static char product_name[BOARD_PRODUCT_NAME_SIZE]; +char *cl_eeprom_get_product_name(uint eeprom_bus) +{ + if (cl_eeprom_setup(eeprom_bus)) + return NULL; + + if (cl_eeprom_read(BOARD_PRODUCT_NAME_OFFSET, + (uchar *)product_name, BOARD_PRODUCT_NAME_SIZE)) { + return NULL; + } + + /* Protect ourselves from invalid data (unterminated string) */ + product_name[BOARD_PRODUCT_NAME_SIZE - 1] = '\0'; + + return product_name; +} diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h index e74c379..fceb5df 100644 --- a/board/compulab/common/eeprom.h +++ b/board/compulab/common/eeprom.h @@ -13,6 +13,7 @@ #ifdef CONFIG_SYS_I2C int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus); u32 cl_eeprom_get_board_rev(uint eeprom_bus); +char *cl_eeprom_get_product_name(uint eeprom_bus); #else static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) { @@ -22,6 +23,10 @@ static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus) { return 0; } +static inline char *cl_eeprom_get_product_name(uint eeprom_bus) +{ + return NULL; +} #endif #endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/3] compulab: eeprom: add support for obtaining product name 2015-09-02 16:05 ` [U-Boot] [PATCH 2/3] compulab: eeprom: add support for obtaining product name Nikita Kiryanov @ 2015-09-03 8:45 ` Igor Grinberg 0 siblings, 0 replies; 7+ messages in thread From: Igor Grinberg @ 2015-09-03 8:45 UTC (permalink / raw) To: u-boot Hi Nikita, On 09/02/15 19:05, Nikita Kiryanov wrote: > Introduce cl_eeprom_get_product_name() for obtaining product name > from the eeprom. > > Cc: Stefano Babic <sbabic@denx.de> > Cc: Igor Grinberg <grinberg@compulab.co.il> > Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> > --- > board/compulab/common/eeprom.c | 19 +++++++++++++++++++ > board/compulab/common/eeprom.h | 5 +++++ > 2 files changed, 24 insertions(+) > > diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c > index aaacd2e..a48da93 100644 > --- a/board/compulab/common/eeprom.c > +++ b/board/compulab/common/eeprom.c > @@ -25,6 +25,8 @@ > #define BOARD_REV_OFFSET 0 > #define BOARD_REV_OFFSET_LEGACY 6 > #define BOARD_REV_SIZE 2 > +#define BOARD_PRODUCT_NAME_OFFSET 128 > +#define BOARD_PRODUCT_NAME_SIZE 16 Please, can we make it shorter like with the MAC_ADDR? e.g. PRODUCT_NAME_* > #define MAC_ADDR_OFFSET 4 > #define MAC_ADDR_OFFSET_LEGACY 0 > > @@ -149,3 +151,20 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus) > > return board_rev; > }; > + > +static char product_name[BOARD_PRODUCT_NAME_SIZE]; That variable does not serve any good purpose... > +char *cl_eeprom_get_product_name(uint eeprom_bus) > +{ > + if (cl_eeprom_setup(eeprom_bus)) > + return NULL; > + > + if (cl_eeprom_read(BOARD_PRODUCT_NAME_OFFSET, > + (uchar *)product_name, BOARD_PRODUCT_NAME_SIZE)) { > + return NULL; > + } > + > + /* Protect ourselves from invalid data (unterminated string) */ > + product_name[BOARD_PRODUCT_NAME_SIZE - 1] = '\0'; > + > + return product_name; > +} I'd like to see this function implemented as the cl_eeprom_read_mac_addr() function is. > diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h > index e74c379..fceb5df 100644 > --- a/board/compulab/common/eeprom.h > +++ b/board/compulab/common/eeprom.h > @@ -13,6 +13,7 @@ > #ifdef CONFIG_SYS_I2C > int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus); > u32 cl_eeprom_get_board_rev(uint eeprom_bus); > +char *cl_eeprom_get_product_name(uint eeprom_bus); > #else > static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus) > { > @@ -22,6 +23,10 @@ static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus) > { > return 0; > } > +static inline char *cl_eeprom_get_product_name(uint eeprom_bus) > +{ > + return NULL; > +} > #endif > > #endif > -- Regards, Igor. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 3/3] arm: mx6: cm-fx6: modify device tree for old revisions of utilite 2015-09-02 16:05 [U-Boot] [PATCH 0/3] cm-fx6 updates for Utilite Nikita Kiryanov 2015-09-02 16:05 ` [U-Boot] [PATCH 1/3] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov 2015-09-02 16:05 ` [U-Boot] [PATCH 2/3] compulab: eeprom: add support for obtaining product name Nikita Kiryanov @ 2015-09-02 16:05 ` Nikita Kiryanov 2015-09-03 8:57 ` Igor Grinberg 2 siblings, 1 reply; 7+ messages in thread From: Nikita Kiryanov @ 2015-09-02 16:05 UTC (permalink / raw) To: u-boot Old revisions of Utilite (a miniature PC based on cm-fx6) do not have a card detect for mmc, and thus the kernel needs to be told that there's a persistent storage on usdhc3 to force it to probe the mmc card. Check the baseboard revision and modify the device tree accordingly if needed. Cc: Stefano Babic <sbabic@denx.de> Cc: Igor Grinberg <grinberg@compulab.co.il> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> --- board/compulab/cm_fx6/cm_fx6.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c index 572111d..c8e980d 100644 --- a/board/compulab/cm_fx6/cm_fx6.c +++ b/board/compulab/cm_fx6/cm_fx6.c @@ -582,6 +582,10 @@ int cm_fx6_setup_ecspi(void) { return 0; } #ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup(void *blob, bd_t *bd) { + u32 baseboard_rev; + int nodeoffset; + const char *usdhc3_path = "/soc/aips-bus at 02100000/usdhc at 02198000/"; + char *baseboard_name; uint8_t enetaddr[6]; /* MAC addr */ @@ -596,6 +600,18 @@ int ft_board_setup(void *blob, bd_t *bd) enetaddr, 6, 1); } + baseboard_name = cl_eeprom_get_product_name(0); + baseboard_rev = cl_eeprom_get_board_rev(0); + if (!strncmp("SB-FX6m", baseboard_name, 7) && baseboard_rev <= 120) { + fdt_shrink_to_minimum(blob); /* Make room for new properties */ + nodeoffset = fdt_path_offset(blob, usdhc3_path); + fdt_delprop(blob, nodeoffset, "cd-gpios"); + fdt_find_and_setprop(blob, usdhc3_path, "non-removable", + NULL, 0, 1); + fdt_find_and_setprop(blob, usdhc3_path, "keep-power-in-suspend", + NULL, 0, 1); + } + return 0; } #endif -- 1.9.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 3/3] arm: mx6: cm-fx6: modify device tree for old revisions of utilite 2015-09-02 16:05 ` [U-Boot] [PATCH 3/3] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov @ 2015-09-03 8:57 ` Igor Grinberg 0 siblings, 0 replies; 7+ messages in thread From: Igor Grinberg @ 2015-09-03 8:57 UTC (permalink / raw) To: u-boot On 09/02/15 19:05, Nikita Kiryanov wrote: > Old revisions of Utilite (a miniature PC based on cm-fx6) do not have > a card detect for mmc, and thus the kernel needs to be told that > there's a persistent storage on usdhc3 to force it to probe the mmc > card. > > Check the baseboard revision and modify the device tree accordingly > if needed. > > Cc: Stefano Babic <sbabic@denx.de> > Cc: Igor Grinberg <grinberg@compulab.co.il> > Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> > --- > board/compulab/cm_fx6/cm_fx6.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c > index 572111d..c8e980d 100644 > --- a/board/compulab/cm_fx6/cm_fx6.c > +++ b/board/compulab/cm_fx6/cm_fx6.c > @@ -582,6 +582,10 @@ int cm_fx6_setup_ecspi(void) { return 0; } > #ifdef CONFIG_OF_BOARD_SETUP > int ft_board_setup(void *blob, bd_t *bd) > { > + u32 baseboard_rev; > + int nodeoffset; > + const char *usdhc3_path = "/soc/aips-bus at 02100000/usdhc at 02198000/"; I would really like to see this path discovered dynamically... Is it possible? If not, then may be define? > + char *baseboard_name; > uint8_t enetaddr[6]; > > /* MAC addr */ > @@ -596,6 +600,18 @@ int ft_board_setup(void *blob, bd_t *bd) > enetaddr, 6, 1); > } > > + baseboard_name = cl_eeprom_get_product_name(0); Once you will change the patch 2/3, this will also need to be changed. > + baseboard_rev = cl_eeprom_get_board_rev(0); > + if (!strncmp("SB-FX6m", baseboard_name, 7) && baseboard_rev <= 120) { > + fdt_shrink_to_minimum(blob); /* Make room for new properties */ > + nodeoffset = fdt_path_offset(blob, usdhc3_path); > + fdt_delprop(blob, nodeoffset, "cd-gpios"); > + fdt_find_and_setprop(blob, usdhc3_path, "non-removable", > + NULL, 0, 1); > + fdt_find_and_setprop(blob, usdhc3_path, "keep-power-in-suspend", > + NULL, 0, 1); > + } > + > return 0; > } > #endif > -- Regards, Igor. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-09-03 8:57 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-09-02 16:05 [U-Boot] [PATCH 0/3] cm-fx6 updates for Utilite Nikita Kiryanov 2015-09-02 16:05 ` [U-Boot] [PATCH 1/3] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov 2015-09-03 8:35 ` Igor Grinberg 2015-09-02 16:05 ` [U-Boot] [PATCH 2/3] compulab: eeprom: add support for obtaining product name Nikita Kiryanov 2015-09-03 8:45 ` Igor Grinberg 2015-09-02 16:05 ` [U-Boot] [PATCH 3/3] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov 2015-09-03 8:57 ` Igor Grinberg
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox