Skip to contentSkip to conversation

serial: msm_geni_serial_console : Add Earlycon support

PATCH Superseded Mukesh, Savaliya 2 participants 4 messages Apr 29, 2020 – May 6, 2020 TTY layer and serial drivers

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: msm_geni_serial_console : Add Earlycon support

From: Mukesh Kumar Savaliya <[email protected]>

This change enables earlyconsole support as static driver for geni based UART. Kernel space UART console driver will be generic for console and other usecases of UART.

---
 drivers/tty/serial/Kconfig                   |  15 +
 drivers/tty/serial/Makefile                  |   1 +
 drivers/tty/serial/msm_geni_serial_console.c | 525 +++++++++++++++++++
 3 files changed, 541 insertions(+)
 create mode 100644 drivers/tty/serial/msm_geni_serial_console.c
drivers/tty/serial/Kconfig +15 -0
index 0aea76cd67ff..ded19d80e696 100644
@@ -956,6 +956,21 @@ config SERIAL_MSM_CONSOLE
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_EARLYCON
 
+config SERIAL_MSM_GENI_HALF_SAMPLING
+	bool "Changes clock divider which impacts sampling rate for QUP HW ver greater than 2.5.0"
+	help
+	  Clock divider value should be doubled for QUP hardware version
+	  greater than 2.5.0.
+	  As earlycon can't have HW version awareness, decision is taken
+	  based on the configuration.
+
+config SERIAL_MSM_GENI_EARLY_CONSOLE
+	bool "MSM on-chip GENI HW based early console support"
+	select SERIAL_MSM_GENI_HALF_SAMPLING
+	help
+	  Serial early console driver for Qualcomm Technologies Inc's GENI
+	  based QUP hardware.
+
 config SERIAL_QCOM_GENI
 	tristate "QCOM on-chip GENI based serial port support"
 	depends on ARCH_QCOM || COMPILE_TEST
drivers/tty/serial/Makefile +1 -0
index d056ee6cca33..9790ef2d802c 100644
@@ -55,6 +55,7 @@ obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
 obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
 obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
 obj-$(CONFIG_SERIAL_MSM) += msm_serial.o
+obj-$(SERIAL_MSM_GENI_EARLY_CONSOLE) += msm_geni_serial_console.o
 obj-$(CONFIG_SERIAL_QCOM_GENI) += qcom_geni_serial.o
 obj-$(CONFIG_SERIAL_OMAP) += omap-serial.o
 obj-$(CONFIG_SERIAL_ALTERA_UART) += altera_uart.o
drivers/tty/serial/msm_geni_serial_console.c new file +525 -0

525 lines not on this page · raw message

Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
maintainer
#1 lore raw
Quoted 19 lines · Savaliya

From: Mukesh Kumar Savaliya <[email protected]>

This change enables earlyconsole support as static driver for geni based UART. Kernel space UART console driver will be generic for console and other usecases of UART.

---
 drivers/tty/serial/Kconfig                   |  15 +
 drivers/tty/serial/Makefile                  |   1 +
 drivers/tty/serial/msm_geni_serial_console.c | 525 +++++++++++++++++++
 3 files changed, 541 insertions(+)
 create mode 100644 drivers/tty/serial/msm_geni_serial_console.c
drivers/tty/serial/Kconfig +0 -0
index 0aea76cd67ff..ded19d80e696 100644

drivers/tty/serial/Kconfig config SERIAL_MSM_CONSOLE · line 963

Quoted 8 lines
drivers/tty/serial/Kconfig +5 -0
@@ -956,6 +956,21 @@ config SERIAL_MSM_CONSOLE
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_EARLYCON
 
+config SERIAL_MSM_GENI_HALF_SAMPLING
+	bool "Changes clock divider which impacts sampling rate for QUP HW ver greater than 2.5.0"
+	help
+	  Clock divider value should be doubled for QUP hardware version
+	  greater than 2.5.0.

How do we know this? Can't this be dynamically determined at runtime? What about kernels that want to be built for both types of hardware at the same time?

drivers/tty/serial/Kconfig config SERIAL_MSM_CONSOLE · line 972

Quoted 9 lines
drivers/tty/serial/Kconfig +9 -0
+	  As earlycon can't have HW version awareness, decision is taken
+	  based on the configuration.
+
+config SERIAL_MSM_GENI_EARLY_CONSOLE
+	bool "MSM on-chip GENI HW based early console support"
+	select SERIAL_MSM_GENI_HALF_SAMPLING
+	help
+	  Serial early console driver for Qualcomm Technologies Inc's GENI
+	  based QUP hardware.

Why can't we have early console without SERIAL_MSM_GENI_HALF_SAMPLING?

Why are these tied directly to each other? Do you really need 2 options?

drivers/tty/serial/Makefile obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o · line 58

Quoted 13 lines
drivers/tty/serial/Kconfig +1 -0
+
 config SERIAL_QCOM_GENI
 	tristate "QCOM on-chip GENI based serial port support"
 	depends on ARCH_QCOM || COMPILE_TEST
drivers/tty/serial/Makefile +1 -0
index d056ee6cca33..9790ef2d802c 100644
@@ -55,6 +55,7 @@ obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
 obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
 obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
 obj-$(CONFIG_SERIAL_MSM) += msm_serial.o
+obj-$(SERIAL_MSM_GENI_EARLY_CONSOLE) += msm_geni_serial_console.o

I don't think you tested this at all :(

I've stopped here in the review for this obvious reason...

thanks,

greg k-h

#2 lore raw
Quoted 23 lines · Greg KH
Quoted 22 lines · Savaliya

From: Mukesh Kumar Savaliya <[email protected]>

This change enables earlyconsole support as static driver for geni based UART. Kernel space UART console driver will be generic for console and other usecases of UART.

---
  drivers/tty/serial/Kconfig                   |  15 +
  drivers/tty/serial/Makefile                  |   1 +
  drivers/tty/serial/msm_geni_serial_console.c | 525 +++++++++++++++++++
  3 files changed, 541 insertions(+)

create mode 100644 drivers/tty/serial/msm_geni_serial_console.c

drivers/tty/serial/Kconfig +0 -0
index 0aea76cd67ff..ded19d80e696 100644
@@ -956,6 +956,21 @@ config SERIAL_MSM_CONSOLE
  	select SERIAL_CORE_CONSOLE
  	select SERIAL_EARLYCON
 
Quoted 8 lines

drivers/tty/serial/Kconfig config SERIAL_MSM_CONSOLE · line 963

Quoted 5 lines
drivers/tty/serial/Kconfig +5 -0
+config SERIAL_MSM_GENI_HALF_SAMPLING
+	bool "Changes clock divider which impacts sampling rate for QUP HW ver greater than 2.5.0"
+	help
+	  Clock divider value should be doubled for QUP hardware version
+	  greater than 2.5.0.

How do we know this? Can't this be dynamically determined at runtime? What about kernels that want to be built for both types of hardware at the same time?

This will vary for different hardware only if QUP version is lower than this.

We can not determine this dynamically because register address space to read QUP version is in QUP wrapper space and that also keep varying per target.

we only  get internal SE address base in cmdline arg.

Quoted 12 lines

drivers/tty/serial/Kconfig config SERIAL_MSM_CONSOLE · line 972

Quoted 10 lines
drivers/tty/serial/Kconfig +9 -0
+	  As earlycon can't have HW version awareness, decision is taken
+	  based on the configuration.
+
+config SERIAL_MSM_GENI_EARLY_CONSOLE
+	bool "MSM on-chip GENI HW based early console support"
+	select SERIAL_MSM_GENI_HALF_SAMPLING
+	help
+	  Serial early console driver for Qualcomm Technologies Inc's GENI
+	  based QUP hardware.

Why can't we have early console without SERIAL_MSM_GENI_HALF_SAMPLING?

Quoted 2 lines

Why are these tied directly to each other? Do you really need 2 options?

HALF_SAMPLING controlls the sampling rate of UART HW, if not then logs come garbled due to wrong sampling.

Quoted 16 lines
Quoted 10 lines
drivers/tty/serial/Kconfig +1 -0
+
  config SERIAL_QCOM_GENI
  	tristate "QCOM on-chip GENI based serial port support"
  	depends on ARCH_QCOM || COMPILE_TEST
drivers/tty/serial/Makefile +0 -0
index d056ee6cca33..9790ef2d802c 100644

drivers/tty/serial/Makefile obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o · line 58

Quoted 4 lines
drivers/tty/serial/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.o
  obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o
  obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
  obj-$(CONFIG_SERIAL_MSM) += msm_serial.o
+obj-$(SERIAL_MSM_GENI_EARLY_CONSOLE) += msm_geni_serial_console.o

I don't think you tested this at all :(

Quoted 1 line

I've stopped here in the review for this obvious reason...

Done the changes. Sorry, i compiled with the static config but missed to add back when compiled with  config change.

Uploaded new change.

Quoted 4 lines

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 33 lines · Savaliya
Quoted 15 lines · Greg KH
Quoted 14 lines · Savaliya

From: Mukesh Kumar Savaliya <[email protected]>

This change enables earlyconsole support as static driver for geni based UART. Kernel space UART console driver will be generic for console and other usecases of UART.

---
  drivers/tty/serial/Kconfig                   |  15 +
  drivers/tty/serial/Makefile                  |   1 +
  drivers/tty/serial/msm_geni_serial_console.c | 525 +++++++++++++++++++
  3 files changed, 541 insertions(+)

create mode 100644 drivers/tty/serial/msm_geni_serial_console.c

Quoted 15 lines

drivers/tty/serial/Kconfig config SERIAL_MSM_CONSOLE · line 962

Quoted 12 lines
drivers/tty/serial/Kconfig +5 -0
index 0aea76cd67ff..ded19d80e696 100644
@@ -956,6 +956,21 @@ config SERIAL_MSM_CONSOLE
  	select SERIAL_CORE_CONSOLE
  	select SERIAL_EARLYCON
+config SERIAL_MSM_GENI_HALF_SAMPLING
+	bool "Changes clock divider which impacts sampling rate for QUP HW ver greater than 2.5.0"
+	help
+	  Clock divider value should be doubled for QUP hardware version
+	  greater than 2.5.0.

How do we know this? Can't this be dynamically determined at runtime? What about kernels that want to be built for both types of hardware at the same time?

Quoted 7 lines

This will vary for different hardware only if QUP version is lower than this.

We can not determine this dynamically because register address space to read QUP version is in QUP wrapper space and that also keep varying per target.

we only  get internal SE address base in cmdline arg.

I don't understand. So does this mean we can not build a single kernel image with support for both?

Why can't you detect "version 2.5.0 or greater" at runtime? How do you know this at kernel build time and not at runtime?

We can't add options that prevent generic versions of the kernel from being able to be built, as that means you just broke kernels that did work, right?

Quoted 13 lines
Quoted 13 lines

drivers/tty/serial/Kconfig config SERIAL_MSM_CONSOLE · line 972

Quoted 11 lines
drivers/tty/serial/Kconfig +9 -0
+	  As earlycon can't have HW version awareness, decision is taken
+	  based on the configuration.
+
+config SERIAL_MSM_GENI_EARLY_CONSOLE
+	bool "MSM on-chip GENI HW based early console support"
+	select SERIAL_MSM_GENI_HALF_SAMPLING
+	help
+	  Serial early console driver for Qualcomm Technologies Inc's GENI
+	  based QUP hardware.

Why can't we have early console without SERIAL_MSM_GENI_HALF_SAMPLING?

Quoted 4 lines
Quoted 2 lines

Why are these tied directly to each other? Do you really need 2 options?

HALF_SAMPLING controlls the sampling rate of UART HW, if not then logs come garbled due to wrong sampling.

I do not understand what you mean here. Again, why can this not be detected at runtime?

Can you split this into two patches, one for the console driver, and one for the crazy new hardware for newer systems?

thanks,

greg k-h