Skip to contentSkip to conversation

rockchip: add CONFIG_SPL_ROCKCHIP_SERIAL

PATCH New Lin Huang 2 participants 7 messages Nov 20, 2015 – Dec 1, 2015

Subsystems (3)
lore
Share & tools
lore

Lin Huang

author
#0 lore raw

PATCH 1/2 rockchip: add CONFIG_SPL_ROCKCHIP_SERIAL

we can use this config to disable rockchip serial driver in SPL stage, since some rockchip soc sram size is small(rk3036 etc), so we don't want rockchip serial driver build in SPL, but we still want use common debug driver in SPL.

---
 arch/arm/mach-rockchip/Kconfig  | 3 +++
 drivers/serial/Makefile         | 2 +-
 include/configs/rk3288_common.h | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +3 -0
index ccff81a..595263c 100644
@@ -59,6 +59,9 @@ config DM_GPIO
 config ROCKCHIP_SERIAL
 	default y
 
+config SPL_ROCKCHIP_SERIAL
+	default n
+
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
 endif
drivers/serial/Makefile +1 -1
index 1818c7c..73e30c6 100644
@@ -41,7 +41,7 @@ obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o
 obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o
 obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
 obj-$(CONFIG_MXS_AUART) += mxs_auart.o
-obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o
+obj-$(CONFIG_$(SPL_)ROCKCHIP_SERIAL) += serial_rockchip.o
 obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
 obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
 obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
include/configs/rk3288_common.h +1 -0
index 74c7ee1..7f3d1ee 100644
@@ -30,6 +30,7 @@
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_ROCKCHIP_SERIAL
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_MEM32
 #define CONFIG_SPL_BOARD_INIT
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/2 rockchip: rk3036: enable CONFIG_DEBUG_UART, and use ns16550 uart driver

enable this config so we use common uart function in SPL stage

---
 arch/arm/mach-rockchip/rk3036-board-spl.c | 6 ++----
 configs/evb-rk3036_defconfig              | 5 +++++
 include/configs/rk3036_common.h           | 1 +
 3 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/mach-rockchip/rk3036-board-spl.c +2 -4
index 3a1491c..449d1df 100644
@@ -5,20 +5,18 @@
  */
 
 #include <common.h>
+#include <debug_uart.h>
 #include <asm/io.h>
 #include <asm/arch/grf_rk3036.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sdram_rk3036.h>
 #include <asm/arch/timer.h>
-#include <asm/arch/uart.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #define GRF_BASE	0x20008000
 static struct rk3036_grf * const grf = (void *)GRF_BASE;
 
-#define DEBUG_UART_BASE	0x20068000
-
 extern void back_to_bootrom(void);
 
 void board_init_f(ulong dummy)
@@ -34,7 +32,7 @@ void board_init_f(ulong dummy)
 		     GPIO1C2_MASK << GPIO1C2_SHIFT,
 		     GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
 		     GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
-	rk_uart_init((void *)DEBUG_UART_BASE);
+	debug_uart_init();
 #endif
 	rockchip_timer_init();
 	sdram_init();
configs/evb-rk3036_defconfig +5 -0
index 2e915ff..b383905 100644
@@ -24,3 +24,8 @@ CONFIG_DM_MMC=y
 CONFIG_USE_PRIVATE_LIBGCC=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_NS16550=y
+CONFIG_DEBUG_UART_BASE=0x20068000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_DEBUG_UART_SHIFT=2
include/configs/rk3036_common.h +1 -0
index f753e68..a6e0fed 100644
@@ -24,6 +24,7 @@
 #define CONFIG_SYS_TIMER_BASE		0x200440a0 /* TIMER5 */
 #define CONFIG_SYS_TIMER_COUNTER	(CONFIG_SYS_TIMER_BASE + 8)
 
+#define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_MEM32
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/2 rockchip: rk3036: enable CONFIG_DEBUG_UART, and use ns16550 uart driver

Quoted 8 lines · Lin Huang

enable this config so we use common uart function in SPL stage

---
 arch/arm/mach-rockchip/rk3036-board-spl.c | 6 ++----
 configs/evb-rk3036_defconfig              | 5 +++++
 include/configs/rk3036_common.h           | 1 +
 3 files changed, 8 insertions(+), 4 deletions(-)
#3 lore raw

PATCH 1/2 rockchip: add CONFIG_SPL_ROCKCHIP_SERIAL

In reply to Lin Huang

Hi Lin,

Quoted 17 lines · Lin Huang

we can use this config to disable rockchip serial driver in SPL stage, since some rockchip soc sram size is small(rk3036 etc), so we don't want rockchip serial driver build in SPL, but we still want use common debug driver in SPL.

---
 arch/arm/mach-rockchip/Kconfig  | 3 +++
 drivers/serial/Makefile         | 2 +-
 include/configs/rk3288_common.h | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +0 -0
index ccff81a..595263c 100644

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 64

Quoted 6 lines
arch/arm/mach-rockchip/Kconfig +3 -0
@@ -59,6 +59,9 @@ config DM_GPIO
 config ROCKCHIP_SERIAL
        default y
 
+config SPL_ROCKCHIP_SERIAL
+       default n
+

It will already default to 'n', so this can be omitted.

Also you should add this new CONFIG to drivers/serial/Kconfig, below the existing (non-SPL) one.

Quoted 21 lines
arch/arm/mach-rockchip/Kconfig +0 -0
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
 endif
drivers/serial/Makefile +1 -1
index 1818c7c..73e30c6 100644
@@ -41,7 +41,7 @@ obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o
 obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o
 obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
 obj-$(CONFIG_MXS_AUART) += mxs_auart.o
-obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o
+obj-$(CONFIG_$(SPL_)ROCKCHIP_SERIAL) += serial_rockchip.o
 obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
 obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
 obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
include/configs/rk3288_common.h +0 -0
index 74c7ee1..7f3d1ee 100644

include/configs/rk3288_common.h line 33

Quoted 4 lines
include/configs/rk3288_common.h +1 -0
@@ -30,6 +30,7 @@
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_ROCKCHIP_SERIAL

You should add this to the rk3288 defconfig files, instead of here. Kconfig items should not be added to config header files - in fact we plan to eventually remove the config header files.

Quoted 6 lines
include/configs/rk3288_common.h +0 -1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_MEM32
 #define CONFIG_SPL_BOARD_INIT
--

1.9.1

Regards,
Simon

#4 lore raw

PATCH 1/2 rockchip: add CONFIG_SPL_ROCKCHIP_SERIAL

Hi Lin,

Quoted 53 lines · Simon Glass

Hi Lin,

Quoted 17 lines · Lin Huang

we can use this config to disable rockchip serial driver in SPL stage, since some rockchip soc sram size is small(rk3036 etc), so we don't want rockchip serial driver build in SPL, but we still want use common debug driver in SPL.

---
 arch/arm/mach-rockchip/Kconfig  | 3 +++
 drivers/serial/Makefile         | 2 +-
 include/configs/rk3288_common.h | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +0 -0
index ccff81a..595263c 100644

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 64

Quoted 6 lines
arch/arm/mach-rockchip/Kconfig +3 -0
@@ -59,6 +59,9 @@ config DM_GPIO
 config ROCKCHIP_SERIAL
        default y
 
+config SPL_ROCKCHIP_SERIAL
+       default n
+

It will already default to 'n', so this can be omitted.

Also you should add this new CONFIG to drivers/serial/Kconfig, below the existing (non-SPL) one.

Quoted 21 lines
arch/arm/mach-rockchip/Kconfig +0 -0
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
 endif
drivers/serial/Makefile +1 -1
index 1818c7c..73e30c6 100644
@@ -41,7 +41,7 @@ obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o
 obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o
 obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
 obj-$(CONFIG_MXS_AUART) += mxs_auart.o
-obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o
+obj-$(CONFIG_$(SPL_)ROCKCHIP_SERIAL) += serial_rockchip.o
 obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
 obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
 obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
include/configs/rk3288_common.h +0 -0
index 74c7ee1..7f3d1ee 100644
@@ -30,6 +30,7 @@
Quoted 15 lines

include/configs/rk3288_common.h line 33

Quoted 4 lines
include/configs/rk3288_common.h +1 -0
 #define CONFIG_SPL_LIBCOMMON_SUPPORT
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_ROCKCHIP_SERIAL

You should add this to the rk3288 defconfig files, instead of here. Kconfig items should not be added to config header files - in fact we plan to eventually remove the config header files.

Quoted 6 lines
include/configs/rk3288_common.h +0 -1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_MEM32
 #define CONFIG_SPL_BOARD_INIT
--

1.9.1

Actually, serial_rockchip.c has been removed in mainline. So you may not need this patch, or maybe it can be reduced in size. Please check the current u-boot-rockchip/master.

Regards,
Simon

author
#5 lore raw

PATCH 1/2 rockchip: add CONFIG_SPL_ROCKCHIP_SERIAL

Hi Simon,

Quoted 69 lines · Simon Glass

Hi Lin,

Quoted 51 lines · Simon Glass

Hi Lin,

Quoted 17 lines · Lin Huang

we can use this config to disable rockchip serial driver in SPL stage, since some rockchip soc sram size is small(rk3036 etc), so we don't want rockchip serial driver build in SPL, but we still want use common debug driver in SPL.

---
  arch/arm/mach-rockchip/Kconfig  | 3 +++
  drivers/serial/Makefile         | 2 +-
  include/configs/rk3288_common.h | 1 +
  3 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +0 -0
index ccff81a..595263c 100644

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 64

Quoted 6 lines
arch/arm/mach-rockchip/Kconfig +3 -0
@@ -59,6 +59,9 @@ config DM_GPIO
  config ROCKCHIP_SERIAL
         default y
 
+config SPL_ROCKCHIP_SERIAL
+       default n
+

It will already default to 'n', so this can be omitted.

Also you should add this new CONFIG to drivers/serial/Kconfig, below the existing (non-SPL) one.

Quoted 20 lines
arch/arm/mach-rockchip/Kconfig +0 -0
  source "arch/arm/mach-rockchip/rk3288/Kconfig"
  source "arch/arm/mach-rockchip/rk3036/Kconfig"
  endif
drivers/serial/Makefile +1 -1
index 1818c7c..73e30c6 100644
@@ -41,7 +41,7 @@ obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o
  obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o
  obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
  obj-$(CONFIG_MXS_AUART) += mxs_auart.o
-obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o
+obj-$(CONFIG_$(SPL_)ROCKCHIP_SERIAL) += serial_rockchip.o
  obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
  obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
  obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
include/configs/rk3288_common.h +0 -0
index 74c7ee1..7f3d1ee 100644
Quoted 15 lines

include/configs/rk3288_common.h line 33

Quoted 5 lines
include/configs/rk3288_common.h +1 -0
@@ -30,6 +30,7 @@
  #define CONFIG_SPL_LIBCOMMON_SUPPORT
  #define CONFIG_SPL_LIBGENERIC_SUPPORT
  #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_ROCKCHIP_SERIAL

You should add this to the rk3288 defconfig files, instead of here. Kconfig items should not be added to config header files - in fact we plan to eventually remove the config header files.

Quoted 6 lines
include/configs/rk3288_common.h +0 -1
  #define CONFIG_SYS_NS16550
  #define CONFIG_SYS_NS16550_MEM32
  #define CONFIG_SPL_BOARD_INIT
--

1.9.1

Quoted 3 lines

Actually, serial_rockchip.c has been removed in mainline. So you may not need this patch, or maybe it can be reduced in size. Please check the current u-boot-rockchip/master.

i cherry-pick the

[PATCH 2/2] rockchip: rk3036: enable CONFIG_DEBUG_UART, and use
ns16550 uart driver

in u-boot-rockchip/master branch, build it, but fail, it is will
call hang() in arch/arm/lib/div0,
so i need to define CONFIG_SPL_LIBGENERIC_SUPPORT, but if i do it,
the spl size too big.

Quoted 5 lines

Regards,
Simon

Signature · 1 line
Lin Huang
#6 lore raw

PATCH 1/2 rockchip: add CONFIG_SPL_ROCKCHIP_SERIAL

Hi Lin,

Quoted 84 lines · hl

Hi Simon,

Quoted 76 lines · Simon Glass

Hi Lin,

Quoted 57 lines · Simon Glass

Hi Lin,

Quoted 19 lines · Lin Huang

we can use this config to disable rockchip serial driver in SPL stage, since some rockchip soc sram size is small(rk3036 etc), so we don't want rockchip serial driver build in SPL, but we still want use common debug driver in SPL.

---
  arch/arm/mach-rockchip/Kconfig  | 3 +++
  drivers/serial/Makefile         | 2 +-
  include/configs/rk3288_common.h | 1 +
  3 files changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +0 -0
index ccff81a..595263c 100644

arch/arm/mach-rockchip/Kconfig config DM_GPIO · line 64

Quoted 6 lines
arch/arm/mach-rockchip/Kconfig +3 -0
@@ -59,6 +59,9 @@ config DM_GPIO
  config ROCKCHIP_SERIAL
         default y
 
+config SPL_ROCKCHIP_SERIAL
+       default n
+

It will already default to 'n', so this can be omitted.

Also you should add this new CONFIG to drivers/serial/Kconfig, below the existing (non-SPL) one.

Quoted 22 lines
arch/arm/mach-rockchip/Kconfig +0 -0
  source "arch/arm/mach-rockchip/rk3288/Kconfig"
  source "arch/arm/mach-rockchip/rk3036/Kconfig"
  endif
drivers/serial/Makefile +1 -1
index 1818c7c..73e30c6 100644
@@ -41,7 +41,7 @@ obj-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o
  obj-$(CONFIG_BFIN_SERIAL) += serial_bfin.o
  obj-$(CONFIG_FSL_LPUART) += serial_lpuart.o
  obj-$(CONFIG_MXS_AUART) += mxs_auart.o
-obj-$(CONFIG_ROCKCHIP_SERIAL) += serial_rockchip.o
+obj-$(CONFIG_$(SPL_)ROCKCHIP_SERIAL) += serial_rockchip.o
  obj-$(CONFIG_ARC_SERIAL) += serial_arc.o
  obj-$(CONFIG_TEGRA_SERIAL) += serial_tegra.o
  obj-$(CONFIG_UNIPHIER_SERIAL) += serial_uniphier.o
include/configs/rk3288_common.h +0 -0
index 74c7ee1..7f3d1ee 100644
@@ -30,6 +30,7 @@
Quoted 15 lines

include/configs/rk3288_common.h line 33

Quoted 4 lines
include/configs/rk3288_common.h +1 -0
  #define CONFIG_SPL_LIBCOMMON_SUPPORT
  #define CONFIG_SPL_LIBGENERIC_SUPPORT
  #define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_ROCKCHIP_SERIAL

You should add this to the rk3288 defconfig files, instead of here. Kconfig items should not be added to config header files - in fact we plan to eventually remove the config header files.

Quoted 6 lines
include/configs/rk3288_common.h +0 -1
  #define CONFIG_SYS_NS16550
  #define CONFIG_SYS_NS16550_MEM32
  #define CONFIG_SPL_BOARD_INIT
--

1.9.1

Quoted 3 lines

Actually, serial_rockchip.c has been removed in mainline. So you may not need this patch, or maybe it can be reduced in size. Please check the current u-boot-rockchip/master.

Quoted 7 lines

i cherry-pick the

[PATCH 2/2] rockchip: rk3036: enable CONFIG_DEBUG_UART, and use ns16550
uart driver

in u-boot-rockchip/master branch, build it, but fail, it is will call
hang() in arch/arm/lib/div0,

That sounds like a symptom of a divide by 0 error?

Quoted 2 lines

so i need to define CONFIG_SPL_LIBGENERIC_SUPPORT, but if i do it, the
spl size too big.

I am hoping that we can enable the debug UART without bringing in full serial support. Do you think it is possible? We just want printch() etc., not printf().

Regards,
Simon