From patchwork Tue Jan 10 11:31:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashok Reddy Soma X-Patchwork-Id: 1723943 X-Patchwork-Delegate: jh80.chung@samsung.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=Embmb6QE; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NrpZK54wVz23gB for ; Tue, 10 Jan 2023 22:32:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F007F8431A; Tue, 10 Jan 2023 12:32:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="Embmb6QE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F1A985016; Tue, 10 Jan 2023 12:31:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2047.outbound.protection.outlook.com [40.107.100.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 30C10851B3 for ; Tue, 10 Jan 2023 12:31:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=ashok.reddy.soma@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PzwKjtJQw9yHpsM9hjieAmXT0oEoFxsU4824Wqira5KfyNRzXkTHQ2TYdTGh2CKNjrr0UX4lVPHOB1DIUaOGQ0mJHl8jLKs1ab+Ix+RCEFrmKCZZ6/AW8iPrJ/ble7o3zqYqjMc+cl6aOmBlfBGActLitcDMXnQVBB4A6nKfeaKojWgTj7Hs4Tlc6Tprr4PAx71HXYEFfKilsfvHdio8E6aTIfikIClvUGd06GoMaMg1boxjxSVDXy374djVJmGbPKnhGA0k8hTXOfypmi0EkkfSdpzsHqD5X2gU/xsIhfv1k2m5mHDueCkpC3zA+lXiuh9Dy0FS01bIDABCcaBMpg== 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=hYD29Or7qsaTqdzRacQGdPEp3oZEfhhxV7JVZW18t48=; b=l3EXkK9Kkv3shCA2IsIcjy35V4Ozlcc8Kr0gowLoHZ1kRbagXtfft8osRAAakhWk6kVgKgxKXkphyZkqw9NX8xD/0XbqnPkbdjiF8J6mtEWsBOHLL6pNSLYXHVwTPclxk31FikQHvCr/+Tv6A4dAE81aaViuKmmQf5dQtyInomEIBE1Si1SywnNuD9093P/uf7R9Q1PWKcC3HYZSIV051rMRvzA6tc7TYOIFJPOhxJ73VWq76fRo97K0JNThxlot3CMkip0KZTmigYWdfzhN3fytmAuU0Sb98kIGr3iI5KKZHmMgVdQyaJHDhda9PLY4Attp3zPR6IB2fuB2wcfpiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de 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=hYD29Or7qsaTqdzRacQGdPEp3oZEfhhxV7JVZW18t48=; b=Embmb6QEwAbfKF8mSz6/O5swcKbrK3+V2PuxAfBTIFIQLsaetC/ZoCk32w5tOaMNMmYppt+TOOVrFoYaHoRy1HyXyywsIOQZEX8EPEmtBU1X/eeGtPgOw8PXkxV7Aj+muI/dWRdO913jaJYWesPfvh5XjKMLvufbyjn5xVWfJIc= Received: from DM6PR08CA0056.namprd08.prod.outlook.com (2603:10b6:5:1e0::30) by PH7PR12MB6657.namprd12.prod.outlook.com (2603:10b6:510:212::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Tue, 10 Jan 2023 11:31:44 +0000 Received: from DS1PEPF0000E647.namprd02.prod.outlook.com (2603:10b6:5:1e0:cafe::b3) by DM6PR08CA0056.outlook.office365.com (2603:10b6:5:1e0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Tue, 10 Jan 2023 11:31:44 +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 DS1PEPF0000E647.mail.protection.outlook.com (10.167.18.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.11 via Frontend Transport; Tue, 10 Jan 2023 11:31:44 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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; Tue, 10 Jan 2023 05:31:43 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 10 Jan 2023 03:31:42 -0800 Received: from xhdashokred41.xilinx.com (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 via Frontend Transport; Tue, 10 Jan 2023 05:31:40 -0600 From: Ashok Reddy Soma To: CC: , , , , , , , , Ashok Reddy Soma Subject: [2/4] mmc: sdhci: Check and call config_dll callback functions Date: Tue, 10 Jan 2023 04:31:22 -0700 Message-ID: <20230110113124.1434-3-ashok.reddy.soma@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230110113124.1434-1-ashok.reddy.soma@amd.com> References: <20230110113124.1434-1-ashok.reddy.soma@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E647:EE_|PH7PR12MB6657:EE_ X-MS-Office365-Filtering-Correlation-Id: b511d29b-59d3-496b-4b38-08daf2fe4050 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YZYe09vVhpYtO3psxnySM1Gxtoc9CD4+QSrY9TGwmCvJE9GasYHvfneveerv0mRxMOCL5rZ5YtWbV4eCf5aO/gsuGcJ0PF6kN/1+M5+1MQj1olY/kcAjv7MN+YHxKgVbIubei3DzqIbkTD2UTJoNiT4em4f4ZI6trA4+OsPF3hrIFjV9RVU00zIJip1whLid/Z3B8RyvHDMBdi+8HwNv55M53FYGmAqW00CMHP9u0+gqvbqBix4i3eCNAfs8nOxY7yjUfmMR5vyucPYZGYSYV0b3BxcdCAfaj4AQFTnHuZDVHR30d3bDYe9SqfjqGiKbFPqPJ6NwYEJy/m9B28sR4R31AvtOLeNxSN/bKXGO93tWjguN8hN3qoVn0hgh6oFruV8B9fTpgzlo2HeEPqlHrF+6Ou7IbaPa0qErOb6ribb4eF6NPm5OT5g/ZMAc9Mao84QmX3vxaRRBX+Clj9G7o2e4+3lXYAYQC9Wrtn7XVDrLbtf5jR3LT3jBiDnT/Jv4Qh++y//2MiLFbvl0kk3M+qAGUoNFe3zqD1jN/9QUu2bfWYtiuaRm4uPJVZxuKn9+lgR/fMTP2sjaBsffmaTN73MjeeOtEMdVLDxX9EvCCEzExOcUbwR6IAyxNj6ZdDEQLIlZWhzUJTa1qZG0ayL0qyQ5Uv6tUQ+c2jzO1AZswMZjqreKcQ5f+IgTodXI5xLOLYbjonFAmPPE6/6Eg64NE96+xfLuopzJskAT2Ec4LyY= 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:(13230022)(4636009)(346002)(396003)(376002)(39860400002)(136003)(451199015)(46966006)(40470700004)(36840700001)(86362001)(40460700003)(2906002)(41300700001)(8676002)(4326008)(70586007)(70206006)(6916009)(8936002)(103116003)(5660300002)(36756003)(336012)(47076005)(316002)(83380400001)(1076003)(478600001)(186003)(6666004)(2616005)(26005)(82310400005)(426003)(40480700001)(54906003)(356005)(82740400003)(81166007)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 11:31:44.0184 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b511d29b-59d3-496b-4b38-08daf2fe4050 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: DS1PEPF0000E647.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6657 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Check if the low level driver supports config_dll callback function and call it if it does. Call with dll disable before calling set_clock and with dll enable after it. Signed-off-by: Ashok Reddy Soma Reviewed-by: Jaehoon Chung --- drivers/mmc/sdhci.c | 16 ++++++++++++++++ include/sdhci.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index a80ad8329a..181ab9b7cb 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -396,6 +396,14 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock) } } + if (host->ops && host->ops->config_dll) { + ret = host->ops->config_dll(host, clock, false); + if (ret) { + printf("%s: Error while configuring dll\n", __func__); + return ret; + } + } + if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) { /* * Check if the Host Controller supports Programmable Clock @@ -439,6 +447,14 @@ int sdhci_set_clock(struct mmc *mmc, unsigned int clock) if (host->ops && host->ops->set_clock) host->ops->set_clock(host, div); + if (host->ops && host->ops->config_dll) { + ret = host->ops->config_dll(host, clock, true); + if (ret) { + printf("%s: Error while configuring dll\n", __func__); + return ret; + } + } + clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) << SDHCI_DIVIDER_HI_SHIFT; diff --git a/include/sdhci.h b/include/sdhci.h index 24b4599b85..64a3d309da 100644 --- a/include/sdhci.h +++ b/include/sdhci.h @@ -272,6 +272,8 @@ struct sdhci_ops { void (*set_clock)(struct sdhci_host *host, u32 div); int (*platform_execute_tuning)(struct mmc *host, u8 opcode); int (*set_delay)(struct sdhci_host *host); + /* Callback function to set DLL clock configuration */ + int (*config_dll)(struct sdhci_host *host, u32 clock, bool enable); int (*deferred_probe)(struct sdhci_host *host); /**