From patchwork Fri Nov 1 06:05: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: 11222339 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 DEB5314DB for ; Fri, 1 Nov 2019 06:06:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCD1A208CB for ; Fri, 1 Nov 2019 06:06:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="MtHQvotd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729961AbfKAGGQ (ORCPT ); Fri, 1 Nov 2019 02:06:16 -0400 Received: from mail-eopbgr790055.outbound.protection.outlook.com ([40.107.79.55]:58400 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728724AbfKAGGO (ORCPT ); Fri, 1 Nov 2019 02:06:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lMsC36rwyqb8T6F3jjkVcrWsNi8yJs5ZqUAepwSsLlcmFCI/2HMv3JMaBPJXJiXslVTZIJAfNW82ny8AkNPKgvQYLIdPZR0xdL6win7vjuUxWpi+CSncehahXHyBy9JNtNXAJMvbn2sk2fWDX8jBxtVgqhwihUEJT9yLxRbFw0WK5j9Urdh4rWPGlp2TnNlZ81bky5fz2hAVh6NQCZLOr8/NG51IaSl16PfRgpZhTmGhwR2F2IpKuA/jrccN+IX7+T6bm/YKbh++5phOu94OHHmolb4+//ORTr7Ai+IDKGciF1Ht1ZfLbtQZG6taqOeESNz+MWUnzabiiL9N2HTClg== 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=lKsQHN/0FeknM1ViTNxES83TGizpSSemaI53gE4lfL4vB5Z8E6nt4nB+xsFpRIvsSOJ90MsawsnNwPURVZ63mWUrVMtFfyxOBYY31Ee5sFcGqxDALyMgDEUOeasCpJqP5X4T7QFu22YtFUWNrdPruAc+Mg+07UuhZc75WvcIKfqmgl2ijm/QohCe/6G/iluQAumkTaUuz63tzSHvfet9SGZzVlcPtK9mkd9fixoE7nt8KwtNvDJV4ZZFW/xx7ZwmkhSED6xtj8e71axpAACDKmUMmY0QnCoAff2hCnMXiQTbsUxm6ow1QGL8Nibt2LKtbLPE8iy6jiXJThkpCrtxKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=MtHQvotdXCh+AD2Y1oH2Kpcv+YA3q7hEzSSGuuJOOKFrhboFqCVjqfhh9Nx1Kz3wMOgCjURzHuwn10RK0jLq7U3wFxH0HQgUNNeG+vNsEq6GjxzI9FVnuiJ71IKmsHXXFUJ41gNdBKjMKFKQ+jRhzOIhoz8zcPrYB15kEOk4XVk= Received: from MWHPR02CA0004.namprd02.prod.outlook.com (2603:10b6:300:4b::14) by SN4PR0201MB3407.namprd02.prod.outlook.com (2603:10b6:803:4f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.22; Fri, 1 Nov 2019 06:06:10 +0000 Received: from SN1NAM02FT035.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::209) by MWHPR02CA0004.outlook.office365.com (2603:10b6:300:4b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 SN1NAM02FT035.mail.protection.outlook.com (10.152.72.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:09 +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 1iQQ4X-0005mP-D3; Thu, 31 Oct 2019 23:06:09 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4S-0007dN-8O; Thu, 31 Oct 2019 23:06:04 -0700 Received: from xsj-pvapsmtp01 (xsj-mail.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165wr5005663; Thu, 31 Oct 2019 23:05:58 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4L-0007Zt-Ly; Thu, 31 Oct 2019 23:05:58 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id E131212123B; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 1/8] mmc: sdhci-of-arasan: Separate out clk related data to another structure Date: Fri, 1 Nov 2019 11:35:46 +0530 Message-Id: <1572588353-110682-2-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(39860400002)(396003)(189003)(199004)(8676002)(5660300002)(305945005)(2616005)(36386004)(70586007)(70206006)(50466002)(48376002)(51416003)(76176011)(44832011)(126002)(476003)(426003)(16586007)(26005)(336012)(11346002)(47776003)(103686004)(14444005)(186003)(446003)(316002)(81156014)(8936002)(6666004)(50226002)(356004)(81166006)(478600001)(107886003)(486006)(2906002)(6266002)(36756003)(42186006)(4326008)(106002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN4PR0201MB3407;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: 6852aa3d-a119-499c-7439-08d75e919777 X-MS-TrafficTypeDiagnostic: SN4PR0201MB3407: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MC1vZ3ThYXCYYq0dmVNMjhCQhUqhOG5Sxja9BhhTz1Ub4CrkI4Zu6RFdK9UoFCZ96J3dPEjqtUrdGecbMz8xCw8IZRsgqx4hRorQSIHf8Chr6m1uANRmKTHZ1p/N28EJGr3BbtIkBE5WUKKTNZG3BOMKO/znCCUkjft92CPQTbFUmvDfaZ1BlBYRhOhicM2ka8uPVdyZdPJepjOjsJsDbp098nnKLVIWpz+PimlfOHv2+CFhuh2T2R+2qnhKhHGHnA6N99SqOmzBVwV704DMoX9bSm3NXFHmbMxySea2NA5R8NFSheqR9Mg5QDuL4d5OEDUUFCQ+nEHbDlnAUc3e8CQYvgAbYBm01/bUOUWqCM57j9hunQUj5jVqGk3pvGzfTnHfIP4IUox2EoEhzU74vYYwe0xM9lYsv96WMwXLuQZ5yazcPDCGcYp6X5QbaBj4 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:09.8840 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6852aa3d-a119-499c-7439-08d75e919777 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: SN4PR0201MB3407 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 Fri Nov 1 06:05: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: 11222337 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 B428A139A for ; Fri, 1 Nov 2019 06:06:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 88BD3208CB for ; Fri, 1 Nov 2019 06:06:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="N66EEaVg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728769AbfKAGGN (ORCPT ); Fri, 1 Nov 2019 02:06:13 -0400 Received: from mail-eopbgr800058.outbound.protection.outlook.com ([40.107.80.58]:51024 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727995AbfKAGGN (ORCPT ); Fri, 1 Nov 2019 02:06:13 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ne07BTbih/2+IaF9XoCuyq65G3mC0SLybFkL3Anv0TPK1/feBx03hiEnBc+o6w7B9b8nCziDvuNyxzz49MuNdQ4NAbBxQ3deWbFZh6VwteVSvoUXcbgiFV0WHEviMl5tCREurZ9uRsNsb5qqx3qssUkN/86BQ3N1eesFh9biiGRB1bLPVaXb/tutiGhzFQF92pcmWn7uIMqvy6SHZuq1HR2wu2+hnGdBtTzQzJSQE9eIKhZIJkMwRLOWylZc8vRb7RJZliAf40oNMp370Q978thyyS39DHsqANT0rT9KBQ6rn3QNjTspG4qAw3Ml7kpmRnaxx6s0wfgYb5umcg/Ilw== 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=qzXvD+IcJGqNn9EqJ780uC5HVrfKOntSd7rWjYG8Csg=; b=R6lVbzxAECWfiKWxjiRmhzqAgLb6izDwKpMt8l97+u0FciJ4Qk9eQyX1jlzIOQo5C5kFDIOhsX+z1CZlxWVwPW021bJAf7dMfd5FxtfNAXUdkkaaG1Djx0Kdj/tMnRFEQRsmedkP1JwJWN4uJZMPvKvrnZvcysvGsAINc5nNztWw9sFatesb67cS4SRhisJmDA539+YS5P1ORb5e7HIOUV3Bf9Z6N4/8ZidTOo2jTG1OjkWuu6LepnP+qOFNBqtLuFj+1Z7pcs4SFbwSPXqQOmrxsVeeK7JfAqUp8OoW0uQvbzTLQ26wGMu/KwBRcBCAX6sZJpQ+R9e1XC5iW/L/ZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=qzXvD+IcJGqNn9EqJ780uC5HVrfKOntSd7rWjYG8Csg=; b=N66EEaVgw2Te8HM65AfDbmTqD/03yQh9tispybXrsgDhaUP6WuPv4O4UG3je+DopQkSzbZxmRPXomQ6ea31u0PbPGIq5icuxQuVJxiW1uw5FfADux675Q+OvrUpOrYAFnavTxazMXwc1aNwlDJulBCIC8c/gLruYfcd53ckZw8Q= Received: from SN4PR0201CA0051.namprd02.prod.outlook.com (2603:10b6:803:20::13) by CH2PR02MB6727.namprd02.prod.outlook.com (2603:10b6:610:ac::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.18; Fri, 1 Nov 2019 06:06:10 +0000 Received: from SN1NAM02FT006.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::202) by SN4PR0201CA0051.outlook.office365.com (2603:10b6:803:20::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.21 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 SN1NAM02FT006.mail.protection.outlook.com (10.152.72.68) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +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 1iQQ4X-0005mX-Nn; Thu, 31 Oct 2019 23:06:09 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4S-0007dN-Is; Thu, 31 Oct 2019 23:06:04 -0700 Received: from xsj-pvapsmtp01 (mail.xilinx.com [149.199.38.66] (may be forged)) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165wT3005661; Thu, 31 Oct 2019 23:05:58 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4L-0007Zu-ML; Thu, 31 Oct 2019 23:05:57 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id E355E121380; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 2/8] dt-bindings: mmc: arasan: Update Documentation for the input clock Date: Fri, 1 Nov 2019 11:35:47 +0530 Message-Id: <1572588353-110682-3-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(396003)(39860400002)(346002)(376002)(199004)(189003)(36756003)(6666004)(16586007)(316002)(8676002)(36386004)(2906002)(48376002)(81166006)(50466002)(103686004)(8936002)(81156014)(42186006)(356004)(106002)(70586007)(70206006)(4326008)(476003)(478600001)(486006)(47776003)(51416003)(50226002)(126002)(26005)(2616005)(186003)(107886003)(11346002)(76176011)(6266002)(5660300002)(44832011)(426003)(336012)(446003)(305945005)(42866002);DIR:OUT;SFP:1101;SCL:1;SRVR:CH2PR02MB6727;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: d576206d-ae71-4bb1-598a-08d75e9197a2 X-MS-TrafficTypeDiagnostic: CH2PR02MB6727: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FqsK8ePPEcInVTZs3GAK8aMjWCCQLZI/uLFsp1+JzO5Yf3AgKjZXeG8VZyEgoHjzpT+UedaLG7ZOhKDU+odHmchtQ3z7c8uvLZsoTFyfeevpvi/1vzRgad6tiaxw3Dc4Ln95FdHQ69/I1Z3VE4FvtWDur40cpx50vGVnrhuZS9FRZ7GEl1xyx6+iVov5Fdc2xcinxbeTP/KbDrFiVBEVW9euypSV2MIc6XPZDMh2JqdBqU6Vhvn8R/vumc8IOJEHlzUWtlTlGS2AONbEVg+PSVqus3+CMMgsDKg+m1paPBNqJu9CkolVlw/d3+icXDDLfIfnda+DUSKGpY9gL2A7uIEyVmCzGGlZEx44EF7ijlPAuXRIdo/Tv/thK1DUiJPlyboJzQJm11vymxhmc5KGBFmcNCEvR+nl8WT611MKWnZ1o1vMmaxO2vbejksx98Y1 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:10.2111 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d576206d-ae71-4bb1-598a-08d75e9197a2 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: CH2PR02MB6727 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 Fri Nov 1 06:05: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: 11222349 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 BCA8B139A for ; Fri, 1 Nov 2019 06:06:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 87B7220656 for ; Fri, 1 Nov 2019 06:06:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="psKxp3C2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729954AbfKAGGQ (ORCPT ); Fri, 1 Nov 2019 02:06:16 -0400 Received: from mail-eopbgr790050.outbound.protection.outlook.com ([40.107.79.50]:54307 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728529AbfKAGGO (ORCPT ); Fri, 1 Nov 2019 02:06:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFTwUv83EttcqMgAqCFd/yhjXhFiONAhoGHsJqegi24ZkZwXErqLH5Sk3M8NpeJqswIBl0T0CWpG1WpcnOzH0fAsklaLm9qy5nMj5tsJN6XzXiWA8rfsxcdH7g4w8oi2Vxc7rwxBhaxkjBWtcLpZUUzktuCe/WDFAAOvSy/V6MgsgUZDx1eYRSWB5T5e8XRx3JvgzH/kSvpLGLXNSNB8qCywHwovZDmziRhbE+TDe+y+rhMzPtuXE+VgjFaHzE3jLCoyhgyv14f6vy+UNTNKaoYc3mAI7xosyeWAejicC9QH887Fc3xh03OgSOKswxB6u0PM9Vlrz0tSPOHvRz9rjA== 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=k7qbsUFt6gIDpj2dYmDYOFz7It+gjHYfXKxGp9daL6Q=; b=HFI2be4KhHroRGF0914kayRI2eQUA3xoKl7hfbwUxJvOhlOCNRTqnFDp0F7ncZS3Y0/Avt5ux2yITYzCzozVGf9+5OBH/kFwc89kAJidF6Lk7EFXtaRUah4fCKa/jbGfXssQrQIIBGTfH9TgIBWVNtBrNlqXJrHYRmXj3mGLNEBaOGJLno8TUHr06xINr6f/h+OzLVrxmKQsvsfLAazdwvbUPMxT9phgj3dkj+/5K9qC7zmpRVOlmZvvhWKPaAXL7mgKfC5/POC1mSDyQ5MoeZge6OLVOuUKs50fMcwkYNJKGwk4uJiwzR5lbtVZ8XiJr9UCc+Ug7iXWRhKS4/MWzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=k7qbsUFt6gIDpj2dYmDYOFz7It+gjHYfXKxGp9daL6Q=; b=psKxp3C2W8PHCI+YYTyokZbA2jsoeMofR/wMnK40Y5OHLT2aRRo4jNHlzs16nyMm4IlyZzbTwNoDyeIQs5UH1+c7sTe7ovF9KK4Hiz3PsECPELxGu0vtsyZ+mHoPmrYLDAt+HDRuSQ8bAuyIe3K4OwRUYQ3Fm+VxHp8toaP68PE= Received: from BL0PR02CA0056.namprd02.prod.outlook.com (2603:10b6:207:3d::33) by BL0PR02MB5409.namprd02.prod.outlook.com (2603:10b6:208:8e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.22; Fri, 1 Nov 2019 06:06:10 +0000 Received: from SN1NAM02FT029.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::201) by BL0PR02CA0056.outlook.office365.com (2603:10b6:207:3d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 SN1NAM02FT029.mail.protection.outlook.com (10.152.72.110) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +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 1iQQ4X-0005mR-Kd; Thu, 31 Oct 2019 23:06:09 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4S-0007dN-GA; Thu, 31 Oct 2019 23:06:04 -0700 Received: from xsj-pvapsmtp01 (xsj-mail.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165wFu005665; Thu, 31 Oct 2019 23:05:58 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4L-0007Zv-NB; Thu, 31 Oct 2019 23:05:58 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id EB7FA121383; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 3/8] mmc: sdhci-of-arasan: Add sampling clock for a phy to use Date: Fri, 1 Nov 2019 11:35:48 +0530 Message-Id: <1572588353-110682-4-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(136003)(39860400002)(396003)(346002)(199004)(189003)(316002)(356004)(103686004)(336012)(70206006)(47776003)(6666004)(16586007)(14444005)(476003)(446003)(11346002)(106002)(2616005)(4326008)(186003)(6266002)(426003)(5660300002)(70586007)(50226002)(42186006)(107886003)(26005)(44832011)(36756003)(305945005)(478600001)(486006)(126002)(2906002)(81156014)(81166006)(8676002)(48376002)(76176011)(8936002)(36386004)(50466002)(51416003);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR02MB5409;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: 8be6f599-c831-455e-c9a0-08d75e9197a3 X-MS-TrafficTypeDiagnostic: BL0PR02MB5409: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qh2NIzpgyYYyS0OUl7+VSXuZnwnAjh8p0SEm2xq1KiGQ6X04b17XnWDlmoYIP9uezjm/VcahndmJU6O6yCDd1qC3ru72bYe2VxEDtWSkMYyLaUwZCszJ5VTzW/3sjvbJSxB+9GWvfVGYLuAji7pljt31Znhy9b5azCd2ANQsNNHX07W8Tz+MK1wNlbpvEjrWT9yT0w1jqawEvJ8iVjKiZ7iCudAGzK9PtSadsaBSOkWla7P2IsmfSy8k7cE568SfcJQjBzfMlIIMCU98pAMQmMLXIp7F0quq/azKAn+ZSFM6zz4+6bAGRtNbxLKk1ylZeWkb34LhOXXPW4oE6ibzUpTRagjKfVdApgcG3F5s2TXZBIXuCEln4i9z7rzpYasbtTS+EsWgsVIFpwex6FA0FLjdniHT5odQr1Z9TrtremlIjThb2rjkOO9s22uzHi15 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:10.1295 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8be6f599-c831-455e-c9a0-08d75e9197a3 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: BL0PR02MB5409 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..b75ba780f902 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 Fri Nov 1 06:05: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: 11222347 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 79DA4139A for ; Fri, 1 Nov 2019 06:06:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43FED21A49 for ; Fri, 1 Nov 2019 06:06:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="PI7bTcTW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728243AbfKAGGQ (ORCPT ); Fri, 1 Nov 2019 02:06:16 -0400 Received: from mail-eopbgr820085.outbound.protection.outlook.com ([40.107.82.85]:9536 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729404AbfKAGGP (ORCPT ); Fri, 1 Nov 2019 02:06:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KYAOYckO8sl+ooAl2u4bn0CHyiPR26GRdWCj0pvD37zgwuE5Gk78GYUExobPVx9Vjc6kzl6K1jq7TSNC6CrHZBI0ZKj9AI9jlk7j6Qb1R9p0f1c6KuSrv204/FxaTtzj4WINkKegp42I8LwsJv8JABVgnuaGxh/4OrmZPAG1NPuSxHBmu4ITCgjtOZv+LcyxGR6BW/Rj4WAWpJU9nNF0OG6dsWnb9LoA6RdDGzZvuUEheM7RktePXBiW+bCaFVCWxuZmTf65Uyp0QMnpC0RX8O9sjNlGk2SnHQt5Akq62BOBYcC1UF87BC/c85inosDDkM3PieMT6j9mvczvYSq+Fw== 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=n3geTXuV4lpN8m8W1d6uvc+nibMhYsrXL7CoPVOywXc=; b=VRM+iZd8Im9byI56Fo3ktHm9xr9mniIT7g4eCaHt3Pn1fNOSpnm3naHx9iQLzYaHpkmQBN4WJySO96LJkC3nrO+t2hirEo9C4OmQEIjMQ3sVqAS+cyUoLvnAaeRsVAJ6NsAbbatZzp4t5I0MoSBrxRCYEmssNWPJAC2bAA5/uW3X8iJQgkzxcqFfS9vsZMNVaZDIIBzJL3XfLepn1TVWhIQ5nOSwGs7GqoZdgRHtLqtMllEPo+Mvtwesd2NdXIAOZgD7qOd22/tbYK6yMEqW2oU3J9e5QFoXqpiBe8ixhPYT+WJHzh5XT70DGp2cZeajRmcKyK/rZQIkp9NKvh5gsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=n3geTXuV4lpN8m8W1d6uvc+nibMhYsrXL7CoPVOywXc=; b=PI7bTcTWZ13tZOqgvpiO/SaxOxLb0Oh8XlKYM2PJadaZDR5Lkg7ykyShQVLnLqGOPVP8locM9JfrevWGiAVmLXpgtlkxwcOExj+5L+fBGdTKLgX4yiC8cDNo2fPvjU4Bd5QKQFHET/0G45RPnFFYzs67sj2c0uOYLwfK1wJPWyg= Received: from MWHPR02CA0003.namprd02.prod.outlook.com (2603:10b6:300:4b::13) by SN1PR02MB3807.namprd02.prod.outlook.com (2603:10b6:802:31::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.17; Fri, 1 Nov 2019 06:06:11 +0000 Received: from SN1NAM02FT035.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::202) by MWHPR02CA0003.outlook.office365.com (2603:10b6:300:4b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:11 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 SN1NAM02FT035.mail.protection.outlook.com (10.152.72.145) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +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 1iQQ4Y-0005me-Cf; Thu, 31 Oct 2019 23:06:10 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4T-0007dN-80; Thu, 31 Oct 2019 23:06:05 -0700 Received: from xsj-pvapsmtp01 (xsj-smtp1.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165w0t010449; Thu, 31 Oct 2019 23:05:58 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4L-0007Zx-Nr; Thu, 31 Oct 2019 23:05:58 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id F1175121385; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 4/8] dt-bindings: mmc: Add optional generic properties for mmc Date: Fri, 1 Nov 2019 11:35:49 +0530 Message-Id: <1572588353-110682-5-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(396003)(376002)(39860400002)(136003)(189003)(199004)(426003)(4326008)(107886003)(5660300002)(11346002)(186003)(126002)(44832011)(2616005)(486006)(476003)(356004)(305945005)(6266002)(336012)(6666004)(446003)(70206006)(70586007)(81156014)(51416003)(478600001)(26005)(81166006)(76176011)(103686004)(106002)(316002)(16586007)(48376002)(47776003)(36756003)(2906002)(50226002)(42186006)(50466002)(36386004)(8936002)(8676002)(41533002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR02MB3807;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: dff954f7-f8e9-49d0-cd79-08d75e91980c X-MS-TrafficTypeDiagnostic: SN1PR02MB3807: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Xrv/KS/zB81+SQjgET0Epr1lkvKD8nX6b5nl+k+lx0JIw+vndDF3WLlfXczqWycNCeaabbK6es6lHER+nmbY85whTzdAkUkcQar8BvamL8yVnJXuhJpPs2nBUJeNIbMKCp8MlsqJqUv4yHflXh6mlO/E0ixgwpRUgYLN/gj9HG9nDFs/Ng17DVYqtDYFUlWtX3Z3DmPPUr7oTlOSyNdbJWg+yAmV23FgaT/JvrnLcjRt7VN0G8KoI+PAsnZppREqSg4OjrRkiPCkseW3VxoGHlj3tYPtExL8ru4S7Tp+xrBRLyvEGV744YP0h+WWz5oZNWbHx6Cg2V95TpoVgcHGU7Ua6klQDDRjPzUL4wcdZQLgLrGvysTlmZWO4yqIS5UO4Mkpg1k3zn4BzyUOl9KX/1cdXkXnwrGF7dyZX1uy5zgdmz73TrpiT5wQJQ3+rMO9 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:10.8597 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dff954f7-f8e9-49d0-cd79-08d75e91980c 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: SN1PR02MB3807 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Add optional properties for mmc hosts which are used to set clk delays for different speed modes in the controller. Signed-off-by: Manish Narani --- .../bindings/mmc/mmc-controller.yaml | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml index 080754e0ef35..87a83d966851 100644 --- a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml +++ b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml @@ -212,6 +212,98 @@ properties: description: eMMC HS400 enhanced strobe mode is supported + # Below mentioned are the clock (phase) delays which are to be configured + # in the controller while switching to particular speed mode. The range + # of values are 0 to 359 degrees. + + clk-phase-legacy: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for Legacy Mode. + + clk-phase-mmc-hs: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair degrees for MMC HS. + + clk-phase-sd-hs: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for SD HS. + + clk-phase-uhs-sdr12: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for SDR12. + + clk-phase-uhs-sdr25: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for SDR25. + + clk-phase-uhs-sdr50: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for SDR50. + + clk-phase-uhs-sdr104: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for SDR104. + + clk-phase-uhs-ddr50: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for SD DDR50. + + clk-phase-mmc-ddr52: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for MMC DDR52. + + clk-phase-mmc-hs200: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for MMC HS200. + + clk-phase-mmc-hs400: + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - minimum: 0 + - maximum: 359 + description: + Input/Output Clock Delay pair in degrees for MMC HS400. + dsr: allOf: - $ref: /schemas/types.yaml#/definitions/uint32 From patchwork Fri Nov 1 06:05: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: 11222343 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 43C4D17E6 for ; Fri, 1 Nov 2019 06:06:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2229221D56 for ; Fri, 1 Nov 2019 06:06:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="N8F4RSPH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729666AbfKAGG1 (ORCPT ); Fri, 1 Nov 2019 02:06:27 -0400 Received: from mail-eopbgr680071.outbound.protection.outlook.com ([40.107.68.71]:36809 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729782AbfKAGGR (ORCPT ); Fri, 1 Nov 2019 02:06:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d5QXGx8pSq1eFTcV+4L5mSJTcE1MWDhoXqw8r6hRFCU+luDmX7I8W4PgBeXLhkKzttkdazdJ+qtXz2ndXM2jGeHKLuQCjRP/IQQ3TMArYkuxqkh+B1CQ4lWSdOf2zI1Z92Ur42FyIimLO67yIVbQoAK5mjtCnvCxUzLUtjxbqL6CbHEbaDhwE2DUZWl1p9lsqtospqQXH68p2uzqe5gRGqEXl2EBIVTdNpffnPiclQ8+Qx5lxPh56Fw6t3bllhaqYE+9alM0pHZqtJTnUa+xDXrSsrUHLwW71xBpovPirYjSy1hQw2ryhZ9wHYGp/i9bBL3GnEScaBqD+eGXh64EhQ== 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=m5S1KA31oH+mkM7DanXAs+YE4sBunEXs4vCCSxmISw8=; b=Y+lxbsXnBH5343nZ5K/tHRjBrtWlqqFQGjbMqmgdO75N5lXvojG2K5VbS7C0YFXFyAVDPGV/2tcYxF16zEaKM6X1kPBiUeOoJ97VB48YJzSURw+Rj70wB4/a+H9zMirWI7A6n9RMXXX03OR+rSPtC7tD7ezM5+K0bZkzZN+KwSYKc8YdlRayf2ZuFm1V128jt2vqFsOpWwDDTEZJhvXxI/ExzeU6mlnYhlDNfJyTPY7nC6Ze9kXSfGXCsFTl/TnNyc7mED0RTO3N1bWF5C5D9e5mMlMFw29yi9m5x9OGts5XyR1XCe00PK2LbFmoaL78l/zc2zkqZp8xQLXyVTZFAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=m5S1KA31oH+mkM7DanXAs+YE4sBunEXs4vCCSxmISw8=; b=N8F4RSPH/wf2KRz0MEUzIhxbV50aLLoxeCDT/DaJXX0cbdZiPig0uNr5bJVG2ZQf36M+KhBi2FrG7Dz48liU7B6D8BKA3/vGra0P7b0SS1kUEdeYPouLn5BZcOBrnOWAj6BmhPrNPxwsj+BiThWOfEP/LfXtkGeMxnkh+eCcmxw= Received: from BYAPR02CA0030.namprd02.prod.outlook.com (2603:10b6:a02:ee::43) by SN4PR0201MB3551.namprd02.prod.outlook.com (2603:10b6:803:4c::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.24; Fri, 1 Nov 2019 06:06:11 +0000 Received: from SN1NAM02FT062.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::207) by BYAPR02CA0030.outlook.office365.com (2603:10b6:a02:ee::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.19 via Frontend Transport; Fri, 1 Nov 2019 06:06:11 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 SN1NAM02FT062.mail.protection.outlook.com (10.152.72.208) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +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 1iQQ4Y-0005mc-7Q; Thu, 31 Oct 2019 23:06:10 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4T-0007dN-2p; Thu, 31 Oct 2019 23:06:05 -0700 Received: from xsj-pvapsmtp01 (mail.xilinx.com [149.199.38.66] (may be forged)) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165xhi005683; Thu, 31 Oct 2019 23:05:59 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4M-0007aL-Pm; Thu, 31 Oct 2019 23:05:59 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id 03029121386; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 5/8] mmc: sdhci-of-arasan: Add support to set clock phase delays for SD Date: Fri, 1 Nov 2019 11:35:50 +0530 Message-Id: <1572588353-110682-6-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(346002)(376002)(396003)(39860400002)(189003)(199004)(478600001)(2906002)(5660300002)(70586007)(70206006)(103686004)(107886003)(8936002)(336012)(50226002)(426003)(126002)(476003)(36756003)(50466002)(48376002)(2616005)(51416003)(14444005)(6666004)(44832011)(486006)(356004)(76176011)(8676002)(81166006)(81156014)(4326008)(42186006)(316002)(26005)(186003)(305945005)(6266002)(11346002)(446003)(36386004)(16586007)(106002)(47776003)(42866002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN4PR0201MB3551;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: cf48439f-2e49-4b22-70b1-08d75e9197fb X-MS-TrafficTypeDiagnostic: SN4PR0201MB3551: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X/iIuO8ojDVe45XT32MBpm14XBa/VMN3w5sQCaWOgbaBD/dbl/hLR/HYkg66IVvXjwswjiAEQblvbnVqxR3SxrVzzwn/JuC/S7P7+LN+PU5oFY1H3cF6dr84fFGc+cyDZjeNP5yxT/XHEm587ErpbgvPAfruMv3mf37kobYpX8uyXk8/P4tOwm9r9C6K4Ax8IDgcJq9/g2ScQpPe89aKYHh6/N64Vgw0err0CNq8aGlTWmhfHxjecM7xaFOmuihXgj8NSUdWj1P9ozyl7xUem4PuuWBZ7kspzois2KvFHo1rUOQr13++7PCvpU+I+hr11afWHqrj1NqbRbaqeuLTLXN9Y0/WBi1KDSeYHr8wqC0sUlzQndpmeKviVMi4dSMwDq73rR77KNihkYP5tvjLW4zFPNVKOr566ycDqZ420ifOtzhVigZKKrbgnfMfxaUn X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:10.7419 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf48439f-2e49-4b22-70b1-08d75e9197fb 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: SN4PR0201MB3551 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 | 92 ++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index b75ba780f902..9452ae01f6fa 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,85 @@ 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. + * @clk_data: Pointer to the Clock Data structure + */ +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 +1032,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 Fri Nov 1 06:05:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11222357 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 2CE7514DB for ; Fri, 1 Nov 2019 06:06:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02353208E3 for ; Fri, 1 Nov 2019 06:06:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="lje32X09" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729834AbfKAGG4 (ORCPT ); Fri, 1 Nov 2019 02:06:56 -0400 Received: from mail-eopbgr720058.outbound.protection.outlook.com ([40.107.72.58]:13554 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729787AbfKAGG4 (ORCPT ); Fri, 1 Nov 2019 02:06:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YwEMGhosXuDDdgGvh3iDWfdzvQsiVYfNeBio/2rvIK5QnLId28tlgkbJ75djaj54Y7wuoARJwxrGdvVQVREJ5NakMZRprYWNvIvTgee82PO5zooYDdEYrHk13IwmyJnTTOj32YfcxFqu6ormS6gXEwXoah+c9QXzwW6V0sdLyrYXTTSCzIKjyN2LDe9m/pPbmTMIXa1sD4jdEL6aPA79ga0r/oBcnoDC3bV4Z86C5vqwWFY+7+GSGEI3qqGl8zVmHnlGvCJ8lsLT0p/TETDyuBk6AsOHWQPbxvvgL2U3QGHPfNGcnt7apKuDQ1xIYPI6jJYDcFi25KgZPZ5sFR+CMA== 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=kMhavVKrWkdziizkO/DoU2ClnLEJpq3TA4wuHLNUz3uwrq9K1oz8iLmUN7f9murx7HEhhkdsRvtsFnZYLSDTQ/94TRZft+YlABCu2z6EnLLTlDz0JD2sfO2YdR6DML1Sh8VWxpru7iDyYUYcXqwoh+fJcs3cpZoNgQhEfO1NEpI6RlNKjFVmDWn4tsswx2xL5kWx1qZnXlIIzI7xceR03pxN9x61A6qURwX12GNc48caziswU1HJODHJCosYrHPIgoJU9s2vd2vNm2ccuuqpsBElJS1PXxF4C+SLdcmUG83eTHXV8aNFykc6Vr2iPf1EmWlyvtzkX4b50wB63VO+sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=lje32X09WbXf0/XxeLf2Ll/KtwVKt9ghnkSh08ccQPkTresYYUb8AvXyELeCkG/s2f54gRhwuT526gSc/JbZQyCbOKs88zuZTBI0aiFvMkwNz2IHH6PjXmCw1PJhSiDooC2Lmde9izvnvWuFSuSTCZ4CXTivm5dWHQcLYFlbzSQ= Received: from BN7PR02CA0020.namprd02.prod.outlook.com (2603:10b6:408:20::33) by BN6PR02MB2771.namprd02.prod.outlook.com (2603:10b6:404:fd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.24; Fri, 1 Nov 2019 06:06:10 +0000 Received: from BL2NAM02FT008.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::209) by BN7PR02CA0020.outlook.office365.com (2603:10b6:408:20::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 BL2NAM02FT008.mail.protection.outlook.com (10.152.76.162) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +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 1iQQ4X-0005mY-QW; Thu, 31 Oct 2019 23:06:09 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4S-0007dN-M3; Thu, 31 Oct 2019 23:06:04 -0700 Received: from xsj-pvapsmtp01 (mailman.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165x4Q010457; Thu, 31 Oct 2019 23:05:59 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4M-0007aM-Pn; Thu, 31 Oct 2019 23:05:59 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id 086AA121387; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 6/8] firmware: xilinx: Add SDIO Tap Delay nodes Date: Fri, 1 Nov 2019 11:35:51 +0530 Message-Id: <1572588353-110682-7-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(39850400004)(346002)(136003)(396003)(189003)(199004)(51416003)(16586007)(478600001)(2616005)(5660300002)(14444005)(6666004)(356004)(107886003)(186003)(4326008)(48376002)(47776003)(42186006)(70206006)(316002)(2906002)(11346002)(36756003)(70586007)(50466002)(446003)(6266002)(4744005)(476003)(76176011)(36386004)(126002)(26005)(50226002)(103686004)(8676002)(106002)(305945005)(486006)(426003)(336012)(44832011)(8936002)(81166006)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR02MB2771;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: 69521a8c-f199-42b6-2653-08d75e9197c9 X-MS-TrafficTypeDiagnostic: BN6PR02MB2771: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:580; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wrs7xNPy3dVbAwSJpBfqJBimh22qK+eSWAkTJbzvnBPp+vufrJW0bNCbT0QR0bZ3JxswYCVcdPPqoYFgyPxA1Ic0K24s4z76R3Ce3hQE7SLfKh60meVg8Y1tI0Ma8gx1TWq8aL+3rua/7GEHcTZTREWAS89v2M2fQR8uYKhtGT7N+uOd7o9itEbA/RlqoVnVdTeIb0okUT/2/0UNW2sWQCSQnTyp7ZnGl1Ghd+8j53+ZNp5EwyIIU9qRwBX0JfhidRjiVtNaLIRO2kLBexBlODpCFVCIC6ssagAt8BWOq/iIsQTUkoiCfQ4by1SCYE6kQ/MocnCG2/VFcQYYy7snKdF6Ek4Bq1l8qRDcAt0li6excsrOqUwGBAKyVfrb0bpmm4UhUJ4Qcln0loGS6mZeEnxc2OJUDiIvyvnwjMP2HOh6MRWu0zyNmaT2nIujKfit X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:10.4204 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69521a8c-f199-42b6-2653-08d75e9197c9 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: BN6PR02MB2771 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 Fri Nov 1 06:05:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11222353 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 B1F1B139A for ; Fri, 1 Nov 2019 06:06:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86B12208E3 for ; Fri, 1 Nov 2019 06:06:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="dBs3EBH+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729782AbfKAGGk (ORCPT ); Fri, 1 Nov 2019 02:06:40 -0400 Received: from mail-eopbgr720052.outbound.protection.outlook.com ([40.107.72.52]:1248 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727995AbfKAGGP (ORCPT ); Fri, 1 Nov 2019 02:06:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PuIm2PJ5eOBtK/48pzdxu+IkETmQ2VVd9NJbkJJ+VNzZoHsp2ZYd3Kz0GjPbGTtRnDeOMZ2PMIG0GhHYdASnOqtsuZrevxYQ8KLYDatyLFamVJDVNlXZBzejmBeRxiVz3gHzHepF8A0wDfTDOJX5+LQk2rHxg/CkusszOhz5jubKzakSCiHEBhOo4s5YTTnfrXZ8HRVTTJvuOK2J4g06ySkDqHM/k2sJR21cR1rckCAhrwzPPg/A+uG7Z0tkmp8ewndwYpEdLuIDilJmmgSxPcts7fF7QD6eOotYX3Wj7BD/iiYcQui4Swt9MaMWc3kuoHh/+eZRzfHN0zQ7SjkSJw== 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=sxkGV6M9kRxWtnGv4KOURERUHVjiwzQj1EsmmBg3bRk=; b=dThYEN5uWfZrP7YuXl/0G37iCo85ypKoM4aPj36dRqnGsrL6hmUjpVTnTvBGMQZWm7f9rRZU7+DJw1app/8Xb7crjclK+d+02/dUWnZz5WqIIfpNz0v58VCEqVTlnZzJCGHN3FR1vvAO7Mlp7GDucZfU089/CJJCkhH6Hrb2fENi8IKzRLZH9tt+h8k0+D95QeypUboT7QVLVNUG2uTVKench90++oABlN8uC9OsZ2RdcKyYVg+HZWkchc/CXX36HQ/KDTYIrDLOaIQDgCDyTzKq2vUoiONjypZc0kp7mqbyrRmxj0HPDNq995HLXEFTccCTW6HOTH1SLIZQ/0L2uA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=sxkGV6M9kRxWtnGv4KOURERUHVjiwzQj1EsmmBg3bRk=; b=dBs3EBH+BSCuejz8SJWsWvBQ/VSFsWRI1Zv/91fT2t7gZijzKidXg7qrANyc1Gpbie5Cxrmwyfy/k1FAyK7KE3nmF0kgJXwSP3rvfj/onkL2Yx7jvOpDmT48Ib1ikBz56lv2/VaxrvA5n0+MT7x+f72md9sFBAfax14JvNZZqA8= Received: from BN7PR02CA0001.namprd02.prod.outlook.com (2603:10b6:408:20::14) by BY5PR02MB6019.namprd02.prod.outlook.com (2603:10b6:a03:1b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.18; Fri, 1 Nov 2019 06:06:11 +0000 Received: from SN1NAM02FT063.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::205) by BN7PR02CA0001.outlook.office365.com (2603:10b6:408:20::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2408.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:09 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 SN1NAM02FT063.mail.protection.outlook.com (10.152.72.213) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2367.14 via Frontend Transport; Fri, 1 Nov 2019 06:06:09 +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 1iQQ4X-0005mN-2C; Thu, 31 Oct 2019 23:06:09 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4R-0007dN-UR; Thu, 31 Oct 2019 23:06:03 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165xts010455; Thu, 31 Oct 2019 23:05:59 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4M-0007aN-Pn; Thu, 31 Oct 2019 23:05:59 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id 0DC00121388; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 7/8] dt-bindings: mmc: arasan: Document 'xlnx,zynqmp-8.9a' controller Date: Fri, 1 Nov 2019 11:35:52 +0530 Message-Id: <1572588353-110682-8-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(376002)(396003)(136003)(189003)(199004)(2906002)(51416003)(70586007)(36756003)(36386004)(70206006)(76176011)(26005)(186003)(356004)(44832011)(2616005)(106002)(305945005)(336012)(426003)(50226002)(8936002)(446003)(11346002)(5660300002)(6666004)(47776003)(478600001)(6266002)(103686004)(486006)(81166006)(4326008)(16586007)(476003)(48376002)(81156014)(107886003)(126002)(8676002)(42186006)(50466002)(316002)(142933001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY5PR02MB6019;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: bd5df4d9-2901-44bc-ddcb-08d75e91974c X-MS-TrafficTypeDiagnostic: BY5PR02MB6019: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xn+9IiKDvliIxDF/t7s/fO2AhvCnePY3nEmitoN1IGxF5WrWjgDC2McIbzq/es5MWVgyCYum1BQS5u6LtTCyLhFRPRay9tm/WzBLrrHyTHQJIRRmXo2KQtwqANC+8BEXGTqggCcYVFBTQqXG2jUlm/5ebrtHOMfGo+A09HGuNpCdiwlD6Wt8PdKppc5xH7bNIOEK999qvyfGnw1FKl070wkbsnXM486J2ng/n8789KmrBBsnEwCHCQIjzMnJWC1cnScZYGAdDYQxHug5f/1SNLSWtTwe6XLPBJYatYZUim30iLmnSgviCN2+7BIAhEoaW5ITrjS1Qz37p644nJgZeoZBxjE2BJVGlHDZHo34IMx7xF4BvtNQdODYFNNkMIFIxRjI46PCbUm94GwlclEnK4H3UbCkyr4muR/ncUW340Vrtce+vYaWRZklEySqG5/+ X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:09.6489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd5df4d9-2901-44bc-ddcb-08d75e91974c 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: BY5PR02MB6019 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 b51e40b2e0c5..6f28e9d612d9 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 @@ -47,6 +50,10 @@ Optional Properties: - xlnx,int-clock-stable-broken: when present, the controller always reports that the internal clock is stable even when it is not. + - 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"; @@ -83,6 +90,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>; + arasan-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 Fri Nov 1 06:05:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manish Narani X-Patchwork-Id: 11222351 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 8956114DB for ; Fri, 1 Nov 2019 06:06:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A218208E3 for ; Fri, 1 Nov 2019 06:06:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="tWlmSLPW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729944AbfKAGGP (ORCPT ); Fri, 1 Nov 2019 02:06:15 -0400 Received: from mail-eopbgr770083.outbound.protection.outlook.com ([40.107.77.83]:45592 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728243AbfKAGGP (ORCPT ); Fri, 1 Nov 2019 02:06:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SdwbWVS05Bb4E+0LLjunCnO+EKYcbRs5McMUjWAiLUeiixQYV6sM4Da94ZcDHzYP4OehOVYg1fkuMfCF0OUT7US95DyXkcTY6OGYwdIpLW01Ey2YMzM6ybQ8SlGrDWyxXD9utHLGNFYmXoWqLDFmklqsGbEO27XPG3kEj7bz2JDsyuUq3Yf6EembFEV9MNsalXpYSDDtUA0upvTjJT3ENPhezvnhscADsALe6qFFOl6Eat3eX9ENLYJZBQNOzfLcZk3GXgDrC9zFnYP4I6X5twzXfrPlIISxxrWootJJSeCyBaH2IuSMGbSz7qYN0OA4sMk7+EIiAg6WfHrAxffgMg== 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=QyNuoP16Z/YOfgx2/n//zWRR2NSkAP2xIdiXXSSl73g=; b=aWEu3B+N24dC23GF+5zK6qJ9jXSQUQsxRuoHPcU/1uhq9FML+HgAupVoLR2rlRlQH3ICKAwBxq914CgFPE1ae6b50pDDz6oTXHYkxv0cS7tjc36ZKKdKVVuHblIpsQnRU2d9vEPly4IL4GTQqOJCkjacJ0Y5z1+XvTdHwxo+jfd04zVYB1Xu7/zFRJdl5nZpj+/73sc0L1n7SQD7xne9JkB+644EWyEARBW1QpjSp1TMIpQiGlBg60xHcdvYxTmE3izvS2i5uvwfbmR0Wdh+iBTGgLYwUunUQVORKmhwf8TiKelfgIcjqP9Chlltb3QtDOF9LT1TbcD/gylQFuFTsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org 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=QyNuoP16Z/YOfgx2/n//zWRR2NSkAP2xIdiXXSSl73g=; b=tWlmSLPWBROeW7nOTALJGLbFttkL3vzyw4pSjbmalkB5vKBWl7eoT5fyyVq/p9u6WXilePM4ZVEJ/c+NcB6SH2R8siiL7+RlHiEy1NJYEJKPgAiDhaNiDltQFg+UEe+vhU/0xOpC9sCqm/KZxFOjeFbVHlbk7LAaH/trX477AWI= Received: from BL0PR02CA0136.namprd02.prod.outlook.com (2603:10b6:208:35::41) by DM6PR02MB4172.namprd02.prod.outlook.com (2603:10b6:5:97::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2387.20; Fri, 1 Nov 2019 06:06:10 +0000 Received: from BL2NAM02FT013.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e46::206) by BL0PR02CA0136.outlook.office365.com (2603:10b6:208:35::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2408.19 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; 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 BL2NAM02FT013.mail.protection.outlook.com (10.152.77.19) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2387.20 via Frontend Transport; Fri, 1 Nov 2019 06:06:10 +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 1iQQ4X-0005mQ-FV; Thu, 31 Oct 2019 23:06:09 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1iQQ4S-0007dN-BF; Thu, 31 Oct 2019 23:06:04 -0700 Received: from xsj-pvapsmtp01 (smtp3.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id xA165x3M005685; Thu, 31 Oct 2019 23:05:59 -0700 Received: from [172.23.64.106] (helo=xhdvnc125.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1iQQ4M-0007aO-Pp; Thu, 31 Oct 2019 23:05:59 -0700 Received: by xhdvnc125.xilinx.com (Postfix, from userid 16987) id 13A71121389; Fri, 1 Nov 2019 11:35: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, nava.manne@xilinx.com, rajan.vaja@xilinx.com, 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 v5 8/8] mmc: sdhci-of-arasan: Add support for ZynqMP Platform Tap Delays Setup Date: Fri, 1 Nov 2019 11:35:53 +0530 Message-Id: <1572588353-110682-9-git-send-email-manish.narani@xilinx.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> References: <1572588353-110682-1-git-send-email-manish.narani@xilinx.com> X-RCIS-Action: ALLOW 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)(346002)(136003)(39860400002)(396003)(189003)(199004)(486006)(336012)(6266002)(70586007)(8676002)(305945005)(70206006)(50466002)(16586007)(107886003)(5660300002)(42186006)(51416003)(76176011)(186003)(26005)(356004)(81156014)(6666004)(81166006)(478600001)(316002)(103686004)(446003)(48376002)(36386004)(126002)(106002)(11346002)(426003)(44832011)(4326008)(2906002)(50226002)(14444005)(8936002)(476003)(2616005)(47776003)(36756003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR02MB4172;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: e862721b-e1b5-4b77-681e-08d75e9197a4 X-MS-TrafficTypeDiagnostic: DM6PR02MB4172: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-Forefront-PRVS: 020877E0CB X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JdKvJRUtC+oNWzwo5dW1QhmleAKKM/FNpOuNWUlnwW79M+5wmK9UGso2jf7hbpVcb/sKsNryqHNvU4JVgaV72wmuaRdNBMFkMYpgPrxNUSEIxp1h+23J6qP2S2UjP58BDgUzoQmuJiGBsNq7aR/dvVChh8t4H4qpKh0GAI9aZsb891GFdoFWet2qIzqY4LR4hzsRAag4UcC4XbmvKwvdE+c/GLMqulPqhgd8f6eo0kb+yq9CIX17jtDuLCdyo2tmcGPa/YknKzD5nD4NvvaOzSSWEEbLlLv92G6kQhdePkP6sY4J2XguN8lfysf3++XDGP+8339azIM7rmYbbLDyYOIjsedMOKt3aEopEG8LkDCld5NEkP6k+bfTozlY8jELBespBA80o2TiVqgIPhYvl+Y4BZ28LiWj3BkyUdgT2DeSyDTLPDQQah+cimAcKHZB X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2019 06:06:10.0405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e862721b-e1b5-4b77-681e-08d75e9197a4 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: DM6PR02MB4172 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 9452ae01f6fa..228dbeef74a8 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, 72, 60, 0, 60, 72, 135, 48, 72, 135, 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 * @@ -709,6 +868,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 @@ -716,6 +879,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, @@ -774,7 +953,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 = @@ -823,7 +1005,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 = @@ -1032,6 +1217,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);