From patchwork Tue Nov 21 03:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1866471 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.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SZ9WZ5s8Zz1yRq for ; Tue, 21 Nov 2023 14:55:22 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1r5Hqz-0001EW-CJ; Tue, 21 Nov 2023 03:55:13 +0000 Received: from mail-pl1-f181.google.com ([209.85.214.181]) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1r5Hqi-0001Aq-5Q for kernel-team@lists.ubuntu.com; Tue, 21 Nov 2023 03:54:57 +0000 Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ce28faa92dso40461685ad.2 for ; Mon, 20 Nov 2023 19:54:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700538894; x=1701143694; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hCNm+MahSERlqU4PbvD/kXxxhrxnl/Iasxx3l1Dp0BE=; b=EHpVLemny92B5DpjXnzkARw15gCPROTpi1FAICU5/VdEAEE5EsH5wM0NVDWiYBkhV3 cYf231cec87cTZDcybZVzgTrIopk5MkWdSqaJO/9+M29XydyaXqtDyCGKsqwBqXvkzuY 1HT91AeT3XgPxpJGyCKy1mcSgyXkm15uP12BvOKxdTCjMoa3mGMSZhDcrmBiIBw4kX11 BhWtGURajI7UthCvHg+pwrAhX1wvBoGHRiR9gFZ6WMqaV4R1Q+qD8pwjhNDTiW74DqhW ehNQadMHcE0N3Qnm5j4sg89nj9jAA+FxALmA6T+qOORSN8tO4Pm/usZkmaQiBHpOGLVX h+sQ== X-Gm-Message-State: AOJu0Yy891Xh8sAIrQtD6BtdipW0wmIx2YlagjBHfRfzf6rKFsGWI4Vc 43ObWCiHT/kCmqjXJpsnz6we5eS4NYQamQ== X-Google-Smtp-Source: AGHT+IH/mVjYFkEPLICEGmJBMViv1w6VQLDAEbSJYH4/BQw4RMUGPxchkvxOWVuG5Lic1vQw77e3/A== X-Received: by 2002:a17:902:9a02:b0:1cc:e66:3732 with SMTP id v2-20020a1709029a0200b001cc0e663732mr7876676plp.19.1700538894110; Mon, 20 Nov 2023 19:54:54 -0800 (PST) Received: from localhost.localdomain (125-229-129-140.hinet-ip.hinet.net. [125.229.129.140]) by smtp.gmail.com with ESMTPSA id x10-20020a170902b40a00b001cf5d07c898sm2992794plr.296.2023.11.20.19.54.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 19:54:53 -0800 (PST) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/3][Unstable][Noble] UBUNTU: SAUCE: mmc: rtsx: add rts5264 to support sd express card Date: Tue, 21 Nov 2023 11:53:58 +0800 Message-Id: <20231121035358.2523345-4-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231121035358.2523345-1-vicamo.yang@canonical.com> References: <20231121035358.2523345-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.214.181; envelope-from=vicamo@gmail.com; helo=mail-pl1-f181.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Ricky WU BugLink: https://bugs.launchpad.net/bugs/2039925 add rts5264 register setting when sd express card insert Signed-off-by: Ricky Wu (backported from https://lore.kernel.org/all/2ba6662162b343e186839abedb8e98c1@realtek.com/) [vicamo: stripping trailing CRs from patch] Signed-off-by: You-Sheng Yang --- drivers/mmc/host/rtsx_pci_sdmmc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index 8098726dcc0b..217192fbd82e 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);