Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mmc-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc

Pull MMC updates from Ulf Hansson:
"MMC core:
- Extend slot-gpio to be used for host specific card detect interrupts
- Align to common busy polling behaviour for mmc ioctls
- Suggest the BFQ I/O scheduler to be built along with MMC/SD support
- Add devm_mmc_alloc_host() to enable further cleanups in host drivers

MMC host:
- atmel-mci: Fix race condition when stopping/starting a command
- dw_mmc-starfive: Add new driver to support the StarFive JH7110 variant
- dw_mmc-rockchip: Add support for the RK3588 variant
- jz4740: Add support for the vqmmc power supply
- meson-gx: Convert the DT bindings to the dt-schema
- meson-gx: Enable the platform interrupt to be used for card detect
- moxart: Set the supported maximum request/block/segment sizes
- renesas,sdhi: Add support for the RZ/V2M variants
- sdhci: Rework code to drop SDHCI_QUIRK_MISSING_CAPS
- sdhci-esdhc-imx: Improve tuning logic support
- sdhci-msm: Add support for the IPQ5332 and the IPQ9574 variants
- sdhci-of-dwcmshc: Add the missing device table IDs for acpi
- sdhci-of-dwcmshc: Improve clock support for the Rockchip variant
- sdhci-of-dwcmshc: Enable support of V4 host for the BlueField-3 variant
- sdhci-pxav2: Add support for the PXA168 V1 variant
- sdhci-pxav2: Add support for SDIO IRQs for the PXA168 V1 variant
- uniphier-sd: Add support for SD UHS-I speed modes"

* tag 'mmc-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (59 commits)
mmc: meson-gx: Use devm_platform_get_and_ioremap_resource()
mmc: meson-gx: constify member data of struct meson_host
mmc: meson-gx: use devm_clk_get_enabled() for core clock
mmc: core: fix return value check in devm_mmc_alloc_host()
dt-bindings: mmc: meson-gx: fix interrupt binding
mmc: meson-gx: support platform interrupt as card detect interrupt
dt-bindings: mmc: meson-gx: support specifying cd interrupt
mmc: core: support setting card detect interrupt from drivers
mmc: starfive: Add sdio/emmc driver support
dt-bindings: mmc: Add StarFive MMC module
dt-bindings: mmc: sdhci-msm: Allow 1 icc path
dt-bindings: mmc: rockchip-dw-mshc: Add RK3588 compatible string
mmc: core: Align to common busy polling behaviour for mmc ioctls
dt-bindings: mmc: Add resets property to cadence SDHCI binding
mmc: meson-gx: remove meson_mmc_get_cd
mmc: moxart: set maximum request/block/segment sizes
mmc: sdhci-brcmstb: Use devm_platform_get_and_ioremap_resource()
mmc: sdhci-of-dwcmshc: add the missing device table IDs for acpi
mmc: sdhci-of-dwcmshc: Update DLL and pre-change delay for rockchip platform
mmc: jz4740: Add support for vqmmc power supply
...

+922 -236
+1 -1
Documentation/devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml
··· 7 7 title: Allwinner A10 MMC Controller 8 8 9 9 allOf: 10 - - $ref: "mmc-controller.yaml" 10 + - $ref: mmc-controller.yaml 11 11 12 12 maintainers: 13 13 - Chen-Yu Tsai <wens@csie.org>
+76
Documentation/devicetree/bindings/mmc/amlogic,meson-gx-mmc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mmc/amlogic,meson-gx-mmc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Amlogic SD / eMMC controller for S905/GXBB family SoCs 8 + 9 + description: 10 + The MMC 5.1 compliant host controller on Amlogic provides the 11 + interface for SD, eMMC and SDIO devices 12 + 13 + maintainers: 14 + - Neil Armstrong <neil.armstrong@linaro.org> 15 + 16 + allOf: 17 + - $ref: mmc-controller.yaml# 18 + 19 + properties: 20 + compatible: 21 + oneOf: 22 + - const: amlogic,meson-axg-mmc 23 + - items: 24 + - const: amlogic,meson-gx-mmc 25 + - const: amlogic,meson-gxbb-mmc 26 + 27 + reg: 28 + maxItems: 1 29 + 30 + interrupts: 31 + minItems: 1 32 + items: 33 + - description: mmc controller instance 34 + - description: card detect 35 + 36 + clocks: 37 + maxItems: 3 38 + 39 + clock-names: 40 + items: 41 + - const: core 42 + - const: clkin0 43 + - const: clkin1 44 + 45 + resets: 46 + maxItems: 1 47 + 48 + amlogic,dram-access-quirk: 49 + type: boolean 50 + description: 51 + set when controller's internal DMA engine cannot access the DRAM memory, 52 + like on the G12A dedicated SDIO controller. 53 + 54 + required: 55 + - compatible 56 + - reg 57 + - interrupts 58 + - clocks 59 + - clock-names 60 + - resets 61 + 62 + unevaluatedProperties: false 63 + 64 + examples: 65 + - | 66 + #include <dt-bindings/interrupt-controller/irq.h> 67 + #include <dt-bindings/interrupt-controller/arm-gic.h> 68 + mmc@70000 { 69 + compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc"; 70 + reg = <0x70000 0x2000>; 71 + interrupts = <GIC_SPI 216 IRQ_TYPE_EDGE_RISING>; 72 + clocks = <&clk_mmc>, <&xtal>, <&clk_div>; 73 + clock-names = "core", "clkin0", "clkin1"; 74 + pinctrl-0 = <&emm_pins>; 75 + resets = <&reset_mmc>; 76 + };
-39
Documentation/devicetree/bindings/mmc/amlogic,meson-gx.txt
··· 1 - Amlogic SD / eMMC controller for S905/GXBB family SoCs 2 - 3 - The MMC 5.1 compliant host controller on Amlogic provides the 4 - interface for SD, eMMC and SDIO devices. 5 - 6 - This file documents the properties in addition to those available in 7 - the MMC core bindings, documented by mmc.txt. 8 - 9 - Required properties: 10 - - compatible : contains one of: 11 - - "amlogic,meson-gx-mmc" 12 - - "amlogic,meson-gxbb-mmc" 13 - - "amlogic,meson-gxl-mmc" 14 - - "amlogic,meson-gxm-mmc" 15 - - "amlogic,meson-axg-mmc" 16 - - clocks : A list of phandle + clock-specifier pairs for the clocks listed in clock-names. 17 - - clock-names: Should contain the following: 18 - "core" - Main peripheral bus clock 19 - "clkin0" - Parent clock of internal mux 20 - "clkin1" - Other parent clock of internal mux 21 - The driver has an internal mux clock which switches between clkin0 and clkin1 depending on the 22 - clock rate requested by the MMC core. 23 - - resets : phandle of the internal reset line 24 - 25 - Optional properties: 26 - - amlogic,dram-access-quirk: set when controller's internal DMA engine cannot access the 27 - DRAM memory, like on the G12A dedicated SDIO controller. 28 - 29 - Example: 30 - 31 - sd_emmc_a: mmc@70000 { 32 - compatible = "amlogic,meson-gxbb-mmc"; 33 - reg = <0x0 0x70000 0x0 0x2000>; 34 - interrupts = < GIC_SPI 216 IRQ_TYPE_EDGE_RISING>; 35 - clocks = <&clkc CLKID_SD_EMMC_A>, <&xtal>, <&clkc CLKID_FCLK_DIV2>; 36 - clock-names = "core", "clkin0", "clkin1"; 37 - pinctrl-0 = <&emmc_pins>; 38 - resets = <&reset RESET_SD_EMMC_A>; 39 - };
+1 -1
Documentation/devicetree/bindings/mmc/amlogic,meson-mx-sdhc.yaml
··· 7 7 title: Amlogic Meson SDHC controller 8 8 9 9 allOf: 10 - - $ref: "mmc-controller.yaml" 10 + - $ref: mmc-controller.yaml 11 11 12 12 maintainers: 13 13 - Martin Blumenstingl <martin.blumenstingl@googlemail.com>
+3 -3
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
··· 1 1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 2 %YAML 1.2 3 3 --- 4 - $id: "http://devicetree.org/schemas/mmc/arasan,sdhci.yaml#" 5 - $schema: "http://devicetree.org/meta-schemas/core.yaml#" 4 + $id: http://devicetree.org/schemas/mmc/arasan,sdhci.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 7 title: Arasan SDHCI Controller 8 8 ··· 10 10 - Adrian Hunter <adrian.hunter@intel.com> 11 11 12 12 allOf: 13 - - $ref: "mmc-controller.yaml#" 13 + - $ref: mmc-controller.yaml# 14 14 - if: 15 15 properties: 16 16 compatible:
+14 -11
Documentation/devicetree/bindings/mmc/cdns,sdhci.yaml
··· 29 29 clocks: 30 30 maxItems: 1 31 31 32 + resets: 33 + maxItems: 1 34 + 32 35 # PHY DLL input delays: 33 36 # They are used to delay the data valid window, and align the window to 34 37 # sampling clock. The delay starts from 5ns (for delay parameter equal to 0) ··· 39 36 40 37 cdns,phy-input-delay-sd-highspeed: 41 38 description: Value of the delay in the input path for SD high-speed timing 42 - $ref: "/schemas/types.yaml#/definitions/uint32" 39 + $ref: /schemas/types.yaml#/definitions/uint32 43 40 minimum: 0 44 41 maximum: 0x1f 45 42 46 43 cdns,phy-input-delay-legacy: 47 44 description: Value of the delay in the input path for legacy timing 48 - $ref: "/schemas/types.yaml#/definitions/uint32" 45 + $ref: /schemas/types.yaml#/definitions/uint32 49 46 minimum: 0 50 47 maximum: 0x1f 51 48 52 49 cdns,phy-input-delay-sd-uhs-sdr12: 53 50 description: Value of the delay in the input path for SD UHS SDR12 timing 54 - $ref: "/schemas/types.yaml#/definitions/uint32" 51 + $ref: /schemas/types.yaml#/definitions/uint32 55 52 minimum: 0 56 53 maximum: 0x1f 57 54 58 55 cdns,phy-input-delay-sd-uhs-sdr25: 59 56 description: Value of the delay in the input path for SD UHS SDR25 timing 60 - $ref: "/schemas/types.yaml#/definitions/uint32" 57 + $ref: /schemas/types.yaml#/definitions/uint32 61 58 minimum: 0 62 59 maximum: 0x1f 63 60 64 61 cdns,phy-input-delay-sd-uhs-sdr50: 65 62 description: Value of the delay in the input path for SD UHS SDR50 timing 66 - $ref: "/schemas/types.yaml#/definitions/uint32" 63 + $ref: /schemas/types.yaml#/definitions/uint32 67 64 minimum: 0 68 65 maximum: 0x1f 69 66 70 67 cdns,phy-input-delay-sd-uhs-ddr50: 71 68 description: Value of the delay in the input path for SD UHS DDR50 timing 72 - $ref: "/schemas/types.yaml#/definitions/uint32" 69 + $ref: /schemas/types.yaml#/definitions/uint32 73 70 minimum: 0 74 71 maximum: 0x1f 75 72 76 73 cdns,phy-input-delay-mmc-highspeed: 77 74 description: Value of the delay in the input path for MMC high-speed timing 78 - $ref: "/schemas/types.yaml#/definitions/uint32" 75 + $ref: /schemas/types.yaml#/definitions/uint32 79 76 minimum: 0 80 77 maximum: 0x1f 81 78 ··· 86 83 # Each delay property represents the fraction of the clock period. 87 84 # The approximate delay value will be 88 85 # (<delay property value>/128)*sdmclk_clock_period. 89 - $ref: "/schemas/types.yaml#/definitions/uint32" 86 + $ref: /schemas/types.yaml#/definitions/uint32 90 87 minimum: 0 91 88 maximum: 0x1f 92 89 ··· 94 91 description: | 95 92 Value of the delay introduced on the sdclk output for all modes except 96 93 HS200, HS400 and HS400_ES. 97 - $ref: "/schemas/types.yaml#/definitions/uint32" 94 + $ref: /schemas/types.yaml#/definitions/uint32 98 95 minimum: 0 99 96 maximum: 0x7f 100 97 ··· 102 99 description: | 103 100 Value of the delay introduced on the sdclk output for HS200, HS400 and 104 101 HS400_ES speed modes. 105 - $ref: "/schemas/types.yaml#/definitions/uint32" 102 + $ref: /schemas/types.yaml#/definitions/uint32 106 103 minimum: 0 107 104 maximum: 0x7f 108 105 ··· 110 107 description: | 111 108 Value of the delay introduced on the dat_strobe input used in 112 109 HS400 / HS400_ES speed modes. 113 - $ref: "/schemas/types.yaml#/definitions/uint32" 110 + $ref: /schemas/types.yaml#/definitions/uint32 114 111 minimum: 0 115 112 maximum: 0x7f 116 113
+15 -6
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml
··· 10 10 - Shawn Guo <shawnguo@kernel.org> 11 11 12 12 allOf: 13 - - $ref: "mmc-controller.yaml" 13 + - $ref: mmc-controller.yaml 14 14 15 15 description: | 16 16 The Enhanced Secure Digital Host Controller on Freescale i.MX family ··· 29 29 - fsl,imx53-esdhc 30 30 - fsl,imx6q-usdhc 31 31 - fsl,imx6sl-usdhc 32 - - fsl,imx6sll-usdhc 33 32 - fsl,imx6sx-usdhc 34 - - fsl,imx6ull-usdhc 35 33 - fsl,imx7d-usdhc 36 34 - fsl,imx7ulp-usdhc 37 35 - fsl,imx8mm-usdhc 38 36 - fsl,imxrt1050-usdhc 39 37 - nxp,s32g2-usdhc 38 + - items: 39 + - const: fsl,imx50-esdhc 40 + - const: fsl,imx53-esdhc 41 + - items: 42 + - enum: 43 + - fsl,imx6sll-usdhc 44 + - fsl,imx6ull-usdhc 45 + - const: fsl,imx6sx-usdhc 46 + - items: 47 + - const: fsl,imx7d-usdhc 48 + - const: fsl,imx6sl-usdhc 40 49 - items: 41 50 - enum: 42 51 - fsl,imx8mq-usdhc ··· 107 98 Specify the number of delay cells for override mode. 108 99 This is used to set the clock delay for DLL(Delay Line) on override mode 109 100 to select a proper data sampling window in case the clock quality is not good 110 - due to signal path is too long on the board. Please refer to eSDHC/uSDHC 101 + because the signal path is too long on the board. Please refer to eSDHC/uSDHC 111 102 chapter, DLL (Delay Line) section in RM for details. 112 103 default: 0 113 104 114 105 voltage-ranges: 115 - $ref: '/schemas/types.yaml#/definitions/uint32-matrix' 106 + $ref: /schemas/types.yaml#/definitions/uint32-matrix 116 107 description: | 117 108 Specify the voltage range in case there are software transparent level 118 109 shifters on the outputs of the controller. Two cells are required, first ··· 136 127 Specify the increasing delay cell steps in tuning procedure. 137 128 The uSDHC use one delay cell as default increasing step to do tuning process. 138 129 This property allows user to change the tuning step to more than one delay 139 - cells which is useful for some special boards or cards when the default 130 + cell which is useful for some special boards or cards when the default 140 131 tuning step can't find the proper delay window within limited tuning retries. 141 132 default: 0 142 133
+1 -1
Documentation/devicetree/bindings/mmc/fsl-imx-mmc.yaml
··· 10 10 - Markus Pargmann <mpa@pengutronix.de> 11 11 12 12 allOf: 13 - - $ref: "mmc-controller.yaml" 13 + - $ref: mmc-controller.yaml 14 14 15 15 properties: 16 16 compatible:
+2 -2
Documentation/devicetree/bindings/mmc/microchip,dw-sparx5-sdhci.yaml
··· 7 7 title: Microchip Sparx5 Mobile Storage Host Controller 8 8 9 9 allOf: 10 - - $ref: "mmc-controller.yaml" 10 + - $ref: mmc-controller.yaml 11 11 12 12 maintainers: 13 13 - Lars Povlsen <lars.povlsen@microchip.com> ··· 35 35 microchip,clock-delay: 36 36 description: Delay clock to card to meet setup time requirements. 37 37 Each step increase by 1.25ns. 38 - $ref: "/schemas/types.yaml#/definitions/uint32" 38 + $ref: /schemas/types.yaml#/definitions/uint32 39 39 minimum: 1 40 40 maximum: 15 41 41
+1 -1
Documentation/devicetree/bindings/mmc/mmc-pwrseq-emmc.yaml
··· 41 41 examples: 42 42 - | 43 43 #include <dt-bindings/gpio/gpio.h> 44 - sdhci0_pwrseq { 44 + pwrseq { 45 45 compatible = "mmc-pwrseq-emmc"; 46 46 reset-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; 47 47 };
+1 -1
Documentation/devicetree/bindings/mmc/mmc-pwrseq-sd8787.yaml
··· 35 35 examples: 36 36 - | 37 37 #include <dt-bindings/gpio/gpio.h> 38 - wifi_pwrseq: wifi_pwrseq { 38 + pwrseq { 39 39 compatible = "mmc-pwrseq-sd8787"; 40 40 powerdown-gpios = <&twl_gpio 0 GPIO_ACTIVE_LOW>; 41 41 reset-gpios = <&twl_gpio 1 GPIO_ACTIVE_LOW>;
+1 -1
Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.yaml
··· 55 55 examples: 56 56 - | 57 57 #include <dt-bindings/gpio/gpio.h> 58 - sdhci0_pwrseq { 58 + pwrseq { 59 59 compatible = "mmc-pwrseq-simple"; 60 60 reset-gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; 61 61 clocks = <&clk_32768_ck>;
+1 -1
Documentation/devicetree/bindings/mmc/mmc-spi-slot.yaml
··· 10 10 - Ulf Hansson <ulf.hansson@linaro.org> 11 11 12 12 allOf: 13 - - $ref: "mmc-controller.yaml" 13 + - $ref: mmc-controller.yaml 14 14 - $ref: /schemas/spi/spi-peripheral-props.yaml 15 15 16 16 description: |
+1 -1
Documentation/devicetree/bindings/mmc/mxs-mmc.yaml
··· 17 17 and the properties used by the mxsmmc driver. 18 18 19 19 allOf: 20 - - $ref: "mmc-controller.yaml" 20 + - $ref: mmc-controller.yaml 21 21 22 22 properties: 23 23 compatible:
+17 -17
Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.yaml
··· 99 99 100 100 The DQS trim values are only used on controllers which support HS400 101 101 timing. Only SDMMC4 on Tegra210 and Tegra186 supports HS400. 102 - $ref: "/schemas/types.yaml#/definitions/uint32" 102 + $ref: /schemas/types.yaml#/definitions/uint32 103 103 104 104 nvidia,default-trim: 105 105 description: Specify the default outbound clock trimmer value. 106 - $ref: "/schemas/types.yaml#/definitions/uint32" 106 + $ref: /schemas/types.yaml#/definitions/uint32 107 107 108 108 nvidia,dqs-trim: 109 109 description: Specify DQS trim value for HS400 timing. 110 - $ref: "/schemas/types.yaml#/definitions/uint32" 110 + $ref: /schemas/types.yaml#/definitions/uint32 111 111 112 112 nvidia,pad-autocal-pull-down-offset-1v8: 113 113 description: Specify drive strength calibration offsets for 1.8 V 114 114 signaling modes. 115 - $ref: "/schemas/types.yaml#/definitions/uint32" 115 + $ref: /schemas/types.yaml#/definitions/uint32 116 116 117 117 nvidia,pad-autocal-pull-down-offset-1v8-timeout: 118 118 description: Specify drive strength used as a fallback in case the 119 119 automatic calibration times out on a 1.8 V signaling mode. 120 - $ref: "/schemas/types.yaml#/definitions/uint32" 120 + $ref: /schemas/types.yaml#/definitions/uint32 121 121 122 122 nvidia,pad-autocal-pull-down-offset-3v3: 123 123 description: Specify drive strength calibration offsets for 3.3 V 124 124 signaling modes. 125 - $ref: "/schemas/types.yaml#/definitions/uint32" 125 + $ref: /schemas/types.yaml#/definitions/uint32 126 126 127 127 nvidia,pad-autocal-pull-down-offset-3v3-timeout: 128 128 description: Specify drive strength used as a fallback in case the 129 129 automatic calibration times out on a 3.3 V signaling mode. 130 - $ref: "/schemas/types.yaml#/definitions/uint32" 130 + $ref: /schemas/types.yaml#/definitions/uint32 131 131 132 132 nvidia,pad-autocal-pull-down-offset-sdr104: 133 133 description: Specify drive strength calibration offsets for SDR104 mode. 134 - $ref: "/schemas/types.yaml#/definitions/uint32" 134 + $ref: /schemas/types.yaml#/definitions/uint32 135 135 136 136 nvidia,pad-autocal-pull-down-offset-hs400: 137 137 description: Specify drive strength calibration offsets for HS400 mode. 138 - $ref: "/schemas/types.yaml#/definitions/uint32" 138 + $ref: /schemas/types.yaml#/definitions/uint32 139 139 140 140 nvidia,pad-autocal-pull-up-offset-1v8: 141 141 description: Specify drive strength calibration offsets for 1.8 V 142 142 signaling modes. 143 - $ref: "/schemas/types.yaml#/definitions/uint32" 143 + $ref: /schemas/types.yaml#/definitions/uint32 144 144 145 145 nvidia,pad-autocal-pull-up-offset-1v8-timeout: 146 146 description: Specify drive strength used as a fallback in case the 147 147 automatic calibration times out on a 1.8 V signaling mode. 148 - $ref: "/schemas/types.yaml#/definitions/uint32" 148 + $ref: /schemas/types.yaml#/definitions/uint32 149 149 150 150 nvidia,pad-autocal-pull-up-offset-3v3: 151 151 description: Specify drive strength calibration offsets for 3.3 V ··· 157 157 refer to the reference manual of the SoC for correct values. The SDR104 158 158 and HS400 timing specific values are used in corresponding modes if 159 159 specified. 160 - $ref: "/schemas/types.yaml#/definitions/uint32" 160 + $ref: /schemas/types.yaml#/definitions/uint32 161 161 162 162 nvidia,pad-autocal-pull-up-offset-3v3-timeout: 163 163 description: Specify drive strength used as a fallback in case the 164 164 automatic calibration times out on a 3.3 V signaling mode. 165 - $ref: "/schemas/types.yaml#/definitions/uint32" 165 + $ref: /schemas/types.yaml#/definitions/uint32 166 166 167 167 nvidia,pad-autocal-pull-up-offset-sdr104: 168 168 description: Specify drive strength calibration offsets for SDR104 mode. 169 - $ref: "/schemas/types.yaml#/definitions/uint32" 169 + $ref: /schemas/types.yaml#/definitions/uint32 170 170 171 171 nvidia,pad-autocal-pull-up-offset-hs400: 172 172 description: Specify drive strength calibration offsets for HS400 mode. 173 - $ref: "/schemas/types.yaml#/definitions/uint32" 173 + $ref: /schemas/types.yaml#/definitions/uint32 174 174 175 175 nvidia,only-1-8v: 176 176 description: The presence of this property indicates that the controller 177 177 operates at a 1.8 V fixed I/O voltage. 178 - $ref: "/schemas/types.yaml#/definitions/flag" 178 + $ref: /schemas/types.yaml#/definitions/flag 179 179 180 180 required: 181 181 - compatible ··· 186 186 - reset-names 187 187 188 188 allOf: 189 - - $ref: "mmc-controller.yaml" 189 + - $ref: mmc-controller.yaml 190 190 - if: 191 191 properties: 192 192 compatible:
+1 -1
Documentation/devicetree/bindings/mmc/owl-mmc.yaml
··· 7 7 title: Actions Semi Owl SoCs SD/MMC/SDIO controller 8 8 9 9 allOf: 10 - - $ref: "mmc-controller.yaml" 10 + - $ref: mmc-controller.yaml 11 11 12 12 maintainers: 13 13 - Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
+1 -1
Documentation/devicetree/bindings/mmc/renesas,mmcif.yaml
··· 10 10 - Wolfram Sang <wsa+renesas@sang-engineering.com> 11 11 12 12 allOf: 13 - - $ref: "mmc-controller.yaml" 13 + - $ref: mmc-controller.yaml 14 14 15 15 properties: 16 16 compatible:
+5 -3
Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
··· 1 1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 2 %YAML 1.2 3 3 --- 4 - $id: "http://devicetree.org/schemas/mmc/renesas,sdhi.yaml#" 5 - $schema: "http://devicetree.org/meta-schemas/core.yaml#" 4 + $id: http://devicetree.org/schemas/mmc/renesas,sdhi.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 7 title: Renesas SDHI SD/MMC controller 8 8 ··· 59 59 - renesas,sdhi-r9a07g043 # RZ/G2UL 60 60 - renesas,sdhi-r9a07g044 # RZ/G2{L,LC} 61 61 - renesas,sdhi-r9a07g054 # RZ/V2L 62 + - renesas,sdhi-r9a09g011 # RZ/V2M 62 63 - const: renesas,rcar-gen3-sdhi # R-Car Gen3 or RZ/G2 63 64 - items: 64 65 - enum: ··· 112 111 max-frequency: true 113 112 114 113 allOf: 115 - - $ref: "mmc-controller.yaml" 114 + - $ref: mmc-controller.yaml 116 115 117 116 - if: 118 117 properties: ··· 122 121 - renesas,sdhi-r9a07g043 123 122 - renesas,sdhi-r9a07g044 124 123 - renesas,sdhi-r9a07g054 124 + - renesas,sdhi-r9a09g011 125 125 then: 126 126 properties: 127 127 clocks:
+2 -1
Documentation/devicetree/bindings/mmc/rockchip-dw-mshc.yaml
··· 14 14 file and the Rockchip specific extensions. 15 15 16 16 allOf: 17 - - $ref: "synopsys-dw-mshc-common.yaml#" 17 + - $ref: synopsys-dw-mshc-common.yaml# 18 18 19 19 maintainers: 20 20 - Heiko Stuebner <heiko@sntech.de> ··· 39 39 - rockchip,rk3368-dw-mshc 40 40 - rockchip,rk3399-dw-mshc 41 41 - rockchip,rk3568-dw-mshc 42 + - rockchip,rk3588-dw-mshc 42 43 - rockchip,rv1108-dw-mshc 43 44 - rockchip,rv1126-dw-mshc 44 45 - const: rockchip,rk3288-dw-mshc
+1 -1
Documentation/devicetree/bindings/mmc/samsung,exynos-dw-mshc.yaml
··· 112 112 - samsung,dw-mshc-sdr-timing 113 113 114 114 allOf: 115 - - $ref: "synopsys-dw-mshc-common.yaml#" 115 + - $ref: synopsys-dw-mshc-common.yaml# 116 116 - if: 117 117 properties: 118 118 compatible:
+4
Documentation/devicetree/bindings/mmc/sdhci-msm.yaml
··· 34 34 - const: qcom,sdhci-msm-v4 # for sdcc versions less than 5.0 35 35 - items: 36 36 - enum: 37 + - qcom,ipq5332-sdhci 38 + - qcom,ipq9574-sdhci 37 39 - qcom,qcs404-sdhci 38 40 - qcom,sc7180-sdhci 39 41 - qcom,sc7280-sdhci ··· 127 125 phandle to apps_smmu node with sid mask. 128 126 129 127 interconnects: 128 + minItems: 1 130 129 items: 131 130 - description: data path, sdhc to ddr 132 131 - description: config path, cpu to sdhc 133 132 134 133 interconnect-names: 134 + minItems: 1 135 135 items: 136 136 - const: sdhc-ddr 137 137 - const: cpu-sdhc
+18 -1
Documentation/devicetree/bindings/mmc/sdhci-pxa.yaml
··· 4 4 $id: http://devicetree.org/schemas/mmc/sdhci-pxa.yaml# 5 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 - title: Marvell PXA SDHCI v2/v3 7 + title: Marvell PXA SDHCI v1/v2/v3 8 8 9 9 maintainers: 10 10 - Ulf Hansson <ulf.hansson@linaro.org> ··· 34 34 properties: 35 35 compatible: 36 36 enum: 37 + - mrvl,pxav1-mmc 37 38 - mrvl,pxav2-mmc 38 39 - mrvl,pxav3-mmc 39 40 - marvell,armada-380-sdhci ··· 61 60 items: 62 61 - const: io 63 62 - const: core 63 + 64 + pinctrl-names: 65 + description: 66 + Optional for supporting PXA168 SDIO IRQ errata to switch CMD pin between 67 + SDIO CMD and GPIO mode. 68 + items: 69 + - const: default 70 + - const: state_cmd_gpio 71 + 72 + pinctrl-0: 73 + description: 74 + Should contain default pinctrl. 75 + 76 + pinctrl-1: 77 + description: 78 + Should switch CMD pin to GPIO mode as a high output. 64 79 65 80 mrvl,clk-delay-cycles: 66 81 description: Specify a number of cycles to delay for tuning.
+10
Documentation/devicetree/bindings/mmc/socionext,uniphier-sd.yaml
··· 55 55 minItems: 1 56 56 maxItems: 3 57 57 58 + socionext,syscon-uhs-mode: 59 + $ref: /schemas/types.yaml#/definitions/phandle-array 60 + items: 61 + - items: 62 + - description: phandle to syscon that configures UHS mode 63 + - description: ID of SD instance 64 + description: 65 + A phandle to syscon with one argument that configures UHS mode. 66 + The argument is the ID of SD instance. 67 + 58 68 allOf: 59 69 - $ref: mmc-controller.yaml 60 70
+77
Documentation/devicetree/bindings/mmc/starfive,jh7110-mmc.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mmc/starfive,jh7110-mmc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: StarFive Designware Mobile Storage Host Controller 8 + 9 + description: 10 + StarFive uses the Synopsys designware mobile storage host controller 11 + to interface a SoC with storage medium such as eMMC or SD/MMC cards. 12 + 13 + allOf: 14 + - $ref: synopsys-dw-mshc-common.yaml# 15 + 16 + maintainers: 17 + - William Qiu <william.qiu@starfivetech.com> 18 + 19 + properties: 20 + compatible: 21 + const: starfive,jh7110-mmc 22 + 23 + reg: 24 + maxItems: 1 25 + 26 + clocks: 27 + items: 28 + - description: biu clock 29 + - description: ciu clock 30 + 31 + clock-names: 32 + items: 33 + - const: biu 34 + - const: ciu 35 + 36 + interrupts: 37 + maxItems: 1 38 + 39 + starfive,sysreg: 40 + $ref: /schemas/types.yaml#/definitions/phandle-array 41 + items: 42 + - items: 43 + - description: phandle to System Register Controller syscon node 44 + - description: offset of SYS_SYSCONSAIF__SYSCFG register for MMC controller 45 + - description: shift of SYS_SYSCONSAIF__SYSCFG register for MMC controller 46 + - description: mask of SYS_SYSCONSAIF__SYSCFG register for MMC controller 47 + description: 48 + Should be four parameters, the phandle to System Register Controller 49 + syscon node and the offset/shift/mask of SYS_SYSCONSAIF__SYSCFG register 50 + for MMC controller. 51 + 52 + required: 53 + - compatible 54 + - reg 55 + - clocks 56 + - clock-names 57 + - interrupts 58 + - starfive,sysreg 59 + 60 + unevaluatedProperties: false 61 + 62 + examples: 63 + - | 64 + mmc@16010000 { 65 + compatible = "starfive,jh7110-mmc"; 66 + reg = <0x16010000 0x10000>; 67 + clocks = <&syscrg 91>, 68 + <&syscrg 93>; 69 + clock-names = "biu","ciu"; 70 + resets = <&syscrg 64>; 71 + reset-names = "reset"; 72 + interrupts = <74>; 73 + fifo-depth = <32>; 74 + fifo-watermark-aligned; 75 + data-addr = <0>; 76 + starfive,sysreg = <&sys_syscon 0x14 0x1a 0x7c000000>; 77 + };
+1 -1
Documentation/devicetree/bindings/mmc/sunplus,mmc.yaml
··· 12 12 - Li-hao Kuo <lhjeff911@gmail.com> 13 13 14 14 allOf: 15 - - $ref: "mmc-controller.yaml" 15 + - $ref: mmc-controller.yaml 16 16 17 17 properties: 18 18 compatible:
+1 -1
Documentation/devicetree/bindings/mmc/synopsys-dw-mshc-common.yaml
··· 7 7 title: Synopsys Designware Mobile Storage Host Controller Common Properties 8 8 9 9 allOf: 10 - - $ref: "mmc-controller.yaml#" 10 + - $ref: mmc-controller.yaml# 11 11 12 12 maintainers: 13 13 - Ulf Hansson <ulf.hansson@linaro.org>
+6
MAINTAINERS
··· 19924 19924 F: drivers/clk/starfive/clk-starfive-jh7100* 19925 19925 F: include/dt-bindings/clock/starfive-jh7100*.h 19926 19926 19927 + STARFIVE JH7110 MMC/SD/SDIO DRIVER 19928 + M: William Qiu <william.qiu@starfivetech.com> 19929 + S: Supported 19930 + F: Documentation/devicetree/bindings/mmc/starfive* 19931 + F: drivers/mmc/host/dw_mmc-starfive.c 19932 + 19927 19933 STARFIVE JH71X0 PINCTRL DRIVERS 19928 19934 M: Emil Renner Berthing <kernel@esmil.dk> 19929 19935 M: Jianlong Huang <jianlong.huang@starfivetech.com>
+2
drivers/memstick/core/Kconfig
··· 20 20 config MSPRO_BLOCK 21 21 tristate "MemoryStick Pro block device driver" 22 22 depends on BLOCK 23 + imply IOSCHED_BFQ 23 24 help 24 25 Say Y here to enable the MemoryStick Pro block device driver 25 26 support. This provides a block device driver, which you can use ··· 30 29 config MS_BLOCK 31 30 tristate "MemoryStick Standard device driver" 32 31 depends on BLOCK 32 + imply IOSCHED_BFQ 33 33 help 34 34 Say Y here to enable the MemoryStick Standard device driver 35 35 support. This provides a block device driver, which you can use
+2 -1
drivers/mmc/core/Kconfig
··· 15 15 16 16 config PWRSEQ_SD8787 17 17 tristate "HW reset support for SD8787 BT + Wifi module" 18 - depends on OF && (MWIFIEX || BT_MRVL_SDIO || LIBERTAS_SDIO || WILC1000_SDIO) 18 + depends on OF && (MWIFIEX != n || BT_MRVL_SDIO != n || LIBERTAS_SDIO != n || WILC1000_SDIO != n) 19 19 help 20 20 This selects hardware reset support for the SD8787 BT + Wifi 21 21 module. By default this option is set to n. ··· 37 37 config MMC_BLOCK 38 38 tristate "MMC block device driver" 39 39 depends on BLOCK 40 + imply IOSCHED_BFQ 40 41 default y 41 42 help 42 43 Say Y here to enable the MMC block device driver support.
+17 -8
drivers/mmc/core/block.c
··· 470 470 struct mmc_data data = {}; 471 471 struct mmc_request mrq = {}; 472 472 struct scatterlist sg; 473 + bool r1b_resp, use_r1b_resp = false; 474 + unsigned int busy_timeout_ms; 473 475 int err; 474 476 unsigned int target_part; 475 477 ··· 547 545 (cmd.opcode == MMC_SWITCH)) 548 546 return mmc_sanitize(card, idata->ic.cmd_timeout_ms); 549 547 548 + /* If it's an R1B response we need some more preparations. */ 549 + busy_timeout_ms = idata->ic.cmd_timeout_ms ? : MMC_BLK_TIMEOUT_MS; 550 + r1b_resp = (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B; 551 + if (r1b_resp) 552 + use_r1b_resp = mmc_prepare_busy_cmd(card->host, &cmd, 553 + busy_timeout_ms); 554 + 550 555 mmc_wait_for_req(card->host, &mrq); 551 556 memcpy(&idata->ic.response, cmd.resp, sizeof(cmd.resp)); 552 557 ··· 605 596 if (idata->ic.postsleep_min_us) 606 597 usleep_range(idata->ic.postsleep_min_us, idata->ic.postsleep_max_us); 607 598 608 - if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) { 609 - /* 610 - * Ensure RPMB/R1B command has completed by polling CMD13 "Send Status". Here we 611 - * allow to override the default timeout value if a custom timeout is specified. 612 - */ 613 - err = mmc_poll_for_busy(card, idata->ic.cmd_timeout_ms ? : MMC_BLK_TIMEOUT_MS, 614 - false, MMC_BUSY_IO); 615 - } 599 + /* No need to poll when using HW busy detection. */ 600 + if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) && use_r1b_resp) 601 + return 0; 602 + 603 + /* Ensure RPMB/R1B command has completed by polling with CMD13. */ 604 + if (idata->rpmb || r1b_resp) 605 + err = mmc_poll_for_busy(card, busy_timeout_ms, false, 606 + MMC_BUSY_IO); 616 607 617 608 return err; 618 609 }
+26
drivers/mmc/core/host.c
··· 588 588 589 589 EXPORT_SYMBOL(mmc_alloc_host); 590 590 591 + static void devm_mmc_host_release(struct device *dev, void *res) 592 + { 593 + mmc_free_host(*(struct mmc_host **)res); 594 + } 595 + 596 + struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra) 597 + { 598 + struct mmc_host **dr, *host; 599 + 600 + dr = devres_alloc(devm_mmc_host_release, sizeof(*dr), GFP_KERNEL); 601 + if (!dr) 602 + return NULL; 603 + 604 + host = mmc_alloc_host(extra, dev); 605 + if (!host) { 606 + devres_free(dr); 607 + return NULL; 608 + } 609 + 610 + *dr = host; 611 + devres_add(dev, dr); 612 + 613 + return host; 614 + } 615 + EXPORT_SYMBOL(devm_mmc_alloc_host); 616 + 591 617 static int mmc_validate_host_caps(struct mmc_host *host) 592 618 { 593 619 struct device *dev = host->parent;
+1
drivers/mmc/core/mmc_ops.c
··· 575 575 cmd->busy_timeout = timeout_ms; 576 576 return true; 577 577 } 578 + EXPORT_SYMBOL_GPL(mmc_prepare_busy_cmd); 578 579 579 580 /** 580 581 * __mmc_switch - modify EXT_CSD register
+2 -2
drivers/mmc/core/pwrseq_simple.c
··· 119 119 120 120 pwrseq->ext_clk = devm_clk_get(dev, "ext_clock"); 121 121 if (IS_ERR(pwrseq->ext_clk) && PTR_ERR(pwrseq->ext_clk) != -ENOENT) 122 - return PTR_ERR(pwrseq->ext_clk); 122 + return dev_err_probe(dev, PTR_ERR(pwrseq->ext_clk), "external clock not ready\n"); 123 123 124 124 pwrseq->reset_gpios = devm_gpiod_get_array(dev, "reset", 125 125 GPIOD_OUT_HIGH); 126 126 if (IS_ERR(pwrseq->reset_gpios) && 127 127 PTR_ERR(pwrseq->reset_gpios) != -ENOENT && 128 128 PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) { 129 - return PTR_ERR(pwrseq->reset_gpios); 129 + return dev_err_probe(dev, PTR_ERR(pwrseq->reset_gpios), "reset GPIOs not ready\n"); 130 130 } 131 131 132 132 device_property_read_u32(dev, "post-power-on-delay-ms",
+1 -1
drivers/mmc/core/sdio_io.c
··· 766 766 * sdio_retune_crc_enable - re-enable retuning on CRC errors 767 767 * @func: SDIO function attached to host 768 768 * 769 - * This is the compement to sdio_retune_crc_disable(). 769 + * This is the complement to sdio_retune_crc_disable(). 770 770 */ 771 771 void sdio_retune_crc_enable(struct sdio_func *func) 772 772 {
+16 -1
drivers/mmc/core/slot-gpio.c
··· 23 23 char *ro_label; 24 24 char *cd_label; 25 25 u32 cd_debounce_delay_ms; 26 + int cd_irq; 26 27 }; 27 28 28 29 static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) ··· 54 53 ctx->ro_label = devm_kasprintf(host->parent, GFP_KERNEL, "%s ro", devname); 55 54 if (!ctx->ro_label) 56 55 return -ENOMEM; 56 + ctx->cd_irq = -EINVAL; 57 57 host->slot.handler_priv = ctx; 58 58 host->slot.cd_irq = -EINVAL; 59 59 60 60 return 0; 61 61 } 62 + 63 + void mmc_gpio_set_cd_irq(struct mmc_host *host, int irq) 64 + { 65 + struct mmc_gpio *ctx = host->slot.handler_priv; 66 + 67 + if (!ctx || irq < 0) 68 + return; 69 + 70 + ctx->cd_irq = irq; 71 + } 72 + EXPORT_SYMBOL(mmc_gpio_set_cd_irq); 62 73 63 74 int mmc_gpio_get_ro(struct mmc_host *host) 64 75 { ··· 111 98 * Do not use IRQ if the platform prefers to poll, e.g., because that 112 99 * IRQ number is already used by another unit and cannot be shared. 113 100 */ 114 - if (!(host->caps & MMC_CAP_NEEDS_POLL)) 101 + if (ctx->cd_irq >= 0) 102 + irq = ctx->cd_irq; 103 + else if (!(host->caps & MMC_CAP_NEEDS_POLL)) 115 104 irq = gpiod_to_irq(ctx->cd_gpio); 116 105 117 106 if (irq >= 0) {
+11
drivers/mmc/host/Kconfig
··· 348 348 depends on MMC_SDHCI_PLTFM 349 349 depends on ARCH_MMP || COMPILE_TEST 350 350 default CPU_PXA910 351 + select MMC_SDHCI_IO_ACCESSORS 351 352 help 352 353 This selects the Marvell(R) PXAV2 SD Host Controller. 353 354 If you have a PXA9XX platform with SD Host Controller ··· 816 815 This selects support for Rockchip SoC specific extensions to the 817 816 Synopsys DesignWare Memory Card Interface driver. Select this option 818 817 for platforms based on RK3066, RK3188 and RK3288 SoC's. 818 + 819 + config MMC_DW_STARFIVE 820 + tristate "StarFive specific extensions for Synopsys DW Memory Card Interface" 821 + depends on SOC_STARFIVE 822 + depends on MMC_DW 823 + select MMC_DW_PLTFM 824 + help 825 + This selects support for StarFive JH7110 SoC specific extensions to the 826 + Synopsys DesignWare Memory Card Interface driver. Select this option 827 + for platforms based on StarFive JH7110 SoC. 819 828 820 829 config MMC_SH_MMCIF 821 830 tristate "SuperH Internal MMCIF support"
+1
drivers/mmc/host/Makefile
··· 54 54 obj-$(CONFIG_MMC_DW_K3) += dw_mmc-k3.o 55 55 obj-$(CONFIG_MMC_DW_PCI) += dw_mmc-pci.o 56 56 obj-$(CONFIG_MMC_DW_ROCKCHIP) += dw_mmc-rockchip.o 57 + obj-$(CONFIG_MMC_DW_STARFIVE) += dw_mmc-starfive.o 57 58 obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o 58 59 obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o 59 60 obj-$(CONFIG_MMC_VUB300) += vub300.o
-3
drivers/mmc/host/atmel-mci.c
··· 1817 1817 atmci_writel(host, ATMCI_IER, ATMCI_NOTBUSY); 1818 1818 state = STATE_WAITING_NOTBUSY; 1819 1819 } else if (host->mrq->stop) { 1820 - atmci_writel(host, ATMCI_IER, ATMCI_CMDRDY); 1821 1820 atmci_send_stop_cmd(host, data); 1822 1821 state = STATE_SENDING_STOP; 1823 1822 } else { ··· 1849 1850 * command to send. 1850 1851 */ 1851 1852 if (host->mrq->stop) { 1852 - atmci_writel(host, ATMCI_IER, 1853 - ATMCI_CMDRDY); 1854 1853 atmci_send_stop_cmd(host, data); 1855 1854 state = STATE_SENDING_STOP; 1856 1855 } else {
+186
drivers/mmc/host/dw_mmc-starfive.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * StarFive Designware Mobile Storage Host Controller Driver 4 + * 5 + * Copyright (c) 2022 StarFive Technology Co., Ltd. 6 + */ 7 + 8 + #include <linux/clk.h> 9 + #include <linux/delay.h> 10 + #include <linux/mfd/syscon.h> 11 + #include <linux/mmc/host.h> 12 + #include <linux/module.h> 13 + #include <linux/of_address.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include "dw_mmc.h" 18 + #include "dw_mmc-pltfm.h" 19 + 20 + #define ALL_INT_CLR 0x1ffff 21 + #define MAX_DELAY_CHAIN 32 22 + 23 + struct starfive_priv { 24 + struct device *dev; 25 + struct regmap *reg_syscon; 26 + u32 syscon_offset; 27 + u32 syscon_shift; 28 + u32 syscon_mask; 29 + }; 30 + 31 + static void dw_mci_starfive_set_ios(struct dw_mci *host, struct mmc_ios *ios) 32 + { 33 + int ret; 34 + unsigned int clock; 35 + 36 + if (ios->timing == MMC_TIMING_MMC_DDR52 || ios->timing == MMC_TIMING_UHS_DDR50) { 37 + clock = (ios->clock > 50000000 && ios->clock <= 52000000) ? 100000000 : ios->clock; 38 + ret = clk_set_rate(host->ciu_clk, clock); 39 + if (ret) 40 + dev_dbg(host->dev, "Use an external frequency divider %uHz\n", ios->clock); 41 + host->bus_hz = clk_get_rate(host->ciu_clk); 42 + } else { 43 + dev_dbg(host->dev, "Using the internal divider\n"); 44 + } 45 + } 46 + 47 + static int dw_mci_starfive_execute_tuning(struct dw_mci_slot *slot, 48 + u32 opcode) 49 + { 50 + static const int grade = MAX_DELAY_CHAIN; 51 + struct dw_mci *host = slot->host; 52 + struct starfive_priv *priv = host->priv; 53 + int rise_point = -1, fall_point = -1; 54 + int err, prev_err; 55 + int i; 56 + bool found = 0; 57 + u32 regval; 58 + 59 + /* 60 + * Use grade as the max delay chain, and use the rise_point and 61 + * fall_point to ensure the best sampling point of a data input 62 + * signals. 63 + */ 64 + for (i = 0; i < grade; i++) { 65 + regval = i << priv->syscon_shift; 66 + err = regmap_update_bits(priv->reg_syscon, priv->syscon_offset, 67 + priv->syscon_mask, regval); 68 + if (err) 69 + return err; 70 + mci_writel(host, RINTSTS, ALL_INT_CLR); 71 + 72 + err = mmc_send_tuning(slot->mmc, opcode, NULL); 73 + if (!err) 74 + found = 1; 75 + 76 + if (i > 0) { 77 + if (err && !prev_err) 78 + fall_point = i - 1; 79 + if (!err && prev_err) 80 + rise_point = i; 81 + } 82 + 83 + if (rise_point != -1 && fall_point != -1) 84 + goto tuning_out; 85 + 86 + prev_err = err; 87 + err = 0; 88 + } 89 + 90 + tuning_out: 91 + if (found) { 92 + if (rise_point == -1) 93 + rise_point = 0; 94 + if (fall_point == -1) 95 + fall_point = grade - 1; 96 + if (fall_point < rise_point) { 97 + if ((rise_point + fall_point) > 98 + (grade - 1)) 99 + i = fall_point / 2; 100 + else 101 + i = (rise_point + grade - 1) / 2; 102 + } else { 103 + i = (rise_point + fall_point) / 2; 104 + } 105 + 106 + regval = i << priv->syscon_shift; 107 + err = regmap_update_bits(priv->reg_syscon, priv->syscon_offset, 108 + priv->syscon_mask, regval); 109 + if (err) 110 + return err; 111 + mci_writel(host, RINTSTS, ALL_INT_CLR); 112 + 113 + dev_info(host->dev, "Found valid delay chain! use it [delay=%d]\n", i); 114 + } else { 115 + dev_err(host->dev, "No valid delay chain! use default\n"); 116 + err = -EINVAL; 117 + } 118 + 119 + mci_writel(host, RINTSTS, ALL_INT_CLR); 120 + return err; 121 + } 122 + 123 + static int dw_mci_starfive_parse_dt(struct dw_mci *host) 124 + { 125 + struct of_phandle_args args; 126 + struct starfive_priv *priv; 127 + int ret; 128 + 129 + priv = devm_kzalloc(host->dev, sizeof(*priv), GFP_KERNEL); 130 + if (!priv) 131 + return -ENOMEM; 132 + 133 + ret = of_parse_phandle_with_fixed_args(host->dev->of_node, 134 + "starfive,sysreg", 3, 0, &args); 135 + if (ret) { 136 + dev_err(host->dev, "Failed to parse starfive,sysreg\n"); 137 + return -EINVAL; 138 + } 139 + 140 + priv->reg_syscon = syscon_node_to_regmap(args.np); 141 + of_node_put(args.np); 142 + if (IS_ERR(priv->reg_syscon)) 143 + return PTR_ERR(priv->reg_syscon); 144 + 145 + priv->syscon_offset = args.args[0]; 146 + priv->syscon_shift = args.args[1]; 147 + priv->syscon_mask = args.args[2]; 148 + 149 + host->priv = priv; 150 + 151 + return 0; 152 + } 153 + 154 + static const struct dw_mci_drv_data starfive_data = { 155 + .common_caps = MMC_CAP_CMD23, 156 + .set_ios = dw_mci_starfive_set_ios, 157 + .parse_dt = dw_mci_starfive_parse_dt, 158 + .execute_tuning = dw_mci_starfive_execute_tuning, 159 + }; 160 + 161 + static const struct of_device_id dw_mci_starfive_match[] = { 162 + { .compatible = "starfive,jh7110-mmc", 163 + .data = &starfive_data }, 164 + {}, 165 + }; 166 + MODULE_DEVICE_TABLE(of, dw_mci_starfive_match); 167 + 168 + static int dw_mci_starfive_probe(struct platform_device *pdev) 169 + { 170 + return dw_mci_pltfm_register(pdev, &starfive_data); 171 + } 172 + 173 + static struct platform_driver dw_mci_starfive_driver = { 174 + .probe = dw_mci_starfive_probe, 175 + .remove = dw_mci_pltfm_remove, 176 + .driver = { 177 + .name = "dwmmc_starfive", 178 + .probe_type = PROBE_PREFER_ASYNCHRONOUS, 179 + .of_match_table = dw_mci_starfive_match, 180 + }, 181 + }; 182 + module_platform_driver(dw_mci_starfive_driver); 183 + 184 + MODULE_DESCRIPTION("StarFive JH7110 Specific DW-MSHC Driver Extension"); 185 + MODULE_LICENSE("GPL"); 186 + MODULE_ALIAS("platform:dwmmc_starfive");
+37 -1
drivers/mmc/host/jz4740_mmc.c
··· 21 21 #include <linux/of_device.h> 22 22 #include <linux/pinctrl/consumer.h> 23 23 #include <linux/platform_device.h> 24 + #include <linux/regulator/consumer.h> 24 25 #include <linux/scatterlist.h> 25 26 26 27 #include <asm/cacheflush.h> ··· 158 157 struct resource *mem_res; 159 158 struct mmc_request *req; 160 159 struct mmc_command *cmd; 160 + 161 + bool vqmmc_enabled; 161 162 162 163 unsigned long waiting; 163 164 ··· 938 935 static void jz4740_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) 939 936 { 940 937 struct jz4740_mmc_host *host = mmc_priv(mmc); 938 + int ret; 939 + 941 940 if (ios->clock) 942 941 jz4740_mmc_set_clock_rate(host, ios->clock); 943 942 ··· 952 947 clk_prepare_enable(host->clk); 953 948 break; 954 949 case MMC_POWER_ON: 950 + if (!IS_ERR(mmc->supply.vqmmc) && !host->vqmmc_enabled) { 951 + ret = regulator_enable(mmc->supply.vqmmc); 952 + if (ret) 953 + dev_err(&host->pdev->dev, "Failed to set vqmmc power!\n"); 954 + else 955 + host->vqmmc_enabled = true; 956 + } 955 957 break; 956 - default: 958 + case MMC_POWER_OFF: 957 959 if (!IS_ERR(mmc->supply.vmmc)) 958 960 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); 961 + if (!IS_ERR(mmc->supply.vqmmc) && host->vqmmc_enabled) { 962 + regulator_disable(mmc->supply.vqmmc); 963 + host->vqmmc_enabled = false; 964 + } 959 965 clk_disable_unprepare(host->clk); 966 + break; 967 + default: 960 968 break; 961 969 } 962 970 ··· 996 978 jz4740_mmc_set_irq_enabled(host, JZ_MMC_IRQ_SDIO, enable); 997 979 } 998 980 981 + static int jz4740_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios) 982 + { 983 + int ret; 984 + 985 + /* vqmmc regulator is available */ 986 + if (!IS_ERR(mmc->supply.vqmmc)) { 987 + ret = mmc_regulator_set_vqmmc(mmc, ios); 988 + return ret < 0 ? ret : 0; 989 + } 990 + 991 + /* no vqmmc regulator, assume fixed regulator at 3/3.3V */ 992 + if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) 993 + return 0; 994 + 995 + return -EINVAL; 996 + } 997 + 999 998 static const struct mmc_host_ops jz4740_mmc_ops = { 1000 999 .request = jz4740_mmc_request, 1001 1000 .pre_req = jz4740_mmc_pre_request, ··· 1021 986 .get_ro = mmc_gpio_get_ro, 1022 987 .get_cd = mmc_gpio_get_cd, 1023 988 .enable_sdio_irq = jz4740_mmc_enable_sdio_irq, 989 + .start_signal_voltage_switch = jz4740_voltage_switch, 1024 990 }; 1025 991 1026 992 static const struct of_device_id jz4740_mmc_of_match[] = {
+27 -65
drivers/mmc/host/meson-gx-mmc.c
··· 150 150 151 151 struct meson_host { 152 152 struct device *dev; 153 - struct meson_mmc_data *data; 153 + const struct meson_mmc_data *data; 154 154 struct mmc_host *mmc; 155 155 struct mmc_command *cmd; 156 156 157 157 void __iomem *regs; 158 - struct clk *core_clk; 159 158 struct clk *mux_clk; 160 159 struct clk *mmc_clk; 161 160 unsigned long req_rate; ··· 1082 1083 return IRQ_HANDLED; 1083 1084 } 1084 1085 1085 - /* 1086 - * NOTE: we only need this until the GPIO/pinctrl driver can handle 1087 - * interrupts. For now, the MMC core will use this for polling. 1088 - */ 1089 - static int meson_mmc_get_cd(struct mmc_host *mmc) 1090 - { 1091 - int status = mmc_gpio_get_cd(mmc); 1092 - 1093 - if (status == -ENOSYS) 1094 - return 1; /* assume present */ 1095 - 1096 - return status; 1097 - } 1098 - 1099 1086 static void meson_mmc_cfg_init(struct meson_host *host) 1100 1087 { 1101 1088 u32 cfg = 0; ··· 1150 1165 static const struct mmc_host_ops meson_mmc_ops = { 1151 1166 .request = meson_mmc_request, 1152 1167 .set_ios = meson_mmc_set_ios, 1153 - .get_cd = meson_mmc_get_cd, 1168 + .get_cd = mmc_gpio_get_cd, 1154 1169 .pre_req = meson_mmc_pre_req, 1155 1170 .post_req = meson_mmc_post_req, 1156 1171 .execute_tuning = meson_mmc_resampling_tuning, ··· 1165 1180 struct resource *res; 1166 1181 struct meson_host *host; 1167 1182 struct mmc_host *mmc; 1168 - int ret; 1183 + struct clk *core_clk; 1184 + int cd_irq, ret; 1169 1185 1170 - mmc = mmc_alloc_host(sizeof(struct meson_host), &pdev->dev); 1186 + mmc = devm_mmc_alloc_host(&pdev->dev, sizeof(struct meson_host)); 1171 1187 if (!mmc) 1172 1188 return -ENOMEM; 1173 1189 host = mmc_priv(mmc); ··· 1184 1198 host->vqmmc_enabled = false; 1185 1199 ret = mmc_regulator_get_supply(mmc); 1186 1200 if (ret) 1187 - goto free_host; 1201 + return ret; 1188 1202 1189 1203 ret = mmc_of_parse(mmc); 1190 - if (ret) { 1191 - if (ret != -EPROBE_DEFER) 1192 - dev_warn(&pdev->dev, "error parsing DT: %d\n", ret); 1193 - goto free_host; 1194 - } 1204 + if (ret) 1205 + return dev_err_probe(&pdev->dev, ret, "error parsing DT\n"); 1195 1206 1196 1207 mmc->caps |= MMC_CAP_CMD23; 1197 1208 1198 1209 if (mmc->caps & MMC_CAP_SDIO_IRQ) 1199 1210 mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; 1200 1211 1201 - host->data = (struct meson_mmc_data *) 1202 - of_device_get_match_data(&pdev->dev); 1203 - if (!host->data) { 1204 - ret = -EINVAL; 1205 - goto free_host; 1206 - } 1212 + host->data = of_device_get_match_data(&pdev->dev); 1213 + if (!host->data) 1214 + return -EINVAL; 1207 1215 1208 1216 ret = device_reset_optional(&pdev->dev); 1209 - if (ret) { 1210 - dev_err_probe(&pdev->dev, ret, "device reset failed\n"); 1211 - goto free_host; 1212 - } 1217 + if (ret) 1218 + return dev_err_probe(&pdev->dev, ret, "device reset failed\n"); 1213 1219 1214 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1215 - host->regs = devm_ioremap_resource(&pdev->dev, res); 1216 - if (IS_ERR(host->regs)) { 1217 - ret = PTR_ERR(host->regs); 1218 - goto free_host; 1219 - } 1220 + host->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); 1221 + if (IS_ERR(host->regs)) 1222 + return PTR_ERR(host->regs); 1220 1223 1221 1224 host->irq = platform_get_irq(pdev, 0); 1222 - if (host->irq <= 0) { 1223 - ret = -EINVAL; 1224 - goto free_host; 1225 - } 1225 + if (host->irq <= 0) 1226 + return -EINVAL; 1227 + 1228 + cd_irq = platform_get_irq_optional(pdev, 1); 1229 + mmc_gpio_set_cd_irq(mmc, cd_irq); 1226 1230 1227 1231 host->pinctrl = devm_pinctrl_get(&pdev->dev); 1228 - if (IS_ERR(host->pinctrl)) { 1229 - ret = PTR_ERR(host->pinctrl); 1230 - goto free_host; 1231 - } 1232 + if (IS_ERR(host->pinctrl)) 1233 + return PTR_ERR(host->pinctrl); 1232 1234 1233 1235 host->pins_clk_gate = pinctrl_lookup_state(host->pinctrl, 1234 1236 "clk-gate"); ··· 1226 1252 host->pins_clk_gate = NULL; 1227 1253 } 1228 1254 1229 - host->core_clk = devm_clk_get(&pdev->dev, "core"); 1230 - if (IS_ERR(host->core_clk)) { 1231 - ret = PTR_ERR(host->core_clk); 1232 - goto free_host; 1233 - } 1234 - 1235 - ret = clk_prepare_enable(host->core_clk); 1236 - if (ret) 1237 - goto free_host; 1255 + core_clk = devm_clk_get_enabled(&pdev->dev, "core"); 1256 + if (IS_ERR(core_clk)) 1257 + return PTR_ERR(core_clk); 1238 1258 1239 1259 ret = meson_mmc_clk_init(host); 1240 1260 if (ret) 1241 - goto err_core_clk; 1261 + return ret; 1242 1262 1243 1263 /* set config to sane default */ 1244 1264 meson_mmc_cfg_init(host); ··· 1316 1348 free_irq(host->irq, host); 1317 1349 err_init_clk: 1318 1350 clk_disable_unprepare(host->mmc_clk); 1319 - err_core_clk: 1320 - clk_disable_unprepare(host->core_clk); 1321 - free_host: 1322 - mmc_free_host(mmc); 1323 1351 return ret; 1324 1352 } 1325 1353 ··· 1330 1366 free_irq(host->irq, host); 1331 1367 1332 1368 clk_disable_unprepare(host->mmc_clk); 1333 - clk_disable_unprepare(host->core_clk); 1334 1369 1335 - mmc_free_host(host->mmc); 1336 1370 return 0; 1337 1371 } 1338 1372
+9
drivers/mmc/host/moxart-mmc.c
··· 611 611 mmc->f_max = DIV_ROUND_CLOSEST(host->sysclk, 2); 612 612 mmc->f_min = DIV_ROUND_CLOSEST(host->sysclk, CLK_DIV_MASK * 2); 613 613 mmc->ocr_avail = 0xffff00; /* Support 2.0v - 3.6v power. */ 614 + mmc->max_blk_size = 2048; /* Max. block length in REG_DATA_CONTROL */ 615 + mmc->max_req_size = DATA_LEN_MASK; /* bits 0-23 in REG_DATA_LENGTH */ 616 + mmc->max_blk_count = mmc->max_req_size / 512; 614 617 615 618 if (IS_ERR(host->dma_chan_tx) || IS_ERR(host->dma_chan_rx)) { 616 619 if (PTR_ERR(host->dma_chan_tx) == -EPROBE_DEFER || ··· 631 628 } 632 629 dev_dbg(dev, "PIO mode transfer enabled\n"); 633 630 host->have_dma = false; 631 + 632 + mmc->max_seg_size = mmc->max_req_size; 634 633 } else { 635 634 dev_dbg(dev, "DMA channels found (%p,%p)\n", 636 635 host->dma_chan_tx, host->dma_chan_rx); ··· 651 646 cfg.src_addr = host->reg_phys + REG_DATA_WINDOW; 652 647 cfg.dst_addr = 0; 653 648 dmaengine_slave_config(host->dma_chan_rx, &cfg); 649 + 650 + mmc->max_seg_size = min3(mmc->max_req_size, 651 + dma_get_max_seg_size(host->dma_chan_rx->device->dev), 652 + dma_get_max_seg_size(host->dma_chan_tx->device->dev)); 654 653 } 655 654 656 655 if (readl(host->base + REG_BUS_WIDTH) & BUS_WIDTH_4_SUPPORT)
+11
drivers/mmc/host/renesas_sdhi_internal_dmac.c
··· 210 210 .manual_tap_correction = true, 211 211 }; 212 212 213 + static const struct renesas_sdhi_quirks sdhi_quirks_r9a09g011 = { 214 + .fixed_addr_mode = true, 215 + .hs400_disabled = true, 216 + }; 217 + 213 218 /* 214 219 * Note for r8a7796 / r8a774a1: we can't distinguish ES1.1 and 1.2 as of now. 215 220 * So, we want to treat them equally and only have a match for ES1.2 to enforce ··· 256 251 .quirks = &sdhi_quirks_r8a77990, 257 252 }; 258 253 254 + static const struct renesas_sdhi_of_data_with_quirks of_r9a09g011_compatible = { 255 + .of_data = &of_data_rcar_gen3, 256 + .quirks = &sdhi_quirks_r9a09g011, 257 + }; 258 + 259 259 static const struct renesas_sdhi_of_data_with_quirks of_rcar_gen3_compatible = { 260 260 .of_data = &of_data_rcar_gen3, 261 261 }; ··· 284 274 { .compatible = "renesas,sdhi-r8a77970", .data = &of_r8a77970_compatible, }, 285 275 { .compatible = "renesas,sdhi-r8a77990", .data = &of_r8a77990_compatible, }, 286 276 { .compatible = "renesas,sdhi-r8a77995", .data = &of_rcar_gen3_nohs400_compatible, }, 277 + { .compatible = "renesas,sdhi-r9a09g011", .data = &of_r9a09g011_compatible, }, 287 278 { .compatible = "renesas,rcar-gen3-sdhi", .data = &of_rcar_gen3_compatible, }, 288 279 { .compatible = "renesas,rcar-gen4-sdhi", .data = &of_rcar_gen3_compatible, }, 289 280 {},
+2 -6
drivers/mmc/host/sdhci-brcmstb.c
··· 255 255 struct sdhci_brcmstb_priv *priv; 256 256 u32 actual_clock_mhz; 257 257 struct sdhci_host *host; 258 - struct resource *iomem; 259 258 struct clk *clk; 260 259 struct clk *base_clk = NULL; 261 260 int res; ··· 290 291 } 291 292 292 293 /* Map in the non-standard CFG registers */ 293 - iomem = platform_get_resource(pdev, IORESOURCE_MEM, 1); 294 - priv->cfg_regs = devm_ioremap_resource(&pdev->dev, iomem); 294 + priv->cfg_regs = devm_platform_get_and_ioremap_resource(pdev, 1, NULL); 295 295 if (IS_ERR(priv->cfg_regs)) { 296 296 res = PTR_ERR(priv->cfg_regs); 297 297 goto err; ··· 322 324 * will allow these modes to be specified by device tree 323 325 * properties through mmc_of_parse(). 324 326 */ 325 - host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); 327 + sdhci_read_caps(host); 326 328 if (match_priv->flags & BRCMSTB_MATCH_FLAGS_NO_64BIT) 327 329 host->caps &= ~SDHCI_CAN_64BIT; 328 - host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); 329 330 host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | 330 331 SDHCI_SUPPORT_DDR50); 331 - host->quirks |= SDHCI_QUIRK_MISSING_CAPS; 332 332 333 333 if (match_priv->flags & BRCMSTB_MATCH_FLAGS_BROKEN_TIMEOUT) 334 334 host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+57 -9
drivers/mmc/host/sdhci-esdhc-imx.c
··· 338 338 struct clk *clk_ahb; 339 339 struct clk *clk_per; 340 340 unsigned int actual_clock; 341 + 342 + /* 343 + * USDHC has one limition, require the SDIO device a different 344 + * register setting. Driver has to recognize card type during 345 + * the card init, but at this stage, mmc_host->card is not 346 + * available. So involve this field to save the card type 347 + * during card init through usdhc_init_card(). 348 + */ 349 + unsigned int init_card_type; 350 + 341 351 enum { 342 352 NO_CMD_PENDING, /* no multiblock command pending */ 343 353 MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */ ··· 440 430 } 441 431 442 432 /* Enable the auto tuning circuit to check the CMD line and BUS line */ 443 - static inline void usdhc_auto_tuning_mode_sel(struct sdhci_host *host) 433 + static inline void usdhc_auto_tuning_mode_sel_and_en(struct sdhci_host *host) 444 434 { 435 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 436 + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); 445 437 u32 buswidth, auto_tune_buswidth; 438 + u32 reg; 446 439 447 440 buswidth = USDHC_GET_BUSWIDTH(readl(host->ioaddr + SDHCI_HOST_CONTROL)); 448 441 ··· 461 448 break; 462 449 } 463 450 451 + /* 452 + * For USDHC, auto tuning circuit can not handle the async sdio 453 + * device interrupt correctly. When sdio device use 4 data lines, 454 + * async sdio interrupt will use the shared DAT[1], if enable auto 455 + * tuning circuit check these 4 data lines, include the DAT[1], 456 + * this circuit will detect this interrupt, take this as a data on 457 + * DAT[1], and adjust the delay cell wrongly. 458 + * This is the hardware design limitation, to avoid this, for sdio 459 + * device, config the auto tuning circuit only check DAT[0] and CMD 460 + * line. 461 + */ 462 + if (imx_data->init_card_type == MMC_TYPE_SDIO) 463 + auto_tune_buswidth = ESDHC_VEND_SPEC2_AUTO_TUNE_1BIT_EN; 464 + 464 465 esdhc_clrset_le(host, ESDHC_VEND_SPEC2_AUTO_TUNE_MODE_MASK, 465 466 auto_tune_buswidth | ESDHC_VEND_SPEC2_AUTO_TUNE_CMD_EN, 466 467 ESDHC_VEND_SPEC2); 468 + 469 + reg = readl(host->ioaddr + ESDHC_MIX_CTRL); 470 + reg |= ESDHC_MIX_CTRL_AUTO_TUNE_EN; 471 + writel(reg, host->ioaddr + ESDHC_MIX_CTRL); 467 472 } 468 473 469 474 static u32 esdhc_readl_le(struct sdhci_host *host, int reg) ··· 713 682 } else { 714 683 v &= ~ESDHC_MIX_CTRL_SMPCLK_SEL; 715 684 m &= ~ESDHC_MIX_CTRL_FBCLK_SEL; 716 - m &= ~ESDHC_MIX_CTRL_AUTO_TUNE_EN; 717 685 } 718 686 719 687 if (val & SDHCI_CTRL_EXEC_TUNING) { 720 688 v |= ESDHC_MIX_CTRL_EXE_TUNE; 721 689 m |= ESDHC_MIX_CTRL_FBCLK_SEL; 722 - m |= ESDHC_MIX_CTRL_AUTO_TUNE_EN; 723 - usdhc_auto_tuning_mode_sel(host); 724 690 } else { 725 691 v &= ~ESDHC_MIX_CTRL_EXE_TUNE; 726 692 } ··· 1051 1023 1052 1024 /* Reset the tuning circuit */ 1053 1025 if (esdhc_is_usdhc(imx_data)) { 1026 + ctrl = readl(host->ioaddr + ESDHC_MIX_CTRL); 1027 + ctrl &= ~ESDHC_MIX_CTRL_AUTO_TUNE_EN; 1054 1028 if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING) { 1055 - ctrl = readl(host->ioaddr + ESDHC_MIX_CTRL); 1056 1029 ctrl &= ~ESDHC_MIX_CTRL_SMPCLK_SEL; 1057 1030 ctrl &= ~ESDHC_MIX_CTRL_FBCLK_SEL; 1058 1031 writel(ctrl, host->ioaddr + ESDHC_MIX_CTRL); 1059 1032 writel(0, host->ioaddr + ESDHC_TUNE_CTRL_STATUS); 1060 1033 } else if (imx_data->socdata->flags & ESDHC_FLAG_STD_TUNING) { 1034 + writel(ctrl, host->ioaddr + ESDHC_MIX_CTRL); 1061 1035 ctrl = readl(host->ioaddr + SDHCI_AUTO_CMD_STATUS); 1062 1036 ctrl &= ~ESDHC_MIX_CTRL_SMPCLK_SEL; 1063 1037 ctrl &= ~ESDHC_MIX_CTRL_EXE_TUNE; ··· 1082 1052 } 1083 1053 } 1084 1054 1055 + static void usdhc_init_card(struct mmc_host *mmc, struct mmc_card *card) 1056 + { 1057 + struct sdhci_host *host = mmc_priv(mmc); 1058 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 1059 + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); 1060 + 1061 + imx_data->init_card_type = card->type; 1062 + } 1063 + 1085 1064 static int usdhc_execute_tuning(struct mmc_host *mmc, u32 opcode) 1086 1065 { 1087 1066 struct sdhci_host *host = mmc_priv(mmc); 1067 + int err; 1088 1068 1089 1069 /* 1090 1070 * i.MX uSDHC internally already uses a fixed optimized timing for ··· 1109 1069 * correct delay cell. 1110 1070 */ 1111 1071 esdhc_reset_tuning(host); 1112 - return sdhci_execute_tuning(mmc, opcode); 1072 + err = sdhci_execute_tuning(mmc, opcode); 1073 + /* If tuning done, enable auto tuning */ 1074 + if (!err && !host->tuning_err) 1075 + usdhc_auto_tuning_mode_sel_and_en(host); 1076 + 1077 + return err; 1113 1078 } 1114 1079 1115 1080 static void esdhc_prepare_tuning(struct sdhci_host *host, u32 val) ··· 1148 1103 { 1149 1104 u32 reg; 1150 1105 1151 - usdhc_auto_tuning_mode_sel(host); 1152 - 1153 1106 reg = readl(host->ioaddr + ESDHC_MIX_CTRL); 1154 1107 reg &= ~ESDHC_MIX_CTRL_EXE_TUNE; 1155 - reg |= ESDHC_MIX_CTRL_AUTO_TUNE_EN; 1156 1108 writel(reg, host->ioaddr + ESDHC_MIX_CTRL); 1157 1109 } 1158 1110 ··· 1716 1674 * to replace the standard one in sdhci_ops. 1717 1675 */ 1718 1676 host->mmc_host_ops.execute_tuning = usdhc_execute_tuning; 1677 + 1678 + /* 1679 + * Link usdhc specific mmc_host_ops init card function, 1680 + * to distinguish the card type. 1681 + */ 1682 + host->mmc_host_ops.init_card = usdhc_init_card; 1719 1683 } 1720 1684 1721 1685 err = sdhci_esdhc_imx_probe_dt(pdev, host, imx_data);
+8 -6
drivers/mmc/host/sdhci-iproc.c
··· 18 18 u32 caps; 19 19 u32 caps1; 20 20 u32 mmc_caps; 21 + bool missing_caps; 21 22 }; 22 23 23 24 struct sdhci_iproc_host { ··· 252 251 static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = { 253 252 .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION | 254 253 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | 255 - SDHCI_QUIRK_MISSING_CAPS | 256 254 SDHCI_QUIRK_NO_HISPD_BIT, 257 255 .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, 258 256 .ops = &sdhci_iproc_32only_ops, ··· 266 266 .caps1 = SDHCI_DRIVER_TYPE_A | 267 267 SDHCI_DRIVER_TYPE_C, 268 268 .mmc_caps = 0x00000000, 269 + .missing_caps = true, 269 270 }; 270 271 271 272 static const struct sdhci_ops sdhci_iproc_bcm2711_ops = { ··· 296 295 }; 297 296 298 297 static const struct sdhci_pltfm_data sdhci_bcm7211a0_pltfm_data = { 299 - .quirks = SDHCI_QUIRK_MISSING_CAPS | 300 - SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | 298 + .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL | 301 299 SDHCI_QUIRK_BROKEN_DMA | 302 300 SDHCI_QUIRK_BROKEN_ADMA, 303 301 .ops = &sdhci_iproc_ops, ··· 315 315 SDHCI_CAN_DO_HISPD, 316 316 .caps1 = SDHCI_DRIVER_TYPE_C | 317 317 SDHCI_DRIVER_TYPE_D, 318 + .missing_caps = true, 318 319 }; 319 320 320 321 static const struct of_device_id sdhci_iproc_of_match[] = { ··· 398 397 } 399 398 } 400 399 401 - if (iproc_host->data->pdata->quirks & SDHCI_QUIRK_MISSING_CAPS) { 402 - host->caps = iproc_host->data->caps; 403 - host->caps1 = iproc_host->data->caps1; 400 + if (iproc_host->data->missing_caps) { 401 + __sdhci_read_caps(host, NULL, 402 + &iproc_host->data->caps, 403 + &iproc_host->data->caps1); 404 404 } 405 405 406 406 ret = sdhci_add_host(host);
+15 -4
drivers/mmc/host/sdhci-of-dwcmshc.c
··· 48 48 #define DWCMSHC_EMMC_DLL_RXCLK_SRCSEL 29 49 49 #define DWCMSHC_EMMC_DLL_START_POINT 16 50 50 #define DWCMSHC_EMMC_DLL_INC 8 51 + #define DWCMSHC_EMMC_DLL_BYPASS BIT(24) 51 52 #define DWCMSHC_EMMC_DLL_DLYENA BIT(27) 52 53 #define DLL_TXCLK_TAPNUM_DEFAULT 0x10 53 54 #define DLL_TXCLK_TAPNUM_90_DEGREES 0xA ··· 61 60 #define DLL_RXCLK_NO_INVERTER 1 62 61 #define DLL_RXCLK_INVERTER 0 63 62 #define DLL_CMDOUT_TAPNUM_90_DEGREES 0x8 63 + #define DLL_RXCLK_ORI_GATE BIT(31) 64 64 #define DLL_CMDOUT_TAPNUM_FROM_SW BIT(24) 65 65 #define DLL_CMDOUT_SRC_CLK_NEG BIT(28) 66 66 #define DLL_CMDOUT_EN_SRC_CLK_NEG BIT(29) ··· 236 234 sdhci_writel(host, extra, reg); 237 235 238 236 if (clock <= 52000000) { 239 - /* Disable DLL and reset both of sample and drive clock */ 240 - sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_CTRL); 241 - sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_RXCLK); 237 + /* 238 + * Disable DLL and reset both of sample and drive clock. 239 + * The bypass bit and start bit need to be set if DLL is not locked. 240 + */ 241 + sdhci_writel(host, DWCMSHC_EMMC_DLL_BYPASS | DWCMSHC_EMMC_DLL_START, DWCMSHC_EMMC_DLL_CTRL); 242 + sdhci_writel(host, DLL_RXCLK_ORI_GATE, DWCMSHC_EMMC_DLL_RXCLK); 242 243 sdhci_writel(host, 0, DWCMSHC_EMMC_DLL_TXCLK); 243 244 sdhci_writel(host, 0, DECMSHC_EMMC_DLL_CMDOUT); 244 245 /* ··· 284 279 } 285 280 286 281 extra = 0x1 << 16 | /* tune clock stop en */ 287 - 0x2 << 17 | /* pre-change delay */ 282 + 0x3 << 17 | /* pre-change delay */ 288 283 0x3 << 19; /* post-change delay */ 289 284 sdhci_writel(host, extra, dwc_priv->vendor_specific_area1 + DWCMSHC_EMMC_ATCTRL); 290 285 ··· 451 446 }, 452 447 {} 453 448 }; 449 + MODULE_DEVICE_TABLE(acpi, sdhci_dwcmshc_acpi_ids); 454 450 #endif 455 451 456 452 static int dwcmshc_probe(struct platform_device *pdev) ··· 533 527 if (err) 534 528 goto err_clk; 535 529 } 530 + 531 + #ifdef CONFIG_ACPI 532 + if (pltfm_data == &sdhci_dwcmshc_bf3_pdata) 533 + sdhci_enable_v4_mode(host); 534 + #endif 536 535 537 536 host->mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY; 538 537
+5 -3
drivers/mmc/host/sdhci-pci-core.c
··· 251 251 252 252 static int ricoh_mmc_probe_slot(struct sdhci_pci_slot *slot) 253 253 { 254 - slot->host->caps = 254 + u32 caps = 255 255 FIELD_PREP(SDHCI_TIMEOUT_CLK_MASK, 0x21) | 256 256 FIELD_PREP(SDHCI_CLOCK_BASE_MASK, 0x21) | 257 257 SDHCI_TIMEOUT_CLK_UNIT | 258 258 SDHCI_CAN_VDD_330 | 259 259 SDHCI_CAN_DO_HISPD | 260 260 SDHCI_CAN_DO_SDMA; 261 + u32 caps1 = 0; 262 + 263 + __sdhci_read_caps(slot->host, NULL, &caps, &caps1); 261 264 return 0; 262 265 } 263 266 ··· 289 286 #endif 290 287 .quirks = SDHCI_QUIRK_32BIT_DMA_ADDR | 291 288 SDHCI_QUIRK_CLOCK_BEFORE_RESET | 292 - SDHCI_QUIRK_NO_CARD_NO_RESET | 293 - SDHCI_QUIRK_MISSING_CAPS 289 + SDHCI_QUIRK_NO_CARD_NO_RESET, 294 290 }; 295 291 296 292 static void ene_714_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
+141 -13
drivers/mmc/host/sdhci-pxav2.c
··· 20 20 #include <linux/slab.h> 21 21 #include <linux/of.h> 22 22 #include <linux/of_device.h> 23 + #include <linux/mmc/sdio.h> 24 + #include <linux/mmc/mmc.h> 25 + #include <linux/pinctrl/consumer.h> 23 26 24 27 #include "sdhci.h" 25 28 #include "sdhci-pltfm.h" ··· 43 40 #define SD_CE_ATA_2 0xea 44 41 #define MMC_CARD 0x1000 45 42 #define MMC_WIDTH 0x0100 43 + 44 + struct sdhci_pxav2_host { 45 + struct mmc_request *sdio_mrq; 46 + struct pinctrl *pinctrl; 47 + struct pinctrl_state *pins_default; 48 + struct pinctrl_state *pins_cmd_gpio; 49 + }; 46 50 47 51 static void pxav2_reset(struct sdhci_host *host, u8 mask) 48 52 { ··· 90 80 } 91 81 } 92 82 83 + static u16 pxav1_readw(struct sdhci_host *host, int reg) 84 + { 85 + /* Workaround for data abort exception on SDH2 and SDH4 on PXA168 */ 86 + if (reg == SDHCI_HOST_VERSION) 87 + return readl(host->ioaddr + SDHCI_HOST_VERSION - 2) >> 16; 88 + 89 + return readw(host->ioaddr + reg); 90 + } 91 + 92 + static u32 pxav1_irq(struct sdhci_host *host, u32 intmask) 93 + { 94 + struct sdhci_pxav2_host *pxav2_host = sdhci_pltfm_priv(sdhci_priv(host)); 95 + struct mmc_request *sdio_mrq; 96 + 97 + if (pxav2_host->sdio_mrq && (intmask & SDHCI_INT_CMD_MASK)) { 98 + /* The dummy CMD0 for the SDIO workaround just completed */ 99 + sdhci_writel(host, intmask & SDHCI_INT_CMD_MASK, SDHCI_INT_STATUS); 100 + intmask &= ~SDHCI_INT_CMD_MASK; 101 + 102 + /* Restore MMC function to CMD pin */ 103 + if (pxav2_host->pinctrl && pxav2_host->pins_default) 104 + pinctrl_select_state(pxav2_host->pinctrl, pxav2_host->pins_default); 105 + 106 + sdio_mrq = pxav2_host->sdio_mrq; 107 + pxav2_host->sdio_mrq = NULL; 108 + mmc_request_done(host->mmc, sdio_mrq); 109 + } 110 + 111 + return intmask; 112 + } 113 + 114 + static void pxav1_request_done(struct sdhci_host *host, struct mmc_request *mrq) 115 + { 116 + u16 tmp; 117 + struct sdhci_pxav2_host *pxav2_host; 118 + 119 + /* If this is an SDIO command, perform errata workaround for silicon bug */ 120 + if (mrq->cmd && !mrq->cmd->error && 121 + (mrq->cmd->opcode == SD_IO_RW_DIRECT || 122 + mrq->cmd->opcode == SD_IO_RW_EXTENDED)) { 123 + /* Reset data port */ 124 + tmp = readw(host->ioaddr + SDHCI_TIMEOUT_CONTROL); 125 + tmp |= 0x400; 126 + writew(tmp, host->ioaddr + SDHCI_TIMEOUT_CONTROL); 127 + 128 + /* Clock is now stopped, so restart it by sending a dummy CMD0 */ 129 + pxav2_host = sdhci_pltfm_priv(sdhci_priv(host)); 130 + pxav2_host->sdio_mrq = mrq; 131 + 132 + /* Set CMD as high output rather than MMC function while we do CMD0 */ 133 + if (pxav2_host->pinctrl && pxav2_host->pins_cmd_gpio) 134 + pinctrl_select_state(pxav2_host->pinctrl, pxav2_host->pins_cmd_gpio); 135 + 136 + sdhci_writel(host, 0, SDHCI_ARGUMENT); 137 + sdhci_writew(host, 0, SDHCI_TRANSFER_MODE); 138 + sdhci_writew(host, SDHCI_MAKE_CMD(MMC_GO_IDLE_STATE, SDHCI_CMD_RESP_NONE), 139 + SDHCI_COMMAND); 140 + 141 + /* Don't finish this request until the dummy CMD0 finishes */ 142 + return; 143 + } 144 + 145 + mmc_request_done(host->mmc, mrq); 146 + } 147 + 93 148 static void pxav2_mmc_set_bus_width(struct sdhci_host *host, int width) 94 149 { 95 150 u8 ctrl; ··· 176 101 writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); 177 102 } 178 103 104 + struct sdhci_pxa_variant { 105 + const struct sdhci_ops *ops; 106 + unsigned int extra_quirks; 107 + }; 108 + 109 + static const struct sdhci_ops pxav1_sdhci_ops = { 110 + .read_w = pxav1_readw, 111 + .set_clock = sdhci_set_clock, 112 + .irq = pxav1_irq, 113 + .get_max_clock = sdhci_pltfm_clk_get_max_clock, 114 + .set_bus_width = pxav2_mmc_set_bus_width, 115 + .reset = pxav2_reset, 116 + .set_uhs_signaling = sdhci_set_uhs_signaling, 117 + .request_done = pxav1_request_done, 118 + }; 119 + 120 + static const struct sdhci_pxa_variant __maybe_unused pxav1_variant = { 121 + .ops = &pxav1_sdhci_ops, 122 + .extra_quirks = SDHCI_QUIRK_NO_BUSY_IRQ | SDHCI_QUIRK_32BIT_DMA_SIZE, 123 + }; 124 + 179 125 static const struct sdhci_ops pxav2_sdhci_ops = { 180 126 .set_clock = sdhci_set_clock, 181 127 .get_max_clock = sdhci_pltfm_clk_get_max_clock, ··· 205 109 .set_uhs_signaling = sdhci_set_uhs_signaling, 206 110 }; 207 111 112 + static const struct sdhci_pxa_variant pxav2_variant = { 113 + .ops = &pxav2_sdhci_ops, 114 + }; 115 + 208 116 #ifdef CONFIG_OF 209 117 static const struct of_device_id sdhci_pxav2_of_match[] = { 210 - { 211 - .compatible = "mrvl,pxav2-mmc", 212 - }, 118 + { .compatible = "mrvl,pxav1-mmc", .data = &pxav1_variant, }, 119 + { .compatible = "mrvl,pxav2-mmc", .data = &pxav2_variant, }, 213 120 {}, 214 121 }; 215 122 MODULE_DEVICE_TABLE(of, sdhci_pxav2_of_match); ··· 254 155 { 255 156 struct sdhci_pltfm_host *pltfm_host; 256 157 struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; 158 + struct sdhci_pxav2_host *pxav2_host; 257 159 struct device *dev = &pdev->dev; 258 160 struct sdhci_host *host = NULL; 259 - const struct of_device_id *match; 161 + const struct sdhci_pxa_variant *variant; 260 162 261 163 int ret; 262 - struct clk *clk; 164 + struct clk *clk, *clk_core; 263 165 264 - host = sdhci_pltfm_init(pdev, NULL, 0); 166 + host = sdhci_pltfm_init(pdev, NULL, sizeof(*pxav2_host)); 265 167 if (IS_ERR(host)) 266 168 return PTR_ERR(host); 267 169 268 170 pltfm_host = sdhci_priv(host); 171 + pxav2_host = sdhci_pltfm_priv(pltfm_host); 269 172 270 - clk = devm_clk_get(dev, "PXA-SDHCLK"); 173 + clk = devm_clk_get(dev, "io"); 174 + if (IS_ERR(clk) && PTR_ERR(clk) != -EPROBE_DEFER) 175 + clk = devm_clk_get(dev, NULL); 271 176 if (IS_ERR(clk)) { 272 - dev_err(dev, "failed to get io clock\n"); 273 177 ret = PTR_ERR(clk); 178 + dev_err_probe(dev, ret, "failed to get io clock\n"); 274 179 goto free; 275 180 } 276 181 pltfm_host->clk = clk; 277 182 ret = clk_prepare_enable(clk); 278 183 if (ret) { 279 - dev_err(&pdev->dev, "failed to enable io clock\n"); 184 + dev_err(dev, "failed to enable io clock\n"); 280 185 goto free; 186 + } 187 + 188 + clk_core = devm_clk_get_optional_enabled(dev, "core"); 189 + if (IS_ERR(clk_core)) { 190 + ret = PTR_ERR(clk_core); 191 + dev_err_probe(dev, ret, "failed to enable core clock\n"); 192 + goto disable_clk; 281 193 } 282 194 283 195 host->quirks = SDHCI_QUIRK_BROKEN_ADMA 284 196 | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL 285 197 | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN; 286 198 287 - match = of_match_device(of_match_ptr(sdhci_pxav2_of_match), &pdev->dev); 288 - if (match) { 199 + variant = of_device_get_match_data(dev); 200 + if (variant) 289 201 pdata = pxav2_get_mmc_pdata(dev); 290 - } 202 + else 203 + variant = &pxav2_variant; 204 + 291 205 if (pdata) { 292 206 if (pdata->flags & PXA_FLAG_CARD_PERMANENT) { 293 207 /* on-chip device */ ··· 320 208 host->mmc->pm_caps |= pdata->pm_caps; 321 209 } 322 210 323 - host->ops = &pxav2_sdhci_ops; 211 + host->quirks |= variant->extra_quirks; 212 + host->ops = variant->ops; 213 + 214 + /* Set up optional pinctrl for PXA168 SDIO IRQ fix */ 215 + pxav2_host->pinctrl = devm_pinctrl_get(dev); 216 + if (!IS_ERR(pxav2_host->pinctrl)) { 217 + pxav2_host->pins_cmd_gpio = pinctrl_lookup_state(pxav2_host->pinctrl, 218 + "state_cmd_gpio"); 219 + if (IS_ERR(pxav2_host->pins_cmd_gpio)) 220 + pxav2_host->pins_cmd_gpio = NULL; 221 + pxav2_host->pins_default = pinctrl_lookup_state(pxav2_host->pinctrl, 222 + "default"); 223 + if (IS_ERR(pxav2_host->pins_default)) 224 + pxav2_host->pins_default = NULL; 225 + } else { 226 + pxav2_host->pinctrl = NULL; 227 + } 324 228 325 229 ret = sdhci_add_host(host); 326 230 if (ret)
+1 -3
drivers/mmc/host/sdhci-pxav3.c
··· 124 124 struct resource *res; 125 125 126 126 host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN; 127 - host->quirks |= SDHCI_QUIRK_MISSING_CAPS; 128 127 129 - host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); 130 - host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); 128 + sdhci_read_caps(host); 131 129 132 130 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 133 131 "conf-sdio3");
+2 -4
drivers/mmc/host/sdhci-sprd.c
··· 553 553 554 554 static const struct sdhci_pltfm_data sdhci_sprd_pdata = { 555 555 .quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION | 556 - SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | 557 - SDHCI_QUIRK_MISSING_CAPS, 556 + SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, 558 557 .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 | 559 558 SDHCI_QUIRK2_USE_32BIT_BLK_CNT | 560 559 SDHCI_QUIRK2_PRESET_VALUE_BROKEN, ··· 670 671 * will allow these modes to be specified only by device 671 672 * tree properties through mmc_of_parse(). 672 673 */ 673 - host->caps = sdhci_readl(host, SDHCI_CAPABILITIES); 674 - host->caps1 = sdhci_readl(host, SDHCI_CAPABILITIES_1); 674 + sdhci_read_caps(host); 675 675 host->caps1 &= ~(SDHCI_SUPPORT_SDR50 | SDHCI_SUPPORT_SDR104 | 676 676 SDHCI_SUPPORT_DDR50); 677 677
-3
drivers/mmc/host/sdhci.c
··· 4121 4121 v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION); 4122 4122 host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT; 4123 4123 4124 - if (host->quirks & SDHCI_QUIRK_MISSING_CAPS) 4125 - return; 4126 - 4127 4124 if (caps) { 4128 4125 host->caps = *caps; 4129 4126 } else {
-2
drivers/mmc/host/sdhci.h
··· 423 423 #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25) 424 424 /* Controller cannot support End Attribute in NOP ADMA descriptor */ 425 425 #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26) 426 - /* Controller is missing device caps. Use caps provided by host */ 427 - #define SDHCI_QUIRK_MISSING_CAPS (1<<27) 428 426 /* Controller uses Auto CMD12 command to stop the transfer */ 429 427 #define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28) 430 428 /* Controller doesn't have HISPD bit field in HI-SPEED SD card */
+78 -5
drivers/mmc/host/uniphier-sd.c
··· 8 8 #include <linux/clk.h> 9 9 #include <linux/delay.h> 10 10 #include <linux/dma-mapping.h> 11 + #include <linux/mfd/syscon.h> 11 12 #include <linux/mfd/tmio.h> 12 13 #include <linux/mmc/host.h> 13 14 #include <linux/module.h> ··· 16 15 #include <linux/of_device.h> 17 16 #include <linux/pinctrl/consumer.h> 18 17 #include <linux/platform_device.h> 18 + #include <linux/regmap.h> 19 19 #include <linux/reset.h> 20 20 21 21 #include "tmio_mmc.h" ··· 50 48 #define UNIPHIER_SD_DMA_ADDR_L 0x440 51 49 #define UNIPHIER_SD_DMA_ADDR_H 0x444 52 50 51 + /* SD control */ 52 + #define UNIPHIER_SDCTRL_CHOFFSET 0x200 53 + #define UNIPHIER_SDCTRL_MODE 0x30 54 + #define UNIPHIER_SDCTRL_MODE_UHS1MOD BIT(15) 55 + #define UNIPHIER_SDCTRL_MODE_SDRSEL BIT(14) 56 + 53 57 /* 54 58 * IP is extended to support various features: built-in DMA engine, 55 59 * 1/1024 divisor, etc. ··· 74 66 struct reset_control *rst_hw; 75 67 struct dma_chan *chan; 76 68 enum dma_data_direction dma_dir; 69 + struct regmap *sdctrl_regmap; 70 + u32 sdctrl_ch; 77 71 unsigned long clk_rate; 78 72 unsigned long caps; 79 73 }; ··· 430 420 usleep_range(300, 1000); 431 421 } 432 422 423 + static void uniphier_sd_speed_switch(struct tmio_mmc_host *host) 424 + { 425 + struct uniphier_sd_priv *priv = uniphier_sd_priv(host); 426 + unsigned int offset; 427 + u32 val = 0; 428 + 429 + if (!(host->mmc->caps & MMC_CAP_UHS)) 430 + return; 431 + 432 + if (host->mmc->ios.timing == MMC_TIMING_UHS_SDR50 || 433 + host->mmc->ios.timing == MMC_TIMING_UHS_SDR104) 434 + val = UNIPHIER_SDCTRL_MODE_SDRSEL; 435 + 436 + offset = UNIPHIER_SDCTRL_CHOFFSET * priv->sdctrl_ch 437 + + UNIPHIER_SDCTRL_MODE; 438 + regmap_write_bits(priv->sdctrl_regmap, offset, 439 + UNIPHIER_SDCTRL_MODE_SDRSEL, val); 440 + } 441 + 442 + static void uniphier_sd_uhs_enable(struct tmio_mmc_host *host, bool uhs_en) 443 + { 444 + struct uniphier_sd_priv *priv = uniphier_sd_priv(host); 445 + unsigned int offset; 446 + u32 val; 447 + 448 + if (!(host->mmc->caps & MMC_CAP_UHS)) 449 + return; 450 + 451 + val = (uhs_en) ? UNIPHIER_SDCTRL_MODE_UHS1MOD : 0; 452 + 453 + offset = UNIPHIER_SDCTRL_CHOFFSET * priv->sdctrl_ch 454 + + UNIPHIER_SDCTRL_MODE; 455 + regmap_write_bits(priv->sdctrl_regmap, offset, 456 + UNIPHIER_SDCTRL_MODE_UHS1MOD, val); 457 + } 458 + 433 459 static void uniphier_sd_set_clock(struct tmio_mmc_host *host, 434 460 unsigned int clock) 435 461 { ··· 478 432 /* stop the clock before changing its rate to avoid a glitch signal */ 479 433 tmp &= ~CLK_CTL_SCLKEN; 480 434 writel(tmp, host->ctl + (CTL_SD_CARD_CLK_CTL << 1)); 435 + 436 + uniphier_sd_speed_switch(host); 481 437 482 438 if (clock == 0) 483 439 return; ··· 548 500 struct uniphier_sd_priv *priv = uniphier_sd_priv(host); 549 501 struct pinctrl_state *pinstate = NULL; 550 502 u32 val, tmp; 503 + bool uhs_en; 551 504 552 505 switch (ios->signal_voltage) { 553 506 case MMC_SIGNAL_VOLTAGE_330: 554 507 val = UNIPHIER_SD_VOLT_330; 508 + uhs_en = false; 555 509 break; 556 510 case MMC_SIGNAL_VOLTAGE_180: 557 511 val = UNIPHIER_SD_VOLT_180; 558 512 pinstate = priv->pinstate_uhs; 513 + uhs_en = true; 559 514 break; 560 515 default: 561 516 return -ENOTSUPP; ··· 574 523 else 575 524 pinctrl_select_default_state(mmc_dev(mmc)); 576 525 526 + uniphier_sd_uhs_enable(host, uhs_en); 527 + 577 528 return 0; 578 529 } 579 530 580 - static int uniphier_sd_uhs_init(struct tmio_mmc_host *host, 581 - struct uniphier_sd_priv *priv) 531 + static int uniphier_sd_uhs_init(struct tmio_mmc_host *host) 582 532 { 533 + struct uniphier_sd_priv *priv = uniphier_sd_priv(host); 534 + struct device *dev = &host->pdev->dev; 535 + struct device_node *np = dev->of_node; 536 + struct of_phandle_args args; 537 + int ret; 538 + 583 539 priv->pinctrl = devm_pinctrl_get(mmc_dev(host->mmc)); 584 540 if (IS_ERR(priv->pinctrl)) 585 541 return PTR_ERR(priv->pinctrl); ··· 595 537 if (IS_ERR(priv->pinstate_uhs)) 596 538 return PTR_ERR(priv->pinstate_uhs); 597 539 598 - host->ops.start_signal_voltage_switch = 599 - uniphier_sd_start_signal_voltage_switch; 540 + ret = of_parse_phandle_with_fixed_args(np, 541 + "socionext,syscon-uhs-mode", 542 + 1, 0, &args); 543 + if (ret) { 544 + dev_err(dev, "Can't get syscon-uhs-mode property\n"); 545 + return ret; 546 + } 547 + priv->sdctrl_regmap = syscon_node_to_regmap(args.np); 548 + of_node_put(args.np); 549 + if (IS_ERR(priv->sdctrl_regmap)) { 550 + dev_err(dev, "Can't map syscon-uhs-mode\n"); 551 + return PTR_ERR(priv->sdctrl_regmap); 552 + } 553 + priv->sdctrl_ch = args.args[0]; 600 554 601 555 return 0; 602 556 } ··· 671 601 } 672 602 673 603 if (host->mmc->caps & MMC_CAP_UHS) { 674 - ret = uniphier_sd_uhs_init(host, priv); 604 + ret = uniphier_sd_uhs_init(host); 675 605 if (ret) { 676 606 dev_warn(dev, 677 607 "failed to setup UHS (error %d). Disabling UHS.", 678 608 ret); 679 609 host->mmc->caps &= ~MMC_CAP_UHS; 610 + } else { 611 + host->ops.start_signal_voltage_switch = 612 + uniphier_sd_start_signal_voltage_switch; 680 613 } 681 614 } 682 615
+1
include/linux/mmc/host.h
··· 527 527 struct device_node; 528 528 529 529 struct mmc_host *mmc_alloc_host(int extra, struct device *); 530 + struct mmc_host *devm_mmc_alloc_host(struct device *dev, int extra); 530 531 int mmc_add_host(struct mmc_host *); 531 532 void mmc_remove_host(struct mmc_host *); 532 533 void mmc_free_host(struct mmc_host *);
+1
include/linux/mmc/slot-gpio.h
··· 15 15 16 16 int mmc_gpio_get_ro(struct mmc_host *host); 17 17 int mmc_gpio_get_cd(struct mmc_host *host); 18 + void mmc_gpio_set_cd_irq(struct mmc_host *host, int irq); 18 19 int mmc_gpiod_request_cd(struct mmc_host *host, const char *con_id, 19 20 unsigned int idx, bool override_active_level, 20 21 unsigned int debounce);