Message ID | 20230410184526.15990-12-blarson@amd.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2086902vqo; Mon, 10 Apr 2023 11:51:44 -0700 (PDT) X-Google-Smtp-Source: AKy350YZrlChH5nnTbqnfTcFZxZYfpXDRtEcKBQM0nt5MF3tYx3np4PHFuYmNakicK/use2i8IdK X-Received: by 2002:a17:907:20b6:b0:94c:6762:e20d with SMTP id pw22-20020a17090720b600b0094c6762e20dmr1705832ejb.12.1681152704524; Mon, 10 Apr 2023 11:51:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681152704; cv=pass; d=google.com; s=arc-20160816; b=oHYNwhjhUQQQGgPWLGgsf/VIEERkCGtDzrgJE9annX35n7eDuGrRa3KbgNngS4lEtz uK6iyLmomnbXbfnlz7Gz9PVBXXQjnRuL2+bBwzZ0tP6p8hEMpZb3t856JpbjJDMWnN+J M/Nt+jyydBHJBFrsmCbqoXiyVRBD5DMHx36WsPU6exkFXvL/fQCgSQ7Dv5DtY987NzAb ND6jUb4xuBOxMqKqcKBo+OwcBuXRA+JJWG8KaRUxBmY2WqN/UVP2K5Xg/0vlohhnhMw0 IAT9c3YRxhqM9d6atRLzVYbdnCveEWTXe4NiCD1xGDPdGBAgAmoCjEK5PhNeboowPiJA 4s6A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ymfACAjSLWbCk+4U3bvrCLTQlZYsf0VDrwtsvVsOjLE=; b=BHGcQD8pA1RbmtnJ39aljaluEj90/+1nggy/icnUo4XkvdVQ62pfc8ufP2CMdI3zqB a5rYEZRtgBFa81tc3yVON5jrYlWAEzN82XSEPuzyhPIuVAGET1obwkfq8NEkFqGuBCgL 30WKNYqOFCrU2UV5Pu7/bqgD4DtDmuxpyZNXDShLpxwiM1E7h4dIBqat4jnidOzL85Mf k3BQHhzDTL7KsfOA46ChdJxARItN3Ocpm6UcDl1UAX3FcwieGvY1bJ9ix5kshVrGf8z7 hzlx4Ew9ORjDX4TKWMP/k9w9v3E2ZsEgn+27IyGni8/f7QBgWTkJ+T/dTSYIAfgCDk51 qnRQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zK8NCDne; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc10-20020a170907168a00b0094a7040a5c8si4546487ejc.843.2023.04.10.11.51.17; Mon, 10 Apr 2023 11:51:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zK8NCDne; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230048AbjDJSsC (ORCPT <rfc822;yuanzuo1009@gmail.com> + 99 others); Mon, 10 Apr 2023 14:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbjDJSrx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 10 Apr 2023 14:47:53 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 573852703; Mon, 10 Apr 2023 11:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JmkvIcrFQllf3lmXNlQ9ob+6HAApevhyxK8bvixm0Qi3qR8Py5ZOqn9LuPqbptbkmEFNFk6WFwBl3B2OWbPmti5M37Qs/uMOVClY4saWGw8kl/N/+MVAD0KKA2+22YDrPHl28CpFu9ZmmbzRNpaubT7Mg04vTcc+ocFMLhQl/nb+1DqH8a1coeYvJYEa3ym4dBxmo553NaZDNjtmrTycKndPrS4oxd7tMByz4rfcEGEL88GWGHZpVNprhPrSujYweBgxWLRU7CCfbaFO7PTE9dp/YWnD/IjJFNpIWQbLh2gF3PtID+NqpM5nGBD1XchuNueCA4Nve8URE/CgZS0GVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ymfACAjSLWbCk+4U3bvrCLTQlZYsf0VDrwtsvVsOjLE=; b=CIpMNyhDRfjj8DahqKmM5912EYVHDNfJs6XJZBeDkod8Ia0NM7yg4n65RsR9+Pn4s8Zfv+Gxhg74S0Ctc+PIcAsn2Ad+e3hITIOjdzNjXG9uxzc6YwfVEt8bpqxsKWRgQbuu2QMf/zAYS0XtQcEFQaD7WrE7YlEIbTJCZxoVSskIXsMYhGW9xA5RAao+eLI5nAKLgOIMfJN7Vk6fHx/Yd2GR1+FAx5cjYwqTcqHS5v1XaIK7NiiHClO3G8lB5MEaeG2/ixT+BtR69U+Xm4hFgGg7dIG6SliLhQHzp8VQqD5d+9PZfwGUs7xM43WtfGLVdPxIxEiMALcnH5WYNS0dNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ymfACAjSLWbCk+4U3bvrCLTQlZYsf0VDrwtsvVsOjLE=; b=zK8NCDneqNk5x3r4uwAFEGdofqFOitdf+xqi78j1T9M6oF0kD7cQMwJ82bCeWKi+wfbl7FK05p1/+VlHqFNFw++rV1T0zWkobvn+DGH4x44/uc29UU1Cvc/q4AZ9IfMyNC6IYXN2mjbdPqFdjuwoW0tNK8LhldfpSBkYYI19zok= Received: from DM6PR21CA0027.namprd21.prod.outlook.com (2603:10b6:5:174::37) by CO6PR12MB5425.namprd12.prod.outlook.com (2603:10b6:303:13e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.33; Mon, 10 Apr 2023 18:47:32 +0000 Received: from DM6NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:5:174:cafe::8c) by DM6PR21CA0027.outlook.office365.com (2603:10b6:5:174::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.2 via Frontend Transport; Mon, 10 Apr 2023 18:47:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT038.mail.protection.outlook.com (10.13.173.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.25 via Frontend Transport; Mon, 10 Apr 2023 18:47:31 +0000 Received: from platform-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 10 Apr 2023 13:47:28 -0500 From: Brad Larson <blarson@amd.com> To: <linux-arm-kernel@lists.infradead.org> CC: <linux-kernel@vger.kernel.org>, <linux-mmc@vger.kernel.org>, <linux-spi@vger.kernel.org>, <adrian.hunter@intel.com>, <alcooperx@gmail.com>, <andy.shevchenko@gmail.com>, <arnd@arndb.de>, <blarson@amd.com>, <brendan.higgins@linux.dev>, <briannorris@chromium.org>, <brijeshkumar.singh@amd.com>, <catalin.marinas@arm.com>, <davidgow@google.com>, <gsomlo@gmail.com>, <gerg@linux-m68k.org>, <krzk@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <lee@kernel.org>, <lee.jones@linaro.org>, <broonie@kernel.org>, <yamada.masahiro@socionext.com>, <p.zabel@pengutronix.de>, <piotrs@cadence.com>, <p.yadav@ti.com>, <rdunlap@infradead.org>, <robh+dt@kernel.org>, <samuel@sholland.org>, <fancer.lancer@gmail.com>, <skhan@linuxfoundation.org>, <suravee.suthikulpanit@amd.com>, <thomas.lendacky@amd.com>, <tonyhuang.sunplus@gmail.com>, <ulf.hansson@linaro.org>, <vaishnav.a@ti.com>, <will@kernel.org>, <devicetree@vger.kernel.org> Subject: [PATCH v13 11/15] mmc: sdhci-cadence: Enable device specific override of writel() Date: Mon, 10 Apr 2023 11:45:22 -0700 Message-ID: <20230410184526.15990-12-blarson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230410184526.15990-1-blarson@amd.com> References: <20230410184526.15990-1-blarson@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT038:EE_|CO6PR12MB5425:EE_ X-MS-Office365-Filtering-Correlation-Id: 9df2f4cd-d3fa-490a-a878-08db39f40aab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Thg55SxbMHMDJYLE1U7b+FlHe5S49Sqz/2dOuk7f8xBJfhXS+fERg7sqwImvsBgmr6zc7iO5KnG8VIsQCs6Y0RF6K4o8waha8ZwBIx32zs4qYxUsQX8mvPN2uJ5SD1eoVZNjk7T8LMawE8z65kXFAmkLDSbYPKs0WjKxSgvJXLUlX/tKPYj8Ot/Lcu2FjTAj//jBpVKlwN6AOFPWWtk5iC6fp9EhULwNk6fwNBxfW/n4ZQOaqirL5tzVFx3Gk/KFK5swW691hmVo1zfA9bg2+mkt/k1vPnBCdZbFJuAoV6iJh2vS6c5erAtsMMh5umkHwOdjkuzHeQyAUg6dtEzLR1cT9VjGxGIXxlnsRc2r0etCHNaBWFzGXZl4Un8nnbGcOwycn/J10BwvSku5ph3LNNVrOfy+TcvVLOdaVziknuwcBvs6k2vKggx9FWdogOvVIwGWxMjyIjknnkN46FQXXBMuF9Z7GTdTDVYwmbAlDNDeTlBlLBHSOfJqHQD/bmxuw4MxCXDo+bwPvpFHXYrsh83AjKZ0dcMXc/waRU2MA5/p6vEPuY2DAUciGMMfo2FNIwPi8e7KuDCOafCTOB1maDplhRUYTUaodgn3hNDqZHd6lga3JmN3pWy8sngndq5Km7sgo34O/cx75m45kxqZZz+il+sA/o2IOuqiIfUH8obf5dGyeVt3LhHKm0Lk9Q4y3SJS229xa6jLMlButSyRr97R1wiUodOtZKGbNW7pvLk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(396003)(39860400002)(376002)(451199021)(46966006)(40470700004)(36840700001)(316002)(40480700001)(81166007)(6666004)(36756003)(41300700001)(82310400005)(8936002)(47076005)(40460700003)(7406005)(7416002)(83380400001)(2616005)(54906003)(16526019)(186003)(336012)(426003)(26005)(82740400003)(356005)(1076003)(5660300002)(36860700001)(2906002)(70586007)(478600001)(70206006)(6916009)(4326008)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2023 18:47:31.6101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9df2f4cd-d3fa-490a-a878-08db39f40aab X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5425 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762816378181022211?= X-GMAIL-MSGID: =?utf-8?q?1762816378181022211?= |
Series |
Support AMD Pensando Elba SoC
|
|
Commit Message
Brad Larson
April 10, 2023, 6:45 p.m. UTC
SoCs with device specific Cadence implementation, such as setting byte-enables before the write, need to override writel(). Add a callback where the default is writel() for all existing chips. Signed-off-by: Brad Larson <blarson@amd.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> --- v10 changes: - The 1st patch adding private writel() is unchanged. The 2nd patch is split into two patches to provide for device specific init in one patch with no effect on existing designs. Then add the pensando support into the next patch. Then the 4th patch is mmc hardware reset support which is unchanged. v9 changes: - No change to this patch but as some patches are deleted and this is a respin the three successive patches to sdhci-cadence.c are patches 12, 13, and 14 which do the following: 1. Add ability for Cadence specific design to have priv writel(). 2. Add Elba SoC support that requires its own priv writel() for byte-lane control . 3. Add support for mmc hardware reset. --- drivers/mmc/host/sdhci-cadence.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
Comments
On Mon, 10 Apr 2023 at 20:47, Brad Larson <blarson@amd.com> wrote: > > SoCs with device specific Cadence implementation, such as setting > byte-enables before the write, need to override writel(). Add a > callback where the default is writel() for all existing chips. > > Signed-off-by: Brad Larson <blarson@amd.com> > Acked-by: Adrian Hunter <adrian.hunter@intel.com> Applied for next, thanks! Kind regards Uffe > --- > > v10 changes: > - The 1st patch adding private writel() is unchanged. The 2nd patch is split > into two patches to provide for device specific init in one patch with no > effect on existing designs. Then add the pensando support into the next patch. > Then the 4th patch is mmc hardware reset support which is unchanged. > > v9 changes: > - No change to this patch but as some patches are deleted and this is > a respin the three successive patches to sdhci-cadence.c are > patches 12, 13, and 14 which do the following: > > 1. Add ability for Cadence specific design to have priv writel(). > 2. Add Elba SoC support that requires its own priv writel() for > byte-lane control . > 3. Add support for mmc hardware reset. > > --- > drivers/mmc/host/sdhci-cadence.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c > index 6f2de54a5987..708d4297f241 100644 > --- a/drivers/mmc/host/sdhci-cadence.c > +++ b/drivers/mmc/host/sdhci-cadence.c > @@ -67,6 +67,7 @@ struct sdhci_cdns_phy_param { > struct sdhci_cdns_priv { > void __iomem *hrs_addr; > bool enhanced_strobe; > + void (*priv_writel)(struct sdhci_cdns_priv *priv, u32 val, void __iomem *reg); > unsigned int nr_phy_params; > struct sdhci_cdns_phy_param phy_params[]; > }; > @@ -90,6 +91,12 @@ static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = { > { "cdns,phy-dll-delay-strobe", SDHCI_CDNS_PHY_DLY_STROBE, }, > }; > > +static inline void cdns_writel(struct sdhci_cdns_priv *priv, u32 val, > + void __iomem *reg) > +{ > + writel(val, reg); > +} > + > static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv, > u8 addr, u8 data) > { > @@ -104,17 +111,17 @@ static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv, > > tmp = FIELD_PREP(SDHCI_CDNS_HRS04_WDATA, data) | > FIELD_PREP(SDHCI_CDNS_HRS04_ADDR, addr); > - writel(tmp, reg); > + priv->priv_writel(priv, tmp, reg); > > tmp |= SDHCI_CDNS_HRS04_WR; > - writel(tmp, reg); > + priv->priv_writel(priv, tmp, reg); > > ret = readl_poll_timeout(reg, tmp, tmp & SDHCI_CDNS_HRS04_ACK, 0, 10); > if (ret) > return ret; > > tmp &= ~SDHCI_CDNS_HRS04_WR; > - writel(tmp, reg); > + priv->priv_writel(priv, tmp, reg); > > ret = readl_poll_timeout(reg, tmp, !(tmp & SDHCI_CDNS_HRS04_ACK), > 0, 10); > @@ -191,7 +198,7 @@ static void sdhci_cdns_set_emmc_mode(struct sdhci_cdns_priv *priv, u32 mode) > tmp = readl(priv->hrs_addr + SDHCI_CDNS_HRS06); > tmp &= ~SDHCI_CDNS_HRS06_MODE; > tmp |= FIELD_PREP(SDHCI_CDNS_HRS06_MODE, mode); > - writel(tmp, priv->hrs_addr + SDHCI_CDNS_HRS06); > + priv->priv_writel(priv, tmp, priv->hrs_addr + SDHCI_CDNS_HRS06); > } > > static u32 sdhci_cdns_get_emmc_mode(struct sdhci_cdns_priv *priv) > @@ -223,7 +230,7 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) > */ > for (i = 0; i < 2; i++) { > tmp |= SDHCI_CDNS_HRS06_TUNE_UP; > - writel(tmp, reg); > + priv->priv_writel(priv, tmp, reg); > > ret = readl_poll_timeout(reg, tmp, > !(tmp & SDHCI_CDNS_HRS06_TUNE_UP), > @@ -386,6 +393,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev) > priv->nr_phy_params = nr_phy_params; > priv->hrs_addr = host->ioaddr; > priv->enhanced_strobe = false; > + priv->priv_writel = cdns_writel; > host->ioaddr += SDHCI_CDNS_SRS_BASE; > host->mmc_host_ops.hs400_enhanced_strobe = > sdhci_cdns_hs400_enhanced_strobe; > -- > 2.17.1 >
diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 6f2de54a5987..708d4297f241 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -67,6 +67,7 @@ struct sdhci_cdns_phy_param { struct sdhci_cdns_priv { void __iomem *hrs_addr; bool enhanced_strobe; + void (*priv_writel)(struct sdhci_cdns_priv *priv, u32 val, void __iomem *reg); unsigned int nr_phy_params; struct sdhci_cdns_phy_param phy_params[]; }; @@ -90,6 +91,12 @@ static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = { { "cdns,phy-dll-delay-strobe", SDHCI_CDNS_PHY_DLY_STROBE, }, }; +static inline void cdns_writel(struct sdhci_cdns_priv *priv, u32 val, + void __iomem *reg) +{ + writel(val, reg); +} + static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv, u8 addr, u8 data) { @@ -104,17 +111,17 @@ static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv, tmp = FIELD_PREP(SDHCI_CDNS_HRS04_WDATA, data) | FIELD_PREP(SDHCI_CDNS_HRS04_ADDR, addr); - writel(tmp, reg); + priv->priv_writel(priv, tmp, reg); tmp |= SDHCI_CDNS_HRS04_WR; - writel(tmp, reg); + priv->priv_writel(priv, tmp, reg); ret = readl_poll_timeout(reg, tmp, tmp & SDHCI_CDNS_HRS04_ACK, 0, 10); if (ret) return ret; tmp &= ~SDHCI_CDNS_HRS04_WR; - writel(tmp, reg); + priv->priv_writel(priv, tmp, reg); ret = readl_poll_timeout(reg, tmp, !(tmp & SDHCI_CDNS_HRS04_ACK), 0, 10); @@ -191,7 +198,7 @@ static void sdhci_cdns_set_emmc_mode(struct sdhci_cdns_priv *priv, u32 mode) tmp = readl(priv->hrs_addr + SDHCI_CDNS_HRS06); tmp &= ~SDHCI_CDNS_HRS06_MODE; tmp |= FIELD_PREP(SDHCI_CDNS_HRS06_MODE, mode); - writel(tmp, priv->hrs_addr + SDHCI_CDNS_HRS06); + priv->priv_writel(priv, tmp, priv->hrs_addr + SDHCI_CDNS_HRS06); } static u32 sdhci_cdns_get_emmc_mode(struct sdhci_cdns_priv *priv) @@ -223,7 +230,7 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val) */ for (i = 0; i < 2; i++) { tmp |= SDHCI_CDNS_HRS06_TUNE_UP; - writel(tmp, reg); + priv->priv_writel(priv, tmp, reg); ret = readl_poll_timeout(reg, tmp, !(tmp & SDHCI_CDNS_HRS06_TUNE_UP), @@ -386,6 +393,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev) priv->nr_phy_params = nr_phy_params; priv->hrs_addr = host->ioaddr; priv->enhanced_strobe = false; + priv->priv_writel = cdns_writel; host->ioaddr += SDHCI_CDNS_SRS_BASE; host->mmc_host_ops.hs400_enhanced_strobe = sdhci_cdns_hs400_enhanced_strobe;