mbox series

[v3,0/2] Rpi: Add support for second sd host controller

Message ID 20180123170522.6581-1-agraf@suse.de
Headers show
Series Rpi: Add support for second sd host controller | expand

Message

Alexander Graf Jan. 23, 2018, 5:05 p.m. UTC
The Raspberry Pi (bcm283x SoC) family contains 2 IP blocks to drive SD
peripherals: A pretty standard SDHCI one called iProc and a home grown
one called "sdhost".

When driving U-Boot by the same device tree that we use for Linux, we
end up in situations where only the "sdhost" device is available for use.
In those situations, current U-Boot can simply not drive the SD card,
because the device tree disables the SDHCI device.

This patch set also adds a full pinctrl driver for pinmuxing the SD
devices properly to their respective pins. This is necessary because
the RPi firmware doesn't mux the SD pins according to the device tree
but instead expects the payload (usually Linux, U-Boot for us) to do that.

With this patch set, I can successfully use U-Boot on a RPi3 Compute
Module with CONFIG_OF_BOARD=y and a device tree generated by the RPi
firmware (plus a few overlays in config.txt for vc4, serial, etc).

v1 -> v2:

  - Introduce real pinctrl driver
  - Checkpatch fixes
  - Remove hand written pinctrl support

v2 -> v3:

  - Use SPDX license identifier
  - Sort headers
  - Remove useless comments
  - Comment style fixes
  - Add magic constant defines (SDHSTS_CLEAR_MASK, SDEDM_FIFO_FILL*,
                                edm_fifo_fill, SDHST_TIMEOUT_MAX_USEC)
  - Add comments in bcm2835_reset_internal()
  - Replace "r" with "ret"
  - Remove one useless while() indirection in bcm2835_transfer_block_pio()
  - Add comments what each loop does in bcm2835_transfer_block_pio()
  - Remove max_ms parameter in bcm2835_read_wait_sdcmd()
  - Only read once with full timeout in bcm2835_read_wait_sdcmd()
  - Check unsupported response type early in bcm2835_send_command()
  - Return -EBUSY on incomplete command in bcm2835_send_command()
  - Combine SDHSTS_REW_TIME_OUT and SDHSTS_CMD_TIME_OUT cases in
    bcm2835_check_cmd_error()
  - Unfold irq_* check/set in bcm2835_threaded_irq()
  - Declare bcm2835_add_host() as void
  - use dev_read
  - add comment on why GPIO failure is non-fatal

Alexander Graf (2):
  bcm283x: Add pinctrl driver
  mmc: Add bcm2835 sdhost controller

 MAINTAINERS                                |   2 +
 arch/arm/mach-bcm283x/include/mach/gpio.h  |   2 -
 board/raspberrypi/rpi/rpi.c                |   5 +-
 configs/rpi_0_w_defconfig                  |   4 +
 configs/rpi_2_defconfig                    |   4 +
 configs/rpi_3_32b_defconfig                |   4 +
 configs/rpi_3_defconfig                    |   4 +
 configs/rpi_defconfig                      |   4 +
 drivers/gpio/bcm2835_gpio.c                |  29 +-
 drivers/mmc/Kconfig                        |  14 +
 drivers/mmc/Makefile                       |   1 +
 drivers/mmc/bcm2835_sdhost.c               | 979 +++++++++++++++++++++++++++++
 drivers/pinctrl/Kconfig                    |   1 +
 drivers/pinctrl/Makefile                   |   1 +
 drivers/pinctrl/broadcom/Kconfig           |   7 +
 drivers/pinctrl/broadcom/Makefile          |   7 +
 drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 152 +++++
 17 files changed, 1197 insertions(+), 23 deletions(-)
 create mode 100644 drivers/mmc/bcm2835_sdhost.c
 create mode 100644 drivers/pinctrl/broadcom/Kconfig
 create mode 100644 drivers/pinctrl/broadcom/Makefile
 create mode 100644 drivers/pinctrl/broadcom/pinctrl-bcm283x.c