mbox series

[v3,00/15] RPi: Properly handle dynamic serial configuration

Message ID 20180125110556.76352-1-agraf@suse.de
Headers show
Series RPi: Properly handle dynamic serial configuration | expand

Message

Alexander Graf Jan. 25, 2018, 11:05 a.m. UTC
The RPi has proprietary firmware that can be configured (using config.txt)
to expose either the PL11, Mini-UART or no serial device to the UART pins
on the GPIO pin bar of the RPi.

So far we've only half-heartedly dealt with that, with lost of heuristics
that ended up falling apart at times. For example the RPi3 CM uses PL011
when serial is enabled in config.txt, but we disabled PL11 support for BCM2837
because the RPi3 uses the Mini-UART with enable_uart=1 is set in config.txt.

This patch set always enables both serial outputs and determines at probe
time whether a serial device is actually muxed to the UART pins on the board.
Only in that case, it will be probed and thus used for in- and output in
U-Boot.

With this patch set applied, I have successfully used the same U-Boot binary
with CONFIG_OF_BOARD=y and a RPi firmware provided device tree with both
enable_uart=1 and without on both a RPi3 and RPi3 CM.

This patch set depends on v3 of the patch set "Rpi: Add support for second
sd host controller".

v1 -> v2:

  - Make search logic easier to follow

v2 -> v3:

  - Use bcm2835 specific serial devices to determine pinctrl state
  - New: Convert PL01* to Kconfig
  - New: Convert PL01* to dev_read
  - New: Convert BCM2835_MU to Kconfig
  - New: Add myself as maintainer
  - Use pinctrl driver to determine pinctrl state

Alexander Graf (15):
  serial: Use next serial device if probing fails
  rpi: Remove runtime disabling support for serial
  serial: bcm283x_mu: Remove support for post-init disabling
  rpi: Determine PL011/Mini-UART availability at runtime
  serial_bcm283x_mu: Convert to dev_read
  serial_bcm283x_mu: Always skip init
  serial_bcm283x_mu: Fail loading if not muxed
  pl01x: Convert to dev_read
  pl010: Convert CONFIG_PL010_SERIAL to Kconfig
  pl011: Convert CONFIG_PL011_SERIAL to Kconfig
  pl01x: Convert CONFIG_PL01X_SERIAL to Kconfig
  bcm2835_mu_serial: Convert to Kconfig
  MAINTAINERS: Take over BCM2835 maintainership
  bcm2835_pl011_serial: Add BCM2835 specific serial driver
  bcm2835_pinctrl: Probe pre-reloc

 MAINTAINERS                                  |  5 +-
 arch/arm/Kconfig                             | 31 ++++++++++++
 arch/arm/dts/bcm283x-uboot.dtsi              |  4 ++
 board/raspberrypi/rpi/rpi.c                  | 43 ----------------
 drivers/pinctrl/broadcom/pinctrl-bcm283x.c   |  3 +-
 drivers/serial/Kconfig                       | 34 +++++++++++++
 drivers/serial/Makefile                      |  1 +
 drivers/serial/serial-uclass.c               | 25 +++++++---
 drivers/serial/serial_bcm283x_mu.c           | 61 ++++++++++++++---------
 drivers/serial/serial_bcm283x_pl011.c        | 73 ++++++++++++++++++++++++++++
 drivers/serial/serial_pl01x.c                | 19 +++-----
 drivers/serial/serial_pl01x_internal.h       | 15 +++++-
 include/configs/edb93xx.h                    |  1 -
 include/configs/highbank.h                   |  1 -
 include/configs/hikey.h                      |  3 --
 include/configs/integrator-common.h          |  2 -
 include/configs/mxs.h                        |  1 -
 include/configs/poplar.h                     |  3 --
 include/configs/qemu-arm.h                   |  3 --
 include/configs/rpi.h                        |  7 ---
 include/configs/spear-common.h               |  1 -
 include/configs/stv0991.h                    |  3 --
 include/configs/thunderx_88xx.h              |  1 -
 include/configs/vexpress_aemv8a.h            |  2 -
 include/configs/vexpress_common.h            |  1 -
 include/configs/x600.h                       |  1 -
 include/dm/platform_data/serial_bcm283x_mu.h |  1 -
 scripts/config_whitelist.txt                 |  4 --
 28 files changed, 224 insertions(+), 125 deletions(-)
 create mode 100644 drivers/serial/serial_bcm283x_pl011.c