Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp1991454pxb; Sun, 10 Jan 2021 19:42:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAxtnuJfcDuJYzCr+QEstJXC3G8+DOL6lfdUCLUVZBCbpZGG7icQB0j6ri1par7WPOx4Ud X-Received: by 2002:a50:d484:: with SMTP id s4mr12641953edi.13.1610336555266; Sun, 10 Jan 2021 19:42:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610336555; cv=none; d=google.com; s=arc-20160816; b=dUbQWd+9KiIY39TZnIxTv3u5COJW7hfiUyHD5077nCKwNdLLTGYH5VdRmQfKrucVnd fkKoHJ2wS9wS1Qp2Zt1ThFHCfE06VEPlum1M1PGG1vhsCJff17Ge8hzxrxX0ydVKEVeP dj1a6OmHkIaQEWyP99JqkCxjPIZVcdAajAgZBjujw1ME5E6G8UrZWNhPbA7MjkhvECju mqltR9OIJ+aN6ayvishTqbMlkx5rQU/jM22AA9KpXe82iCAQRacyrlm+ZlZhEJD3H8VF OzL8VdoM8X5ufIF22LAi/Vrjv4hVB0izLqkW0orj5aZeNq1u2yfMFjQu5fUf87tvbUni Z5Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=mxE6sVRvs8E5GG8VQICeHpPFebEMjdpq2L1/lNs2OQw=; b=zzeHkShvdZK/yuBkjxYI/Dm2PbCF2x9JJJ0tdAFb9smfaF8tKyR9hgrtdOsAgGzLrx HlmyuCWjXXvreBPpaM7Ni0HMC0SpDyUATmUQUIvwfPYhv1YnMilDWJJ5tib1WsaMdWU/ xqiHTqg9KMaRN6C/SG88pXhwgOxB1xeJUyXxoXZEajA/1RlwMVApZEEcZ92TsTdEmaE8 TVo0S4a7SpkhWGlgWTgwhWWmfqNUenPRn9V62LfW7vgDk6uAmUuwy1zAX5sdvWPD6B5D 2vOcGO7Qf1LjOKP+gO90AaIxTpmkH7dTnQ3YiKiGlr0XHptujlomFJ9srZQYnUL185CF tucA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml22si6039056ejb.172.2021.01.10.19.42.11; Sun, 10 Jan 2021 19:42:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbhAKDj7 (ORCPT + 99 others); Sun, 10 Jan 2021 22:39:59 -0500 Received: from foss.arm.com ([217.140.110.172]:44638 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725824AbhAKDj6 (ORCPT ); Sun, 10 Jan 2021 22:39:58 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 576C131B; Sun, 10 Jan 2021 19:39:12 -0800 (PST) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DCC0A3F719; Sun, 10 Jan 2021 19:39:11 -0800 (PST) Subject: Re: [PATCH] mmc: sdhci-iproc: Add ACPI bindings for the rpi4 To: Stefan Wahren , linux-mmc@vger.kernel.org, Nicolas Saenz Julienne Cc: ulf.hansson@linaro.org, f.fainelli@gmail.com, sbranden@broadcom.com, rjui@broadcom.com, adrian.hunter@intel.com, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org References: <20210108211339.1724769-1-jeremy.linton@arm.com> From: Jeremy Linton Message-ID: Date: Sun, 10 Jan 2021 21:39:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 1/9/21 5:07 AM, Stefan Wahren wrote: > Hi Jeremy, > > +add Nicolas > > Am 08.01.21 um 22:13 schrieb Jeremy Linton: >> The rpi4 has a Arasan controller it carries over >> from the rpi3, and a newer eMMC2 controller. >> Because of a couple "quirks" it seems wiser to bind >> these controllers to the same driver that DT is using >> on this platform rather than the generic sdhci_acpi >> driver with PNP0D40. >> >> So, we use BCM2847 for the older Arasan and BRCME88C >> for the newer eMMC2. >> >> With this change linux is capable of utilizing the >> SD card slot, and the wifi on this platform >> with linux. >> >> Signed-off-by: Jeremy Linton >> --- >> drivers/mmc/host/sdhci-iproc.c | 14 ++++++++++++++ >> 1 file changed, 14 insertions(+) >> >> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c >> index c9434b461aab..f79d97b41805 100644 >> --- a/drivers/mmc/host/sdhci-iproc.c >> +++ b/drivers/mmc/host/sdhci-iproc.c >> @@ -250,6 +250,14 @@ static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = { >> .ops = &sdhci_iproc_32only_ops, >> }; >> >> +static const struct sdhci_pltfm_data sdhci_bcm_arasan_data = { >> + .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION | >> + SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | >> + SDHCI_QUIRK_NO_HISPD_BIT, >> + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, >> + .ops = &sdhci_iproc_32only_ops, >> +}; First, thanks for taking a look at this! > Why do we need an almost exact copy of bcm2835_data which works fine for > all Raspberry Pi boards? The short answer to the remainder of this email is that i'm trying to continue supporting existing OSs (windows) using the ACPI tables on the rpi3/rpi4 while adding rpi4+Linux support. An even shorter answer is they don't work because ACPI doesn't provide the same clock/attributes/etc controls that exist with DT. So, what happened here is that I got this controller "working" with the generic PNP0D40 sdhci_acpi driver. I managed this only by controlling the sdhci_caps/masks in the firmware. In theory this minimizes the amount of work needed on the other OS which are booting on the same ACPI tables (*bsds). They should only need to quirk the bcm/arasan specific functionality, rather than some of the quirking which change the caps behavior. But because we don't know which if any of the older rpi/arasan quirks are still needed the safest solution is to use the _iproc driver and just drop the quirk flags known to be worked around by the firmware caps override. >> + >> static const struct sdhci_iproc_data bcm2835_data = { >> .pdata = &sdhci_bcm2835_pltfm_data, >> .caps = ((0x1 << SDHCI_MAX_BLOCK_SHIFT) >> @@ -261,6 +269,10 @@ static const struct sdhci_iproc_data bcm2835_data = { >> .mmc_caps = 0x00000000, >> }; >> >> +static const struct sdhci_iproc_data bcm_arasan_data = { >> + .pdata = &sdhci_bcm_arasan_data, >> +}; >> + >> static const struct sdhci_ops sdhci_iproc_bcm2711_ops = { >> .read_l = sdhci_iproc_readl, >> .read_w = sdhci_iproc_readw, >> @@ -299,6 +311,8 @@ MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match); >> static const struct acpi_device_id sdhci_iproc_acpi_ids[] = { >> { .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data }, >> { .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data }, >> + { .id = "BCM2847", .driver_data = (kernel_ulong_t)&bcm_arasan_data }, > > Sorry, i don't have deeper knowledge about ACPI, but BCM2837 is the > official naming of the SoC on the RPi 3. > > Is this a typo in the id? Not really. Some background: The PFTF is basically the custodian of the combined rpi3 port done by Microsoft and a few other peoples/organizations ports. That merged code base was upstreamed a couple years ago to edk2 for the rpi3 and is the official port. On the rpi3+uefi platform, linux is just using DT, but windows and possibly other OSs are using the ACPI tables. For the Rpi4, the intentions is to be an ACPI first platform, but we are inheriting the rpi3 legacy peripheral descriptions. So, for the past year+ everyone has been basing their rpi4 ACPI OS ports on those tables and only adjusting them in backwards compatible ways. Meaning, that a few years back someone put that ID in the rpi3 ACPI tables, and now we are stuck with it unless we are willing to break other OSs. > >> + { .id = "BRCME88C", .driver_data = (kernel_ulong_t)&bcm2711_data }, >> { /* sentinel */ } >> }; >> MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids); >