From patchwork Thu Oct 17 06:21:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194831 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1722A912 for ; Thu, 17 Oct 2019 06:22:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D9BF02054F for ; Thu, 17 Oct 2019 06:22:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="L5wSSPrG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437225AbfJQGWK (ORCPT ); Thu, 17 Oct 2019 02:22:10 -0400 Received: from mail-eopbgr760082.outbound.protection.outlook.com ([40.107.76.82]:55526 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389916AbfJQGWK (ORCPT ); Thu, 17 Oct 2019 02:22:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FF73MEqWqf+OwN0xDjNe1N4dH6mi7OvBOe6/RJw+nsgeV4AtG1t38VdxLThe48vCiWBuQ5kILhcu2+UU+cYgtkUS1wCobRBa3TISwj7FZJMYlj4/4DMDNtN9Am2v00w/wVfFNM7p4qVOqlJel/gHmxPN793MTHyWaEtNFqBg8TiNIUM5yDXZmlPYD6i4+LOSaU5pY6kxI0oc7xAcqkhT29kRpPCkFkTuKd9U4DrO6TUo+1cyMqkJu+QdDtRaHRjaEbyaAlKkzsnWOkXC3Dmu+aiHLusmp1jYDej7MnoUu7TBEXrylifzRIi50/C87lD2IccRoSR0Y0X/ScXLbenZ2A== 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-SenderADCheck; bh=0eQy9sbl57qj64wcfahgY/DCazAuE05WULs7Rq44dFw=; b=PmkbeIlA/0KU5XVF2I8pXsuxi+LxJsb+Xi0XHDKOMW6dq2qZ863vg0TbznRVl62hStRMEQZ5e5QBSjXoLJX2M4KZGTk0Z9yoNnxxYFoHJuZaEZR6WmFRjy6Si2ae/2kDPyY2ETwwP9iDI1ST3wv1nRLh3JzgIFBMotT3ZQGknIKKoLd6c6tfnPorjKmANrLOGhqZb0/X02dBdFjftanXr4tKYVgfa9xmbNg8yt7iNjMLzb3lbcf2S7DQVKf3a+xc7Q9o34YVZrlqybu4prnMZJtrGH9LsbEnpb2cf1NsxNIre/RDHbHYn6jb1nlDIVGTEF8cTReBj3HguXQsdo+/Qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0eQy9sbl57qj64wcfahgY/DCazAuE05WULs7Rq44dFw=; b=L5wSSPrGXhfz6XPKgSXIvb3x3pJ+H9nDzTff3kgQx13pFqfJbzoTtYa9aIpWqbDqIRVlTdQBO3jDBqohNhtlFUTDTNf2RN/zzEVfH9kai97znasmWw3BgUa56DWjptKjLtc2PnnNIY3bCJ9JfPMLbMf9ktdVUc2qgXyqYEeMuwc= Received: from SN4PR0201CA0027.namprd02.prod.outlook.com (2603:10b6:803:2e::13) by DM5PR02MB2811.namprd02.prod.outlook.com (2603:10b6:3:107::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.18; Thu, 17 Oct 2019 06:22:04 +0000 Received: from CY1NAM02FT043.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::204) by SN4PR0201CA0027.outlook.office365.com (2603:10b6:803:2e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.18 via Frontend Transport; Thu, 17 Oct 2019 06:22:04 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT043.mail.protection.outlook.com (10.152.74.182) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:04 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAh-0004af-JO; Wed, 16 Oct 2019 23:22:03 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAc-0003f6-GB; Wed, 16 Oct 2019 23:21:58 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAa-0003ek-TT; Wed, 16 Oct 2019 23:21:57 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id 246B143A9A; Thu, 17 Oct 2019 11:51:56 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 1/8] mmc: sdhci-of-arasan: Separate out clk related data to another structure Date: Thu, 17 Oct 2019 11:51:43 +0530 Message-Id: <1571293310-92563-2-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(346002)(39860400002)(136003)(376002)(396003)(199004)(189003)(4326008)(336012)(51416003)(14444005)(42186006)(11346002)(36756003)(2616005)(476003)(26005)(126002)(186003)(36386004)(426003)(6666004)(316002)(44832011)(16586007)(70586007)(70206006)(47776003)(446003)(356004)(76176011)(5660300002)(48376002)(50226002)(305945005)(8936002)(8676002)(106002)(81166006)(50466002)(81156014)(2906002)(6266002)(486006)(107886003)(478600001)(103686004)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR02MB2811;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2fc7384b-9ce1-4f59-b782-08d752ca5426 X-MS-TrafficTypeDiagnostic: DM5PR02MB2811: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +T897kc4huKREUfMhwHSk36fEVwN4eVLRsGXXLgR6AwUErhX182Az5rbchMa2r8moPIpE/pip2V3oVDv13KwiBQOLwDHN9OmPzIc0xvZPOAqtAdK6scLBUNHuLDbN6L1ypQEwd9rMsIwqRTDP0e/BSd7k7WrFtMr+8uHxr5WY/Gn+oPxs7cLaiRbWrVkDi2EzMPYlvxredYBYk72vdq7EPVG3k9JqKwWm4zT16CKD0z6pjP2ovHywdCYqwBMsTpbs0xvWY/GhjlKLDvVzwHbwjwPjv513bKQdVzCTgHYRIHGad51E6fPEIupnIxiJphiZRyhWAJztSmXFORXrBZ1vL348TUIBIBkAocyT8AkCTc6Sdk1OlByFtnHAAQWw58LcIB5EFuel7NcCFtoo5oM3uznTsxR2k/UVTCU0Qlzq1U= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:04.2997 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2fc7384b-9ce1-4f59-b782-08d752ca5426 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2811 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org To improve the code readability, use two different structs, one for clock provider data and one for mmc platform data. Signed-off-by: Manish Narani --- drivers/mmc/host/sdhci-of-arasan.c | 31 ++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 7023cbec4017..701b6cc0f9a3 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -71,14 +71,23 @@ struct sdhci_arasan_soc_ctl_map { bool hiword_update; }; +/** + * struct sdhci_arasan_clk_data + * @sdcardclk_hw: Struct for the clock we might provide to a PHY. + * @sdcardclk: Pointer to normal 'struct clock' for sdcardclk_hw. + */ +struct sdhci_arasan_clk_data { + struct clk_hw sdcardclk_hw; + struct clk *sdcardclk; +}; + /** * struct sdhci_arasan_data * @host: Pointer to the main SDHCI host structure. * @clk_ahb: Pointer to the AHB clock * @phy: Pointer to the generic phy * @is_phy_on: True if the PHY is on; false if not. - * @sdcardclk_hw: Struct for the clock we might provide to a PHY. - * @sdcardclk: Pointer to normal 'struct clock' for sdcardclk_hw. + * @clk_data: Struct for the Arasan Controller Clock Data. * @soc_ctl_base: Pointer to regmap for syscon for soc_ctl registers. * @soc_ctl_map: Map to get offsets into soc_ctl registers. */ @@ -89,8 +98,7 @@ struct sdhci_arasan_data { bool is_phy_on; bool has_cqe; - struct clk_hw sdcardclk_hw; - struct clk *sdcardclk; + struct sdhci_arasan_clk_data clk_data; struct regmap *soc_ctl_base; const struct sdhci_arasan_soc_ctl_map *soc_ctl_map; @@ -520,8 +528,10 @@ static unsigned long sdhci_arasan_sdcardclk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { + struct sdhci_arasan_clk_data *clk_data = + container_of(hw, struct sdhci_arasan_clk_data, sdcardclk_hw); struct sdhci_arasan_data *sdhci_arasan = - container_of(hw, struct sdhci_arasan_data, sdcardclk_hw); + container_of(clk_data, struct sdhci_arasan_data, clk_data); struct sdhci_host *host = sdhci_arasan->host; return host->mmc->actual_clock; @@ -633,6 +643,7 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, struct clk *clk_xin, struct device *dev) { + struct sdhci_arasan_clk_data *clk_data = &sdhci_arasan->clk_data; struct device_node *np = dev->of_node; struct clk_init_data sdcardclk_init; const char *parent_clk_name; @@ -655,13 +666,13 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, sdcardclk_init.flags = CLK_GET_RATE_NOCACHE; sdcardclk_init.ops = &arasan_sdcardclk_ops; - sdhci_arasan->sdcardclk_hw.init = &sdcardclk_init; - sdhci_arasan->sdcardclk = - devm_clk_register(dev, &sdhci_arasan->sdcardclk_hw); - sdhci_arasan->sdcardclk_hw.init = NULL; + clk_data->sdcardclk_hw.init = &sdcardclk_init; + clk_data->sdcardclk = + devm_clk_register(dev, &clk_data->sdcardclk_hw); + clk_data->sdcardclk_hw.init = NULL; ret = of_clk_add_provider(np, of_clk_src_simple_get, - sdhci_arasan->sdcardclk); + clk_data->sdcardclk); if (ret) dev_err(dev, "Failed to add clock provider\n"); From patchwork Thu Oct 17 06:21:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194825 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E916912 for ; Thu, 17 Oct 2019 06:22:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3739621A4C for ; Thu, 17 Oct 2019 06:22:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="mCIhripl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404767AbfJQGWH (ORCPT ); Thu, 17 Oct 2019 02:22:07 -0400 Received: from mail-eopbgr770049.outbound.protection.outlook.com ([40.107.77.49]:23431 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389411AbfJQGWH (ORCPT ); Thu, 17 Oct 2019 02:22:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MkGZ2MAQiq7jSgewGxYvolRSKK0Y92peUFy3py8BrRwA9+xMvDaYjhLpSAzQXh1f8eSh27Qf+dF0xAmnxvNhOFtGueKaboOvRVewP+ECDjtHSreeshl6ocmgeVPauUja6egebVVRnYt+cW7XrsNzfKyaSZ8gEkwVzrcHNMTnjJ8Mcj5zavjKtHWKuMNl1VAmEjJML3wtmUba0kkD5s0zemQDdWEgTIahq2pOeoHkt/FaugSOhL5gkml65Ya9WoEYuWJV1WjlVtjKtzDZZdPNnWW1rNYcZUlbixJFgwn6eXxp2wF70TJHLhrugMjSl/ip6Jkrq7Zk5w0a2uUOFOYwrg== 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-SenderADCheck; bh=BXoPYeaz6IJVGbGlZ6HkOSNYtTLoVxVYczxjp4u62TI=; b=m/kT5YLg0gQI/TnGCl9EJ15RHdEobb9gtm34+zSY+O7fbRHtsLTd1UCkQFMOuBwl9D2in9sTXyUlV0KotHsAd2Xjz35Bx7wdOqOlMroeCbtmzDWId5Ff1ysL3SfPFeP1Zdi6O84KUbNFefoL6aVjnEy/pxrm9s9vyEctGGHpaJblVBJ6ikMHG1z49Cir+n3d507yBjVLjmAGaCBu9pn1xu7R4D+3JXn3gRaxlP/Ihnweh6dikElkUXA1PrtGqm3VIV7R8UhRL0yj45QjQnSTNcQ4rBdyLK9IRzYSaAItWLWHkucCU/CFrbWKLxuZJGND/4SezBr5NyMRZwzSjyiEXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BXoPYeaz6IJVGbGlZ6HkOSNYtTLoVxVYczxjp4u62TI=; b=mCIhriplcResGZ0NkbHseO3Re/50MD+DVouIFk7DX1vWeYxVnZtUNpBhAwPn48gw7ommjzcQcgiKLE+Ny1/UBk1Skj1zGTGRNCTatQAGQxynLXVUzqABHH9f+FZUlDjtq07ajZ2KLcYH+mGv43pziXZpYaqFcONPylhu5eRNpKI= Received: from CY4PR02CA0026.namprd02.prod.outlook.com (2603:10b6:903:117::12) by DM6PR02MB4219.namprd02.prod.outlook.com (2603:10b6:5:98::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Thu, 17 Oct 2019 06:22:05 +0000 Received: from BL2NAM02FT003.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::208) by CY4PR02CA0026.outlook.office365.com (2603:10b6:903:117::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.17 via Frontend Transport; Thu, 17 Oct 2019 06:22:04 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT003.mail.protection.outlook.com (10.152.76.204) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:04 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAh-0004ah-O5; Wed, 16 Oct 2019 23:22:03 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAc-0003f6-Kh; Wed, 16 Oct 2019 23:21:58 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAb-0003ey-OJ; Wed, 16 Oct 2019 23:21:57 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id EF84D43A9B; Thu, 17 Oct 2019 11:51:56 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 2/8] dt-bindings: mmc: arasan: Update Documentation for the input clock Date: Thu, 17 Oct 2019 11:51:44 +0530 Message-Id: <1571293310-92563-3-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(346002)(396003)(136003)(376002)(199004)(189003)(50226002)(76176011)(4326008)(51416003)(16586007)(48376002)(47776003)(44832011)(478600001)(36756003)(305945005)(70206006)(106002)(70586007)(426003)(356004)(6666004)(26005)(336012)(107886003)(5660300002)(186003)(6266002)(486006)(42186006)(2616005)(476003)(126002)(36386004)(2906002)(8936002)(81156014)(81166006)(103686004)(8676002)(316002)(446003)(50466002)(11346002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4219;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 55e307f7-7458-4a85-a8a9-08d752ca5433 X-MS-TrafficTypeDiagnostic: DM6PR02MB4219: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lxb+tRWn2tUlDtbs+exrpgoG2owOAe1IIBuaePWkvUuf4r+Q8HURBeKkqNjjIVx0JIW2R0PT6nydu6BTc6NMk2SU8/89MjS7lhJhYzADj74FdgS3UhpVZmVTwpAy4ssv/liFFoAzoADPPWMzlLQqG688GpnsBETWiX2/7ob3PJkZo96rg3KNesGzmsdr/mPpWdq/W+cKKi82GCeBrNTecFTXWCn95Parbo4Mfartg9sCEU10pqCZAVEDtj+hT13R12BowL2rvzQ+RxJQkdM1ZnJDK5F1ZjamxsBqLQ9lVhuwYpv1Fhb8v8hv1i97ZleKc0Po5wv9E/F6rVdcb7Y/tIjT75wHOCnQl91VzSAwrVco9RdNEFzBvlvgpdPLPZ1uK1vUqods1u5+lZJctP4fhVrdQVMRF2L0v3txUD1YCfI= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:04.4006 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 55e307f7-7458-4a85-a8a9-08d752ca5433 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4219 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add documentation for an optional input clock which is essentially used in sampling the input data coming from the card. Signed-off-by: Manish Narani Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/mmc/arasan,sdhci.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt index 7ca0aa7ccc0b..b51e40b2e0c5 100644 --- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt +++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt @@ -38,9 +38,9 @@ Optional Properties: - clock-output-names: If specified, this will be the name of the card clock which will be exposed by this device. Required if #clock-cells is specified. - - #clock-cells: If specified this should be the value <0>. With this property - in place we will export a clock representing the Card Clock. This clock - is expected to be consumed by our PHY. You must also specify + - #clock-cells: If specified this should be the value <0> or <1>. With this + property in place we will export one or two clocks representing the Card + Clock. These clocks are expected to be consumed by our PHY. - xlnx,fails-without-test-cd: when present, the controller doesn't work when the CD line is not connected properly, and the line is not connected properly. Test mode can be used to force the controller to function. From patchwork Thu Oct 17 06:21:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194835 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1B491668 for ; Thu, 17 Oct 2019 06:22:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8236B214E0 for ; Thu, 17 Oct 2019 06:22:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="A/U14Eow" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437895AbfJQGWU (ORCPT ); Thu, 17 Oct 2019 02:22:20 -0400 Received: from mail-eopbgr680067.outbound.protection.outlook.com ([40.107.68.67]:38019 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437774AbfJQGWU (ORCPT ); Thu, 17 Oct 2019 02:22:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUGY58UTUkkbLZZ7dDvbSJiZTa6EHBy8iCm/5ac6IUiL2QD//RB28p89P4FL1Z5mc23+dqxf0jyHH4EWFqXjzdtwYIk/pGseK7ENUYiI69NLtrkAKxc/JwK0M/g1BCYpK2vTKGE08sDTw3+hrKiH3BqldFKSqyq8hCfcSuoujd56FWJ7AZZF9JBuBN4K5Ccp4iyCQhZw68tkKt8eW+w3nKFpgSmRt4Nhod+MvrpTT8p+hAsbLpxeuSk4iQZkFs2FxfkcKgIScxGdxt849gL7vBZiTTxN9E5smlk/f7wr7eUPB2qAK50oAjvO9qxNMGwHIkB4lFKpu6QRLJv3DB8awQ== 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-SenderADCheck; bh=40OcsSTvAI7fWjnEhcoxg8VFoF2pOMTdNxkv07pTj7E=; b=JS8AhCP123m7TgsMeO1utGQ09E6B4m+3hcErLngh9nW+JyA/BxIS0Qv0szi9QP9I4dklfnlmbmvVEFWxWSj+WRPTWKT6w3XPb2Ot9K225d/RzlOSfCYAGrdEcVN7YMRCNUOpCjX3weUdGm1IJywbY6ad6Wfdjobp8TZRQ//XUmpuiQN0pW0kxGNZ4vTgx6vT0VWEqkRekto4D0GhP3Asc5n80gYtjc36QKQNqyAtwgGJzn2kuP/tF0OHJbOFiycJOSNwXztnSX0CDiUVI9P0rPgCfQ73d5lMaYPw9/wcNImpfSTxlY16GBwAdRadg6TMbhTH3dMoNlF0FNfHM0bguA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=40OcsSTvAI7fWjnEhcoxg8VFoF2pOMTdNxkv07pTj7E=; b=A/U14Eowa1WBchF6NDINCi42umPRQRtgTSVww0olSIa4fiGd2BL+4khvv9Fg9rmllOHgNYfa4mXBgosi26PYVdjRK+FsKJzFY/aBAOrACaO+av4Ox9cGyC3yNAUA+GEXHrpfOWHBHQCdXrLWX96sm9j9yjcRCjxpFMEuo/V+F6k= Received: from DM6PR02CA0138.namprd02.prod.outlook.com (2603:10b6:5:1b4::40) by MWHPR02MB2829.namprd02.prod.outlook.com (2603:10b6:300:109::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Thu, 17 Oct 2019 06:22:15 +0000 Received: from BL2NAM02FT005.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::202) by DM6PR02CA0138.outlook.office365.com (2603:10b6:5:1b4::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16 via Frontend Transport; Thu, 17 Oct 2019 06:22:15 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT005.mail.protection.outlook.com (10.152.76.252) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAs-0004bU-AR; Wed, 16 Oct 2019 23:22:14 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAn-0003mX-78; Wed, 16 Oct 2019 23:22:09 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAc-0003f5-N7; Wed, 16 Oct 2019 23:21:59 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id DDB8C43A9A; Thu, 17 Oct 2019 11:51:57 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 3/8] mmc: sdhci-of-arasan: Add sampling clock for a phy to use Date: Thu, 17 Oct 2019 11:51:45 +0530 Message-Id: <1571293310-92563-4-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(136003)(376002)(346002)(396003)(39860400002)(189003)(199004)(356004)(4326008)(8676002)(14444005)(81156014)(186003)(26005)(70206006)(106002)(2906002)(36756003)(51416003)(316002)(16586007)(70586007)(42186006)(47776003)(126002)(44832011)(476003)(305945005)(486006)(76176011)(2616005)(6666004)(426003)(107886003)(81166006)(446003)(50226002)(11346002)(103686004)(336012)(6266002)(48376002)(8936002)(36386004)(478600001)(50466002)(5660300002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR02MB2829;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0411717-299a-4bb4-d848-08d752ca5a8d X-MS-TrafficTypeDiagnostic: MWHPR02MB2829: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DBjNxpd2Y8yqHMy83hLavX63nS3K0hqi6fw6blajHU6K7dApdrxuFReR/LpNx3lTnn+ERd/t0r4b6yzeyRxR4y9dDNpABIXQZhsQ3cFOFJCp3/qFr3JdLMIQXm+J5CpKwx+PDdPePTTDjrgn8VxW3kZewRZ7/blPA54ohSM5RBicZWn+vpo1k3jLHMdnlRGgUyERkE+neiEn7hq7BPRiIWHreJ0DxNMXXM1maNqzm/n6fa9sRZ+Wud4af/49t8IeJVXJibHuO4CUFA82hZ91dzUlIuU1kEVOVsUuiEAT1N7mxyVbjCseCodFlhKjgyTOcVRP6axlId/q8OaMZ9tRgwZY7CoXKbBtPSsx841pWtd/cdc7CVdzquLjlchI9mtl+zP358Wx16p+DSd8yqY5kNM/n0o6dzikWUsCh3VmYjI= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:14.9519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0411717-299a-4bb4-d848-08d752ca5a8d X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2829 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org There are some operations like setting the clock delays may need to have two clocks, one for output path and one for input path. Adding input path clock for some phys to use. Signed-off-by: Manish Narani --- drivers/mmc/host/sdhci-of-arasan.c | 151 +++++++++++++++++++++++++---- 1 file changed, 134 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 701b6cc0f9a3..f77f884f44a4 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -75,10 +75,14 @@ struct sdhci_arasan_soc_ctl_map { * struct sdhci_arasan_clk_data * @sdcardclk_hw: Struct for the clock we might provide to a PHY. * @sdcardclk: Pointer to normal 'struct clock' for sdcardclk_hw. + * @sampleclk_hw: Struct for the clock we might provide to a PHY. + * @sampleclk: Pointer to normal 'struct clock' for sampleclk_hw. */ struct sdhci_arasan_clk_data { struct clk_hw sdcardclk_hw; struct clk *sdcardclk; + struct clk_hw sampleclk_hw; + struct clk *sampleclk; }; /** @@ -541,6 +545,33 @@ static const struct clk_ops arasan_sdcardclk_ops = { .recalc_rate = sdhci_arasan_sdcardclk_recalc_rate, }; +/** + * sdhci_arasan_sampleclk_recalc_rate - Return the sampling clock rate + * + * Return the current actual rate of the sampling clock. This can be used + * to communicate with out PHY. + * + * @hw: Pointer to the hardware clock structure. + * @parent_rate The parent rate (should be rate of clk_xin). + * Returns the sample clock rate. + */ +static unsigned long sdhci_arasan_sampleclk_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) + +{ + struct sdhci_arasan_clk_data *clk_data = + container_of(hw, struct sdhci_arasan_clk_data, sampleclk_hw); + struct sdhci_arasan_data *sdhci_arasan = + container_of(clk_data, struct sdhci_arasan_data, clk_data); + struct sdhci_host *host = sdhci_arasan->host; + + return host->mmc->actual_clock; +} + +static const struct clk_ops arasan_sampleclk_ops = { + .recalc_rate = sdhci_arasan_sampleclk_recalc_rate, +}; + /** * sdhci_arasan_update_clockmultiplier - Set corecfg_clockmultiplier * @@ -620,28 +651,21 @@ static void sdhci_arasan_update_baseclkfreq(struct sdhci_host *host) } /** - * sdhci_arasan_register_sdclk - Register the sdclk for a PHY to use + * sdhci_arasan_register_sdcardclk - Register the sdcardclk for a PHY to use * * Some PHY devices need to know what the actual card clock is. In order for * them to find out, we'll provide a clock through the common clock framework * for them to query. * - * Note: without seriously re-architecting SDHCI's clock code and testing on - * all platforms, there's no way to create a totally beautiful clock here - * with all clock ops implemented. Instead, we'll just create a clock that can - * be queried and set the CLK_GET_RATE_NOCACHE attribute to tell common clock - * framework that we're doing things behind its back. This should be sufficient - * to create nice clean device tree bindings and later (if needed) we can try - * re-architecting SDHCI if we see some benefit to it. - * * @sdhci_arasan: Our private data structure. * @clk_xin: Pointer to the functional clock * @dev: Pointer to our struct device. * Returns 0 on success and error value on error */ -static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, - struct clk *clk_xin, - struct device *dev) +static int +sdhci_arasan_register_sdcardclk(struct sdhci_arasan_data *sdhci_arasan, + struct clk *clk_xin, + struct device *dev) { struct sdhci_arasan_clk_data *clk_data = &sdhci_arasan->clk_data; struct device_node *np = dev->of_node; @@ -649,10 +673,6 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, const char *parent_clk_name; int ret; - /* Providing a clock to the PHY is optional; no error if missing */ - if (!of_find_property(np, "#clock-cells", NULL)) - return 0; - ret = of_property_read_string_index(np, "clock-output-names", 0, &sdcardclk_init.name); if (ret) { @@ -674,7 +694,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, ret = of_clk_add_provider(np, of_clk_src_simple_get, clk_data->sdcardclk); if (ret) - dev_err(dev, "Failed to add clock provider\n"); + dev_err(dev, "Failed to add sdcard clock provider\n"); + + return ret; +} + +/** + * sdhci_arasan_register_sampleclk - Register the sampleclk for a PHY to use + * + * Some PHY devices need to know what the actual card clock is. In order for + * them to find out, we'll provide a clock through the common clock framework + * for them to query. + * + * @sdhci_arasan: Our private data structure. + * @clk_xin: Pointer to the functional clock + * @dev: Pointer to our struct device. + * Returns 0 on success and error value on error + */ +static int +sdhci_arasan_register_sampleclk(struct sdhci_arasan_data *sdhci_arasan, + struct clk *clk_xin, + struct device *dev) +{ + struct sdhci_arasan_clk_data *clk_data = &sdhci_arasan->clk_data; + struct device_node *np = dev->of_node; + struct clk_init_data sampleclk_init; + const char *parent_clk_name; + int ret; + + ret = of_property_read_string_index(np, "clock-output-names", 1, + &sampleclk_init.name); + if (ret) { + dev_err(dev, "DT has #clock-cells but no clock-output-names\n"); + return ret; + } + + parent_clk_name = __clk_get_name(clk_xin); + sampleclk_init.parent_names = &parent_clk_name; + sampleclk_init.num_parents = 1; + sampleclk_init.flags = CLK_GET_RATE_NOCACHE; + sampleclk_init.ops = &arasan_sampleclk_ops; + + clk_data->sampleclk_hw.init = &sampleclk_init; + clk_data->sampleclk = + devm_clk_register(dev, &clk_data->sampleclk_hw); + clk_data->sampleclk_hw.init = NULL; + + ret = of_clk_add_provider(np, of_clk_src_simple_get, + clk_data->sampleclk); + if (ret) + dev_err(dev, "Failed to add sample clock provider\n"); return ret; } @@ -697,6 +766,54 @@ static void sdhci_arasan_unregister_sdclk(struct device *dev) of_clk_del_provider(dev->of_node); } +/** + * sdhci_arasan_register_sdclk - Register the sdcardclk for a PHY to use + * + * Some PHY devices need to know what the actual card clock is. In order for + * them to find out, we'll provide a clock through the common clock framework + * for them to query. + * + * Note: without seriously re-architecting SDHCI's clock code and testing on + * all platforms, there's no way to create a totally beautiful clock here + * with all clock ops implemented. Instead, we'll just create a clock that can + * be queried and set the CLK_GET_RATE_NOCACHE attribute to tell common clock + * framework that we're doing things behind its back. This should be sufficient + * to create nice clean device tree bindings and later (if needed) we can try + * re-architecting SDHCI if we see some benefit to it. + * + * @sdhci_arasan: Our private data structure. + * @clk_xin: Pointer to the functional clock + * @dev: Pointer to our struct device. + * Returns 0 on success and error value on error + */ +static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, + struct clk *clk_xin, + struct device *dev) +{ + struct device_node *np = dev->of_node; + u32 num_clks = 0; + int ret; + + /* Providing a clock to the PHY is optional; no error if missing */ + if (of_property_read_u32(np, "#clock-cells", &num_clks) < 0) + return 0; + + ret = sdhci_arasan_register_sdcardclk(sdhci_arasan, clk_xin, dev); + if (ret) + return ret; + + if (num_clks) { + ret = sdhci_arasan_register_sampleclk(sdhci_arasan, clk_xin, + dev); + if (ret) { + sdhci_arasan_unregister_sdclk(dev); + return ret; + } + } + + return 0; +} + static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) { struct sdhci_host *host = sdhci_arasan->host; From patchwork Thu Oct 17 06:21:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194843 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 23AA01668 for ; Thu, 17 Oct 2019 06:22:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02A762054F for ; Thu, 17 Oct 2019 06:22:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="NqAT1bJD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437784AbfJQGWS (ORCPT ); Thu, 17 Oct 2019 02:22:18 -0400 Received: from mail-eopbgr690074.outbound.protection.outlook.com ([40.107.69.74]:20101 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389411AbfJQGWR (ORCPT ); Thu, 17 Oct 2019 02:22:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XJN/2xYgH9mJh989qoY0vMP3vFlt/wbd4HKwWEM354c7A1XYKxduyjSv9FWoPr9oSnfm/7xpCvMyDw7+4DOP/2ZueegpjgtM3TVCGRyuXT+yknTloKn2nQlWQds/yLKmdXjp33HATHTkaW8Hj4DwBqPfYj19HDt0NvDe4tXPQpq14G6b58bpkt07gpUS5diUbrY/BQmZRHiHdoriHYItBLCUol7YrqLZ8iqyivCodnKADv7wlx1jPOyskMuJ+MlCBowA0dZNbDd9obRVxwycaOGsXUsA+rz8JRbEaNQaplZUfS4rap6eWviWfekdLQWcxhua+gvXq9jX5I8CBhdVEg== 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-SenderADCheck; bh=dSKpuWFWYg7fUgNHBvrR8U0R3/HCKwCxvjhTf8hP0mE=; b=HiaqecI9Lg8/QH+Z5heEH29LLrpoSpgrYuEWVomgEashHrs41S9va9YWI5IHydqT9Iy/ldD9DoqQg4hZzCH2oeJyv/Ou3FS8vhFdtOqeifl3hCEjoAKAHYUYb3A1kip1N0UK8wGhZe5rKGUZOUs0SaHl187S3AEvCptI4PY4oJTBAExvYthK/KoixBj/jcGTqYyeKdUHpjD0SXV71ahBlXWMTrNwaxExNA9fmpV6XYhLE/uqXBC7u4OBsUP1jpIVIAkEBAomO03/tlTajaMyqXNGdpawjvmzvNbs+lgc+nTCHNeDsjFO1kybrY4kqeRxp8JZVzN4q6sQKX63fKasjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dSKpuWFWYg7fUgNHBvrR8U0R3/HCKwCxvjhTf8hP0mE=; b=NqAT1bJDDZNwfBRjbTOPKAcFmAVGsN8ivJlCImJvddkuqPHmWmZPOwa5fTxK4k+CgOoMoD1rDe78cWF1wQ3OGUjXGD3wIjvqBxPNarRPg9vPgvfv9hLF1AVYJNadxtT1tNrqHswUQaOFj6JL1vyLdme+bgTYvgrLq9FclkvoNBA= Received: from CY4PR02CA0040.namprd02.prod.outlook.com (2603:10b6:903:117::26) by SN6PR02MB4525.namprd02.prod.outlook.com (2603:10b6:805:af::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Thu, 17 Oct 2019 06:22:14 +0000 Received: from CY1NAM02FT005.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::208) by CY4PR02CA0040.outlook.office365.com (2603:10b6:903:117::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.16 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT005.mail.protection.outlook.com (10.152.74.117) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAr-0004bR-Vx; Wed, 16 Oct 2019 23:22:13 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAm-0003mX-Sx; Wed, 16 Oct 2019 23:22:08 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAd-0003fI-91; Wed, 16 Oct 2019 23:21:59 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id 7E44643A9B; Thu, 17 Oct 2019 11:51:58 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 4/8] dt-bindings: mmc: arasan: Add optional properties for Arasan SDHCI Date: Thu, 17 Oct 2019 11:51:46 +0530 Message-Id: <1571293310-92563-5-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(346002)(136003)(39860400002)(376002)(396003)(199004)(189003)(5660300002)(50466002)(47776003)(70586007)(186003)(36386004)(26005)(336012)(76176011)(51416003)(70206006)(106002)(16586007)(305945005)(2906002)(426003)(107886003)(486006)(6266002)(36756003)(42186006)(476003)(126002)(8676002)(81166006)(316002)(2616005)(81156014)(50226002)(478600001)(6666004)(8936002)(11346002)(356004)(4326008)(446003)(103686004)(44832011)(48376002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR02MB4525;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ed1c626-cd3e-43b5-9de6-08d752ca5a38 X-MS-TrafficTypeDiagnostic: SN6PR02MB4525: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xaZJSkwCNOIBLAwMcwyHUWalYirDcvRLwv91CFA/meGHRaKfSi8VLf/3KlFf27CpC4mlKKE4agR+BIOmTi7MfGGLYxaXq2Yew5b+KoJkJoZmePQbVla/FoQHvyqp4xQEKkWX91exDfp/TmvZMWGPngalNSDJ8+M5Y0dEJRA4neyFOXHn/RO6ouzhFiQsMKjvVGudpzkt7jGo7xSxsKr5KyPMofu6npCZc0CdJJoZUe9zOqM+oBsZnuAxXuyPnmvFz3qaOgED+w5IcXzE5yrdwFIQO0J/toAAEskWU4HKpGuuSd8xKFw/+BHVgjPwKetvnz7UkYDvT+g0RSz6PtMaoXYnBzKZZnEc8GeFDjegptV/YUO2621bZpuolzivxUV7KbKrJn2iaNh/yu37GWHWOkYWpZjQJFbLDFUbeHPy0w8= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:14.5334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ed1c626-cd3e-43b5-9de6-08d752ca5a38 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4525 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add optional propeties for Arasan SDHCI which are used to set clk delays for different speed modes in the controller. Signed-off-by: Manish Narani --- .../devicetree/bindings/mmc/arasan,sdhci.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt index b51e40b2e0c5..e0369dd7fb18 100644 --- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt +++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt @@ -46,6 +46,21 @@ Optional Properties: properly. Test mode can be used to force the controller to function. - xlnx,int-clock-stable-broken: when present, the controller always reports that the internal clock is stable even when it is not. + - clk-phase-legacy: Input/Output Clock Delay pair in degrees for Legacy Mode. + - clk-phase-mmc-hs: Input/Output Clock Delay pair degrees for MMC HS. + - clk-phase-sd-hs: Input/Output Clock Delay pair in degrees for SD HS. + - clk-phase-uhs-sdr12: Input/Output Clock Delay pair in degrees for SDR12. + - clk-phase-uhs-sdr25: Input/Output Clock Delay pair in degrees for SDR25. + - clk-phase-uhs-sdr50: Input/Output Clock Delay pair in degrees for SDR50. + - clk-phase-uhs-sdr104: Input/Output Clock Delay pair in degrees for SDR104. + - clk-phase-uhs-ddr50: Input/Output Clock Delay pair in degrees for SD DDR50. + - clk-phase-mmc-ddr52: Input/Output Clock Delay pair in degrees for MMC DDR52. + - clk-phase-mmc-hs200: Input/Output Clock Delay pair in degrees for MMC HS200. + - clk-phase-mmc-hs400: Input/Output Clock Delay pair in degrees for MMC HS400. + + Above mentioned are the clock (phase) delays which are to be configured in the + controller while switching to particular speed mode. If not specified, driver + will configure the default value defined for particular mode in it. Example: sdhci@e0100000 { From patchwork Thu Oct 17 06:21:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194833 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C238912 for ; Thu, 17 Oct 2019 06:22:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0D7C214E0 for ; Thu, 17 Oct 2019 06:22:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="dNA1nOe1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437906AbfJQGWV (ORCPT ); Thu, 17 Oct 2019 02:22:21 -0400 Received: from mail-eopbgr690077.outbound.protection.outlook.com ([40.107.69.77]:44373 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437781AbfJQGWT (ORCPT ); Thu, 17 Oct 2019 02:22:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TiV0Mc3BadiENrREs27Kr7JaSlMAXJyAPI/bXM8z9dsKeW6aWJAuFoyRFVJFuZ+4vsHap1Vd7NWIkT/2eNMf5gOXO8I9ZH1uhwCPirKVFGqp8sJ/Nt9qBgIeatdrRAGc+A8Bj98f1v2KUj+CX3u4M4I0xp3sQf4pnPrRmNmG6ZD81+m/ipcUAIoT4O/CJMXg/7iA2LKHY15teuY8VQtJ79p2gIR9C5S+TEdy8U2YwXiRd2fmr+wMxD3iAg3ZVzYT3f+X28m1WyCpj6VvR8XBLaH2l9aaWeWDJd3vr3xUAtJvHx6I/0oFqkDfJNioaZngAyO+OYhTqUJ55/OsvHJ42A== 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-SenderADCheck; bh=8qDw/n6pYbuVj7aNkz/HCp/vJho35whuwLxPQziceMA=; b=fi39lm9vhQmJm5earmIVAbL6xGmKdSsdFqGcSWLWXAziVmrvrabaR/H8cZcQhoTwAoxNZ/k2oEBlDR5hv7UPKLcfBrZqvVlVdOg3w7pLWD9b1s4shAnjBU+aXY9o2n0VEJeZUEBKIw4s/3M1cdWXc70K99Lm2k4qS9X17Ci/C0yfyFFi9w3KbeLJjY+nvlY479jCB7qESd6ajFFMHpRfQnI4vEECjYSRU5O1AV14MEnKncHXqv2uTul4dE1ORHxfURpMmD3GByJg+s495ASHa6Oxf8ZZ137nDFN+KB6nrQFNHwBKucr+ZCM3GdIjliiD4+HnlXgXiu1FjoqEoO3F7Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8qDw/n6pYbuVj7aNkz/HCp/vJho35whuwLxPQziceMA=; b=dNA1nOe1nu+zrzCjYFvC3G78rCxDvazGuIRgjcL+tEM8GLifHQEHWJc6khT6iGKUUge6YD37DdDVTPm1JoMI71QtCN1+AKNpmqCKdfqzcwCkb5ZQR7S5mb0pcAcMLRb1+TqG6p2Z8SDuC62W+LafRVJ5ICn7IDiFileavP1Nmtc= Received: from BN6PR02CA0037.namprd02.prod.outlook.com (2603:10b6:404:5f::23) by DM5PR02MB2860.namprd02.prod.outlook.com (2603:10b6:3:113::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.18; Thu, 17 Oct 2019 06:22:15 +0000 Received: from CY1NAM02FT013.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::207) by BN6PR02CA0037.outlook.office365.com (2603:10b6:404:5f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16 via Frontend Transport; Thu, 17 Oct 2019 06:22:15 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT013.mail.protection.outlook.com (10.152.75.162) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAs-0004bV-C5; Wed, 16 Oct 2019 23:22:14 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAn-0003mX-8e; Wed, 16 Oct 2019 23:22:09 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAd-0003fw-TR; Wed, 16 Oct 2019 23:22:00 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id 22F5E43A9C; Thu, 17 Oct 2019 11:51:59 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 5/8] mmc: sdhci-of-arasan: Add support to set clock phase delays for SD Date: Thu, 17 Oct 2019 11:51:47 +0530 Message-Id: <1571293310-92563-6-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(39860400002)(136003)(346002)(396003)(189003)(199004)(2616005)(26005)(70206006)(476003)(126002)(81166006)(106002)(486006)(50226002)(426003)(5660300002)(8936002)(48376002)(16586007)(8676002)(478600001)(81156014)(44832011)(336012)(70586007)(186003)(305945005)(51416003)(446003)(11346002)(76176011)(14444005)(6666004)(4326008)(36386004)(36756003)(356004)(103686004)(50466002)(2906002)(6266002)(107886003)(47776003)(316002)(42186006)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR02MB2860;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;MX:1;A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 947197bb-cc99-48c5-1c0b-08d752ca5a76 X-MS-TrafficTypeDiagnostic: DM5PR02MB2860: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a7dOOgmQWzoZOFmQEG2yGOBHxepaK+yjVf7sA7Sr9Lw3TGurUObzhX+dJyBnj7ZbUqLbZCzrpE+L8iBDgK5/hwdE85Ix6JJl8OvjYdk2GDyGZBQ7k2FZRnPLhuu35jHFbfSmvTxsl8dvOrhY6B8goJkNkt+9I1t/pshemTvifK56N5AcVvtFKyvbuY/HJnJ/TCzscy2vHQIqfngUVazu2BKHyliU0WIDsTzIJ+D73qblczCkazYtXRHqPq+hNBa68IRNcEbk7Jnn16LsCZ+0VdTlwte/q6zaA7jHTvyklJd+deVETd+mI87flj9Ar+Cbr2oL7ulunMcl5TiaOVESIP1hxbDWdtyalT/yYv9vYzLTzmBa6JUUE798lmAFFI0VXgWv8hTGfFglTNUO2Le4HkvQ+pFP6KxNzbcNKOJFqoY= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:14.8854 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 947197bb-cc99-48c5-1c0b-08d752ca5a76 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB2860 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add support to read Clock Phase Delays from the DT and set it via clk_set_phase() API from clock framework. Some of the controllers might have their own handling of setting clock delays, for this keep the set_clk_delays as function pointer which can be assigned controller specific handling of the same. Signed-off-by: Manish Narani --- drivers/mmc/host/sdhci-of-arasan.c | 91 ++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index f77f884f44a4..9b2b7b6399b3 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -77,12 +77,18 @@ struct sdhci_arasan_soc_ctl_map { * @sdcardclk: Pointer to normal 'struct clock' for sdcardclk_hw. * @sampleclk_hw: Struct for the clock we might provide to a PHY. * @sampleclk: Pointer to normal 'struct clock' for sampleclk_hw. + * @clk_phase_in: Array of Input Clock Phase Delays for all speed modes + * @clk_phase_out: Array of Output Clock Phase Delays for all speed modes + * @set_clk_delays: Function pointer for setting Clock Delays */ struct sdhci_arasan_clk_data { struct clk_hw sdcardclk_hw; struct clk *sdcardclk; struct clk_hw sampleclk_hw; struct clk *sampleclk; + int clk_phase_in[MMC_TIMING_MMC_HS400 + 1]; + int clk_phase_out[MMC_TIMING_MMC_HS400 + 1]; + void (*set_clk_delays)(struct sdhci_host *host); }; /** @@ -186,6 +192,7 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host); + struct sdhci_arasan_clk_data *clk_data = &sdhci_arasan->clk_data; bool ctrl_phy = false; if (!IS_ERR(sdhci_arasan->phy)) { @@ -227,6 +234,10 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock) sdhci_arasan->is_phy_on = false; } + /* Set the Input and Output Clock Phase Delays */ + if (clk_data->set_clk_delays) + clk_data->set_clk_delays(host); + sdhci_set_clock(host, clock); if (sdhci_arasan->quirks & SDHCI_ARASAN_QUIRK_CLOCK_UNSTABLE) @@ -650,6 +661,84 @@ static void sdhci_arasan_update_baseclkfreq(struct sdhci_host *host) sdhci_arasan_syscon_write(host, &soc_ctl_map->baseclkfreq, mhz); } +static void sdhci_arasan_set_clk_delays(struct sdhci_host *host) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host); + struct sdhci_arasan_clk_data *clk_data = &sdhci_arasan->clk_data; + + clk_set_phase(clk_data->sampleclk, + clk_data->clk_phase_in[host->timing]); + clk_set_phase(clk_data->sdcardclk, + clk_data->clk_phase_out[host->timing]); +} + +static void arasan_dt_read_clk_phase(struct device *dev, + struct sdhci_arasan_clk_data *clk_data, + unsigned int timing, const char *prop) +{ + struct device_node *np = dev->of_node; + + int clk_phase[2] = {0}; + + /* + * Read Tap Delay values from DT, if the DT does not contain the + * Tap Values then use the pre-defined values. + */ + if (of_property_read_variable_u32_array(np, prop, &clk_phase[0], + 2, 0)) { + dev_dbg(dev, "Using predefined clock phase for %s = %d %d\n", + prop, clk_data->clk_phase_in[timing], + clk_data->clk_phase_out[timing]); + return; + } + + /* The values read are Input and Output Clock Delays in order */ + clk_data->clk_phase_in[timing] = clk_phase[0]; + clk_data->clk_phase_out[timing] = clk_phase[1]; +} + +/** + * arasan_dt_parse_clk_phases - Read Clock Delay values from DT + * + * Called at initialization to parse the values of Clock Delays. + * + * @dev: Pointer to our struct device. + */ +static void arasan_dt_parse_clk_phases(struct device *dev, + struct sdhci_arasan_clk_data *clk_data) +{ + /* + * This has been kept as a pointer and is assigned a function here. + * So that different controller variants can assign their own handling + * function. + */ + clk_data->set_clk_delays = sdhci_arasan_set_clk_delays; + + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_LEGACY, + "clk-phase-legacy"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_MMC_HS, + "clk-phase-mmc-hs"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_SD_HS, + "clk-phase-sd-hs"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_UHS_SDR12, + "clk-phase-uhs-sdr12"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_UHS_SDR25, + "clk-phase-uhs-sdr25"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_UHS_SDR50, + "clk-phase-uhs-sdr50"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_UHS_SDR104, + "clk-phase-uhs-sdr104"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_UHS_DDR50, + "clk-phase-uhs-ddr50"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_MMC_DDR52, + "clk-phase-mmc-ddr52"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_MMC_HS200, + "clk-phase-mmc-hs200"); + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_MMC_HS400, + "clk-phase-mmc-hs400"); +} + /** * sdhci_arasan_register_sdcardclk - Register the sdcardclk for a PHY to use * @@ -942,6 +1031,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev) if (ret) goto clk_disable_all; + arasan_dt_parse_clk_phases(&pdev->dev, &sdhci_arasan->clk_data); + ret = mmc_of_parse(host->mmc); if (ret) { if (ret != -EPROBE_DEFER) From patchwork Thu Oct 17 06:21:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE3B914DB for ; Thu, 17 Oct 2019 06:22:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5C092054F for ; Thu, 17 Oct 2019 06:22:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="PZf7U885" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390536AbfJQGWe (ORCPT ); Thu, 17 Oct 2019 02:22:34 -0400 Received: from mail-eopbgr820053.outbound.protection.outlook.com ([40.107.82.53]:21088 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437783AbfJQGWT (ORCPT ); Thu, 17 Oct 2019 02:22:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kzUHt1ZWPPGI3Nil7wmLO2bzqN+uRalRAluOw01DOH+2d+14TDOfq71hdY8xdhlm3lzeciZw96hluixDUM24BgrK8tPcHMzA79tCHtk12e/QeOUex1wV06i1XazgWfaNLMY5crKz2IqMPo9JQlNeE2QkEKcw8DSQMANoHX7KIfocqyb0dR7xWNSOqZgz7GxsXjkaAZEyZIRt8TfkIguH3URy8FwX5owyyJ1Fh4pvWU3xKzk0bdS44IRqFnszMXwZ6uG9hOR5G8nx+3QE6nKMJH8ypPo6satyZsYKv1RhVkAo2C7oyLLQGCu95/rN38zVlXiyJYkvYFtq1P2bxxSSLw== 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-SenderADCheck; bh=Elx1S6x5O1qEFyNTFHBUXfMn9vSEuSXCQ8O8cIrSquA=; b=iqzDK438UfuD0lID0oMXDI73l+hBheTT9zHnOp+Jc2EafXj1nSQi6kw3fRQkaOvrYr5LdGibcFHu23uJywShbHW6L9TKCQkRVsTIj5HucQ18TlTIKV9lAKj8AiXd2RlDnBQFEPAPVg4g5YAaL8h2WMdh844W2p5N2JQPYfOTmT5/lKt6yW5EYBmwYmT8WqUNSwmHkvKNEAMmF63i5H3Yq2E/1ddQEYdMrIWgE3rJFDKnFLx8YlvifeB8M56JNGyJ2bk2HEuikDeW9riI9l1J502F05Gzp5WcRp6b2FK+EfPMxhy3FFq+2jFX6QFlqAwe26GPYS7xF+Jqs6Kcze8P2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Elx1S6x5O1qEFyNTFHBUXfMn9vSEuSXCQ8O8cIrSquA=; b=PZf7U885PKCJW7saSIJovumcl8aZQhyWJh+pg2cc9NaX82Xpb5Pvuvbec8kpriRMJKgnR3lj3ZBxGRJTT93baD1s305jRTwr+yyuWSvjVY7xu3bm4OzeQV5yTRvNQpY+Uj6x93X5W+hmxmqTjSfGjVYHtRSk9CNSD2pwY2iCulA= Received: from SN4PR0201CA0065.namprd02.prod.outlook.com (2603:10b6:803:20::27) by BYAPR02MB5158.namprd02.prod.outlook.com (2603:10b6:a03:6c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Thu, 17 Oct 2019 06:22:15 +0000 Received: from BL2NAM02FT006.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::205) by SN4PR0201CA0065.outlook.office365.com (2603:10b6:803:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.17 via Frontend Transport; Thu, 17 Oct 2019 06:22:15 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT006.mail.protection.outlook.com (10.152.76.239) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAs-0004bT-7I; Wed, 16 Oct 2019 23:22:14 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAn-0003mX-4C; Wed, 16 Oct 2019 23:22:09 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAe-0003f5-27; Wed, 16 Oct 2019 23:22:00 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id B2DD543A9A; Thu, 17 Oct 2019 11:51:59 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 6/8] firmware: xilinx: Add SDIO Tap Delay nodes Date: Thu, 17 Oct 2019 11:51:48 +0530 Message-Id: <1571293310-92563-7-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(396003)(346002)(376002)(136003)(39860400002)(199004)(189003)(36386004)(8676002)(81156014)(478600001)(8936002)(16586007)(6266002)(42186006)(2906002)(81166006)(316002)(50466002)(36756003)(4326008)(106002)(107886003)(48376002)(50226002)(356004)(6666004)(51416003)(47776003)(70206006)(14444005)(70586007)(186003)(486006)(476003)(4744005)(426003)(126002)(11346002)(336012)(2616005)(446003)(76176011)(103686004)(26005)(5660300002)(305945005)(44832011)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR02MB5158;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ccdee2b5-54f6-445f-5913-08d752ca5a6a X-MS-TrafficTypeDiagnostic: BYAPR02MB5158: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:580; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tUJcyX0WMhrg11zyu79hI4Q4nvsfCTrY4vfkR38tu6ih45jmBXlBrkIZCcdCjR2TaOsPyCihQ8I0WC0LpEP2cmxc1Au5eXoc009mXUUKH51NsPbLW/GDyMQSYrF8Sv3N1l67bjRXLt+qwER3D30ndccoQY7RrhaGWhq+XqQJ4Mdhqljau9pxv4E6C4lWqg0eKyF/MQZuh6VyZsq3c0ds53US4mYDJa2aATbxIr4SC/Q+3C3kDn6lzafH5fpztG5SvwWbXtBdDSdkFdGprtkPNRYIBmbQGTs1tXaVgClf1UCuAJOwQjKV/53yss4rcYF8a/gjywPI6PzrVmlx7JgLGaqLzU6IgfwqQvZhBFcHKgZSdql3Vs3Nhg3Mm2M19/IAGHcYFU7CNzwFj7mNUIVGquytBjrIgrANU0gnHRZYTt8= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:14.8263 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ccdee2b5-54f6-445f-5913-08d752ca5a6a X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5158 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add tap delay nodes for setting SDIO Tap Delays on ZynqMP platform. Signed-off-by: Manish Narani --- include/linux/firmware/xlnx-zynqmp.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 778abbbc7d94..df366f1a4cb4 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -91,7 +91,8 @@ enum pm_ret_status { }; enum pm_ioctl_id { - IOCTL_SET_PLL_FRAC_MODE = 8, + IOCTL_SET_SD_TAPDELAY = 7, + IOCTL_SET_PLL_FRAC_MODE, IOCTL_GET_PLL_FRAC_MODE, IOCTL_SET_PLL_FRAC_DATA, IOCTL_GET_PLL_FRAC_DATA, @@ -250,6 +251,16 @@ enum zynqmp_pm_request_ack { ZYNQMP_PM_REQUEST_ACK_NON_BLOCKING, }; +enum pm_node_id { + NODE_SD_0 = 39, + NODE_SD_1, +}; + +enum tap_delay_type { + PM_TAPDELAY_INPUT = 0, + PM_TAPDELAY_OUTPUT, +}; + /** * struct zynqmp_pm_query_data - PM query data * @qid: query ID From patchwork Thu Oct 17 06:21:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D867E912 for ; Thu, 17 Oct 2019 06:22:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AFBC921D7A for ; Thu, 17 Oct 2019 06:22:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="jD8MDQx6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437781AbfJQGWj (ORCPT ); Thu, 17 Oct 2019 02:22:39 -0400 Received: from mail-eopbgr820075.outbound.protection.outlook.com ([40.107.82.75]:26432 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437764AbfJQGWS (ORCPT ); Thu, 17 Oct 2019 02:22:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WgeDJIzP5D+fqFojj7PKzdk+CJz6mR0DgxH17sm65EE/mUQKOWq5iNnj9iu8MNTqGnY+ciyaS/BC9yMAtbOzk5G1b+3R63KtLBe8d4JSBkaJlCLuk80x4v36FnGeIPzfYMAKUYcTehk5H5HZ2B91tJi+dYLUGo8Hvb2oKVt985slz2BBrhSYAv5ogOx2r/ZVMASIqV0mH2n6w9hUQPAw1+EbAj+aPBPfCkkkvUz3YCbPOoI6fRAd/7zK0il+6HhwQHqY9zqlBLW1D3E8dg0/mUQG8qpbykXvzRwJaa199Yl34xnkNF0BqV7P5JJWJciKCsIF2pXW21O9yM22cos0jQ== 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-SenderADCheck; bh=7CQasHPXaJ2sCQPAjdsHoAZR98dlhjH7T48MmF7bglA=; b=bWqC1RNNTAAmhv2IzaqSk1/4Dt0I/5nSCQsIwWoQMm+IA3qz/nzFQxKlm0Am686bEnSuE8dw6IZbLd5jGvnC49MYbSpAKs9djjvY28Nlk73Phh9PYXKyJWdTK52tKNz6/MATlONDQ9YyyNRUobolRoxG2WumFvG1/QgbWBmsqUl2VhZci3PijdFPGia3x6xDzLHOXJSK0kCvYc9CdaiSg+TnhDaCUIiAgaRqdYerZaQdwa4JsFLa87TwlVzToPFuKLR8/6awIzKSVw9xPnuXX6zqUYCXKdOFFrN2/z6iZD/JhBxpAMDI87kRoS1bNqIPpW76NnAOl7nbPYQh8rUFXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7CQasHPXaJ2sCQPAjdsHoAZR98dlhjH7T48MmF7bglA=; b=jD8MDQx6sKpha2Iz/CGSp1hk5SDD1LvleSykdaysudFYOSE483ZGsVtxZaZYzCnHEE29+ZuqlrF8RLUR5f5lnUPfHEAK5shkhB+/wD91qMliTjpFxW8QnmPOZwIKsNjufyqOqZpsmVRKmiqgfFqTzCBeoYy1AhVOc1yIMoSTDu4= Received: from BL0PR02CA0106.namprd02.prod.outlook.com (2603:10b6:208:51::47) by MWHPR02MB3151.namprd02.prod.outlook.com (2603:10b6:301:6a::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Thu, 17 Oct 2019 06:22:15 +0000 Received: from BL2NAM02FT052.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::202) by BL0PR02CA0106.outlook.office365.com (2603:10b6:208:51::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by BL2NAM02FT052.mail.protection.outlook.com (10.152.77.0) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAr-0004bQ-Ua; Wed, 16 Oct 2019 23:22:13 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAm-0003mX-RS; Wed, 16 Oct 2019 23:22:08 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAe-0003fI-Mv; Wed, 16 Oct 2019 23:22:00 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id 5B88143A9B; Thu, 17 Oct 2019 11:52:00 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 7/8] dt-bindings: mmc: arasan: Document 'xlnx,zynqmp-8.9a' controller Date: Thu, 17 Oct 2019 11:51:49 +0530 Message-Id: <1571293310-92563-8-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(136003)(346002)(376002)(396003)(199004)(189003)(336012)(426003)(26005)(305945005)(2906002)(36386004)(186003)(47776003)(103686004)(81156014)(81166006)(8676002)(16586007)(50226002)(316002)(106002)(8936002)(42186006)(486006)(44832011)(2616005)(476003)(11346002)(446003)(126002)(50466002)(478600001)(36756003)(70586007)(70206006)(51416003)(107886003)(356004)(6666004)(48376002)(6266002)(76176011)(5660300002)(4326008)(921003)(142933001)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR02MB3151;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c746296-2466-4db8-7745-08d752ca5a36 X-MS-TrafficTypeDiagnostic: MWHPR02MB3151: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 95aKU+mcAcJ9zXh0GZOUlVPOdFF3H1QOdHBxTy+aSgqBlO23JAzz4oXVk2j92cT9C2jfOWJ1MU9Jo83I2Lc+NHfMmwxRHsRsmZY4WLaMcsige8lYpAy8gWUgSJeK2BdQQffim7ByX4/vNzEd6FyozWzdqGQyxYqhJVZDIQGjAqZwJILiG4EOwfoVrEI4Mc7Wtwx04HEFHpvzFp5Qrmp/sMKqCtUoJcTR3SwCFwnot493Q685SwicfMMF2cXvpA9iYwLash3sFhGgHvKYza6oVCnJv+yl6/UEHviVL/elUiy5M5V2054qVFv/5bDya/ENYQMyxIKNn6awlVQVL20QnCC1lv463Vq+Cu7FyJnckSyHtm5xR9S33jMPLv/7qD3yuLmpHeEiqUUy6mzbnBJnm/d9bK8HHWvIhKYvvxXoTfE= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:14.4853 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c746296-2466-4db8-7745-08d752ca5a36 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB3151 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org dd documentation for 'xlnx,zynqmp-8.9a' SDHCI controller and optional properties followed by example. Signed-off-by: Manish Narani Reviewed-by: Rob Herring --- .../devicetree/bindings/mmc/arasan,sdhci.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt index e0369dd7fb18..c3ee86b819f3 100644 --- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt +++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.txt @@ -15,6 +15,9 @@ Required Properties: - "arasan,sdhci-5.1": generic Arasan SDHCI 5.1 PHY - "rockchip,rk3399-sdhci-5.1", "arasan,sdhci-5.1": rk3399 eMMC PHY For this device it is strongly suggested to include arasan,soc-ctl-syscon. + - "xlnx,zynqmp-8.9a": ZynqMP SDHCI 8.9a PHY + For this device it is strongly suggested to include clock-output-names and + #clock-cells. - "ti,am654-sdhci-5.1", "arasan,sdhci-5.1": TI AM654 MMC PHY Note: This binding has been deprecated and moved to [5]. - "intel,lgm-sdhci-5.1-emmc", "arasan,sdhci-5.1": Intel LGM eMMC PHY @@ -62,6 +65,10 @@ Optional Properties: controller while switching to particular speed mode. If not specified, driver will configure the default value defined for particular mode in it. + - xlnx,mio-bank: When specified, this will indicate the MIO bank number in + which the command and data lines are configured. If not specified, driver + will assume this as 0. + Example: sdhci@e0100000 { compatible = "arasan,sdhci-8.9a"; @@ -98,6 +105,18 @@ Example: #clock-cells = <0>; }; + sdhci: mmc@ff160000 { + compatible = "xlnx,zynqmp-8.9a", "arasan,sdhci-8.9a"; + interrupt-parent = <&gic>; + interrupts = <0 48 4>; + reg = <0x0 0xff160000 0x0 0x1000>; + clocks = <&clk200>, <&clk200>; + clock-names = "clk_xin", "clk_ahb"; + clock-output-names = "clk_out_sd0", "clk_in_sd0"; + #clock-cells = <1>; + clk-phase-sd-hs = <63>, <72>; + }; + emmc: sdhci@ec700000 { compatible = "intel,lgm-sdhci-5.1-emmc", "arasan,sdhci-5.1"; reg = <0xec700000 0x300>; From patchwork Thu Oct 17 06:21:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11194837 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0F7A14DB for ; Thu, 17 Oct 2019 06:22:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA5CF2054F for ; Thu, 17 Oct 2019 06:22:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="KTfEw767" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437882AbfJQGWU (ORCPT ); Thu, 17 Oct 2019 02:22:20 -0400 Received: from mail-eopbgr800077.outbound.protection.outlook.com ([40.107.80.77]:14896 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2437766AbfJQGWU (ORCPT ); Thu, 17 Oct 2019 02:22:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TDLvtw5/79V9v/f+SinjiOPOsYF5Nna6w1V+KMBvPdNEz9e4W8JXxcRdq1/45QDrvVa64aVlCKkGrEuZwvqaqSTBxaGrzVVVzMiXtClHBT/doyX4Grz7x3rjmk8Lhkc62xPe/DO3Yt8VmEkFFTQneRyyMrjxSGNLL/n7GUrvsgCmJhX1eKzpiN0oPDwvPt6pCGrhrEMXUlid+tUEf1o5v9rjCIhvo2NZeZ1D+2TIKFFuFigRiX8liPE/c8FVjCw3bXb1bqlpPrelQYsa45VGr05y7/orKggfzMZtLBC5fehJVf1KcRBWKfC4oV2MkzbwsGLyssaNbN8E8QB/wFX4FA== 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-SenderADCheck; bh=V0CuAPC7/crThHnovy0j0JxqVT6wkqTovNppIq1SNpM=; b=CiGx89YgT1NmLErHuTYLfG2GzwQzyZSkAcm6CCV+enA47NXQARRyxHUlt0vhVuXsxTVxEykXfaaF5XH85RupBRhHpl5UNxTxt55GIJkprNqb1amb40s8luUodZ72YXTsynDMRLyoydzcc6Mm/epPrHYt0vUBeEIvzSNW/YQkto520BUrYU+5BmGB3NaWlltdYHXsE3sd/FletCVodUS0gtYbJGUdR6idXtA6g+YhIbVklc1K2PUVp1JYV3/RzVYXiI1rrOXOK+SA/aZ/OIk/1cemMpoO0DPVT3YVlIhRBJiEWCzvGSJ4RTE39Zh7FVcE3MEJo2wD9Nhd6DOufmnpig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=V0CuAPC7/crThHnovy0j0JxqVT6wkqTovNppIq1SNpM=; b=KTfEw7678gVjg+cLL0CY8UxJs0PIYXgKldyy97qPI2L9dxYx2nVQAZauwgSWjbTtKO8/8Z88JXmKoqR+wmz1cx7Hxtm0Oo0N9EO1IaF66pO8pnPcAEF5VSDmQwYS23CqtfCQWQTiKNoyyW3cWC8Prh+vtoRZytXIXRCxpNp0WHY= Received: from SN4PR0201CA0067.namprd02.prod.outlook.com (2603:10b6:803:20::29) by DM6PR02MB5899.namprd02.prod.outlook.com (2603:10b6:5:152::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Thu, 17 Oct 2019 06:22:15 +0000 Received: from SN1NAM02FT025.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::203) by SN4PR0201CA0067.outlook.office365.com (2603:10b6:803:20::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2347.18 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT025.mail.protection.outlook.com (10.152.72.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Thu, 17 Oct 2019 06:22:14 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAs-0004bS-1O; Wed, 16 Oct 2019 23:22:14 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iKzAm-0003mX-US; Wed, 16 Oct 2019 23:22:08 -0700 Received: from [172.23.64.104] (helo=xhdvnc123.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iKzAg-0003kk-AG; Wed, 16 Oct 2019 23:22:02 -0700 Received: by xhdvnc123.xilinx.com (Postfix, from userid 16987) id 86ECE43A9A; Thu, 17 Oct 2019 11:52:01 +0530 (IST) From: Manish Narani To: ulf.hansson@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, adrian.hunter@intel.com, michal.simek@xilinx.com, jolly.shah@xilinx.com, rajan.vaja@xilinx.com, nava.manne@xilinx.com, mdf@kernel.org, manish.narani@xilinx.com Cc: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, git@xilinx.com Subject: [PATCH v3 8/8] mmc: sdhci-of-arasan: Add support for ZynqMP Platform Tap Delays Setup Date: Thu, 17 Oct 2019 11:51:50 +0530 Message-Id: <1571293310-92563-9-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> References: <1571293310-92563-1-git-send-email-manish.narani@xilinx.com> X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(396003)(376002)(346002)(136003)(39860400002)(199004)(189003)(486006)(6266002)(4326008)(107886003)(478600001)(36756003)(103686004)(50466002)(336012)(426003)(50226002)(8936002)(305945005)(44832011)(8676002)(81156014)(81166006)(11346002)(126002)(2616005)(2906002)(446003)(14444005)(476003)(5660300002)(70206006)(42186006)(51416003)(356004)(316002)(16586007)(47776003)(36386004)(70586007)(186003)(26005)(48376002)(6666004)(76176011)(106002)(921003)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB5899;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;LANG:en;PTR:unknown-60-83.xilinx.com;A:1;MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7a091de-7f1e-450f-3f09-08d752ca5a32 X-MS-TrafficTypeDiagnostic: DM6PR02MB5899: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-Forefront-PRVS: 01930B2BA8 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7XEnKkt9juv5SNQjAA2X7JF9Qv2q8xzAwlHaPvVXVFC6rrF9MrHY1Ws2uSNYsgpyM2hI4a22WzSbZ+MDyuo677+2NWoV7qNlwB/lWJHG225b10Gim1mC8WHnNpBjLU2ygD70HbmXiqpFlGxA12zT6wYrXzDh2TyDub4MjrARRVVndadOD0DJIivjCmEYqlMz0NPjXd9gZrGcK1hhbILiYHOyZYu78LPib+V/gvsPUWJA6ZbSBKHZOXp8BNVXEhoKIfDqj8LoWhg9YodYqFCokPACDBbeQEJPdMsRxc8ReUSxPuh4/1jiCY1j9NhLpCto4fOOjIhi2cy9NI+esJ7/7PAw5FF6+JQQXwVNSGkg7xzyDR5kuccjDj9KmM0yJdp4tYFO/YS8PAdt90qRjTFR4pswVM65eZfjYhL1Jbu+Fb0= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2019 06:22:14.4486 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7a091de-7f1e-450f-3f09-08d752ca5a32 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5899 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Apart from taps set by auto tuning, ZynqMP platform has feature to set the tap values manually. Add support to set tap delay values in HW via ZynqMP SoC framework. Signed-off-by: Manish Narani --- drivers/mmc/host/sdhci-of-arasan.c | 206 ++++++++++++++++++++++++++++- 1 file changed, 204 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 9b2b7b6399b3..45cde17da5a2 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "cqhci.h" #include "sdhci-pltfm.h" @@ -32,6 +33,10 @@ #define PHY_CLK_TOO_SLOW_HZ 400000 +/* Default settings for ZynqMP Clock Phases */ +#define ZYNQMP_ICLK_PHASE {0, 63, 63, 0, 63, 0, 0, 183, 54, 0, 0} +#define ZYNQMP_OCLK_PHASE {0, 60, 72, 0, 60, 72, 135, 180, 72, 36, 0} + /* * On some SoCs the syscon area has a feature where the upper 16-bits of * each 32-bit register act as a write mask for the lower 16-bits. This allows @@ -80,6 +85,7 @@ struct sdhci_arasan_soc_ctl_map { * @clk_phase_in: Array of Input Clock Phase Delays for all speed modes * @clk_phase_out: Array of Output Clock Phase Delays for all speed modes * @set_clk_delays: Function pointer for setting Clock Delays + * @clk_of_data: Platform specific runtime clock data storage pointer */ struct sdhci_arasan_clk_data { struct clk_hw sdcardclk_hw; @@ -89,6 +95,11 @@ struct sdhci_arasan_clk_data { int clk_phase_in[MMC_TIMING_MMC_HS400 + 1]; int clk_phase_out[MMC_TIMING_MMC_HS400 + 1]; void (*set_clk_delays)(struct sdhci_host *host); + void *clk_of_data; +}; + +struct sdhci_arasan_zynqmp_clk_data { + const struct zynqmp_eemi_ops *eemi_ops; }; /** @@ -525,6 +536,10 @@ static const struct of_device_id sdhci_arasan_of_match[] = { .compatible = "arasan,sdhci-4.9a", .data = &sdhci_arasan_data, }, + { + .compatible = "xlnx,zynqmp-8.9a", + .data = &sdhci_arasan_data, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sdhci_arasan_of_match); @@ -583,6 +598,150 @@ static const struct clk_ops arasan_sampleclk_ops = { .recalc_rate = sdhci_arasan_sampleclk_recalc_rate, }; +/** + * sdhci_zynqmp_sdcardclk_set_phase - Set the SD Output Clock Tap Delays + * + * Set the SD Output Clock Tap Delays for Output path + * + * @hw: Pointer to the hardware clock structure. + * @degrees The clock phase shift between 0 - 359. + * Return: 0 on success and error value on error + */ +static int sdhci_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees) + +{ + struct sdhci_arasan_clk_data *clk_data = + container_of(hw, struct sdhci_arasan_clk_data, sdcardclk_hw); + struct sdhci_arasan_data *sdhci_arasan = + container_of(clk_data, struct sdhci_arasan_data, clk_data); + struct sdhci_host *host = sdhci_arasan->host; + struct sdhci_arasan_zynqmp_clk_data *zynqmp_clk_data = + clk_data->clk_of_data; + const struct zynqmp_eemi_ops *eemi_ops = zynqmp_clk_data->eemi_ops; + const char *clk_name = clk_hw_get_name(hw); + u32 node_id = !strcmp(clk_name, "clk_out_sd0") ? NODE_SD_0 : NODE_SD_1; + u8 tap_delay, tap_max = 0; + int ret; + + /* + * This is applicable for SDHCI_SPEC_300 and above + * ZynqMP does not set phase for <=25MHz clock. + * If degrees is zero, no need to do anything. + */ + if (host->version < SDHCI_SPEC_300 || + host->timing == MMC_TIMING_LEGACY || + host->timing == MMC_TIMING_UHS_SDR12 || !degrees) + return 0; + + switch (host->timing) { + case MMC_TIMING_MMC_HS: + case MMC_TIMING_SD_HS: + case MMC_TIMING_UHS_SDR25: + case MMC_TIMING_UHS_DDR50: + case MMC_TIMING_MMC_DDR52: + /* For 50MHz clock, 30 Taps are available */ + tap_max = 30; + break; + case MMC_TIMING_UHS_SDR50: + /* For 100MHz clock, 15 Taps are available */ + tap_max = 15; + break; + case MMC_TIMING_UHS_SDR104: + case MMC_TIMING_MMC_HS200: + /* For 200MHz clock, 8 Taps are available */ + tap_max = 8; + default: + break; + } + + tap_delay = (degrees * tap_max) / 360; + + /* Set the Clock Phase */ + ret = eemi_ops->ioctl(node_id, IOCTL_SET_SD_TAPDELAY, + PM_TAPDELAY_OUTPUT, tap_delay, NULL); + if (ret) + pr_err("Error setting Output Tap Delay\n"); + + return ret; +} + +static const struct clk_ops zynqmp_sdcardclk_ops = { + .recalc_rate = sdhci_arasan_sdcardclk_recalc_rate, + .set_phase = sdhci_zynqmp_sdcardclk_set_phase, +}; + +/** + * sdhci_zynqmp_sampleclk_set_phase - Set the SD Input Clock Tap Delays + * + * Set the SD Input Clock Tap Delays for Input path + * + * @hw: Pointer to the hardware clock structure. + * @degrees The clock phase shift between 0 - 359. + * Return: 0 on success and error value on error + */ +static int sdhci_zynqmp_sampleclk_set_phase(struct clk_hw *hw, int degrees) + +{ + struct sdhci_arasan_clk_data *clk_data = + container_of(hw, struct sdhci_arasan_clk_data, sampleclk_hw); + struct sdhci_arasan_data *sdhci_arasan = + container_of(clk_data, struct sdhci_arasan_data, clk_data); + struct sdhci_host *host = sdhci_arasan->host; + struct sdhci_arasan_zynqmp_clk_data *zynqmp_clk_data = + clk_data->clk_of_data; + const struct zynqmp_eemi_ops *eemi_ops = zynqmp_clk_data->eemi_ops; + const char *clk_name = clk_hw_get_name(hw); + u32 node_id = !strcmp(clk_name, "clk_in_sd0") ? NODE_SD_0 : NODE_SD_1; + u8 tap_delay, tap_max = 0; + int ret; + + /* + * This is applicable for SDHCI_SPEC_300 and above + * ZynqMP does not set phase for <=25MHz clock. + * If degrees is zero, no need to do anything. + */ + if (host->version < SDHCI_SPEC_300 || + host->timing == MMC_TIMING_LEGACY || + host->timing == MMC_TIMING_UHS_SDR12 || !degrees) + return 0; + + switch (host->timing) { + case MMC_TIMING_MMC_HS: + case MMC_TIMING_SD_HS: + case MMC_TIMING_UHS_SDR25: + case MMC_TIMING_UHS_DDR50: + case MMC_TIMING_MMC_DDR52: + /* For 50MHz clock, 120 Taps are available */ + tap_max = 120; + break; + case MMC_TIMING_UHS_SDR50: + /* For 100MHz clock, 60 Taps are available */ + tap_max = 60; + break; + case MMC_TIMING_UHS_SDR104: + case MMC_TIMING_MMC_HS200: + /* For 200MHz clock, 30 Taps are available */ + tap_max = 30; + default: + break; + } + + tap_delay = (degrees * tap_max) / 360; + + /* Set the Clock Phase */ + ret = eemi_ops->ioctl(node_id, IOCTL_SET_SD_TAPDELAY, + PM_TAPDELAY_INPUT, tap_delay, NULL); + if (ret) + pr_err("Error setting Input Tap Delay\n"); + + return ret; +} + +static const struct clk_ops zynqmp_sampleclk_ops = { + .recalc_rate = sdhci_arasan_sampleclk_recalc_rate, + .set_phase = sdhci_zynqmp_sampleclk_set_phase, +}; + /** * sdhci_arasan_update_clockmultiplier - Set corecfg_clockmultiplier * @@ -708,6 +867,10 @@ static void arasan_dt_read_clk_phase(struct device *dev, static void arasan_dt_parse_clk_phases(struct device *dev, struct sdhci_arasan_clk_data *clk_data) { + int *iclk_phase, *oclk_phase; + u32 mio_bank = 0; + int i; + /* * This has been kept as a pointer and is assigned a function here. * So that different controller variants can assign their own handling @@ -715,6 +878,22 @@ static void arasan_dt_parse_clk_phases(struct device *dev, */ clk_data->set_clk_delays = sdhci_arasan_set_clk_delays; + if (of_device_is_compatible(dev->of_node, "xlnx,zynqmp-8.9a")) { + iclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) ZYNQMP_ICLK_PHASE; + oclk_phase = (int [MMC_TIMING_MMC_HS400 + 1]) ZYNQMP_OCLK_PHASE; + + of_property_read_u32(dev->of_node, "xlnx,mio-bank", &mio_bank); + if (mio_bank == 2) { + oclk_phase[MMC_TIMING_UHS_SDR104] = 90; + oclk_phase[MMC_TIMING_MMC_HS200] = 90; + } + + for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) { + clk_data->clk_phase_in[i] = iclk_phase[i]; + clk_data->clk_phase_out[i] = oclk_phase[i]; + } + } + arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_LEGACY, "clk-phase-legacy"); arasan_dt_read_clk_phase(dev, clk_data, MMC_TIMING_MMC_HS, @@ -773,7 +952,10 @@ sdhci_arasan_register_sdcardclk(struct sdhci_arasan_data *sdhci_arasan, sdcardclk_init.parent_names = &parent_clk_name; sdcardclk_init.num_parents = 1; sdcardclk_init.flags = CLK_GET_RATE_NOCACHE; - sdcardclk_init.ops = &arasan_sdcardclk_ops; + if (of_device_is_compatible(np, "xlnx,zynqmp-8.9a")) + sdcardclk_init.ops = &zynqmp_sdcardclk_ops; + else + sdcardclk_init.ops = &arasan_sdcardclk_ops; clk_data->sdcardclk_hw.init = &sdcardclk_init; clk_data->sdcardclk = @@ -822,7 +1004,10 @@ sdhci_arasan_register_sampleclk(struct sdhci_arasan_data *sdhci_arasan, sampleclk_init.parent_names = &parent_clk_name; sampleclk_init.num_parents = 1; sampleclk_init.flags = CLK_GET_RATE_NOCACHE; - sampleclk_init.ops = &arasan_sampleclk_ops; + if (of_device_is_compatible(np, "xlnx,zynqmp-8.9a")) + sampleclk_init.ops = &zynqmp_sampleclk_ops; + else + sampleclk_init.ops = &arasan_sampleclk_ops; clk_data->sampleclk_hw.init = &sampleclk_init; clk_data->sampleclk = @@ -1031,6 +1216,23 @@ static int sdhci_arasan_probe(struct platform_device *pdev) if (ret) goto clk_disable_all; + if (of_device_is_compatible(np, "xlnx,zynqmp-8.9a")) { + struct sdhci_arasan_zynqmp_clk_data *zynqmp_clk_data; + const struct zynqmp_eemi_ops *eemi_ops; + + zynqmp_clk_data = devm_kzalloc(&pdev->dev, + sizeof(*zynqmp_clk_data), + GFP_KERNEL); + eemi_ops = zynqmp_pm_get_eemi_ops(); + if (IS_ERR(eemi_ops)) { + ret = PTR_ERR(eemi_ops); + goto unreg_clk; + } + + zynqmp_clk_data->eemi_ops = eemi_ops; + sdhci_arasan->clk_data.clk_of_data = zynqmp_clk_data; + } + arasan_dt_parse_clk_phases(&pdev->dev, &sdhci_arasan->clk_data); ret = mmc_of_parse(host->mmc);