From patchwork Wed Jun 2 19:27:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Cooper X-Patchwork-Id: 12295605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2CABC47083 for ; Wed, 2 Jun 2021 19:30:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9A7961009 for ; Wed, 2 Jun 2021 19:30:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9A7961009 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xo07mMXfeiOjef/H7zT0ouAV5rUPng+nA0Hk+E2sxWs=; b=JDURDCyXZiuFBp EW4zMT+2WYp39+ugan8C9BEfP4ao1TOSVe+RjsAsv8z6wcnc/guesmXCBz3ynBf/u4vw/v1iusID2 3uhaA1OgBAx+3WWi05au+m05nWp7jStU6QW+Nqr/oVT9LGF8D/eDYrf5rLunE9nX4hMVP/YZb4MkX YHrYLRC/lUNRMW/eKucdbwhBCjHU7q28hzOKTepzNGJM+E9ognsAeqXTaKI1PoUh2xOQosaBKa9ev FO5fkm1CVDvcAzV0wrkWsdfXL/CNJQZ1AhWMKNbo+1w3t2N4YHqo3xySks3G4TfQ+EYjILN0zfq+a aypGU8eutUh5JQN314bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loWXU-005xXC-VY; Wed, 02 Jun 2021 19:28:29 +0000 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loWXQ-005xWs-Ui for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 19:28:26 +0000 Received: by mail-pg1-x52b.google.com with SMTP id o9so271941pgd.2 for ; Wed, 02 Jun 2021 12:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XzS7P5N5k8NA+I80eCjz5cao0sI4VjQkYkjsy3xGV2s=; b=XcmgsIbVOf1QZ7uTKgEMHSEjQ/6DN5FscfTVPa5dfmC9xGud8OWTtoQAmFp+yvb6GV rrgTaYQfEUwx1J19VajRnvPqP4cWtj3l2EJ9eb5Omx6+4k6XCpbK5daqPgiRuceV4x3t UIj5IgTSA7/0vU0CRrJYc5i9Hf3uPNH0+oGGjWtTRBZOC4dva5uHfKic/fOnmH2wUbgo uqAsaSBMeMYlCQZ6Sv2rytprJh5h8UES/7GU0N4Xy2VSya1yCix2S4Z3OrF8OSiymw/F 9uw7qPSSvZ5hqprNEK3CAUKyhvLQhPheW5C20N2nFy7j1jF+QnTLIN8yTj8bUpWZFYcm 73LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XzS7P5N5k8NA+I80eCjz5cao0sI4VjQkYkjsy3xGV2s=; b=mlpre8NPC1EsSy1CUjkZCxQKe6lEH7xmUrXzqu3SeaTUzazU/qu9FWAUr3GHbIlHun evRixYBOQamJnVx1jcXE0xH4ia0qnKICo7ybo7Q8/SJKDGZzmaH+6sl/JOtkFJKvBCpK xOzimFIKzTToghaXkJWRonBbIl20AT+1hRNSqhfW/APJpGcJ+6UOMh7q2lKSkrqwPNIt NclqPV2KHNfls2ZyXvc4Ld+r8cOMfqEv6UDVrshbGUAFKI8BGmTXL0makVXg4caT6hTS BnUMgY1R2de9XPue3zB+LEKJE+JqG91ecHqCsseDPyzjmLiLGSTh46yw1HN0hPIjMBBF fevg== X-Gm-Message-State: AOAM5321rG/Mj9oJGNLVnxygJQa64GEpL+uNgxNjtbYFlnljpDk+rfZK 9WEQ1j5I9nzbn86Xl4gVRyI= X-Google-Smtp-Source: ABdhPJzuX7PTrVxOwtB9BNIY51BbJrzkNV8t51Kl5odDi2X2XBDtb7Ecu3lYfyLom7NDDesosLlwyA== X-Received: by 2002:a63:5a19:: with SMTP id o25mr35092339pgb.122.1622662103231; Wed, 02 Jun 2021 12:28:23 -0700 (PDT) Received: from stbsrv-and-01.and.broadcom.net ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id m134sm349882pfd.148.2021.06.02.12.28.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 12:28:22 -0700 (PDT) From: Al Cooper To: linux-kernel@vger.kernel.org Cc: Al Cooper , Adrian Hunter , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Nicolas Saenz Julienne , Ray Jui , Rob Herring , Scott Branden , Ulf Hansson Subject: [PATCH 2/2] mmc: sdhci-iproc: Add support for the legacy sdhci controller on the BCM7211 Date: Wed, 2 Jun 2021 15:27:58 -0400 Message-Id: <20210602192758.38735-2-alcooperx@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210602192758.38735-1-alcooperx@gmail.com> References: <20210602192758.38735-1-alcooperx@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_122825_053908_B2C768B8 X-CRM114-Status: GOOD ( 18.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for the legacy Arasan sdhci controller on the BCM7211 and related SoC's. This includes adding a .shutdown callback to increase the power savings during S5. Signed-off-by: Al Cooper --- drivers/mmc/host/Kconfig | 2 +- drivers/mmc/host/sdhci-iproc.c | 30 ++++++++++++++++++++++++++++++ drivers/mmc/host/sdhci.h | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index a4d4c757eea0..561184fa7eb9 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -412,7 +412,7 @@ config MMC_SDHCI_MILBEAUT config MMC_SDHCI_IPROC tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller" - depends on ARCH_BCM2835 || ARCH_BCM_IPROC || COMPILE_TEST + depends on ARCH_BCM2835 || ARCH_BCM_IPROC || ARCH_BRCMSTB || COMPILE_TEST depends on MMC_SDHCI_PLTFM depends on OF || ACPI default ARCH_BCM_IPROC diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index ddeaf8e1f72f..cce390fe9cf3 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -286,11 +286,35 @@ static const struct sdhci_iproc_data bcm2711_data = { .mmc_caps = MMC_CAP_3_3V_DDR, }; +static const struct sdhci_pltfm_data sdhci_bcm7211a0_pltfm_data = { + .quirks = SDHCI_QUIRK_MISSING_CAPS | + SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | + SDHCI_QUIRK_BROKEN_DMA | + SDHCI_QUIRK_BROKEN_ADMA, + .ops = &sdhci_iproc_ops, +}; + +#define BCM7211A0_BASE_CLK_MHZ 100 +static const struct sdhci_iproc_data bcm7211a0_data = { + .pdata = &sdhci_bcm7211a0_pltfm_data, + .caps = ((BCM7211A0_BASE_CLK_MHZ / 2) << SDHCI_TIMEOUT_CLK_SHIFT) | + (BCM7211A0_BASE_CLK_MHZ << SDHCI_CLOCK_BASE_SHIFT) | + ((0x2 << SDHCI_MAX_BLOCK_SHIFT) + & SDHCI_MAX_BLOCK_MASK) | + SDHCI_CAN_VDD_330 | + SDHCI_CAN_VDD_180 | + SDHCI_CAN_DO_SUSPEND | + SDHCI_CAN_DO_HISPD, + .caps1 = SDHCI_DRIVER_TYPE_C | + SDHCI_DRIVER_TYPE_D, +}; + static const struct of_device_id sdhci_iproc_of_match[] = { { .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data }, { .compatible = "brcm,bcm2711-emmc2", .data = &bcm2711_data }, { .compatible = "brcm,sdhci-iproc-cygnus", .data = &iproc_cygnus_data}, { .compatible = "brcm,sdhci-iproc", .data = &iproc_data }, + { .compatible = "brcm,bcm7211a0-sdhci", .data = &bcm7211a0_data }, { } }; MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match); @@ -384,6 +408,11 @@ static int sdhci_iproc_probe(struct platform_device *pdev) return ret; } +static void sdhci_iproc_shutdown(struct platform_device *pdev) +{ + sdhci_pltfm_suspend(&pdev->dev); +} + static struct platform_driver sdhci_iproc_driver = { .driver = { .name = "sdhci-iproc", @@ -394,6 +423,7 @@ static struct platform_driver sdhci_iproc_driver = { }, .probe = sdhci_iproc_probe, .remove = sdhci_pltfm_unregister, + .shutdown = sdhci_iproc_shutdown, }; module_platform_driver(sdhci_iproc_driver); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 0770c036e2ff..c35ed4be75b7 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -201,8 +201,10 @@ #define SDHCI_CAPABILITIES 0x40 #define SDHCI_TIMEOUT_CLK_MASK GENMASK(5, 0) +#define SDHCI_TIMEOUT_CLK_SHIFT 0 #define SDHCI_TIMEOUT_CLK_UNIT 0x00000080 #define SDHCI_CLOCK_BASE_MASK GENMASK(13, 8) +#define SDHCI_CLOCK_BASE_SHIFT 8 #define SDHCI_CLOCK_V3_BASE_MASK GENMASK(15, 8) #define SDHCI_MAX_BLOCK_MASK 0x00030000 #define SDHCI_MAX_BLOCK_SHIFT 16