From patchwork Thu Mar 23 00:06:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Larson X-Patchwork-Id: 666420 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22912C6FD1C for ; Thu, 23 Mar 2023 00:11:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbjCWALj (ORCPT ); Wed, 22 Mar 2023 20:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230493AbjCWALY (ORCPT ); Wed, 22 Mar 2023 20:11:24 -0400 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2042.outbound.protection.outlook.com [40.107.101.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2823335EDE; Wed, 22 Mar 2023 17:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dsbH/d1iUxSe3H2SMDgHI3OyPjR/suEmbkx9n6Yc6U3vr7NXpz3vymHEERgfe7hWPFFp2x6rEsAgUfxyCwjDSWzVSXK3k883rkctuE8LY4lHGJML+lzTM2PLYA225D9D4+3zV+WlJSti+ydLo2oyeNhXqX8VtSySiW6xZocOgvf3lrXbsc/DsUkyLhseyy+NILc2x/nVkT0AwJLqRZsiAK3jYcZncG0WB1PASMtNSjfP1WVcyDCV+T8YpyK7Eh5g2GgADAX9TyGvVLACaisuQR3UzZJAYIJO3bQ8JDvpY+LOEgI5hC8FjCtUYukHFcnHcdLL9z5hYYO1Z3+weAbVBA== 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=1MDls9ITIFGGKkwfzufckKk9fjZ1Lh0w+zr7TA/z5wc=; b=gclitdk/YNVPSCRObHenfOhDJyADSZMz67t9fCYLU9LgqgYgzly+vXIwGTBZjnp6C7yxma2s1vMCgrtQ9DXi0szOshdk6mQTI2X2ZhDarKQawKCdbEmSerRDgvhxZ7EtbTIZgCoihIoOuONljcxLXY/ap4Qn2GTcjPrmBJnt42wQ8tEkmxg/xx5+e3T82cZmtG79ZeXuFUPow2w0wsQA4WYtYlWKWIY1HbfG/V4I5YfkGlSFlXidjrwK0tLpagd9JP0PiGAt6qNugfqbXvIhs1EYF6ogmh42nZw0/ili366P7FsGIsGHxSnEcePl8xTyIgOxKr4DIuYK0MdOYysuYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.infradead.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1MDls9ITIFGGKkwfzufckKk9fjZ1Lh0w+zr7TA/z5wc=; b=Jnymu99BEijCKDHV9pa6ClhJAUb8WNPUYrvkvGuGMe2uyigHDhDqqdBnJl9AH4FM+9IubqvJOU+LzaXGCCINHvkfHFt3vF8H9ESE7uekek0VedqZLqWJ8BhoBkcAFTr89ZqZA8WcFDXqT+MOOaFZanYEt5fdnmtTYDMg2MgniRc= Received: from BL1PR13CA0241.namprd13.prod.outlook.com (2603:10b6:208:2ba::6) by MN2PR12MB4517.namprd12.prod.outlook.com (2603:10b6:208:267::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Thu, 23 Mar 2023 00:10:19 +0000 Received: from BL02EPF000100D3.namprd05.prod.outlook.com (2603:10b6:208:2ba:cafe::d8) by BL1PR13CA0241.outlook.office365.com (2603:10b6:208:2ba::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.17 via Frontend Transport; Thu, 23 Mar 2023 00:10:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF000100D3.mail.protection.outlook.com (10.167.241.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Thu, 23 Mar 2023 00:10:19 +0000 Received: from platform-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 22 Mar 2023 19:10:16 -0500 From: Brad Larson To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v12 12/15] mmc: sdhci-cadence: Support device specific init during probe Date: Wed, 22 Mar 2023 17:06:54 -0700 Message-ID: <20230323000657.28664-13-blarson@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230323000657.28664-1-blarson@amd.com> References: <20230323000657.28664-1-blarson@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000100D3:EE_|MN2PR12MB4517:EE_ X-MS-Office365-Filtering-Correlation-Id: 519749aa-39ef-412f-539a-08db2b32fcef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CrdNSGjl+Xzyf1NStkBP1cYKS5J4NHFTzF27gfPDPL3jNeJdl94cpL4bMt6Nl/xNugF/12H2HPhmjPlzGaeqS9WricERWLTdRN4lLihxFM/HY4zR+xs5vdRbu60gZq6/xK70fC5I6Mw7Jg5bDgmjYUmmhTsKI5gKg1wnJf3mlIhWD1suwGZS7EATcg0bl+FmkIQxOVJq55C8JAu2wpeiNAAvpXwU2/jO9NdLClMNMDuNvniC5HhqlhWFvm0okFIsMDbvP61k2yLDi7Tczig0iNhqQ5JEOERMt2RwHqcB2qX9boi8v/Rws3xfU8DQhKGnSdVqhtNaAYhhHng3q2YX/Z8chCCCQhFaTu4z0//GCpp9sdAlvkFiPVjQNnvofeG8XO0CZJZ1MmJCyB0YRt429MlQVX0PowoWZyFy/Qg6lNlUQd0MUsxxv4O742jBn2u66OHOHkIFeWA+KL/kk/CPMEcrfcZIf+ikOzydWlpQMAF+MVrZl/5uTSvgVf6OAy+ZF4ZP0uaV4YTzc89N+FrmvsoRebDOZP1rL1xzUmS35iKooNwvJmhMBKOtq7HotKRnaEU2H8N/HCpz/QJ5H8lvRTqnG3a+iPrxaWIRQFKLKwjz2u/rC8hC+cMjlZ8letknoKt/zzMS5C4+Bu0oNZlFX+nSaYbVBFlGM0pRvm9zNB6KBdXbCbQ+gp95tIx3zOsRwwdLgc0E0AIXPh1n4EgCGlV86qQPBA8WQtimu68lwd8= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199018)(36840700001)(40470700004)(46966006)(82740400003)(356005)(40480700001)(81166007)(40460700003)(186003)(16526019)(54906003)(336012)(2906002)(316002)(47076005)(83380400001)(36860700001)(426003)(41300700001)(82310400005)(70586007)(6916009)(4326008)(70206006)(2616005)(8676002)(26005)(1076003)(7416002)(7406005)(478600001)(6666004)(8936002)(5660300002)(36756003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2023 00:10:19.4334 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 519749aa-39ef-412f-539a-08db2b32fcef X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000100D3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4517 Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Move struct sdhci_pltfm_data under new struct sdhci_cdns_drv_data. Add an init() into sdhci_cdns_drv_data for platform specific device initialization in the device probe which is not used for existing devices. Signed-off-by: Brad Larson Acked-by: Adrian Hunter --- v10 changes: - New patch to provide for platform specific init() with no change to existing designs. --- drivers/mmc/host/sdhci-cadence.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 708d4297f241..c528a25f48b8 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -77,6 +77,11 @@ struct sdhci_cdns_phy_cfg { u8 addr; }; +struct sdhci_cdns_drv_data { + int (*init)(struct platform_device *pdev); + const struct sdhci_pltfm_data pltfm_data; +}; + static const struct sdhci_cdns_phy_cfg sdhci_cdns_phy_cfgs[] = { { "cdns,phy-input-delay-sd-highspeed", SDHCI_CDNS_PHY_DLY_SD_HS, }, { "cdns,phy-input-delay-legacy", SDHCI_CDNS_PHY_DLY_SD_DEFAULT, }, @@ -325,13 +330,17 @@ static const struct sdhci_ops sdhci_cdns_ops = { .set_uhs_signaling = sdhci_cdns_set_uhs_signaling, }; -static const struct sdhci_pltfm_data sdhci_cdns_uniphier_pltfm_data = { - .ops = &sdhci_cdns_ops, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, +static const struct sdhci_cdns_drv_data sdhci_cdns_uniphier_drv_data = { + .pltfm_data = { + .ops = &sdhci_cdns_ops, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + }, }; -static const struct sdhci_pltfm_data sdhci_cdns_pltfm_data = { - .ops = &sdhci_cdns_ops, +static const struct sdhci_cdns_drv_data sdhci_cdns_drv_data = { + .pltfm_data = { + .ops = &sdhci_cdns_ops, + }, }; static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc, @@ -357,7 +366,7 @@ static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc, static int sdhci_cdns_probe(struct platform_device *pdev) { struct sdhci_host *host; - const struct sdhci_pltfm_data *data; + const struct sdhci_cdns_drv_data *data; struct sdhci_pltfm_host *pltfm_host; struct sdhci_cdns_priv *priv; struct clk *clk; @@ -376,10 +385,10 @@ static int sdhci_cdns_probe(struct platform_device *pdev) data = of_device_get_match_data(dev); if (!data) - data = &sdhci_cdns_pltfm_data; + data = &sdhci_cdns_drv_data; nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node); - host = sdhci_pltfm_init(pdev, data, + host = sdhci_pltfm_init(pdev, &data->pltfm_data, struct_size(priv, phy_params, nr_phy_params)); if (IS_ERR(host)) { ret = PTR_ERR(host); @@ -397,6 +406,11 @@ static int sdhci_cdns_probe(struct platform_device *pdev) host->ioaddr += SDHCI_CDNS_SRS_BASE; host->mmc_host_ops.hs400_enhanced_strobe = sdhci_cdns_hs400_enhanced_strobe; + if (data->init) { + ret = data->init(pdev); + if (ret) + goto free; + } sdhci_enable_v4_mode(host); __sdhci_read_caps(host, &version, NULL, NULL); @@ -461,7 +475,7 @@ static const struct dev_pm_ops sdhci_cdns_pm_ops = { static const struct of_device_id sdhci_cdns_match[] = { { .compatible = "socionext,uniphier-sd4hc", - .data = &sdhci_cdns_uniphier_pltfm_data, + .data = &sdhci_cdns_uniphier_drv_data, }, { .compatible = "cdns,sd4hc" }, { /* sentinel */ }