Skip to contentSkip to conversation

serial: msm_geni_serial_console : Add Earlycon support

PATCH In review Mukesh, Savaliya 2 participants 3 messages May 22, 2020 – Jun 22, 2020 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH v5 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.

---
Changes In V2:
- Fixed Makefile Typo issue.

Changes In V3:
- Removed mb() calls as *_relaxed() should take care.

Changes In V4:
- Minor change: space between offset and base addition.

Changes In V5:
- Removed unlikely() macro.
- root_freq() array taken as static.
- Removed extra readback of the register having no meaning.

 drivers/tty/serial/Kconfig                   |  15 +
 drivers/tty/serial/Makefile                  |   1 +
 drivers/tty/serial/msm_geni_serial_console.c | 476 +++++++++++++++++++
 3 files changed, 492 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..7b6422e9d638 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-$(CONFIG_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 +476 -0

476 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 33 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.

---
Changes In V2:
- Fixed Makefile Typo issue.

Changes In V3:
- Removed mb() calls as *_relaxed() should take care.

Changes In V4:
- Minor change: space between offset and base addition.

Changes In V5:
- Removed unlikely() macro.
- root_freq() array taken as static.
- Removed extra readback of the register having no meaning.

 drivers/tty/serial/Kconfig                   |  15 +
 drivers/tty/serial/Makefile                  |   1 +
 drivers/tty/serial/msm_geni_serial_console.c | 476 +++++++++++++++++++
 3 files changed, 492 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 965

Quoted 10 lines
drivers/tty/serial/Kconfig +7 -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.
+	  As earlycon can't have HW version awareness, decision is taken
+	  based on the configuration.

Can you split this option out into a separate file so we don't have to keep arguing about it, preventing the "real" early console code from being merged?

I really think someone needs to go yell at some hardware engineers for this issue. How is this going to work for a "generic" arm64 kernel image? Your hardware always has to be self-describing for crazy stuff like this. Or you pass it in from the bootloader. You can't hard-code this thing, it defeats the whole idea of dynamic systems...

thanks,

greg k-h

#2 lore raw
Quoted 37 lines · Greg KH
Quoted 36 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.

---
Changes In V2:
- Fixed Makefile Typo issue.

Changes In V3:
- Removed mb() calls as *_relaxed() should take care.

Changes In V4:
- Minor change: space between offset and base addition.

Changes In V5:
- Removed unlikely() macro.
- root_freq() array taken as static.
- Removed extra readback of the register having no meaning.

  drivers/tty/serial/Kconfig                   |  15 +
  drivers/tty/serial/Makefile                  |   1 +
  drivers/tty/serial/msm_geni_serial_console.c | 476 +++++++++++++++++++
  3 files changed, 492 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 10 lines

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

Quoted 7 lines
drivers/tty/serial/Kconfig +7 -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.
+	  As earlycon can't have HW version awareness, decision is taken
+	  based on the configuration.

Can you split this option out into a separate file so we don't have to keep arguing about it, preventing the "real" early console code from being merged?

Sure, patch is uploaded. We are removing this CONFIG and considering  no such config needed for now for

latest chipsets.

Quoted 5 lines

I really think someone needs to go yell at some hardware engineers for this issue. How is this going to work for a "generic" arm64 kernel image? Your hardware always has to be self-describing for crazy stuff like this. Or you pass it in from the bootloader. You can't hard-code this thing, it defeats the whole idea of dynamic systems...

I agree with the generic image change, we will work out on this later.

Quoted 3 lines

thanks,

greg k-h