Skip to contentSkip to conversation

rockchip: px30: Fixup PMUGRF registers layout order

PATCH New Paul Kocialkowski 2 participants 4 messages Nov 28, 2019 – Dec 1, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 rockchip: px30: Fixup PMUGRF registers layout order

According to the PX30 TRM, the iomux registers come first, before the pull and strength control registers.

---
 arch/arm/include/asm/arch-rockchip/grf_px30.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm/include/asm/arch-rockchip/grf_px30.h +8 -8
index c167bb42fac9..3d2a8770322e 100644
@@ -112,18 +112,18 @@ struct px30_grf {
 check_member(px30_grf, mac_con1, 0x904);
 
 struct px30_pmugrf {
-	unsigned int gpio0a_e;
-	unsigned int gpio0b_e;
-	unsigned int gpio0c_e;
-	unsigned int gpio0d_e;
-	unsigned int gpio0a_p;
-	unsigned int gpio0b_p;
-	unsigned int gpio0c_p;
-	unsigned int gpio0d_p;
 	unsigned int gpio0al_iomux;
 	unsigned int gpio0bl_iomux;
 	unsigned int gpio0cl_iomux;
 	unsigned int gpio0dl_iomux;
+	unsigned int gpio0a_p;
+	unsigned int gpio0b_p;
+	unsigned int gpio0c_p;
+	unsigned int gpio0d_p;
+	unsigned int gpio0a_e;
+	unsigned int gpio0b_e;
+	unsigned int gpio0c_e;
+	unsigned int gpio0d_e;
 	unsigned int gpio0l_sr;
 	unsigned int gpio0h_sr;
 	unsigned int gpio0l_smt;
Signature · 1 line
2.24.0
#1 lore raw

PATCH v2 2/3 rockchip: px30: Rename CONFIG_DEBUG_UART2_CHANNEL to CONFIG_DEBUG_UART_CHANNEL

UART3 also has two sets of pins that can be selected.

Rename the config option to a common name, to allow it to be used for both UART2 and UART3.

---
 arch/arm/mach-rockchip/px30/Kconfig | 6 +++---
 arch/arm/mach-rockchip/px30/px30.c  | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-rockchip/px30/Kconfig +3 -3
index 109a37be15ad..9f3ad4f623b0 100644
@@ -27,12 +27,12 @@ config TPL_MAX_SIZE
 config TPL_STACK
 	default 0xff0e4fff
 
-config DEBUG_UART2_CHANNEL
-	int "Mux channel to use for debug UART2"
+config DEBUG_UART_CHANNEL
+	int "Mux channel to use for debug UART2/UART3"
 	depends on DEBUG_UART_BOARD_INIT
 	default 0
 	help
-	  UART2 can use two different set of pins to route the output.
+	  UART2 and UART3 can use two different set of pins to route the output.
 	  For using the UART for early debugging the route to use needs
 	  to be declared (0 or 1).
 
arch/arm/mach-rockchip/px30/px30.c +2 -2
index bacdcc0b938d..a2241cfc608d 100644
@@ -222,7 +222,7 @@ void board_debug_uart_init(void)
 		     UART2_CLK_SEL_MASK,
 		     UART2_CLK_SEL_UART2 << UART2_CLK_SEL_SHIFT);
 
-#if (CONFIG_DEBUG_UART2_CHANNEL == 1)
+#if (CONFIG_DEBUG_UART_CHANNEL == 1)
 	/* Enable early UART2 */
 	rk_clrsetreg(&grf->iofunc_con0,
 		     CON_IOMUX_UART2SEL_MASK,
@@ -241,7 +241,7 @@ void board_debug_uart_init(void)
 		     GPIO1D3_MASK | GPIO1D2_MASK,
 		     GPIO1D3_UART2_RXM0 << GPIO1D3_SHIFT |
 		     GPIO1D2_UART2_TXM0 << GPIO1D2_SHIFT);
-#endif /* CONFIG_DEBUG_UART2_CHANNEL == 1 */
+#endif /* CONFIG_DEBUG_UART_CHANNEL == 1 */
 
 #endif /* CONFIG_DEBUG_UART_BASE && CONFIG_DEBUG_UART_BASE == ... */
 }
Signature · 1 line
2.24.0
#2 lore raw

PATCH v2 2/3 rockchip: px30: Rename CONFIG_DEBUG_UART2_CHANNEL to CONFIG_DEBUG_UART_CHANNEL

Quoted 6 lines · Paul Kocialkowski

UART3 also has two sets of pins that can be selected.

Rename the config option to a common name, to allow it to be used for both UART2 and UART3.

Thanks,
- Kever

Quoted 47 lines
---
  arch/arm/mach-rockchip/px30/Kconfig | 6 +++---
  arch/arm/mach-rockchip/px30/px30.c  | 4 ++--
  2 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-rockchip/px30/Kconfig +3 -3
index 109a37be15ad..9f3ad4f623b0 100644
@@ -27,12 +27,12 @@ config TPL_MAX_SIZE
  config TPL_STACK
  	default 0xff0e4fff
 
-config DEBUG_UART2_CHANNEL
-	int "Mux channel to use for debug UART2"
+config DEBUG_UART_CHANNEL
+	int "Mux channel to use for debug UART2/UART3"
  	depends on DEBUG_UART_BOARD_INIT
  	default 0
  	help
-	  UART2 can use two different set of pins to route the output.
+	  UART2 and UART3 can use two different set of pins to route the output.
  	  For using the UART for early debugging the route to use needs
  	  to be declared (0 or 1).
 
arch/arm/mach-rockchip/px30/px30.c +2 -2
index bacdcc0b938d..a2241cfc608d 100644
@@ -222,7 +222,7 @@ void board_debug_uart_init(void)
  		     UART2_CLK_SEL_MASK,
  		     UART2_CLK_SEL_UART2 << UART2_CLK_SEL_SHIFT);
 
-#if (CONFIG_DEBUG_UART2_CHANNEL == 1)
+#if (CONFIG_DEBUG_UART_CHANNEL == 1)
  	/* Enable early UART2 */
  	rk_clrsetreg(&grf->iofunc_con0,
  		     CON_IOMUX_UART2SEL_MASK,
@@ -241,7 +241,7 @@ void board_debug_uart_init(void)
  		     GPIO1D3_MASK | GPIO1D2_MASK,
  		     GPIO1D3_UART2_RXM0 << GPIO1D3_SHIFT |
  		     GPIO1D2_UART2_TXM0 << GPIO1D2_SHIFT);
-#endif /* CONFIG_DEBUG_UART2_CHANNEL == 1 */
+#endif /* CONFIG_DEBUG_UART_CHANNEL == 1 */
 
  #endif /* CONFIG_DEBUG_UART_BASE && CONFIG_DEBUG_UART_BASE == ... */
  }
#3 lore raw

PATCH v2 3/3 rockchip: px30: Add support for using UART3 as debug UART

In reply to Paul Kocialkowski

Some generic PX30 SoMs found in the wild use UART3 as their debug output instead of UART2 (used for MMC) and UART5.

Make it possible to use UART3 as early debug output, with the associated clock and pinmux configuration. Two sets of output pins are supported (M0/M1).

Future users should also note that the pinmux default in the dts is to use the M1 pins while the Kconfig option takes M0 as a default.

---
 arch/arm/include/asm/arch-rockchip/cru_px30.h | 19 +++++
 arch/arm/mach-rockchip/px30/px30.c            | 77 +++++++++++++++++++
 2 files changed, 96 insertions(+)
arch/arm/include/asm/arch-rockchip/cru_px30.h +19 -0
index 7d9fd181aca2..798444ae49f5 100644
@@ -357,6 +357,25 @@ enum {
 	UART2_DIVNP5_SHIFT	= 0,
 	UART2_DIVNP5_MASK	= 0x1f << UART2_DIVNP5_SHIFT,
 
+	/* CRU_CLK_SEL40_CON */
+	UART3_PLL_SEL_SHIFT	= 14,
+	UART3_PLL_SEL_MASK	= 3 << UART3_PLL_SEL_SHIFT,
+	UART3_PLL_SEL_GPLL	= 0,
+	UART3_PLL_SEL_24M,
+	UART3_PLL_SEL_480M,
+	UART3_PLL_SEL_NPLL,
+	UART3_DIV_CON_SHIFT	= 0,
+	UART3_DIV_CON_MASK	= 0x1f << UART3_DIV_CON_SHIFT,
+
+	/* CRU_CLK_SEL41_CON */
+	UART3_CLK_SEL_SHIFT	= 14,
+	UART3_CLK_SEL_MASK	= 3 << UART3_PLL_SEL_SHIFT,
+	UART3_CLK_SEL_UART3	= 0,
+	UART3_CLK_SEL_UART3_NP5,
+	UART3_CLK_SEL_UART3_FRAC,
+	UART3_DIVNP5_SHIFT	= 0,
+	UART3_DIVNP5_MASK	= 0x1f << UART3_DIVNP5_SHIFT,
+
 	/* CRU_CLK_SEL46_CON */
 	UART5_PLL_SEL_SHIFT	= 14,
 	UART5_PLL_SEL_MASK	= 3 << UART5_PLL_SEL_SHIFT,
arch/arm/mach-rockchip/px30/px30.c +77 -0

107 lines not on this page · raw message

Signature · 1 line
2.24.0