mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
parent
a9671e8543
commit
ecf4e9e890
@ -0,0 +1,54 @@
|
|||||||
|
From 3b6c472822f8bdeaa3cea8290f5b4a210dca5585 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ulf Hansson <ulf.hansson@linaro.org>
|
||||||
|
Date: Thu, 3 Mar 2022 17:45:22 +0100
|
||||||
|
Subject: [PATCH] mmc: core: Improve fallback to speed modes if eMMC HS200
|
||||||
|
fails
|
||||||
|
|
||||||
|
In the error path of mmc_select_hs200() we are trying our best to restore
|
||||||
|
the card/host into a valid state. This makes sense, especially if we
|
||||||
|
encounter a simple switch error (-EBADMSG). However, rather than then
|
||||||
|
continue with using the legacy speed mode, let's try the other better speed
|
||||||
|
modes first. Additionally, let's update the card->mmc_avail_type to avoid
|
||||||
|
us from trying a broken HS200 mode again.
|
||||||
|
|
||||||
|
In an Amlogic S905W based TV box where the switch to HS200 mode fails for
|
||||||
|
the eMMC, this allows us to use the eMMC in DDR mode in favor of the legacy
|
||||||
|
mode, which greatly improves the performance.
|
||||||
|
|
||||||
|
Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||||
|
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
|
||||||
|
Tested-by: Heiner Kallweit <hkallweit1@gmail.com>
|
||||||
|
Link: https://lore.kernel.org/r/20220303164522.129583-1-ulf.hansson@linaro.org
|
||||||
|
---
|
||||||
|
drivers/mmc/core/mmc.c | 16 +++++++++++++---
|
||||||
|
1 file changed, 13 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/mmc/core/mmc.c
|
||||||
|
+++ b/drivers/mmc/core/mmc.c
|
||||||
|
@@ -1523,13 +1523,23 @@ static int mmc_select_timing(struct mmc_card *card)
|
||||||
|
if (!mmc_can_ext_csd(card))
|
||||||
|
goto bus_speed;
|
||||||
|
|
||||||
|
- if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES)
|
||||||
|
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES) {
|
||||||
|
err = mmc_select_hs400es(card);
|
||||||
|
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200) {
|
||||||
|
err = mmc_select_hs200(card);
|
||||||
|
- else if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
|
||||||
|
+ if (err == -EBADMSG)
|
||||||
|
+ card->mmc_avail_type &= ~EXT_CSD_CARD_TYPE_HS200;
|
||||||
|
+ else
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS)
|
||||||
|
err = mmc_select_hs(card);
|
||||||
|
|
||||||
|
+out:
|
||||||
|
if (err && err != -EBADMSG)
|
||||||
|
return err;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -15,15 +15,15 @@ Signed-off-by: Furkan Kardame <f.kardame@manjaro.org>
|
|||||||
|
|
||||||
--- a/drivers/net/phy/motorcomm.c
|
--- a/drivers/net/phy/motorcomm.c
|
||||||
+++ b/drivers/net/phy/motorcomm.c
|
+++ b/drivers/net/phy/motorcomm.c
|
||||||
@@ -10,6 +10,7 @@
|
@@ -13,6 +13,7 @@
|
||||||
#include <linux/phy.h>
|
|
||||||
|
|
||||||
#define PHY_ID_YT8511 0x0000010a
|
#define PHY_ID_YT8511 0x0000010a
|
||||||
|
#define PHY_ID_YT8521 0x0000011A
|
||||||
+#define PHY_ID_YT8531 0x4f51e91b
|
+#define PHY_ID_YT8531 0x4f51e91b
|
||||||
|
|
||||||
#define YT8511_PAGE_SELECT 0x1e
|
/* YT8521 Register Overview
|
||||||
#define YT8511_PAGE 0x1f
|
* UTP Register space | FIBER Register space
|
||||||
@@ -38,6 +39,38 @@
|
@@ -129,6 +130,38 @@
|
||||||
#define YT8511_DELAY_FE_TX_EN (0xf << 12)
|
#define YT8511_DELAY_FE_TX_EN (0xf << 12)
|
||||||
#define YT8511_DELAY_FE_TX_DIS (0x2 << 12)
|
#define YT8511_DELAY_FE_TX_DIS (0x2 << 12)
|
||||||
|
|
||||||
@ -59,11 +59,11 @@ Signed-off-by: Furkan Kardame <f.kardame@manjaro.org>
|
|||||||
+ */
|
+ */
|
||||||
+#define YT8531_CLKCFG_125M (BIT(6) | BIT(4) | (0x0 < 1))
|
+#define YT8531_CLKCFG_125M (BIT(6) | BIT(4) | (0x0 < 1))
|
||||||
+
|
+
|
||||||
static int yt8511_read_page(struct phy_device *phydev)
|
/* Extended register is different from MMD Register and MII Register.
|
||||||
{
|
* We can use ytphy_read_ext/ytphy_write_ext/ytphy_modify_ext function to
|
||||||
return __phy_read(phydev, YT8511_PAGE_SELECT);
|
* operate extended register.
|
||||||
@@ -111,6 +144,51 @@ err_restore_page:
|
@@ -1723,6 +1756,51 @@ err_restore_page:
|
||||||
return phy_restore_page(phydev, oldpage, ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
+static int yt8531_config_init(struct phy_device *phydev)
|
+static int yt8531_config_init(struct phy_device *phydev)
|
||||||
@ -114,10 +114,10 @@ Signed-off-by: Furkan Kardame <f.kardame@manjaro.org>
|
|||||||
static struct phy_driver motorcomm_phy_drvs[] = {
|
static struct phy_driver motorcomm_phy_drvs[] = {
|
||||||
{
|
{
|
||||||
PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
|
PHY_ID_MATCH_EXACT(PHY_ID_YT8511),
|
||||||
@@ -120,7 +198,16 @@ static struct phy_driver motorcomm_phy_d
|
@@ -1749,7 +1827,16 @@ static struct phy_driver motorcomm_phy_d
|
||||||
.resume = genphy_resume,
|
.soft_reset = yt8521_soft_reset,
|
||||||
.read_page = yt8511_read_page,
|
.suspend = yt8521_suspend,
|
||||||
.write_page = yt8511_write_page,
|
.resume = yt8521_resume,
|
||||||
+ }, {
|
+ }, {
|
||||||
+ PHY_ID_MATCH_EXACT(PHY_ID_YT8531),
|
+ PHY_ID_MATCH_EXACT(PHY_ID_YT8531),
|
||||||
+ .name = "YT8531 Gigabit Ethernet",
|
+ .name = "YT8531 Gigabit Ethernet",
|
||||||
@ -131,10 +131,10 @@ Signed-off-by: Furkan Kardame <f.kardame@manjaro.org>
|
|||||||
};
|
};
|
||||||
|
|
||||||
module_phy_driver(motorcomm_phy_drvs);
|
module_phy_driver(motorcomm_phy_drvs);
|
||||||
@@ -131,6 +218,7 @@ MODULE_LICENSE("GPL");
|
@@ -1762,6 +1849,7 @@ MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
|
static const struct mdio_device_id __maybe_unused motorcomm_tbl[] = {
|
||||||
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
|
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8511) },
|
||||||
|
{ PHY_ID_MATCH_EXACT(PHY_ID_YT8521) },
|
||||||
+ { PHY_ID_MATCH_EXACT(PHY_ID_YT8531) },
|
+ { PHY_ID_MATCH_EXACT(PHY_ID_YT8531) },
|
||||||
{ /* sentinal */ }
|
{ /* sentinal */ }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user