cm-fx6 updates
v2 cover cm-fx6 updates
This patchset contains a bug fix for DRAM detection, support for Phison SSD, and a new preboot hook.
Changes in V2:
- Added board_preboot_os to bootm.h
- Split "common: introduce board_preboot_os hook" into 2 patches
Nikita Kiryanov (4):
arm: mx6: cm_fx6: change issd gpio order
arm: mx6: cm_fx6: detect 1GB DRAM correctly on solo
common: introduce board_preboot_os hook
arm: mx6: cm_fx6: power down sata on OS boot
board/compulab/cm_fx6/cm_fx6.c | 8 +++++++- board/compulab/cm_fx6/spl.c | 7 ++++--- common/bootm_os.c | 7 +++++++ include/bootm.h | 1 + 4 files changed, 19 insertions(+), 4 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/4 arm: mx6: cm_fx6: change issd gpio order
Change the order in which GPIOs are toggled in SATA init sequence to accomodate both SanDisk and Phison SSDs.
--- board/compulab/cm_fx6/cm_fx6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/compulab/cm_fx6/cm_fx6.c +1 -1
@@ -31,12 +31,12 @@ DECLARE_GLOBAL_DATA_PTR;#ifdef CONFIG_DWC_AHSATA static int cm_fx6_issd_gpios[] = {/* The order of the GPIOs in the array is important! */ +CM_FX6_SATA_LDO_EN ,CM_FX6_SATA_PHY_SLP ,CM_FX6_SATA_NRSTDLY ,CM_FX6_SATA_PWREN ,CM_FX6_SATA_NSTANDBY1 ,CM_FX6_SATA_NSTANDBY2 , -CM_FX6_SATA_LDO_EN , };static void cm_fx6_sata_power (int on)
Signature · 1 line
1.9.1
PATCH v2 1/4 arm: mx6: cm_fx6: change issd gpio order
Forgot the changelog:
Quoted 7 lines · Nikita Kiryanov
Change the order in which GPIOs are toggled in SATA init sequence to accomodate both SanDisk and Phison SSDs.
Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>---
Changes in V2:
- No changes.
Quoted 22 lines
board/compulab/cm_fx6/cm_fx6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/compulab/cm_fx6/cm_fx6.c +1
-1@@ -31,12 +31,12 @@ DECLARE_GLOBAL_DATA_PTR;#ifdef CONFIG_DWC_AHSATA static int cm_fx6_issd_gpios[] = {/* The order of the GPIOs in the array is important! */ +CM_FX6_SATA_LDO_EN ,CM_FX6_SATA_PHY_SLP ,CM_FX6_SATA_NRSTDLY ,CM_FX6_SATA_PWREN ,CM_FX6_SATA_NSTANDBY1 ,CM_FX6_SATA_NSTANDBY2 , -CM_FX6_SATA_LDO_EN , };static void cm_fx6_sata_power (int on)
Signature · 2 lines
Regards, Nikita Kiryanov
PATCH v2 1/4 arm: mx6: cm_fx6: change issd gpio order
In reply to Nikita KiryanovQuoted 6 lines · Nikita Kiryanov
Change the order in which GPIOs are toggled in SATA init sequence to accomodate both SanDisk and Phison SSDs.
Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>
Signature · 2 lines
Regards, Igor.
PATCH v2 2/4 arm: mx6: cm_fx6: detect 1GB DRAM correctly on solo
In reply to Nikita KiryanovThe 1GB DRAM configuration on mx6 solo uses 2 chip selects, but the code tests 1GB DRAM configuration as if it is all present on one chip select, and thus cannot see the full range of available memory.
Refactor the check to detect 1GB DRAM correctly.
--- board/compulab/cm_fx6/spl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
board/compulab/cm_fx6/spl.c +4 -3
@@ -235,10 +235,11 @@ static int cm_fx6_spl_dram_init(void)spl_mx6s_dram_init (DDR_32BIT_1GB , false); bank1_size =get_ram_size ((long int *)PHYS_SDRAM_1 ,0x80000000 ); -if (bank1_size ==0x40000000 ) -return 0 ; - + bank2_size =get_ram_size ((long int *)PHYS_SDRAM_2 ,0x80000000 );if (bank1_size ==0x20000000 ) { +if (bank2_size ==0x20000000 ) +return 0 ; +spl_mx6s_dram_init (DDR_32BIT_512MB , true);return 0 ; }
Signature · 1 line
1.9.1
PATCH v2 2/4 arm: mx6: cm_fx6: detect 1GB DRAM correctly on solo
Forgot the changelog:
Quoted 10 lines · Nikita Kiryanov
The 1GB DRAM configuration on mx6 solo uses 2 chip selects, but the code tests 1GB DRAM configuration as if it is all present on one chip select, and thus cannot see the full range of available memory.
Refactor the check to detect 1GB DRAM correctly.
Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>---
Changes in V2:
- No changes.
Quoted 23 lines
board/compulab/cm_fx6/spl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)board/compulab/cm_fx6/spl.c +4
-3@@ -235,10 +235,11 @@ static int cm_fx6_spl_dram_init(void)spl_mx6s_dram_init (DDR_32BIT_1GB , false); bank1_size =get_ram_size ((long int *)PHYS_SDRAM_1 ,0x80000000 ); -if (bank1_size ==0x40000000 ) -return 0 ; - + bank2_size =get_ram_size ((long int *)PHYS_SDRAM_2 ,0x80000000 );if (bank1_size ==0x20000000 ) { +if (bank2_size ==0x20000000 ) +return 0 ; +spl_mx6s_dram_init (DDR_32BIT_512MB , true);return 0 ; }
Signature · 2 lines
Regards, Nikita Kiryanov
PATCH v2 2/4 arm: mx6: cm_fx6: detect 1GB DRAM correctly on solo
In reply to Nikita KiryanovQuoted 9 lines · Nikita Kiryanov
The 1GB DRAM configuration on mx6 solo uses 2 chip selects, but the code tests 1GB DRAM configuration as if it is all present on one chip select, and thus cannot see the full range of available memory.
Refactor the check to detect 1GB DRAM correctly.
Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>
Signature · 2 lines
Regards, Igor.
PATCH v2 3/4 common: introduce board_preboot_os hook
In reply to Nikita KiryanovIntroduce board specific function board_preboot_os() to allow for board specific config before we boot.
---
Changes in V2:
- Added board_preboot_os to bootm.h
- Split cm_fx6 stuff into a separate patch
common/bootm_os.c | 7 +++++++ include/bootm.h | 1 + 2 files changed, 8 insertions(+)
common/bootm_os.c +7 -0
@@ -442,10 +442,17 @@ __weak void arch_preboot_os(void)/* please define platform specific arch_preboot_os() */ } +/* Allow for board specific config before we boot */ +__weak void board_preboot_os (void ) +{ +/* please define board specific board_preboot_os() */ +} +int boot_selected_os (int argc,char *const argv[],int state,bootm_headers_t *images,boot_os_fn *boot_fn) {arch_preboot_os (); +board_preboot_os ();boot_fn (state, argc, argv, images);/* Stand-alone may return when 'autostart' is 'no' */
include/bootm.h +1 -0
@@ -55,5 +55,6 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], int states, bootm_headers_t *images, int boot_progress);void arch_preboot_os (void ); +void board_preboot_os (void );#endif
Signature · 1 line
1.9.1
PATCH v2 3/4 common: introduce board_preboot_os hook
Quoted 9 lines · Nikita Kiryanov
Introduce board specific function
board_preboot_os()to allow for board specific config before we boot.Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>Cc Tom Rini <[email protected]>Cc Jeroen Hofstee <[email protected]>Cc Otavio Salvador <[email protected]>
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
PATCH v2 3/4 common: introduce board_preboot_os hook
In reply to Nikita KiryanovQuoted 9 lines · Nikita Kiryanov
Introduce board specific function
board_preboot_os()to allow for board specific config before we boot.Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>Cc Tom Rini <[email protected]>Cc Jeroen Hofstee <[email protected]>Cc Otavio Salvador <[email protected]>
Signature · 2 lines
Regards, Igor.
PATCH v2 3/4 common: introduce board_preboot_os hook
In reply to Nikita KiryanovHi Nikita,
Quoted 9 lines · Nikita Kiryanov
Introduce board specific function
board_preboot_os()to allow for board specific config before we boot.Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>Cc Tom Rini <[email protected]>Cc Jeroen Hofstee <[email protected]>Cc Otavio Salvador <[email protected]>
Quoted 9 lines
---
Changes in V2:
- Addedboard_preboot_ostobootm.h
- Splitcm_fx6stuff into a separate patchcommon/bootm_os.c | 7 +++++++ include/bootm.h | 1 + 2 files changed, 8 insertions(+)
There is something that does not convince me. Really, the general statement should be to turn all devices off before booting the kernel, because this is what Linux expects. That said, this could be later solved with dm, because we will can iterate through all drivers and call a shutdown function.
Currently, "preboot" functions are turning off the hardware, so the name is already misleading. And I see that arch_preboot_os() was also convinced (because it is weak) to become a board_preboot, for example
here: board/renesas/koelsch/koelsch.c (and in other renesas implementation, too).
I have some concerns adding a new weak function, that enables some further hooks inside board code. I find it not well scalable. In your case, you need such as sata_shutdown(), and it should be responsibility of the general sata code to call something specific for the board, if necessary.
In current code, bootm_disable_interrupts() calls also usb_stop() and eth_halt(), - nothing to do with the name of the function. IMHO it should be better to move the code to shutdown interface inside boot_selected_os(), or having a common function "disable_hardware()" that calls usb_stop(), eth_halt() and then, why not, a sata_stop().
There is also in arch/arm/imx-common/cpu.c a derived implementation for arch_preboot_os(). Really it has nothing to do with arch, as I can see:
it shuts down only the IPU. But it is another hook, and IMHO it is better stopping sata here as adding a hidden callback.
Best regards,
Stefano Babic
Quoted 34 lines
common/bootm_os.c +7
-0@@ -442,10 +442,17 @@ __weak void arch_preboot_os(void)/* please define platform specific arch_preboot_os() */ } +/* Allow for board specific config before we boot */ +__weak void board_preboot_os (void ) +{ +/* please define board specific board_preboot_os() */ +} +int boot_selected_os (int argc,char *const argv[],int state,bootm_headers_t *images,boot_os_fn *boot_fn) {arch_preboot_os (); +board_preboot_os ();boot_fn (state, argc, argv, images);/* Stand-alone may return when 'autostart' is 'no' */ include/bootm.h +1
-0@@ -55,5 +55,6 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], int states, bootm_headers_t *images, int boot_progress);void arch_preboot_os (void ); +void board_preboot_os (void );#endif
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 v2 3/4 common: introduce board_preboot_os hook
Hi Stefano,
Quoted 46 lines · Stefano Babic
Hi Nikita,
Quoted 9 lines · Nikita Kiryanov
Introduce board specific function
board_preboot_os()to allow for board specific config before we boot.Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>Cc Tom Rini <[email protected]>Cc Jeroen Hofstee <[email protected]>Cc Otavio Salvador <[email protected]>Quoted 9 lines
---
Changes in V2:
- Addedboard_preboot_ostobootm.h
- Splitcm_fx6stuff into a separate patchcommon/bootm_os.c | 7 +++++++ include/bootm.h | 1 + 2 files changed, 8 insertions(+)There is something that does not convince me. Really, the general statement should be to turn all devices off before booting the kernel, because this is what Linux expects. That said, this could be later solved with dm, because we will can iterate through all drivers and call a shutdown function.
Currently, "preboot" functions are turning off the hardware, so the name is already misleading. And I see that
arch_preboot_os()was also convinced (because it is weak) to become aboard_preboot, for example
here:board/renesas/koelsch/koelsch.c(and in other renesas implementation, too).I have some concerns adding a new weak function, that enables some further hooks inside board code. I find it not well scalable. In your case, you need such as
sata_shutdown(), and it should be responsibility of the general sata code to call something specific for the board, if necessary.In current code,
bootm_disable_interrupts()calls alsousb_stop()andeth_halt(), - nothing to do with the name of the function. IMHO it should be better to move the code to shutdown interface insideboot_selected_os(), or having a common function "disable_hardware()" that callsusb_stop(),eth_halt()and then, why not, asata_stop().
Quoted 4 lines
There is also in
arch/arm/imx-common/cpu.ca derived implementation forarch_preboot_os(). Really it has nothing to do with arch, as I can see:
it shuts down only the IPU. But it is another hook, and IMHO it is better stopping sata here as adding a hidden callback.
You make some good points.
I'll switch to using arch_preboot_os until there's a better way of doing this.
Signature · 2 lines
Regards, Nikita Kiryanov
PATCH v2 4/4 arm: mx6: cm_fx6: power down sata on OS boot
In reply to Nikita KiryanovIf sata is used by U-Boot, the Linux kernel fails to detect the ssd correctly afterwards. Power off sata on OS boot so that Linux will have a clean state to work with.
---
Changes in V2:
- New patch split off the previous patch.
board/compulab/cm_fx6/cm_fx6.c | 6 ++++++ 1 file changed, 6 insertions(+)
board/compulab/cm_fx6/cm_fx6.c +6 -0
@@ -15,6 +15,7 @@#include <netdev.h> #include <fdt_support.h> #include <sata.h> +#include <bootm.h> #include <asm/arch/crm_regs.h> #include <asm/arch/sys_proto.h> #include <asm/arch/iomux.h>
@@ -125,6 +126,11 @@ int sata_initialize(void) return err; } + +void board_preboot_os (void ) +{ +cm_fx6_sata_power (0 ); +}#else static int cm_fx6_setup_issd (void ) {return 0 ; }#endif
Signature · 1 line
1.9.1
PATCH v2 4/4 arm: mx6: cm_fx6: power down sata on OS boot
Quoted 10 lines · Nikita Kiryanov
If sata is used by U-Boot, the Linux kernel fails to detect the ssd correctly afterwards. Power off sata on OS boot so that Linux will have a clean state to work with.
Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>Cc Jeroen Hofstee <[email protected]>Cc Otavio Salvador <[email protected]>---
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
PATCH v2 4/4 arm: mx6: cm_fx6: power down sata on OS boot
In reply to Nikita KiryanovQuoted 9 lines · Nikita Kiryanov
If sata is used by U-Boot, the Linux kernel fails to detect the ssd correctly afterwards. Power off sata on OS boot so that Linux will have a clean state to work with.
Signed-off-by Nikita Kiryanov <[email protected]>Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>Cc Jeroen Hofstee <[email protected]>Cc Otavio Salvador <[email protected]>
Signature · 2 lines
Regards, Igor.
v2 cover cm-fx6 updates
In reply to Nikita KiryanovQuoted 6 lines · Nikita Kiryanov
This patchset contains a bug fix for DRAM detection, support for Phison SSD, and a new preboot hook.
Cc Igor Grinberg <[email protected]>Cc Stefano Babic <[email protected]>
Quoted 7 lines
Changes in V2:
- Addedboard_preboot_ostobootm.h
- Split "common: introduceboard_preboot_oshook" into 2 patchesNikita Kiryanov (4):
arm: mx6:cm_fx6: change issd gpio order
arm: mx6:cm_fx6: detect 1GB DRAM correctly on solo
First two patches 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 =====================================================================