Skip to content

Commit

Permalink
Merge tag 'mmc-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/ulfh/mmc

Pull MMC updates from Ulf Hansson:
 "MMC core:
   - Allow an invalid regulator in mmc_regulator_set_ocr()
   - Log about empty non-removable slots
   - Add helpers to enable/disable the vqmmc regulator

  MMC host:
   - mtk-sd: Add support for the mt8365 variant
   - renesas_sdhi: Remove support for R-Car H3 ES1.* variants
   - sdhci_am654: Add power management support
   - sdhci-cadence: Add support for eMMC hardware reset
   - sdhci-cadence: Add support for AMD Pensando Elba variant
   - sdhci-msm: Add support for the IPQ5018 variant
   - sdhci-msm: Add support for the QCM2290 variant
   - sdhci-of-arasan: Skip setting clock delay for 400KHz
   - sdhci-of-arasan: Add support for the Xilinx Versal Net variant
   - sdhci-of-arasan: Remove Intel Thunder Bay SOC support
   - sdhci-of-arasan: Add support to request the "gate" clock
   - sdhci-of-dwcmshc: Properly determine max clock on Rockchip
   - sdhci-of-esdhc: Fix quirk to ignore command inhibit for data
   - sdhci-pci-o2micro: Fix SDR50 mode timing issue

  MEMSTICK:
   - r592: Fix use-after-free bug in r592_remove due to race condition"

* tag 'mmc-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (40 commits)
  dt-bindings: mmc: sdhci-msm: Document the IPQ5018 compatible
  mmc: vub300: remove unreachable code
  mmc: sdhci-cadence: Support mmc hardware reset
  mmc: sdhci-cadence: Add AMD Pensando Elba SoC support
  mmc: sdhci-cadence: Support device specific init during probe
  mmc: sdhci-cadence: Enable device specific override of writel()
  dt-bindings: mmc: cdns: Add AMD Pensando Elba SoC
  mmc: core: Remove unused macro mmc_req_rel_wr
  mmc: sdhci-of-arasan: Skip setting clock delay for 400KHz
  mmc: sdhci-of-arasan: Add support for eMMC5.1 on Xilinx Versal Net platform
  dt-bindings: mmc: arasan,sdci: Add Xilinx Versal Net compatible
  mmc: sdhci_am654: Add support for PM suspend/resume
  mmc: core: remove unnecessary (void*) conversions
  dt-bindings: mmc: fsl-imx-esdhc: ref sdhci-common.yaml
  mmc: sdhci-of-esdhc: fix quirk to ignore command inhibit for data
  mmc: core: Log about empty non-removable slots
  dt-bindings: mmc: fujitsu: Add Socionext Synquacer
  mmc: sdricoh_cs: remove unused sdricoh_readw function
  dt-bindings: mmc: Remove bindings for Intel Thunder Bay SoC"
  mmc: sdhci-of-arasan: Remove Intel Thunder Bay SOC support
  ...
  • Loading branch information
torvalds committed Apr 26, 2023
2 parents eb8322d + 22a4455 commit c5c06e2
Show file tree
Hide file tree
Showing 38 changed files with 711 additions and 205 deletions.
30 changes: 5 additions & 25 deletions Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ allOf:
enum:
- xlnx,zynqmp-8.9a
- xlnx,versal-8.9a
- xlnx,versal-net-emmc
then:
properties:
clock-output-names:
Expand Down Expand Up @@ -62,6 +63,10 @@ properties:
description:
For this device it is strongly suggested to include
clock-output-names and '#clock-cells'.
- const: xlnx,versal-net-emmc # Versal Net eMMC PHY
description:
For this device it is strongly suggested to include
clock-output-names and '#clock-cells'.
- items:
- const: intel,lgm-sdhci-5.1-emmc # Intel LGM eMMC PHY
- const: arasan,sdhci-5.1
Expand All @@ -88,12 +93,6 @@ properties:
description:
For this device it is strongly suggested to include
arasan,soc-ctl-syscon.
- items:
- const: intel,thunderbay-sdhci-5.1 # Intel Thunder Bay eMMC PHY
- const: arasan,sdhci-5.1
description:
For this device it is strongly suggested to include
clock-output-names and '#clock-cells'.

reg:
maxItems: 1
Expand Down Expand Up @@ -309,22 +308,3 @@ examples:
<&scmi_clk KEEM_BAY_PSS_SD0>;
arasan,soc-ctl-syscon = <&sd0_phy_syscon>;
};
- |
#define EMMC_XIN_CLK
#define EMMC_AXI_CLK
#define TBH_PSS_EMMC_RST_N
mmc@80420000 {
compatible = "intel,thunderbay-sdhci-5.1", "arasan,sdhci-5.1";
interrupts = <GIC_SPI 714 IRQ_TYPE_LEVEL_HIGH>;
reg = <0x80420000 0x400>;
clocks = <&scmi_clk EMMC_XIN_CLK>,
<&scmi_clk EMMC_AXI_CLK>;
clock-names = "clk_xin", "clk_ahb";
phys = <&emmc_phy>;
phy-names = "phy_arasan";
assigned-clocks = <&scmi_clk EMMC_XIN_CLK>;
clock-output-names = "emmc_cardclock";
resets = <&rst_pss1 TBH_PSS_EMMC_RST_N>;
#clock-cells = <0x0>;
};
27 changes: 23 additions & 4 deletions Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@ title: Cadence SD/SDIO/eMMC Host Controller (SD4HC)
maintainers:
- Masahiro Yamada <[email protected]>

allOf:
- $ref: mmc-controller.yaml

properties:
compatible:
items:
- enum:
- amd,pensando-elba-sd4hc
- microchip,mpfs-sd4hc
- socionext,uniphier-sd4hc
- const: cdns,sd4hc

reg:
maxItems: 1
minItems: 1
maxItems: 2

interrupts:
maxItems: 1
Expand Down Expand Up @@ -120,6 +119,26 @@ required:
- interrupts
- clocks

allOf:
- $ref: mmc-controller.yaml
- if:
properties:
compatible:
contains:
const: amd,pensando-elba-sd4hc
then:
properties:
reg:
items:
- description: Host controller registers
- description: Elba byte-lane enable register for writes
required:
- resets
else:
properties:
reg:
maxItems: 1

unevaluatedProperties: false

examples:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ maintainers:
- Shawn Guo <[email protected]>

allOf:
- $ref: mmc-controller.yaml
- $ref: sdhci-common.yaml#

description: |
The Enhanced Secure Digital Host Controller on Freescale i.MX family
Expand Down
15 changes: 12 additions & 3 deletions Documentation/devicetree/bindings/mmc/fujitsu,sdhci-fujitsu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ allOf:

properties:
compatible:
enum:
- fujitsu,mb86s70-sdhci-3.0
- socionext,f-sdh30-e51-mmc
oneOf:
- items:
- const: socionext,synquacer-sdhci
- const: fujitsu,mb86s70-sdhci-3.0
- enum:
- fujitsu,mb86s70-sdhci-3.0
- socionext,f-sdh30-e51-mmc

reg:
maxItems: 1
Expand All @@ -29,6 +33,11 @@ properties:
- const: iface
- const: core

dma-coherent: true

interrupts:
maxItems: 2

resets:
maxItems: 1

Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/mmc/mtk-sd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ properties:
- mediatek,mt8188-mmc
- mediatek,mt8192-mmc
- mediatek,mt8195-mmc
- mediatek,mt8365-mmc
- const: mediatek,mt8183-mmc

reg:
Expand Down
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/mmc/sdhci-msm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ properties:
- const: qcom,sdhci-msm-v4 # for sdcc versions less than 5.0
- items:
- enum:
- qcom,ipq5018-sdhci
- qcom,ipq5332-sdhci
- qcom,ipq9574-sdhci
- qcom,qcm2290-sdhci
- qcom,qcs404-sdhci
- qcom,sc7180-sdhci
- qcom,sc7280-sdhci
Expand Down
2 changes: 1 addition & 1 deletion drivers/memstick/host/r592.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ static void r592_remove(struct pci_dev *pdev)
/* Stop the processing thread.
That ensures that we won't take any more requests */
kthread_stop(dev->io_thread);

del_timer_sync(&dev->detect_timer);
r592_enable_device(dev, false);

while (!error && dev->req) {
Expand Down
2 changes: 0 additions & 2 deletions drivers/mmc/core/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ MODULE_ALIAS("mmc:block");
#define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
#define MMC_EXTRACT_VALUE_FROM_ARG(x) ((x & 0x0000FF00) >> 8)

#define mmc_req_rel_wr(req) ((req->cmd_flags & REQ_FUA) && \
(rq_data_dir(req) == WRITE))
static DEFINE_MUTEX(block_mutex);

/*
Expand Down
5 changes: 5 additions & 0 deletions drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,11 @@ void mmc_rescan(struct work_struct *work)
break;
}

/* A non-removable card should have been detected by now. */
if (!mmc_card_is_removable(host) && !host->bus_ops)
pr_info("%s: Failed to initialize a non-removable card",
mmc_hostname(host));

/*
* Ignore the command timeout errors observed during
* the card init as those are excepted.
Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/core/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(mmc_err_state, mmc_err_state_get, NULL, "%llu\n");

static int mmc_err_stats_show(struct seq_file *file, void *data)
{
struct mmc_host *host = (struct mmc_host *)file->private;
struct mmc_host *host = file->private;
const char *desc[MMC_ERR_MAX] = {
[MMC_ERR_CMD_TIMEOUT] = "Command Timeout Occurred",
[MMC_ERR_CMD_CRC] = "Command CRC Errors Occurred",
Expand Down
6 changes: 3 additions & 3 deletions drivers/mmc/core/mmc_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@ static LIST_HEAD(mmc_test_file_test);

static int mtf_test_show(struct seq_file *sf, void *data)
{
struct mmc_card *card = (struct mmc_card *)sf->private;
struct mmc_card *card = sf->private;
struct mmc_test_general_result *gr;

mutex_lock(&mmc_test_lock);
Expand Down Expand Up @@ -3079,8 +3079,8 @@ static int mtf_test_open(struct inode *inode, struct file *file)
static ssize_t mtf_test_write(struct file *file, const char __user *buf,
size_t count, loff_t *pos)
{
struct seq_file *sf = (struct seq_file *)file->private_data;
struct mmc_card *card = (struct mmc_card *)sf->private;
struct seq_file *sf = file->private_data;
struct mmc_card *card = sf->private;
struct mmc_test_card *test;
long testcase;
int ret;
Expand Down
44 changes: 44 additions & 0 deletions drivers/mmc/core/regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
int result = 0;
int min_uV, max_uV;

if (IS_ERR(supply))
return 0;

if (vdd_bit) {
mmc_ocrbitnum_to_vdd(vdd_bit, &min_uV, &max_uV);

Expand Down Expand Up @@ -271,3 +274,44 @@ int mmc_regulator_get_supply(struct mmc_host *mmc)
return 0;
}
EXPORT_SYMBOL_GPL(mmc_regulator_get_supply);

/**
* mmc_regulator_enable_vqmmc - enable VQMMC regulator for a host
* @mmc: the host to regulate
*
* Returns 0 or errno. Enables the regulator for vqmmc.
* Keeps track of the enable status for ensuring that calls to
* regulator_enable/disable are balanced.
*/
int mmc_regulator_enable_vqmmc(struct mmc_host *mmc)
{
int ret = 0;

if (!IS_ERR(mmc->supply.vqmmc) && !mmc->vqmmc_enabled) {
ret = regulator_enable(mmc->supply.vqmmc);
if (ret < 0)
dev_err(mmc_dev(mmc), "enabling vqmmc regulator failed\n");
else
mmc->vqmmc_enabled = true;
}

return ret;
}
EXPORT_SYMBOL_GPL(mmc_regulator_enable_vqmmc);

/**
* mmc_regulator_disable_vqmmc - disable VQMMC regulator for a host
* @mmc: the host to regulate
*
* Returns 0 or errno. Disables the regulator for vqmmc.
* Keeps track of the enable status for ensuring that calls to
* regulator_enable/disable are balanced.
*/
void mmc_regulator_disable_vqmmc(struct mmc_host *mmc)
{
if (!IS_ERR(mmc->supply.vqmmc) && mmc->vqmmc_enabled) {
regulator_disable(mmc->supply.vqmmc);
mmc->vqmmc_enabled = false;
}
}
EXPORT_SYMBOL_GPL(mmc_regulator_disable_vqmmc);
1 change: 1 addition & 0 deletions drivers/mmc/host/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ config MMC_SDHCI_CADENCE
tristate "SDHCI support for the Cadence SD/SDIO/eMMC controller"
depends on MMC_SDHCI_PLTFM
depends on OF
select MMC_SDHCI_IO_ACCESSORS
help
This selects the Cadence SD/SDIO/eMMC driver.

Expand Down
3 changes: 1 addition & 2 deletions drivers/mmc/host/dw_mmc-pltfm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
host->irq_flags = 0;
host->pdata = pdev->dev.platform_data;

regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->regs = devm_ioremap_resource(&pdev->dev, regs);
host->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &regs);
if (IS_ERR(host->regs))
return PTR_ERR(host->regs);

Expand Down
3 changes: 1 addition & 2 deletions drivers/mmc/host/jz4740_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,7 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
goto err_free_host;
}

host->mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
host->base = devm_ioremap_resource(&pdev->dev, host->mem_res);
host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &host->mem_res);
if (IS_ERR(host->base)) {
ret = PTR_ERR(host->base);
goto err_free_host;
Expand Down
24 changes: 4 additions & 20 deletions drivers/mmc/host/meson-gx-mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ struct meson_host {

int irq;

bool vqmmc_enabled;
bool needs_pre_post_req;

spinlock_t lock;
Expand Down Expand Up @@ -604,32 +603,18 @@ static void meson_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
*/
switch (ios->power_mode) {
case MMC_POWER_OFF:
if (!IS_ERR(mmc->supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);

if (!IS_ERR(mmc->supply.vqmmc) && host->vqmmc_enabled) {
regulator_disable(mmc->supply.vqmmc);
host->vqmmc_enabled = false;
}
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
mmc_regulator_disable_vqmmc(mmc);

break;

case MMC_POWER_UP:
if (!IS_ERR(mmc->supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);

break;

case MMC_POWER_ON:
if (!IS_ERR(mmc->supply.vqmmc) && !host->vqmmc_enabled) {
int ret = regulator_enable(mmc->supply.vqmmc);

if (ret < 0)
dev_err(host->dev,
"failed to enable vqmmc regulator\n");
else
host->vqmmc_enabled = true;
}
mmc_regulator_enable_vqmmc(mmc);

break;
}
Expand Down Expand Up @@ -1181,7 +1166,6 @@ static int meson_mmc_probe(struct platform_device *pdev)
"amlogic,dram-access-quirk");

/* Get regulators and the supported OCR mask */
host->vqmmc_enabled = false;
ret = mmc_regulator_get_supply(mmc);
if (ret)
return ret;
Expand Down
22 changes: 11 additions & 11 deletions drivers/mmc/host/mmci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1962,28 +1962,28 @@ static int mmci_of_parse(struct device_node *np, struct mmc_host *mmc)
if (ret)
return ret;

if (of_get_property(np, "st,sig-dir-dat0", NULL))
if (of_property_read_bool(np, "st,sig-dir-dat0"))
host->pwr_reg_add |= MCI_ST_DATA0DIREN;
if (of_get_property(np, "st,sig-dir-dat2", NULL))
if (of_property_read_bool(np, "st,sig-dir-dat2"))
host->pwr_reg_add |= MCI_ST_DATA2DIREN;
if (of_get_property(np, "st,sig-dir-dat31", NULL))
if (of_property_read_bool(np, "st,sig-dir-dat31"))
host->pwr_reg_add |= MCI_ST_DATA31DIREN;
if (of_get_property(np, "st,sig-dir-dat74", NULL))
if (of_property_read_bool(np, "st,sig-dir-dat74"))
host->pwr_reg_add |= MCI_ST_DATA74DIREN;
if (of_get_property(np, "st,sig-dir-cmd", NULL))
if (of_property_read_bool(np, "st,sig-dir-cmd"))
host->pwr_reg_add |= MCI_ST_CMDDIREN;
if (of_get_property(np, "st,sig-pin-fbclk", NULL))
if (of_property_read_bool(np, "st,sig-pin-fbclk"))
host->pwr_reg_add |= MCI_ST_FBCLKEN;
if (of_get_property(np, "st,sig-dir", NULL))
if (of_property_read_bool(np, "st,sig-dir"))
host->pwr_reg_add |= MCI_STM32_DIRPOL;
if (of_get_property(np, "st,neg-edge", NULL))
if (of_property_read_bool(np, "st,neg-edge"))
host->clk_reg_add |= MCI_STM32_CLK_NEGEDGE;
if (of_get_property(np, "st,use-ckin", NULL))
if (of_property_read_bool(np, "st,use-ckin"))
mmci_probe_level_translator(mmc);

if (of_get_property(np, "mmc-cap-mmc-highspeed", NULL))
if (of_property_read_bool(np, "mmc-cap-mmc-highspeed"))
mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
if (of_get_property(np, "mmc-cap-sd-highspeed", NULL))
if (of_property_read_bool(np, "mmc-cap-sd-highspeed"))
mmc->caps |= MMC_CAP_SD_HIGHSPEED;

return 0;
Expand Down
Loading

0 comments on commit c5c06e2

Please sign in to comment.