Skip to contentSkip to conversation

board: ast2400: Enable SGPIO in SCU

PATCH In review Willy Tu 2 participants 6 messages Apr 13, 2021 – May 27, 2021

Subsystems (3)
lore
Share & tools
lore

Willy Tu

author
#0 lore raw

PATCH 1/1 board: ast2400: Enable SGPIO in SCU

Add option to enable register for SGPIO in SCU.

Included new function register values for ast2400
SCU and enable the SGPIO function in board init.

---
 arch/arm/include/asm/arch-aspeed/scu_ast2400.h |  4 ++++
 arch/arm/mach-aspeed/ast2400/Kconfig           |  4 ++++
 arch/arm/mach-aspeed/ast2400/board_common.c    | 15 +++++++++++++++
 3 files changed, 23 insertions(+)
arch/arm/include/asm/arch-aspeed/scu_ast2400.h +4 -0
index 9c5d96ae84..17eaaf3e9d 100644
@@ -75,6 +75,10 @@
 #define SCU_PIN_FUN_SCL2		(1 << 14)
 #define SCU_PIN_FUN_SDA1		(1 << 13)
 #define SCU_PIN_FUN_SDA2		(1 << 15)
+#define SCU_PIN_FUN_SGPMCK		(0x1 << 8)
+#define SCU_PIN_FUN_SGPMLD		(0x1 << 9)
+#define SCU_PIN_FUN_SGPMO		(0x1 << 10)
+#define SCU_PIN_FUN_SGPMI		(0x1 << 11)
 
 #define SCU_D2PLL_EXT1_OFF		(1 << 0)
 #define SCU_D2PLL_EXT1_BYPASS		(1 << 1)
arch/arm/mach-aspeed/ast2400/Kconfig +4 -0
index f76276860c..c4e88b5140 100644
@@ -17,6 +17,10 @@ config TARGET_EVB_AST2400
 	  20 pin JTAG, pinouts for 14 I2Cs, 3 SPIs and eSPI, 8 PWMs.
 endchoice
 
+config ENABLE_SGPIO
+    tristate "Enable SGPIO in SCU"
+	default n
+
 source "board/aspeed/evb_ast2400/Kconfig"
 
 endif
arch/arm/mach-aspeed/ast2400/board_common.c +15 -0
index 3829b06934..eca2ef03e5 100644
@@ -14,6 +14,21 @@ __weak int board_init(void)
 {
 	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
+#ifdef CONFIG_ENABLE_SGPIO
+#define SCU_BASE 0x1e6e2000
+#define SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+	/* Unlock SCU */
+	writel(SCU_UNLOCK_VALUE, SCU_BASE);
+
+	/* Enable SGPIO Master */
+	u32 reg = readl(SCU_BASE + SCU_FUN_PIN_CTRL2);
+
+	reg |= (SCU_PIN_FUN_SGPMI  |
+			SCU_PIN_FUN_SGPMO  |
+			SCU_PIN_FUN_SGPMLD |
+			SCU_PIN_FUN_SGPMCK);
+	writel(reg, SCU_BASE + SCU_FUN_PIN_CTRL2);
+#endif
 	return 0;
 }
 
Signature · 1 line
2.31.1.295.g9ea45b61b8-goog
maintainer
#1 lore raw

Hi Willy,

Quoted 5 lines · Willy Tu

Add option to enable register for SGPIO in SCU.

Included new function register values for ast2400
SCU and enable the SGPIO function in board init.

Which branch would you like this patch applied to?

Quoted 67 lines
---
 arch/arm/include/asm/arch-aspeed/scu_ast2400.h |  4 ++++
 arch/arm/mach-aspeed/ast2400/Kconfig           |  4 ++++
 arch/arm/mach-aspeed/ast2400/board_common.c    | 15 +++++++++++++++
 3 files changed, 23 insertions(+)
arch/arm/include/asm/arch-aspeed/scu_ast2400.h +4 -0
index 9c5d96ae84..17eaaf3e9d 100644
@@ -75,6 +75,10 @@
 #define SCU_PIN_FUN_SCL2               (1 << 14)
 #define SCU_PIN_FUN_SDA1               (1 << 13)
 #define SCU_PIN_FUN_SDA2               (1 << 15)
+#define SCU_PIN_FUN_SGPMCK             (0x1 << 8)
+#define SCU_PIN_FUN_SGPMLD             (0x1 << 9)
+#define SCU_PIN_FUN_SGPMO              (0x1 << 10)
+#define SCU_PIN_FUN_SGPMI              (0x1 << 11)
 
 #define SCU_D2PLL_EXT1_OFF             (1 << 0)
 #define SCU_D2PLL_EXT1_BYPASS          (1 << 1)
arch/arm/mach-aspeed/ast2400/Kconfig +4 -0
index f76276860c..c4e88b5140 100644
@@ -17,6 +17,10 @@ config TARGET_EVB_AST2400
          20 pin JTAG, pinouts for 14 I2Cs, 3 SPIs and eSPI, 8 PWMs.
 endchoice
 
+config ENABLE_SGPIO
+    tristate "Enable SGPIO in SCU"
+       default n
+
 source "board/aspeed/evb_ast2400/Kconfig"
 
 endif
arch/arm/mach-aspeed/ast2400/board_common.c +15 -1
index 3829b06934..eca2ef03e5 100644
@@ -14,6 +14,21 @@ __weak int board_init(void)
 {
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
+#ifdef CONFIG_ENABLE_SGPIO
+#define SCU_BASE 0x1e6e2000
+#define SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+       /* Unlock SCU */
+       writel(SCU_UNLOCK_VALUE, SCU_BASE);
+
+       /* Enable SGPIO Master */
+       u32 reg = readl(SCU_BASE + SCU_FUN_PIN_CTRL2);
+
+       reg |= (SCU_PIN_FUN_SGPMI  |
+                       SCU_PIN_FUN_SGPMO  |
+                       SCU_PIN_FUN_SGPMLD |
+                       SCU_PIN_FUN_SGPMCK);
+       writel(reg, SCU_BASE + SCU_FUN_PIN_CTRL2);
+#endif
        return 0;
 }
 
--

2.31.1.295.g9ea45b61b8-goog

author
#2 lore raw

Hi Joel,

thanks for the response.

Sorry, I did not update the patch to include the branch name. I'll be more careful next time.

This change should be in v2019.04-aspeed-openbmc and the other patch in
https://lore.kernel.org/openbmc/[email protected]/
should
be in v2016.07-aspeed-openbmc.

I have not tested this change, but have tested
https://lore.kernel.org/openbmc/[email protected]/ that I based off of (Which I have tested with my setup). Will that be an issue?

Best,

Willy Tu

Quoted 82 lines · Joel Stanley

Hi Willy,

Quoted 5 lines · Willy Tu

Add option to enable register for SGPIO in SCU.

Included new function register values for ast2400
SCU and enable the SGPIO function in board init.

Which branch would you like this patch applied to?

Review

Quoted 9 lines
---
 arch/arm/include/asm/arch-aspeed/scu_ast2400.h |  4 ++++
 arch/arm/mach-aspeed/ast2400/Kconfig           |  4 ++++
 arch/arm/mach-aspeed/ast2400/board_common.c    | 15 +++++++++++++++
 3 files changed, 23 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-aspeed/scu_ast2400.h

Review

Quoted 15 lines

index 9c5d96ae84..17eaaf3e9d 100644

arch/arm/include/asm/arch-aspeed/scu_ast2400.h +4 -0
@@ -75,6 +75,10 @@
 #define SCU_PIN_FUN_SCL2               (1 << 14)
 #define SCU_PIN_FUN_SDA1               (1 << 13)
 #define SCU_PIN_FUN_SDA2               (1 << 15)
+#define SCU_PIN_FUN_SGPMCK             (0x1 << 8)
+#define SCU_PIN_FUN_SGPMLD             (0x1 << 9)
+#define SCU_PIN_FUN_SGPMO              (0x1 << 10)
+#define SCU_PIN_FUN_SGPMI              (0x1 << 11)
 
 #define SCU_D2PLL_EXT1_OFF             (1 << 0)
 #define SCU_D2PLL_EXT1_BYPASS          (1 << 1)
(quoted diff) +0 -0

b/arch/arm/mach-aspeed/ast2400/Kconfig

Review

Quoted 15 lines

index f76276860c..c4e88b5140 100644

arch/arm/mach-aspeed/ast2400/Kconfig +4 -0
@@ -17,6 +17,10 @@ config TARGET_EVB_AST2400
          20 pin JTAG, pinouts for 14 I2Cs, 3 SPIs and eSPI, 8 PWMs.
 endchoice
 
+config ENABLE_SGPIO
+    tristate "Enable SGPIO in SCU"
+       default n
+
 source "board/aspeed/evb_ast2400/Kconfig"
 
 endif
(quoted diff) +0 -0

b/arch/arm/mach-aspeed/ast2400/board_common.c

Quoted 28 lines

index 3829b06934..eca2ef03e5 100644

arch/arm/mach-aspeed/ast2400/board_common.c +15 -1
@@ -14,6 +14,21 @@ __weak int board_init(void)
 {
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
+#ifdef CONFIG_ENABLE_SGPIO
+#define SCU_BASE 0x1e6e2000
+#define SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+       /* Unlock SCU */
+       writel(SCU_UNLOCK_VALUE, SCU_BASE);
+
+       /* Enable SGPIO Master */
+       u32 reg = readl(SCU_BASE + SCU_FUN_PIN_CTRL2);
+
+       reg |= (SCU_PIN_FUN_SGPMI  |
+                       SCU_PIN_FUN_SGPMO  |
+                       SCU_PIN_FUN_SGPMLD |
+                       SCU_PIN_FUN_SGPMCK);
+       writel(reg, SCU_BASE + SCU_FUN_PIN_CTRL2);
+#endif
        return 0;
 }
 
--

2.31.1.295.g9ea45b61b8-goog

author
#3 lore raw

ping

Quoted 104 lines · Willy Tu

Hi Joel,

thanks for the response.

Sorry, I did not update the patch to include the branch name. I'll be more careful next time.

This change should be in v2019.04-aspeed-openbmc and the other patch in
https://lore.kernel.org/openbmc/[email protected]/ should be in v2016.07-aspeed-openbmc.

I have not tested this change, but have tested
https://lore.kernel.org/openbmc/[email protected]/ that I based off of (Which I have tested with my setup). Will that be an issue?

Best,

Willy Tu

Quoted 82 lines · Joel Stanley

Hi Willy,

Quoted 5 lines · Willy Tu

Add option to enable register for SGPIO in SCU.

Included new function register values for ast2400
SCU and enable the SGPIO function in board init.

Which branch would you like this patch applied to?

Review

Quoted 9 lines
---
 arch/arm/include/asm/arch-aspeed/scu_ast2400.h |  4 ++++
 arch/arm/mach-aspeed/ast2400/Kconfig           |  4 ++++
 arch/arm/mach-aspeed/ast2400/board_common.c    | 15 +++++++++++++++
 3 files changed, 23 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-aspeed/scu_ast2400.h

Review

Quoted 15 lines

index 9c5d96ae84..17eaaf3e9d 100644

arch/arm/include/asm/arch-aspeed/scu_ast2400.h +4 -0
@@ -75,6 +75,10 @@
 #define SCU_PIN_FUN_SCL2               (1 << 14)
 #define SCU_PIN_FUN_SDA1               (1 << 13)
 #define SCU_PIN_FUN_SDA2               (1 << 15)
+#define SCU_PIN_FUN_SGPMCK             (0x1 << 8)
+#define SCU_PIN_FUN_SGPMLD             (0x1 << 9)
+#define SCU_PIN_FUN_SGPMO              (0x1 << 10)
+#define SCU_PIN_FUN_SGPMI              (0x1 << 11)
 
 #define SCU_D2PLL_EXT1_OFF             (1 << 0)
 #define SCU_D2PLL_EXT1_BYPASS          (1 << 1)
(quoted diff) +0 -0

b/arch/arm/mach-aspeed/ast2400/Kconfig

Review

Quoted 15 lines

index f76276860c..c4e88b5140 100644

arch/arm/mach-aspeed/ast2400/Kconfig +4 -0
@@ -17,6 +17,10 @@ config TARGET_EVB_AST2400
          20 pin JTAG, pinouts for 14 I2Cs, 3 SPIs and eSPI, 8 PWMs.
 endchoice
 
+config ENABLE_SGPIO
+    tristate "Enable SGPIO in SCU"
+       default n
+
 source "board/aspeed/evb_ast2400/Kconfig"
 
 endif
(quoted diff) +0 -0

b/arch/arm/mach-aspeed/ast2400/board_common.c

Quoted 28 lines

index 3829b06934..eca2ef03e5 100644

arch/arm/mach-aspeed/ast2400/board_common.c +15 -1
@@ -14,6 +14,21 @@ __weak int board_init(void)
 {
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
+#ifdef CONFIG_ENABLE_SGPIO
+#define SCU_BASE 0x1e6e2000
+#define SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+       /* Unlock SCU */
+       writel(SCU_UNLOCK_VALUE, SCU_BASE);
+
+       /* Enable SGPIO Master */
+       u32 reg = readl(SCU_BASE + SCU_FUN_PIN_CTRL2);
+
+       reg |= (SCU_PIN_FUN_SGPMI  |
+                       SCU_PIN_FUN_SGPMO  |
+                       SCU_PIN_FUN_SGPMLD |
+                       SCU_PIN_FUN_SGPMCK);
+       writel(reg, SCU_BASE + SCU_FUN_PIN_CTRL2);
+#endif
        return 0;
 }
 
--

2.31.1.295.g9ea45b61b8-goog

maintainer
#4 lore raw
In reply to Willy Tu
Quoted 8 lines · Willy Tu

Hi Joel,

thanks for the response.

Sorry, I did not update the patch to include the branch name. I'll be more careful next time.

This change should be in v2019.04-aspeed-openbmc and the other patch in https://lore.kernel.org/openbmc/[email protected]/ should be in v2016.07-aspeed-openbmc.

Okay.

Quoted 1 line

I have not tested this change, but have tested https://lore.kernel.org/openbmc/[email protected]/ that I based off of (Which I have tested with my setup). Will that be an issue?

What branch are you using for your system?

I strongly encourage you to use the 2019.04 branch if at all possible.

Some review below.

Quoted 44 lines · Joel Stanley
Quoted 43 lines

Hi Willy,

Quoted 5 lines · Willy Tu

Add option to enable register for SGPIO in SCU.

Included new function register values for ast2400
SCU and enable the SGPIO function in board init.

Which branch would you like this patch applied to?

Quoted 31 lines
---
 arch/arm/include/asm/arch-aspeed/scu_ast2400.h |  4 ++++
 arch/arm/mach-aspeed/ast2400/Kconfig           |  4 ++++
 arch/arm/mach-aspeed/ast2400/board_common.c    | 15 +++++++++++++++
 3 files changed, 23 insertions(+)
arch/arm/include/asm/arch-aspeed/scu_ast2400.h +4 -0
index 9c5d96ae84..17eaaf3e9d 100644
@@ -75,6 +75,10 @@
 #define SCU_PIN_FUN_SCL2               (1 << 14)
 #define SCU_PIN_FUN_SDA1               (1 << 13)
 #define SCU_PIN_FUN_SDA2               (1 << 15)
+#define SCU_PIN_FUN_SGPMCK             (0x1 << 8)
+#define SCU_PIN_FUN_SGPMLD             (0x1 << 9)
+#define SCU_PIN_FUN_SGPMO              (0x1 << 10)
+#define SCU_PIN_FUN_SGPMI              (0x1 << 11)
 
 #define SCU_D2PLL_EXT1_OFF             (1 << 0)
 #define SCU_D2PLL_EXT1_BYPASS          (1 << 1)
arch/arm/mach-aspeed/ast2400/Kconfig +0 -0
index f76276860c..c4e88b5140 100644
@@ -17,6 +17,10 @@ config TARGET_EVB_AST2400
          20 pin JTAG, pinouts for 14 I2Cs, 3 SPIs and eSPI, 8 PWMs.
 endchoice
 
Quoted 3 lines
Quoted 3 lines

arch/arm/mach-aspeed/ast2400/Kconfig config TARGET_EVB_AST2400 · line 22

Quoted 3 lines
arch/arm/mach-aspeed/ast2400/Kconfig +3 -0
+config ENABLE_SGPIO
+    tristate "Enable SGPIO in SCU"
+       default n

Note that this is the default default in kconfig, you only need to specify a default if you want some other behaviour.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-aspeed/ast2400/Kconfig +0 -0
@@ -14,6 +14,21 @@ __weak int board_init(void)
 {
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-aspeed/ast2400/Kconfig +7 -0
+#ifdef CONFIG_ENABLE_SGPIO
+#define SCU_BASE 0x1e6e2000
+#define SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+       /* Unlock SCU */
+       writel(SCU_UNLOCK_VALUE, SCU_BASE);
+
+       /* Enable SGPIO Master */
Quoted 8 lines

arch/arm/mach-aspeed/ast2400/Kconfig __weak int board_init(void) · line 31

Quoted 8 lines
arch/arm/mach-aspeed/ast2400/Kconfig +8 -0
+       u32 reg = readl(SCU_BASE + SCU_FUN_PIN_CTRL2);
+
+       reg |= (SCU_PIN_FUN_SGPMI  |
+                       SCU_PIN_FUN_SGPMO  |
+                       SCU_PIN_FUN_SGPMLD |
+                       SCU_PIN_FUN_SGPMCK);
+       writel(reg, SCU_BASE + SCU_FUN_PIN_CTRL2);
+#endif

Here's what I saw when attempting to compile test your patch:

In file included from ../arch/arm/mach-aspeed/ast2400/board_common.c:6:
../arch/arm/mach-aspeed/ast2400/board_common.c: In function ‘board_init’:
../arch/arm/mach-aspeed/ast2400/board_common.c:21:16: error:
‘SCU_UNLOCK_VALUE’ undeclared (first use in this function)

   21 |         writel(SCU_UNLOCK_VALUE, SCU_BASE);
      |                ^~~~~~~~~~~~~~~~

../arch/arm/include/asm/io.h:117:38: note: in definition of macro ‘writel’
117 | #define writel(v,c) ({ u32 __v = v; __iowmb();
__arch_putl(__v,c); __v; })
| ^
../arch/arm/mach-aspeed/ast2400/board_common.c:21:16: note: each undeclared identifier is reported only once for each function it appears in

   21 |         writel(SCU_UNLOCK_VALUE, SCU_BASE);
      |                ^~~~~~~~~~~~~~~~

../arch/arm/include/asm/io.h:117:38: note: in definition of macro ‘writel’
117 | #define writel(v,c) ({ u32 __v = v; __iowmb();
__arch_putl(__v,c); __v; })
| ^
../arch/arm/mach-aspeed/ast2400/board_common.c:26:17: error:
‘SCU_PIN_FUN_SGPMI’ undeclared (first use in this function)
26 | reg |= (SCU_PIN_FUN_SGPMI |

      |                 ^~~~~~~~~~~~~~~~~
../arch/arm/mach-aspeed/ast2400/board_common.c:27:25: error:
‘SCU_PIN_FUN_SGPMO’ undeclared (first use in this function)
   27 |                         SCU_PIN_FUN_SGPMO  |
      |                         ^~~~~~~~~~~~~~~~~
../arch/arm/mach-aspeed/ast2400/board_common.c:28:25: error:
‘SCU_PIN_FUN_SGPMLD’ undeclared (first use in this function)
   28 |                         SCU_PIN_FUN_SGPMLD |
      |                         ^~~~~~~~~~~~~~~~~~
../arch/arm/mach-aspeed/ast2400/board_common.c:29:25: error:
‘SCU_PIN_FUN_SGPMCK’ undeclared (first use in this function)
   29 |                         SCU_PIN_FUN_SGPMCK);
      |                         ^~~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-aspeed/ast2400/Kconfig +0 -1
        return 0;
 }
 
--

2.31.1.295.g9ea45b61b8-goog

author
#5 lore raw
Quoted 21 lines · Joel Stanley
Quoted 6 lines · Willy Tu

Hi Joel,

thanks for the response.

Sorry, I did not update the patch to include the branch name. I'll be

more careful next time.

Quoted 2 lines

This change should be in v2019.04-aspeed-openbmc and the other patch

in
https://lore.kernel.org/openbmc/[email protected]/
should be in v2016.07-aspeed-openbmc.

Okay.

Quoted 1 line

I have not tested this change, but have tested

https://lore.kernel.org/openbmc/[email protected]/
that I based off of (Which I have tested with my setup). Will that be an issue?

Quoted 6 lines

What branch are you using for your system?

I strongly encourage you to use the 2019.04 branch if at all possible.

Some review below.

The system that I was using was based on v2016.07-aspeed-openbmc . It is an old system and we don't plan on migrating the u-boot version for it. We don't have any system that is using aspeed other than this one.

Quoted 98 lines
Quoted 15 lines · Joel Stanley
Quoted 13 lines

Hi Willy,

Quoted 5 lines · Willy Tu

Add option to enable register for SGPIO in SCU.

Included new function register values for ast2400
SCU and enable the SGPIO function in board init.

Which branch would you like this patch applied to?

Quoted 1 line
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
---
 arch/arm/include/asm/arch-aspeed/scu_ast2400.h |  4 ++++
 arch/arm/mach-aspeed/ast2400/Kconfig           |  4 ++++
 arch/arm/mach-aspeed/ast2400/board_common.c    | 15 +++++++++++++++
 3 files changed, 23 insertions(+)
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-aspeed/scu_ast2400.h

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

index 9c5d96ae84..17eaaf3e9d 100644

arch/arm/include/asm/arch-aspeed/scu_ast2400.h +4 -0
@@ -75,6 +75,10 @@
 #define SCU_PIN_FUN_SCL2               (1 << 14)
 #define SCU_PIN_FUN_SDA1               (1 << 13)
 #define SCU_PIN_FUN_SDA2               (1 << 15)
+#define SCU_PIN_FUN_SGPMCK             (0x1 << 8)
+#define SCU_PIN_FUN_SGPMLD             (0x1 << 9)
+#define SCU_PIN_FUN_SGPMO              (0x1 << 10)
+#define SCU_PIN_FUN_SGPMI              (0x1 << 11)
 
Quoted 3 lines
Quoted 3 lines

Review

Quoted 3 lines
arch/arm/include/asm/arch-aspeed/scu_ast2400.h +0 -0
 #define SCU_D2PLL_EXT1_OFF             (1 << 0)
 #define SCU_D2PLL_EXT1_BYPASS          (1 << 1)
(quoted diff) +0 -0

b/arch/arm/mach-aspeed/ast2400/Kconfig

Quoted 10 lines
Quoted 10 lines

arch/arm/mach-aspeed/ast2400/Kconfig config TARGET_EVB_AST2400 · line 22

Quoted 10 lines

index f76276860c..c4e88b5140 100644

arch/arm/mach-aspeed/ast2400/Kconfig +3 -0
@@ -17,6 +17,10 @@ config TARGET_EVB_AST2400
          20 pin JTAG, pinouts for 14 I2Cs, 3 SPIs and eSPI, 8 PWMs.
 endchoice
 
+config ENABLE_SGPIO
+    tristate "Enable SGPIO in SCU"
+       default n

Note that this is the default default in kconfig, you only need to specify a default if you want some other behaviour.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-aspeed/ast2400/Kconfig +0 -0
@@ -14,6 +14,21 @@ __weak int board_init(void)
 {
        gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
 
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-aspeed/ast2400/Kconfig +7 -0
+#ifdef CONFIG_ENABLE_SGPIO
+#define SCU_BASE 0x1e6e2000
+#define SCU_FUN_PIN_CTRL2 0x84 /* Multi-function Pin Control#2*/
+       /* Unlock SCU */
+       writel(SCU_UNLOCK_VALUE, SCU_BASE);
+
+       /* Enable SGPIO Master */
Quoted 8 lines

arch/arm/mach-aspeed/ast2400/Kconfig __weak int board_init(void) · line 31

Quoted 8 lines
arch/arm/mach-aspeed/ast2400/Kconfig +8 -0
+       u32 reg = readl(SCU_BASE + SCU_FUN_PIN_CTRL2);
+
+       reg |= (SCU_PIN_FUN_SGPMI  |
+                       SCU_PIN_FUN_SGPMO  |
+                       SCU_PIN_FUN_SGPMLD |
+                       SCU_PIN_FUN_SGPMCK);
+       writel(reg, SCU_BASE + SCU_FUN_PIN_CTRL2);
+#endif

Here's what I saw when attempting to compile test your patch:

In file included from ../arch/arm/mach-aspeed/ast2400/board_common.c:6:
../arch/arm/mach-aspeed/ast2400/board_common.c: In function ‘board_init’:
../arch/arm/mach-aspeed/ast2400/board_common.c:21:16: error:
‘SCU_UNLOCK_VALUE’ undeclared (first use in this function)

   21 |         writel(SCU_UNLOCK_VALUE, SCU_BASE);
      |                ^~~~~~~~~~~~~~~~

../arch/arm/include/asm/io.h:117:38: note: in definition of macro ‘writel’
117 | #define writel(v,c) ({ u32 __v = v; __iowmb();
__arch_putl(__v,c); __v; })
| ^
../arch/arm/mach-aspeed/ast2400/board_common.c:21:16: note: each undeclared identifier is reported only once for each function it appears in

   21 |         writel(SCU_UNLOCK_VALUE, SCU_BASE);
      |                ^~~~~~~~~~~~~~~~

../arch/arm/include/asm/io.h:117:38: note: in definition of macro ‘writel’
117 | #define writel(v,c) ({ u32 __v = v; __iowmb();
__arch_putl(__v,c); __v; })
| ^
../arch/arm/mach-aspeed/ast2400/board_common.c:26:17: error:
‘SCU_PIN_FUN_SGPMI’ undeclared (first use in this function)
26 | reg |= (SCU_PIN_FUN_SGPMI |

Quoted 22 lines
      |                 ^~~~~~~~~~~~~~~~~
../arch/arm/mach-aspeed/ast2400/board_common.c:27:25: error:
‘SCU_PIN_FUN_SGPMO’ undeclared (first use in this function)
   27 |                         SCU_PIN_FUN_SGPMO  |
      |                         ^~~~~~~~~~~~~~~~~
../arch/arm/mach-aspeed/ast2400/board_common.c:28:25: error:
‘SCU_PIN_FUN_SGPMLD’ undeclared (first use in this function)
   28 |                         SCU_PIN_FUN_SGPMLD |
      |                         ^~~~~~~~~~~~~~~~~~
../arch/arm/mach-aspeed/ast2400/board_common.c:29:25: error:
‘SCU_PIN_FUN_SGPMCK’ undeclared (first use in this function)
   29 |                         SCU_PIN_FUN_SGPMCK);
      |                         ^~~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-aspeed/ast2400/Kconfig +0 -1
        return 0;
 }
 
--

2.31.1.295.g9ea45b61b8-goog

Thanks for the feedback. I'll address the issue and apply a new patch.

Willy Tu