* [PATCH v3 2/2] mmc: rtsx: add rts5264 to support sd express card
@ 2023-10-19 3:00 Ricky WU
2023-10-19 11:41 ` Ulf Hansson
0 siblings, 1 reply; 3+ messages in thread
From: Ricky WU @ 2023-10-19 3:00 UTC (permalink / raw)
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
add rts5264 register setting when sd express card insert
Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
---
v3: split up mmc part from v2 patch
---
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 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 <wei_wang@realsil.com.cn>
*/
+#include <linux/pci.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/highmem.h>
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 2/2] mmc: rtsx: add rts5264 to support sd express card
2023-10-19 3:00 Ricky WU
@ 2023-10-19 11:41 ` Ulf Hansson
0 siblings, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2023-10-19 11:41 UTC (permalink / raw)
To: Ricky WU
Cc: frank.li@vivo.com, u.kleine-koenig@pengutronix.de,
yangyingliang@huawei.com, linux-mmc@vger.kernel.org,
linux-kernel@vger.kernel.org
On Thu, 19 Oct 2023 at 05:01, Ricky WU <ricky_wu@realtek.com> wrote:
>
> add rts5264 register setting when sd express card insert
>
> Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
I wasn't cc'd patch1 and not the mmc-list. Can you please resubmit so
we can see the complete series?
Kind regards
Uffe
> ---
> v3: split up mmc part from v2 patch
> ---
> 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 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 <wei_wang@realsil.com.cn>
> */
>
> +#include <linux/pci.h>
> #include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/highmem.h>
> @@ -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);
> --
> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v3 2/2] mmc: rtsx: add rts5264 to support sd express card
@ 2023-10-20 8:18 Ricky WU
0 siblings, 0 replies; 3+ messages in thread
From: Ricky WU @ 2023-10-20 8:18 UTC (permalink / raw)
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
Cc: arnd@arndb.de, gregkh@linuxfoundation.org
add rts5264 register setting when sd express card insert
Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
---
v3: split up mmc part from v2 patch
---
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 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 <wei_wang@realsil.com.cn>
*/
+#include <linux/pci.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/highmem.h>
@@ -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);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-20 8:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20 8:18 [PATCH v3 2/2] mmc: rtsx: add rts5264 to support sd express card Ricky WU
-- strict thread matches above, loose matches on Subject: below --
2023-10-19 3:00 Ricky WU
2023-10-19 11:41 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox