From patchwork Tue Jan 16 13:46:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 124690 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1019566lje; Tue, 16 Jan 2018 05:48:12 -0800 (PST) X-Google-Smtp-Source: ACJfBotLz2ZylNRxmWpr6BRrZskXqkt3MdTyfSyok4lhkUYSYNZA0oqWdtyu5IZIhljulwaZAdjP X-Received: by 10.80.190.137 with SMTP id b9mr53002568edk.246.1516110492794; Tue, 16 Jan 2018 05:48:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516110492; cv=none; d=google.com; s=arc-20160816; b=j6VugPVL7ngUuxkGIXS1ndbTNKIrfpBdSSnadOgzoaxXLiIAaA+NJsxAV5tj7vF6rD GuAkcq3Q0idW0Xg5RKT54FrUT1U0BEMeZcFA/GklK+7rQWcLENtrlQKPFp2kamJA9Gg5 kgZYgqF8WERlM+WsMHVWhWqUnJ3DVE5kR4CEBPfGxsCa2GF3USMxrRCE4nNL6be24kZx X7qTgI2WMPt9XksvtRodke+5nEA7FKN36kOwz83IM83ZWOillx7vwKOQ1TTvfv7IGRp1 su7azpssVdSdLNQTN4/1QgCNT1MmoHsW4VOXKfuYCM4yAUU35JL6ui+rUj35mdtGjE1j UsEA== 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:references:in-reply-to:message-id:date :to:from:arc-authentication-results; bh=XG3Jc/gqRUoGmHMFj5B4t+SUDstG33qZGE5UoIZfdaY=; b=ZD3kUfM7RmLHz/+eTmC7s2pqQ/cyP6CaAZny6tJjimURRQebxJz3GttLdAamvTtS+6 wqYhbr9irirldDOQrOBydMho62/VO5xXOS5uIr7cLTyLtuGir87IpTS1Ghlz091ws0To w9qC/Ldq/XviOI5zAsR1jTG0eejbRmgThkpVGs5i7HJeO+S++QsDZfO5ghEJd4jQDhTz 9iKqZWAkOePK6w7xXyoqDSd/omKkEEqlmUCIPsRq1zpVJ/ZlQgwx5wK1Al69W6CQQvgk NWf4v/psTktQ7NITI55l6q/zHqcSig2ucqj7ZbsxuvvHevQS4OjRGDZYl+NSWqrHqSxU MbdQ== 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 y91si2291692edy.242.2018.01.16.05.48.12; Tue, 16 Jan 2018 05:48:12 -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 6BE1FC21DC1; Tue, 16 Jan 2018 13:47:07 +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 ABA22C21C2F; Tue, 16 Jan 2018 13:46:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 806DFC21DA6; Tue, 16 Jan 2018 13:46:45 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 1E2BFC21DA6 for ; Tue, 16 Jan 2018 13:46:45 +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 7EC60AD0C; Tue, 16 Jan 2018 13:46:44 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Tue, 16 Jan 2018 14:46:38 +0100 Message-Id: <20180116134638.3879-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180116134638.3879-1-agraf@suse.de> References: <20180116134638.3879-1-agraf@suse.de> Subject: [U-Boot] [PATCH 3/3] mmc: bcm2835_sdhci: Add pinmux support 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 bcm2835 firmware provided device trees expect device tree users to support pin muxing for the SD devices to work properly. This patch adds pin muxing support to the sdhci based SD controller on said family of SoCs, so that its pins are getting configured correctly on boot. Signed-off-by: Alexander Graf --- drivers/mmc/bcm2835_sdhci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c index 3157354d2a..62ad109361 100644 --- a/drivers/mmc/bcm2835_sdhci.c +++ b/drivers/mmc/bcm2835_sdhci.c @@ -45,6 +45,7 @@ #include #include #include +#include /* 400KHz is max freq for card ID etc. Use that as min */ #define MIN_FREQ 400000 @@ -178,6 +179,7 @@ static int bcm2835_sdhci_probe(struct udevice *dev) fdt_addr_t base; int emmc_freq; int ret; + int pinctrl_handle; base = devfdt_get_addr(dev); if (base == FDT_ADDR_T_NONE) @@ -190,6 +192,15 @@ static int bcm2835_sdhci_probe(struct udevice *dev) } emmc_freq = ret; + pinctrl_handle = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "pinctrl-0", -1); + if (pinctrl_handle != -1) { + struct udevice *dev; + + /* Need to set up pinmuxing */ + if (!uclass_first_device(UCLASS_GPIO, &dev) && dev) + bcm2835_gpio_set_pinmux(dev, pinctrl_handle); + } + /* * See the comments in bcm2835_sdhci_raw_writel(). *