MMC core:
- Remove redundant pm_runtime_mark_last_busy() calls
MMC host:
- Convert drivers to use devm_mmc_alloc_host()
- Remove redundant pm_runtime_mark_last_busy() calls
- renesas_sdhi: Add support for the RZ/T2H and RZ/N2H variants
- renesas_sdhi: Fix incorrect auto retuning for an SDIO card
- rtsx_usb_sdmmc: Add 74 clocks in poweron flow
- rtsx_usb_sdmmc: Re-work the code in sd_set_power_mode()
- loongson2: Add driver for the Loongson-2K SD/SDIO controller
- loongson2: Add support for the Loongson-2K2000 SD/SDIO/eMMC controller
- sdhci: Drop sdhci_free_host()/sdhci_pltfm_free() interface
- sdhci: Remove the sdhci_free_host() and sdhci_pltfm_free() helpers
- sdhci-cadence: Add support for the Mobileye EyeQ controller
- sdhci-esdhc-imx: Optimize clock loopback selection
- sdhci-esdhc-imx: Don't change pinctrl in suspend if wakeup source
- sdhci-msm: Add support for the Milos variant
- sdhci-msm: Add support for the qcs8300 variant
- sdhci-msm: Ensure SD card power isn't ON when card gets removed
- sdhci-of-k1: Disable HW busy detection
-----BEGIN PGP SIGNATURE-----
iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmiIs7gXHHVsZi5oYW5z
c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCmLpA/+PS/xQxbNKpTp8xxGiVNTYjr8
QodSjlj/v0U+4P5OKgdfPtCfXSdw3qqJXdDExBiciWDk/oP+s6QtijT/kJTaGvF8
KcY/vWzuuNxqc6B1fcIyxWUwe5u2IZOfAy+eacD+fkjyr2NZN+F45g5Z+3zDGE/X
792ireOKUFvB8R05SOSOjC4rrNqair+s1ANbVNqjfO5V+iWD6mJPkzy53dM6qeYc
JaTuELNML51Iv6zFS8cKMLnWaxTb6rDe59oFMDCJF+vvzgj7v0eOUbWUjPUPHShm
0vxjAAu6EPaWEj0z+PDMeFSrMjCr8QsfD/gixsDJ5mJZnyi0BgAatzJcPZTiZG8H
WjOR69A68cI2LTvILQ7Juj4GPAMVIqQ1oqsF8Gtq1koV1FdWKAL1Qa7Mzt1ILJun
lpmPlQfb1sYtUqERVrUspf9xtlrbOcIv6T1VL5k5S0DzkjL05VWH2zPws3IrVSlE
a25oyfvPKhbvn8csfumk9cSFF9LfTedA21RP6tZWofKZgOBZ5zKqDAggvLM1f9uq
41Q5i0CEWiq5+C6oK2RbfLzHgqKHbiA0DDCpB+W5Qtbl0mxKpV9Y6iYHzV2SgJp1
JACfTKOb//lHXN+eMA0JJXBe6OP/5AbeT8+V8dCoRyT1pRJgXHb1UO6wHZ94X2Ho
j3VDmefy5lOaA4od2bg=
=bC9D
-----END PGP SIGNATURE-----
Merge tag 'mmc-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC updates from Ulf Hansson:
"MMC core:
- Remove redundant pm_runtime_mark_last_busy() calls
MMC host:
- Convert drivers to use devm_mmc_alloc_host()
- Remove redundant pm_runtime_mark_last_busy() calls
- renesas_sdhi:
- Add support for the RZ/T2H and RZ/N2H variants
- Fix incorrect auto retuning for an SDIO card
- rtsx_usb_sdmmc:
- Add 74 clocks in poweron flow
- Re-work the code in sd_set_power_mode()
- loongson2:
- Add driver for the Loongson-2K SD/SDIO controller
- Add support for the Loongson-2K2000 SD/SDIO/eMMC controller
- sdhci:
- Drop sdhci_free_host()/sdhci_pltfm_free() interface
- Remove the sdhci_free_host() and sdhci_pltfm_free() helpers
- sdhci-cadence: Add support for the Mobileye EyeQ controller
- sdhci-esdhc-imx:
- Optimize clock loopback selection
- Don't change pinctrl in suspend if wakeup source
- sdhci-msm:
- Add support for the Milos variant
- Add support for the qcs8300 variant
- Ensure SD card power isn't ON when card gets removed
- sdhci-of-k1: Disable HW busy detection"
* tag 'mmc-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (102 commits)
mmc: loongson2: Unify the function prefixes for loongson2_mmc_pdata
mmc: loongson2: Fix error code in loongson2_mmc_resource_request()
dt-bindings: mmc: sdhci-msm: document the Milos SDHCI Controller
mmc: loongson2: prevent integer overflow in ret variable
mmc: Remove redundant pm_runtime_mark_last_busy() calls
mmc: sdhci-msm: Ensure SD card power isn't ON when card removed
dt-bindings: mmc: Add sdhci compatible for qcs8300
mmc: sdhci-cadence: use of_property_present
mmc: loongson2: Add Loongson-2K2000 SD/SDIO/eMMC controller driver
dt-bindings: mmc: loongson,ls2k0500-mmc: Add compatible for Loongson-2K2000
mmc: loongson2: Add Loongson-2K SD/SDIO controller driver
dt-bindings: mmc: Add Loongson-2K SD/SDIO/eMMC controller binding
mmc: Convert ternary operator to str_true_false() helper
dt-bindings: mmc: renesas,sdhi: Document RZ/T2H and RZ/N2H support
mmc: sdhci-cadence: add Mobileye eyeQ support
dt-bindings: mmc: cdns: add Mobileye EyeQ MMC/SDHCI controller
mmc: rtsx_usb_sdmmc: Fix clang -Wimplicit-fallthrough in sd_set_power_mode()
mmc: cb710-mmc: Convert ternary operator to str_plural() helper
mmc: rtsx_usb_sdmmc: Add 74 clocks in poweron flow
mmc: rtsx_usb_sdmmc: Re-work the code in sd_set_power_mode()
...
pull/1309/head
commit
854ff79237
|
|
@ -16,6 +16,7 @@ properties:
|
|||
- amd,pensando-elba-sd4hc
|
||||
- microchip,mpfs-sd4hc
|
||||
- microchip,pic64gx-sd4hc
|
||||
- mobileye,eyeq-sd4hc
|
||||
- socionext,uniphier-sd4hc
|
||||
- const: cdns,sd4hc
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,112 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/mmc/loongson,ls2k0500-mmc.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: The SD/SDIO/eMMC host controller for Loongson-2K family SoCs
|
||||
|
||||
description:
|
||||
The MMC host controller on the Loongson-2K0500/2K1000 (using an externally
|
||||
shared apbdma controller) provides the SD and SDIO device interfaces.
|
||||
The two MMC host controllers on the Loongson-2K2000 are similar,
|
||||
except that they use internal exclusive DMA. one controller provides
|
||||
the eMMC interface and the other provides the SD/SDIO interface.
|
||||
|
||||
maintainers:
|
||||
- Binbin Zhou <zhoubinbin@loongson.cn>
|
||||
|
||||
allOf:
|
||||
- $ref: mmc-controller.yaml#
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- loongson,ls2k0500-mmc
|
||||
- loongson,ls2k1000-mmc
|
||||
- loongson,ls2k2000-mmc
|
||||
|
||||
reg:
|
||||
minItems: 1
|
||||
items:
|
||||
- description: Loongson-2K MMC controller registers.
|
||||
- description: APB DMA config register for Loongson-2K MMC controller.
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
dmas:
|
||||
maxItems: 1
|
||||
|
||||
dma-names:
|
||||
const: rx-tx
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
- clocks
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- loongson,ls2k0500-mmc
|
||||
- loongson,ls2k1000-mmc
|
||||
|
||||
then:
|
||||
properties:
|
||||
reg:
|
||||
minItems: 2
|
||||
|
||||
required:
|
||||
- dmas
|
||||
- dma-names
|
||||
|
||||
else:
|
||||
properties:
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/clock/loongson,ls2k-clk.h>
|
||||
|
||||
mmc@1fe2c000 {
|
||||
compatible = "loongson,ls2k1000-mmc";
|
||||
reg = <0x1fe2c000 0x68>,
|
||||
<0x1fe00438 0x8>;
|
||||
interrupt-parent = <&liointc0>;
|
||||
interrupts = <31 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clk LOONGSON2_APB_CLK>;
|
||||
dmas = <&apbdma1 0>;
|
||||
dma-names = "rx-tx";
|
||||
bus-width = <4>;
|
||||
cd-gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
#include <dt-bindings/clock/loongson,ls2k-clk.h>
|
||||
|
||||
mmc@79990000 {
|
||||
compatible = "loongson,ls2k2000-mmc";
|
||||
reg = <0x79990000 0x1000>;
|
||||
interrupt-parent = <&pic>;
|
||||
interrupts = <51 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&clk LOONGSON2_EMMC_CLK>;
|
||||
bus-width = <8>;
|
||||
non-removable;
|
||||
cap-mmc-highspeed;
|
||||
mmc-hs200-1_8v;
|
||||
no-sd;
|
||||
no-sdio;
|
||||
};
|
||||
|
|
@ -17,7 +17,7 @@ description: |
|
|||
and the properties used by the mxsmmc driver.
|
||||
|
||||
allOf:
|
||||
- $ref: mmc-controller.yaml
|
||||
- $ref: mmc-controller-common.yaml#
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
|
|
@ -31,6 +31,9 @@ properties:
|
|||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
dmas:
|
||||
maxItems: 1
|
||||
|
||||
|
|
@ -41,6 +44,7 @@ required:
|
|||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
- clocks
|
||||
- dmas
|
||||
- dma-names
|
||||
|
||||
|
|
@ -52,6 +56,7 @@ examples:
|
|||
compatible = "fsl,imx28-mmc";
|
||||
reg = <0x80010000 2000>;
|
||||
interrupts = <96>;
|
||||
clocks = <&clks 46>;
|
||||
dmas = <&dma_apbh 0>;
|
||||
dma-names = "rx-tx";
|
||||
bus-width = <8>;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ properties:
|
|||
- enum:
|
||||
- renesas,sdhi-r9a09g047 # RZ/G3E
|
||||
- renesas,sdhi-r9a09g056 # RZ/V2N
|
||||
- renesas,sdhi-r9a09g077 # RZ/T2H
|
||||
- renesas,sdhi-r9a09g087 # RZ/N2H
|
||||
- const: renesas,sdhi-r9a09g057 # RZ/V2H(P)
|
||||
|
||||
reg:
|
||||
|
|
@ -129,59 +131,78 @@ allOf:
|
|||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- renesas,sdhi-r9a09g057
|
||||
- renesas,rzg2l-sdhi
|
||||
- renesas,sdhi-r9a09g077
|
||||
- renesas,sdhi-r9a09g087
|
||||
then:
|
||||
properties:
|
||||
resets: false
|
||||
clocks:
|
||||
items:
|
||||
- description: IMCLK, SDHI channel main clock1.
|
||||
- description: CLK_HS, SDHI channel High speed clock which operates
|
||||
4 times that of SDHI channel main clock1.
|
||||
- description: IMCLK2, SDHI channel main clock2. When this clock is
|
||||
turned off, external SD card detection cannot be
|
||||
detected.
|
||||
- description: ACLK, SDHI channel bus clock.
|
||||
- description: ACLK, IMCLK, SDHI channel bus and main clocks.
|
||||
- description: CLK_HS, SDHI channel High speed clock.
|
||||
clock-names:
|
||||
items:
|
||||
- const: core
|
||||
- const: clkh
|
||||
- const: cd
|
||||
- const: aclk
|
||||
required:
|
||||
- clock-names
|
||||
- resets
|
||||
- const: clkh
|
||||
else:
|
||||
if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- renesas,rcar-gen2-sdhi
|
||||
- renesas,rcar-gen3-sdhi
|
||||
- renesas,rcar-gen4-sdhi
|
||||
- renesas,sdhi-r9a09g057
|
||||
- renesas,rzg2l-sdhi
|
||||
then:
|
||||
properties:
|
||||
clocks:
|
||||
minItems: 1
|
||||
maxItems: 3
|
||||
items:
|
||||
- description: IMCLK, SDHI channel main clock1.
|
||||
- description: CLK_HS, SDHI channel High speed clock which operates
|
||||
4 times that of SDHI channel main clock1.
|
||||
- description: IMCLK2, SDHI channel main clock2. When this clock is
|
||||
turned off, external SD card detection cannot be
|
||||
detected.
|
||||
- description: ACLK, SDHI channel bus clock.
|
||||
clock-names:
|
||||
minItems: 1
|
||||
uniqueItems: true
|
||||
items:
|
||||
- const: core
|
||||
- enum: [ clkh, cd ]
|
||||
- const: clkh
|
||||
- const: cd
|
||||
- const: aclk
|
||||
required:
|
||||
- clock-names
|
||||
- resets
|
||||
else:
|
||||
properties:
|
||||
clocks:
|
||||
minItems: 1
|
||||
maxItems: 2
|
||||
clock-names:
|
||||
minItems: 1
|
||||
items:
|
||||
- const: core
|
||||
- const: cd
|
||||
if:
|
||||
properties:
|
||||
compatible:
|
||||
contains:
|
||||
enum:
|
||||
- renesas,rcar-gen2-sdhi
|
||||
- renesas,rcar-gen3-sdhi
|
||||
- renesas,rcar-gen4-sdhi
|
||||
then:
|
||||
properties:
|
||||
clocks:
|
||||
minItems: 1
|
||||
maxItems: 3
|
||||
clock-names:
|
||||
minItems: 1
|
||||
uniqueItems: true
|
||||
items:
|
||||
- const: core
|
||||
- enum: [ clkh, cd ]
|
||||
- const: cd
|
||||
else:
|
||||
properties:
|
||||
clocks:
|
||||
minItems: 1
|
||||
maxItems: 2
|
||||
clock-names:
|
||||
minItems: 1
|
||||
items:
|
||||
- const: core
|
||||
- const: cd
|
||||
|
||||
- if:
|
||||
properties:
|
||||
|
|
|
|||
|
|
@ -42,9 +42,11 @@ properties:
|
|||
- qcom,ipq5424-sdhci
|
||||
- qcom,ipq6018-sdhci
|
||||
- qcom,ipq9574-sdhci
|
||||
- qcom,milos-sdhci
|
||||
- qcom,qcm2290-sdhci
|
||||
- qcom,qcs404-sdhci
|
||||
- qcom,qcs615-sdhci
|
||||
- qcom,qcs8300-sdhci
|
||||
- qcom,qdu1000-sdhci
|
||||
- qcom,sar2130p-sdhci
|
||||
- qcom,sc7180-sdhci
|
||||
|
|
|
|||
|
|
@ -14268,6 +14268,13 @@ S: Maintained
|
|||
F: Documentation/devicetree/bindings/hwinfo/loongson,ls2k-chipid.yaml
|
||||
F: drivers/soc/loongson/loongson2_guts.c
|
||||
|
||||
LOONGSON-2 SOC SERIES MMC/SD/SDIO CONTROLLER DRIVER
|
||||
M: Binbin Zhou <zhoubinbin@loongson.cn>
|
||||
L: linux-mmc@vger.kernel.org
|
||||
S: Maintained
|
||||
F: Documentation/devicetree/bindings/mmc/loongson,ls2k0500-mmc.yaml
|
||||
F: drivers/mmc/host/loongson2-mmc.c
|
||||
|
||||
LOONGSON-2 SOC SERIES PM DRIVER
|
||||
M: Yinbo Zhu <zhuyinbo@loongson.cn>
|
||||
L: linux-pm@vger.kernel.org
|
||||
|
|
|
|||
|
|
@ -882,7 +882,6 @@ void mmc_put_card(struct mmc_card *card, struct mmc_ctx *ctx)
|
|||
WARN_ON(ctx && host->claimer != ctx);
|
||||
|
||||
mmc_release_host(host);
|
||||
pm_runtime_mark_last_busy(&card->dev);
|
||||
pm_runtime_put_autosuspend(&card->dev);
|
||||
}
|
||||
EXPORT_SYMBOL(mmc_put_card);
|
||||
|
|
|
|||
|
|
@ -1111,6 +1111,19 @@ config MMC_OWL
|
|||
This selects support for the SD/MMC Host Controller on
|
||||
Actions Semi Owl SoCs.
|
||||
|
||||
config MMC_LOONGSON2
|
||||
tristate "Loongson-2K SD/SDIO/eMMC Host Interface support"
|
||||
depends on LOONGARCH || COMPILE_TEST
|
||||
depends on HAS_DMA
|
||||
help
|
||||
This selects support for the SD/SDIO/eMMC Host Controller on
|
||||
Loongson-2K series CPUs.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called mmc_loongson2.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config MMC_SDHCI_EXTERNAL_DMA
|
||||
bool
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ obj-$(CONFIG_MMC_USDHI6ROL0) += usdhi6rol0.o
|
|||
obj-$(CONFIG_MMC_TOSHIBA_PCI) += toshsd.o
|
||||
obj-$(CONFIG_MMC_BCM2835) += bcm2835.o
|
||||
obj-$(CONFIG_MMC_OWL) += owl-mmc.o
|
||||
obj-$(CONFIG_MMC_LOONGSON2) += loongson2-mmc.o
|
||||
|
||||
obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o
|
||||
obj-$(CONFIG_MMC_REALTEK_USB) += rtsx_usb_sdmmc.o
|
||||
|
|
|
|||
|
|
@ -1084,7 +1084,7 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
|
|||
struct alcor_sdmmc_host *host;
|
||||
int ret;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc) {
|
||||
dev_err(&pdev->dev, "Can't allocate MMC\n");
|
||||
return -ENOMEM;
|
||||
|
|
@ -1102,11 +1102,9 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
|
|||
ret = devm_request_threaded_irq(&pdev->dev, priv->irq,
|
||||
alcor_irq, alcor_irq_thread, IRQF_SHARED,
|
||||
DRV_NAME_ALCOR_PCI_SDMMC, host);
|
||||
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to get irq for data line\n");
|
||||
goto free_host;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"Failed to get irq for data line\n");
|
||||
|
||||
mutex_init(&host->cmd_mutex);
|
||||
INIT_DELAYED_WORK(&host->timeout_work, alcor_timeout_timer);
|
||||
|
|
@ -1115,15 +1113,8 @@ static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)
|
|||
alcor_hw_init(host);
|
||||
|
||||
dev_set_drvdata(&pdev->dev, host);
|
||||
ret = mmc_add_host(mmc);
|
||||
if (ret)
|
||||
goto free_host;
|
||||
|
||||
return 0;
|
||||
|
||||
free_host:
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
return mmc_add_host(mmc);
|
||||
}
|
||||
|
||||
static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
|
||||
|
|
@ -1136,7 +1127,6 @@ static void alcor_pci_sdmmc_drv_remove(struct platform_device *pdev)
|
|||
|
||||
alcor_hw_uninit(host);
|
||||
mmc_remove_host(mmc);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <asm/cacheflush.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/unaligned.h>
|
||||
#include <linux/string_choices.h>
|
||||
|
||||
#define ATMCI_MAX_NR_SLOTS 2
|
||||
|
||||
|
|
@ -541,7 +542,6 @@ static int atmci_regs_show(struct seq_file *s, void *v)
|
|||
memcpy_fromio(buf, host->regs, ATMCI_REGS_SIZE);
|
||||
spin_unlock_bh(&host->lock);
|
||||
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
seq_printf(s, "MR:\t0x%08x%s%s ",
|
||||
|
|
@ -2248,7 +2248,7 @@ static int atmci_init_slot(struct atmel_mci *host,
|
|||
struct atmel_mci_slot *slot;
|
||||
int ret;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct atmel_mci_slot), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*slot));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -2264,7 +2264,7 @@ static int atmci_init_slot(struct atmel_mci *host,
|
|||
"slot[%u]: bus_width=%u, detect_pin=%d, "
|
||||
"detect_is_active_high=%s, wp_pin=%d\n",
|
||||
id, slot_data->bus_width, desc_to_gpio(slot_data->detect_pin),
|
||||
!gpiod_is_active_low(slot_data->detect_pin) ? "true" : "false",
|
||||
str_true_false(!gpiod_is_active_low(slot_data->detect_pin)),
|
||||
desc_to_gpio(slot_data->wp_pin));
|
||||
|
||||
mmc->ops = &atmci_ops;
|
||||
|
|
@ -2321,10 +2321,8 @@ static int atmci_init_slot(struct atmel_mci *host,
|
|||
host->slot[id] = slot;
|
||||
mmc_regulator_get_supply(mmc);
|
||||
ret = mmc_add_host(mmc);
|
||||
if (ret) {
|
||||
mmc_free_host(mmc);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (slot->detect_pin) {
|
||||
timer_setup(&slot->detect_timer, atmci_detect_change, 0);
|
||||
|
|
@ -2362,7 +2360,6 @@ static void atmci_cleanup_slot(struct atmel_mci_slot *slot,
|
|||
}
|
||||
|
||||
slot->host->slot[id] = NULL;
|
||||
mmc_free_host(slot->mmc);
|
||||
}
|
||||
|
||||
static int atmci_configure_dma(struct atmel_mci *host)
|
||||
|
|
@ -2570,7 +2567,6 @@ static int atmci_probe(struct platform_device *pdev)
|
|||
dev_info(dev, "Atmel MCI controller at 0x%08lx irq %d, %u slots\n",
|
||||
host->mapbase, irq, nr_slots);
|
||||
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -937,11 +937,10 @@ static int au1xmmc_probe(struct platform_device *pdev)
|
|||
struct resource *r;
|
||||
int ret, iflag;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct au1xmmc_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc) {
|
||||
dev_err(&pdev->dev, "no memory for mmc_host\n");
|
||||
ret = -ENOMEM;
|
||||
goto out0;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
|
|
@ -953,14 +952,14 @@ static int au1xmmc_probe(struct platform_device *pdev)
|
|||
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
if (!r) {
|
||||
dev_err(&pdev->dev, "no mmio defined\n");
|
||||
goto out1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
host->ioarea = request_mem_region(r->start, resource_size(r),
|
||||
pdev->name);
|
||||
if (!host->ioarea) {
|
||||
dev_err(&pdev->dev, "mmio already in use\n");
|
||||
goto out1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
host->iobase = ioremap(r->start, 0x3c);
|
||||
|
|
@ -1109,9 +1108,6 @@ out3:
|
|||
out2:
|
||||
release_resource(host->ioarea);
|
||||
kfree(host->ioarea);
|
||||
out1:
|
||||
mmc_free_host(mmc);
|
||||
out0:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1151,8 +1147,6 @@ static void au1xmmc_remove(struct platform_device *pdev)
|
|||
iounmap((void *)host->iobase);
|
||||
release_resource(host->ioarea);
|
||||
kfree(host->ioarea);
|
||||
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1372,7 +1372,7 @@ static int bcm2835_probe(struct platform_device *pdev)
|
|||
int ret;
|
||||
|
||||
dev_dbg(dev, "%s\n", __func__);
|
||||
mmc = mmc_alloc_host(sizeof(*host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1451,7 +1451,6 @@ err:
|
|||
dev_dbg(dev, "%s -> err %d\n", __func__, ret);
|
||||
if (host->dma_chan_rxtx)
|
||||
dma_release_channel(host->dma_chan_rxtx);
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1474,8 +1473,6 @@ static void bcm2835_remove(struct platform_device *pdev)
|
|||
|
||||
if (host->dma_chan_rxtx)
|
||||
dma_release_channel(host->dma_chan_rxtx);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static const struct of_device_id bcm2835_match[] = {
|
||||
|
|
|
|||
|
|
@ -1012,7 +1012,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
|
|||
struct mmc_host *mmc;
|
||||
int ret, id;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct cvm_mmc_slot), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*slot));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1022,7 +1022,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
|
|||
|
||||
ret = cvm_mmc_of_parse(dev, slot);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
id = ret;
|
||||
|
||||
/* Set up host parameters */
|
||||
|
|
@ -1066,12 +1066,7 @@ int cvm_mmc_of_slot_probe(struct device *dev, struct cvm_mmc_host *host)
|
|||
if (ret) {
|
||||
dev_err(dev, "mmc_add_host() returned %d\n", ret);
|
||||
slot->host->slot[id] = NULL;
|
||||
goto error;
|
||||
}
|
||||
return 0;
|
||||
|
||||
error:
|
||||
mmc_free_host(slot->mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1079,6 +1074,5 @@ int cvm_mmc_of_slot_remove(struct cvm_mmc_slot *slot)
|
|||
{
|
||||
mmc_remove_host(slot->mmc);
|
||||
slot->host->slot[slot->bus_id] = NULL;
|
||||
mmc_free_host(slot->mmc);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/string_choices.h>
|
||||
#include "cb710-mmc.h"
|
||||
|
||||
#define CB710_MMC_REQ_TIMEOUT_MS 2000
|
||||
|
|
@ -215,7 +216,7 @@ static void cb710_mmc_set_transfer_size(struct cb710_slot *slot,
|
|||
((count - 1) << 16)|(blocksize - 1));
|
||||
|
||||
dev_vdbg(cb710_slot_dev(slot), "set up for %zu block%s of %zu bytes\n",
|
||||
count, count == 1 ? "" : "s", blocksize);
|
||||
count, str_plural(count), blocksize);
|
||||
}
|
||||
|
||||
static void cb710_mmc_fifo_hack(struct cb710_slot *slot)
|
||||
|
|
@ -692,7 +693,7 @@ static int cb710_mmc_init(struct platform_device *pdev)
|
|||
int err;
|
||||
u32 val;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(*reader), cb710_slot_dev(slot));
|
||||
mmc = devm_mmc_alloc_host(cb710_slot_dev(slot), sizeof(*reader));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -741,7 +742,6 @@ err_free_mmc:
|
|||
dev_dbg(cb710_slot_dev(slot), "mmc_add_host() failed: %d\n", err);
|
||||
|
||||
cb710_set_irq_handler(slot, NULL);
|
||||
mmc_free_host(mmc);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -764,8 +764,6 @@ static void cb710_mmc_exit(struct platform_device *pdev)
|
|||
cb710_write_port_16(slot, CB710_MMC_CONFIGB_PORT, 0);
|
||||
|
||||
cancel_work_sync(&reader->finish_req_bh_work);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static struct platform_driver cb710_mmc_driver = {
|
||||
|
|
|
|||
|
|
@ -1203,7 +1203,7 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
|
|||
if (!mem)
|
||||
return -EBUSY;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1212,19 +1212,16 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
|
|||
|
||||
host->mem_res = mem;
|
||||
host->base = devm_ioremap(&pdev->dev, mem->start, mem_size);
|
||||
if (!host->base) {
|
||||
ret = -ENOMEM;
|
||||
goto ioremap_fail;
|
||||
}
|
||||
if (!host->base)
|
||||
return -ENOMEM;
|
||||
|
||||
host->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(host->clk)) {
|
||||
ret = PTR_ERR(host->clk);
|
||||
goto clk_get_fail;
|
||||
}
|
||||
if (IS_ERR(host->clk))
|
||||
return PTR_ERR(host->clk);
|
||||
|
||||
ret = clk_prepare_enable(host->clk);
|
||||
if (ret)
|
||||
goto clk_prepare_enable_fail;
|
||||
return ret;
|
||||
|
||||
host->mmc_input_clk = clk_get_rate(host->clk);
|
||||
|
||||
|
|
@ -1336,10 +1333,6 @@ cpu_freq_fail:
|
|||
parse_fail:
|
||||
dma_probe_defer:
|
||||
clk_disable_unprepare(host->clk);
|
||||
clk_prepare_enable_fail:
|
||||
clk_get_fail:
|
||||
ioremap_fail:
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1352,7 +1345,6 @@ static void davinci_mmcsd_remove(struct platform_device *pdev)
|
|||
mmc_davinci_cpufreq_deregister(host);
|
||||
davinci_release_dma_channels(host);
|
||||
clk_disable_unprepare(host->clk);
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
|
|
|||
|
|
@ -3008,7 +3008,7 @@ static int dw_mci_init_slot(struct dw_mci *host)
|
|||
struct dw_mci_slot *slot;
|
||||
int ret;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct dw_mci_slot), host->dev);
|
||||
mmc = devm_mmc_alloc_host(host->dev, sizeof(*slot));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -3024,18 +3024,18 @@ static int dw_mci_init_slot(struct dw_mci *host)
|
|||
/*if there are external regulators, get them*/
|
||||
ret = mmc_regulator_get_supply(mmc);
|
||||
if (ret)
|
||||
goto err_host_allocated;
|
||||
return ret;
|
||||
|
||||
if (!mmc->ocr_avail)
|
||||
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret)
|
||||
goto err_host_allocated;
|
||||
return ret;
|
||||
|
||||
ret = dw_mci_init_slot_caps(slot);
|
||||
if (ret)
|
||||
goto err_host_allocated;
|
||||
return ret;
|
||||
|
||||
/* Useful defaults if platform data is unset. */
|
||||
if (host->use_dma == TRANS_MODE_IDMAC) {
|
||||
|
|
@ -3065,17 +3065,13 @@ static int dw_mci_init_slot(struct dw_mci *host)
|
|||
|
||||
ret = mmc_add_host(mmc);
|
||||
if (ret)
|
||||
goto err_host_allocated;
|
||||
return ret;
|
||||
|
||||
#if defined(CONFIG_DEBUG_FS)
|
||||
dw_mci_init_debugfs(slot);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
err_host_allocated:
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void dw_mci_cleanup_slot(struct dw_mci_slot *slot)
|
||||
|
|
@ -3083,7 +3079,6 @@ static void dw_mci_cleanup_slot(struct dw_mci_slot *slot)
|
|||
/* Debugfs stuff is cleaned up by mmc core */
|
||||
mmc_remove_host(slot->mmc);
|
||||
slot->host->slot = NULL;
|
||||
mmc_free_host(slot->mmc);
|
||||
}
|
||||
|
||||
static void dw_mci_init_dma(struct dw_mci *host)
|
||||
|
|
|
|||
|
|
@ -1043,7 +1043,7 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
|
|||
struct mmc_host *mmc;
|
||||
struct jz4740_mmc_host *host;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct jz4740_mmc_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc) {
|
||||
dev_err(&pdev->dev, "Failed to alloc mmc host structure\n");
|
||||
return -ENOMEM;
|
||||
|
|
@ -1055,31 +1055,24 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
|
|||
host->version = (enum jz4740_mmc_version)device_get_match_data(&pdev->dev);
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret) {
|
||||
dev_err_probe(&pdev->dev, ret, "could not parse device properties\n");
|
||||
goto err_free_host;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"could not parse device properties\n");
|
||||
|
||||
mmc_regulator_get_supply(mmc);
|
||||
|
||||
host->irq = platform_get_irq(pdev, 0);
|
||||
if (host->irq < 0) {
|
||||
ret = host->irq;
|
||||
goto err_free_host;
|
||||
}
|
||||
if (host->irq < 0)
|
||||
return host->irq;
|
||||
|
||||
host->clk = devm_clk_get(&pdev->dev, "mmc");
|
||||
if (IS_ERR(host->clk)) {
|
||||
ret = PTR_ERR(host->clk);
|
||||
dev_err(&pdev->dev, "Failed to get mmc clock\n");
|
||||
goto err_free_host;
|
||||
}
|
||||
if (IS_ERR(host->clk))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(host->clk),
|
||||
"Failed to get mmc clock\n");
|
||||
|
||||
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;
|
||||
}
|
||||
if (IS_ERR(host->base))
|
||||
return PTR_ERR(host->base);
|
||||
|
||||
mmc->ops = &jz4740_mmc_ops;
|
||||
if (!mmc->f_max)
|
||||
|
|
@ -1119,10 +1112,8 @@ static int jz4740_mmc_probe(struct platform_device* pdev)
|
|||
|
||||
ret = request_threaded_irq(host->irq, jz_mmc_irq, jz_mmc_irq_worker, 0,
|
||||
dev_name(&pdev->dev), host);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to request irq: %d\n", ret);
|
||||
goto err_free_host;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret, "Failed to request irq\n");
|
||||
|
||||
jz4740_mmc_clock_disable(host);
|
||||
timer_setup(&host->timeout_timer, jz4740_mmc_timeout, 0);
|
||||
|
|
@ -1153,9 +1144,6 @@ err_release_dma:
|
|||
jz4740_mmc_release_dma_channels(host);
|
||||
err_free_irq:
|
||||
free_irq(host->irq, host);
|
||||
err_free_host:
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1173,8 +1161,6 @@ static void jz4740_mmc_remove(struct platform_device *pdev)
|
|||
|
||||
if (host->use_dma)
|
||||
jz4740_mmc_release_dma_channels(host);
|
||||
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
|
||||
static int jz4740_mmc_suspend(struct device *dev)
|
||||
|
|
|
|||
|
|
@ -506,11 +506,6 @@ use_polling:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void litex_mmc_free_host_wrapper(void *mmc)
|
||||
{
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static int litex_mmc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
|
|
@ -525,15 +520,10 @@ static int litex_mmc_probe(struct platform_device *pdev)
|
|||
* If for some reason we need to modify max_blk_count, we must also
|
||||
* re-calculate `max_[req,seg]_size = max_blk_size * max_blk_count;`
|
||||
*/
|
||||
mmc = mmc_alloc_host(sizeof(struct litex_mmc_host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = devm_add_action_or_reset(dev, litex_mmc_free_host_wrapper, mmc);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Can't register mmc_free_host action\n");
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -757,11 +757,6 @@ static void meson_mx_sdhc_init_hw(struct mmc_host *mmc)
|
|||
regmap_write(host->regmap, MESON_SDHC_ISTA, MESON_SDHC_ISTA_ALL_IRQS);
|
||||
}
|
||||
|
||||
static void meason_mx_mmc_free_host(void *data)
|
||||
{
|
||||
mmc_free_host(data);
|
||||
}
|
||||
|
||||
static int meson_mx_sdhc_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
|
|
@ -770,16 +765,10 @@ static int meson_mx_sdhc_probe(struct platform_device *pdev)
|
|||
void __iomem *base;
|
||||
int ret, irq;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(*host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = devm_add_action_or_reset(dev, meason_mx_mmc_free_host, mmc);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to register mmc_free_host action\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
||||
|
|
|
|||
|
|
@ -1185,7 +1185,7 @@ static int mmc_spi_probe(struct spi_device *spi)
|
|||
goto nomem;
|
||||
memset(ones, 0xff, MMC_SPI_BLOCKSIZE);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(*host), &spi->dev);
|
||||
mmc = devm_mmc_alloc_host(&spi->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
goto nomem;
|
||||
|
||||
|
|
@ -1305,7 +1305,6 @@ fail_glue_init:
|
|||
kfree(host->data);
|
||||
fail_nobuf1:
|
||||
mmc_spi_put_pdata(spi);
|
||||
mmc_free_host(mmc);
|
||||
nomem:
|
||||
kfree(ones);
|
||||
return status;
|
||||
|
|
@ -1328,7 +1327,6 @@ static void mmc_spi_remove(struct spi_device *spi)
|
|||
|
||||
spi->max_speed_hz = mmc->f_max;
|
||||
mmc_spi_put_pdata(spi);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static const struct spi_device_id mmc_spi_dev_ids[] = {
|
||||
|
|
|
|||
|
|
@ -2082,7 +2082,6 @@ static void mmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
|
|||
spin_unlock_irqrestore(&host->lock, flags);
|
||||
|
||||
if (!enable) {
|
||||
pm_runtime_mark_last_busy(mmc_dev(mmc));
|
||||
pm_runtime_put_autosuspend(mmc_dev(mmc));
|
||||
}
|
||||
}
|
||||
|
|
@ -2223,7 +2222,7 @@ static int mmci_probe(struct amba_device *dev,
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct mmci_host), &dev->dev);
|
||||
mmc = devm_mmc_alloc_host(&dev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -2234,7 +2233,7 @@ static int mmci_probe(struct amba_device *dev,
|
|||
|
||||
ret = mmci_of_parse(np, mmc);
|
||||
if (ret)
|
||||
goto host_free;
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Some variant (STM32) doesn't have opendrain bit, nevertheless
|
||||
|
|
@ -2242,19 +2241,15 @@ static int mmci_probe(struct amba_device *dev,
|
|||
*/
|
||||
if (!variant->opendrain) {
|
||||
host->pinctrl = devm_pinctrl_get(&dev->dev);
|
||||
if (IS_ERR(host->pinctrl)) {
|
||||
dev_err(&dev->dev, "failed to get pinctrl");
|
||||
ret = PTR_ERR(host->pinctrl);
|
||||
goto host_free;
|
||||
}
|
||||
if (IS_ERR(host->pinctrl))
|
||||
return dev_err_probe(&dev->dev, PTR_ERR(host->pinctrl),
|
||||
"failed to get pinctrl\n");
|
||||
|
||||
host->pins_opendrain = pinctrl_lookup_state(host->pinctrl,
|
||||
MMCI_PINCTRL_STATE_OPENDRAIN);
|
||||
if (IS_ERR(host->pins_opendrain)) {
|
||||
dev_err(mmc_dev(mmc), "Can't select opendrain pins\n");
|
||||
ret = PTR_ERR(host->pins_opendrain);
|
||||
goto host_free;
|
||||
}
|
||||
if (IS_ERR(host->pins_opendrain))
|
||||
return dev_err_probe(&dev->dev, PTR_ERR(host->pins_opendrain),
|
||||
"Can't select opendrain pins\n");
|
||||
}
|
||||
|
||||
host->hw_designer = amba_manf(dev);
|
||||
|
|
@ -2263,14 +2258,12 @@ static int mmci_probe(struct amba_device *dev,
|
|||
dev_dbg(mmc_dev(mmc), "revision = 0x%01x\n", host->hw_revision);
|
||||
|
||||
host->clk = devm_clk_get(&dev->dev, NULL);
|
||||
if (IS_ERR(host->clk)) {
|
||||
ret = PTR_ERR(host->clk);
|
||||
goto host_free;
|
||||
}
|
||||
if (IS_ERR(host->clk))
|
||||
return PTR_ERR(host->clk);
|
||||
|
||||
ret = clk_prepare_enable(host->clk);
|
||||
if (ret)
|
||||
goto host_free;
|
||||
return ret;
|
||||
|
||||
if (variant->qcom_fifo)
|
||||
host->get_rx_fifocnt = mmci_qcom_get_rx_fifocnt;
|
||||
|
|
@ -2491,8 +2484,6 @@ static int mmci_probe(struct amba_device *dev,
|
|||
|
||||
clk_disable:
|
||||
clk_disable_unprepare(host->clk);
|
||||
host_free:
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2522,7 +2513,6 @@ static void mmci_remove(struct amba_device *dev)
|
|||
|
||||
mmci_dma_release(host);
|
||||
clk_disable_unprepare(host->clk);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -558,41 +558,33 @@ static int moxart_probe(struct platform_device *pdev)
|
|||
int irq, ret;
|
||||
u32 i;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct moxart_host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc) {
|
||||
dev_err(dev, "mmc_alloc_host failed\n");
|
||||
ret = -ENOMEM;
|
||||
goto out_mmc;
|
||||
dev_err(dev, "devm_mmc_alloc_host failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
ret = of_address_to_resource(node, 0, &res_mmc);
|
||||
if (ret) {
|
||||
dev_err(dev, "of_address_to_resource failed\n");
|
||||
goto out_mmc;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"of_address_to_resource failed\n");
|
||||
|
||||
irq = irq_of_parse_and_map(node, 0);
|
||||
if (irq <= 0) {
|
||||
dev_err(dev, "irq_of_parse_and_map failed\n");
|
||||
ret = -EINVAL;
|
||||
goto out_mmc;
|
||||
}
|
||||
if (irq <= 0)
|
||||
return dev_err_probe(dev, -EINVAL,
|
||||
"irq_of_parse_and_map failed\n");
|
||||
|
||||
clk = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
goto out_mmc;
|
||||
}
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
|
||||
reg_mmc = devm_ioremap_resource(dev, &res_mmc);
|
||||
if (IS_ERR(reg_mmc)) {
|
||||
ret = PTR_ERR(reg_mmc);
|
||||
goto out_mmc;
|
||||
}
|
||||
if (IS_ERR(reg_mmc))
|
||||
return PTR_ERR(reg_mmc);
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret)
|
||||
goto out_mmc;
|
||||
return ret;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
|
@ -686,9 +678,6 @@ out:
|
|||
dma_release_channel(host->dma_chan_tx);
|
||||
if (!IS_ERR_OR_NULL(host->dma_chan_rx))
|
||||
dma_release_channel(host->dma_chan_rx);
|
||||
out_mmc:
|
||||
if (mmc)
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -707,7 +696,6 @@ static void moxart_remove(struct platform_device *pdev)
|
|||
writel(0, host->base + REG_POWER_CONTROL);
|
||||
writel(readl(host->base + REG_CLOCK_CONTROL) | CLK_OFF,
|
||||
host->base + REG_CLOCK_CONTROL);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static const struct of_device_id moxart_mmc_match[] = {
|
||||
|
|
|
|||
|
|
@ -706,11 +706,9 @@ static int mvsd_probe(struct platform_device *pdev)
|
|||
if (irq < 0)
|
||||
return irq;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev);
|
||||
if (!mmc) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
|
@ -724,11 +722,9 @@ static int mvsd_probe(struct platform_device *pdev)
|
|||
* fixed rate clock).
|
||||
*/
|
||||
host->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(host->clk)) {
|
||||
dev_err(&pdev->dev, "no clock associated\n");
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (IS_ERR(host->clk))
|
||||
return dev_err_probe(&pdev->dev, -EINVAL, "no clock associated\n");
|
||||
|
||||
clk_prepare_enable(host->clk);
|
||||
|
||||
mmc->ops = &mvsd_ops;
|
||||
|
|
@ -787,12 +783,7 @@ static int mvsd_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
out:
|
||||
if (mmc) {
|
||||
if (!IS_ERR(host->clk))
|
||||
clk_disable_unprepare(host->clk);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
clk_disable_unprepare(host->clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -808,7 +799,6 @@ static void mvsd_remove(struct platform_device *pdev)
|
|||
|
||||
if (!IS_ERR(host->clk))
|
||||
clk_disable_unprepare(host->clk);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static const struct of_device_id mvsdio_dt_ids[] = {
|
||||
|
|
|
|||
|
|
@ -1005,23 +1005,21 @@ static int mxcmci_probe(struct platform_device *pdev)
|
|||
if (irq < 0)
|
||||
return irq;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
|
||||
host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(host->base)) {
|
||||
ret = PTR_ERR(host->base);
|
||||
goto out_free;
|
||||
}
|
||||
if (IS_ERR(host->base))
|
||||
return PTR_ERR(host->base);
|
||||
|
||||
host->phys_base = res->start;
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret)
|
||||
goto out_free;
|
||||
return ret;
|
||||
mmc->ops = &mxcmci_ops;
|
||||
|
||||
/* For devicetree parsing, the bus width is read from devicetree */
|
||||
|
|
@ -1054,7 +1052,7 @@ static int mxcmci_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_regulator_get_supply(mmc);
|
||||
if (ret)
|
||||
goto out_free;
|
||||
return ret;
|
||||
|
||||
if (!mmc->ocr_avail) {
|
||||
if (pdata && pdata->ocr_avail)
|
||||
|
|
@ -1070,20 +1068,16 @@ static int mxcmci_probe(struct platform_device *pdev)
|
|||
host->default_irq_mask = 0;
|
||||
|
||||
host->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
|
||||
if (IS_ERR(host->clk_ipg)) {
|
||||
ret = PTR_ERR(host->clk_ipg);
|
||||
goto out_free;
|
||||
}
|
||||
if (IS_ERR(host->clk_ipg))
|
||||
return PTR_ERR(host->clk_ipg);
|
||||
|
||||
host->clk_per = devm_clk_get(&pdev->dev, "per");
|
||||
if (IS_ERR(host->clk_per)) {
|
||||
ret = PTR_ERR(host->clk_per);
|
||||
goto out_free;
|
||||
}
|
||||
if (IS_ERR(host->clk_per))
|
||||
return PTR_ERR(host->clk_per);
|
||||
|
||||
ret = clk_prepare_enable(host->clk_per);
|
||||
if (ret)
|
||||
goto out_free;
|
||||
return ret;
|
||||
|
||||
ret = clk_prepare_enable(host->clk_ipg);
|
||||
if (ret)
|
||||
|
|
@ -1169,9 +1163,6 @@ out_clk_put:
|
|||
out_clk_per_put:
|
||||
clk_disable_unprepare(host->clk_per);
|
||||
|
||||
out_free:
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1190,8 +1181,6 @@ static void mxcmci_remove(struct platform_device *pdev)
|
|||
|
||||
clk_disable_unprepare(host->clk_per);
|
||||
clk_disable_unprepare(host->clk_ipg);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static int mxcmci_suspend(struct device *dev)
|
||||
|
|
|
|||
|
|
@ -569,7 +569,7 @@ static int mxs_mmc_probe(struct platform_device *pdev)
|
|||
if (irq_err < 0)
|
||||
return irq_err;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct mxs_mmc_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -577,10 +577,8 @@ static int mxs_mmc_probe(struct platform_device *pdev)
|
|||
ssp = &host->ssp;
|
||||
ssp->dev = &pdev->dev;
|
||||
ssp->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(ssp->base)) {
|
||||
ret = PTR_ERR(ssp->base);
|
||||
goto out_mmc_free;
|
||||
}
|
||||
if (IS_ERR(ssp->base))
|
||||
return PTR_ERR(ssp->base);
|
||||
|
||||
ssp->devid = (enum mxs_ssp_id)of_device_get_match_data(&pdev->dev);
|
||||
|
||||
|
|
@ -590,26 +588,23 @@ static int mxs_mmc_probe(struct platform_device *pdev)
|
|||
reg_vmmc = devm_regulator_get(&pdev->dev, "vmmc");
|
||||
if (!IS_ERR(reg_vmmc)) {
|
||||
ret = regulator_enable(reg_vmmc);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev,
|
||||
"Failed to enable vmmc regulator: %d\n", ret);
|
||||
goto out_mmc_free;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"Failed to enable vmmc regulator\n");
|
||||
|
||||
ret = devm_add_action_or_reset(&pdev->dev, mxs_mmc_regulator_disable,
|
||||
reg_vmmc);
|
||||
if (ret)
|
||||
goto out_mmc_free;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssp->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(ssp->clk)) {
|
||||
ret = PTR_ERR(ssp->clk);
|
||||
goto out_mmc_free;
|
||||
}
|
||||
if (IS_ERR(ssp->clk))
|
||||
return PTR_ERR(ssp->clk);
|
||||
|
||||
ret = clk_prepare_enable(ssp->clk);
|
||||
if (ret)
|
||||
goto out_mmc_free;
|
||||
return ret;
|
||||
|
||||
ret = mxs_mmc_reset(host);
|
||||
if (ret) {
|
||||
|
|
@ -668,8 +663,6 @@ out_free_dma:
|
|||
dma_release_channel(ssp->dmach);
|
||||
out_clk_disable:
|
||||
clk_disable_unprepare(ssp->clk);
|
||||
out_mmc_free:
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -685,8 +678,6 @@ static void mxs_mmc_remove(struct platform_device *pdev)
|
|||
dma_release_channel(ssp->dmach);
|
||||
|
||||
clk_disable_unprepare(ssp->clk);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
|||
|
|
@ -1259,7 +1259,7 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
|
|||
struct mmc_host *mmc;
|
||||
int r;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct mmc_omap_slot), host->dev);
|
||||
mmc = devm_mmc_alloc_host(host->dev, sizeof(*slot));
|
||||
if (mmc == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1273,25 +1273,21 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
|
|||
/* Check for some optional GPIO controls */
|
||||
slot->vsd = devm_gpiod_get_index_optional(host->dev, "vsd",
|
||||
id, GPIOD_OUT_LOW);
|
||||
if (IS_ERR(slot->vsd)) {
|
||||
r = dev_err_probe(host->dev, PTR_ERR(slot->vsd),
|
||||
if (IS_ERR(slot->vsd))
|
||||
return dev_err_probe(host->dev, PTR_ERR(slot->vsd),
|
||||
"error looking up VSD GPIO\n");
|
||||
goto err_free_host;
|
||||
}
|
||||
|
||||
slot->vio = devm_gpiod_get_index_optional(host->dev, "vio",
|
||||
id, GPIOD_OUT_LOW);
|
||||
if (IS_ERR(slot->vio)) {
|
||||
r = dev_err_probe(host->dev, PTR_ERR(slot->vio),
|
||||
if (IS_ERR(slot->vio))
|
||||
return dev_err_probe(host->dev, PTR_ERR(slot->vio),
|
||||
"error looking up VIO GPIO\n");
|
||||
goto err_free_host;
|
||||
}
|
||||
|
||||
slot->cover = devm_gpiod_get_index_optional(host->dev, "cover",
|
||||
id, GPIOD_IN);
|
||||
if (IS_ERR(slot->cover)) {
|
||||
r = dev_err_probe(host->dev, PTR_ERR(slot->cover),
|
||||
if (IS_ERR(slot->cover))
|
||||
return dev_err_probe(host->dev, PTR_ERR(slot->cover),
|
||||
"error looking up cover switch GPIO\n");
|
||||
goto err_free_host;
|
||||
}
|
||||
|
||||
host->slots[id] = slot;
|
||||
|
||||
|
|
@ -1351,8 +1347,6 @@ err_remove_slot_name:
|
|||
device_remove_file(&mmc->class_dev, &dev_attr_slot_name);
|
||||
err_remove_host:
|
||||
mmc_remove_host(mmc);
|
||||
err_free_host:
|
||||
mmc_free_host(mmc);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -1370,7 +1364,6 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot *slot)
|
|||
flush_workqueue(slot->host->mmc_omap_wq);
|
||||
|
||||
mmc_remove_host(mmc);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static int mmc_omap_probe(struct platform_device *pdev)
|
||||
|
|
|
|||
|
|
@ -1663,7 +1663,6 @@ static int mmc_regs_show(struct seq_file *s, void *data)
|
|||
seq_printf(s, "CAPA:\t\t0x%08x\n",
|
||||
OMAP_HSMMC_READ(host->base, CAPA));
|
||||
|
||||
pm_runtime_mark_last_busy(host->dev);
|
||||
pm_runtime_put_autosuspend(host->dev);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1798,15 +1797,13 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(base))
|
||||
return PTR_ERR(base);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev);
|
||||
if (!mmc) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret)
|
||||
goto err1;
|
||||
return ret;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
|
@ -1842,7 +1839,7 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(host->fclk)) {
|
||||
ret = PTR_ERR(host->fclk);
|
||||
host->fclk = NULL;
|
||||
goto err1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) {
|
||||
|
|
@ -1956,7 +1953,6 @@ static int omap_hsmmc_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
omap_hsmmc_debugfs(mmc);
|
||||
pm_runtime_mark_last_busy(host->dev);
|
||||
pm_runtime_put_autosuspend(host->dev);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1973,9 +1969,6 @@ err_irq:
|
|||
pm_runtime_put_sync(host->dev);
|
||||
pm_runtime_disable(host->dev);
|
||||
clk_disable_unprepare(host->dbclk);
|
||||
err1:
|
||||
mmc_free_host(mmc);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1995,8 +1988,6 @@ static void omap_hsmmc_remove(struct platform_device *pdev)
|
|||
pm_runtime_disable(host->dev);
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
clk_disable_unprepare(host->dbclk);
|
||||
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
@ -2038,7 +2029,6 @@ static int omap_hsmmc_resume(struct device *dev)
|
|||
if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER))
|
||||
omap_hsmmc_conf_bus_power(host);
|
||||
|
||||
pm_runtime_mark_last_busy(host->dev);
|
||||
pm_runtime_put_autosuspend(host->dev);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ static int owl_mmc_probe(struct platform_device *pdev)
|
|||
struct resource *res;
|
||||
int ret;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct owl_mmc_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*owl_host));
|
||||
if (!mmc) {
|
||||
dev_err(&pdev->dev, "mmc alloc host failed\n");
|
||||
return -ENOMEM;
|
||||
|
|
@ -580,24 +580,18 @@ static int owl_mmc_probe(struct platform_device *pdev)
|
|||
spin_lock_init(&owl_host->lock);
|
||||
|
||||
owl_host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(owl_host->base)) {
|
||||
ret = PTR_ERR(owl_host->base);
|
||||
goto err_free_host;
|
||||
}
|
||||
if (IS_ERR(owl_host->base))
|
||||
return PTR_ERR(owl_host->base);
|
||||
|
||||
owl_host->clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(owl_host->clk)) {
|
||||
dev_err(&pdev->dev, "No clock defined\n");
|
||||
ret = PTR_ERR(owl_host->clk);
|
||||
goto err_free_host;
|
||||
}
|
||||
if (IS_ERR(owl_host->clk))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(owl_host->clk),
|
||||
"No clock defined\n");
|
||||
|
||||
owl_host->reset = devm_reset_control_get_exclusive(&pdev->dev, NULL);
|
||||
if (IS_ERR(owl_host->reset)) {
|
||||
dev_err(&pdev->dev, "Could not get reset control\n");
|
||||
ret = PTR_ERR(owl_host->reset);
|
||||
goto err_free_host;
|
||||
}
|
||||
if (IS_ERR(owl_host->reset))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(owl_host->reset),
|
||||
"Could not get reset control\n");
|
||||
|
||||
mmc->ops = &owl_mmc_ops;
|
||||
mmc->max_blk_count = 512;
|
||||
|
|
@ -616,16 +610,14 @@ static int owl_mmc_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret)
|
||||
goto err_free_host;
|
||||
return ret;
|
||||
|
||||
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
|
||||
pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
|
||||
owl_host->dma = dma_request_chan(&pdev->dev, "mmc");
|
||||
if (IS_ERR(owl_host->dma)) {
|
||||
dev_err(owl_host->dev, "Failed to get external DMA channel.\n");
|
||||
ret = PTR_ERR(owl_host->dma);
|
||||
goto err_free_host;
|
||||
}
|
||||
if (IS_ERR(owl_host->dma))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(owl_host->dma),
|
||||
"Failed to get external DMA channel.\n");
|
||||
|
||||
dev_info(&pdev->dev, "Using %s for DMA transfers\n",
|
||||
dma_chan_name(owl_host->dma));
|
||||
|
|
@ -662,8 +654,6 @@ static int owl_mmc_probe(struct platform_device *pdev)
|
|||
|
||||
err_release_channel:
|
||||
dma_release_channel(owl_host->dma);
|
||||
err_free_host:
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -676,7 +666,6 @@ static void owl_mmc_remove(struct platform_device *pdev)
|
|||
mmc_remove_host(mmc);
|
||||
disable_irq(owl_host->irq);
|
||||
dma_release_channel(owl_host->dma);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
static const struct of_device_id owl_mmc_of_match[] = {
|
||||
|
|
|
|||
|
|
@ -615,11 +615,9 @@ static int pxamci_probe(struct platform_device *pdev)
|
|||
if (irq < 0)
|
||||
return irq;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct pxamci_host), dev);
|
||||
if (!mmc) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
mmc->ops = &pxamci_ops;
|
||||
|
||||
|
|
@ -646,7 +644,7 @@ static int pxamci_probe(struct platform_device *pdev)
|
|||
|
||||
ret = pxamci_of_init(pdev, mmc);
|
||||
if (ret)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
|
@ -655,9 +653,8 @@ static int pxamci_probe(struct platform_device *pdev)
|
|||
|
||||
host->clk = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(host->clk)) {
|
||||
ret = PTR_ERR(host->clk);
|
||||
host->clk = NULL;
|
||||
goto out;
|
||||
return PTR_ERR(host->clk);
|
||||
}
|
||||
|
||||
host->clkrate = clk_get_rate(host->clk);
|
||||
|
|
@ -670,7 +667,7 @@ static int pxamci_probe(struct platform_device *pdev)
|
|||
|
||||
ret = pxamci_init_ocr(host);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
mmc->caps = 0;
|
||||
host->cmdat = 0;
|
||||
|
|
@ -686,10 +683,8 @@ static int pxamci_probe(struct platform_device *pdev)
|
|||
host->imask = MMC_I_MASK_ALL;
|
||||
|
||||
host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &r);
|
||||
if (IS_ERR(host->base)) {
|
||||
ret = PTR_ERR(host->base);
|
||||
goto out;
|
||||
}
|
||||
if (IS_ERR(host->base))
|
||||
return PTR_ERR(host->base);
|
||||
host->res = r;
|
||||
|
||||
/*
|
||||
|
|
@ -704,16 +699,15 @@ static int pxamci_probe(struct platform_device *pdev)
|
|||
ret = devm_request_irq(dev, irq, pxamci_irq, 0,
|
||||
DRIVER_NAME, host);
|
||||
if (ret)
|
||||
goto out;
|
||||
return ret;
|
||||
|
||||
platform_set_drvdata(pdev, mmc);
|
||||
|
||||
host->dma_chan_rx = dma_request_chan(dev, "rx");
|
||||
if (IS_ERR(host->dma_chan_rx)) {
|
||||
dev_err(dev, "unable to request rx dma channel\n");
|
||||
ret = PTR_ERR(host->dma_chan_rx);
|
||||
host->dma_chan_rx = NULL;
|
||||
goto out;
|
||||
return dev_err_probe(dev, PTR_ERR(host->dma_chan_rx),
|
||||
"unable to request rx dma channel\n");
|
||||
}
|
||||
|
||||
host->dma_chan_tx = dma_request_chan(dev, "tx");
|
||||
|
|
@ -771,14 +765,10 @@ static int pxamci_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
out:
|
||||
if (host) {
|
||||
if (host->dma_chan_rx)
|
||||
dma_release_channel(host->dma_chan_rx);
|
||||
if (host->dma_chan_tx)
|
||||
dma_release_channel(host->dma_chan_tx);
|
||||
}
|
||||
if (mmc)
|
||||
mmc_free_host(mmc);
|
||||
if (host->dma_chan_rx)
|
||||
dma_release_channel(host->dma_chan_rx);
|
||||
if (host->dma_chan_tx)
|
||||
dma_release_channel(host->dma_chan_tx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -803,8 +793,6 @@ static void pxamci_remove(struct platform_device *pdev)
|
|||
dmaengine_terminate_all(host->dma_chan_tx);
|
||||
dma_release_channel(host->dma_chan_rx);
|
||||
dma_release_channel(host->dma_chan_tx);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ struct renesas_sdhi {
|
|||
u32 scc_tappos_hs400;
|
||||
const u8 *adjust_hs400_calib_table;
|
||||
bool needs_adjust_hs400;
|
||||
bool card_is_sdio;
|
||||
|
||||
/* Tuning values: 1 for success, 0 for failure */
|
||||
DECLARE_BITMAP(taps, BITS_PER_LONG);
|
||||
|
|
|
|||
|
|
@ -686,9 +686,8 @@ static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
|
|||
/* Set SCC */
|
||||
sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, priv->tap_set);
|
||||
|
||||
/* Enable auto re-tuning */
|
||||
sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL,
|
||||
SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN |
|
||||
(priv->card_is_sdio ? 0 : SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN) |
|
||||
sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL));
|
||||
|
||||
return 0;
|
||||
|
|
@ -778,6 +777,14 @@ static bool renesas_sdhi_manual_correction(struct tmio_mmc_host *host, bool use_
|
|||
if (bad_taps & BIT(new_tap % priv->tap_num))
|
||||
return test_bit(error_tap % priv->tap_num, priv->smpcmp);
|
||||
} else {
|
||||
if (!priv->card_is_sdio &&
|
||||
!(val & SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR)) {
|
||||
u32 smpcmp = sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_SMPCMP);
|
||||
|
||||
/* DAT1 is unmatched because of an SDIO irq */
|
||||
if (smpcmp & (BIT(17) | BIT(1)))
|
||||
return false;
|
||||
}
|
||||
if (val & SH_MOBILE_SDHI_SCC_RVSREQ_RVSERR)
|
||||
return true; /* need retune */
|
||||
else if (val & SH_MOBILE_SDHI_SCC_RVSREQ_REQTAPUP)
|
||||
|
|
@ -828,11 +835,14 @@ static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host,
|
|||
if (mmc_doing_tune(host->mmc))
|
||||
return false;
|
||||
|
||||
if (((mrq->cmd->error == -ETIMEDOUT) ||
|
||||
(mrq->data && mrq->data->error == -ETIMEDOUT)) &&
|
||||
((host->mmc->caps & MMC_CAP_NONREMOVABLE) ||
|
||||
(host->ops.get_cd && host->ops.get_cd(host->mmc))))
|
||||
ret |= true;
|
||||
/* mrq can be NULL to check SCC error on SDIO irq without any request */
|
||||
if (mrq) {
|
||||
if (((mrq->cmd->error == -ETIMEDOUT) ||
|
||||
(mrq->data && mrq->data->error == -ETIMEDOUT)) &&
|
||||
((host->mmc->caps & MMC_CAP_NONREMOVABLE) ||
|
||||
(host->ops.get_cd && host->ops.get_cd(host->mmc))))
|
||||
ret |= true;
|
||||
}
|
||||
|
||||
if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL) &
|
||||
SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN)
|
||||
|
|
@ -843,6 +853,28 @@ static bool renesas_sdhi_check_scc_error(struct tmio_mmc_host *host,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void renesas_sdhi_init_card(struct mmc_host *mmc, struct mmc_card *card)
|
||||
{
|
||||
struct tmio_mmc_host *host = mmc_priv(mmc);
|
||||
struct renesas_sdhi *priv = host_to_priv(host);
|
||||
|
||||
/*
|
||||
* This controller cannot do auto-retune with SDIO irqs, so we
|
||||
* then need to enforce manual correction. However, when tuning,
|
||||
* mmc->card is not populated yet, so we don't know if the card
|
||||
* is SDIO. init_card provides this information earlier, so we
|
||||
* keep a copy of it.
|
||||
*/
|
||||
priv->card_is_sdio = mmc_card_sdio(card);
|
||||
}
|
||||
|
||||
static void renesas_sdhi_sdio_irq(struct tmio_mmc_host *host)
|
||||
{
|
||||
/* This controller requires retune when an SDIO irq occurs */
|
||||
if (renesas_sdhi_check_scc_error(host, NULL))
|
||||
mmc_retune_needed(host->mmc);
|
||||
}
|
||||
|
||||
static int renesas_sdhi_wait_idle(struct tmio_mmc_host *host, u32 bit)
|
||||
{
|
||||
int timeout = 1000;
|
||||
|
|
@ -1164,7 +1196,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
|
|||
|
||||
ret = renesas_sdhi_clk_enable(host);
|
||||
if (ret)
|
||||
goto efree;
|
||||
return ret;
|
||||
|
||||
rcfg.of_node = of_get_available_child_by_name(dev->of_node, "vqmmc-regulator");
|
||||
if (rcfg.of_node) {
|
||||
|
|
@ -1227,6 +1259,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
|
|||
dev_warn(&host->pdev->dev, "Unknown clock rate for tuning\n");
|
||||
|
||||
host->check_retune = renesas_sdhi_check_scc_error;
|
||||
host->sdio_irq = renesas_sdhi_sdio_irq;
|
||||
host->ops.init_card = renesas_sdhi_init_card;
|
||||
host->ops.execute_tuning = renesas_sdhi_execute_tuning;
|
||||
host->ops.prepare_hs400_tuning = renesas_sdhi_prepare_hs400_tuning;
|
||||
host->ops.hs400_downgrade = renesas_sdhi_disable_scc;
|
||||
|
|
@ -1266,9 +1300,6 @@ int renesas_sdhi_probe(struct platform_device *pdev,
|
|||
|
||||
edisclk:
|
||||
renesas_sdhi_clk_disable(host);
|
||||
efree:
|
||||
tmio_mmc_host_free(host);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(renesas_sdhi_probe);
|
||||
|
|
@ -1279,7 +1310,6 @@ void renesas_sdhi_remove(struct platform_device *pdev)
|
|||
|
||||
tmio_mmc_host_remove(host);
|
||||
renesas_sdhi_clk_disable(host);
|
||||
tmio_mmc_host_free(host);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(renesas_sdhi_remove);
|
||||
|
||||
|
|
|
|||
|
|
@ -1498,7 +1498,7 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
|
|||
|
||||
dev_dbg(&(pdev->dev), ": Realtek PCI-E SDMMC controller found\n");
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1529,7 +1529,6 @@ static int rtsx_pci_sdmmc_drv_probe(struct platform_device *pdev)
|
|||
if (ret) {
|
||||
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1572,8 +1571,6 @@ static void rtsx_pci_sdmmc_drv_remove(struct platform_device *pdev)
|
|||
pm_runtime_dont_use_autosuspend(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
|
||||
dev_dbg(&(pdev->dev),
|
||||
": Realtek PCI-E SDMMC controller has been removed\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1010,29 +1010,45 @@ static int sd_power_off(struct rtsx_usb_sdmmc *host)
|
|||
return sd_pull_ctl_disable_qfn24(ucr);
|
||||
}
|
||||
|
||||
static int sd_set_power_mode(struct rtsx_usb_sdmmc *host,
|
||||
static void sd_set_power_mode(struct rtsx_usb_sdmmc *host,
|
||||
unsigned char power_mode)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (power_mode != MMC_POWER_OFF)
|
||||
power_mode = MMC_POWER_ON;
|
||||
struct rtsx_ucr *ucr = host->ucr;
|
||||
|
||||
if (power_mode == host->power_mode)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
if (power_mode == MMC_POWER_OFF) {
|
||||
switch (power_mode) {
|
||||
case MMC_POWER_OFF:
|
||||
err = sd_power_off(host);
|
||||
if (err)
|
||||
dev_dbg(sdmmc_dev(host), "power-off (err = %d)\n", err);
|
||||
pm_runtime_put_noidle(sdmmc_dev(host));
|
||||
} else {
|
||||
break;
|
||||
|
||||
case MMC_POWER_UP:
|
||||
pm_runtime_get_noresume(sdmmc_dev(host));
|
||||
err = sd_power_on(host);
|
||||
if (err)
|
||||
dev_dbg(sdmmc_dev(host), "power-on (err = %d)\n", err);
|
||||
/* issue the clock signals to card at least 74 clocks */
|
||||
rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, SD_CLK_TOGGLE_EN);
|
||||
break;
|
||||
|
||||
case MMC_POWER_ON:
|
||||
/* stop to send the clock signals */
|
||||
rtsx_usb_write_register(ucr, SD_BUS_STAT, SD_CLK_TOGGLE_EN, 0x00);
|
||||
break;
|
||||
|
||||
case MMC_POWER_UNDEFINED:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!err)
|
||||
host->power_mode = power_mode;
|
||||
|
||||
return err;
|
||||
host->power_mode = power_mode;
|
||||
}
|
||||
|
||||
static int sd_set_timing(struct rtsx_usb_sdmmc *host,
|
||||
|
|
@ -1334,7 +1350,7 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
|
|||
|
||||
dev_dbg(&(pdev->dev), ": Realtek USB SD/MMC controller found\n");
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(*host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1368,7 +1384,6 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev)
|
|||
#ifdef RTSX_USB_USE_LEDS_CLASS
|
||||
led_classdev_unregister(&host->led);
|
||||
#endif
|
||||
mmc_free_host(mmc);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1406,7 +1421,6 @@ static void rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev)
|
|||
led_classdev_unregister(&host->led);
|
||||
#endif
|
||||
|
||||
mmc_free_host(mmc);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -948,7 +948,6 @@ err_free:
|
|||
if (c->slot && c->slot->free_slot)
|
||||
c->slot->free_slot(pdev);
|
||||
|
||||
sdhci_free_host(c->host);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -972,8 +971,6 @@ static void sdhci_acpi_remove(struct platform_device *pdev)
|
|||
|
||||
if (c->slot && c->slot->free_slot)
|
||||
c->slot->free_slot(pdev);
|
||||
|
||||
sdhci_free_host(c->host);
|
||||
}
|
||||
|
||||
static void __maybe_unused sdhci_acpi_reset_signal_voltage_if_needed(
|
||||
|
|
@ -1028,14 +1025,11 @@ static int sdhci_acpi_runtime_suspend(struct device *dev)
|
|||
{
|
||||
struct sdhci_acpi_host *c = dev_get_drvdata(dev);
|
||||
struct sdhci_host *host = c->host;
|
||||
int ret;
|
||||
|
||||
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
mmc_retune_needed(host->mmc);
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
if (ret)
|
||||
return ret;
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
sdhci_acpi_reset_signal_voltage_if_needed(dev);
|
||||
return 0;
|
||||
|
|
@ -1047,7 +1041,8 @@ static int sdhci_acpi_runtime_resume(struct device *dev)
|
|||
|
||||
sdhci_acpi_byt_setting(&c->pdev->dev);
|
||||
|
||||
return sdhci_runtime_resume_host(c->host, 0);
|
||||
sdhci_runtime_resume_host(c->host, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -304,8 +304,6 @@ err_clk_disable:
|
|||
clk_disable_unprepare(pltfm_priv->clk);
|
||||
|
||||
err_pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
|
||||
dev_err(dev, "Probing of sdhci-pltfm failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -485,7 +485,6 @@ add_host:
|
|||
return res;
|
||||
|
||||
err:
|
||||
sdhci_pltfm_free(pdev);
|
||||
clk_disable_unprepare(base_clk);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ static unsigned int sdhci_cdns_phy_param_count(struct device_node *np)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(sdhci_cdns_phy_cfgs); i++)
|
||||
if (of_property_read_bool(np, sdhci_cdns_phy_cfgs[i].property))
|
||||
if (of_property_present(np, sdhci_cdns_phy_cfgs[i].property))
|
||||
count++;
|
||||
|
||||
return count;
|
||||
|
|
@ -433,6 +433,13 @@ static const struct sdhci_cdns_drv_data sdhci_elba_drv_data = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct sdhci_cdns_drv_data sdhci_eyeq_drv_data = {
|
||||
.pltfm_data = {
|
||||
.ops = &sdhci_cdns_ops,
|
||||
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
|
||||
},
|
||||
};
|
||||
|
||||
static const struct sdhci_cdns_drv_data sdhci_cdns_drv_data = {
|
||||
.pltfm_data = {
|
||||
.ops = &sdhci_cdns_ops,
|
||||
|
|
@ -515,7 +522,7 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
|
|||
if (data->init) {
|
||||
ret = data->init(pdev);
|
||||
if (ret)
|
||||
goto free;
|
||||
return ret;
|
||||
}
|
||||
sdhci_enable_v4_mode(host);
|
||||
__sdhci_read_caps(host, &version, NULL, NULL);
|
||||
|
|
@ -524,33 +531,24 @@ static int sdhci_cdns_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto free;
|
||||
return ret;
|
||||
|
||||
sdhci_cdns_phy_param_parse(dev->of_node, priv);
|
||||
|
||||
ret = sdhci_cdns_phy_init(priv);
|
||||
if (ret)
|
||||
goto free;
|
||||
return ret;
|
||||
|
||||
if (host->mmc->caps & MMC_CAP_HW_RESET) {
|
||||
priv->rst_hw = devm_reset_control_get_optional_exclusive(dev, NULL);
|
||||
if (IS_ERR(priv->rst_hw)) {
|
||||
ret = dev_err_probe(mmc_dev(host->mmc), PTR_ERR(priv->rst_hw),
|
||||
if (IS_ERR(priv->rst_hw))
|
||||
return dev_err_probe(mmc_dev(host->mmc), PTR_ERR(priv->rst_hw),
|
||||
"reset controller error\n");
|
||||
goto free;
|
||||
}
|
||||
if (priv->rst_hw)
|
||||
host->mmc_host_ops.card_hw_reset = sdhci_cdns_mmc_hw_reset;
|
||||
}
|
||||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
goto free;
|
||||
|
||||
return 0;
|
||||
free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
return sdhci_add_host(host);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
@ -595,6 +593,10 @@ static const struct of_device_id sdhci_cdns_match[] = {
|
|||
.compatible = "amd,pensando-elba-sd4hc",
|
||||
.data = &sdhci_elba_drv_data,
|
||||
},
|
||||
{
|
||||
.compatible = "mobileye,eyeq-sd4hc",
|
||||
.data = &sdhci_eyeq_drv_data,
|
||||
},
|
||||
{ .compatible = "cdns,sd4hc" },
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -79,17 +79,9 @@ static int sdhci_dove_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto err_sdhci_add;
|
||||
return ret;
|
||||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
goto err_sdhci_add;
|
||||
|
||||
return 0;
|
||||
|
||||
err_sdhci_add:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
return sdhci_add_host(host);
|
||||
}
|
||||
|
||||
static const struct of_device_id sdhci_dove_of_match_table[] = {
|
||||
|
|
|
|||
|
|
@ -212,6 +212,9 @@
|
|||
/* The IP does not have GPIO CD wake capabilities */
|
||||
#define ESDHC_FLAG_SKIP_CD_WAKE BIT(18)
|
||||
|
||||
/* the controller has dummy pad for clock loopback */
|
||||
#define ESDHC_FLAG_DUMMY_PAD BIT(19)
|
||||
|
||||
#define ESDHC_AUTO_TUNING_WINDOW 3
|
||||
|
||||
enum wp_types {
|
||||
|
|
@ -348,6 +351,15 @@ static struct esdhc_soc_data usdhc_imx8mm_data = {
|
|||
.quirks = SDHCI_QUIRK_NO_LED,
|
||||
};
|
||||
|
||||
static struct esdhc_soc_data usdhc_imx95_data = {
|
||||
.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_MAN_TUNING
|
||||
| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
|
||||
| ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES
|
||||
| ESDHC_FLAG_STATE_LOST_IN_LPMODE
|
||||
| ESDHC_FLAG_DUMMY_PAD,
|
||||
.quirks = SDHCI_QUIRK_NO_LED,
|
||||
};
|
||||
|
||||
struct pltfm_imx_data {
|
||||
u32 scratchpad;
|
||||
struct pinctrl *pinctrl;
|
||||
|
|
@ -392,6 +404,8 @@ static const struct of_device_id imx_esdhc_dt_ids[] = {
|
|||
{ .compatible = "fsl,imx7ulp-usdhc", .data = &usdhc_imx7ulp_data, },
|
||||
{ .compatible = "fsl,imx8qxp-usdhc", .data = &usdhc_imx8qxp_data, },
|
||||
{ .compatible = "fsl,imx8mm-usdhc", .data = &usdhc_imx8mm_data, },
|
||||
{ .compatible = "fsl,imx94-usdhc", .data = &usdhc_imx95_data, },
|
||||
{ .compatible = "fsl,imx95-usdhc", .data = &usdhc_imx95_data, },
|
||||
{ .compatible = "fsl,imxrt1050-usdhc", .data = &usdhc_imxrt1050_data, },
|
||||
{ .compatible = "nxp,s32g2-usdhc", .data = &usdhc_s32g2_data, },
|
||||
{ /* sentinel */ }
|
||||
|
|
@ -728,23 +742,17 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg)
|
|||
writel(new_val, host->ioaddr + ESDHC_VENDOR_SPEC);
|
||||
if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) {
|
||||
u32 v = readl(host->ioaddr + SDHCI_AUTO_CMD_STATUS);
|
||||
u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL);
|
||||
if (val & SDHCI_CTRL_TUNED_CLK) {
|
||||
if (val & SDHCI_CTRL_TUNED_CLK)
|
||||
v |= ESDHC_MIX_CTRL_SMPCLK_SEL;
|
||||
} else {
|
||||
else
|
||||
v &= ~ESDHC_MIX_CTRL_SMPCLK_SEL;
|
||||
m &= ~ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
}
|
||||
|
||||
if (val & SDHCI_CTRL_EXEC_TUNING) {
|
||||
if (val & SDHCI_CTRL_EXEC_TUNING)
|
||||
v |= ESDHC_MIX_CTRL_EXE_TUNE;
|
||||
m |= ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
} else {
|
||||
else
|
||||
v &= ~ESDHC_MIX_CTRL_EXE_TUNE;
|
||||
}
|
||||
|
||||
writel(v, host->ioaddr + SDHCI_AUTO_CMD_STATUS);
|
||||
writel(m, host->ioaddr + ESDHC_MIX_CTRL);
|
||||
}
|
||||
return;
|
||||
case SDHCI_TRANSFER_MODE:
|
||||
|
|
@ -1082,7 +1090,6 @@ static void esdhc_reset_tuning(struct sdhci_host *host)
|
|||
ctrl &= ~ESDHC_MIX_CTRL_AUTO_TUNE_EN;
|
||||
if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) {
|
||||
ctrl &= ~ESDHC_MIX_CTRL_SMPCLK_SEL;
|
||||
ctrl &= ~ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
writel(ctrl, host->ioaddr + ESDHC_MIX_CTRL);
|
||||
writel(0, host->ioaddr + ESDHC_TUNE_CTRL_STATUS);
|
||||
} else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) {
|
||||
|
|
@ -1177,8 +1184,7 @@ static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val)
|
|||
"warning! RESET_ALL never complete before sending tuning command\n");
|
||||
|
||||
reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
|
||||
reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL |
|
||||
ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
reg |= ESDHC_MIX_CTRL_EXE_TUNE | ESDHC_MIX_CTRL_SMPCLK_SEL;
|
||||
writel(reg, host->ioaddr + ESDHC_MIX_CTRL);
|
||||
writel(FIELD_PREP(ESDHC_TUNE_CTRL_STATUS_DLY_CELL_SET_PRE_MASK, val),
|
||||
host->ioaddr + ESDHC_TUNE_CTRL_STATUS);
|
||||
|
|
@ -1432,6 +1438,16 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!(imx_data->socdata->flags & ESDHC_FLAG_DUMMY_PAD) &&
|
||||
(timing == MMC_TIMING_UHS_SDR104 ||
|
||||
timing == MMC_TIMING_MMC_HS200 ||
|
||||
timing == MMC_TIMING_MMC_HS400))
|
||||
m |= ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
else
|
||||
m &= ~ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
|
||||
writel(m, host->ioaddr + ESDHC_MIX_CTRL);
|
||||
|
||||
esdhc_change_pinstate(host, timing);
|
||||
}
|
||||
|
||||
|
|
@ -1677,7 +1693,9 @@ static void sdhc_esdhc_tuning_restore(struct sdhci_host *host)
|
|||
writel(reg, host->ioaddr + ESDHC_TUNING_CTRL);
|
||||
|
||||
reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
|
||||
reg |= ESDHC_MIX_CTRL_SMPCLK_SEL | ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
reg |= ESDHC_MIX_CTRL_SMPCLK_SEL;
|
||||
if (!(imx_data->socdata->flags & ESDHC_FLAG_DUMMY_PAD))
|
||||
reg |= ESDHC_MIX_CTRL_FBCLK_SEL;
|
||||
writel(reg, host->ioaddr + ESDHC_MIX_CTRL);
|
||||
|
||||
writel(FIELD_PREP(ESDHC_TUNE_CTRL_STATUS_DLY_CELL_SET_PRE_MASK,
|
||||
|
|
@ -1973,7 +1991,6 @@ disable_per_clk:
|
|||
free_sdhci:
|
||||
if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
|
||||
cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
|
||||
sdhci_pltfm_free(pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1997,8 +2014,6 @@ static void sdhci_esdhc_imx_remove(struct platform_device *pdev)
|
|||
|
||||
if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
|
||||
cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
|
||||
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
@ -2039,12 +2054,20 @@ static int sdhci_esdhc_suspend(struct device *dev)
|
|||
ret = sdhci_enable_irq_wakeups(host);
|
||||
if (!ret)
|
||||
dev_warn(dev, "Failed to enable irq wakeup\n");
|
||||
} else {
|
||||
/*
|
||||
* For the device which works as wakeup source, no need
|
||||
* to change the pinctrl to sleep state.
|
||||
* e.g. For SDIO device, the interrupt share with data pin,
|
||||
* but the pinctrl sleep state may config the data pin to
|
||||
* other function like GPIO function to save power in PM,
|
||||
* which finally block the SDIO wakeup function.
|
||||
*/
|
||||
ret = pinctrl_pm_select_sleep_state(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = pinctrl_pm_select_sleep_state(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = mmc_gpio_set_cd_wake(host->mmc, true);
|
||||
|
||||
/*
|
||||
|
|
@ -2085,7 +2108,6 @@ static int sdhci_esdhc_resume(struct device *dev)
|
|||
esdhc_is_usdhc(imx_data))
|
||||
sdhc_esdhc_tuning_restore(host);
|
||||
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
return ret;
|
||||
|
|
@ -2106,9 +2128,7 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
if (ret)
|
||||
return ret;
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
mmc_retune_needed(host->mmc);
|
||||
|
|
@ -2122,7 +2142,7 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev)
|
|||
if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS)
|
||||
cpu_latency_qos_remove_request(&imx_data->pm_qos_req);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sdhci_esdhc_runtime_resume(struct device *dev)
|
||||
|
|
@ -2152,17 +2172,13 @@ static int sdhci_esdhc_runtime_resume(struct device *dev)
|
|||
|
||||
esdhc_pltfm_set_clock(host, imx_data->actual_clock);
|
||||
|
||||
err = sdhci_runtime_resume_host(host, 0);
|
||||
if (err)
|
||||
goto disable_ipg_clk;
|
||||
sdhci_runtime_resume_host(host, 0);
|
||||
|
||||
if (host->mmc->caps2 & MMC_CAP2_CQE)
|
||||
err = cqhci_resume(host->mmc);
|
||||
|
||||
return err;
|
||||
|
||||
disable_ipg_clk:
|
||||
clk_disable_unprepare(imx_data->clk_ipg);
|
||||
disable_per_clk:
|
||||
clk_disable_unprepare(imx_data->clk_per);
|
||||
disable_ahb_clk:
|
||||
|
|
|
|||
|
|
@ -426,28 +426,22 @@ static int sdhci_esdhc_mcf_probe(struct platform_device *pdev)
|
|||
host->flags |= SDHCI_AUTO_CMD12;
|
||||
|
||||
mcf_data->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
|
||||
if (IS_ERR(mcf_data->clk_ipg)) {
|
||||
err = PTR_ERR(mcf_data->clk_ipg);
|
||||
goto err_exit;
|
||||
}
|
||||
if (IS_ERR(mcf_data->clk_ipg))
|
||||
return PTR_ERR(mcf_data->clk_ipg);
|
||||
|
||||
mcf_data->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
|
||||
if (IS_ERR(mcf_data->clk_ahb)) {
|
||||
err = PTR_ERR(mcf_data->clk_ahb);
|
||||
goto err_exit;
|
||||
}
|
||||
if (IS_ERR(mcf_data->clk_ahb))
|
||||
return PTR_ERR(mcf_data->clk_ahb);
|
||||
|
||||
mcf_data->clk_per = devm_clk_get(&pdev->dev, "per");
|
||||
if (IS_ERR(mcf_data->clk_per)) {
|
||||
err = PTR_ERR(mcf_data->clk_per);
|
||||
goto err_exit;
|
||||
}
|
||||
if (IS_ERR(mcf_data->clk_per))
|
||||
return PTR_ERR(mcf_data->clk_per);
|
||||
|
||||
pltfm_host->clk = mcf_data->clk_per;
|
||||
pltfm_host->clock = clk_get_rate(pltfm_host->clk);
|
||||
err = clk_prepare_enable(mcf_data->clk_per);
|
||||
if (err)
|
||||
goto err_exit;
|
||||
return err;
|
||||
|
||||
err = clk_prepare_enable(mcf_data->clk_ipg);
|
||||
if (err)
|
||||
|
|
@ -485,9 +479,6 @@ unprep_ipg:
|
|||
clk_disable_unprepare(mcf_data->clk_ipg);
|
||||
unprep_per:
|
||||
clk_disable_unprepare(mcf_data->clk_per);
|
||||
err_exit:
|
||||
sdhci_pltfm_free(pdev);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -502,8 +493,6 @@ static void sdhci_esdhc_mcf_remove(struct platform_device *pdev)
|
|||
clk_disable_unprepare(mcf_data->clk_ipg);
|
||||
clk_disable_unprepare(mcf_data->clk_ahb);
|
||||
clk_disable_unprepare(mcf_data->clk_per);
|
||||
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
static struct platform_driver sdhci_esdhc_mcf_driver = {
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
sdhci_get_property(pdev);
|
||||
|
||||
|
|
@ -387,10 +387,8 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
|
|||
|
||||
if (dev->of_node) {
|
||||
pltfm_host->clk = devm_clk_get_enabled(dev, NULL);
|
||||
if (IS_ERR(pltfm_host->clk)) {
|
||||
ret = PTR_ERR(pltfm_host->clk);
|
||||
goto err;
|
||||
}
|
||||
if (IS_ERR(pltfm_host->clk))
|
||||
return PTR_ERR(pltfm_host->clk);
|
||||
}
|
||||
|
||||
if (iproc_host->data->missing_caps) {
|
||||
|
|
@ -399,15 +397,7 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
|
|||
&iproc_host->data->caps1);
|
||||
}
|
||||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
return sdhci_add_host(host);
|
||||
}
|
||||
|
||||
static void sdhci_iproc_shutdown(struct platform_device *pdev)
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
platform_set_drvdata(pdev, host);
|
||||
|
||||
|
|
@ -267,23 +267,19 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev)
|
|||
host->irq = irq;
|
||||
|
||||
host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(host->ioaddr)) {
|
||||
ret = PTR_ERR(host->ioaddr);
|
||||
goto err;
|
||||
}
|
||||
if (IS_ERR(host->ioaddr))
|
||||
return PTR_ERR(host->ioaddr);
|
||||
|
||||
if (dev_of_node(dev)) {
|
||||
sdhci_get_of_property(pdev);
|
||||
|
||||
priv->clk_iface = devm_clk_get(&pdev->dev, "iface");
|
||||
if (IS_ERR(priv->clk_iface)) {
|
||||
ret = PTR_ERR(priv->clk_iface);
|
||||
goto err;
|
||||
}
|
||||
if (IS_ERR(priv->clk_iface))
|
||||
return PTR_ERR(priv->clk_iface);
|
||||
|
||||
ret = clk_prepare_enable(priv->clk_iface);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
priv->clk = devm_clk_get(&pdev->dev, "core");
|
||||
if (IS_ERR(priv->clk)) {
|
||||
|
|
@ -308,8 +304,6 @@ err_add_host:
|
|||
clk_disable_unprepare(priv->clk);
|
||||
err_clk:
|
||||
clk_disable_unprepare(priv->clk_iface);
|
||||
err:
|
||||
sdhci_free_host(host);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +318,6 @@ static void sdhci_milbeaut_remove(struct platform_device *pdev)
|
|||
clk_disable_unprepare(priv->clk_iface);
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
sdhci_free_host(host);
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1564,6 +1564,7 @@ static void sdhci_msm_check_power_status(struct sdhci_host *host, u32 req_type)
|
|||
{
|
||||
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||||
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
|
||||
struct mmc_host *mmc = host->mmc;
|
||||
bool done = false;
|
||||
u32 val = SWITCHABLE_SIGNALING_VOLTAGE;
|
||||
const struct sdhci_msm_offset *msm_offset =
|
||||
|
|
@ -1621,6 +1622,12 @@ static void sdhci_msm_check_power_status(struct sdhci_host *host, u32 req_type)
|
|||
"%s: pwr_irq for req: (%d) timed out\n",
|
||||
mmc_hostname(host->mmc), req_type);
|
||||
}
|
||||
|
||||
if ((req_type & REQ_BUS_ON) && mmc->card && !mmc->ops->get_cd(mmc)) {
|
||||
sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
|
||||
host->pwr = 0;
|
||||
}
|
||||
|
||||
pr_debug("%s: %s: request %d done\n", mmc_hostname(host->mmc),
|
||||
__func__, req_type);
|
||||
}
|
||||
|
|
@ -1679,6 +1686,13 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq)
|
|||
udelay(10);
|
||||
}
|
||||
|
||||
if ((irq_status & CORE_PWRCTL_BUS_ON) && mmc->card &&
|
||||
!mmc->ops->get_cd(mmc)) {
|
||||
msm_host_writel(msm_host, CORE_PWRCTL_BUS_FAIL, host,
|
||||
msm_offset->core_pwrctl_ctl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle BUS ON/OFF*/
|
||||
if (irq_status & CORE_PWRCTL_BUS_ON) {
|
||||
pwr_state = REQ_BUS_ON;
|
||||
|
|
@ -2526,7 +2540,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto pltfm_free;
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* Based on the compatible string, load the required msm host info from
|
||||
|
|
@ -2548,7 +2562,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
|
|||
|
||||
ret = sdhci_msm_gcc_reset(&pdev->dev, host);
|
||||
if (ret)
|
||||
goto pltfm_free;
|
||||
return ret;
|
||||
|
||||
/* Setup SDCC bus voter clock. */
|
||||
msm_host->bus_clk = devm_clk_get(&pdev->dev, "bus");
|
||||
|
|
@ -2556,10 +2570,10 @@ static int sdhci_msm_probe(struct platform_device *pdev)
|
|||
/* Vote for max. clk rate for max. performance */
|
||||
ret = clk_set_rate(msm_host->bus_clk, INT_MAX);
|
||||
if (ret)
|
||||
goto pltfm_free;
|
||||
return ret;
|
||||
ret = clk_prepare_enable(msm_host->bus_clk);
|
||||
if (ret)
|
||||
goto pltfm_free;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Setup main peripheral bus clock */
|
||||
|
|
@ -2750,7 +2764,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
goto pm_runtime_disable;
|
||||
|
||||
pm_runtime_mark_last_busy(&pdev->dev);
|
||||
pm_runtime_put_autosuspend(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
|
@ -2765,8 +2778,6 @@ clk_disable:
|
|||
bus_clk_disable:
|
||||
if (!IS_ERR(msm_host->bus_clk))
|
||||
clk_disable_unprepare(msm_host->bus_clk);
|
||||
pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -2788,7 +2799,6 @@ static void sdhci_msm_remove(struct platform_device *pdev)
|
|||
msm_host->bulk_clks);
|
||||
if (!IS_ERR(msm_host->bus_clk))
|
||||
clk_disable_unprepare(msm_host->bus_clk);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
|
||||
|
|
|
|||
|
|
@ -48,8 +48,7 @@ static int npcm_sdhci_probe(struct platform_device *pdev)
|
|||
|
||||
pltfm_host->clk = devm_clk_get_optional_enabled(dev, NULL);
|
||||
if (IS_ERR(pltfm_host->clk)) {
|
||||
ret = PTR_ERR(pltfm_host->clk);
|
||||
goto err_sdhci;
|
||||
return PTR_ERR(pltfm_host->clk);
|
||||
}
|
||||
|
||||
caps = sdhci_readl(host, SDHCI_CAPABILITIES);
|
||||
|
|
@ -58,17 +57,9 @@ static int npcm_sdhci_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto err_sdhci;
|
||||
return ret;
|
||||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
goto err_sdhci;
|
||||
|
||||
return 0;
|
||||
|
||||
err_sdhci:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
return sdhci_add_host(host);
|
||||
}
|
||||
|
||||
static const struct of_device_id npcm_sdhci_of_match[] = {
|
||||
|
|
|
|||
|
|
@ -1883,34 +1883,26 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
|
|||
sdhci_arasan->soc_ctl_base = syscon_node_to_regmap(node);
|
||||
of_node_put(node);
|
||||
|
||||
if (IS_ERR(sdhci_arasan->soc_ctl_base)) {
|
||||
ret = dev_err_probe(dev,
|
||||
if (IS_ERR(sdhci_arasan->soc_ctl_base))
|
||||
return dev_err_probe(dev,
|
||||
PTR_ERR(sdhci_arasan->soc_ctl_base),
|
||||
"Can't get syscon\n");
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
}
|
||||
|
||||
sdhci_get_of_property(pdev);
|
||||
|
||||
sdhci_arasan->clk_ahb = devm_clk_get(dev, "clk_ahb");
|
||||
if (IS_ERR(sdhci_arasan->clk_ahb)) {
|
||||
ret = dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
|
||||
if (IS_ERR(sdhci_arasan->clk_ahb))
|
||||
return dev_err_probe(dev, PTR_ERR(sdhci_arasan->clk_ahb),
|
||||
"clk_ahb clock not found.\n");
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
|
||||
clk_xin = devm_clk_get(dev, "clk_xin");
|
||||
if (IS_ERR(clk_xin)) {
|
||||
ret = dev_err_probe(dev, PTR_ERR(clk_xin), "clk_xin clock not found.\n");
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
if (IS_ERR(clk_xin))
|
||||
return dev_err_probe(dev, PTR_ERR(clk_xin), "clk_xin clock not found.\n");
|
||||
|
||||
ret = clk_prepare_enable(sdhci_arasan->clk_ahb);
|
||||
if (ret) {
|
||||
dev_err(dev, "Unable to enable AHB clock.\n");
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Unable to enable AHB clock.\n");
|
||||
|
||||
/* If clock-frequency property is set, use the provided value */
|
||||
if (pltfm_host->clock &&
|
||||
|
|
@ -2029,8 +2021,6 @@ clk_disable_all:
|
|||
clk_disable_unprepare(clk_xin);
|
||||
clk_dis_ahb:
|
||||
clk_disable_unprepare(sdhci_arasan->clk_ahb);
|
||||
err_pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -425,10 +425,8 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
|
|||
return PTR_ERR(pltfm_host->clk);
|
||||
|
||||
ret = clk_prepare_enable(pltfm_host->clk);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Unable to enable SDIO clock\n");
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret, "Unable to enable SDIO clock\n");
|
||||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
|
|
@ -445,8 +443,6 @@ static int aspeed_sdhci_probe(struct platform_device *pdev)
|
|||
|
||||
err_sdhci_add:
|
||||
clk_disable_unprepare(pltfm_host->clk);
|
||||
err_pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -461,8 +457,6 @@ static void aspeed_sdhci_remove(struct platform_device *pdev)
|
|||
sdhci_remove_host(host, 0);
|
||||
|
||||
clk_disable_unprepare(pltfm_host->clk);
|
||||
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
static const struct aspeed_sdhci_pdata ast2400_sdhci_pdata = {
|
||||
|
|
|
|||
|
|
@ -251,9 +251,8 @@ static int sdhci_at91_runtime_suspend(struct device *dev)
|
|||
struct sdhci_host *host = dev_get_drvdata(dev);
|
||||
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||||
struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host);
|
||||
int ret;
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
mmc_retune_needed(host->mmc);
|
||||
|
|
@ -262,7 +261,7 @@ static int sdhci_at91_runtime_suspend(struct device *dev)
|
|||
clk_disable_unprepare(priv->hclock);
|
||||
clk_disable_unprepare(priv->mainck);
|
||||
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sdhci_at91_runtime_resume(struct device *dev)
|
||||
|
|
@ -300,7 +299,8 @@ static int sdhci_at91_runtime_resume(struct device *dev)
|
|||
}
|
||||
|
||||
out:
|
||||
return sdhci_runtime_resume_host(host, 0);
|
||||
sdhci_runtime_resume_host(host, 0);
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
|
|
@ -333,32 +333,26 @@ static int sdhci_at91_probe(struct platform_device *pdev)
|
|||
|
||||
priv->mainck = devm_clk_get(&pdev->dev, "baseclk");
|
||||
if (IS_ERR(priv->mainck)) {
|
||||
if (soc_data->baseclk_is_generated_internally) {
|
||||
if (soc_data->baseclk_is_generated_internally)
|
||||
priv->mainck = NULL;
|
||||
} else {
|
||||
dev_err(&pdev->dev, "failed to get baseclk\n");
|
||||
ret = PTR_ERR(priv->mainck);
|
||||
goto sdhci_pltfm_free;
|
||||
}
|
||||
else
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(priv->mainck),
|
||||
"failed to get baseclk\n");
|
||||
}
|
||||
|
||||
priv->hclock = devm_clk_get(&pdev->dev, "hclock");
|
||||
if (IS_ERR(priv->hclock)) {
|
||||
dev_err(&pdev->dev, "failed to get hclock\n");
|
||||
ret = PTR_ERR(priv->hclock);
|
||||
goto sdhci_pltfm_free;
|
||||
}
|
||||
if (IS_ERR(priv->hclock))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(priv->hclock),
|
||||
"failed to get hclock\n");
|
||||
|
||||
priv->gck = devm_clk_get(&pdev->dev, "multclk");
|
||||
if (IS_ERR(priv->gck)) {
|
||||
dev_err(&pdev->dev, "failed to get multclk\n");
|
||||
ret = PTR_ERR(priv->gck);
|
||||
goto sdhci_pltfm_free;
|
||||
}
|
||||
if (IS_ERR(priv->gck))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(priv->gck),
|
||||
"failed to get multclk\n");
|
||||
|
||||
ret = sdhci_at91_set_clks_presets(&pdev->dev);
|
||||
if (ret)
|
||||
goto sdhci_pltfm_free;
|
||||
return ret;
|
||||
|
||||
priv->restore_needed = false;
|
||||
|
||||
|
|
@ -438,8 +432,6 @@ clocks_disable_unprepare:
|
|||
clk_disable_unprepare(priv->gck);
|
||||
clk_disable_unprepare(priv->mainck);
|
||||
clk_disable_unprepare(priv->hclock);
|
||||
sdhci_pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1387,14 +1387,13 @@ static int dwcmshc_probe(struct platform_device *pdev)
|
|||
|
||||
if (dev->of_node) {
|
||||
pltfm_host->clk = devm_clk_get(dev, "core");
|
||||
if (IS_ERR(pltfm_host->clk)) {
|
||||
err = PTR_ERR(pltfm_host->clk);
|
||||
dev_err(dev, "failed to get core clk: %d\n", err);
|
||||
goto free_pltfm;
|
||||
}
|
||||
if (IS_ERR(pltfm_host->clk))
|
||||
return dev_err_probe(dev, PTR_ERR(pltfm_host->clk),
|
||||
"failed to get core clk\n");
|
||||
|
||||
err = clk_prepare_enable(pltfm_host->clk);
|
||||
if (err)
|
||||
goto free_pltfm;
|
||||
return err;
|
||||
|
||||
priv->bus_clk = devm_clk_get(dev, "bus");
|
||||
if (!IS_ERR(priv->bus_clk))
|
||||
|
|
@ -1467,8 +1466,6 @@ err_clk:
|
|||
clk_disable_unprepare(pltfm_host->clk);
|
||||
clk_disable_unprepare(priv->bus_clk);
|
||||
clk_bulk_disable_unprepare(priv->num_other_clks, priv->other_clks);
|
||||
free_pltfm:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1500,7 +1497,6 @@ static void dwcmshc_remove(struct platform_device *pdev)
|
|||
clk_disable_unprepare(pltfm_host->clk);
|
||||
clk_disable_unprepare(priv->bus_clk);
|
||||
clk_bulk_disable_unprepare(priv->num_other_clks, priv->other_clks);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
|||
|
|
@ -1499,18 +1499,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
|
|||
/* call to generic mmc_of_parse to support additional capabilities */
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
mmc_of_parse_voltage(host->mmc, &host->ocr_mask);
|
||||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
return sdhci_add_host(host);
|
||||
}
|
||||
|
||||
static struct platform_driver sdhci_esdhc_driver = {
|
||||
|
|
|
|||
|
|
@ -20,45 +20,45 @@
|
|||
#include "sdhci.h"
|
||||
#include "sdhci-pltfm.h"
|
||||
|
||||
#define SDHC_MMC_CTRL_REG 0x114
|
||||
#define MISC_INT_EN BIT(1)
|
||||
#define MISC_INT BIT(2)
|
||||
#define ENHANCE_STROBE_EN BIT(8)
|
||||
#define MMC_HS400 BIT(9)
|
||||
#define MMC_HS200 BIT(10)
|
||||
#define MMC_CARD_MODE BIT(12)
|
||||
#define SPACEMIT_SDHC_MMC_CTRL_REG 0x114
|
||||
#define SDHC_MISC_INT_EN BIT(1)
|
||||
#define SDHC_MISC_INT BIT(2)
|
||||
#define SDHC_ENHANCE_STROBE_EN BIT(8)
|
||||
#define SDHC_MMC_HS400 BIT(9)
|
||||
#define SDHC_MMC_HS200 BIT(10)
|
||||
#define SDHC_MMC_CARD_MODE BIT(12)
|
||||
|
||||
#define SDHC_TX_CFG_REG 0x11C
|
||||
#define TX_INT_CLK_SEL BIT(30)
|
||||
#define TX_MUX_SEL BIT(31)
|
||||
#define SPACEMIT_SDHC_TX_CFG_REG 0x11C
|
||||
#define SDHC_TX_INT_CLK_SEL BIT(30)
|
||||
#define SDHC_TX_MUX_SEL BIT(31)
|
||||
|
||||
#define SDHC_PHY_CTRL_REG 0x160
|
||||
#define PHY_FUNC_EN BIT(0)
|
||||
#define PHY_PLL_LOCK BIT(1)
|
||||
#define HOST_LEGACY_MODE BIT(31)
|
||||
#define SPACEMIT_SDHC_PHY_CTRL_REG 0x160
|
||||
#define SDHC_PHY_FUNC_EN BIT(0)
|
||||
#define SDHC_PHY_PLL_LOCK BIT(1)
|
||||
#define SDHC_HOST_LEGACY_MODE BIT(31)
|
||||
|
||||
#define SDHC_PHY_FUNC_REG 0x164
|
||||
#define PHY_TEST_EN BIT(7)
|
||||
#define HS200_USE_RFIFO BIT(15)
|
||||
#define SPACEMIT_SDHC_PHY_FUNC_REG 0x164
|
||||
#define SDHC_PHY_TEST_EN BIT(7)
|
||||
#define SDHC_HS200_USE_RFIFO BIT(15)
|
||||
|
||||
#define SDHC_PHY_DLLCFG 0x168
|
||||
#define DLL_PREDLY_NUM GENMASK(3, 2)
|
||||
#define DLL_FULLDLY_RANGE GENMASK(5, 4)
|
||||
#define DLL_VREG_CTRL GENMASK(7, 6)
|
||||
#define DLL_ENABLE BIT(31)
|
||||
#define SPACEMIT_SDHC_PHY_DLLCFG 0x168
|
||||
#define SDHC_DLL_PREDLY_NUM GENMASK(3, 2)
|
||||
#define SDHC_DLL_FULLDLY_RANGE GENMASK(5, 4)
|
||||
#define SDHC_DLL_VREG_CTRL GENMASK(7, 6)
|
||||
#define SDHC_DLL_ENABLE BIT(31)
|
||||
|
||||
#define SDHC_PHY_DLLCFG1 0x16C
|
||||
#define DLL_REG1_CTRL GENMASK(7, 0)
|
||||
#define DLL_REG2_CTRL GENMASK(15, 8)
|
||||
#define DLL_REG3_CTRL GENMASK(23, 16)
|
||||
#define DLL_REG4_CTRL GENMASK(31, 24)
|
||||
#define SPACEMIT_SDHC_PHY_DLLCFG1 0x16C
|
||||
#define SDHC_DLL_REG1_CTRL GENMASK(7, 0)
|
||||
#define SDHC_DLL_REG2_CTRL GENMASK(15, 8)
|
||||
#define SDHC_DLL_REG3_CTRL GENMASK(23, 16)
|
||||
#define SDHC_DLL_REG4_CTRL GENMASK(31, 24)
|
||||
|
||||
#define SDHC_PHY_DLLSTS 0x170
|
||||
#define DLL_LOCK_STATE BIT(0)
|
||||
#define SPACEMIT_SDHC_PHY_DLLSTS 0x170
|
||||
#define SDHC_DLL_LOCK_STATE BIT(0)
|
||||
|
||||
#define SDHC_PHY_PADCFG_REG 0x178
|
||||
#define PHY_DRIVE_SEL GENMASK(2, 0)
|
||||
#define RX_BIAS_CTRL BIT(5)
|
||||
#define SPACEMIT_SDHC_PHY_PADCFG_REG 0x178
|
||||
#define SDHC_PHY_DRIVE_SEL GENMASK(2, 0)
|
||||
#define SDHC_RX_BIAS_CTRL BIT(5)
|
||||
|
||||
struct spacemit_sdhci_host {
|
||||
struct clk *clk_core;
|
||||
|
|
@ -91,23 +91,24 @@ static void spacemit_sdhci_reset(struct sdhci_host *host, u8 mask)
|
|||
if (mask != SDHCI_RESET_ALL)
|
||||
return;
|
||||
|
||||
spacemit_sdhci_setbits(host, PHY_FUNC_EN | PHY_PLL_LOCK, SDHC_PHY_CTRL_REG);
|
||||
spacemit_sdhci_setbits(host, SDHC_PHY_FUNC_EN | SDHC_PHY_PLL_LOCK,
|
||||
SPACEMIT_SDHC_PHY_CTRL_REG);
|
||||
|
||||
spacemit_sdhci_clrsetbits(host, PHY_DRIVE_SEL,
|
||||
RX_BIAS_CTRL | FIELD_PREP(PHY_DRIVE_SEL, 4),
|
||||
SDHC_PHY_PADCFG_REG);
|
||||
spacemit_sdhci_clrsetbits(host, SDHC_PHY_DRIVE_SEL,
|
||||
SDHC_RX_BIAS_CTRL | FIELD_PREP(SDHC_PHY_DRIVE_SEL, 4),
|
||||
SPACEMIT_SDHC_PHY_PADCFG_REG);
|
||||
|
||||
if (!(host->mmc->caps2 & MMC_CAP2_NO_MMC))
|
||||
spacemit_sdhci_setbits(host, MMC_CARD_MODE, SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_setbits(host, SDHC_MMC_CARD_MODE, SPACEMIT_SDHC_MMC_CTRL_REG);
|
||||
}
|
||||
|
||||
static void spacemit_sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned int timing)
|
||||
{
|
||||
if (timing == MMC_TIMING_MMC_HS200)
|
||||
spacemit_sdhci_setbits(host, MMC_HS200, SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_setbits(host, SDHC_MMC_HS200, SPACEMIT_SDHC_MMC_CTRL_REG);
|
||||
|
||||
if (timing == MMC_TIMING_MMC_HS400)
|
||||
spacemit_sdhci_setbits(host, MMC_HS400, SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_setbits(host, SDHC_MMC_HS400, SPACEMIT_SDHC_MMC_CTRL_REG);
|
||||
|
||||
sdhci_set_uhs_signaling(host, timing);
|
||||
|
||||
|
|
@ -120,9 +121,9 @@ static void spacemit_sdhci_set_clock(struct sdhci_host *host, unsigned int clock
|
|||
struct mmc_host *mmc = host->mmc;
|
||||
|
||||
if (mmc->ios.timing <= MMC_TIMING_UHS_SDR50)
|
||||
spacemit_sdhci_setbits(host, TX_INT_CLK_SEL, SDHC_TX_CFG_REG);
|
||||
spacemit_sdhci_setbits(host, SDHC_TX_INT_CLK_SEL, SPACEMIT_SDHC_TX_CFG_REG);
|
||||
else
|
||||
spacemit_sdhci_clrbits(host, TX_INT_CLK_SEL, SDHC_TX_CFG_REG);
|
||||
spacemit_sdhci_clrbits(host, SDHC_TX_INT_CLK_SEL, SPACEMIT_SDHC_TX_CFG_REG);
|
||||
|
||||
sdhci_set_clock(host, clock);
|
||||
};
|
||||
|
|
@ -132,20 +133,22 @@ static void spacemit_sdhci_phy_dll_init(struct sdhci_host *host)
|
|||
u32 state;
|
||||
int ret;
|
||||
|
||||
spacemit_sdhci_clrsetbits(host, DLL_PREDLY_NUM | DLL_FULLDLY_RANGE | DLL_VREG_CTRL,
|
||||
FIELD_PREP(DLL_PREDLY_NUM, 1) |
|
||||
FIELD_PREP(DLL_FULLDLY_RANGE, 1) |
|
||||
FIELD_PREP(DLL_VREG_CTRL, 1),
|
||||
SDHC_PHY_DLLCFG);
|
||||
spacemit_sdhci_clrsetbits(host, SDHC_DLL_PREDLY_NUM |
|
||||
SDHC_DLL_FULLDLY_RANGE |
|
||||
SDHC_DLL_VREG_CTRL,
|
||||
FIELD_PREP(SDHC_DLL_PREDLY_NUM, 1) |
|
||||
FIELD_PREP(SDHC_DLL_FULLDLY_RANGE, 1) |
|
||||
FIELD_PREP(SDHC_DLL_VREG_CTRL, 1),
|
||||
SPACEMIT_SDHC_PHY_DLLCFG);
|
||||
|
||||
spacemit_sdhci_clrsetbits(host, DLL_REG1_CTRL,
|
||||
FIELD_PREP(DLL_REG1_CTRL, 0x92),
|
||||
SDHC_PHY_DLLCFG1);
|
||||
spacemit_sdhci_clrsetbits(host, SDHC_DLL_REG1_CTRL,
|
||||
FIELD_PREP(SDHC_DLL_REG1_CTRL, 0x92),
|
||||
SPACEMIT_SDHC_PHY_DLLCFG1);
|
||||
|
||||
spacemit_sdhci_setbits(host, DLL_ENABLE, SDHC_PHY_DLLCFG);
|
||||
spacemit_sdhci_setbits(host, SDHC_DLL_ENABLE, SPACEMIT_SDHC_PHY_DLLCFG);
|
||||
|
||||
ret = readl_poll_timeout(host->ioaddr + SDHC_PHY_DLLSTS, state,
|
||||
state & DLL_LOCK_STATE, 2, 100);
|
||||
ret = readl_poll_timeout(host->ioaddr + SPACEMIT_SDHC_PHY_DLLSTS, state,
|
||||
state & SDHC_DLL_LOCK_STATE, 2, 100);
|
||||
if (ret == -ETIMEDOUT)
|
||||
dev_warn(mmc_dev(host->mmc), "fail to lock phy dll in 100us!\n");
|
||||
}
|
||||
|
|
@ -155,11 +158,11 @@ static void spacemit_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc, struct mm
|
|||
struct sdhci_host *host = mmc_priv(mmc);
|
||||
|
||||
if (!ios->enhanced_strobe) {
|
||||
spacemit_sdhci_clrbits(host, ENHANCE_STROBE_EN, SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_clrbits(host, SDHC_ENHANCE_STROBE_EN, SPACEMIT_SDHC_MMC_CTRL_REG);
|
||||
return;
|
||||
}
|
||||
|
||||
spacemit_sdhci_setbits(host, ENHANCE_STROBE_EN, SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_setbits(host, SDHC_ENHANCE_STROBE_EN, SPACEMIT_SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_phy_dll_init(host);
|
||||
}
|
||||
|
||||
|
|
@ -174,8 +177,7 @@ static int spacemit_sdhci_pre_select_hs400(struct mmc_host *mmc)
|
|||
{
|
||||
struct sdhci_host *host = mmc_priv(mmc);
|
||||
|
||||
spacemit_sdhci_setbits(host, MMC_HS400, SDHC_MMC_CTRL_REG);
|
||||
host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY;
|
||||
spacemit_sdhci_setbits(host, SDHC_MMC_HS400, SPACEMIT_SDHC_MMC_CTRL_REG);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -185,20 +187,22 @@ static void spacemit_sdhci_post_select_hs400(struct mmc_host *mmc)
|
|||
struct sdhci_host *host = mmc_priv(mmc);
|
||||
|
||||
spacemit_sdhci_phy_dll_init(host);
|
||||
host->mmc->caps &= ~MMC_CAP_WAIT_WHILE_BUSY;
|
||||
}
|
||||
|
||||
static void spacemit_sdhci_pre_hs400_to_hs200(struct mmc_host *mmc)
|
||||
{
|
||||
struct sdhci_host *host = mmc_priv(mmc);
|
||||
|
||||
spacemit_sdhci_clrbits(host, PHY_FUNC_EN | PHY_PLL_LOCK, SDHC_PHY_CTRL_REG);
|
||||
spacemit_sdhci_clrbits(host, MMC_HS400 | MMC_HS200 | ENHANCE_STROBE_EN, SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_clrbits(host, HS200_USE_RFIFO, SDHC_PHY_FUNC_REG);
|
||||
spacemit_sdhci_clrbits(host, SDHC_PHY_FUNC_EN | SDHC_PHY_PLL_LOCK,
|
||||
SPACEMIT_SDHC_PHY_CTRL_REG);
|
||||
spacemit_sdhci_clrbits(host, SDHC_MMC_HS400 | SDHC_MMC_HS200 | SDHC_ENHANCE_STROBE_EN,
|
||||
SPACEMIT_SDHC_MMC_CTRL_REG);
|
||||
spacemit_sdhci_clrbits(host, SDHC_HS200_USE_RFIFO, SPACEMIT_SDHC_PHY_FUNC_REG);
|
||||
|
||||
udelay(5);
|
||||
|
||||
spacemit_sdhci_setbits(host, PHY_FUNC_EN | PHY_PLL_LOCK, SDHC_PHY_CTRL_REG);
|
||||
spacemit_sdhci_setbits(host, SDHC_PHY_FUNC_EN | SDHC_PHY_PLL_LOCK,
|
||||
SPACEMIT_SDHC_PHY_CTRL_REG);
|
||||
}
|
||||
|
||||
static inline int spacemit_sdhci_get_clocks(struct device *dev,
|
||||
|
|
@ -287,7 +291,6 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
err_pltfm:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -211,20 +211,18 @@ static int ma35_probe(struct platform_device *pdev)
|
|||
priv = sdhci_pltfm_priv(pltfm_host);
|
||||
|
||||
pltfm_host->clk = devm_clk_get_optional_enabled(dev, NULL);
|
||||
if (IS_ERR(pltfm_host->clk)) {
|
||||
err = dev_err_probe(dev, PTR_ERR(pltfm_host->clk), "failed to get clk\n");
|
||||
goto err_sdhci;
|
||||
}
|
||||
if (IS_ERR(pltfm_host->clk))
|
||||
return dev_err_probe(dev, PTR_ERR(pltfm_host->clk),
|
||||
"failed to get clk\n");
|
||||
|
||||
err = mmc_of_parse(host->mmc);
|
||||
if (err)
|
||||
goto err_sdhci;
|
||||
return err;
|
||||
|
||||
priv->rst = devm_reset_control_get_exclusive(dev, NULL);
|
||||
if (IS_ERR(priv->rst)) {
|
||||
err = dev_err_probe(dev, PTR_ERR(priv->rst), "failed to get reset control\n");
|
||||
goto err_sdhci;
|
||||
}
|
||||
if (IS_ERR(priv->rst))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->rst),
|
||||
"failed to get reset control\n");
|
||||
|
||||
sdhci_get_of_property(pdev);
|
||||
|
||||
|
|
@ -255,7 +253,7 @@ static int ma35_probe(struct platform_device *pdev)
|
|||
|
||||
err = sdhci_add_host(host);
|
||||
if (err)
|
||||
goto err_sdhci;
|
||||
return err;
|
||||
|
||||
/*
|
||||
* Split data into chunks of 16 or 8 bytes for transmission.
|
||||
|
|
@ -268,10 +266,6 @@ static int ma35_probe(struct platform_device *pdev)
|
|||
sdhci_writew(host, ctl, MA35_SDHCI_MBIUCTL);
|
||||
|
||||
return 0;
|
||||
|
||||
err_sdhci:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void ma35_disable_card_clk(struct sdhci_host *host)
|
||||
|
|
@ -291,7 +285,6 @@ static void ma35_remove(struct platform_device *pdev)
|
|||
|
||||
sdhci_remove_host(host, 0);
|
||||
ma35_disable_card_clk(host);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
static const struct of_device_id sdhci_ma35_dt_ids[] = {
|
||||
|
|
|
|||
|
|
@ -185,11 +185,9 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
|
|||
sdhci_sparx5->host = host;
|
||||
|
||||
pltfm_host->clk = devm_clk_get_enabled(&pdev->dev, "core");
|
||||
if (IS_ERR(pltfm_host->clk)) {
|
||||
ret = PTR_ERR(pltfm_host->clk);
|
||||
dev_err(&pdev->dev, "failed to get and enable core clk: %d\n", ret);
|
||||
goto free_pltfm;
|
||||
}
|
||||
if (IS_ERR(pltfm_host->clk))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(pltfm_host->clk),
|
||||
"failed to get and enable core clk\n");
|
||||
|
||||
if (!of_property_read_u32(np, "microchip,clock-delay", &value) &&
|
||||
(value > 0 && value <= MSHC_DLY_CC_MAX))
|
||||
|
|
@ -199,14 +197,12 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto free_pltfm;
|
||||
return ret;
|
||||
|
||||
sdhci_sparx5->cpu_ctrl = syscon_regmap_lookup_by_compatible(syscon);
|
||||
if (IS_ERR(sdhci_sparx5->cpu_ctrl)) {
|
||||
dev_err(&pdev->dev, "No CPU syscon regmap !\n");
|
||||
ret = PTR_ERR(sdhci_sparx5->cpu_ctrl);
|
||||
goto free_pltfm;
|
||||
}
|
||||
if (IS_ERR(sdhci_sparx5->cpu_ctrl))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(sdhci_sparx5->cpu_ctrl),
|
||||
"No CPU syscon regmap !\n");
|
||||
|
||||
if (sdhci_sparx5->delay_clock >= 0)
|
||||
sparx5_set_delay(host, sdhci_sparx5->delay_clock);
|
||||
|
|
@ -222,7 +218,7 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
|
|||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
goto free_pltfm;
|
||||
return ret;
|
||||
|
||||
/* Set AXI bus master to use un-cached access (for DMA) */
|
||||
if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA) &&
|
||||
|
|
@ -235,10 +231,6 @@ static int sdhci_sparx5_probe(struct platform_device *pdev)
|
|||
mmc_hostname(host->mmc), sdhci_readl(host, MSHC2_TYPE));
|
||||
|
||||
return ret;
|
||||
|
||||
free_pltfm:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct of_device_id sdhci_sparx5_of_match[] = {
|
||||
|
|
|
|||
|
|
@ -1257,7 +1257,7 @@ static int sdhci_omap_probe(struct platform_device *pdev)
|
|||
sdhci_get_of_property(pdev);
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret)
|
||||
goto err_pltfm_free;
|
||||
return ret;
|
||||
|
||||
soc = soc_device_match(sdhci_omap_soc_devices);
|
||||
if (soc) {
|
||||
|
|
@ -1274,22 +1274,19 @@ static int sdhci_omap_probe(struct platform_device *pdev)
|
|||
mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
|
||||
|
||||
pltfm_host->clk = devm_clk_get(dev, "fck");
|
||||
if (IS_ERR(pltfm_host->clk)) {
|
||||
ret = PTR_ERR(pltfm_host->clk);
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
if (IS_ERR(pltfm_host->clk))
|
||||
return PTR_ERR(pltfm_host->clk);
|
||||
|
||||
ret = clk_set_rate(pltfm_host->clk, mmc->f_max);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to set clock to %d\n", mmc->f_max);
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"failed to set clock to %d\n", mmc->f_max);
|
||||
|
||||
omap_host->pbias = devm_regulator_get_optional(dev, "pbias");
|
||||
if (IS_ERR(omap_host->pbias)) {
|
||||
ret = PTR_ERR(omap_host->pbias);
|
||||
if (ret != -ENODEV)
|
||||
goto err_pltfm_free;
|
||||
return ret;
|
||||
dev_dbg(dev, "unable to get pbias regulator %d\n", ret);
|
||||
}
|
||||
omap_host->pbias_enabled = false;
|
||||
|
|
@ -1373,7 +1370,6 @@ static int sdhci_omap_probe(struct platform_device *pdev)
|
|||
host->mmc->pm_caps |= MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ;
|
||||
}
|
||||
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
return 0;
|
||||
|
|
@ -1382,14 +1378,10 @@ err_cleanup_host:
|
|||
sdhci_cleanup_host(host);
|
||||
|
||||
err_rpm_put:
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
err_rpm_disable:
|
||||
pm_runtime_dont_use_autosuspend(dev);
|
||||
pm_runtime_disable(dev);
|
||||
|
||||
err_pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1406,7 +1398,6 @@ static void sdhci_omap_remove(struct platform_device *pdev)
|
|||
pm_runtime_put_sync(dev);
|
||||
/* Ensure device gets disabled despite userspace sysfs config */
|
||||
pm_runtime_force_suspend(dev);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
|
|
|||
|
|
@ -152,18 +152,15 @@ static int sdhci_pci_runtime_suspend_host(struct sdhci_pci_chip *chip)
|
|||
{
|
||||
struct sdhci_pci_slot *slot;
|
||||
struct sdhci_host *host;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < chip->num_slots; i++) {
|
||||
for (int i = 0; i < chip->num_slots; i++) {
|
||||
slot = chip->slots[i];
|
||||
if (!slot)
|
||||
continue;
|
||||
|
||||
host = slot->host;
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
if (ret)
|
||||
goto err_pci_runtime_suspend;
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
if (chip->rpm_retune &&
|
||||
host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
|
|
@ -171,26 +168,18 @@ static int sdhci_pci_runtime_suspend_host(struct sdhci_pci_chip *chip)
|
|||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_pci_runtime_suspend:
|
||||
while (--i >= 0)
|
||||
sdhci_runtime_resume_host(chip->slots[i]->host, 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sdhci_pci_runtime_resume_host(struct sdhci_pci_chip *chip)
|
||||
{
|
||||
struct sdhci_pci_slot *slot;
|
||||
int i, ret;
|
||||
|
||||
for (i = 0; i < chip->num_slots; i++) {
|
||||
for (int i = 0; i < chip->num_slots; i++) {
|
||||
slot = chip->slots[i];
|
||||
if (!slot)
|
||||
continue;
|
||||
|
||||
ret = sdhci_runtime_resume_host(slot->host, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
sdhci_runtime_resume_host(slot->host, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -2174,7 +2163,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
|
|||
ret = pcim_iomap_regions(pdev, BIT(bar), mmc_hostname(host->mmc));
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "cannot request region\n");
|
||||
goto cleanup;
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
host->ioaddr = pcim_iomap_table(pdev)[bar];
|
||||
|
|
@ -2182,7 +2171,7 @@ static struct sdhci_pci_slot *sdhci_pci_probe_slot(
|
|||
if (chip->fixes && chip->fixes->probe_slot) {
|
||||
ret = chip->fixes->probe_slot(slot);
|
||||
if (ret)
|
||||
goto cleanup;
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
host->mmc->pm_caps = MMC_PM_KEEP_POWER;
|
||||
|
|
@ -2243,9 +2232,6 @@ remove:
|
|||
if (chip->fixes && chip->fixes->remove_slot)
|
||||
chip->fixes->remove_slot(slot, 0);
|
||||
|
||||
cleanup:
|
||||
sdhci_free_host(host);
|
||||
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
|
|
@ -2266,8 +2252,6 @@ static void sdhci_pci_remove_slot(struct sdhci_pci_slot *slot)
|
|||
|
||||
if (slot->chip->fixes && slot->chip->fixes->remove_slot)
|
||||
slot->chip->fixes->remove_slot(slot, dead);
|
||||
|
||||
sdhci_free_host(slot->host);
|
||||
}
|
||||
|
||||
int sdhci_pci_uhs2_add_host(struct sdhci_pci_slot *slot)
|
||||
|
|
|
|||
|
|
@ -157,20 +157,20 @@ static int pic32_sdhci_probe(struct platform_device *pdev)
|
|||
ret = plat_data->setup_dma(ADMA_FIFO_RD_THSHLD,
|
||||
ADMA_FIFO_WR_THSHLD);
|
||||
if (ret)
|
||||
goto err_host;
|
||||
goto err;
|
||||
}
|
||||
|
||||
sdhci_pdata->sys_clk = devm_clk_get(&pdev->dev, "sys_clk");
|
||||
if (IS_ERR(sdhci_pdata->sys_clk)) {
|
||||
ret = PTR_ERR(sdhci_pdata->sys_clk);
|
||||
dev_err(&pdev->dev, "Error getting clock\n");
|
||||
goto err_host;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(sdhci_pdata->sys_clk);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Error enabling clock\n");
|
||||
goto err_host;
|
||||
goto err;
|
||||
}
|
||||
|
||||
sdhci_pdata->base_clk = devm_clk_get(&pdev->dev, "base_clk");
|
||||
|
|
@ -203,8 +203,6 @@ err_base_clk:
|
|||
clk_disable_unprepare(sdhci_pdata->base_clk);
|
||||
err_sys_clk:
|
||||
clk_disable_unprepare(sdhci_pdata->sys_clk);
|
||||
err_host:
|
||||
sdhci_pltfm_free(pdev);
|
||||
err:
|
||||
dev_err(&pdev->dev, "pic32-sdhci probe failed: %d\n", ret);
|
||||
return ret;
|
||||
|
|
@ -220,7 +218,6 @@ static void pic32_sdhci_remove(struct platform_device *pdev)
|
|||
sdhci_remove_host(host, scratch == (u32)~0);
|
||||
clk_disable_unprepare(sdhci_pdata->base_clk);
|
||||
clk_disable_unprepare(sdhci_pdata->sys_clk);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
static const struct of_device_id pic32_sdhci_id_table[] = {
|
||||
|
|
|
|||
|
|
@ -146,20 +146,11 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(sdhci_pltfm_init);
|
||||
|
||||
void sdhci_pltfm_free(struct platform_device *pdev)
|
||||
{
|
||||
struct sdhci_host *host = platform_get_drvdata(pdev);
|
||||
|
||||
sdhci_free_host(host);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sdhci_pltfm_free);
|
||||
|
||||
int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
|
||||
const struct sdhci_pltfm_data *pdata,
|
||||
size_t priv_size)
|
||||
{
|
||||
struct sdhci_host *host;
|
||||
int ret = 0;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, pdata, priv_size);
|
||||
if (IS_ERR(host))
|
||||
|
|
@ -167,11 +158,7 @@ int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
|
|||
|
||||
sdhci_get_property(pdev);
|
||||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
sdhci_pltfm_free(pdev);
|
||||
|
||||
return ret;
|
||||
return sdhci_add_host(host);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sdhci_pltfm_init_and_add_host);
|
||||
|
||||
|
|
@ -181,7 +168,6 @@ void sdhci_pltfm_remove(struct platform_device *pdev)
|
|||
int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
|
||||
|
||||
sdhci_remove_host(host, dead);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sdhci_pltfm_remove);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ static inline void sdhci_get_of_property(struct platform_device *pdev)
|
|||
extern struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
|
||||
const struct sdhci_pltfm_data *pdata,
|
||||
size_t priv_size);
|
||||
extern void sdhci_pltfm_free(struct platform_device *pdev);
|
||||
|
||||
extern int sdhci_pltfm_init_and_add_host(struct platform_device *pdev,
|
||||
const struct sdhci_pltfm_data *pdata,
|
||||
|
|
|
|||
|
|
@ -258,7 +258,6 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
|
|||
struct sdhci_host *host = NULL;
|
||||
const struct sdhci_pxa_variant *variant;
|
||||
|
||||
int ret;
|
||||
struct clk *clk, *clk_core;
|
||||
|
||||
host = sdhci_pltfm_init(pdev, NULL, sizeof(*pxav2_host));
|
||||
|
|
@ -271,19 +270,14 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
|
|||
clk = devm_clk_get_optional_enabled(dev, "io");
|
||||
if (!clk)
|
||||
clk = devm_clk_get_enabled(dev, NULL);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
dev_err_probe(dev, ret, "failed to get io clock\n");
|
||||
goto free;
|
||||
}
|
||||
if (IS_ERR(clk))
|
||||
return dev_err_probe(dev, PTR_ERR(clk), "failed to get io clock\n");
|
||||
pltfm_host->clk = clk;
|
||||
|
||||
clk_core = devm_clk_get_optional_enabled(dev, "core");
|
||||
if (IS_ERR(clk_core)) {
|
||||
ret = PTR_ERR(clk_core);
|
||||
dev_err_probe(dev, ret, "failed to enable core clock\n");
|
||||
goto free;
|
||||
}
|
||||
if (IS_ERR(clk_core))
|
||||
return dev_err_probe(dev, PTR_ERR(clk_core),
|
||||
"failed to enable core clock\n");
|
||||
|
||||
host->quirks = SDHCI_QUIRK_BROKEN_ADMA
|
||||
| SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
|
||||
|
|
@ -332,15 +326,7 @@ static int sdhci_pxav2_probe(struct platform_device *pdev)
|
|||
pxav2_host->pinctrl = NULL;
|
||||
}
|
||||
|
||||
ret = sdhci_add_host(host);
|
||||
if (ret)
|
||||
goto free;
|
||||
|
||||
return 0;
|
||||
|
||||
free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
return sdhci_add_host(host);
|
||||
}
|
||||
|
||||
static struct platform_driver sdhci_pxav2_driver = {
|
||||
|
|
|
|||
|
|
@ -389,8 +389,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
|
|||
pxa->clk_io = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(pxa->clk_io)) {
|
||||
dev_err(dev, "failed to get io clock\n");
|
||||
ret = PTR_ERR(pxa->clk_io);
|
||||
goto err_clk_get;
|
||||
return PTR_ERR(pxa->clk_io);
|
||||
}
|
||||
pltfm_host->clk = pxa->clk_io;
|
||||
clk_prepare_enable(pxa->clk_io);
|
||||
|
|
@ -466,8 +465,6 @@ err_of_parse:
|
|||
err_mbus_win:
|
||||
clk_disable_unprepare(pxa->clk_io);
|
||||
clk_disable_unprepare(pxa->clk_core);
|
||||
err_clk_get:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -485,8 +482,6 @@ static void sdhci_pxav3_remove(struct platform_device *pdev)
|
|||
|
||||
clk_disable_unprepare(pxa->clk_io);
|
||||
clk_disable_unprepare(pxa->clk_core);
|
||||
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
@ -499,7 +494,6 @@ static int sdhci_pxav3_suspend(struct device *dev)
|
|||
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
mmc_retune_needed(host->mmc);
|
||||
ret = sdhci_suspend_host(host);
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
return ret;
|
||||
|
|
@ -512,7 +506,6 @@ static int sdhci_pxav3_resume(struct device *dev)
|
|||
|
||||
pm_runtime_get_sync(dev);
|
||||
ret = sdhci_resume_host(host);
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
|
||||
return ret;
|
||||
|
|
@ -525,11 +518,8 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev)
|
|||
struct sdhci_host *host = dev_get_drvdata(dev);
|
||||
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||||
struct sdhci_pxa *pxa = sdhci_pltfm_priv(pltfm_host);
|
||||
int ret;
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
if (ret)
|
||||
return ret;
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
mmc_retune_needed(host->mmc);
|
||||
|
|
@ -551,7 +541,8 @@ static int sdhci_pxav3_runtime_resume(struct device *dev)
|
|||
if (!IS_ERR(pxa->clk_core))
|
||||
clk_prepare_enable(pxa->clk_core);
|
||||
|
||||
return sdhci_runtime_resume_host(host, 0);
|
||||
sdhci_runtime_resume_host(host, 0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -507,15 +507,13 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
|
|||
sc = sdhci_priv(host);
|
||||
|
||||
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata) {
|
||||
ret = -ENOMEM;
|
||||
goto err_pdata_io_clk;
|
||||
}
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
ret = sdhci_s3c_parse_dt(&pdev->dev, host, pdata);
|
||||
if (ret)
|
||||
goto err_pdata_io_clk;
|
||||
return ret;
|
||||
} else {
|
||||
memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata));
|
||||
}
|
||||
|
|
@ -532,8 +530,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
|
|||
sc->clk_io = devm_clk_get(dev, "hsmmc");
|
||||
if (IS_ERR(sc->clk_io)) {
|
||||
dev_err(dev, "failed to get io clock\n");
|
||||
ret = PTR_ERR(sc->clk_io);
|
||||
goto err_pdata_io_clk;
|
||||
return PTR_ERR(sc->clk_io);
|
||||
}
|
||||
|
||||
/* enable the local io clock and keep it running for the moment. */
|
||||
|
|
@ -661,9 +658,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
|
|||
err_no_busclks:
|
||||
clk_disable_unprepare(sc->clk_io);
|
||||
|
||||
err_pdata_io_clk:
|
||||
sdhci_free_host(host);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -685,8 +679,6 @@ static void sdhci_s3c_remove(struct platform_device *pdev)
|
|||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
clk_disable_unprepare(sc->clk_io);
|
||||
|
||||
sdhci_free_host(host);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
@ -714,9 +706,8 @@ static int sdhci_s3c_runtime_suspend(struct device *dev)
|
|||
struct sdhci_host *host = dev_get_drvdata(dev);
|
||||
struct sdhci_s3c *ourhost = to_s3c(host);
|
||||
struct clk *busclk = ourhost->clk_io;
|
||||
int ret;
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
mmc_retune_needed(host->mmc);
|
||||
|
|
@ -724,7 +715,7 @@ static int sdhci_s3c_runtime_suspend(struct device *dev)
|
|||
if (ourhost->cur_clk >= 0)
|
||||
clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);
|
||||
clk_disable_unprepare(busclk);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sdhci_s3c_runtime_resume(struct device *dev)
|
||||
|
|
@ -732,13 +723,12 @@ static int sdhci_s3c_runtime_resume(struct device *dev)
|
|||
struct sdhci_host *host = dev_get_drvdata(dev);
|
||||
struct sdhci_s3c *ourhost = to_s3c(host);
|
||||
struct clk *busclk = ourhost->clk_io;
|
||||
int ret;
|
||||
|
||||
clk_prepare_enable(busclk);
|
||||
if (ourhost->cur_clk >= 0)
|
||||
clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]);
|
||||
ret = sdhci_runtime_resume_host(host, 0);
|
||||
return ret;
|
||||
sdhci_runtime_resume_host(host, 0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static int sdhci_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(host->ioaddr)) {
|
||||
ret = PTR_ERR(host->ioaddr);
|
||||
dev_dbg(&pdev->dev, "unable to map iomem: %d\n", ret);
|
||||
goto err_host;
|
||||
goto err;
|
||||
}
|
||||
|
||||
host->hw_name = "sdhci";
|
||||
|
|
@ -67,7 +67,7 @@ static int sdhci_probe(struct platform_device *pdev)
|
|||
host->irq = platform_get_irq(pdev, 0);
|
||||
if (host->irq < 0) {
|
||||
ret = host->irq;
|
||||
goto err_host;
|
||||
goto err;
|
||||
}
|
||||
host->quirks = SDHCI_QUIRK_BROKEN_ADMA;
|
||||
|
||||
|
|
@ -78,13 +78,13 @@ static int sdhci_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(sdhci->clk)) {
|
||||
ret = PTR_ERR(sdhci->clk);
|
||||
dev_dbg(&pdev->dev, "Error getting clock\n");
|
||||
goto err_host;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(sdhci->clk);
|
||||
if (ret) {
|
||||
dev_dbg(&pdev->dev, "Error enabling clock\n");
|
||||
goto err_host;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = clk_set_rate(sdhci->clk, 50000000);
|
||||
|
|
@ -110,8 +110,6 @@ static int sdhci_probe(struct platform_device *pdev)
|
|||
|
||||
disable_clk:
|
||||
clk_disable_unprepare(sdhci->clk);
|
||||
err_host:
|
||||
sdhci_free_host(host);
|
||||
err:
|
||||
dev_err(&pdev->dev, "spear-sdhci probe failed: %d\n", ret);
|
||||
return ret;
|
||||
|
|
@ -130,7 +128,6 @@ static void sdhci_remove(struct platform_device *pdev)
|
|||
|
||||
sdhci_remove_host(host, dead);
|
||||
clk_disable_unprepare(sdhci->clk);
|
||||
sdhci_free_host(host);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
|
|||
|
|
@ -764,7 +764,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto pltfm_free;
|
||||
return ret;
|
||||
|
||||
if (!mmc_card_is_removable(host->mmc))
|
||||
host->mmc_host_ops.request_atomic = sdhci_sprd_request_atomic;
|
||||
|
|
@ -778,34 +778,26 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
|
|||
if (!IS_ERR(sprd_host->pinctrl)) {
|
||||
sprd_host->pins_uhs =
|
||||
pinctrl_lookup_state(sprd_host->pinctrl, "state_uhs");
|
||||
if (IS_ERR(sprd_host->pins_uhs)) {
|
||||
ret = PTR_ERR(sprd_host->pins_uhs);
|
||||
goto pltfm_free;
|
||||
}
|
||||
if (IS_ERR(sprd_host->pins_uhs))
|
||||
return PTR_ERR(sprd_host->pins_uhs);
|
||||
|
||||
sprd_host->pins_default =
|
||||
pinctrl_lookup_state(sprd_host->pinctrl, "default");
|
||||
if (IS_ERR(sprd_host->pins_default)) {
|
||||
ret = PTR_ERR(sprd_host->pins_default);
|
||||
goto pltfm_free;
|
||||
}
|
||||
if (IS_ERR(sprd_host->pins_default))
|
||||
return PTR_ERR(sprd_host->pins_default);
|
||||
}
|
||||
|
||||
clk = devm_clk_get(&pdev->dev, "sdio");
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
goto pltfm_free;
|
||||
}
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
sprd_host->clk_sdio = clk;
|
||||
sprd_host->base_rate = clk_get_rate(sprd_host->clk_sdio);
|
||||
if (!sprd_host->base_rate)
|
||||
sprd_host->base_rate = SDHCI_SPRD_CLK_DEF_RATE;
|
||||
|
||||
clk = devm_clk_get(&pdev->dev, "enable");
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
goto pltfm_free;
|
||||
}
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
sprd_host->clk_enable = clk;
|
||||
|
||||
clk = devm_clk_get(&pdev->dev, "2x_enable");
|
||||
|
|
@ -814,7 +806,7 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
|
|||
|
||||
ret = clk_prepare_enable(sprd_host->clk_sdio);
|
||||
if (ret)
|
||||
goto pltfm_free;
|
||||
return ret;
|
||||
|
||||
ret = clk_prepare_enable(sprd_host->clk_enable);
|
||||
if (ret)
|
||||
|
|
@ -871,7 +863,6 @@ static int sdhci_sprd_probe(struct platform_device *pdev)
|
|||
if (ret)
|
||||
goto err_cleanup_host;
|
||||
|
||||
pm_runtime_mark_last_busy(&pdev->dev);
|
||||
pm_runtime_put_autosuspend(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
|
@ -891,9 +882,6 @@ clk_disable2:
|
|||
|
||||
clk_disable:
|
||||
clk_disable_unprepare(sprd_host->clk_sdio);
|
||||
|
||||
pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -907,8 +895,6 @@ static void sdhci_sprd_remove(struct platform_device *pdev)
|
|||
clk_disable_unprepare(sprd_host->clk_sdio);
|
||||
clk_disable_unprepare(sprd_host->clk_enable);
|
||||
clk_disable_unprepare(sprd_host->clk_2x_enable);
|
||||
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
static const struct of_device_id sdhci_sprd_of_match[] = {
|
||||
|
|
|
|||
|
|
@ -380,13 +380,13 @@ static int sdhci_st_probe(struct platform_device *pdev)
|
|||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed mmc_of_parse\n");
|
||||
goto err_of;
|
||||
goto err_pltfm_init;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(clk);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to prepare clock\n");
|
||||
goto err_of;
|
||||
goto err_pltfm_init;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(icnclk);
|
||||
|
|
@ -423,8 +423,6 @@ err_out:
|
|||
clk_disable_unprepare(icnclk);
|
||||
err_icnclk:
|
||||
clk_disable_unprepare(clk);
|
||||
err_of:
|
||||
sdhci_pltfm_free(pdev);
|
||||
err_pltfm_init:
|
||||
reset_control_assert(rstc);
|
||||
|
||||
|
|
|
|||
|
|
@ -1693,7 +1693,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
|
|||
|
||||
rc = mmc_of_parse(host->mmc);
|
||||
if (rc)
|
||||
goto err_parse_dt;
|
||||
return rc;
|
||||
|
||||
if (tegra_host->soc_data->nvquirks & NVQUIRK_ENABLE_DDR50)
|
||||
host->mmc->caps |= MMC_CAP_1_8V_DDR;
|
||||
|
|
@ -1739,7 +1739,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(clk)) {
|
||||
rc = PTR_ERR(clk);
|
||||
if (rc == -EPROBE_DEFER)
|
||||
goto err_power_req;
|
||||
return rc;
|
||||
|
||||
dev_warn(&pdev->dev, "failed to get tmclk: %d\n", rc);
|
||||
clk = NULL;
|
||||
|
|
@ -1750,7 +1750,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
|
|||
if (rc) {
|
||||
dev_err(&pdev->dev,
|
||||
"failed to enable tmclk: %d\n", rc);
|
||||
goto err_power_req;
|
||||
return rc;
|
||||
}
|
||||
|
||||
tegra_host->tmclk = clk;
|
||||
|
|
@ -1811,8 +1811,6 @@ err_rst_get:
|
|||
err_clk_get:
|
||||
clk_disable_unprepare(tegra_host->tmclk);
|
||||
err_power_req:
|
||||
err_parse_dt:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -1831,7 +1829,6 @@ static void sdhci_tegra_remove(struct platform_device *pdev)
|
|||
pm_runtime_force_suspend(&pdev->dev);
|
||||
|
||||
clk_disable_unprepare(tegra_host->tmclk);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
static int __maybe_unused sdhci_tegra_runtime_suspend(struct device *dev)
|
||||
|
|
|
|||
|
|
@ -532,14 +532,13 @@ static int xenon_probe(struct platform_device *pdev)
|
|||
|
||||
if (dev->of_node) {
|
||||
pltfm_host->clk = devm_clk_get(&pdev->dev, "core");
|
||||
if (IS_ERR(pltfm_host->clk)) {
|
||||
err = PTR_ERR(pltfm_host->clk);
|
||||
dev_err(&pdev->dev, "Failed to setup input clk: %d\n", err);
|
||||
goto free_pltfm;
|
||||
}
|
||||
if (IS_ERR(pltfm_host->clk))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(pltfm_host->clk),
|
||||
"Failed to setup input clk.\n");
|
||||
|
||||
err = clk_prepare_enable(pltfm_host->clk);
|
||||
if (err)
|
||||
goto free_pltfm;
|
||||
return err;
|
||||
|
||||
priv->axi_clk = devm_clk_get(&pdev->dev, "axi");
|
||||
if (IS_ERR(priv->axi_clk)) {
|
||||
|
|
@ -603,8 +602,6 @@ err_clk_axi:
|
|||
clk_disable_unprepare(priv->axi_clk);
|
||||
err_clk:
|
||||
clk_disable_unprepare(pltfm_host->clk);
|
||||
free_pltfm:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -623,8 +620,6 @@ static void xenon_remove(struct platform_device *pdev)
|
|||
xenon_sdhc_unprepare(host);
|
||||
clk_disable_unprepare(priv->axi_clk);
|
||||
clk_disable_unprepare(pltfm_host->clk);
|
||||
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
|
@ -648,11 +643,8 @@ static int xenon_runtime_suspend(struct device *dev)
|
|||
struct sdhci_host *host = dev_get_drvdata(dev);
|
||||
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||||
struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);
|
||||
int ret;
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
if (ret)
|
||||
return ret;
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
if (host->tuning_mode != SDHCI_TUNING_MODE_3)
|
||||
mmc_retune_needed(host->mmc);
|
||||
|
|
@ -687,9 +679,7 @@ static int xenon_runtime_resume(struct device *dev)
|
|||
priv->restore_needed = false;
|
||||
}
|
||||
|
||||
ret = sdhci_runtime_resume_host(host, 0);
|
||||
if (ret)
|
||||
goto out;
|
||||
sdhci_runtime_resume_host(host, 0);
|
||||
return 0;
|
||||
out:
|
||||
clk_disable_unprepare(pltfm_host->clk);
|
||||
|
|
|
|||
|
|
@ -3858,7 +3858,7 @@ int sdhci_resume_host(struct sdhci_host *host)
|
|||
|
||||
EXPORT_SYMBOL_GPL(sdhci_resume_host);
|
||||
|
||||
int sdhci_runtime_suspend_host(struct sdhci_host *host)
|
||||
void sdhci_runtime_suspend_host(struct sdhci_host *host)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
|
|
@ -3875,12 +3875,10 @@ int sdhci_runtime_suspend_host(struct sdhci_host *host)
|
|||
spin_lock_irqsave(&host->lock, flags);
|
||||
host->runtime_suspended = true;
|
||||
spin_unlock_irqrestore(&host->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sdhci_runtime_suspend_host);
|
||||
|
||||
int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset)
|
||||
void sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset)
|
||||
{
|
||||
struct mmc_host *mmc = host->mmc;
|
||||
unsigned long flags;
|
||||
|
|
@ -3926,8 +3924,6 @@ int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset)
|
|||
sdhci_enable_card_detection(host);
|
||||
|
||||
spin_unlock_irqrestore(&host->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(sdhci_runtime_resume_host);
|
||||
|
||||
|
|
@ -4071,7 +4067,7 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,
|
|||
|
||||
WARN_ON(dev == NULL);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct sdhci_host) + priv_size, dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(struct sdhci_host) + priv_size);
|
||||
if (!mmc)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
|
@ -4995,13 +4991,6 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
|
|||
|
||||
EXPORT_SYMBOL_GPL(sdhci_remove_host);
|
||||
|
||||
void sdhci_free_host(struct sdhci_host *host)
|
||||
{
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL_GPL(sdhci_free_host);
|
||||
|
||||
/*****************************************************************************\
|
||||
* *
|
||||
* Driver init/exit *
|
||||
|
|
|
|||
|
|
@ -811,7 +811,6 @@ static inline u8 sdhci_readb(struct sdhci_host *host, int reg)
|
|||
#endif /* CONFIG_MMC_SDHCI_IO_ACCESSORS */
|
||||
|
||||
struct sdhci_host *sdhci_alloc_host(struct device *dev, size_t priv_size);
|
||||
void sdhci_free_host(struct sdhci_host *host);
|
||||
|
||||
static inline void *sdhci_priv(struct sdhci_host *host)
|
||||
{
|
||||
|
|
@ -879,8 +878,8 @@ bool sdhci_enable_irq_wakeups(struct sdhci_host *host);
|
|||
void sdhci_disable_irq_wakeups(struct sdhci_host *host);
|
||||
int sdhci_suspend_host(struct sdhci_host *host);
|
||||
int sdhci_resume_host(struct sdhci_host *host);
|
||||
int sdhci_runtime_suspend_host(struct sdhci_host *host);
|
||||
int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset);
|
||||
void sdhci_runtime_suspend_host(struct sdhci_host *host);
|
||||
void sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset);
|
||||
#endif
|
||||
|
||||
void sdhci_cqe_enable(struct mmc_host *mmc);
|
||||
|
|
|
|||
|
|
@ -945,35 +945,30 @@ static int sdhci_am654_probe(struct platform_device *pdev)
|
|||
clk_xin = devm_clk_get(dev, "clk_xin");
|
||||
if (IS_ERR(clk_xin)) {
|
||||
dev_err(dev, "clk_xin clock not found.\n");
|
||||
ret = PTR_ERR(clk_xin);
|
||||
goto err_pltfm_free;
|
||||
return PTR_ERR(clk_xin);
|
||||
}
|
||||
|
||||
pltfm_host->clk = clk_xin;
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 1);
|
||||
if (IS_ERR(base)) {
|
||||
ret = PTR_ERR(base);
|
||||
goto err_pltfm_free;
|
||||
return PTR_ERR(base);
|
||||
}
|
||||
|
||||
sdhci_am654->base = devm_regmap_init_mmio(dev, base,
|
||||
&sdhci_am654_regmap_config);
|
||||
if (IS_ERR(sdhci_am654->base)) {
|
||||
dev_err(dev, "Failed to initialize regmap\n");
|
||||
ret = PTR_ERR(sdhci_am654->base);
|
||||
goto err_pltfm_free;
|
||||
return PTR_ERR(sdhci_am654->base);
|
||||
}
|
||||
|
||||
ret = sdhci_am654_get_of_property(pdev, sdhci_am654);
|
||||
if (ret)
|
||||
goto err_pltfm_free;
|
||||
return ret;
|
||||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret) {
|
||||
dev_err_probe(dev, ret, "parsing dt failed\n");
|
||||
goto err_pltfm_free;
|
||||
}
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "parsing dt failed\n");
|
||||
|
||||
host->mmc_host_ops.start_signal_voltage_switch = sdhci_am654_start_signal_voltage_switch;
|
||||
host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
|
||||
|
|
@ -994,7 +989,6 @@ static int sdhci_am654_probe(struct platform_device *pdev)
|
|||
/* Setting up autosuspend */
|
||||
pm_runtime_set_autosuspend_delay(dev, SDHCI_AM654_AUTOSUSPEND_DELAY);
|
||||
pm_runtime_use_autosuspend(dev);
|
||||
pm_runtime_mark_last_busy(dev);
|
||||
pm_runtime_put_autosuspend(dev);
|
||||
return 0;
|
||||
|
||||
|
|
@ -1004,8 +998,6 @@ pm_disable:
|
|||
pm_runtime_disable(dev);
|
||||
pm_put:
|
||||
pm_runtime_put_noidle(dev);
|
||||
err_pltfm_free:
|
||||
sdhci_pltfm_free(pdev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1024,7 +1016,6 @@ static void sdhci_am654_remove(struct platform_device *pdev)
|
|||
clk_disable_unprepare(pltfm_host->clk);
|
||||
pm_runtime_disable(dev);
|
||||
pm_runtime_put_noidle(dev);
|
||||
sdhci_pltfm_free(pdev);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
|
@ -1085,9 +1076,7 @@ static int sdhci_am654_runtime_suspend(struct device *dev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = sdhci_runtime_suspend_host(host);
|
||||
if (ret)
|
||||
return ret;
|
||||
sdhci_runtime_suspend_host(host);
|
||||
|
||||
/* disable the clock */
|
||||
clk_disable_unprepare(pltfm_host->clk);
|
||||
|
|
@ -1109,9 +1098,7 @@ static int sdhci_am654_runtime_resume(struct device *dev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = sdhci_runtime_resume_host(host, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
sdhci_runtime_resume_host(host, 0);
|
||||
|
||||
ret = cqhci_resume(host->mmc);
|
||||
if (ret)
|
||||
|
|
|
|||
|
|
@ -133,20 +133,18 @@ static int sdhci_f_sdh30_probe(struct platform_device *pdev)
|
|||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
if (dev_of_node(dev)) {
|
||||
sdhci_get_of_property(pdev);
|
||||
|
||||
priv->clk_iface = devm_clk_get(&pdev->dev, "iface");
|
||||
if (IS_ERR(priv->clk_iface)) {
|
||||
ret = PTR_ERR(priv->clk_iface);
|
||||
goto err;
|
||||
}
|
||||
if (IS_ERR(priv->clk_iface))
|
||||
return PTR_ERR(priv->clk_iface);
|
||||
|
||||
ret = clk_prepare_enable(priv->clk_iface);
|
||||
if (ret)
|
||||
goto err;
|
||||
return ret;
|
||||
|
||||
priv->clk = devm_clk_get(&pdev->dev, "core");
|
||||
if (IS_ERR(priv->clk)) {
|
||||
|
|
@ -200,9 +198,6 @@ err_rst:
|
|||
clk_disable_unprepare(priv->clk);
|
||||
err_clk:
|
||||
clk_disable_unprepare(priv->clk_iface);
|
||||
err:
|
||||
sdhci_pltfm_free(pdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -403,9 +403,9 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
|||
}
|
||||
/* allocate privdata */
|
||||
mmc = pcmcia_dev->priv =
|
||||
mmc_alloc_host(sizeof(struct sdricoh_host), &pcmcia_dev->dev);
|
||||
devm_mmc_alloc_host(&pcmcia_dev->dev, sizeof(*host));
|
||||
if (!mmc) {
|
||||
dev_err(dev, "mmc_alloc_host failed\n");
|
||||
dev_err(dev, "devm_mmc_alloc_host failed\n");
|
||||
result = -ENOMEM;
|
||||
goto unmap_io;
|
||||
}
|
||||
|
|
@ -431,7 +431,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
|||
if (sdricoh_reset(host)) {
|
||||
dev_dbg(dev, "could not reset\n");
|
||||
result = -EIO;
|
||||
goto free_host;
|
||||
goto unmap_io;
|
||||
}
|
||||
|
||||
result = mmc_add_host(mmc);
|
||||
|
|
@ -440,8 +440,6 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev,
|
|||
dev_dbg(dev, "mmc host registered\n");
|
||||
return 0;
|
||||
}
|
||||
free_host:
|
||||
mmc_free_host(mmc);
|
||||
unmap_io:
|
||||
pci_iounmap(pci_dev, iobase);
|
||||
return result;
|
||||
|
|
@ -483,10 +481,8 @@ static void sdricoh_pcmcia_detach(struct pcmcia_device *link)
|
|||
mmc_remove_host(mmc);
|
||||
pci_iounmap(host->pci_dev, host->iobase);
|
||||
pci_dev_put(host->pci_dev);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
pcmcia_disable_device(link);
|
||||
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
|
|
|||
|
|
@ -1444,13 +1444,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(reg))
|
||||
return PTR_ERR(reg);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct sh_mmcif_host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret < 0)
|
||||
goto err_host;
|
||||
return ret;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
|
@ -1481,15 +1481,13 @@ static int sh_mmcif_probe(struct platform_device *pdev)
|
|||
platform_set_drvdata(pdev, host);
|
||||
|
||||
host->clk = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(host->clk)) {
|
||||
ret = PTR_ERR(host->clk);
|
||||
dev_err(dev, "cannot get clock: %d\n", ret);
|
||||
goto err_host;
|
||||
}
|
||||
if (IS_ERR(host->clk))
|
||||
return dev_err_probe(dev, PTR_ERR(host->clk),
|
||||
"cannot get clock\n");
|
||||
|
||||
ret = clk_prepare_enable(host->clk);
|
||||
if (ret < 0)
|
||||
goto err_host;
|
||||
return ret;
|
||||
|
||||
sh_mmcif_clk_setup(host);
|
||||
|
||||
|
|
@ -1542,8 +1540,6 @@ err_clk:
|
|||
clk_disable_unprepare(host->clk);
|
||||
pm_runtime_put_sync(dev);
|
||||
pm_runtime_disable(dev);
|
||||
err_host:
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1568,7 +1564,6 @@ static void sh_mmcif_remove(struct platform_device *pdev)
|
|||
cancel_delayed_work_sync(&host->timeout_work);
|
||||
|
||||
clk_disable_unprepare(host->clk);
|
||||
mmc_free_host(host->mmc);
|
||||
pm_runtime_put_sync(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1369,11 +1369,10 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
|
|||
struct mmc_host *mmc;
|
||||
int ret;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct sunxi_mmc_host), &pdev->dev);
|
||||
if (!mmc) {
|
||||
dev_err(&pdev->dev, "mmc alloc host failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return dev_err_probe(&pdev->dev, -ENOMEM,
|
||||
"mmc alloc host failed\n");
|
||||
platform_set_drvdata(pdev, mmc);
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
|
|
@ -1383,15 +1382,13 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
|
|||
|
||||
ret = sunxi_mmc_resource_request(host, pdev);
|
||||
if (ret)
|
||||
goto error_free_host;
|
||||
return ret;
|
||||
|
||||
host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE,
|
||||
&host->sg_dma, GFP_KERNEL);
|
||||
if (!host->sg_cpu) {
|
||||
dev_err(&pdev->dev, "Failed to allocate DMA descriptor mem\n");
|
||||
ret = -ENOMEM;
|
||||
goto error_free_host;
|
||||
}
|
||||
if (!host->sg_cpu)
|
||||
return dev_err_probe(&pdev->dev, -ENOMEM,
|
||||
"Failed to allocate DMA descriptor mem\n");
|
||||
|
||||
if (host->cfg->ccu_has_timings_switch) {
|
||||
/*
|
||||
|
|
@ -1481,8 +1478,6 @@ static int sunxi_mmc_probe(struct platform_device *pdev)
|
|||
|
||||
error_free_dma:
|
||||
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
|
||||
error_free_host:
|
||||
mmc_free_host(mmc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1498,7 +1493,6 @@ static void sunxi_mmc_remove(struct platform_device *pdev)
|
|||
sunxi_mmc_disable(host);
|
||||
}
|
||||
dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma);
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
|
|
|||
|
|
@ -947,7 +947,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)
|
|||
return rc;
|
||||
}
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct tifm_sd), &sock->dev);
|
||||
mmc = devm_mmc_alloc_host(&sock->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -982,10 +982,7 @@ static int tifm_sd_probe(struct tifm_dev *sock)
|
|||
|
||||
if (!rc)
|
||||
rc = mmc_add_host(mmc);
|
||||
if (!rc)
|
||||
return 0;
|
||||
|
||||
mmc_free_host(mmc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -1015,8 +1012,6 @@ static void tifm_sd_remove(struct tifm_dev *sock)
|
|||
spin_unlock_irqrestore(&sock->lock, flags);
|
||||
mmc_remove_host(mmc);
|
||||
dev_dbg(&sock->dev, "after remove\n");
|
||||
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
|
|
|||
|
|
@ -193,13 +193,13 @@ struct tmio_mmc_host {
|
|||
bool (*check_retune)(struct tmio_mmc_host *host, struct mmc_request *mrq);
|
||||
void (*fixup_request)(struct tmio_mmc_host *host, struct mmc_request *mrq);
|
||||
unsigned int (*get_timeout_cycles)(struct tmio_mmc_host *host);
|
||||
void (*sdio_irq)(struct tmio_mmc_host *host);
|
||||
|
||||
const struct tmio_mmc_dma_ops *dma_ops;
|
||||
};
|
||||
|
||||
struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
|
||||
struct tmio_mmc_data *pdata);
|
||||
void tmio_mmc_host_free(struct tmio_mmc_host *host);
|
||||
int tmio_mmc_host_probe(struct tmio_mmc_host *host);
|
||||
void tmio_mmc_host_remove(struct tmio_mmc_host *host);
|
||||
void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable)
|
|||
sd_ctrl_write16(host, CTL_SDIO_IRQ_MASK, host->sdio_irq_mask);
|
||||
|
||||
host->sdio_irq_enabled = false;
|
||||
pm_runtime_mark_last_busy(mmc_dev(mmc));
|
||||
pm_runtime_put_autosuspend(mmc_dev(mmc));
|
||||
}
|
||||
}
|
||||
|
|
@ -696,8 +695,11 @@ static bool __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
|
|||
|
||||
sd_ctrl_write16(host, CTL_SDIO_STATUS, sdio_status);
|
||||
|
||||
if (mmc->caps & MMC_CAP_SDIO_IRQ && ireg & TMIO_SDIO_STAT_IOIRQ)
|
||||
if (mmc->caps & MMC_CAP_SDIO_IRQ && ireg & TMIO_SDIO_STAT_IOIRQ) {
|
||||
if (host->sdio_irq)
|
||||
host->sdio_irq(host);
|
||||
mmc_signal_sdio_irq(mmc);
|
||||
}
|
||||
|
||||
return ireg;
|
||||
}
|
||||
|
|
@ -1097,7 +1099,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
|
|||
if (IS_ERR(ctl))
|
||||
return ERR_CAST(ctl);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
|
|
@ -1110,29 +1112,17 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev,
|
|||
mmc->ops = &host->ops;
|
||||
|
||||
ret = mmc_of_parse(host->mmc);
|
||||
if (ret) {
|
||||
host = ERR_PTR(ret);
|
||||
goto free;
|
||||
}
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
tmio_mmc_of_parse(pdev, mmc);
|
||||
|
||||
platform_set_drvdata(pdev, host);
|
||||
|
||||
return host;
|
||||
free:
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return host;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc);
|
||||
|
||||
void tmio_mmc_host_free(struct tmio_mmc_host *host)
|
||||
{
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tmio_mmc_host_free);
|
||||
|
||||
int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
|
||||
{
|
||||
struct platform_device *pdev = _host->pdev;
|
||||
|
|
|
|||
|
|
@ -612,7 +612,7 @@ static int toshsd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct toshsd_host), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*host));
|
||||
if (!mmc) {
|
||||
ret = -ENOMEM;
|
||||
goto err;
|
||||
|
|
@ -669,7 +669,6 @@ unmap:
|
|||
release:
|
||||
pci_release_regions(pdev);
|
||||
free:
|
||||
mmc_free_host(mmc);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
err:
|
||||
pci_disable_device(pdev);
|
||||
|
|
@ -685,7 +684,6 @@ static void toshsd_remove(struct pci_dev *pdev)
|
|||
free_irq(pdev->irq, host);
|
||||
pci_iounmap(pdev, host->ioaddr);
|
||||
pci_release_regions(pdev);
|
||||
mmc_free_host(host->mmc);
|
||||
pci_set_drvdata(pdev, NULL);
|
||||
pci_disable_device(pdev);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -663,8 +663,7 @@ static int uniphier_sd_probe(struct platform_device *pdev)
|
|||
priv->rst_hw = devm_reset_control_get_exclusive(dev, "hw");
|
||||
if (IS_ERR(priv->rst_hw)) {
|
||||
dev_err(dev, "failed to get hw reset\n");
|
||||
ret = PTR_ERR(priv->rst_hw);
|
||||
goto free_host;
|
||||
return PTR_ERR(priv->rst_hw);
|
||||
}
|
||||
host->ops.card_hw_reset = uniphier_sd_hw_reset;
|
||||
}
|
||||
|
|
@ -694,7 +693,7 @@ static int uniphier_sd_probe(struct platform_device *pdev)
|
|||
|
||||
ret = uniphier_sd_clk_enable(host);
|
||||
if (ret)
|
||||
goto free_host;
|
||||
return ret;
|
||||
|
||||
uniphier_sd_host_init(host);
|
||||
|
||||
|
|
@ -720,8 +719,6 @@ static int uniphier_sd_probe(struct platform_device *pdev)
|
|||
|
||||
disable_clk:
|
||||
uniphier_sd_clk_disable(host);
|
||||
free_host:
|
||||
tmio_mmc_host_free(host);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -732,7 +729,6 @@ static void uniphier_sd_remove(struct platform_device *pdev)
|
|||
|
||||
tmio_mmc_host_remove(host);
|
||||
uniphier_sd_clk_disable(host);
|
||||
tmio_mmc_host_free(host);
|
||||
}
|
||||
|
||||
static const struct of_device_id uniphier_sd_match[] = {
|
||||
|
|
|
|||
|
|
@ -1762,17 +1762,17 @@ static int usdhi6_probe(struct platform_device *pdev)
|
|||
if (irq_sdio < 0)
|
||||
return irq_sdio;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct usdhi6_host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = mmc_regulator_get_supply(mmc);
|
||||
if (ret)
|
||||
goto e_free_mmc;
|
||||
return ret;
|
||||
|
||||
ret = mmc_of_parse(mmc);
|
||||
if (ret < 0)
|
||||
goto e_free_mmc;
|
||||
return ret;
|
||||
|
||||
host = mmc_priv(mmc);
|
||||
host->mmc = mmc;
|
||||
|
|
@ -1785,30 +1785,24 @@ static int usdhi6_probe(struct platform_device *pdev)
|
|||
mmc->max_busy_timeout = USDHI6_REQ_TIMEOUT_MS;
|
||||
|
||||
host->pinctrl = devm_pinctrl_get(&pdev->dev);
|
||||
if (IS_ERR(host->pinctrl)) {
|
||||
ret = PTR_ERR(host->pinctrl);
|
||||
goto e_free_mmc;
|
||||
}
|
||||
if (IS_ERR(host->pinctrl))
|
||||
return PTR_ERR(host->pinctrl);
|
||||
|
||||
host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs");
|
||||
|
||||
host->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||
if (IS_ERR(host->base)) {
|
||||
ret = PTR_ERR(host->base);
|
||||
goto e_free_mmc;
|
||||
}
|
||||
if (IS_ERR(host->base))
|
||||
return PTR_ERR(host->base);
|
||||
|
||||
host->clk = devm_clk_get(dev, NULL);
|
||||
if (IS_ERR(host->clk)) {
|
||||
ret = PTR_ERR(host->clk);
|
||||
goto e_free_mmc;
|
||||
}
|
||||
if (IS_ERR(host->clk))
|
||||
return PTR_ERR(host->clk);
|
||||
|
||||
host->imclk = clk_get_rate(host->clk);
|
||||
|
||||
ret = clk_prepare_enable(host->clk);
|
||||
if (ret < 0)
|
||||
goto e_free_mmc;
|
||||
return ret;
|
||||
|
||||
version = usdhi6_read(host, USDHI6_VERSION);
|
||||
if ((version & 0xfff) != 0xa0d) {
|
||||
|
|
@ -1878,9 +1872,6 @@ e_release_dma:
|
|||
usdhi6_dma_release(host);
|
||||
e_clk_off:
|
||||
clk_disable_unprepare(host->clk);
|
||||
e_free_mmc:
|
||||
mmc_free_host(mmc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1894,7 +1885,6 @@ static void usdhi6_remove(struct platform_device *pdev)
|
|||
cancel_delayed_work_sync(&host->timeout_work);
|
||||
usdhi6_dma_release(host);
|
||||
clk_disable_unprepare(host->clk);
|
||||
mmc_free_host(host->mmc);
|
||||
}
|
||||
|
||||
static struct platform_driver usdhi6_driver = {
|
||||
|
|
|
|||
|
|
@ -404,8 +404,6 @@ static void ushc_clean_up(struct ushc_data *ushc)
|
|||
kfree(ushc->int_data);
|
||||
kfree(ushc->cbw);
|
||||
kfree(ushc->csw);
|
||||
|
||||
mmc_free_host(ushc->mmc);
|
||||
}
|
||||
|
||||
static const struct mmc_host_ops ushc_ops = {
|
||||
|
|
@ -425,7 +423,7 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
|
|||
if (intf->cur_altsetting->desc.bNumEndpoints < 1)
|
||||
return -ENODEV;
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev);
|
||||
mmc = devm_mmc_alloc_host(&intf->dev, sizeof(*ushc));
|
||||
if (mmc == NULL)
|
||||
return -ENOMEM;
|
||||
ushc = mmc_priv(mmc);
|
||||
|
|
|
|||
|
|
@ -1100,7 +1100,7 @@ static int via_sd_probe(struct pci_dev *pcidev,
|
|||
pci_write_config_byte(pcidev, VIA_CRDR_PCI_WORK_MODE, 0);
|
||||
pci_write_config_byte(pcidev, VIA_CRDR_PCI_DBG_MODE, 0);
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct via_crdr_mmc_host), &pcidev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pcidev->dev, sizeof(*sdhost));
|
||||
if (!mmc) {
|
||||
ret = -ENOMEM;
|
||||
goto release;
|
||||
|
|
@ -1115,7 +1115,7 @@ static int via_sd_probe(struct pci_dev *pcidev,
|
|||
sdhost->mmiobase = ioremap(base, len);
|
||||
if (!sdhost->mmiobase) {
|
||||
ret = -ENOMEM;
|
||||
goto free_mmc_host;
|
||||
goto release;
|
||||
}
|
||||
|
||||
sdhost->sdhc_mmiobase =
|
||||
|
|
@ -1160,8 +1160,6 @@ static int via_sd_probe(struct pci_dev *pcidev,
|
|||
|
||||
unmap:
|
||||
iounmap(sdhost->mmiobase);
|
||||
free_mmc_host:
|
||||
mmc_free_host(mmc);
|
||||
release:
|
||||
pci_release_regions(pcidev);
|
||||
disable:
|
||||
|
|
@ -1212,7 +1210,6 @@ static void via_sd_remove(struct pci_dev *pcidev)
|
|||
writeb(gatt, sdhost->pcictrl_mmiobase + VIA_CRDR_PCICLKGATT);
|
||||
|
||||
iounmap(sdhost->mmiobase);
|
||||
mmc_free_host(sdhost->mmc);
|
||||
pci_release_regions(pcidev);
|
||||
pci_disable_device(pcidev);
|
||||
|
||||
|
|
|
|||
|
|
@ -369,13 +369,11 @@ struct vub300_mmc_host {
|
|||
static void vub300_delete(struct kref *kref)
|
||||
{ /* kref callback - softirq */
|
||||
struct vub300_mmc_host *vub300 = kref_to_vub300_mmc_host(kref);
|
||||
struct mmc_host *mmc = vub300->mmc;
|
||||
usb_free_urb(vub300->command_out_urb);
|
||||
vub300->command_out_urb = NULL;
|
||||
usb_free_urb(vub300->command_res_urb);
|
||||
vub300->command_res_urb = NULL;
|
||||
usb_put_dev(vub300->udev);
|
||||
mmc_free_host(mmc);
|
||||
/*
|
||||
* and hence also frees vub300
|
||||
* which is contained at the end of struct mmc
|
||||
|
|
@ -2114,7 +2112,7 @@ static int vub300_probe(struct usb_interface *interface,
|
|||
goto error1;
|
||||
}
|
||||
/* this also allocates memory for our VUB300 mmc host device */
|
||||
mmc = mmc_alloc_host(sizeof(struct vub300_mmc_host), &udev->dev);
|
||||
mmc = devm_mmc_alloc_host(&udev->dev, sizeof(*vub300));
|
||||
if (!mmc) {
|
||||
retval = -ENOMEM;
|
||||
dev_err(&udev->dev, "not enough memory for the mmc_host\n");
|
||||
|
|
@ -2271,7 +2269,7 @@ static int vub300_probe(struct usb_interface *interface,
|
|||
dev_err(&vub300->udev->dev,
|
||||
"Could not find two sets of bulk-in/out endpoint pairs\n");
|
||||
retval = -EINVAL;
|
||||
goto error5;
|
||||
goto error4;
|
||||
}
|
||||
retval =
|
||||
usb_control_msg(vub300->udev, usb_rcvctrlpipe(vub300->udev, 0),
|
||||
|
|
@ -2280,14 +2278,14 @@ static int vub300_probe(struct usb_interface *interface,
|
|||
0x0000, 0x0000, &vub300->hc_info,
|
||||
sizeof(vub300->hc_info), 1000);
|
||||
if (retval < 0)
|
||||
goto error5;
|
||||
goto error4;
|
||||
retval =
|
||||
usb_control_msg(vub300->udev, usb_sndctrlpipe(vub300->udev, 0),
|
||||
SET_ROM_WAIT_STATES,
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
firmware_rom_wait_states, 0x0000, NULL, 0, 1000);
|
||||
if (retval < 0)
|
||||
goto error5;
|
||||
goto error4;
|
||||
dev_info(&vub300->udev->dev,
|
||||
"operating_mode = %s %s %d MHz %s %d byte USB packets\n",
|
||||
(mmc->caps & MMC_CAP_SDIO_IRQ) ? "IRQs" : "POLL",
|
||||
|
|
@ -2302,7 +2300,7 @@ static int vub300_probe(struct usb_interface *interface,
|
|||
0x0000, 0x0000, &vub300->system_port_status,
|
||||
sizeof(vub300->system_port_status), 1000);
|
||||
if (retval < 0) {
|
||||
goto error5;
|
||||
goto error4;
|
||||
} else if (sizeof(vub300->system_port_status) == retval) {
|
||||
vub300->card_present =
|
||||
(0x0001 & vub300->system_port_status.port_flags) ? 1 : 0;
|
||||
|
|
@ -2310,7 +2308,7 @@ static int vub300_probe(struct usb_interface *interface,
|
|||
(0x0010 & vub300->system_port_status.port_flags) ? 1 : 0;
|
||||
} else {
|
||||
retval = -EINVAL;
|
||||
goto error5;
|
||||
goto error4;
|
||||
}
|
||||
usb_set_intfdata(interface, vub300);
|
||||
INIT_DELAYED_WORK(&vub300->pollwork, vub300_pollwork_thread);
|
||||
|
|
@ -2340,8 +2338,6 @@ static int vub300_probe(struct usb_interface *interface,
|
|||
return 0;
|
||||
error6:
|
||||
timer_delete_sync(&vub300->inactivity_timer);
|
||||
error5:
|
||||
mmc_free_host(mmc);
|
||||
/*
|
||||
* and hence also frees vub300
|
||||
* which is contained at the end of struct mmc
|
||||
|
|
|
|||
|
|
@ -1190,7 +1190,7 @@ static int wbsd_alloc_mmc(struct device *dev)
|
|||
/*
|
||||
* Allocate MMC structure.
|
||||
*/
|
||||
mmc = mmc_alloc_host(sizeof(struct wbsd_host), dev);
|
||||
mmc = devm_mmc_alloc_host(dev, sizeof(*host));
|
||||
if (!mmc)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1262,8 +1262,6 @@ static void wbsd_free_mmc(struct device *dev)
|
|||
BUG_ON(host == NULL);
|
||||
|
||||
timer_delete_sync(&host->ignore_timer);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -774,7 +774,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
|
|||
goto fail1;
|
||||
}
|
||||
|
||||
mmc = mmc_alloc_host(sizeof(struct wmt_mci_priv), &pdev->dev);
|
||||
mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(*priv));
|
||||
if (!mmc) {
|
||||
dev_err(&pdev->dev, "Failed to allocate mmc_host\n");
|
||||
ret = -ENOMEM;
|
||||
|
|
@ -808,7 +808,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
|
|||
if (!priv->sdmmc_base) {
|
||||
dev_err(&pdev->dev, "Failed to map IO space\n");
|
||||
ret = -ENOMEM;
|
||||
goto fail2;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
priv->irq_regular = regular_irq;
|
||||
|
|
@ -873,8 +873,6 @@ fail4:
|
|||
free_irq(regular_irq, priv);
|
||||
fail3:
|
||||
iounmap(priv->sdmmc_base);
|
||||
fail2:
|
||||
mmc_free_host(mmc);
|
||||
fail1:
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -910,8 +908,6 @@ static void wmt_mci_remove(struct platform_device *pdev)
|
|||
clk_disable_unprepare(priv->clk_sdmmc);
|
||||
clk_put(priv->clk_sdmmc);
|
||||
|
||||
mmc_free_host(mmc);
|
||||
|
||||
dev_info(&pdev->dev, "WMT MCI device removed\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue