diff mbox

[U-Boot,v2,2/8] nios2: move altera_pio_init to board_early_init_r

Message ID 1441369343-4638-3-git-send-email-thomas@wytron.com.tw
State Superseded
Delegated to: Thomas Chou
Headers show

Commit Message

Thomas Chou Sept. 4, 2015, 12:22 p.m. UTC
As altera_pio_init() uses BSS, it should be moved to
board_early_init_r().

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 board/altera/nios2-generic/nios2-generic.c | 13 +++++++++----
 include/configs/nios2-generic.h            |  1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

Comments

Marek Vasut Sept. 4, 2015, 1:55 p.m. UTC | #1
On Friday, September 04, 2015 at 02:22:17 PM, Thomas Chou wrote:
> As altera_pio_init() uses BSS, it should be moved to
> board_early_init_r().
> 
> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>

Shouldn't this be part of arch_cpu_init() instead ?

Best regards,
Marek Vasut
Thomas Chou Sept. 5, 2015, 12:16 a.m. UTC | #2
Hi Marek,

On 09/04/2015 09:55 PM, Marek Vasut wrote:
> On Friday, September 04, 2015 at 02:22:17 PM, Thomas Chou wrote:
>> As altera_pio_init() uses BSS, it should be moved to
>> board_early_init_r().
>>
>> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
>
> Shouldn't this be part of arch_cpu_init() instead ?

This is per board setup. Each board might has a different PIO configuration.

Regards,
Thomas Chou
Marek Vasut Sept. 5, 2015, 12:54 a.m. UTC | #3
On Saturday, September 05, 2015 at 02:16:20 AM, Thomas Chou wrote:
> Hi Marek,
> 
> On 09/04/2015 09:55 PM, Marek Vasut wrote:
> > On Friday, September 04, 2015 at 02:22:17 PM, Thomas Chou wrote:
> >> As altera_pio_init() uses BSS, it should be moved to
> >> board_early_init_r().
> >> 
> >> Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
> > 
> > Shouldn't this be part of arch_cpu_init() instead ?
> 
> This is per board setup. Each board might has a different PIO
> configuration.

OK, I see what you're doing here now. I agree.

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index 834cbeb..384fee9 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -28,6 +28,15 @@  void early_flash_cmd_reset(void)
 
 int board_early_init_f(void)
 {
+#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
+    defined(CONFIG_CFI_FLASH_MTD)
+	early_flash_cmd_reset();
+#endif
+	return 0;
+}
+
+int board_early_init_r(void)
+{
 #ifdef CONFIG_ALTERA_PIO
 #ifdef LED_PIO_BASE
 	altera_pio_init(LED_PIO_BASE, LED_PIO_WIDTH, 'o',
@@ -35,10 +44,6 @@  int board_early_init_f(void)
 			"led");
 #endif
 #endif
-#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
-    defined(CONFIG_CFI_FLASH_MTD)
-	early_flash_cmd_reset();
-#endif
 	return 0;
 }
 
diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h
index 5bb7768..293acae 100644
--- a/include/configs/nios2-generic.h
+++ b/include/configs/nios2-generic.h
@@ -15,6 +15,7 @@ 
 #include "../board/altera/nios2-generic/custom_fpga.h" /* fpga parameters */
 #define CONFIG_BOARD_NAME "nios2-generic" /* custom board name */
 #define CONFIG_BOARD_EARLY_INIT_F	/* enable early board-spec. init */
+#define CONFIG_BOARD_EARLY_INIT_R
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_DISPLAY_BOARDINFO
 #define CONFIG_SYS_NIOS_SYSID_BASE	CONFIG_SYS_SYSID_BASE