From patchwork Tue Jan 23 17:05:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 125562 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1878013ljf; Tue, 23 Jan 2018 09:05:32 -0800 (PST) X-Google-Smtp-Source: AH8x2252VhBvxRVB+uUKOVqlGkW2v4AKaUYUYi57uzDFUYdlKhzLPOuRIdr3V73Tb4RDL3LyNEEQ X-Received: by 10.80.191.6 with SMTP id f6mr20531215edk.281.1516727132479; Tue, 23 Jan 2018 09:05:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516727132; cv=none; d=google.com; s=arc-20160816; b=spe48Al4FRKTlJO5uKR930Z82vdsGd0HdT/NDRIaCPzeyTDG283/67BF4sPZHd6Ab6 gRGujD9tsrfZGYM20+f72UWHVG9n0G1x97h7MtcNMULzylv/nk8So2EeFuktbWp6xNK3 2/p4KEo/I5I52VCSsf9zU3IVuI25K0KLY7806DVL+35a8TKuSwmVlipnhY7zSwzFig7O aBBwAa80e8TaiRxaefqESZkz7w8RMzY9SwD6TE50Dz5VJneDSz/+fOwH/cS9TdEUiSW3 538ujSEGmG+wDbIdWAHcuyMC04dB7OmRHrFdHejmc2qFKnri2RxVDFjTK7pk/4hX+q1U Qg/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from :arc-authentication-results; bh=h3Q1dcVY1UpN+5aomvqTGZvu7iQBaW3rQ525Op83tfQ=; b=XDN44TQw4gPdFWBzTcCqnH6ntF4aegnHAcYryNwM+qiN5HYxVDhU2OTYj+h0oUEFUa Q7Peqnsy7EUbbHHFbgczMeirfJkDUk17NS4rARpBikFfNdlRaBWv60hi3XwY2v90kNbT wY0ANtejruR6JhH0BFG6MUMTYe+jJPX5ieQIypBt0jVZIHD+mL7XNNjkwvXa1cDiFk7M wQ3vorYFOz0toKig9DP74Pj5yMF9YVqSrg2uqQdXJQIGyiW7gp9p7Y2RSnAoQHj81w6U 982X6XpcXYg4YE1lT7zp1STBZp2TIkWzGiVpURbO/152M5YcBLS7APF0/7C6oD0hob5i bItA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u6si6843451edm.151.2018.01.23.09.05.31; Tue, 23 Jan 2018 09:05:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id B8664C22103; Tue, 23 Jan 2018 17:05:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9FF14C21E50; Tue, 23 Jan 2018 17:05:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D7037C21E64; Tue, 23 Jan 2018 17:05:25 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 84C64C21DA6 for ; Tue, 23 Jan 2018 17:05:25 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 21D37AF55; Tue, 23 Jan 2018 17:05:25 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Tue, 23 Jan 2018 18:05:20 +0100 Message-Id: <20180123170522.6581-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Subject: [U-Boot] [PATCH v3 0/2] Rpi: Add support for second sd host controller X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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