From patchwork Fri Jul 29 19:35:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 12932798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6333C00144 for ; Fri, 29 Jul 2022 19:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AlXBYQuc99spwvI9ZJO6xRYMGfOhxTnB315DGmK/M8g=; b=MjjjVOd6+7FWUq 62zkE6jAccQ0sTcPXehIDkPEM4Ea8xDsa/cesFkKPBLTeLfnUiVs+qy6/iphpmw8/Ddm/r1xCKXKC SOrXaoUmGeqbkk8VZGQMct3PwKXlmPJFajvJOIKLMbjBB3+cAazF3XsYQBCDQ8q186uTo/HIyfFUO PEogN+cZEDHn1NfSDWrwLVTC5GMiUNdQcagGE//U/W8uyRGDRfcXKONBdrL+rRgbOO1jny4Mix6TF LrZGIgyIn56TGI3iMrgqCTvyKb4V21uF/iAeKJvExWpI1IlX1TnxopDEHYKNRPMa1ipSu6A/2tBRj UKixsWcI+HiOPHXiiSoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHVnJ-00BXsK-Pe; Fri, 29 Jul 2022 19:37:09 +0000 Received: from mail-sn1anam02on2063.outbound.protection.outlook.com ([40.107.96.63] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHVnG-00BXr9-GK for linux-arm-kernel@lists.infradead.org; Fri, 29 Jul 2022 19:37:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l5Im5KvSAduhMGr6547gC69SNkw99BAwPJJLrRYbHBHuZ6xLPiL+bSSBkZllCKP7xt2i0A3RBbrar2aETtc7GCFFtY+V9/U763IR9j4RtWGWnM99e74HBtZbb1Weae4G1yy/mT2hOMOhgnc+AL4iEdT8gs828pRs9oP6/70RoFMTju1fk73wl7vyoNPwe4urA7vBEZDP0ouyHdLcJJkiAUu/b9MUXwtrQfNXgEeyKyhWkahzI7Tyo9UTe/AXiu4jwJnBzYrwSuSx6rSLd2UNq6cX71+TFHqRj03iDA6ZWsrOBLbcGzrDU+vCTI5fMCsRohLfhkT5i1v0nrdA1eC/zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uxuBLQyTlZLiue2zimNPlMyIbm6yAtPWF8jMFP5KsRg=; b=eTcAszn0DxPNaNrzB9OEGA9/m8FlrPG7SMyJgndsTfRWw3maOto9qIB6scVqfqokv3DkdPT5yUBeW1AgTieBA0TT1qi8RTPv7JXqQAQ6aXSKNEgyNLVFDNOft+GXhI8fQ6np/kpnzzteCDYTFBUT8eEIrWp25mhzqD+yE9YyUoL0V0AcWmY0beLbQ+UknSi5hJdRSpWkI1TLPXZ08tW8XVl/UUi67CPYMVN7GzcI9m8whmEOgT6gROmu4vOG/+gqqSY8YdfnQvNbj+4ucmkfUQX6yCjbieMRLEe5BBS4XNk6tlQ55wAlBSa9+sxvpBPyzkxoXZS5bB+dc1eA/Zt+1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=amd.com smtp.mailfrom=xilinx.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.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=uxuBLQyTlZLiue2zimNPlMyIbm6yAtPWF8jMFP5KsRg=; b=LDz+hmyFG1UGOadvkmsNjKiS0VOESQbqgW53P+6hEd7GhrlYWjY7VakJH49x2vOcW1DvhPQ7lr2wvzdRU2VybE1UWFscMuhjcSWbj67z443YTyduQVb9foU8Rx1Z75qKNQSSPYyIwWl4eivW/09PEhNrcOSjZIEuIeWb1bqhW50= Received: from SA0PR11CA0157.namprd11.prod.outlook.com (2603:10b6:806:1bb::12) by CO1PR02MB8553.namprd02.prod.outlook.com (2603:10b6:303:158::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Fri, 29 Jul 2022 19:37:01 +0000 Received: from SN1NAM02FT0051.eop-nam02.prod.protection.outlook.com (2603:10b6:806:1bb:cafe::9b) by SA0PR11CA0157.outlook.office365.com (2603:10b6:806:1bb::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Fri, 29 Jul 2022 19:37:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0051.mail.protection.outlook.com (10.97.5.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5458.17 via Frontend Transport; Fri, 29 Jul 2022 19:37:01 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 29 Jul 2022 12:36:59 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 29 Jul 2022 12:36:59 -0700 Received: from [172.23.64.3] (port=58455 helo=xhdvnc103.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oHVn8-000GwV-JP; Fri, 29 Jul 2022 12:36:59 -0700 Received: by xhdvnc103.xilinx.com (Postfix, from userid 13245) id 38418102C79; Sat, 30 Jul 2022 01:06:43 +0530 (IST) From: Radhey Shyam Pandey To: , , , , , , , CC: , , , , , Ronak Jain , Radhey Shyam Pandey Subject: [PATCH v2 net-next 1/2] firmware: xilinx: add support for sd/gem config Date: Sat, 30 Jul 2022 01:05:49 +0530 Message-ID: <1659123350-10638-2-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1659123350-10638-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1659123350-10638-1-git-send-email-radhey.shyam.pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 429a2f0e-68c8-44ba-68ae-08da7199b547 X-MS-TrafficTypeDiagnostic: CO1PR02MB8553:EE_ X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 43aQAYDEXGiVZE8sf365nL9SXKbtysJhZeofooda1IUFV5oeVMoKkh5x0JG0nyVOe+2rsx0T5J1bJI7ZBA6oX4GnYgPAIX3DiUl+2ooLp3/Tko1JJpmNYKAmAs0JhOb82cZiAeRwrH1Kc0PFiVQDLEHw9wW3b2lwt/uodaElpJGftSvaMszinPNESJNPBhh6UH4rhxOQHYs3TVVkT6oG3uz5HsegzrJOYHmPuJtBLd9V26qucuXA8NXwKIJ8avJWqIH4i3PcvfVxCZhMWrrvt4B5U1iKdccBQox0ACudTWHqsL1GbcyxRv2Rqdy/bY0qYWHGn80DYlCwLEgXnv2CEpIITLQTbyYjm8lwBtZQxqzp7zg1WkqFMMX6QiymSPm9OdyqNqg+h492mJg8HijdDaiMcGhyHQALPbV3KHbYpsDVnwp35FEkRndFjh6Mzo6SAlh2q19cD/0miMUoEvL43pRkHyUjnolqsTt+JcQuZ+UgmLG4qLIXH22pBePxtN1Nw2JaYoU8RG7j1zg6xvTXztEjzmWYIfF4KELCndyC11tQcV0z9flIhpaiRlgqp7H8A8WkZM68gUXyyjyIkg8js6KV8H+xD6z2E8Nmon3abRhhz6+wLNfBjD33M+M+vIM4zDlSDGxbnP5OJSBc3tB6uESCUQ71yKpKaLllScSl5CvNYjV9iGr79hwiEdCo9V9JWQGXeRhie1jx+lto9weTNob2I6rKxJJBOvA55kES/gI5Cf0iB0A9ElotX1v2WlCWp83SjXJ9iLrKENTE3Zj5ou093QeaCVoHNfY/2m7ZENr+P3BhbVk9hbGiJETO+XxQT6ForO4VKdgkuZvDgw5vug== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch02.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(346002)(136003)(396003)(376002)(40470700004)(36840700001)(46966006)(41300700001)(356005)(6266002)(83170400001)(36860700001)(82740400003)(7636003)(26005)(2616005)(336012)(40460700003)(42882007)(186003)(83380400001)(8936002)(70586007)(7416002)(4326008)(47076005)(70206006)(8676002)(36756003)(5660300002)(40480700001)(110136005)(2906002)(54906003)(316002)(42186006)(478600001)(82310400005)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 19:37:01.0699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 429a2f0e-68c8-44ba-68ae-08da7199b547 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0051.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR02MB8553 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_123706_577313_A5B7F0B2 X-CRM114-Status: GOOD ( 12.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Ronak Jain Add new APIs in firmware to configure SD/GEM registers. Internally it calls PM IOCTL for below SD/GEM register configuration: - SD/EMMC select - SD slot type - SD base clock - SD 8 bit support - SD fixed config - GEM SGMII Mode - GEM fixed config Signed-off-by: Ronak Jain Signed-off-by: Radhey Shyam Pandey --- Changes for v2: - Use tab indent for zynqmp_pm_set_sd/gem_config return documentation. --- drivers/firmware/xilinx/zynqmp.c | 31 +++++++++++++++++++++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index 7977a494a651..44c44077dfc5 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -1298,6 +1298,37 @@ int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, } /** + * zynqmp_pm_set_sd_config - PM call to set value of SD config registers + * @node: SD node ID + * @config: The config type of SD registers + * @value: Value to be set + * + * Return: Returns 0 on success or error value on failure. + */ +int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, node, IOCTL_SET_SD_CONFIG, + config, value, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_set_sd_config); + +/** + * zynqmp_pm_set_gem_config - PM call to set value of GEM config registers + * @node: GEM node ID + * @config: The config type of GEM registers + * @value: Value to be set + * + * Return: Returns 0 on success or error value on failure. + */ +int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, + u32 value) +{ + return zynqmp_pm_invoke_fn(PM_IOCTL, node, IOCTL_SET_GEM_CONFIG, + config, value, NULL); +} +EXPORT_SYMBOL_GPL(zynqmp_pm_set_gem_config); + +/** * struct zynqmp_pm_shutdown_scope - Struct for shutdown scope * @subtype: Shutdown subtype * @name: Matching string for scope argument diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 1ec73d5352c3..063a93c133f1 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -152,6 +152,9 @@ enum pm_ioctl_id { /* Runtime feature configuration */ IOCTL_SET_FEATURE_CONFIG = 26, IOCTL_GET_FEATURE_CONFIG = 27, + /* Dynamic SD/GEM configuration */ + IOCTL_SET_SD_CONFIG = 30, + IOCTL_SET_GEM_CONFIG = 31, }; enum pm_query_id { @@ -393,6 +396,18 @@ enum pm_feature_config_id { PM_FEATURE_EXTWDT_VALUE = 4, }; +enum pm_sd_config_type { + SD_CONFIG_EMMC_SEL = 1, /* To set SD_EMMC_SEL in CTRL_REG_SD and SD_SLOTTYPE */ + SD_CONFIG_BASECLK = 2, /* To set SD_BASECLK in SD_CONFIG_REG1 */ + SD_CONFIG_8BIT = 3, /* To set SD_8BIT in SD_CONFIG_REG2 */ + SD_CONFIG_FIXED = 4, /* To set fixed config registers */ +}; + +enum pm_gem_config_type { + GEM_CONFIG_SGMII_MODE = 1, /* To set GEM_SGMII_MODE in GEM_CLK_CTRL register */ + GEM_CONFIG_FIXED = 2, /* To set fixed config registers */ +}; + /** * struct zynqmp_pm_query_data - PM query data * @qid: query ID @@ -468,6 +483,9 @@ int zynqmp_pm_feature(const u32 api_id); int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_pm_set_feature_config(enum pm_feature_config_id id, u32 value); int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, u32 *payload); +int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value); +int zynqmp_pm_set_gem_config(u32 node, enum pm_gem_config_type config, + u32 value); #else static inline int zynqmp_pm_get_api_version(u32 *version) { @@ -733,6 +751,21 @@ static inline int zynqmp_pm_get_feature_config(enum pm_feature_config_id id, { return -ENODEV; } + +static inline int zynqmp_pm_set_sd_config(u32 node, + enum pm_sd_config_type config, + u32 value) +{ + return -ENODEV; +} + +static inline int zynqmp_pm_set_gem_config(u32 node, + enum pm_gem_config_type config, + u32 value) +{ + return -ENODEV; +} + #endif #endif /* __FIRMWARE_ZYNQMP_H__ */ From patchwork Fri Jul 29 19:35:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radhey Shyam Pandey X-Patchwork-Id: 12932799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEFA0C00144 for ; Fri, 29 Jul 2022 19:38:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fqCgCldY94h43kxP1u5y0ehhXTyvvoh6Z+XEkaNHEKU=; b=IaGsUHD733zI1J 8YxDQpluNFo8elmjR5XZ6KyqgzWwCTHbeql/2ERm+TqAyy82d5hirqV96f6+Y4JmPhM2z6CUrd9ih SLyIM825Vie7dQCpdkLP2I3btbOfvFGNpBe4jfUruTp7It9UqrTGT9aX4xjHFGMkAFsRzj0fVxUCM JF28818i8l8/pB769Rb9ghbBkUM3HAEFRoTJgAOauitxTH6IyzpSP7Ju+4II1MpVIU3qmZpRRDXGh krcpLvvD5VY61abP6h6Vh1a4evlcf0sc/tUI6j7WaUVPGfAPqXQQr4a1O6XbmBXGDTp1MG1ZH09jp dH+ch9dc+345SxHd8pWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHVnY-00BXzo-0E; Fri, 29 Jul 2022 19:37:24 +0000 Received: from mail-co1nam11on2056.outbound.protection.outlook.com ([40.107.220.56] helo=NAM11-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHVnU-00BXvq-0F for linux-arm-kernel@lists.infradead.org; Fri, 29 Jul 2022 19:37:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ty+6yc8lpFwJYMvqSUr2Nza57ySRJKofNkpuCBtgDmQw0LZVuRhZYqjJfDJOTwvgGIwIkkfFWlEXsvHrDif2hRzToPZNddMhuY6xMu62HR24CoIAkAsMT6ZUXVjlhNei2rQhOc+GWguOujUqll+ZaG4AjiWNA0MuxVEmKPzMoR5BUZ3i2h9cSGTnrTTM0t12+iahT8/4ZdcbwtQcraamNiQxtHTYThF/7kKXb4ONxQYaZzyqFScfVl0/AY+kvf36z86aBV5B4PQX5kA/BloZBV8uYLqqaOTxg+hQgeL+ZouEIbNDWvQrbNXETxKfCs5nVsyRNqgxGFXwORgBBywLNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yu7IQxFIGve9bKAtpfiF43uh1bouRkixqOEp3eisZIw=; b=fUlDK8TdMU4pZVvmK5A5x5yhfj6OdRXlYEHRzwWsa+LAqTzF0M7nXXy8aW1beits9llbJ3jowVQ7aYNmRdgXmJ0BGhCCgl1R34EyUTkg0ofkcyZNrb3eTc7ueD1MPl4iX1dUno3tZLw5GuIP3G7VRS+VhofDmeEQYRJ6r7c7xvT0b4IDGtESIwUrqIqx8f2O8I4v9MQtSPEoPS1VEIx4dXkguk4G4snOpetC/mCnJz8MaXJNqk8lUQ2gdzf8CoESMcljH1H0XLjr1pFqJt3MMIiwmgftjNSgoxzDp8QbHwPK0gWxP5O8EJpUi6kWfWpfCtZYQ4tGgesuaXSdvs+kcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=amd.com smtp.mailfrom=xilinx.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine header.from=amd.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=yu7IQxFIGve9bKAtpfiF43uh1bouRkixqOEp3eisZIw=; b=iyeygUBANFbJWcksc25fTvFFtSJLO4bLlaRhUjhyP8pulqjlDuHJ3i2UOT0Nis+hB09UIqB0j2vYWg4+cDgsreNrjNnUYLZfYM6Yn3bCZLHO9J6jWkJ6qzUA3Ao0CNU2MmiJ0WSefzx73kG5Bvbfr32PhFR1iwbq/V6sMzEnPPQ= Received: from DS7PR05CA0021.namprd05.prod.outlook.com (2603:10b6:5:3b9::26) by DM5PR02MB3752.namprd02.prod.outlook.com (2603:10b6:4:b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.11; Fri, 29 Jul 2022 19:37:13 +0000 Received: from DM3NAM02FT048.eop-nam02.prod.protection.outlook.com (2603:10b6:5:3b9:cafe::d2) by DS7PR05CA0021.outlook.office365.com (2603:10b6:5:3b9::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.8 via Frontend Transport; Fri, 29 Jul 2022 19:37:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; pr=C Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by DM3NAM02FT048.mail.protection.outlook.com (10.13.4.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5482.10 via Frontend Transport; Fri, 29 Jul 2022 19:37:13 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Fri, 29 Jul 2022 12:37:12 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Fri, 29 Jul 2022 12:37:12 -0700 Received: from [172.23.64.3] (port=58456 helo=xhdvnc103.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1oHVnL-000GzJ-TD; Fri, 29 Jul 2022 12:37:12 -0700 Received: by xhdvnc103.xilinx.com (Postfix, from userid 13245) id 3D16D1054B2; Sat, 30 Jul 2022 01:06:43 +0530 (IST) From: Radhey Shyam Pandey To: , , , , , , , CC: , , , , , "Radhey Shyam Pandey" Subject: [PATCH v2 net-next 2/2] net: macb: Add zynqmp SGMII dynamic configuration support Date: Sat, 30 Jul 2022 01:05:50 +0530 Message-ID: <1659123350-10638-3-git-send-email-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1659123350-10638-1-git-send-email-radhey.shyam.pandey@amd.com> References: <1659123350-10638-1-git-send-email-radhey.shyam.pandey@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11984e9e-8143-4202-be28-08da7199bcbf X-MS-TrafficTypeDiagnostic: DM5PR02MB3752:EE_ X-MS-Exchange-SenderADCheck: 0 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cckMJcQvLxcrUDrKr60BTF1N5t3/LhTwpApS4qmlipTozDegnDGPQyUhUZiNW2mLx3ZUsZrxDWQFJ3n/Mhc4Swx87tEV/glHDCWBW7RDnmWmkYOErsER6kIOh/Gc/E199u1LVCoEkTttrgG0glCvgu83wRRot7PMinbiYAdgX9yLywAoqWH9C1WmB65ASyqQMpsjfjdqWDKaPo7hGaFnGvkgopmozDf37X9AhmunK/9+EhEQBwpIbbs2WGcJP+EbZYYvz+vzqfZoi3RF+GY5s+D47snyptO+pglyP6bsJPR5uTM6UAXIaN0lOPCKgabnWQLaEx9153fimSztaDmHK8Jdd1xGZImcz5HrTpRPFJUCcMSTd5EQqGT0JwSmOtgMPKk5DomjM5zGNUdvYiCgqC/iGEvA5k3TgoREgAp1ki2ePVrSQupocOq4ZQOA4jZE7K57qYl5CjiwmbBKuOLpc0QWe9xq+MIEZ0Mkw8OiPZ7cmAZQlzHrJQmtF9ftw1laYXezwIPOsAB9aWLBGdVBRFxFs0H/R45KVWmBTjnGm/HkvMbHqqu1RSj7NOGTQKoghmbebeAmzS1lVq5/3geDSElDvwNfmInYd+QgkJo7lE9ZEowBRdSBXM0YgQ6+WqUjSQuuzp4HIptLwtrHyrjAdRy+8EVHol8LtG1ACcAIJPKUl1tKQb0WVFaCqeRnYFMsi2C8BpE3FoVzisr2r/DaRr1hGBBLznTFdrywbL5edj9ApgVClVtECcxUrZk3Fxw+EothN8fdutDhK98UgYaW0mWygx1jRXm4D3Iv4XCHnDai/T9MP6rWLjOGujvjpRsgy2yUmMNOL3czGtsi7cpG6A== X-Forefront-Antispam-Report: CIP:149.199.62.198;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:xsj-pvapexch01.xlnx.xilinx.com;PTR:unknown-62-198.xilinx.com;CAT:NONE;SFS:(13230016)(4636009)(346002)(39860400002)(376002)(396003)(136003)(40470700004)(46966006)(36840700001)(47076005)(7636003)(6266002)(26005)(82740400003)(83170400001)(336012)(2616005)(40460700003)(41300700001)(356005)(186003)(6666004)(36860700001)(42882007)(40480700001)(70206006)(5660300002)(4326008)(70586007)(82310400005)(8936002)(36756003)(316002)(2906002)(110136005)(478600001)(7416002)(54906003)(8676002)(42186006)(102446001);DIR:OUT;SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2022 19:37:13.6026 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11984e9e-8143-4202-be28-08da7199bcbf X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.62.198];Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT048.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR02MB3752 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220729_123720_097419_E8EDA9C3 X-CRM114-Status: GOOD ( 13.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for the dynamic configuration which takes care of configuring the GEM secure space configuration registers using EEMI APIs. High level sequence is to: - Check for the PM dynamic configuration support, if no error proceed with GEM dynamic configurations(next steps) otherwise skip the dynamic configuration. - Configure GEM Fixed configurations. - Configure GEM_CLK_CTRL (gemX_sgmii_mode). - Trigger GEM reset. Signed-off-by: Radhey Shyam Pandey Reviewed-by: Andrew Lunn Tested-by: Conor Dooley (for MPFS) --- Changes for v2: - Add phy_exit() in error return paths. --- drivers/net/ethernet/cadence/macb_main.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 4cd4f57ca2aa..517b40ff098b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "macb.h" /* This structure is only used for MACB on SiFive FU540 devices */ @@ -4621,6 +4622,30 @@ static int init_reset_optional(struct platform_device *pdev) "failed to init SGMII PHY\n"); } + ret = zynqmp_pm_is_function_supported(PM_IOCTL, IOCTL_SET_GEM_CONFIG); + if (!ret) { + u32 pm_info[2]; + + ret = of_property_read_u32_array(pdev->dev.of_node, "power-domains", + pm_info, ARRAY_SIZE(pm_info)); + if (ret < 0) { + phy_exit(bp->sgmii_phy); + dev_err(&pdev->dev, "Failed to read power management information\n"); + return ret; + } + ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_FIXED, 0); + if (ret < 0) { + phy_exit(bp->sgmii_phy); + return ret; + } + + ret = zynqmp_pm_set_gem_config(pm_info[1], GEM_CONFIG_SGMII_MODE, 1); + if (ret < 0) { + phy_exit(bp->sgmii_phy); + return ret; + } + } + /* Fully reset controller at hardware level if mapped in device tree */ ret = device_reset_optional(&pdev->dev); if (ret) {