Add support for eMMC PHY on Intel Thunder Bay
Subsystems (5)
cover Add support for eMMC PHY on Intel Thunder Bay
From: Rashmi A <[email protected]>
This patch set enables the support for eMMC PHY on the Intel Thunder Bay SoC.
Patch 1 Holds the relevant Device Tree bindings documentation
and listings of new files in MAINTAINERS file
Patch 2 Adds support for eMMC Intel Thunder Bay Patch 3 Adds Thunder Bay eMMC PHY support
The review comments from Adrian Hunter, Kris Pan, Furong Zhou and Mark Gross have been incorporated.
Please help to review this patch set
Thanks
Rashmi A (3):
dt-bindings: phy: intel: Add Thunder Bay eMMC PHY bindings
mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan
eMMC driver
phy: intel: Add Thunder Bay eMMC PHY support
.../phy/intel,phy-thunderbay-emmc.yaml | 49 ++ MAINTAINERS | 7 + drivers/mmc/host/sdhci-of-arasan.c | 29 +- drivers/phy/intel/Kconfig | 10 + drivers/phy/intel/Makefile | 1 + drivers/phy/intel/phy-intel-thunderbay-emmc.c | 500 ++++++++++++++++++ 6 files changed, 595 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/phy/intel,phy-thunderbay-emmc.yaml create mode 100644 drivers/phy/intel/phy-intel-thunderbay-emmc.c
Signature · 1 line
2.17.1
PATCH 1/3 dt-bindings: phy: intel: Add Thunder Bay eMMC PHY bindings
From: Rashmi A <[email protected]>
Binding description for Intel Thunder Bay eMMC PHY. Added the newly introduced files into MAINTAINERS file-list
--- .../phy/intel,phy-thunderbay-emmc.yaml | 49 +++++++++++++++++++ MAINTAINERS | 7 +++ 2 files changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/intel,phy-thunderbay-emmc.yaml
Documentation/devicetree/bindings/phy/intel,phy-thunderbay-emmc.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/intel,phy-thunderbay-emmc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel Thunder Bay eMMC PHY bindings + +maintainers: + - Srikandan Nandhini <[email protected]> + +properties: + compatible: + oneOf: + - const: intel,thunderbay-emmc-phy + - const: intel,thunderbay-sdhci-5.1 + - const: intel,thunderbay-sd-phy + + "#phy-cells": + const: 0 + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: emmcclk + +required: + - "#phy-cells" + - compatible + - reg + - clocks + +additionalProperties: false + +examples: + - | + mmc_phy@80440800 { + #phy-cells = <0x0>; + compatible = "intel,thunderbay-emmc-phy"; + status = "okay"; + reg = <0x80440800 0x100>; + clocks = <&emmc>; + clock-names = "emmcclk"; + };
MAINTAINERS +7 -0
@@ -9278,6 +9278,13 @@ F: drivers/crypto/keembay/keembay-ocs-hcu-core.c F: drivers/crypto/keembay/ocs-hcu.c F: drivers/crypto/keembay/ocs-hcu.h +INTEL THUNDER BAY EMMC PHY DRIVER +M: Nandhini Srikandan <[email protected]> +M: Rashmi A <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/phy/intel,phy-thunderbay-emmc.yaml +F: drivers/phy/intel/phy-intel-thunderbay-emmc.c + INTEL MANAGEMENT ENGINE (mei) M: Tomas Winkler <[email protected]> L: [email protected]
Signature · 1 line
2.17.1
PATCH 2/3 mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver
In reply to [email protected]From: Rashmi A <[email protected]>
Intel Thunder Bay SoC eMMC controller is based on Arasan eMMC 5.1 host controller IP
--- drivers/mmc/host/sdhci-of-arasan.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-of-arasan.c +28 -1
@@ -185,6 +185,13 @@ static const struct sdhci_arasan_soc_ctl_map intel_lgm_sdxc_soc_ctl_map = { .hiword_update = false, }; +static const struct sdhci_arasan_soc_ctl_map thunderbay_soc_ctl_map = { + .baseclkfreq = { .reg =0x0 , .width =8 , .shift =14 }, + .clockmultiplier = { .reg =0x4 , .width =8 , .shift =14 }, + .support64b = { .reg =0x4 , .width =1 , .shift =24 }, + .hiword_update = false, +}; +static const struct sdhci_arasan_soc_ctl_map intel_keembay_soc_ctl_map = { .baseclkfreq = { .reg =0x0 , .width =8 , .shift =14 }, .clockmultiplier = { .reg =0x4 , .width =8 , .shift =14 },
@@ -430,6 +437,15 @@ static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = { SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN, }; +static const struct sdhci_pltfm_data sdhci_arasan_thunderbay_pdata = { + .ops = &sdhci_arasan_cqe_ops, + .quirks =SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC , + .quirks2 =SDHCI_QUIRK2_PRESET_VALUE_BROKEN | +SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN | +SDHCI_QUIRK2_STOP_WITH_TC | +SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 , +}; +#ifdef CONFIG_PM_SLEEP /** * sdhci_arasan_suspend - Suspend method for the driver
@@ -1098,6 +1114,12 @@ static struct sdhci_arasan_of_data sdhci_arasan_generic_data = { .clk_ops = &arasan_clk_ops, }; +static const struct sdhci_arasan_of_data sdhci_arasan_thunderbay_data = { + .soc_ctl_map = &thunderbay_soc_ctl_map, + .pdata = &sdhci_arasan_thunderbay_pdata, + .clk_ops = &arasan_clk_ops, +}; +static const struct sdhci_pltfm_data sdhci_keembay_emmc_pdata = { .ops = &sdhci_arasan_cqe_ops, .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
@@ -1231,6 +1253,10 @@ static const struct of_device_id sdhci_arasan_of_match[] = { .compatible = "intel,keembay-sdhci-5.1-sdio", .data = &intel_keembay_sdio_data, }, + { + .compatible = "intel,thunderbay-sdhci-5.1", + .data = &sdhci_arasan_thunderbay_data, + },/* Generic compatible below here */ { .compatible = "arasan,sdhci-8.9a",
@@ -1582,7 +1608,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)if (of_device_is_compatible (np,"intel,keembay-sdhci-5.1-emmc" ) ||of_device_is_compatible (np,"intel,keembay-sdhci-5.1-sd" ) || -of_device_is_compatible (np,"intel,keembay-sdhci-5.1-sdio" )) { +of_device_is_compatible (np,"intel,keembay-sdhci-5.1-sdio" ) || +of_device_is_compatible (np,"intel,thunderbay-sdhci-5.1" )) {sdhci_arasan_update_clockmultiplier (host,0x0 );sdhci_arasan_update_support64b (host,0x0 );
Signature · 1 line
2.17.1
PATCH 3/3 phy: intel: Add Thunder Bay eMMC PHY support
In reply to [email protected]From: Rashmi A <[email protected]>
Add support for eMMC PHY on Intel Thunder Bay SoC, uses the Arasan eMMC phy
--- drivers/phy/intel/Kconfig | 10 + drivers/phy/intel/Makefile | 1 + drivers/phy/intel/phy-intel-thunderbay-emmc.c | 500 ++++++++++++++++++ 3 files changed, 511 insertions(+) create mode 100644 drivers/phy/intel/phy-intel-thunderbay-emmc.c
drivers/phy/intel/Kconfig +10 -0
@@ -46,3 +46,13 @@ config PHY_INTEL_LGM_EMMC select GENERIC_PHY help Enable this to support the Intel EMMC PHY + +config PHY_INTEL_THUNDERBAY_EMMC + tristate "Intel Thunder Bay eMMC PHY driver" + depends on OF && (ARCH_THUNDERBAY || COMPILE_TEST) + select GENERIC_PHY + help + This option enables support for Intel Thunder Bay SoC eMMC PHY. + + To compile this driver as a module, choose M here: the module + will be called phy-intel-thunderbay-emmc.ko.
drivers/phy/intel/Makefile +1 -0
@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PHY_INTEL_KEEMBAY_EMMC) += phy-intel-keembay-emmc.o +obj-$(CONFIG_PHY_INTEL_THUNDERBAY_EMMC) += phy-intel-thunderbay-emmc.o obj-$(CONFIG_PHY_INTEL_KEEMBAY_USB) += phy-intel-keembay-usb.o obj-$(CONFIG_PHY_INTEL_LGM_COMBO) += phy-intel-lgm-combo.o obj-$(CONFIG_PHY_INTEL_LGM_EMMC) += phy-intel-lgm-emmc.o
drivers/phy/intel/phy-intel-thunderbay-emmc.c new file +500 -0
500 lines not on this page · raw message
Signature · 1 line
2.17.1
Vinod Koul
maintainerRe: [PATCH 3/3] phy: intel: Add Thunder Bay eMMC PHY support
drivers/phy/intel/Kconfig config PHY_INTEL_LGM_EMMC · line 50
Quoted 10 lines · On 30-07-21, 12:03, [email protected] wrote:
drivers/phy/intel/Kconfig +2
-0@@ -46,3 +46,13 @@ config PHY_INTEL_LGM_EMMC select GENERIC_PHY help Enable this to support the Intel EMMC PHY + +config PHY_INTEL_THUNDERBAY_EMMC
Alphabetical sort please
Quoted 13 lines
drivers/phy/intel/Kconfig +8
-0+ tristate "Intel Thunder Bay eMMC PHY driver" + depends on OF && (ARCH_THUNDERBAY || COMPILE_TEST) + select GENERIC_PHY + help + This option enables support for Intel Thunder Bay SoC eMMC PHY. + + To compile this driver as a module, choose M here: the module + will be called phy-intel-thunderbay-emmc.ko.drivers/phy/intel/Makefile +0
-0
drivers/phy/intel/Makefile line 3
Quoted 3 lines
drivers/phy/intel/Makefile +1
-0@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PHY_INTEL_KEEMBAY_EMMC) += phy-intel-keembay-emmc.o +obj-$(CONFIG_PHY_INTEL_THUNDERBAY_EMMC) += phy-intel-thunderbay-emmc.o
here as well
Quoted 5 lines
drivers/phy/intel/Makefile +5
-0+static int thunderbay_emmc_phy_power(struct phy *phy, bool power_on) +{ + struct thunderbay_emmc_phy *tbh_phy = phy_get_drvdata(phy); + unsigned int freqsel = FREQSEL_200M_170M; + unsigned long rate;
drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ static int lock; + u32 val; + int ret; + + /* Disable DLL */ + rate = clk_get_rate(tbh_phy->emmcclk); + switch (rate) { + case 200000000: + /* lock dll only when it is used, i.e only if SEL_DLY_TXCLK/RXCLK are 0 */ + update_reg(tbh_phy, PHY_CFG_0, DLL_EN_MASK, DLL_EN_SHIFT, 0x0);
pls keep the same indent for comment and code!
drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ break; + /* dll lock not required for other frequencies */ + case 50000000 ... 52000000: + case 400000: + default: + break; + } + + if (!power_on) + return 0;
should this not be the first thing you check...
Quoted 24 lines
drivers/phy/intel/Makefile +24
-0+ + rate = clk_get_rate(tbh_phy->emmcclk); + switch (rate) { + case 170000001 ... 200000000: + freqsel = FREQSEL_200M_170M; + break; + case 140000001 ... 170000000: + freqsel = FREQSEL_170M_140M; + break; + case 110000001 ... 140000000: + freqsel = FREQSEL_140M_110M; + break; + case 80000001 ... 110000000: + freqsel = FREQSEL_110M_80M; + break; + case 50000000 ... 80000000: + freqsel = FREQSEL_80M_50M; + break; + case 250000001 ... 275000000: + freqsel = FREQSEL_275M_250M; + break; + case 225000001 ... 250000000: + freqsel = FREQSEL_250M_225M; + break;
drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ case 200000001 ... 225000000: + freqsel = FREQSEL_225M_200M; + break; + default: + break; + } + + if (rate > 200000000) + /* only the upper limit is considered as the clock rate may fall low during init */ + dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);
here as well! (checkpatch --strict should have told you so)
Quoted 14 lines
drivers/phy/intel/Makefile +14
-0+static int thunderbay_emmc_phy_power_on(struct phy *phy) +{ + struct thunderbay_emmc_phy *tbh_phy = phy_get_drvdata(phy); + unsigned long rate; + + /* Overwrite capability bits configurable in bootloader */ + update_reg(tbh_phy, CTRL_CFG_0, + SUPPORT_HS_MASK, SUPPORT_HS_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_0, + SUPPORT_8B_MASK, SUPPORT_8B_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_SDR50_MASK, SUPPORT_SDR50_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_DDR50_MASK, SUPPORT_DDR50_SHIFT, 0x1);
drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_SDR104_MASK, SUPPORT_SDR104_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_HS400_MASK, SUPPORT_HS400_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_64B_MASK, SUPPORT_64B_SHIFT, 0x1); + + if (tbh_phy->phy_power_sts == PHY_UNINITIALIZED) { + /* Indicates initialization, so settings to be done for init , same as 400KHZ setting */ + update_reg(tbh_phy, PHY_CFG_0, SEL_DLY_TXCLK_MASK, SEL_DLY_TXCLK_SHIFT, 0x1);
inconsistent indent here too!
Quoted 23 lines
drivers/phy/intel/Makefile +23
-0+ update_reg(tbh_phy, PHY_CFG_0, SEL_DLY_RXCLK_MASK, SEL_DLY_RXCLK_SHIFT, 0x1); + update_reg(tbh_phy, PHY_CFG_0, ITAP_DLY_ENA_MASK, ITAP_DLY_ENA_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0, ITAP_DLY_SEL_MASK, ITAP_DLY_SEL_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0, OTAP_DLY_ENA_MASK, OTAP_DLY_ENA_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0, OTAP_DLY_SEL_MASK, OTAP_DLY_SEL_SHIFT, 0); + update_reg(tbh_phy, PHY_CFG_0, DLL_TRIM_ICP_MASK, DLL_TRIM_ICP_SHIFT, 0); + update_reg(tbh_phy, PHY_CFG_0, DR_TY_MASK, DR_TY_SHIFT, 0x1); + + } else if (tbh_phy->phy_power_sts == PHY_INITIALIZED) { + /* Indicates actual clock setting */ + rate = clk_get_rate(tbh_phy->emmcclk); + switch (rate) { + case 200000000: + update_reg(tbh_phy, PHY_CFG_0, SEL_DLY_TXCLK_MASK, + SEL_DLY_TXCLK_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0, SEL_DLY_RXCLK_MASK, + SEL_DLY_RXCLK_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0, ITAP_DLY_ENA_MASK, + ITAP_DLY_ENA_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0, ITAP_DLY_SEL_MASK, + ITAP_DLY_SEL_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0, OTAP_DLY_ENA_MASK, + OTAP_DLY_ENA_SHIFT, 0x1);
drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ update_reg(tbh_phy, PHY_CFG_0, OTAP_DLY_SEL_MASK, + OTAP_DLY_SEL_SHIFT, 2); + update_reg(tbh_phy, PHY_CFG_0, DLL_TRIM_ICP_MASK, + DLL_TRIM_ICP_SHIFT, 0x8); + update_reg(tbh_phy, PHY_CFG_0, DR_TY_MASK, + DR_TY_SHIFT, 0x1); + /* For HS400 only */ + update_reg(tbh_phy, PHY_CFG_2, SEL_STRB_MASK, + SEL_STRB_SHIFT, STRB); + break;
pls give a empty line after break, helps to read the code
Signature · 1 line
~Vinod
Re: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver
In reply to [email protected]Quoted 8 lines · On Fri, 30 Jul 2021 at 08:33, <[email protected]> wrote:
From: Rashmi A <[email protected]>
Intel Thunder Bay SoC eMMC controller is based on Arasan eMMC 5.1 host controller IP
Signed-off-by Rashmi A <[email protected]>Reviewed-by Adrian Hunter <[email protected]>
Rashmi, is it safe to apply this separately from the phy driver/dt changes? Then I can queue this via my mmc tree, if you like.
Kind regards
Uffe
Quoted 75 lines
--- drivers/mmc/host/sdhci-of-arasan.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci-of-arasan.c +28
-2@@ -185,6 +185,13 @@ static const struct sdhci_arasan_soc_ctl_map intel_lgm_sdxc_soc_ctl_map = { .hiword_update = false, }; +static const struct sdhci_arasan_soc_ctl_map thunderbay_soc_ctl_map = { + .baseclkfreq = { .reg =0x0 , .width =8 , .shift =14 }, + .clockmultiplier = { .reg =0x4 , .width =8 , .shift =14 }, + .support64b = { .reg =0x4 , .width =1 , .shift =24 }, + .hiword_update = false, +}; +static const struct sdhci_arasan_soc_ctl_map intel_keembay_soc_ctl_map = { .baseclkfreq = { .reg =0x0 , .width =8 , .shift =14 }, .clockmultiplier = { .reg =0x4 , .width =8 , .shift =14 },@@ -430,6 +437,15 @@ static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = { SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN, }; +static const struct sdhci_pltfm_data sdhci_arasan_thunderbay_pdata = { + .ops = &sdhci_arasan_cqe_ops, + .quirks =SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC , + .quirks2 =SDHCI_QUIRK2_PRESET_VALUE_BROKEN | +SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN | +SDHCI_QUIRK2_STOP_WITH_TC | +SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 , +}; +#ifdef CONFIG_PM_SLEEP /** * sdhci_arasan_suspend - Suspend method for the driver @@ -1098,6 +1114,12 @@ static struct sdhci_arasan_of_data sdhci_arasan_generic_data = { .clk_ops = &arasan_clk_ops, }; +static const struct sdhci_arasan_of_data sdhci_arasan_thunderbay_data = { + .soc_ctl_map = &thunderbay_soc_ctl_map, + .pdata = &sdhci_arasan_thunderbay_pdata, + .clk_ops = &arasan_clk_ops, +}; +static const struct sdhci_pltfm_data sdhci_keembay_emmc_pdata = { .ops = &sdhci_arasan_cqe_ops, .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |@@ -1231,6 +1253,10 @@ static const struct of_device_id sdhci_arasan_of_match[] = { .compatible = "intel,keembay-sdhci-5.1-sdio", .data = &intel_keembay_sdio_data, }, + { + .compatible = "intel,thunderbay-sdhci-5.1", + .data = &sdhci_arasan_thunderbay_data, + },/* Generic compatible below here */ { .compatible = "arasan,sdhci-8.9a",@@ -1582,7 +1608,8 @@ static int sdhci_arasan_probe(struct platform_device *pdev)if (of_device_is_compatible (np,"intel,keembay-sdhci-5.1-emmc" ) ||of_device_is_compatible (np,"intel,keembay-sdhci-5.1-sd" ) || -of_device_is_compatible (np,"intel,keembay-sdhci-5.1-sdio" )) { +of_device_is_compatible (np,"intel,keembay-sdhci-5.1-sdio" ) || +of_device_is_compatible (np,"intel,thunderbay-sdhci-5.1" )) {sdhci_arasan_update_clockmultiplier (host,0x0 );sdhci_arasan_update_support64b (host,0x0 ); --2.17.1
RE: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver
Quoted 26 lines
-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Friday, August 6, 2021 6:36 PM
To: A, Rashmi <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; linux-mmc <[email protected]>; Linux ARM <[email protected]>; Linux Kernel Mailing List <linux- [email protected]>; Kishon <[email protected]>; Vinod Koul <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; Mark Gross <[email protected]>; [email protected]; Zhou, Furong <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; Hunter, Adrian <[email protected]>; Vaidya, Mahesh R <[email protected]>; Srikandan, Nandhini <[email protected]>; Demakkanavar, Kenchappa <[email protected]>
Subject: Re: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driverQuoted 3 lines · On Fri, 30 Jul 2021 at 08:33, <[email protected]> wrote:
From: Rashmi A <[email protected]>
Quoted 8 lines
Quoted 5 lines
Intel Thunder Bay SoC eMMC controller is based on Arasan eMMC 5.1 host controller IP
Signed-off-by Rashmi A <[email protected]>Reviewed-by Adrian Hunter <[email protected]>Rashmi, is it safe to apply this separately from the phy driver/dt changes? Then I can queue this via my mmc tree, if you like.
No, the phy driver/dt changes must go together with "mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver" patch.
Regards
Rashmi
Quoted 88 lines
Kind regards
UffeQuoted 2 lines
--- drivers/mmc/host/sdhci-of-arasan.c | 29++++++++++++++++++++++++++++-
drivers/mmc/host/sdhci-of-arasan.c static const struct sdhci_arasan_soc_ctl_map
Quoted 8 lines
1 file changed, 28 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci-of-arasan.c +0
-0@@ -185,6 +185,13 @@ static const struct sdhci_arasan_soc_ctl_map
intel_lgm_sdxc_soc_ctl_map= {drivers/mmc/host/sdhci-of-arasan.c static const struct sdhci_arasan_soc_ctl_map intel_lgm_sdxc_soc_ctl_map = {
Quoted 11 lines
drivers/mmc/host/sdhci-of-arasan.c +7
-0.hiword_update = false, }; +static const struct sdhci_arasan_soc_ctl_map thunderbay_soc_ctl_map = { + .baseclkfreq = { .reg =0x0 , .width =8 , .shift =14 }, + .clockmultiplier = { .reg =0x4 , .width =8 , .shift =14 }, + .support64b = { .reg =0x4 , .width =1 , .shift =24 }, + .hiword_update = false, +}; +static const struct sdhci_arasan_soc_ctl_map intel_keembay_soc_ctl_map= {
drivers/mmc/host/sdhci-of-arasan.c static const struct sdhci_arasan_soc_ctl_map
Quoted 3 lines
drivers/mmc/host/sdhci-of-arasan.c +0
-1.baseclkfreq = { .reg = 0x0, .width = 8, .shift = 14 }, .clockmultiplier = { .reg = 0x4, .width = 8, .shift = 14 }, @@ -430,6 +437,15 @@ static const struct sdhci_pltfm_data
sdhci_arasan_cqe_pdata= {drivers/mmc/host/sdhci-of-arasan.c static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = {
Quoted 6 lines
SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN,
};drivers/mmc/host/sdhci-of-arasan.c +3
-0+static const struct sdhci_pltfm_data sdhci_arasan_thunderbay_pdata = { + .ops = &sdhci_arasan_cqe_ops, + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN |
SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC,drivers/mmc/host/sdhci-of-arasan.c static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = {
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +7
-0+ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | +SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN | +SDHCI_QUIRK2_STOP_WITH_TC | + SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400, +}; +#ifdef CONFIG_PM_SLEEP /** * sdhci_arasan_suspend - Suspend method for the driver @@ -1098,6 +1114,12 @@ static struct sdhci_arasan_of_data
sdhci_arasan_generic_data= {Quoted 4 lines
.clk_ops = &arasan_clk_ops,};
+static const struct
sdhci_arasan_of_datasdhci_arasan_thunderbay_data={
Quoted 33 lines
drivers/mmc/host/sdhci-of-arasan.c +10
-0+ .soc_ctl_map = &thunderbay_soc_ctl_map, + .pdata = &sdhci_arasan_thunderbay_pdata, + .clk_ops = &arasan_clk_ops, +}; +static const struct sdhci_pltfm_data sdhci_keembay_emmc_pdata = { .ops = &sdhci_arasan_cqe_ops, .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | @@ -1231,6 +1253,10 @@ static const struct of_device_id sdhci_arasan_of_match[] = { .compatible ="intel,keembay-sdhci-5.1-sdio" , .data = &intel_keembay_sdio_data, }, + { + .compatible ="intel,thunderbay-sdhci-5.1" , + .data = &sdhci_arasan_thunderbay_data, + },/* Generic compatible below here */ { .compatible = "arasan,sdhci-8.9a", @@ -1582,7 +1608,8@@ static int
sdhci_arasan_probe(struct platform_device *pdev)if (of_device_is_compatible(np, "intel,keembay-sdhci-5.1-emmc") || of_device_is_compatible(np, "intel,keembay-sdhci-5.1-sd") ||drivers/mmc/host/sdhci-of-arasan.c +3
-2- of_device_is_compatible(np, "intel,keembay-sdhci-5.1-sdio")) { + of_device_is_compatible(np, "intel,keembay-sdhci-5.1-sdio") || + of_device_is_compatible(np, "intel,thunderbay-sdhci-5.1")) + {sdhci_arasan_update_clockmultiplier (host,0x0 );sdhci_arasan_update_support64b (host,0x0 ); --2.17.1
Vinod Koul
maintainerRe: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver
Quoted 4 lines · Rashmi
Quoted 3 lines
Rashmi, is it safe to apply this separately from the phy driver/dt changes? Then I can queue this via my mmc tree, if you like.
No, the phy driver/dt changes must go together with "mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver" patch.
Why is that?
What could happen, emmc driver will complain about phy not found and bail right?
Signature · 1 line
~Vinod
RE: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver
Quoted 26 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Monday, August 9, 2021 2:12 PM
To: A, Rashmi <[email protected]>
Cc: Ulf Hansson <[email protected]>; Michal Simek <[email protected]>; linux-mmc <[email protected]>; Linux ARM <[email protected]>; Linux Kernel Mailing List <linux- [email protected]>; Kishon <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; Mark Gross <[email protected]>; [email protected]; Zhou, Furong <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; Hunter, Adrian <[email protected]>; Vaidya, Mahesh R <[email protected]>; Srikandan, Nandhini <[email protected]>; Demakkanavar, Kenchappa <[email protected]>
Subject: Re: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driverQuoted 3 lines · Rashmi
Quoted 3 lines
Rashmi, is it safe to apply this separately from the phy driver/dt changes? Then I can queue this via my mmc tree, if you like.
Quoted 8 lines
Quoted 1 line
No, the phy driver/dt changes must go together with "mmc: sdhci-of-
arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver" patch.
Why is that?
What could happen, emmc driver will complain about phy not found and bail right?
This is right, but ideally both mmc:phy and mmc: sdhci-of-arasan driver code changes should go together
Quoted 3 lines
--
~Vinod
Re: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver
Quoted 28 lines · Rashmi
Quoted 28 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Monday, August 9, 2021 2:12 PM
To: A, Rashmi <[email protected]>
Cc: Ulf Hansson <[email protected]>; Michal Simek <[email protected]>; linux-mmc <[email protected]>; Linux ARM <[email protected]>; Linux Kernel Mailing List <linux- [email protected]>; Kishon <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; Mark Gross <[email protected]>; [email protected]; Zhou, Furong <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; Hunter, Adrian <[email protected]>; Vaidya, Mahesh R <[email protected]>; Srikandan, Nandhini <[email protected]>; Demakkanavar, Kenchappa <[email protected]>
Subject: Re: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driverQuoted 4 lines · Rashmi
Quoted 3 lines
Rashmi, is it safe to apply this separately from the phy driver/dt changes? Then I can queue this via my mmc tree, if you like.
No, the phy driver/dt changes must go together with "mmc: sdhci-of-
Quoted 8 lines
Quoted 7 lines
arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver" patch.
Why is that?
What could happen, emmc driver will complain about phy not found and bail right?
This is right, but ideally both mmc:phy and mmc: sdhci-of-arasan driver code changes should go together
If patches are well written and can be standalone, we (maintainers) ideally prefer to queue things on a per subsystem basis, because it's just easier.
That said, I also noticed that a new compatible string was added, "intel,thunderbay-sdhci-5.1". This needs to be documented in Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml, in a separate patch, preceding $subject patch.
Kind regards
Uffe
RE: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver
Quoted 63 lines
-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Monday, August 9, 2021 5:43 PM
To: A, Rashmi <[email protected]>
Cc: Vinod Koul <[email protected]>; Michal Simek <[email protected]>; linux-mmc <[email protected]>; Linux ARM <[email protected]>; Linux Kernel Mailing List <linux- [email protected]>; Kishon <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; Mark Gross <[email protected]>; [email protected]; Zhou, Furong <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; Hunter, Adrian <[email protected]>; Vaidya, Mahesh R <[email protected]>; Srikandan, Nandhini <[email protected]>; Demakkanavar, Kenchappa <[email protected]>
Subject: Re: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driverQuoted 23 lines · Rashmi
Quoted 23 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Monday, August 9, 2021 2:12 PM
To: A, Rashmi <[email protected]>
Cc: Ulf Hansson <[email protected]>; Michal Simek <[email protected]>; linux-mmc <[email protected]>; Linux ARM <[email protected]>; Linux Kernel Mailing List <linux- [email protected]>; Kishon <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; Mark Gross <[email protected]>; [email protected]; Zhou, Furong <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; Hunter, Adrian <[email protected]>; Vaidya, Mahesh R <[email protected]>; Srikandan, Nandhini <[email protected]>; Demakkanavar, Kenchappa <[email protected]>
Subject: Re: [PATCH 2/3] mmc: sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driverQuoted 4 lines
Quoted 4 lines · Rashmi
Quoted 3 lines
Quoted 3 lines
Rashmi, is it safe to apply this separately from the phy driver/dt
changes?
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Then I can queue this via my mmc tree, if you like.
No, the phy driver/dt changes must go together with "mmc:
sdhci-of-arasan: Add intel Thunder Bay SOC support to the arasan eMMC driver" patch.
Quoted 6 lines
Quoted 4 lines
Why is that?
What could happen, emmc driver will complain about phy not found and bail right?
This is right, but ideally both mmc:phy and mmc: sdhci-of-arasan driver code changes should go together
Quoted 8 lines
If patches are well written and can be standalone, we (maintainers) ideally prefer to queue things on a per subsystem basis, because it's just easier.
That said, I also noticed that a new compatible string was added, "intel,thunderbay-sdhci-5.1". This needs to be documented in
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml, in a separate patch, preceding $subject patch.
I acknowledge your comments. I will submit a separate patch to document device tree bindings. After that mmc: sdhci-of-arasan driver patch could be queued.
Regards
Rashmi
RE: [PATCH 3/3] phy: intel: Add Thunder Bay eMMC PHY support
In reply to Vinod KoulQuoted 50 lines
-----Original Message-----
From: Vinod Koul <[email protected]>
Sent: Friday, August 6, 2021 6:09 PM
To: A, Rashmi <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Zhou, Furong <[email protected]>; Sangannavar, Mallikarjunappa <[email protected]>; Hunter, Adrian <[email protected]>; Vaidya, Mahesh R <[email protected]>; Srikandan, Nandhini <[email protected]>; Demakkanavar, Kenchappa <[email protected]>
Subject: Re: [PATCH 3/3] phy: intel: Add Thunder Bay eMMC PHY supportdrivers/phy/intel/Kconfig config PHY_INTEL_LGM_EMMC · line 50
Quoted 10 lines · On 30-07-21, 12:03, [email protected] wrote:
drivers/phy/intel/Kconfig +2
-0@@ -46,3 +46,13 @@ config PHY_INTEL_LGM_EMMC select GENERIC_PHY help Enable this to support the Intel EMMC PHY + +config PHY_INTEL_THUNDERBAY_EMMCAlphabetical sort please
Quoted 13 lines
drivers/phy/intel/Kconfig +8
-0+ tristate "Intel Thunder Bay eMMC PHY driver" + depends on OF && (ARCH_THUNDERBAY || COMPILE_TEST) + select GENERIC_PHY + help + This option enables support for Intel Thunder Bay SoC eMMC PHY. + + To compile this driver as a module, choose M here: the module + will be called phy-intel-thunderbay-emmc.ko.drivers/phy/intel/Makefile +0
-0drivers/phy/intel/Makefile line 2
Quoted 2 lines
drivers/phy/intel/Makefile +0
-0@@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PHY_INTEL_KEEMBAY_EMMC) += phy-intel-keembay-emmc.o
Quoted 4 lines
drivers/phy/intel/Makefile line 3
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+obj-$(CONFIG_PHY_INTEL_THUNDERBAY_EMMC) += phy-intel-thunderbay-emmc.o
here as well
I will reorder the entry in Makefile. The Kconfig entries are in alphabetical order. Let me know if I am missing something.
-Rashmi
Quoted 16 lines
Quoted 5 lines
drivers/phy/intel/Makefile +4
-0+static int thunderbay_emmc_phy_power(struct phy *phy, bool power_on) +{ + struct thunderbay_emmc_phy *tbh_phy = phy_get_drvdata(phy); + unsigned int freqsel = FREQSEL_200M_170M;drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ unsigned long rate; + static int lock; + u32 val; + int ret; + + /* Disable DLL */ + rate = clk_get_rate(tbh_phy->emmcclk); + switch (rate) { + case 200000000: + /* lock dll only when it is used, i.e only if SEL_DLY_TXCLK/RXCLK are 0*/
Quoted 4 lines
drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, DLL_EN_MASK,
DLL_EN_SHIFT,0x0);pls keep the same indent for comment and code!
Acknowledged
-Rashmi
Quoted 13 lines
drivers/phy/intel/Makefile
Quoted 11 lines
drivers/phy/intel/Makefile +10
-0+ break; + /* dll lock not required for other frequencies */ + case 50000000 ... 52000000: + case 400000: + default: + break; + } + + if (!power_on) + return 0;should this not be the first thing you check...
During phy power on/off condition, dll should be disabled first. So power_on check is made after disabling dll.
-Rashmi
Quoted 35 lines
Quoted 24 lines
drivers/phy/intel/Makefile +23
-0+ + rate = clk_get_rate(tbh_phy->emmcclk); + switch (rate) { + case 170000001 ... 200000000: + freqsel = FREQSEL_200M_170M; + break; + case 140000001 ... 170000000: + freqsel = FREQSEL_170M_140M; + break; + case 110000001 ... 140000000: + freqsel = FREQSEL_140M_110M; + break; + case 80000001 ... 110000000: + freqsel = FREQSEL_110M_80M; + break; + case 50000000 ... 80000000: + freqsel = FREQSEL_80M_50M; + break; + case 250000001 ... 275000000: + freqsel = FREQSEL_275M_250M; + break; + case 225000001 ... 250000000: + freqsel = FREQSEL_250M_225M;drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ break; + case 200000001 ... 225000000: + freqsel = FREQSEL_225M_200M; + break; + default: + break; + } + + if (rate > 200000000) + /* only the upper limit is considered as the clock rate may fall lowduring init */
Quoted 3 lines
drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate);here as well! (checkpatch --strict should have told you so)
I will follow the proper alignment, though check-patch script didn't show any warnings.
-Rashmi
Quoted 69 lines
Quoted 13 lines
drivers/phy/intel/Makefile +12
-0+static int thunderbay_emmc_phy_power_on(struct phy *phy) { + struct thunderbay_emmc_phy *tbh_phy = phy_get_drvdata(phy); + unsigned long rate; + + /* Overwrite capability bits configurable in bootloader */ + update_reg(tbh_phy, CTRL_CFG_0, + SUPPORT_HS_MASK, SUPPORT_HS_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_0, + SUPPORT_8B_MASK, SUPPORT_8B_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_SDR50_MASK, SUPPORT_SDR50_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1,drivers/phy/intel/Makefile
Quoted 10 lines
drivers/phy/intel/Makefile +10
-0+ SUPPORT_DDR50_MASK, SUPPORT_DDR50_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_SDR104_MASK, SUPPORT_SDR104_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_HS400_MASK, SUPPORT_HS400_SHIFT, 0x1); + update_reg(tbh_phy, CTRL_CFG_1, + SUPPORT_64B_MASK, SUPPORT_64B_SHIFT, 0x1); + + if (tbh_phy->phy_power_sts == PHY_UNINITIALIZED) { + /* Indicates initialization, so settings to be done for init , same as400KHZ setting */
drivers/phy/intel/Makefile
Quoted 2 lines
drivers/phy/intel/Makefile +2
-0+ update_reg(tbh_phy, PHY_CFG_0, SEL_DLY_TXCLK_MASK, +SEL_DLY_TXCLK_SHIFT, 0x1);inconsistent indent here too!
drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, SEL_DLY_RXCLK_MASK,
SEL_DLY_RXCLK_SHIFT,0x1);drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, ITAP_DLY_ENA_MASK,
ITAP_DLY_ENA_SHIFT,0x0);drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, ITAP_DLY_SEL_MASK,
ITAP_DLY_SEL_SHIFT,0x0);drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, OTAP_DLY_ENA_MASK,
OTAP_DLY_ENA_SHIFT,0x0);drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, OTAP_DLY_SEL_MASK,
OTAP_DLY_SEL_SHIFT, 0);drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, DLL_TRIM_ICP_MASK,
DLL_TRIM_ICP_SHIFT, 0);drivers/phy/intel/Makefile
Quoted 1 line
drivers/phy/intel/Makefile +1
-0+ update_reg(tbh_phy, PHY_CFG_0, DR_TY_MASK,
DR_TY_SHIFT,0x1);drivers/phy/intel/Makefile
Quoted 7 lines
drivers/phy/intel/Makefile +7
-0+ + } else if (tbh_phy->phy_power_sts == PHY_INITIALIZED) { + /* Indicates actual clock setting */ + rate = clk_get_rate(tbh_phy->emmcclk); + switch (rate) { + case 200000000: + update_reg(tbh_phy, PHY_CFG_0,
SEL_DLY_TXCLK_MASK,drivers/phy/intel/Makefile
Quoted 2 lines
drivers/phy/intel/Makefile +2
-0+ SEL_DLY_TXCLK_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0,
SEL_DLY_RXCLK_MASK,drivers/phy/intel/Makefile
Quoted 2 lines
drivers/phy/intel/Makefile +2
-0+ SEL_DLY_RXCLK_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0,
ITAP_DLY_ENA_MASK,drivers/phy/intel/Makefile
Quoted 2 lines
drivers/phy/intel/Makefile +2
-0+ ITAP_DLY_ENA_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0,
ITAP_DLY_SEL_MASK,drivers/phy/intel/Makefile
Quoted 2 lines
drivers/phy/intel/Makefile +2
-0+ ITAP_DLY_SEL_SHIFT, 0x0); + update_reg(tbh_phy, PHY_CFG_0,
OTAP_DLY_ENA_MASK,drivers/phy/intel/Makefile
Quoted 2 lines
drivers/phy/intel/Makefile +2
-0+ OTAP_DLY_ENA_SHIFT, 0x1); + update_reg(tbh_phy, PHY_CFG_0,
OTAP_DLY_SEL_MASK,drivers/phy/intel/Makefile
Quoted 2 lines
drivers/phy/intel/Makefile +2
-0+ OTAP_DLY_SEL_SHIFT, 2); + update_reg(tbh_phy, PHY_CFG_0,
DLL_TRIM_ICP_MASK,
Quoted 9 lines
drivers/phy/intel/Makefile
Quoted 7 lines
drivers/phy/intel/Makefile +7
-0+ DLL_TRIM_ICP_SHIFT, 0x8); + update_reg(tbh_phy, PHY_CFG_0, DR_TY_MASK, + DR_TY_SHIFT, 0x1); + /* For HS400 only */ + update_reg(tbh_phy, PHY_CFG_2, SEL_STRB_MASK, + SEL_STRB_SHIFT, STRB); + break;pls give a empty line after break, helps to read the code
Acknowledged
-Rashmi