From patchwork Thu Oct 8 18:18:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zulkifli, Muhammad Husaini" X-Patchwork-Id: 11824325 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 B0E256CA for ; Thu, 8 Oct 2020 18:23:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72C142076E for ; Thu, 8 Oct 2020 18:23:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rmzu5z0+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72C142076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wh7hRlYjACSQgEyKwideDxYuUVcXCmZQWRavnnuUdvg=; b=rmzu5z0+le+htsj2DCVy1D2dQH Di4XyFp+sd+rR+7xzl5CecAvKzC33zICUowGlxxGILSLhsdXu3ghT4qEblxu3e2U979lw5kxKdIWc tLUyhpre/ceu6iXapQ0TpPaJujcytuvOmb/CIjJk/7C2hoeFDtKsf/OTPWL3iyIXB/20SCZ4FdbTq Cox/Y/mJouapEN5hVKB6InubNoAlPd7neGibWCTROnzaeVqkn+w78yL23D0vEdHhD64O9rI7zEGE5 kmARwQMYIUqlceHrLifNMRiHyLK0Hfzienv3tHaWqGm8cINkD4hyItViVe00w8qWdBF2ctZrOQbKr X0LVzRFw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYH-0005W6-9z; Thu, 08 Oct 2020 18:22:05 +0000 Received: from mga17.intel.com ([192.55.52.151]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYD-0005U6-CV for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 18:22:02 +0000 IronPort-SDR: WyQyWIqQVcSZB8xuVLrZP996GG08kFHvut5p2emt6E2BMS9jdoWC8qitr2EmN0wyYqkOd9Lwey 6o8ALdhCnjwA== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="145250435" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="145250435" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 11:22:01 -0700 IronPort-SDR: t8c24oTZ4xxPnrr4TlH5ygvnILrdLs5QQ7QaR32zFL6nxc58zqF2l+dOA4zB1DFZ8bbhxnRN71 7yqmrSZPd11A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="349572534" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.114]) by fmsmga002.fm.intel.com with ESMTP; 08 Oct 2020 11:21:56 -0700 From: muhammad.husaini.zulkifli@intel.com To: adrian.hunter@intel.com, michal.simek@xilinx.com, andriy.shevchenko@intel.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/4] firmware: keembay: Add support for Trusted Firmware Service call Date: Fri, 9 Oct 2020 02:18:41 +0800 Message-Id: <20201008181844.27947-2-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> References: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_142201_735544_788CC161 X-CRM114-Status: GOOD ( 18.26 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lakshmi.bai.raja.subramanian@intel.com, muhammad.husaini.zulkifli@intel.com, arnd@arndb.de, wan.ahmad.zainie.wan.mohamad@intel.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Muhammad Husaini Zulkifli Add header file to handle API function for device driver to communicate with Trusted Firmware - A profile(TF-A) or Trusted Firmware - M profile (TF-M). Signed-off-by: Muhammad Husaini Zulkifli Acked-by: Michal Simek Acked-by: Sudeep Holla --- include/linux/firmware/intel/keembay.h | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 include/linux/firmware/intel/keembay.h diff --git a/include/linux/firmware/intel/keembay.h b/include/linux/firmware/intel/keembay.h new file mode 100644 index 000000000000..363e6bf2c27a --- /dev/null +++ b/include/linux/firmware/intel/keembay.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Intel Keembay SOC Firmware API Layer + * + * Copyright (C) 2020, Intel Corporation + * + * Author: Muhammad Husaini Zulkifli + */ + +#ifndef __FIRMWARE_KEEMBAY_SMC_H__ +#define __FIRMWARE_KEEMBAY_SMC_H__ + +#include + +/* + * This file defines an API function that can be called by a device driver in order to + * communicate with Trusted Firmware - A profile(TF-A) or Trusted Firmware - M profile (TF-M). + */ + +/* Setting for Keem Bay IO Pad Line Voltage Selection */ +#define ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE \ + ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, \ + ARM_SMCCC_SMC_32, \ + ARM_SMCCC_OWNER_SIP, \ + 0xFF26) + +#define KEEMBAY_SET_1V8_VOLT 1 +#define KEEMBAY_SET_3V3_VOLT 0 + +#if IS_ENABLED(CONFIG_HAVE_ARM_SMCCC_DISCOVERY) +static inline int keembay_sd_voltage_selection(int volt) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_invoke(ARM_SMCCC_SIP_KEEMBAY_SET_SD_VOLTAGE, volt, &res); + if ((int)res.a0 < 0) + return -EINVAL; + + return 0; +} +#else +static inline int keembay_sd_voltage_selection(int volt) +{ + return -ENODEV; +} +#endif +#endif /* __FIRMWARE_KEEMBAY_SMC_H__ */ From patchwork Thu Oct 8 18:18:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zulkifli, Muhammad Husaini" X-Patchwork-Id: 11824327 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 62FEA6CA for ; Thu, 8 Oct 2020 18:23:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 261FD2076E for ; Thu, 8 Oct 2020 18:23:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="c05kI8kO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 261FD2076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9KC5XN4I/q2BMUArN5DfleHCDTqgejjhIDENs/1wH28=; b=c05kI8kOMA615d8CD0Kd2IkKYY X7iZyXHvbf25ghYLKlLp3mqfOwwey9b37smVGvzy+wnSil45fH+Fq2oW+yr44l4sEhynOlELlmYTv mvkQlMr9yqTESbXky7Nms4e/du6nsrErRavLa+LCCNuHwghRufXqy7mp6ehHg3d29N7aG0b2zX0Ej qCA3+CYDW05q6OgUYTMe21Qb1sylyaUuxIeqpbvSH9ovLyFdfq7nWh7WmIz5qsG8q5meb0TA54kDi NXkNmc6jkq9vB/As+ATgbZnPbEk3SqsUWACRe1Jk8X6KDHkfBr8d88EtKSSI2Aygyb5qLbnBWhEzR bYMjRtGg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYL-0005Xd-SK; Thu, 08 Oct 2020 18:22:09 +0000 Received: from mga17.intel.com ([192.55.52.151]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYG-0005U6-3r for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 18:22:05 +0000 IronPort-SDR: ZmmSHa2RERGOxTchcbNSEjLwYGQ+pk0ePHECVh1kTprjgnQ1n6BYhBRgeGsGvgYOt9LhiSIuYX guWxkOZHRBDw== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="145250443" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="145250443" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 11:22:03 -0700 IronPort-SDR: tTWZA1hY9EMh9skBW5psikHF8FM8NkX4s7kMCbozh2EpAitrejR4xYgk4F6EZOiQ+7pvRYEQyZ Zy/LbIX+liKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="349572559" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.114]) by fmsmga002.fm.intel.com with ESMTP; 08 Oct 2020 11:22:01 -0700 From: muhammad.husaini.zulkifli@intel.com To: adrian.hunter@intel.com, michal.simek@xilinx.com, andriy.shevchenko@intel.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/4] dt-bindings: mmc: Add uhs-gpio for Keem Bay UHS-1 Support Date: Fri, 9 Oct 2020 02:18:42 +0800 Message-Id: <20201008181844.27947-3-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> References: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_142204_319899_62A0D945 X-CRM114-Status: GOOD ( 13.45 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lakshmi.bai.raja.subramanian@intel.com, muhammad.husaini.zulkifli@intel.com, arnd@arndb.de, wan.ahmad.zainie.wan.mohamad@intel.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Muhammad Husaini Zulkifli Add DT bindings of uhs-gpio for Keem Bay SOC UHS Mode Support Signed-off-by: Muhammad Husaini Zulkifli Acked-by: Michal Simek --- Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml b/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml index 58fe9d02a781..320566a673f0 100644 --- a/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml +++ b/Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml @@ -83,7 +83,7 @@ properties: - const: intel,keembay-sdhci-5.1-sd # Intel Keem Bay SD controller description: For this device it is strongly suggested to include - arasan,soc-ctl-syscon. + arasan,soc-ctl-syscon and uhs-gpio. - const: intel,keembay-sdhci-5.1-sdio # Intel Keem Bay SDIO controller description: For this device it is strongly suggested to include @@ -152,6 +152,11 @@ properties: description: The MIO bank number in which the command and data lines are configured. + uhs-gpio: + description: + The power mux input will be configure using the GPIO provided + to generate either 1.8v or 3.3v output. + dependencies: clock-output-names: [ '#clock-cells' ] '#clock-cells': [ clock-output-names ] @@ -300,4 +305,5 @@ examples: clocks = <&scmi_clk KEEM_BAY_PSS_AUX_SD0>, <&scmi_clk KEEM_BAY_PSS_SD0>; arasan,soc-ctl-syscon = <&sd0_phy_syscon>; + uhs-gpio = <&pca0 17 0>; }; From patchwork Thu Oct 8 18:18:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zulkifli, Muhammad Husaini" X-Patchwork-Id: 11824329 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 6F5816CA for ; Thu, 8 Oct 2020 18:23:34 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33E1E2076E for ; Thu, 8 Oct 2020 18:23:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="u7Y90pzr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33E1E2076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F50toOWTE5Eg9oW7yMBFda/k1HbxakH1L9EAMfpiF0I=; b=u7Y90pzr9JnNkEdKN/n7IVm8g2 Hyn6eIKnQjAkvlbNw4Y2bBOOVdeyWYLkjQ7DFNdmCA35Vv+yxHKJPRuybbtRL0TX74kBUpWuixayC 2fUuPIidvcUKEjyp3VJfuGo3UoUrog723+PZ/7+Pw4Cj6D8QqgYkoCzHw1yRXE06IIv+Z/lWXx6A1 6SMjUJN37j5J8RQSHtnYDsUu+fo946IgBWgbicWvyrnIXN7GeK7hVwVRvPUunK7EnN/ttRkHuCxUn XOXfEHCKW1cu4J5H+QbtSBZS8iMG2xUN0N998+GBWvhnYwsEPt8VYoDq1XQ4gu3mazKMuu88YTgH9 OxVLlktA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYN-0005YK-LO; Thu, 08 Oct 2020 18:22:11 +0000 Received: from mga17.intel.com ([192.55.52.151]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYJ-0005U6-Ak for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 18:22:08 +0000 IronPort-SDR: imEaWCEWf/ty8nV57icziSghZTLwvVAYRS5Mu2MY2WfOxgxtGLnSpe9iHG38z+4HTci/hsFGQn qnqXMNjjMIIA== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="145250462" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="145250462" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 11:22:06 -0700 IronPort-SDR: tvp8US/UhPgYpAFeA1cCUsWdiyFLFMm8H7sL12S5UfHwMvsa2ZlusWAFgnXsk4gVAmM7eI+zz8 cZXlxroFV3Eg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="349572568" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.114]) by fmsmga002.fm.intel.com with ESMTP; 08 Oct 2020 11:22:03 -0700 From: muhammad.husaini.zulkifli@intel.com To: adrian.hunter@intel.com, michal.simek@xilinx.com, andriy.shevchenko@intel.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/4] mmc: sdhci-of-arasan: Add structure device pointer in probe Date: Fri, 9 Oct 2020 02:18:43 +0800 Message-Id: <20201008181844.27947-4-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> References: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_142207_593813_A5893DE3 X-CRM114-Status: GOOD ( 15.44 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lakshmi.bai.raja.subramanian@intel.com, muhammad.husaini.zulkifli@intel.com, arnd@arndb.de, wan.ahmad.zainie.wan.mohamad@intel.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Muhammad Husaini Zulkifli Add struct device *dev in probe func() so that it can widely use in probe to make code more readable. Signed-off-by: Muhammad Husaini Zulkifli --- drivers/mmc/host/sdhci-of-arasan.c | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index f186fbd016b1..6a9412dee975 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -1521,9 +1521,10 @@ static int sdhci_arasan_probe(struct platform_device *pdev) struct sdhci_pltfm_host *pltfm_host; struct sdhci_arasan_data *sdhci_arasan; struct device_node *np = pdev->dev.of_node; + struct device *dev = &pdev->dev; const struct sdhci_arasan_of_data *data; - match = of_match_node(sdhci_arasan_of_match, pdev->dev.of_node); + match = of_match_node(sdhci_arasan_of_match, dev->of_node); data = match->data; host = sdhci_pltfm_init(pdev, data->pdata, sizeof(*sdhci_arasan)); @@ -1537,7 +1538,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev) sdhci_arasan->soc_ctl_map = data->soc_ctl_map; sdhci_arasan->clk_ops = data->clk_ops; - node = of_parse_phandle(pdev->dev.of_node, "arasan,soc-ctl-syscon", 0); + node = of_parse_phandle(dev->of_node, "arasan,soc-ctl-syscon", 0); if (node) { sdhci_arasan->soc_ctl_base = syscon_node_to_regmap(node); of_node_put(node); @@ -1545,35 +1546,35 @@ static int sdhci_arasan_probe(struct platform_device *pdev) if (IS_ERR(sdhci_arasan->soc_ctl_base)) { ret = PTR_ERR(sdhci_arasan->soc_ctl_base); if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "Can't get syscon: %d\n", + dev_err(dev, "Can't get syscon: %d\n", ret); goto err_pltfm_free; } } - sdhci_arasan->clk_ahb = devm_clk_get(&pdev->dev, "clk_ahb"); + sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb"); if (IS_ERR(sdhci_arasan->clk_ahb)) { - dev_err(&pdev->dev, "clk_ahb clock not found.\n"); + dev_err(dev, "clk_ahb clock not found.\n"); ret = PTR_ERR(sdhci_arasan->clk_ahb); goto err_pltfm_free; } - clk_xin = devm_clk_get(&pdev->dev, "clk_xin"); + clk_xin = devm_clk_get(dev, "clk_xin"); if (IS_ERR(clk_xin)) { - dev_err(&pdev->dev, "clk_xin clock not found.\n"); + dev_err(dev, "clk_xin clock not found.\n"); ret = PTR_ERR(clk_xin); goto err_pltfm_free; } ret = clk_prepare_enable(sdhci_arasan->clk_ahb); if (ret) { - dev_err(&pdev->dev, "Unable to enable AHB clock.\n"); + dev_err(dev, "Unable to enable AHB clock.\n"); goto err_pltfm_free; } ret = clk_prepare_enable(clk_xin); if (ret) { - dev_err(&pdev->dev, "Unable to enable SD clock.\n"); + dev_err(dev, "Unable to enable SD clock.\n"); goto clk_dis_ahb; } @@ -1587,7 +1588,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev) pltfm_host->clk = clk_xin; - if (of_device_is_compatible(pdev->dev.of_node, + if (of_device_is_compatible(dev->of_node, "rockchip,rk3399-sdhci-5.1")) sdhci_arasan_update_clockmultiplier(host, 0x0); @@ -1602,7 +1603,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev) sdhci_arasan_update_baseclkfreq(host); - ret = sdhci_arasan_register_sdclk(sdhci_arasan, clk_xin, &pdev->dev); + ret = sdhci_arasan_register_sdclk(sdhci_arasan, clk_xin, dev); if (ret) goto clk_disable_all; @@ -1611,29 +1612,29 @@ static int sdhci_arasan_probe(struct platform_device *pdev) arasan_zynqmp_execute_tuning; } - arasan_dt_parse_clk_phases(&pdev->dev, &sdhci_arasan->clk_data); + arasan_dt_parse_clk_phases(dev, &sdhci_arasan->clk_data); ret = mmc_of_parse(host->mmc); if (ret) { if (ret != -EPROBE_DEFER) - dev_err(&pdev->dev, "parsing dt failed (%d)\n", ret); + dev_err(dev, "parsing dt failed (%d)\n", ret); goto unreg_clk; } sdhci_arasan->phy = ERR_PTR(-ENODEV); - if (of_device_is_compatible(pdev->dev.of_node, + if (of_device_is_compatible(dev->of_node, "arasan,sdhci-5.1")) { - sdhci_arasan->phy = devm_phy_get(&pdev->dev, + sdhci_arasan->phy = devm_phy_get(dev, "phy_arasan"); if (IS_ERR(sdhci_arasan->phy)) { ret = PTR_ERR(sdhci_arasan->phy); - dev_err(&pdev->dev, "No phy for arasan,sdhci-5.1.\n"); + dev_err(dev, "No phy for arasan,sdhci-5.1.\n"); goto unreg_clk; } ret = phy_init(sdhci_arasan->phy); if (ret < 0) { - dev_err(&pdev->dev, "phy_init err.\n"); + dev_err(dev, "phy_init err.\n"); goto unreg_clk; } @@ -1658,7 +1659,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev) if (!IS_ERR(sdhci_arasan->phy)) phy_exit(sdhci_arasan->phy); unreg_clk: - sdhci_arasan_unregister_sdclk(&pdev->dev); + sdhci_arasan_unregister_sdclk(dev); clk_disable_all: clk_disable_unprepare(clk_xin); clk_dis_ahb: From patchwork Thu Oct 8 18:18:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zulkifli, Muhammad Husaini" X-Patchwork-Id: 11824331 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 583191592 for ; Thu, 8 Oct 2020 18:23:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 052182076E for ; Thu, 8 Oct 2020 18:23:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="dIL5wnIx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 052182076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IFQqyLwkN8EWSBi9PH8lUEj5bzQ0HYPulQIIj+xvBk0=; b=dIL5wnIxut7v4dhDPiafHiKumX ybVNmeSx0aUT1dBxh9ew2Bo/qjM1Asep2re/OjHHzgMamsNwFcMIte1qb2RCdLuQyJaOi9sLMrwmg ymMx8TbmlrIdijUG2yKnz8/NZgbxvza5zP5fnDqyg46BMoZlCFZtEJmjJMy6cBGEs4GzlLRyw6Zx9 FuxeCyM2aasRM7EOfJGEGPqhpHClWhYTrIgY8znGcpdXtZc6abyGGq9aReL6VL4qmVlpGE39MT3yM /rw3wU4ysqmEleCSpdx/NtEC4XCJw51TBkGClZ4Z8bhXVLH6vqoDCStiZdytjyADc+fWZneHg9VAK qFddRR4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYT-0005aW-Pc; Thu, 08 Oct 2020 18:22:17 +0000 Received: from mga17.intel.com ([192.55.52.151]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kQaYO-0005U6-7A for linux-arm-kernel@lists.infradead.org; Thu, 08 Oct 2020 18:22:13 +0000 IronPort-SDR: jSVFRmVPFjs8nywPXIyxHSNTtP/048x05CZE5DbxmjkFbE6iZdkOrFhLZ3+9Ib/SdcGI3hsxEj ktS+COZQz43A== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="145250484" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="145250484" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 11:22:11 -0700 IronPort-SDR: DjVzTZyL7ldcAfow3St0wnsItsmveRgioxrxCmye8znpL/RxhX4nysqR7Bj4jI4dr7VoW5tTLE Oc6ixnovkCoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="349572580" Received: from zulkifl3-ilbpg0.png.intel.com ([10.88.229.114]) by fmsmga002.fm.intel.com with ESMTP; 08 Oct 2020 11:22:07 -0700 From: muhammad.husaini.zulkifli@intel.com To: adrian.hunter@intel.com, michal.simek@xilinx.com, andriy.shevchenko@intel.com, ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 4/4] mmc: sdhci-of-arasan: Enable UHS-1 support for Keem Bay SOC Date: Fri, 9 Oct 2020 02:18:44 +0800 Message-Id: <20201008181844.27947-5-muhammad.husaini.zulkifli@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> References: <20201008181844.27947-1-muhammad.husaini.zulkifli@intel.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201008_142212_516630_1BA1119E X-CRM114-Status: GOOD ( 21.09 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lakshmi.bai.raja.subramanian@intel.com, muhammad.husaini.zulkifli@intel.com, arnd@arndb.de, wan.ahmad.zainie.wan.mohamad@intel.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Muhammad Husaini Zulkifli Voltage switching sequence is needed to support UHS-1 interface. There are 2 places to control the voltage. 1) By setting the AON register using firmware driver calling system-level platform management layer (SMC) to set the register. 2) By controlling the GPIO expander value to drive either 1.8V or 3.3V for power mux input. Signed-off-by: Muhammad Husaini Zulkifli Reviewed-by: Andy Shevchenko Reviewed-by: Adrian Hunter Acked-by: Michal Simek --- drivers/mmc/host/sdhci-of-arasan.c | 126 +++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 6a9412dee975..7b19de53e96d 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -23,6 +24,7 @@ #include #include #include +#include #include "cqhci.h" #include "sdhci-pltfm.h" @@ -136,6 +138,7 @@ struct sdhci_arasan_clk_data { * @soc_ctl_base: Pointer to regmap for syscon for soc_ctl registers. * @soc_ctl_map: Map to get offsets into soc_ctl registers. * @quirks: Arasan deviations from spec. + * @uhs_gpio: Pointer to the uhs gpio. */ struct sdhci_arasan_data { struct sdhci_host *host; @@ -150,6 +153,7 @@ struct sdhci_arasan_data { struct regmap *soc_ctl_base; const struct sdhci_arasan_soc_ctl_map *soc_ctl_map; unsigned int quirks; + struct gpio_desc *uhs_gpio; /* Controller does not have CD wired and will not function normally without */ #define SDHCI_ARASAN_QUIRK_FORCE_CDTEST BIT(0) @@ -361,6 +365,112 @@ static int sdhci_arasan_voltage_switch(struct mmc_host *mmc, return -EINVAL; } +static int sdhci_arasan_keembay_voltage_switch(struct mmc_host *mmc, + struct mmc_ios *ios) +{ + struct sdhci_host *host = mmc_priv(mmc); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host); + u16 ctrl_2, clk; + int ret; + + switch (ios->signal_voltage) { + case MMC_SIGNAL_VOLTAGE_180: + clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); + clk &= ~SDHCI_CLOCK_CARD_EN; + sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); + + clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); + if (clk & SDHCI_CLOCK_CARD_EN) + return -EAGAIN; + + sdhci_writeb(host, SDHCI_POWER_ON | SDHCI_POWER_180, + SDHCI_POWER_CONTROL); + + /* + * Set VDDIO_B voltage to Low for 1.8V + * which is controlling by GPIO Expander. + */ + gpiod_set_value_cansleep(sdhci_arasan->uhs_gpio, 0); + + /* + * This is like a final gatekeeper. Need to ensure changed voltage + * is settled before and after turn on this bit. + */ + usleep_range(1000, 1100); + + ret = keembay_sd_voltage_selection(KEEMBAY_SET_1V8_VOLT); + if (ret) + return ret; + + usleep_range(1000, 1100); + + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + ctrl_2 |= SDHCI_CTRL_VDD_180; + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + + /* Sleep for 5ms to stabilize 1.8V regulator */ + usleep_range(5000, 5500); + + /* 1.8V regulator output should be stable within 5 ms */ + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + if (!(ctrl_2 & SDHCI_CTRL_VDD_180)) + return -EAGAIN; + + clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); + clk |= SDHCI_CLOCK_CARD_EN; + sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); + break; + case MMC_SIGNAL_VOLTAGE_330: + /* + * Set VDDIO_B voltage to High for 3.3V + * which is controlling by GPIO Expander. + */ + gpiod_set_value_cansleep(sdhci_arasan->uhs_gpio, 1); + + /* + * This is like a final gatekeeper. Need to ensure changed voltage + * is settled before and after turn on this bit. + */ + usleep_range(1000, 1100); + + ret = keembay_sd_voltage_selection(KEEMBAY_SET_3V3_VOLT); + if (ret) + return ret; + + usleep_range(1000, 1100); + + /* Set 1.8V Signal Enable in the Host Control2 register to 0 */ + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + ctrl_2 &= ~SDHCI_CTRL_VDD_180; + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + + /* Sleep for 5ms to stabilize 3.3V regulator */ + usleep_range(5000, 5500); + + /* 3.3V regulator output should be stable within 5 ms */ + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + if (ctrl_2 & SDHCI_CTRL_VDD_180) + return -EAGAIN; + + break; + default: + return -EINVAL; + } + + return 0; +} + +static int sdhci_arasan_keembay_select_drive_strength(struct mmc_card *card, + unsigned int max_dtr, int host_drv, + int card_drv, int *drv_type) +{ + if (card->host->ios.signal_voltage == MMC_SIGNAL_VOLTAGE_180) + *drv_type = MMC_SET_DRIVER_TYPE_C; + + return 0; +} + static const struct sdhci_ops sdhci_arasan_ops = { .set_clock = sdhci_arasan_set_clock, .get_max_clock = sdhci_pltfm_clk_get_max_clock, @@ -1601,6 +1711,22 @@ static int sdhci_arasan_probe(struct platform_device *pdev) host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY; } + if (of_device_is_compatible(np, "intel,keembay-sdhci-5.1-sd")) { + struct gpio_desc *uhs; + + uhs = devm_gpiod_get_optional(dev, "uhs", GPIOD_OUT_HIGH); + if (IS_ERR(uhs)) + return dev_err_probe(dev, PTR_ERR(uhs), "can't get uhs gpio\n"); + + sdhci_arasan->uhs_gpio = uhs; + + host->mmc_host_ops.start_signal_voltage_switch = + sdhci_arasan_keembay_voltage_switch; + + host->mmc_host_ops.select_drive_strength = + sdhci_arasan_keembay_select_drive_strength; + } + sdhci_arasan_update_baseclkfreq(host); ret = sdhci_arasan_register_sdclk(sdhci_arasan, clk_xin, dev);