From patchwork Thu Oct 19 03:00:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricky WU X-Patchwork-Id: 155272 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp130220vqb; Wed, 18 Oct 2023 20:02:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwvHv00P+fI7+PeIYENzyinz5feSZGrm79AnKepwh+WVu2iKIK05NkNUHXybgqZz1sXYfu X-Received: by 2002:a25:3604:0:b0:d62:a199:fb18 with SMTP id d4-20020a253604000000b00d62a199fb18mr1076050yba.60.1697684575950; Wed, 18 Oct 2023 20:02:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697684575; cv=none; d=google.com; s=arc-20160816; b=tQPtwdqSkQXoViv3qxoIKpH1rp81mGRWZmFDqGE5VtQYDKg3weeIKwT7ll62rNOFRV pU444RRbmDl7q2f/pUeXrR9MWRv66UKV6UPHUD8aOE3EnARkO3M4SLrPsXpihjWmPNCY CUhGDJmtf7ewpKqq8vExzfs9zgFTo/OAC/WtGWzp6MA1+QkSotQSRo4xCxFQKo0VRkiu rG6upN+y0DVxgPjNXZGoKTbV7UmC+D2BxNjsXBiV/mrhr5D1gfRn2V8O19FOfBEwCjEw JDD0ihxwxtc6pQ9RmI3q+t67C2GmkCsCkgrP3kA8zI6DPXvHyewg81pbIINy14ZXVUDQ IGGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:to:from; bh=TQvIYWGREB1u/+Bh6W7p0JnxXlPnksfSRWm5vblJDzM=; fh=U0WYgN3/5Gore7ej1KZm/p1NrNzNyRVlquQJVITZtM0=; b=Xd2hXohK9luBV8c4TPM+XmWlykZxxnx5pacKwld+hGzHMFihbBdMbcd/DdHosZkZW9 NnKO6N9jvZumDhTcU13QizQaoH4Sjhcs/s19rqcYmbsTA+c0fIo6TYC8I9MXgu8Kr8As 9sMolHhzXESaNXMKSizN2bqtP8JIEMluQ4/WPVAYmb1aucRy9gZ5e8Ev5rU2jsgDeLdD 9y0Sgynpso/VVQRonj7V3MOIIxI5e09uV8bg3dVRI0VmLQ0iPDoGRv8ifAPEdf1YKzKu tYdpisQEtgs7NZTyM13sTinTa81kturyF/KP1KK1mS2PmcVBamKh7YijJ2WNBTUg5CPE 8yXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id q1-20020a056a00150100b006be2d9914eesi5666041pfu.118.2023.10.18.20.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 20:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 980518181B82; Wed, 18 Oct 2023 20:02:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232385AbjJSDCL (ORCPT + 24 others); Wed, 18 Oct 2023 23:02:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbjJSDCJ (ORCPT ); Wed, 18 Oct 2023 23:02:09 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32AD012D; Wed, 18 Oct 2023 20:01:58 -0700 (PDT) X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 39J3110G02399582, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.93/5.92) with ESMTPS id 39J3110G02399582 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2023 11:01:01 +0800 Received: from RTEXMBS02.realtek.com.tw (172.21.6.95) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.32; Thu, 19 Oct 2023 11:01:01 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) by RTEXMBS02.realtek.com.tw (172.21.6.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Thu, 19 Oct 2023 11:01:00 +0800 Received: from RTEXMBS01.realtek.com.tw ([fe80::9cb8:8d5:b6b3:213b]) by RTEXMBS01.realtek.com.tw ([fe80::9cb8:8d5:b6b3:213b%5]) with mapi id 15.01.2375.007; Thu, 19 Oct 2023 11:00:59 +0800 From: Ricky WU To: "ulf.hansson@linaro.org" , "frank.li@vivo.com" , Ricky WU , "u.kleine-koenig@pengutronix.de" , "yangyingliang@huawei.com" , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH v3 2/2] mmc: rtsx: add rts5264 to support sd express card Thread-Topic: [PATCH v3 2/2] mmc: rtsx: add rts5264 to support sd express card Thread-Index: AQHaAjguN03dRmCsUU20q33k85igXA== Date: Thu, 19 Oct 2023 03:00:59 +0000 Message-ID: <1143f3d4d26b4e7a8b3cc0d68caaa5ba@realtek.com> Accept-Language: zh-TW, en-US Content-Language: zh-TW x-originating-ip: [172.22.81.102] x-kse-serverinfo: RTEXMBS02.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 20:02:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780151301765951820 X-GMAIL-MSGID: 1780151301765951820 add rts5264 register setting when sd express card insert Signed-off-by: Ricky Wu --- v3: split up mmc part from v2 patch --- drivers/mmc/host/rtsx_pci_sdmmc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index 87d78432a1e0..7dfe7c4e0077 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -7,6 +7,7 @@ * Wei WANG */ +#include #include #include #include @@ -947,7 +948,7 @@ static int sd_power_on(struct realtek_pci_sdmmc *host, unsigned char power_mode) /* send at least 74 clocks */ rtsx_pci_write_register(pcr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, SD_CLK_TOGGLE_EN); - if (PCI_PID(pcr) == PID_5261) { + if ((PCI_PID(pcr) == PID_5261) || (PCI_PID(pcr) == PID_5264)) { /* * If test mode is set switch to SD Express mandatorily, * this is only for factory testing. @@ -1364,6 +1365,14 @@ static int sdmmc_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios) struct realtek_pci_sdmmc *host = mmc_priv(mmc); struct rtsx_pcr *pcr = host->pcr; + if (PCI_PID(pcr) == PID_5264) { + pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL2, + PCI_EXP_LNKCTL2_TLS, PCI_EXP_LNKCTL2_TLS_2_5GT); + pci_write_config_byte(pcr->pci, 0x80e, 0x02); + pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL2, + PCI_EXP_LNKCTL2_TLS, PCI_EXP_LNKCTL2_TLS_5_0GT); + } + /* Set relink_time for changing to PCIe card */ relink_time = 0x8FFF; @@ -1379,6 +1388,12 @@ static int sdmmc_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios) if (pcr->ops->disable_auto_blink) pcr->ops->disable_auto_blink(pcr); + if (PCI_PID(pcr) == PID_5264) { + rtsx_pci_write_register(pcr, RTS5264_AUTOLOAD_CFG2, + RTS5264_CHIP_RST_N_SEL, RTS5264_CHIP_RST_N_SEL); + rtsx_pci_write_register(pcr, GPIO_CTL, 0x02, 0x00); + } + /* For PCIe/NVMe mode can't enter delink issue */ pcr->hw_param.interrupt_en &= ~(SD_INT_EN); rtsx_pci_writel(pcr, RTSX_BIER, pcr->hw_param.interrupt_en);