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

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

Pull MMC updates from Ulf Hansson:
"MMC core:
- Initial support for SD express card/host

MMC host:
- mxc: Convert the driver to DT-only
- mtk-sd: Add HS400 enhanced strobe support
- mtk-sd: Add support for the MT8192 SoC variant
- sdhci-acpi: Allow changing HS200/HS400 driver strength for AMDI0040
- sdhci-esdhc-imx: Convert the driver to DT-only
- sdhci-pci-gli: Improve performance for HS400 mode for GL9763E
- sdhci-pci-gli: Reduce power consumption for GL9755
- sdhci-xenon: Introduce ACPI support
- tmio: Fix command error processing
- tmio: Inform the core about the max_busy_timeout
- tmio/renesas_sdhi: Support custom calculation of busy-wait time
- renesas_sdhi: Reset SCC only when available
- rtsx_pci: Add SD Express mode support for RTS5261
- rtsx_pci: Various fixes and improvements for RTS5261

MEMSTICK:
- Minor fixes/improvements"

* tag 'mmc-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (72 commits)
dt-bindings: mmc: eliminate yamllint warnings
mmc: sdhci-xenon: introduce ACPI support
mmc: sdhci-xenon: use clk only with DT
mmc: sdhci-xenon: switch to device_* API
mmc: sdhci-xenon: use match data for controllers variants
dt-bindings: mmc: Fix xlnx,mio-bank property values for arasan driver
mmc: renesas_sdhi: populate hook for longer busy_wait
mmc: tmio: add hook for custom busy_wait calculation
mmc: tmio: set max_busy_timeout
dt-bindings: mmc: imx: fix the wrongly dropped imx8qm compatible string
mmc: sdhci-pci-gli: Disable slow mode in HS400 mode for GL9763E
mmc: sdhci: Use more concise device_property_read_u64
memstick: r592: Fix error return in r592_probe()
mmc: mxc: Convert the driver to DT-only
mmc: mxs: Remove the unused .id_table
mmc: sdhci-of-arasan: Fix fall-through warnings for Clang
mmc: sdhci-pci-gli: Reduce power consumption for GL9755
mmc: mediatek: depend on COMMON_CLK to fix compile tests
mmc: pxamci: Fix error return code in pxamci_probe
mmc: sdhci: Update firmware interface API
...

+839 -454
+1 -1
Documentation/devicetree/bindings/mmc/arasan,sdhci.yaml
··· 147 147 148 148 xlnx,mio-bank: 149 149 $ref: /schemas/types.yaml#/definitions/uint32 150 - enum: [0, 2] 150 + enum: [0, 1, 2] 151 151 default: 0 152 152 description: 153 153 The MIO bank number in which the command and data lines are configured.
+1
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml
··· 39 39 - fsl,imx8mn-usdhc 40 40 - fsl,imx8mp-usdhc 41 41 - fsl,imx8mq-usdhc 42 + - fsl,imx8qm-usdhc 42 43 - fsl,imx8qxp-usdhc 43 44 - const: fsl,imx7d-usdhc 44 45
-75
Documentation/devicetree/bindings/mmc/mtk-sd.txt
··· 1 - * MTK MMC controller 2 - 3 - The MTK MSDC can act as a MMC controller 4 - to support MMC, SD, and SDIO types of memory cards. 5 - 6 - This file documents differences between the core properties in mmc.txt 7 - and the properties used by the msdc driver. 8 - 9 - Required properties: 10 - - compatible: value should be either of the following. 11 - "mediatek,mt8135-mmc": for mmc host ip compatible with mt8135 12 - "mediatek,mt8173-mmc": for mmc host ip compatible with mt8173 13 - "mediatek,mt8183-mmc": for mmc host ip compatible with mt8183 14 - "mediatek,mt8516-mmc": for mmc host ip compatible with mt8516 15 - "mediatek,mt6779-mmc": for mmc host ip compatible with mt6779 16 - "mediatek,mt2701-mmc": for mmc host ip compatible with mt2701 17 - "mediatek,mt2712-mmc": for mmc host ip compatible with mt2712 18 - "mediatek,mt7622-mmc": for MT7622 SoC 19 - "mediatek,mt7623-mmc", "mediatek,mt2701-mmc": for MT7623 SoC 20 - "mediatek,mt7620-mmc", for MT7621 SoC (and others) 21 - 22 - - reg: physical base address of the controller and length 23 - - interrupts: Should contain MSDC interrupt number 24 - - clocks: Should contain phandle for the clock feeding the MMC controller 25 - - clock-names: Should contain the following: 26 - "source" - source clock (required) 27 - "hclk" - HCLK which used for host (required) 28 - "source_cg" - independent source clock gate (required for MT2712) 29 - "bus_clk" - bus clock used for internal register access (required for MT2712 MSDC0/3) 30 - - pinctrl-names: should be "default", "state_uhs" 31 - - pinctrl-0: should contain default/high speed pin ctrl 32 - - pinctrl-1: should contain uhs mode pin ctrl 33 - - vmmc-supply: power to the Core 34 - - vqmmc-supply: power to the IO 35 - 36 - Optional properties: 37 - - assigned-clocks: PLL of the source clock 38 - - assigned-clock-parents: parent of source clock, used for HS400 mode to get 400Mhz source clock 39 - - hs400-ds-delay: HS400 DS delay setting 40 - - mediatek,hs200-cmd-int-delay: HS200 command internal delay setting. 41 - This field has total 32 stages. 42 - The value is an integer from 0 to 31. 43 - - mediatek,hs400-cmd-int-delay: HS400 command internal delay setting 44 - This field has total 32 stages. 45 - The value is an integer from 0 to 31. 46 - - mediatek,hs400-cmd-resp-sel-rising: HS400 command response sample selection 47 - If present,HS400 command responses are sampled on rising edges. 48 - If not present,HS400 command responses are sampled on falling edges. 49 - - mediatek,latch-ck: Some SoCs do not support enhance_rx, need set correct latch-ck to avoid data crc 50 - error caused by stop clock(fifo full) 51 - Valid range = [0:0x7]. if not present, default value is 0. 52 - applied to compatible "mediatek,mt2701-mmc". 53 - - resets: Phandle and reset specifier pair to softreset line of MSDC IP. 54 - - reset-names: Should be "hrst". 55 - 56 - Examples: 57 - mmc0: mmc@11230000 { 58 - compatible = "mediatek,mt8173-mmc", "mediatek,mt8135-mmc"; 59 - reg = <0 0x11230000 0 0x108>; 60 - interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_LOW>; 61 - vmmc-supply = <&mt6397_vemc_3v3_reg>; 62 - vqmmc-supply = <&mt6397_vio18_reg>; 63 - clocks = <&pericfg CLK_PERI_MSDC30_0>, 64 - <&topckgen CLK_TOP_MSDC50_0_H_SEL>; 65 - clock-names = "source", "hclk"; 66 - pinctrl-names = "default", "state_uhs"; 67 - pinctrl-0 = <&mmc0_pins_default>; 68 - pinctrl-1 = <&mmc0_pins_uhs>; 69 - assigned-clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>; 70 - assigned-clock-parents = <&topckgen CLK_TOP_MSDCPLL_D2>; 71 - hs400-ds-delay = <0x14015>; 72 - mediatek,hs200-cmd-int-delay = <26>; 73 - mediatek,hs400-cmd-int-delay = <14>; 74 - mediatek,hs400-cmd-resp-sel-rising; 75 - };
+176
Documentation/devicetree/bindings/mmc/mtk-sd.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mmc/mtk-sd.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: MTK MSDC Storage Host Controller Binding 8 + 9 + maintainers: 10 + - Chaotian Jing <chaotian.jing@mediatek.com> 11 + - Wenbin Mei <wenbin.mei@mediatek.com> 12 + 13 + allOf: 14 + - $ref: mmc-controller.yaml# 15 + 16 + properties: 17 + compatible: 18 + oneOf: 19 + - enum: 20 + - mediatek,mt2701-mmc 21 + - mediatek,mt2712-mmc 22 + - mediatek,mt6779-mmc 23 + - mediatek,mt7620-mmc 24 + - mediatek,mt7622-mmc 25 + - mediatek,mt8135-mmc 26 + - mediatek,mt8173-mmc 27 + - mediatek,mt8183-mmc 28 + - mediatek,mt8516-mmc 29 + - items: 30 + - const: mediatek,mt7623-mmc 31 + - const: mediatek,mt2701-mmc 32 + - items: 33 + - const: mediatek,mt8192-mmc 34 + - const: mediatek,mt8183-mmc 35 + 36 + clocks: 37 + description: 38 + Should contain phandle for the clock feeding the MMC controller. 39 + minItems: 2 40 + maxItems: 8 41 + items: 42 + - description: source clock (required). 43 + - description: HCLK which used for host (required). 44 + - description: independent source clock gate (required for MT2712). 45 + - description: bus clock used for internal register access (required for MT2712 MSDC0/3). 46 + - description: msdc subsys clock gate (required for MT8192). 47 + - description: peripheral bus clock gate (required for MT8192). 48 + - description: AXI bus clock gate (required for MT8192). 49 + - description: AHB bus clock gate (required for MT8192). 50 + 51 + clock-names: 52 + minItems: 2 53 + maxItems: 8 54 + items: 55 + - const: source 56 + - const: hclk 57 + - const: source_cg 58 + - const: bus_clk 59 + - const: sys_cg 60 + - const: pclk_cg 61 + - const: axi_cg 62 + - const: ahb_cg 63 + 64 + pinctrl-names: 65 + items: 66 + - const: default 67 + - const: state_uhs 68 + 69 + pinctrl-0: 70 + description: 71 + should contain default/high speed pin ctrl. 72 + maxItems: 1 73 + 74 + pinctrl-1: 75 + description: 76 + should contain uhs mode pin ctrl. 77 + maxItems: 1 78 + 79 + assigned-clocks: 80 + description: 81 + PLL of the source clock. 82 + maxItems: 1 83 + 84 + assigned-clock-parents: 85 + description: 86 + parent of source clock, used for HS400 mode to get 400Mhz source clock. 87 + maxItems: 1 88 + 89 + hs400-ds-delay: 90 + $ref: /schemas/types.yaml#/definitions/uint32 91 + description: 92 + HS400 DS delay setting. 93 + minimum: 0 94 + maximum: 0xffffffff 95 + 96 + mediatek,hs200-cmd-int-delay: 97 + $ref: /schemas/types.yaml#/definitions/uint32 98 + description: 99 + HS200 command internal delay setting. 100 + This field has total 32 stages. 101 + The value is an integer from 0 to 31. 102 + minimum: 0 103 + maximum: 31 104 + 105 + mediatek,hs400-cmd-int-delay: 106 + $ref: /schemas/types.yaml#/definitions/uint32 107 + description: 108 + HS400 command internal delay setting. 109 + This field has total 32 stages. 110 + The value is an integer from 0 to 31. 111 + minimum: 0 112 + maximum: 31 113 + 114 + mediatek,hs400-cmd-resp-sel-rising: 115 + $ref: /schemas/types.yaml#/definitions/flag 116 + description: 117 + HS400 command response sample selection. 118 + If present, HS400 command responses are sampled on rising edges. 119 + If not present, HS400 command responses are sampled on falling edges. 120 + 121 + mediatek,latch-ck: 122 + $ref: /schemas/types.yaml#/definitions/uint32 123 + description: 124 + Some SoCs do not support enhance_rx, need set correct latch-ck to avoid 125 + data crc error caused by stop clock(fifo full) Valid range = [0:0x7]. 126 + if not present, default value is 0. 127 + applied to compatible "mediatek,mt2701-mmc". 128 + minimum: 0 129 + maximum: 7 130 + 131 + resets: 132 + maxItems: 1 133 + 134 + reset-names: 135 + const: hrst 136 + 137 + required: 138 + - compatible 139 + - reg 140 + - interrupts 141 + - clocks 142 + - clock-names 143 + - pinctrl-names 144 + - pinctrl-0 145 + - pinctrl-1 146 + - vmmc-supply 147 + - vqmmc-supply 148 + 149 + unevaluatedProperties: false 150 + 151 + examples: 152 + - | 153 + #include <dt-bindings/interrupt-controller/irq.h> 154 + #include <dt-bindings/interrupt-controller/arm-gic.h> 155 + #include <dt-bindings/clock/mt8173-clk.h> 156 + mmc0: mmc@11230000 { 157 + compatible = "mediatek,mt8173-mmc"; 158 + reg = <0x11230000 0x1000>; 159 + interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_LOW>; 160 + vmmc-supply = <&mt6397_vemc_3v3_reg>; 161 + vqmmc-supply = <&mt6397_vio18_reg>; 162 + clocks = <&pericfg CLK_PERI_MSDC30_0>, 163 + <&topckgen CLK_TOP_MSDC50_0_H_SEL>; 164 + clock-names = "source", "hclk"; 165 + pinctrl-names = "default", "state_uhs"; 166 + pinctrl-0 = <&mmc0_pins_default>; 167 + pinctrl-1 = <&mmc0_pins_uhs>; 168 + assigned-clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>; 169 + assigned-clock-parents = <&topckgen CLK_TOP_MSDCPLL_D2>; 170 + hs400-ds-delay = <0x14015>; 171 + mediatek,hs200-cmd-int-delay = <26>; 172 + mediatek,hs400-cmd-int-delay = <14>; 173 + mediatek,hs400-cmd-resp-sel-rising; 174 + }; 175 + 176 + ...
+3 -1
Documentation/devicetree/bindings/mmc/owl-mmc.yaml
··· 17 17 oneOf: 18 18 - const: actions,owl-mmc 19 19 - items: 20 - - const: actions,s700-mmc 20 + - enum: 21 + - actions,s500-mmc 22 + - actions,s700-mmc 21 23 - const: actions,owl-mmc 22 24 23 25 reg:
-1
drivers/memstick/core/memstick.c
··· 468 468 host->card = card; 469 469 if (device_register(&card->dev)) { 470 470 put_device(&card->dev); 471 - kfree(host->card); 472 471 host->card = NULL; 473 472 } 474 473 } else
+1 -1
drivers/memstick/core/mspro_block.c
··· 276 276 return "attr_devinfo"; 277 277 default: 278 278 return NULL; 279 - }; 279 + } 280 280 } 281 281 282 282 typedef ssize_t (*sysfs_show_t)(struct device *dev,
+1 -1
drivers/memstick/host/jmb38x_ms.c
··· 748 748 clock_delay); 749 749 host->ifmode = value; 750 750 break; 751 - }; 751 + } 752 752 return 0; 753 753 } 754 754
+8 -4
drivers/memstick/host/r592.c
··· 759 759 goto error3; 760 760 761 761 dev->mmio = pci_ioremap_bar(pdev, 0); 762 - if (!dev->mmio) 762 + if (!dev->mmio) { 763 + error = -ENOMEM; 763 764 goto error4; 765 + } 764 766 765 767 dev->irq = pdev->irq; 766 768 spin_lock_init(&dev->irq_lock); ··· 788 786 &dev->dummy_dma_page_physical_address, GFP_KERNEL); 789 787 r592_stop_dma(dev , 0); 790 788 791 - if (request_irq(dev->irq, &r592_irq, IRQF_SHARED, 792 - DRV_NAME, dev)) 789 + error = request_irq(dev->irq, &r592_irq, IRQF_SHARED, 790 + DRV_NAME, dev); 791 + if (error) 793 792 goto error6; 794 793 795 794 r592_update_card_detect(dev); 796 - if (memstick_add_host(host)) 795 + error = memstick_add_host(host); 796 + if (error) 797 797 goto error7; 798 798 799 799 message("driver successfully loaded");
+1 -1
drivers/memstick/host/tifm_ms.c
··· 528 528 } else 529 529 return -EINVAL; 530 530 break; 531 - }; 531 + } 532 532 533 533 return 0; 534 534 }
+48 -13
drivers/misc/cardreader/rts5261.c
··· 26 26 static void rts5261_fill_driving(struct rtsx_pcr *pcr, u8 voltage) 27 27 { 28 28 u8 driving_3v3[4][3] = { 29 - {0x13, 0x13, 0x13}, 29 + {0x96, 0x96, 0x96}, 30 30 {0x96, 0x96, 0x96}, 31 31 {0x7F, 0x7F, 0x7F}, 32 - {0x96, 0x96, 0x96}, 32 + {0x13, 0x13, 0x13}, 33 33 }; 34 34 u8 driving_1v8[4][3] = { 35 - {0x99, 0x99, 0x99}, 35 + {0xB3, 0xB3, 0xB3}, 36 36 {0x3A, 0x3A, 0x3A}, 37 37 {0xE6, 0xE6, 0xE6}, 38 - {0xB3, 0xB3, 0xB3}, 38 + {0x99, 0x99, 0x99}, 39 39 }; 40 40 u8 (*driving)[3], drive_sel; 41 41 ··· 67 67 pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG2, reg); 68 68 69 69 if (!rts5261_vendor_setting_valid(reg)) { 70 + /* Not support MMC default */ 71 + pcr->extra_caps |= EXTRA_CAPS_NO_MMC; 70 72 pcr_dbg(pcr, "skip fetch vendor setting\n"); 71 73 return; 72 74 } 73 75 74 - pcr->card_drive_sel &= 0x3F; 75 - pcr->card_drive_sel |= rts5261_reg_to_card_drive_sel(reg); 76 + if (!rts5261_reg_check_mmc_support(reg)) 77 + pcr->extra_caps |= EXTRA_CAPS_NO_MMC; 78 + 79 + /* TO do: need to add rtd3 function */ 80 + pcr->rtd3_en = rts5261_reg_to_rtd3(reg); 76 81 77 82 if (rts5261_reg_check_reverse_socket(reg)) 78 83 pcr->flags |= PCR_REVERSE_SOCKET; ··· 176 171 if (option->ocp_en) 177 172 rtsx_pci_enable_ocp(pcr); 178 173 174 + rtsx_pci_write_register(pcr, REG_CRC_DUMMY_0, 175 + CFG_SD_POW_AUTO_PD, CFG_SD_POW_AUTO_PD); 179 176 180 177 rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG1, 181 178 RTS5261_LDO1_TUNE_MASK, RTS5261_LDO1_33); ··· 279 272 u8 val = 0; 280 273 281 274 val = SD_OCP_INT_EN | SD_DETECT_EN; 275 + rtsx_pci_write_register(pcr, RTS5261_LDO1_CFG0, 276 + RTS5261_LDO1_OCP_EN | RTS5261_LDO1_OCP_LMT_EN, 277 + RTS5261_LDO1_OCP_EN | RTS5261_LDO1_OCP_LMT_EN); 282 278 rtsx_pci_write_register(pcr, REG_OCPCTL, 0xFF, val); 283 279 284 280 } ··· 305 295 err = rtsx_pci_write_register(pcr, RTS5261_LDO1233318_POW_CTL, 306 296 RTS5261_LDO_POWERON_MASK, 0); 307 297 298 + rtsx_pci_write_register(pcr, REG_CRC_DUMMY_0, 299 + CFG_SD_POW_AUTO_PD, 0); 308 300 if (pcr->option.ocp_en) 309 301 rtsx_pci_disable_ocp(pcr); 310 302 ··· 352 340 353 341 rtsx_pci_write_register(pcr, REG_OCPCTL, mask, val); 354 342 355 - udelay(10); 343 + udelay(1000); 356 344 rtsx_pci_write_register(pcr, REG_OCPCTL, mask, 0); 357 345 358 346 } ··· 365 353 rtsx_pci_get_ocpstat(pcr, &pcr->ocp_stat); 366 354 367 355 if (pcr->ocp_stat & (SD_OC_NOW | SD_OC_EVER)) { 356 + rts5261_clear_ocpstat(pcr); 368 357 rts5261_card_power_off(pcr, RTSX_SD_CARD); 369 358 rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, 0); 370 - rts5261_clear_ocpstat(pcr); 371 359 pcr->ocp_stat = 0; 372 360 } 373 361 ··· 479 467 static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) 480 468 { 481 469 struct rtsx_cr_option *option = &pcr->option; 470 + u32 val; 482 471 483 472 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1, 484 473 CD_RESUME_EN_MASK, CD_RESUME_EN_MASK); ··· 494 481 AUX_CLK_ACTIVE_SEL_MASK, MAC_CKSW_DONE); 495 482 rtsx_pci_write_register(pcr, L1SUB_CONFIG3, 0xFF, 0); 496 483 484 + if (is_version_higher_than(pcr, PID_5261, IC_VER_B)) { 485 + val = rtsx_pci_readl(pcr, RTSX_DUM_REG); 486 + rtsx_pci_writel(pcr, RTSX_DUM_REG, val | 0x1); 487 + } 497 488 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG4, 498 489 RTS5261_AUX_CLK_16M_EN, 0); 499 490 ··· 519 502 /* Configure driving */ 520 503 rts5261_fill_driving(pcr, OUTPUT_3V3); 521 504 505 + if (pcr->flags & PCR_REVERSE_SOCKET) 506 + rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x30); 507 + else 508 + rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00); 509 + 522 510 /* 523 511 * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced 524 512 * to drive low, and we forcibly request clock. ··· 535 513 rtsx_pci_write_register(pcr, PETXCFG, 536 514 FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH); 537 515 516 + rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB); 538 517 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x00); 539 518 rtsx_pci_write_register(pcr, RTS5261_REG_PME_FORCE_CTL, 540 519 FORCE_PM_CONTROL | FORCE_PM_VALUE, FORCE_PM_CONTROL); ··· 549 526 550 527 static void rts5261_enable_aspm(struct rtsx_pcr *pcr, bool enable) 551 528 { 529 + u8 val = FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1; 530 + u8 mask = FORCE_ASPM_VAL_MASK | FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1; 531 + 552 532 if (pcr->aspm_enabled == enable) 553 533 return; 554 534 535 + val |= (pcr->aspm_en & 0x02); 536 + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, mask, val); 555 537 pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL, 556 538 PCI_EXP_LNKCTL_ASPMC, pcr->aspm_en); 557 539 pcr->aspm_enabled = enable; 558 - 559 540 } 560 541 561 542 static void rts5261_disable_aspm(struct rtsx_pcr *pcr, bool enable) 562 543 { 544 + u8 val = FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1; 545 + u8 mask = FORCE_ASPM_VAL_MASK | FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1; 546 + 563 547 if (pcr->aspm_enabled == enable) 564 548 return; 565 549 566 550 pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL, 567 551 PCI_EXP_LNKCTL_ASPMC, 0); 552 + rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, mask, val); 568 553 rtsx_pci_write_register(pcr, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0); 569 554 udelay(10); 570 555 pcr->aspm_enabled = enable; ··· 649 618 650 619 if (initial_mode) { 651 620 /* We use 250k(around) here, in initial stage */ 652 - if (is_version(pcr, PID_5261, IC_VER_D)) { 621 + if (is_version_higher_than(pcr, PID_5261, IC_VER_C)) { 653 622 clk_divider = SD_CLK_DIVIDE_256; 654 623 card_clock = 60000000; 655 624 } else { ··· 700 669 div++; 701 670 } 702 671 703 - n = (n / 2); 672 + n = (n / 2) - 1; 704 673 pcr_dbg(pcr, "n = %d, div = %d\n", n, div); 705 674 706 675 ssc_depth = depth[ssc_depth]; ··· 769 738 { 770 739 struct rtsx_cr_option *option = &pcr->option; 771 740 struct rtsx_hw_param *hw_param = &pcr->hw_param; 741 + u8 val; 772 742 773 743 pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104; 744 + rtsx_pci_read_register(pcr, RTS5261_FW_STATUS, &val); 745 + if (!(val & RTS5261_EXPRESS_LINK_FAIL_MASK)) 746 + pcr->extra_caps |= EXTRA_CAPS_SD_EXPRESS; 774 747 pcr->num_slots = 1; 775 748 pcr->ops = &rts5261_pcr_ops; 776 749 777 750 pcr->flags = 0; 778 751 pcr->card_drive_sel = RTSX_CARD_DRIVE_DEFAULT; 779 - pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B; 780 - pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B; 752 + pcr->sd30_drive_sel_1v8 = 0x00; 753 + pcr->sd30_drive_sel_3v3 = 0x00; 781 754 pcr->aspm_en = ASPM_L1_EN; 782 755 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 11); 783 756 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
+6 -33
drivers/misc/cardreader/rts5261.h
··· 12 12 13 13 /*New add*/ 14 14 #define rts5261_vendor_setting_valid(reg) ((reg) & 0x010000) 15 - #define rts5261_reg_to_aspm(reg) (((reg) >> 28) ^ 0x03) 15 + #define rts5261_reg_to_aspm(reg) \ 16 + (((~(reg) >> 28) & 0x02) | (((reg) >> 28) & 0x01)) 16 17 #define rts5261_reg_check_reverse_socket(reg) ((reg) & 0x04) 17 - #define rts5261_reg_to_card_drive_sel(reg) ((((reg) >> 6) & 0x01) << 6) 18 - #define rts5261_reg_to_sd30_drive_sel_1v8(reg) (((reg) >> 22) ^ 0x03) 19 - #define rts5261_reg_to_sd30_drive_sel_3v3(reg) (((reg) >> 16) ^ 0x03) 20 - 18 + #define rts5261_reg_to_sd30_drive_sel_1v8(reg) (((reg) >> 22) & 0x03) 19 + #define rts5261_reg_to_sd30_drive_sel_3v3(reg) (((reg) >> 16) & 0x03) 20 + #define rts5261_reg_to_rtd3(reg) ((reg) & 0x08) 21 + #define rts5261_reg_check_mmc_support(reg) ((reg) & 0x10) 21 22 22 23 #define RTS5261_AUTOLOAD_CFG0 0xFF7B 23 24 #define RTS5261_AUTOLOAD_CFG1 0xFF7C ··· 61 60 /* DMACTL 0xFE2C */ 62 61 #define RTS5261_DMA_PACK_SIZE_MASK 0xF0 63 62 64 - /* FW config info register */ 65 - #define RTS5261_FW_CFG_INFO0 0xFF50 66 - #define RTS5261_FW_EXPRESS_TEST_MASK (0x01<<0) 67 - #define RTS5261_FW_EA_MODE_MASK (0x01<<5) 68 - 69 - /* FW config register */ 70 - #define RTS5261_FW_CFG0 0xFF54 71 - #define RTS5261_FW_ENTER_EXPRESS (0x01<<0) 72 - 73 - #define RTS5261_FW_CFG1 0xFF55 74 - #define RTS5261_SYS_CLK_SEL_MCU_CLK (0x01<<7) 75 - #define RTS5261_CRC_CLK_SEL_MCU_CLK (0x01<<6) 76 - #define RTS5261_FAKE_MCU_CLOCK_GATING (0x01<<5) 77 - /*MCU_bus_mode_sel: 0=real 8051 1=fake mcu*/ 78 - #define RTS5261_MCU_BUS_SEL_MASK (0x01<<4) 79 - /*MCU_clock_sel:VerA 00=aux16M 01=aux400K 1x=REFCLK100M*/ 80 - /*MCU_clock_sel:VerB 00=aux400K 01=aux16M 10=REFCLK100M*/ 81 - #define RTS5261_MCU_CLOCK_SEL_MASK (0x03<<2) 82 - #define RTS5261_MCU_CLOCK_SEL_16M (0x01<<2) 83 - #define RTS5261_MCU_CLOCK_GATING (0x01<<1) 84 - #define RTS5261_DRIVER_ENABLE_FW (0x01<<0) 85 - 86 63 /* FW status register */ 87 64 #define RTS5261_FW_STATUS 0xFF56 88 65 #define RTS5261_EXPRESS_LINK_FAIL_MASK (0x01<<7) ··· 99 120 #define RTS5261_DV3318_18 (0x02<<4) 100 121 #define RTS5261_DV3318_19 (0x04<<4) 101 122 #define RTS5261_DV3318_33 (0x07<<4) 102 - 103 - #define RTS5261_LDO1_CFG0 0xFF72 104 - #define RTS5261_LDO1_OCP_THD_MASK (0x07<<5) 105 - #define RTS5261_LDO1_OCP_EN (0x01<<4) 106 - #define RTS5261_LDO1_OCP_LMT_THD_MASK (0x03<<2) 107 - #define RTS5261_LDO1_OCP_LMT_EN (0x01<<1) 108 123 109 124 /* CRD6603-433 190319 request changed */ 110 125 #define RTS5261_LDO1_OCP_THD_740 (0x00<<5)
+5
drivers/misc/cardreader/rtsx_pcr.c
··· 1004 1004 } else { 1005 1005 pcr->card_removed |= SD_EXIST; 1006 1006 pcr->card_inserted &= ~SD_EXIST; 1007 + if (PCI_PID(pcr) == PID_5261) { 1008 + rtsx_pci_write_register(pcr, RTS5261_FW_STATUS, 1009 + RTS5261_EXPRESS_LINK_FAIL_MASK, 0); 1010 + pcr->extra_caps |= EXTRA_CAPS_SD_EXPRESS; 1011 + } 1007 1012 } 1008 1013 pcr->dma_error_count = 0; 1009 1014 }
+13 -2
drivers/mmc/core/core.c
··· 2147 2147 2148 2148 mmc_go_idle(host); 2149 2149 2150 - if (!(host->caps2 & MMC_CAP2_NO_SD)) 2151 - mmc_send_if_cond(host, host->ocr_avail); 2150 + if (!(host->caps2 & MMC_CAP2_NO_SD)) { 2151 + if (mmc_send_if_cond_pcie(host, host->ocr_avail)) 2152 + goto out; 2153 + if (mmc_card_sd_express(host)) 2154 + return 0; 2155 + } 2152 2156 2153 2157 /* Order's important: probe SDIO, then SD, then MMC */ 2154 2158 if (!(host->caps2 & MMC_CAP2_NO_SDIO)) ··· 2167 2163 if (!mmc_attach_mmc(host)) 2168 2164 return 0; 2169 2165 2166 + out: 2170 2167 mmc_power_off(host); 2171 2168 return -EIO; 2172 2169 } ··· 2291 2286 if (mmc_card_is_removable(host) && host->ops->get_cd && 2292 2287 host->ops->get_cd(host) == 0) { 2293 2288 mmc_power_off(host); 2289 + mmc_release_host(host); 2290 + goto out; 2291 + } 2292 + 2293 + /* If an SD express card is present, then leave it as is. */ 2294 + if (mmc_card_sd_express(host)) { 2294 2295 mmc_release_host(host); 2295 2296 goto out; 2296 2297 }
+6
drivers/mmc/core/host.h
··· 77 77 return card->host->ios.enhanced_strobe; 78 78 } 79 79 80 + static inline bool mmc_card_sd_express(struct mmc_host *host) 81 + { 82 + return host->ios.timing == MMC_TIMING_SD_EXP || 83 + host->ios.timing == MMC_TIMING_SD_EXP_1_2V; 84 + } 85 + 80 86 #endif 81 87
+47 -2
drivers/mmc/core/sd_ops.c
··· 158 158 return err; 159 159 } 160 160 161 - int mmc_send_if_cond(struct mmc_host *host, u32 ocr) 161 + static int __mmc_send_if_cond(struct mmc_host *host, u32 ocr, u8 pcie_bits, 162 + u32 *resp) 162 163 { 163 164 struct mmc_command cmd = {}; 164 165 int err; ··· 172 171 * SD 1.0 cards. 173 172 */ 174 173 cmd.opcode = SD_SEND_IF_COND; 175 - cmd.arg = ((ocr & 0xFF8000) != 0) << 8 | test_pattern; 174 + cmd.arg = ((ocr & 0xFF8000) != 0) << 8 | pcie_bits << 8 | test_pattern; 176 175 cmd.flags = MMC_RSP_SPI_R7 | MMC_RSP_R7 | MMC_CMD_BCR; 177 176 178 177 err = mmc_wait_for_cmd(host, &cmd, 0); ··· 186 185 187 186 if (result_pattern != test_pattern) 188 187 return -EIO; 188 + 189 + if (resp) 190 + *resp = cmd.resp[0]; 191 + 192 + return 0; 193 + } 194 + 195 + int mmc_send_if_cond(struct mmc_host *host, u32 ocr) 196 + { 197 + return __mmc_send_if_cond(host, ocr, 0, NULL); 198 + } 199 + 200 + int mmc_send_if_cond_pcie(struct mmc_host *host, u32 ocr) 201 + { 202 + u32 resp = 0; 203 + u8 pcie_bits = 0; 204 + int ret; 205 + 206 + if (host->caps2 & MMC_CAP2_SD_EXP) { 207 + /* Probe card for SD express support via PCIe. */ 208 + pcie_bits = 0x10; 209 + if (host->caps2 & MMC_CAP2_SD_EXP_1_2V) 210 + /* Probe also for 1.2V support. */ 211 + pcie_bits = 0x30; 212 + } 213 + 214 + ret = __mmc_send_if_cond(host, ocr, pcie_bits, &resp); 215 + if (ret) 216 + return 0; 217 + 218 + /* Continue with the SD express init, if the card supports it. */ 219 + resp &= 0x3000; 220 + if (pcie_bits && resp) { 221 + if (resp == 0x3000) 222 + host->ios.timing = MMC_TIMING_SD_EXP_1_2V; 223 + else 224 + host->ios.timing = MMC_TIMING_SD_EXP; 225 + 226 + /* 227 + * According to the spec the clock shall also be gated, but 228 + * let's leave this to the host driver for more flexibility. 229 + */ 230 + return host->ops->init_sd_express(host, &host->ios); 231 + } 189 232 190 233 return 0; 191 234 }
+1
drivers/mmc/core/sd_ops.h
··· 16 16 int mmc_app_set_bus_width(struct mmc_card *card, int width); 17 17 int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr); 18 18 int mmc_send_if_cond(struct mmc_host *host, u32 ocr); 19 + int mmc_send_if_cond_pcie(struct mmc_host *host, u32 ocr); 19 20 int mmc_send_relative_addr(struct mmc_host *host, unsigned int *rca); 20 21 int mmc_app_send_scr(struct mmc_card *card); 21 22 int mmc_sd_switch(struct mmc_card *card, int mode, int group,
+4 -3
drivers/mmc/host/Kconfig
··· 631 631 632 632 config MMC_S3C 633 633 tristate "Samsung S3C SD/MMC Card Interface support" 634 - depends on ARCH_S3C24XX 635 - depends on S3C24XX_DMAC 634 + depends on ARCH_S3C24XX || COMPILE_TEST 635 + depends on S3C24XX_DMAC || COMPILE_TEST 636 636 help 637 637 This selects a driver for the MCI interface found in 638 638 Samsung's S3C2410, S3C2412, S3C2440, S3C2442 CPUs. ··· 664 664 config MMC_S3C_DMA 665 665 bool "Use DMA transfers only" 666 666 help 667 - Use DMA to transfer data between memory and the hardare. 667 + Use DMA to transfer data between memory and the hardware. 668 668 669 669 Currently, the DMA support in this driver seems to not be 670 670 working properly and needs to be debugged before this ··· 1023 1023 config MMC_MTK 1024 1024 tristate "MediaTek SD/MMC Card Interface support" 1025 1025 depends on HAS_DMA 1026 + depends on COMMON_CLK 1026 1027 select REGULATOR 1027 1028 select MMC_CQHCI 1028 1029 help
+1 -1
drivers/mmc/host/davinci_mmc.c
··· 290 290 default: 291 291 s = ", (R? response)"; 292 292 break; 293 - }; s; })); 293 + } s; })); 294 294 host->cmd = cmd; 295 295 296 296 switch (mmc_resp_type(cmd)) {
+8 -9
drivers/mmc/host/dw_mmc.c
··· 2617 2617 struct dw_mci *host = dev_id; 2618 2618 u32 pending; 2619 2619 struct dw_mci_slot *slot = host->slot; 2620 - unsigned long irqflags; 2621 2620 2622 2621 pending = mci_readl(host, MINTSTS); /* read-only mask reg */ 2623 2622 ··· 2631 2632 * Hold the lock; we know cmd11_timer can't be kicked 2632 2633 * off after the lock is released, so safe to delete. 2633 2634 */ 2634 - spin_lock_irqsave(&host->irq_lock, irqflags); 2635 + spin_lock(&host->irq_lock); 2635 2636 dw_mci_cmd_interrupt(host, pending); 2636 - spin_unlock_irqrestore(&host->irq_lock, irqflags); 2637 + spin_unlock(&host->irq_lock); 2637 2638 2638 2639 del_timer(&host->cmd11_timer); 2639 2640 } 2640 2641 2641 2642 if (pending & DW_MCI_CMD_ERROR_FLAGS) { 2642 - spin_lock_irqsave(&host->irq_lock, irqflags); 2643 + spin_lock(&host->irq_lock); 2643 2644 2644 2645 del_timer(&host->cto_timer); 2645 2646 mci_writel(host, RINTSTS, DW_MCI_CMD_ERROR_FLAGS); ··· 2647 2648 smp_wmb(); /* drain writebuffer */ 2648 2649 set_bit(EVENT_CMD_COMPLETE, &host->pending_events); 2649 2650 2650 - spin_unlock_irqrestore(&host->irq_lock, irqflags); 2651 + spin_unlock(&host->irq_lock); 2651 2652 } 2652 2653 2653 2654 if (pending & DW_MCI_DATA_ERROR_FLAGS) { ··· 2660 2661 } 2661 2662 2662 2663 if (pending & SDMMC_INT_DATA_OVER) { 2663 - spin_lock_irqsave(&host->irq_lock, irqflags); 2664 + spin_lock(&host->irq_lock); 2664 2665 2665 2666 del_timer(&host->dto_timer); 2666 2667 ··· 2675 2676 set_bit(EVENT_DATA_COMPLETE, &host->pending_events); 2676 2677 tasklet_schedule(&host->tasklet); 2677 2678 2678 - spin_unlock_irqrestore(&host->irq_lock, irqflags); 2679 + spin_unlock(&host->irq_lock); 2679 2680 } 2680 2681 2681 2682 if (pending & SDMMC_INT_RXDR) { ··· 2691 2692 } 2692 2693 2693 2694 if (pending & SDMMC_INT_CMD_DONE) { 2694 - spin_lock_irqsave(&host->irq_lock, irqflags); 2695 + spin_lock(&host->irq_lock); 2695 2696 2696 2697 mci_writel(host, RINTSTS, SDMMC_INT_CMD_DONE); 2697 2698 dw_mci_cmd_interrupt(host, pending); 2698 2699 2699 - spin_unlock_irqrestore(&host->irq_lock, irqflags); 2700 + spin_unlock(&host->irq_lock); 2700 2701 } 2701 2702 2702 2703 if (pending & SDMMC_INT_CD) {
+1 -1
drivers/mmc/host/meson-gx-mmc.c
··· 1265 1265 .driver = { 1266 1266 .name = DRIVER_NAME, 1267 1267 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 1268 - .of_match_table = of_match_ptr(meson_mmc_of_match), 1268 + .of_match_table = meson_mmc_of_match, 1269 1269 }, 1270 1270 }; 1271 1271
+2 -3
drivers/mmc/host/meson-mx-sdio.c
··· 418 418 { 419 419 struct meson_mx_mmc_host *host = (void *) data; 420 420 u32 irqs, send; 421 - unsigned long irqflags; 422 421 irqreturn_t ret; 423 422 424 - spin_lock_irqsave(&host->irq_lock, irqflags); 423 + spin_lock(&host->irq_lock); 425 424 426 425 irqs = readl(host->base + MESON_MX_SDIO_IRQS); 427 426 send = readl(host->base + MESON_MX_SDIO_SEND); ··· 433 434 /* finally ACK all pending interrupts */ 434 435 writel(irqs, host->base + MESON_MX_SDIO_IRQS); 435 436 436 - spin_unlock_irqrestore(&host->irq_lock, irqflags); 437 + spin_unlock(&host->irq_lock); 437 438 438 439 return ret; 439 440 }
+2 -3
drivers/mmc/host/moxart-mmc.c
··· 465 465 { 466 466 struct moxart_host *host = (struct moxart_host *)devid; 467 467 u32 status; 468 - unsigned long flags; 469 468 470 - spin_lock_irqsave(&host->lock, flags); 469 + spin_lock(&host->lock); 471 470 472 471 status = readl(host->base + REG_STATUS); 473 472 if (status & CARD_CHANGE) { ··· 483 484 if (status & (FIFO_ORUN | FIFO_URUN) && host->mrq) 484 485 moxart_transfer_pio(host); 485 486 486 - spin_unlock_irqrestore(&host->lock, flags); 487 + spin_unlock(&host->lock); 487 488 488 489 return IRQ_HANDLED; 489 490 }
+102 -23
drivers/mmc/host/mtk-sd.c
··· 35 35 #include "cqhci.h" 36 36 37 37 #define MAX_BD_NUM 1024 38 + #define MSDC_NR_CLOCKS 3 38 39 39 40 /*--------------------------------------------------------------------------*/ 40 41 /* Common Definition */ ··· 78 77 #define MSDC_PAD_TUNE0 0xf0 79 78 #define PAD_DS_TUNE 0x188 80 79 #define PAD_CMD_TUNE 0x18c 80 + #define EMMC51_CFG0 0x204 81 81 #define EMMC50_CFG0 0x208 82 + #define EMMC50_CFG1 0x20c 82 83 #define EMMC50_CFG3 0x220 83 84 #define SDC_FIFO_CFG 0x228 85 + #define CQHCI_SETTING 0x7fc 84 86 85 87 /*--------------------------------------------------------------------------*/ 86 88 /* Top Pad Register Offset */ ··· 264 260 265 261 #define PAD_CMD_TUNE_RX_DLY3 (0x1f << 1) /* RW */ 266 262 263 + /* EMMC51_CFG0 mask */ 264 + #define CMDQ_RDAT_CNT (0x3ff << 12) /* RW */ 265 + 267 266 #define EMMC50_CFG_PADCMD_LATCHCK (0x1 << 0) /* RW */ 268 267 #define EMMC50_CFG_CRCSTS_EDGE (0x1 << 3) /* RW */ 269 268 #define EMMC50_CFG_CFCSTS_SEL (0x1 << 4) /* RW */ 269 + #define EMMC50_CFG_CMD_RESP_SEL (0x1 << 9) /* RW */ 270 + 271 + /* EMMC50_CFG1 mask */ 272 + #define EMMC50_CFG1_DS_CFG (0x1 << 28) /* RW */ 270 273 271 274 #define EMMC50_CFG3_OUTS_WR (0x1f << 0) /* RW */ 272 275 273 276 #define SDC_FIFO_CFG_WRVALIDSEL (0x1 << 24) /* RW */ 274 277 #define SDC_FIFO_CFG_RDVALIDSEL (0x1 << 25) /* RW */ 278 + 279 + /* CQHCI_SETTING */ 280 + #define CQHCI_RD_CMD_WND_SEL (0x1 << 14) /* RW */ 281 + #define CQHCI_WR_CMD_WND_SEL (0x1 << 15) /* RW */ 275 282 276 283 /* EMMC_TOP_CONTROL mask */ 277 284 #define PAD_RXDLY_SEL (0x1 << 0) /* RW */ ··· 440 425 struct clk *h_clk; /* msdc h_clk */ 441 426 struct clk *bus_clk; /* bus clock which used to access register */ 442 427 struct clk *src_clk_cg; /* msdc source clock control gate */ 428 + struct clk *sys_clk_cg; /* msdc subsys clock control gate */ 429 + struct clk_bulk_data bulk_clks[MSDC_NR_CLOCKS]; 443 430 u32 mclk; /* mmc subsystem clock frequency */ 444 431 u32 src_clk_freq; /* source clock frequency */ 445 432 unsigned char timing; ··· 802 785 803 786 static void msdc_gate_clock(struct msdc_host *host) 804 787 { 788 + clk_bulk_disable_unprepare(MSDC_NR_CLOCKS, host->bulk_clks); 805 789 clk_disable_unprepare(host->src_clk_cg); 806 790 clk_disable_unprepare(host->src_clk); 807 791 clk_disable_unprepare(host->bus_clk); ··· 811 793 812 794 static void msdc_ungate_clock(struct msdc_host *host) 813 795 { 796 + int ret; 797 + 814 798 clk_prepare_enable(host->h_clk); 815 799 clk_prepare_enable(host->bus_clk); 816 800 clk_prepare_enable(host->src_clk); 817 801 clk_prepare_enable(host->src_clk_cg); 802 + ret = clk_bulk_prepare_enable(MSDC_NR_CLOCKS, host->bulk_clks); 803 + if (ret) { 804 + dev_err(host->dev, "Cannot enable pclk/axi/ahb clock gates\n"); 805 + return; 806 + } 807 + 818 808 while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB)) 819 809 cpu_relax(); 820 810 } ··· 1563 1537 struct mmc_host *mmc = mmc_from_priv(host); 1564 1538 1565 1539 while (true) { 1566 - unsigned long flags; 1567 1540 struct mmc_request *mrq; 1568 1541 struct mmc_command *cmd; 1569 1542 struct mmc_data *data; 1570 1543 u32 events, event_mask; 1571 1544 1572 - spin_lock_irqsave(&host->lock, flags); 1545 + spin_lock(&host->lock); 1573 1546 events = readl(host->base + MSDC_INT); 1574 1547 event_mask = readl(host->base + MSDC_INTEN); 1575 1548 if ((events & event_mask) & MSDC_INT_SDIOIRQ) ··· 1579 1554 mrq = host->mrq; 1580 1555 cmd = host->cmd; 1581 1556 data = host->data; 1582 - spin_unlock_irqrestore(&host->lock, flags); 1557 + spin_unlock(&host->lock); 1583 1558 1584 1559 if ((events & event_mask) & MSDC_INT_SDIOIRQ) 1585 1560 sdio_signal_irq(mmc); ··· 2291 2266 return !val; 2292 2267 } 2293 2268 2269 + static void msdc_hs400_enhanced_strobe(struct mmc_host *mmc, 2270 + struct mmc_ios *ios) 2271 + { 2272 + struct msdc_host *host = mmc_priv(mmc); 2273 + 2274 + if (ios->enhanced_strobe) { 2275 + msdc_prepare_hs400_tuning(mmc, ios); 2276 + sdr_set_field(host->base + EMMC50_CFG0, EMMC50_CFG_PADCMD_LATCHCK, 1); 2277 + sdr_set_field(host->base + EMMC50_CFG0, EMMC50_CFG_CMD_RESP_SEL, 1); 2278 + sdr_set_field(host->base + EMMC50_CFG1, EMMC50_CFG1_DS_CFG, 1); 2279 + 2280 + sdr_clr_bits(host->base + CQHCI_SETTING, CQHCI_RD_CMD_WND_SEL); 2281 + sdr_clr_bits(host->base + CQHCI_SETTING, CQHCI_WR_CMD_WND_SEL); 2282 + sdr_clr_bits(host->base + EMMC51_CFG0, CMDQ_RDAT_CNT); 2283 + } else { 2284 + sdr_set_field(host->base + EMMC50_CFG0, EMMC50_CFG_PADCMD_LATCHCK, 0); 2285 + sdr_set_field(host->base + EMMC50_CFG0, EMMC50_CFG_CMD_RESP_SEL, 0); 2286 + sdr_set_field(host->base + EMMC50_CFG1, EMMC50_CFG1_DS_CFG, 0); 2287 + 2288 + sdr_set_bits(host->base + CQHCI_SETTING, CQHCI_RD_CMD_WND_SEL); 2289 + sdr_set_bits(host->base + CQHCI_SETTING, CQHCI_WR_CMD_WND_SEL); 2290 + sdr_set_field(host->base + EMMC51_CFG0, CMDQ_RDAT_CNT, 0xb4); 2291 + } 2292 + } 2293 + 2294 2294 static void msdc_cqe_enable(struct mmc_host *mmc) 2295 2295 { 2296 2296 struct msdc_host *host = mmc_priv(mmc); ··· 2373 2323 .set_ios = msdc_ops_set_ios, 2374 2324 .get_ro = mmc_gpio_get_ro, 2375 2325 .get_cd = msdc_get_cd, 2326 + .hs400_enhanced_strobe = msdc_hs400_enhanced_strobe, 2376 2327 .enable_sdio_irq = msdc_enable_sdio_irq, 2377 2328 .ack_sdio_irq = msdc_ack_sdio_irq, 2378 2329 .start_signal_voltage_switch = msdc_ops_switch_volt, ··· 2418 2367 host->cqhci = false; 2419 2368 } 2420 2369 2370 + static int msdc_of_clock_parse(struct platform_device *pdev, 2371 + struct msdc_host *host) 2372 + { 2373 + int ret; 2374 + 2375 + host->src_clk = devm_clk_get(&pdev->dev, "source"); 2376 + if (IS_ERR(host->src_clk)) 2377 + return PTR_ERR(host->src_clk); 2378 + 2379 + host->h_clk = devm_clk_get(&pdev->dev, "hclk"); 2380 + if (IS_ERR(host->h_clk)) 2381 + return PTR_ERR(host->h_clk); 2382 + 2383 + host->bus_clk = devm_clk_get_optional(&pdev->dev, "bus_clk"); 2384 + if (IS_ERR(host->bus_clk)) 2385 + host->bus_clk = NULL; 2386 + 2387 + /*source clock control gate is optional clock*/ 2388 + host->src_clk_cg = devm_clk_get_optional(&pdev->dev, "source_cg"); 2389 + if (IS_ERR(host->src_clk_cg)) 2390 + host->src_clk_cg = NULL; 2391 + 2392 + host->sys_clk_cg = devm_clk_get_optional(&pdev->dev, "sys_cg"); 2393 + if (IS_ERR(host->sys_clk_cg)) 2394 + host->sys_clk_cg = NULL; 2395 + 2396 + /* If present, always enable for this clock gate */ 2397 + clk_prepare_enable(host->sys_clk_cg); 2398 + 2399 + host->bulk_clks[0].id = "pclk_cg"; 2400 + host->bulk_clks[1].id = "axi_cg"; 2401 + host->bulk_clks[2].id = "ahb_cg"; 2402 + ret = devm_clk_bulk_get_optional(&pdev->dev, MSDC_NR_CLOCKS, 2403 + host->bulk_clks); 2404 + if (ret) { 2405 + dev_err(&pdev->dev, "Cannot get pclk/axi/ahb clock gates\n"); 2406 + return ret; 2407 + } 2408 + 2409 + return 0; 2410 + } 2411 + 2421 2412 static int msdc_drv_probe(struct platform_device *pdev) 2422 2413 { 2423 2414 struct mmc_host *mmc; ··· 2499 2406 if (ret) 2500 2407 goto host_free; 2501 2408 2502 - host->src_clk = devm_clk_get(&pdev->dev, "source"); 2503 - if (IS_ERR(host->src_clk)) { 2504 - ret = PTR_ERR(host->src_clk); 2409 + ret = msdc_of_clock_parse(pdev, host); 2410 + if (ret) 2505 2411 goto host_free; 2506 - } 2507 - 2508 - host->h_clk = devm_clk_get(&pdev->dev, "hclk"); 2509 - if (IS_ERR(host->h_clk)) { 2510 - ret = PTR_ERR(host->h_clk); 2511 - goto host_free; 2512 - } 2513 - 2514 - host->bus_clk = devm_clk_get(&pdev->dev, "bus_clk"); 2515 - if (IS_ERR(host->bus_clk)) 2516 - host->bus_clk = NULL; 2517 - /*source clock control gate is optional clock*/ 2518 - host->src_clk_cg = devm_clk_get(&pdev->dev, "source_cg"); 2519 - if (IS_ERR(host->src_clk_cg)) 2520 - host->src_clk_cg = NULL; 2521 2412 2522 2413 host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev, 2523 2414 "hrst"); 2524 - if (IS_ERR(host->reset)) 2525 - return PTR_ERR(host->reset); 2415 + if (IS_ERR(host->reset)) { 2416 + ret = PTR_ERR(host->reset); 2417 + goto host_free; 2418 + } 2526 2419 2527 2420 host->irq = platform_get_irq(pdev, 0); 2528 2421 if (host->irq < 0) {
+4 -29
drivers/mmc/host/mxcmmc.c
··· 157 157 enum mxcmci_type devtype; 158 158 }; 159 159 160 - static const struct platform_device_id mxcmci_devtype[] = { 161 - { 162 - .name = "imx21-mmc", 163 - .driver_data = IMX21_MMC, 164 - }, { 165 - .name = "imx31-mmc", 166 - .driver_data = IMX31_MMC, 167 - }, { 168 - .name = "mpc512x-sdhc", 169 - .driver_data = MPC512X_MMC, 170 - }, { 171 - /* sentinel */ 172 - } 173 - }; 174 - MODULE_DEVICE_TABLE(platform, mxcmci_devtype); 175 - 176 160 static const struct of_device_id mxcmci_of_match[] = { 177 161 { 178 162 .compatible = "fsl,imx21-mmc", 179 - .data = &mxcmci_devtype[IMX21_MMC], 163 + .data = (void *) IMX21_MMC, 180 164 }, { 181 165 .compatible = "fsl,imx31-mmc", 182 - .data = &mxcmci_devtype[IMX31_MMC], 166 + .data = (void *) IMX31_MMC, 183 167 }, { 184 168 .compatible = "fsl,mpc5121-sdhc", 185 - .data = &mxcmci_devtype[MPC512X_MMC], 169 + .data = (void *) MPC512X_MMC, 186 170 }, { 187 171 /* sentinel */ 188 172 } ··· 985 1001 int ret = 0, irq; 986 1002 bool dat3_card_detect = false; 987 1003 dma_cap_mask_t mask; 988 - const struct of_device_id *of_id; 989 1004 struct imxmmc_platform_data *pdata = pdev->dev.platform_data; 990 1005 991 1006 pr_info("i.MX/MPC512x SDHC driver\n"); 992 - 993 - of_id = of_match_device(mxcmci_of_match, &pdev->dev); 994 1007 995 1008 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 996 1009 irq = platform_get_irq(pdev, 0); ··· 1025 1044 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; 1026 1045 mmc->max_seg_size = mmc->max_req_size; 1027 1046 1028 - if (of_id) { 1029 - const struct platform_device_id *id_entry = of_id->data; 1030 - host->devtype = id_entry->driver_data; 1031 - } else { 1032 - host->devtype = pdev->id_entry->driver_data; 1033 - } 1047 + host->devtype = (enum mxcmci_type)of_device_get_match_data(&pdev->dev); 1034 1048 1035 1049 /* adjust max_segs after devtype detection */ 1036 1050 if (!is_mpc512x_mmc(host)) ··· 1217 1241 static struct platform_driver mxcmci_driver = { 1218 1242 .probe = mxcmci_probe, 1219 1243 .remove = mxcmci_remove, 1220 - .id_table = mxcmci_devtype, 1221 1244 .driver = { 1222 1245 .name = DRIVER_NAME, 1223 1246 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+1 -17
drivers/mmc/host/mxs-mmc.c
··· 545 545 .enable_sdio_irq = mxs_mmc_enable_sdio_irq, 546 546 }; 547 547 548 - static const struct platform_device_id mxs_ssp_ids[] = { 549 - { 550 - .name = "imx23-mmc", 551 - .driver_data = IMX23_SSP, 552 - }, { 553 - .name = "imx28-mmc", 554 - .driver_data = IMX28_SSP, 555 - }, { 556 - /* sentinel */ 557 - } 558 - }; 559 - MODULE_DEVICE_TABLE(platform, mxs_ssp_ids); 560 - 561 548 static const struct of_device_id mxs_mmc_dt_ids[] = { 562 549 { .compatible = "fsl,imx23-mmc", .data = (void *) IMX23_SSP, }, 563 550 { .compatible = "fsl,imx28-mmc", .data = (void *) IMX28_SSP, }, ··· 554 567 555 568 static int mxs_mmc_probe(struct platform_device *pdev) 556 569 { 557 - const struct of_device_id *of_id = 558 - of_match_device(mxs_mmc_dt_ids, &pdev->dev); 559 570 struct device_node *np = pdev->dev.of_node; 560 571 struct mxs_mmc_host *host; 561 572 struct mmc_host *mmc; ··· 578 593 goto out_mmc_free; 579 594 } 580 595 581 - ssp->devid = (enum mxs_ssp_id) of_id->data; 596 + ssp->devid = (enum mxs_ssp_id)of_device_get_match_data(&pdev->dev); 582 597 583 598 host->mmc = mmc; 584 599 host->sdio_irq_en = 0; ··· 708 723 static struct platform_driver mxs_mmc_driver = { 709 724 .probe = mxs_mmc_probe, 710 725 .remove = mxs_mmc_remove, 711 - .id_table = mxs_ssp_ids, 712 726 .driver = { 713 727 .name = DRIVER_NAME, 714 728 .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+4 -5
drivers/mmc/host/owl-mmc.c
··· 134 134 static irqreturn_t owl_irq_handler(int irq, void *devid) 135 135 { 136 136 struct owl_mmc_host *owl_host = devid; 137 - unsigned long flags; 138 137 u32 state; 139 138 140 - spin_lock_irqsave(&owl_host->lock, flags); 139 + spin_lock(&owl_host->lock); 141 140 142 141 state = readl(owl_host->base + OWL_REG_SD_STATE); 143 142 if (state & OWL_SD_STATE_TEI) { ··· 146 147 complete(&owl_host->sdc_complete); 147 148 } 148 149 149 - spin_unlock_irqrestore(&owl_host->lock, flags); 150 + spin_unlock(&owl_host->lock); 150 151 151 152 return IRQ_HANDLED; 152 153 } ··· 521 522 522 523 /* Enable DDR mode if requested */ 523 524 if (ios->timing == MMC_TIMING_UHS_DDR50) { 524 - owl_host->ddr_50 = 1; 525 + owl_host->ddr_50 = true; 525 526 owl_mmc_update_reg(owl_host->base + OWL_REG_SD_EN, 526 527 OWL_SD_EN_DDREN, true); 527 528 } else { 528 - owl_host->ddr_50 = 0; 529 + owl_host->ddr_50 = false; 529 530 } 530 531 } 531 532
+1
drivers/mmc/host/pxamci.c
··· 731 731 732 732 host->power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW); 733 733 if (IS_ERR(host->power)) { 734 + ret = PTR_ERR(host->power); 734 735 dev_err(dev, "Failed requesting gpio_power\n"); 735 736 goto out; 736 737 }
+71 -48
drivers/mmc/host/renesas_sdhi_core.c
··· 18 18 * 19 19 */ 20 20 21 - #include <linux/kernel.h> 22 21 #include <linux/clk.h> 23 - #include <linux/slab.h> 24 - #include <linux/module.h> 25 - #include <linux/of_device.h> 26 - #include <linux/platform_device.h> 27 - #include <linux/pm_domain.h> 22 + #include <linux/delay.h> 23 + #include <linux/kernel.h> 24 + #include <linux/mfd/tmio.h> 28 25 #include <linux/mmc/host.h> 29 26 #include <linux/mmc/mmc.h> 30 27 #include <linux/mmc/slot-gpio.h> 31 - #include <linux/mfd/tmio.h> 32 - #include <linux/sh_dma.h> 33 - #include <linux/delay.h> 28 + #include <linux/module.h> 29 + #include <linux/of_device.h> 34 30 #include <linux/pinctrl/consumer.h> 35 31 #include <linux/pinctrl/pinctrl-state.h> 32 + #include <linux/platform_device.h> 33 + #include <linux/pm_domain.h> 36 34 #include <linux/regulator/consumer.h> 35 + #include <linux/sh_dma.h> 36 + #include <linux/slab.h> 37 37 #include <linux/sys_soc.h> 38 38 39 39 #include "renesas_sdhi.h" 40 40 #include "tmio_mmc.h" 41 41 42 - #define HOST_MODE 0xe4 42 + #define CTL_HOST_MODE 0xe4 43 + #define HOST_MODE_GEN2_SDR50_WMODE BIT(0) 44 + #define HOST_MODE_GEN2_SDR104_WMODE BIT(0) 45 + #define HOST_MODE_GEN3_WMODE BIT(0) 46 + #define HOST_MODE_GEN3_BUSWIDTH BIT(8) 47 + 48 + #define HOST_MODE_GEN3_16BIT HOST_MODE_GEN3_WMODE 49 + #define HOST_MODE_GEN3_32BIT (HOST_MODE_GEN3_WMODE | HOST_MODE_GEN3_BUSWIDTH) 50 + #define HOST_MODE_GEN3_64BIT 0 51 + 52 + #define CTL_SDIF_MODE 0xe6 53 + #define SDIF_MODE_HS400 BIT(0) 43 54 44 55 #define SDHI_VER_GEN2_SDR50 0x490c 45 56 #define SDHI_VER_RZ_A1 0x820b ··· 71 60 */ 72 61 switch (sd_ctrl_read16(host, CTL_VERSION)) { 73 62 case SDHI_VER_GEN2_SDR50: 74 - val = (width == 32) ? 0x0001 : 0x0000; 63 + val = (width == 32) ? HOST_MODE_GEN2_SDR50_WMODE : 0; 75 64 break; 76 65 case SDHI_VER_GEN2_SDR104: 77 - val = (width == 32) ? 0x0000 : 0x0001; 66 + val = (width == 32) ? 0 : HOST_MODE_GEN2_SDR104_WMODE; 78 67 break; 79 68 case SDHI_VER_GEN3_SD: 80 69 case SDHI_VER_GEN3_SDMMC: 81 70 if (width == 64) 82 - val = 0x0000; 71 + val = HOST_MODE_GEN3_64BIT; 83 72 else if (width == 32) 84 - val = 0x0101; 73 + val = HOST_MODE_GEN3_32BIT; 85 74 else 86 - val = 0x0001; 75 + val = HOST_MODE_GEN3_16BIT; 87 76 break; 88 77 default: 89 78 /* nothing to do */ 90 79 return; 91 80 } 92 81 93 - sd_ctrl_write16(host, HOST_MODE, val); 82 + sd_ctrl_write16(host, CTL_HOST_MODE, val); 94 83 } 95 84 96 85 static int renesas_sdhi_clk_enable(struct tmio_mmc_host *host) ··· 384 373 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); 385 374 386 375 /* Set HS400 mode */ 387 - sd_ctrl_write16(host, CTL_SDIF_MODE, 0x0001 | 376 + sd_ctrl_write16(host, CTL_SDIF_MODE, SDIF_MODE_HS400 | 388 377 sd_ctrl_read16(host, CTL_SDIF_MODE)); 389 378 390 379 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF, ··· 435 424 priv->needs_adjust_hs400 = true; 436 425 } 437 426 438 - static void renesas_sdhi_reset_scc(struct tmio_mmc_host *host, 439 - struct renesas_sdhi *priv) 427 + static void renesas_sdhi_disable_scc(struct mmc_host *mmc) 440 428 { 429 + struct tmio_mmc_host *host = mmc_priv(mmc); 430 + struct renesas_sdhi *priv = host_to_priv(host); 431 + 441 432 sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN & 442 433 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); 443 434 ··· 447 434 ~SH_MOBILE_SDHI_SCC_CKSEL_DTSEL & 448 435 sd_scc_read32(host, priv, 449 436 SH_MOBILE_SDHI_SCC_CKSEL)); 450 - } 451 - 452 - static void renesas_sdhi_disable_scc(struct mmc_host *mmc) 453 - { 454 - struct tmio_mmc_host *host = mmc_priv(mmc); 455 - struct renesas_sdhi *priv = host_to_priv(host); 456 - 457 - renesas_sdhi_reset_scc(host, priv); 458 437 459 438 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DTCNTL, 460 439 ~SH_MOBILE_SDHI_SCC_DTCNTL_TAPEN & ··· 532 527 sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); 533 528 534 529 /* Reset HS400 mode */ 535 - sd_ctrl_write16(host, CTL_SDIF_MODE, ~0x0001 & 530 + sd_ctrl_write16(host, CTL_SDIF_MODE, ~SDIF_MODE_HS400 & 536 531 sd_ctrl_read16(host, CTL_SDIF_MODE)); 537 532 538 533 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_DT2FF, priv->scc_tappos); ··· 557 552 return 0; 558 553 } 559 554 555 + /* only populated for TMIO_MMC_MIN_RCAR2 */ 560 556 static void renesas_sdhi_reset(struct tmio_mmc_host *host) 561 557 { 562 558 struct renesas_sdhi *priv = host_to_priv(host); 559 + u16 val; 563 560 564 - renesas_sdhi_reset_scc(host, priv); 565 - renesas_sdhi_reset_hs400_mode(host, priv); 566 - priv->needs_adjust_hs400 = false; 561 + if (priv->scc_ctl) { 562 + renesas_sdhi_disable_scc(host->mmc); 563 + renesas_sdhi_reset_hs400_mode(host, priv); 564 + priv->needs_adjust_hs400 = false; 567 565 568 - sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN | 569 - sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); 566 + sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL, 567 + ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN & 568 + sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL)); 569 + } 570 570 571 - sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL, 572 - ~SH_MOBILE_SDHI_SCC_RVSCNTL_RVSEN & 573 - sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_RVSCNTL)); 571 + sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, TMIO_MASK_INIT_RCAR2); 574 572 575 - if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) 576 - sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, 577 - TMIO_MASK_INIT_RCAR2); 573 + if (sd_ctrl_read16(host, CTL_VERSION) >= SDHI_VER_GEN3_SD) { 574 + val = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT); 575 + val |= CARD_OPT_EXTOP; 576 + sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, val); 577 + } 578 + } 579 + 580 + static unsigned int renesas_sdhi_gen3_get_cycles(struct tmio_mmc_host *host) 581 + { 582 + u16 num, val = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT); 583 + 584 + num = (val & CARD_OPT_TOP_MASK) >> CARD_OPT_TOP_SHIFT; 585 + return 1 << ((val & CARD_OPT_EXTOP ? 14 : 13) + num); 586 + 578 587 } 579 588 580 589 #define SH_MOBILE_SDHI_MIN_TAP_ROW 3 ··· 822 803 case CTL_SD_MEM_CARD_OPT: 823 804 case CTL_TRANSACTION_CTL: 824 805 case CTL_DMA_ENABLE: 825 - case HOST_MODE: 806 + case CTL_HOST_MODE: 826 807 if (host->pdata->flags & TMIO_MMC_HAVE_CBSY) 827 808 bit = TMIO_STAT_CMD_BUSY; 828 809 fallthrough; ··· 1024 1005 host->ops.start_signal_voltage_switch = 1025 1006 renesas_sdhi_start_signal_voltage_switch; 1026 1007 host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27; 1027 - 1028 - if (of_data && of_data->scc_offset) { 1029 - priv->scc_ctl = host->ctl + of_data->scc_offset; 1030 - host->reset = renesas_sdhi_reset; 1031 - } 1008 + host->reset = renesas_sdhi_reset; 1032 1009 } 1033 1010 1034 1011 /* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */ ··· 1057 1042 /* All SDHI have SDIO status bits which must be 1 */ 1058 1043 mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS; 1059 1044 1045 + /* All SDHI support HW busy detection */ 1046 + mmc_data->flags |= TMIO_MMC_USE_BUSY_TIMEOUT; 1047 + 1060 1048 dev_pm_domain_start(&pdev->dev); 1061 1049 1062 1050 ret = renesas_sdhi_clk_enable(host); ··· 1083 1065 quirks->hs400_calib_table + 1); 1084 1066 } 1085 1067 1086 - ret = tmio_mmc_host_probe(host); 1087 - if (ret < 0) 1088 - goto edisclk; 1068 + /* these have an EXTOP bit */ 1069 + if (ver >= SDHI_VER_GEN3_SD) 1070 + host->get_timeout_cycles = renesas_sdhi_gen3_get_cycles; 1089 1071 1090 1072 /* Enable tuning iff we have an SCC and a supported mode */ 1091 1073 if (of_data && of_data->scc_offset && ··· 1111 1093 if (!hit) 1112 1094 dev_warn(&host->pdev->dev, "Unknown clock rate for tuning\n"); 1113 1095 1096 + priv->scc_ctl = host->ctl + of_data->scc_offset; 1114 1097 host->check_retune = renesas_sdhi_check_scc_error; 1115 1098 host->ops.execute_tuning = renesas_sdhi_execute_tuning; 1116 1099 host->ops.prepare_hs400_tuning = renesas_sdhi_prepare_hs400_tuning; 1117 1100 host->ops.hs400_downgrade = renesas_sdhi_disable_scc; 1118 1101 host->ops.hs400_complete = renesas_sdhi_hs400_complete; 1119 1102 } 1103 + 1104 + ret = tmio_mmc_host_probe(host); 1105 + if (ret < 0) 1106 + goto edisclk; 1120 1107 1121 1108 num_irqs = platform_irq_count(pdev); 1122 1109 if (num_irqs < 0) {
+71
drivers/mmc/host/rtsx_pci_sdmmc.c
··· 48 48 bool using_cookie; 49 49 }; 50 50 51 + static int sdmmc_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios); 52 + 51 53 static inline struct device *sdmmc_dev(struct realtek_pci_sdmmc *host) 52 54 { 53 55 return &(host->pdev->dev); ··· 898 896 static int sd_power_on(struct realtek_pci_sdmmc *host) 899 897 { 900 898 struct rtsx_pcr *pcr = host->pcr; 899 + struct mmc_host *mmc = host->mmc; 901 900 int err; 901 + u32 val; 902 + u8 test_mode; 902 903 903 904 if (host->power_state == SDMMC_POWER_ON) 904 905 return 0; ··· 927 922 err = rtsx_pci_write_register(pcr, CARD_OE, SD_OUTPUT_EN, SD_OUTPUT_EN); 928 923 if (err < 0) 929 924 return err; 925 + 926 + if (PCI_PID(pcr) == PID_5261) { 927 + /* 928 + * If test mode is set switch to SD Express mandatorily, 929 + * this is only for factory testing. 930 + */ 931 + rtsx_pci_read_register(pcr, RTS5261_FW_CFG_INFO0, &test_mode); 932 + if (test_mode & RTS5261_FW_EXPRESS_TEST_MASK) { 933 + sdmmc_init_sd_express(mmc, NULL); 934 + return 0; 935 + } 936 + if (pcr->extra_caps & EXTRA_CAPS_SD_EXPRESS) 937 + mmc->caps2 |= MMC_CAP2_SD_EXP | MMC_CAP2_SD_EXP_1_2V; 938 + /* 939 + * HW read wp status when resuming from S3/S4, 940 + * and then picks SD legacy interface if it's set 941 + * in read-only mode. 942 + */ 943 + val = rtsx_pci_readl(pcr, RTSX_BIPR); 944 + if (val & SD_WRITE_PROTECT) { 945 + pcr->extra_caps &= ~EXTRA_CAPS_SD_EXPRESS; 946 + mmc->caps2 &= ~(MMC_CAP2_SD_EXP | MMC_CAP2_SD_EXP_1_2V); 947 + } 948 + } 930 949 931 950 host->power_state = SDMMC_POWER_ON; 932 951 return 0; ··· 1338 1309 return err; 1339 1310 } 1340 1311 1312 + static int sdmmc_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios) 1313 + { 1314 + u32 relink_time; 1315 + struct realtek_pci_sdmmc *host = mmc_priv(mmc); 1316 + struct rtsx_pcr *pcr = host->pcr; 1317 + 1318 + /* Set relink_time for changing to PCIe card */ 1319 + relink_time = 0x8FFF; 1320 + 1321 + rtsx_pci_write_register(pcr, 0xFF01, 0xFF, relink_time); 1322 + rtsx_pci_write_register(pcr, 0xFF02, 0xFF, relink_time >> 8); 1323 + rtsx_pci_write_register(pcr, 0xFF03, 0x01, relink_time >> 16); 1324 + 1325 + rtsx_pci_write_register(pcr, PETXCFG, 0x80, 0x80); 1326 + rtsx_pci_write_register(pcr, LDO_VCC_CFG0, 1327 + RTS5261_LDO1_OCP_THD_MASK, 1328 + pcr->option.sd_800mA_ocp_thd); 1329 + 1330 + if (pcr->ops->disable_auto_blink) 1331 + pcr->ops->disable_auto_blink(pcr); 1332 + 1333 + /* For PCIe/NVMe mode can't enter delink issue */ 1334 + pcr->hw_param.interrupt_en &= ~(SD_INT_EN); 1335 + rtsx_pci_writel(pcr, RTSX_BIER, pcr->hw_param.interrupt_en); 1336 + 1337 + rtsx_pci_write_register(pcr, RTS5260_AUTOLOAD_CFG4, 1338 + RTS5261_AUX_CLK_16M_EN, RTS5261_AUX_CLK_16M_EN); 1339 + rtsx_pci_write_register(pcr, RTS5261_FW_CFG0, 1340 + RTS5261_FW_ENTER_EXPRESS, RTS5261_FW_ENTER_EXPRESS); 1341 + rtsx_pci_write_register(pcr, RTS5261_FW_CFG1, 1342 + RTS5261_MCU_CLOCK_GATING, RTS5261_MCU_CLOCK_GATING); 1343 + rtsx_pci_write_register(pcr, RTS5261_FW_CFG1, 1344 + RTS5261_MCU_BUS_SEL_MASK | RTS5261_MCU_CLOCK_SEL_MASK 1345 + | RTS5261_DRIVER_ENABLE_FW, 1346 + RTS5261_MCU_CLOCK_SEL_16M | RTS5261_DRIVER_ENABLE_FW); 1347 + host->eject = true; 1348 + return 0; 1349 + } 1350 + 1341 1351 static const struct mmc_host_ops realtek_pci_sdmmc_ops = { 1342 1352 .pre_req = sdmmc_pre_req, 1343 1353 .post_req = sdmmc_post_req, ··· 1386 1318 .get_cd = sdmmc_get_cd, 1387 1319 .start_signal_voltage_switch = sdmmc_switch_voltage, 1388 1320 .execute_tuning = sdmmc_execute_tuning, 1321 + .init_sd_express = sdmmc_init_sd_express, 1389 1322 }; 1390 1323 1391 1324 static void init_extra_caps(struct realtek_pci_sdmmc *host) ··· 1408 1339 mmc->caps |= MMC_CAP_8_BIT_DATA; 1409 1340 if (pcr->extra_caps & EXTRA_CAPS_NO_MMC) 1410 1341 mmc->caps2 |= MMC_CAP2_NO_MMC; 1342 + if (pcr->extra_caps & EXTRA_CAPS_SD_EXPRESS) 1343 + mmc->caps2 |= MMC_CAP2_SD_EXP | MMC_CAP2_SD_EXP_1_2V; 1411 1344 } 1412 1345 1413 1346 static void realtek_init_host(struct realtek_pci_sdmmc *host)
+1 -1
drivers/mmc/host/s3cmci.c
··· 17 17 #include <linux/cpufreq.h> 18 18 #include <linux/debugfs.h> 19 19 #include <linux/seq_file.h> 20 - #include <linux/gpio.h> 20 + #include <linux/gpio/consumer.h> 21 21 #include <linux/interrupt.h> 22 22 #include <linux/irq.h> 23 23 #include <linux/io.h>
+35 -3
drivers/mmc/host/sdhci-acpi.c
··· 5 5 * Copyright (c) 2012, Intel Corporation. 6 6 */ 7 7 8 + #include <linux/bitfield.h> 8 9 #include <linux/init.h> 9 10 #include <linux/export.h> 10 11 #include <linux/module.h> ··· 546 545 547 546 static int amd_select_drive_strength(struct mmc_card *card, 548 547 unsigned int max_dtr, int host_drv, 549 - int card_drv, int *drv_type) 548 + int card_drv, int *host_driver_strength) 550 549 { 551 - *drv_type = MMC_SET_DRIVER_TYPE_A; 552 - return MMC_SET_DRIVER_TYPE_A; 550 + struct sdhci_host *host = mmc_priv(card->host); 551 + u16 preset, preset_driver_strength; 552 + 553 + /* 554 + * This method is only called by mmc_select_hs200 so we only need to 555 + * read from the HS200 (SDR104) preset register. 556 + * 557 + * Firmware that has "invalid/default" presets return a driver strength 558 + * of A. This matches the previously hard coded value. 559 + */ 560 + preset = sdhci_readw(host, SDHCI_PRESET_FOR_SDR104); 561 + preset_driver_strength = FIELD_GET(SDHCI_PRESET_DRV_MASK, preset); 562 + 563 + /* 564 + * We want the controller driver strength to match the card's driver 565 + * strength so they have similar rise/fall times. 566 + * 567 + * The controller driver strength set by this method is sticky for all 568 + * timings after this method is called. This unfortunately means that 569 + * while HS400 tuning is in progress we end up with mismatched driver 570 + * strengths between the controller and the card. HS400 tuning requires 571 + * switching from HS400->DDR52->HS->HS200->HS400. So the driver mismatch 572 + * happens while in DDR52 and HS modes. This has not been observed to 573 + * cause problems. Enabling presets would fix this issue. 574 + */ 575 + *host_driver_strength = preset_driver_strength; 576 + 577 + /* 578 + * The resulting card driver strength is only set when switching the 579 + * card's timing to HS200 or HS400. The card will use the default driver 580 + * strength (B) for any other mode. 581 + */ 582 + return preset_driver_strength; 553 583 } 554 584 555 585 static void sdhci_acpi_amd_hs400_dll(struct sdhci_host *host, bool enable)
+2 -89
drivers/mmc/host/sdhci-esdhc-imx.c
··· 296 296 struct pm_qos_request pm_qos_req; 297 297 }; 298 298 299 - static const struct platform_device_id imx_esdhc_devtype[] = { 300 - { 301 - .name = "sdhci-esdhc-imx25", 302 - .driver_data = (kernel_ulong_t) &esdhc_imx25_data, 303 - }, { 304 - .name = "sdhci-esdhc-imx35", 305 - .driver_data = (kernel_ulong_t) &esdhc_imx35_data, 306 - }, { 307 - .name = "sdhci-esdhc-imx51", 308 - .driver_data = (kernel_ulong_t) &esdhc_imx51_data, 309 - }, { 310 - /* sentinel */ 311 - } 312 - }; 313 - MODULE_DEVICE_TABLE(platform, imx_esdhc_devtype); 314 - 315 299 static const struct of_device_id imx_esdhc_dt_ids[] = { 316 300 { .compatible = "fsl,imx25-esdhc", .data = &esdhc_imx25_data, }, 317 301 { .compatible = "fsl,imx35-esdhc", .data = &esdhc_imx35_data, }, ··· 1515 1531 } 1516 1532 #endif 1517 1533 1518 - static int sdhci_esdhc_imx_probe_nondt(struct platform_device *pdev, 1519 - struct sdhci_host *host, 1520 - struct pltfm_imx_data *imx_data) 1521 - { 1522 - struct esdhc_platform_data *boarddata = &imx_data->boarddata; 1523 - int err; 1524 - 1525 - if (!host->mmc->parent->platform_data) { 1526 - dev_err(mmc_dev(host->mmc), "no board data!\n"); 1527 - return -EINVAL; 1528 - } 1529 - 1530 - imx_data->boarddata = *((struct esdhc_platform_data *) 1531 - host->mmc->parent->platform_data); 1532 - /* write_protect */ 1533 - if (boarddata->wp_type == ESDHC_WP_GPIO) { 1534 - host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; 1535 - 1536 - err = mmc_gpiod_request_ro(host->mmc, "wp", 0, 0); 1537 - if (err) { 1538 - dev_err(mmc_dev(host->mmc), 1539 - "failed to request write-protect gpio!\n"); 1540 - return err; 1541 - } 1542 - } 1543 - 1544 - /* card_detect */ 1545 - switch (boarddata->cd_type) { 1546 - case ESDHC_CD_GPIO: 1547 - err = mmc_gpiod_request_cd(host->mmc, "cd", 0, false, 0); 1548 - if (err) { 1549 - dev_err(mmc_dev(host->mmc), 1550 - "failed to request card-detect gpio!\n"); 1551 - return err; 1552 - } 1553 - fallthrough; 1554 - 1555 - case ESDHC_CD_CONTROLLER: 1556 - /* we have a working card_detect back */ 1557 - host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION; 1558 - break; 1559 - 1560 - case ESDHC_CD_PERMANENT: 1561 - host->mmc->caps |= MMC_CAP_NONREMOVABLE; 1562 - break; 1563 - 1564 - case ESDHC_CD_NONE: 1565 - break; 1566 - } 1567 - 1568 - switch (boarddata->max_bus_width) { 1569 - case 8: 1570 - host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA; 1571 - break; 1572 - case 4: 1573 - host->mmc->caps |= MMC_CAP_4_BIT_DATA; 1574 - break; 1575 - case 1: 1576 - default: 1577 - host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; 1578 - break; 1579 - } 1580 - 1581 - return 0; 1582 - } 1583 - 1584 1534 static int sdhci_esdhc_imx_probe(struct platform_device *pdev) 1585 1535 { 1586 1536 const struct of_device_id *of_id = ··· 1534 1616 1535 1617 imx_data = sdhci_pltfm_priv(pltfm_host); 1536 1618 1537 - imx_data->socdata = of_id ? of_id->data : (struct esdhc_soc_data *) 1538 - pdev->id_entry->driver_data; 1619 + imx_data->socdata = of_id->data; 1539 1620 1540 1621 if (imx_data->socdata->flags & ESDHC_FLAG_PMQOS) 1541 1622 cpu_latency_qos_add_request(&imx_data->pm_qos_req, 0); ··· 1630 1713 goto disable_ahb_clk; 1631 1714 } 1632 1715 1633 - if (of_id) 1634 - err = sdhci_esdhc_imx_probe_dt(pdev, host, imx_data); 1635 - else 1636 - err = sdhci_esdhc_imx_probe_nondt(pdev, host, imx_data); 1716 + err = sdhci_esdhc_imx_probe_dt(pdev, host, imx_data); 1637 1717 if (err) 1638 1718 goto disable_ahb_clk; 1639 1719 ··· 1843 1929 .of_match_table = imx_esdhc_dt_ids, 1844 1930 .pm = &sdhci_esdhc_pmops, 1845 1931 }, 1846 - .id_table = imx_esdhc_devtype, 1847 1932 .probe = sdhci_esdhc_imx_probe, 1848 1933 .remove = sdhci_esdhc_imx_remove, 1849 1934 };
+3 -10
drivers/mmc/host/sdhci-msm.c
··· 248 248 struct sdhci_msm_variant_info { 249 249 bool mci_removed; 250 250 bool restore_dll_config; 251 - bool uses_tassadar_dll; 252 251 const struct sdhci_msm_variant_ops *var_ops; 253 252 const struct sdhci_msm_offset *offset; 254 253 }; ··· 2153 2154 .offset = &sdhci_msm_v5_offset, 2154 2155 }; 2155 2156 2156 - static const struct sdhci_msm_variant_info sm8250_sdhci_var = { 2157 - .mci_removed = true, 2158 - .uses_tassadar_dll = true, 2159 - .var_ops = &v5_var_ops, 2160 - .offset = &sdhci_msm_v5_offset, 2161 - }; 2162 - 2163 2157 static const struct of_device_id sdhci_msm_dt_match[] = { 2164 2158 {.compatible = "qcom,sdhci-msm-v4", .data = &sdhci_msm_mci_var}, 2165 2159 {.compatible = "qcom,sdhci-msm-v5", .data = &sdhci_msm_v5_var}, 2166 2160 {.compatible = "qcom,sdm845-sdhci", .data = &sdm845_sdhci_var}, 2167 - {.compatible = "qcom,sm8250-sdhci", .data = &sm8250_sdhci_var}, 2168 2161 {.compatible = "qcom,sc7180-sdhci", .data = &sdm845_sdhci_var}, 2169 2162 {}, 2170 2163 }; ··· 2240 2249 msm_host->restore_dll_config = var_info->restore_dll_config; 2241 2250 msm_host->var_ops = var_info->var_ops; 2242 2251 msm_host->offset = var_info->offset; 2243 - msm_host->uses_tassadar_dll = var_info->uses_tassadar_dll; 2244 2252 2245 2253 msm_offset = msm_host->offset; 2246 2254 ··· 2385 2395 2386 2396 if (core_major == 1 && core_minor >= 0x49) 2387 2397 msm_host->updated_ddr_cfg = true; 2398 + 2399 + if (core_major == 1 && core_minor >= 0x71) 2400 + msm_host->uses_tassadar_dll = true; 2388 2401 2389 2402 ret = sdhci_msm_register_vreg(msm_host); 2390 2403 if (ret)
+4
drivers/mmc/host/sdhci-of-arasan.c
··· 624 624 case MMC_TIMING_MMC_HS200: 625 625 /* For 200MHz clock, 8 Taps are available */ 626 626 tap_max = 8; 627 + break; 627 628 default: 628 629 break; 629 630 } ··· 693 692 case MMC_TIMING_MMC_HS200: 694 693 /* For 200MHz clock, 30 Taps are available */ 695 694 tap_max = 30; 695 + break; 696 696 default: 697 697 break; 698 698 } ··· 753 751 case MMC_TIMING_MMC_HS200: 754 752 /* For 200MHz clock, 8 Taps are available */ 755 753 tap_max = 8; 754 + break; 756 755 default: 757 756 break; 758 757 } ··· 820 817 case MMC_TIMING_MMC_HS200: 821 818 /* For 200MHz clock, 30 Taps are available */ 822 819 tap_max = 30; 820 + break; 823 821 default: 824 822 break; 825 823 }
+27
drivers/mmc/host/sdhci-pci-gli.c
··· 87 87 #define PCIE_GLI_9763E_SCR 0x8E0 88 88 #define GLI_9763E_SCR_AXI_REQ BIT(9) 89 89 90 + #define PCIE_GLI_9763E_MMC_CTRL 0x960 91 + #define GLI_9763E_HS400_SLOW BIT(3) 92 + 90 93 #define SDHCI_GLI_9763E_CQE_BASE_ADDR 0x200 91 94 #define GLI_9763E_CQE_TRNS_MODE (SDHCI_TRNS_MULTI | \ 92 95 SDHCI_TRNS_BLK_CNT_EN | \ ··· 99 96 #define PCI_GLI_9755_WT_EN BIT(0) 100 97 #define GLI_9755_WT_EN_ON 0x1 101 98 #define GLI_9755_WT_EN_OFF 0x0 99 + 100 + #define PCI_GLI_9755_PECONF 0x44 101 + #define PCI_GLI_9755_LFCLK GENMASK(14, 12) 102 + #define PCI_GLI_9755_DMACLK BIT(29) 102 103 103 104 #define PCI_GLI_9755_PLL 0x64 104 105 #define PCI_GLI_9755_PLL_LDIV GENMASK(9, 0) ··· 526 519 sdhci_enable_clk(host, clk); 527 520 } 528 521 522 + static void gl9755_hw_setting(struct sdhci_pci_slot *slot) 523 + { 524 + struct pci_dev *pdev = slot->chip->pdev; 525 + u32 value; 526 + 527 + gl9755_wt_on(pdev); 528 + 529 + pci_read_config_dword(pdev, PCI_GLI_9755_PECONF, &value); 530 + value &= ~PCI_GLI_9755_LFCLK; 531 + value &= ~PCI_GLI_9755_DMACLK; 532 + pci_write_config_dword(pdev, PCI_GLI_9755_PECONF, value); 533 + 534 + gl9755_wt_off(pdev); 535 + } 536 + 529 537 static int gli_probe_slot_gl9750(struct sdhci_pci_slot *slot) 530 538 { 531 539 struct sdhci_host *host = slot->host; ··· 556 534 { 557 535 struct sdhci_host *host = slot->host; 558 536 537 + gl9755_hw_setting(slot); 559 538 gli_pcie_enable_msi(slot); 560 539 slot->host->mmc->caps2 |= MMC_CAP2_NO_SDIO; 561 540 sdhci_enable_v4_mode(host); ··· 786 763 pci_read_config_dword(pdev, PCIE_GLI_9763E_SCR, &value); 787 764 value |= GLI_9763E_SCR_AXI_REQ; 788 765 pci_write_config_dword(pdev, PCIE_GLI_9763E_SCR, value); 766 + 767 + pci_read_config_dword(pdev, PCIE_GLI_9763E_MMC_CTRL, &value); 768 + value &= ~GLI_9763E_HS400_SLOW; 769 + pci_write_config_dword(pdev, PCIE_GLI_9763E_MMC_CTRL, value); 789 770 790 771 pci_read_config_dword(pdev, PCIE_GLI_9763E_VHS, &value); 791 772 value &= ~GLI_9763E_VHS_REV;
+2 -9
drivers/mmc/host/sdhci-pic32.c
··· 121 121 writel(bus, host->ioaddr + SDH_SHARED_BUS_CTRL); 122 122 } 123 123 124 - static int pic32_sdhci_probe_platform(struct platform_device *pdev, 124 + static void pic32_sdhci_probe_platform(struct platform_device *pdev, 125 125 struct pic32_sdhci_priv *pdata) 126 126 { 127 - int ret = 0; 128 127 u32 caps_slot_type; 129 128 struct sdhci_host *host = platform_get_drvdata(pdev); 130 129 ··· 132 133 caps_slot_type = (host->caps & SDH_CAPS_SDH_SLOT_TYPE_MASK) >> 30; 133 134 if (caps_slot_type == SDH_SLOT_TYPE_SHARED_BUS) 134 135 pic32_sdhci_shared_bus(pdev); 135 - 136 - return ret; 137 136 } 138 137 139 138 static int pic32_sdhci_probe(struct platform_device *pdev) ··· 190 193 if (ret) 191 194 goto err_base_clk; 192 195 193 - ret = pic32_sdhci_probe_platform(pdev, sdhci_pdata); 194 - if (ret) { 195 - dev_err(&pdev->dev, "failed to probe platform!\n"); 196 - goto err_base_clk; 197 - } 196 + pic32_sdhci_probe_platform(pdev, sdhci_pdata); 198 197 199 198 ret = sdhci_add_host(host); 200 199 if (ret)
+1 -1
drivers/mmc/host/sdhci-sprd.c
··· 788 788 .driver = { 789 789 .name = "sdhci_sprd_r11", 790 790 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 791 - .of_match_table = of_match_ptr(sdhci_sprd_of_match), 791 + .of_match_table = sdhci_sprd_of_match, 792 792 .pm = &sdhci_sprd_pm_ops, 793 793 }, 794 794 };
+1 -1
drivers/mmc/host/sdhci-st.c
··· 523 523 .name = "sdhci-st", 524 524 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 525 525 .pm = &sdhci_st_pmops, 526 - .of_match_table = of_match_ptr(st_sdhci_match), 526 + .of_match_table = st_sdhci_match, 527 527 }, 528 528 }; 529 529
+1 -1
drivers/mmc/host/sdhci-tegra.c
··· 1272 1272 * busy wait mode. 1273 1273 */ 1274 1274 val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL); 1275 - if (cmd && cmd->busy_timeout >= 11 * HZ) 1275 + if (cmd && cmd->busy_timeout >= 11 * MSEC_PER_SEC) 1276 1276 val |= SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT; 1277 1277 else 1278 1278 val &= ~SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT;
+22 -18
drivers/mmc/host/sdhci-xenon-phy.c
··· 651 651 struct device_node *np, 652 652 struct xenon_emmc_phy_params *params) 653 653 { 654 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 655 + struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); 654 656 int ret = 0; 655 657 const char *name; 656 658 struct resource iomem; 657 659 658 - if (of_device_is_compatible(np, "marvell,armada-3700-sdhci")) 660 + if (priv->hw_version == XENON_A3700) 659 661 params->pad_ctrl.set_soc_pad = armada_3700_soc_pad_voltage_set; 660 662 else 661 663 return 0; ··· 691 689 return ret; 692 690 } 693 691 694 - static int xenon_emmc_phy_parse_param_dt(struct sdhci_host *host, 695 - struct device_node *np, 696 - struct xenon_emmc_phy_params *params) 692 + static int xenon_emmc_phy_parse_params(struct sdhci_host *host, 693 + struct device *dev, 694 + struct xenon_emmc_phy_params *params) 697 695 { 698 696 u32 value; 699 697 700 698 params->slow_mode = false; 701 - if (of_property_read_bool(np, "marvell,xenon-phy-slow-mode")) 699 + if (device_property_read_bool(dev, "marvell,xenon-phy-slow-mode")) 702 700 params->slow_mode = true; 703 701 704 702 params->znr = XENON_ZNR_DEF_VALUE; 705 - if (!of_property_read_u32(np, "marvell,xenon-phy-znr", &value)) 703 + if (!device_property_read_u32(dev, "marvell,xenon-phy-znr", &value)) 706 704 params->znr = value & XENON_ZNR_MASK; 707 705 708 706 params->zpr = XENON_ZPR_DEF_VALUE; 709 - if (!of_property_read_u32(np, "marvell,xenon-phy-zpr", &value)) 707 + if (!device_property_read_u32(dev, "marvell,xenon-phy-zpr", &value)) 710 708 params->zpr = value & XENON_ZPR_MASK; 711 709 712 710 params->nr_tun_times = XENON_TUN_CONSECUTIVE_TIMES; 713 - if (!of_property_read_u32(np, "marvell,xenon-phy-nr-success-tun", 714 - &value)) 711 + if (!device_property_read_u32(dev, "marvell,xenon-phy-nr-success-tun", 712 + &value)) 715 713 params->nr_tun_times = value & XENON_TUN_CONSECUTIVE_TIMES_MASK; 716 714 717 715 params->tun_step_divider = XENON_TUNING_STEP_DIVIDER; 718 - if (!of_property_read_u32(np, "marvell,xenon-phy-tun-step-divider", 719 - &value)) 716 + if (!device_property_read_u32(dev, "marvell,xenon-phy-tun-step-divider", 717 + &value)) 720 718 params->tun_step_divider = value & 0xFF; 721 719 722 - return get_dt_pad_ctrl_data(host, np, params); 720 + if (dev->of_node) 721 + return get_dt_pad_ctrl_data(host, dev->of_node, params); 722 + return 0; 723 723 } 724 724 725 725 /* Set SoC PHY Voltage PAD */ ··· 815 811 return ret; 816 812 } 817 813 818 - static int xenon_add_phy(struct device_node *np, struct sdhci_host *host, 814 + static int xenon_add_phy(struct device *dev, struct sdhci_host *host, 819 815 const char *phy_name) 820 816 { 821 817 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); ··· 834 830 if (ret) 835 831 return ret; 836 832 837 - return xenon_emmc_phy_parse_param_dt(host, np, priv->phy_params); 833 + return xenon_emmc_phy_parse_params(host, dev, priv->phy_params); 838 834 } 839 835 840 - int xenon_phy_parse_dt(struct device_node *np, struct sdhci_host *host) 836 + int xenon_phy_parse_params(struct device *dev, struct sdhci_host *host) 841 837 { 842 838 const char *phy_type = NULL; 843 839 844 - if (!of_property_read_string(np, "marvell,xenon-phy-type", &phy_type)) 845 - return xenon_add_phy(np, host, phy_type); 840 + if (!device_property_read_string(dev, "marvell,xenon-phy-type", &phy_type)) 841 + return xenon_add_phy(dev, host, phy_type); 846 842 847 - return xenon_add_phy(np, host, "emmc 5.1 phy"); 843 + return xenon_add_phy(dev, host, "emmc 5.1 phy"); 848 844 }
+59 -32
drivers/mmc/host/sdhci-xenon.c
··· 11 11 * Special thanks to Video BG4 project team. 12 12 */ 13 13 14 + #include <linux/acpi.h> 14 15 #include <linux/delay.h> 15 16 #include <linux/ktime.h> 16 17 #include <linux/module.h> ··· 248 247 sdhci_readw(host, SDHCI_HOST_CONTROL2); 249 248 } 250 249 250 + static unsigned int xenon_get_max_clock(struct sdhci_host *host) 251 + { 252 + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 253 + 254 + if (pltfm_host->clk) 255 + return sdhci_pltfm_clk_get_max_clock(host); 256 + else 257 + return pltfm_host->clock; 258 + } 259 + 251 260 static const struct sdhci_ops sdhci_xenon_ops = { 252 261 .voltage_switch = xenon_voltage_switch, 253 262 .set_clock = sdhci_set_clock, ··· 265 254 .set_bus_width = sdhci_set_bus_width, 266 255 .reset = xenon_reset, 267 256 .set_uhs_signaling = xenon_set_uhs_signaling, 268 - .get_max_clock = sdhci_pltfm_clk_get_max_clock, 257 + .get_max_clock = xenon_get_max_clock, 269 258 }; 270 259 271 260 static const struct sdhci_pltfm_data sdhci_xenon_pdata = { ··· 418 407 * Refer to XENON_SYS_CFG_INFO register 419 408 * tun-count: the interval between re-tuning 420 409 */ 421 - static int xenon_probe_dt(struct platform_device *pdev) 410 + static int xenon_probe_params(struct platform_device *pdev) 422 411 { 423 - struct device_node *np = pdev->dev.of_node; 412 + struct device *dev = &pdev->dev; 424 413 struct sdhci_host *host = platform_get_drvdata(pdev); 425 414 struct mmc_host *mmc = host->mmc; 426 415 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); ··· 429 418 u32 tuning_count; 430 419 431 420 /* Disable HS200 on Armada AP806 */ 432 - if (of_device_is_compatible(np, "marvell,armada-ap806-sdhci")) 421 + if (priv->hw_version == XENON_AP806) 433 422 host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200; 434 423 435 424 sdhc_id = 0x0; 436 - if (!of_property_read_u32(np, "marvell,xenon-sdhc-id", &sdhc_id)) { 425 + if (!device_property_read_u32(dev, "marvell,xenon-sdhc-id", &sdhc_id)) { 437 426 nr_sdhc = sdhci_readl(host, XENON_SYS_CFG_INFO); 438 427 nr_sdhc &= XENON_NR_SUPPORTED_SLOT_MASK; 439 428 if (unlikely(sdhc_id > nr_sdhc)) { ··· 445 434 priv->sdhc_id = sdhc_id; 446 435 447 436 tuning_count = XENON_DEF_TUNING_COUNT; 448 - if (!of_property_read_u32(np, "marvell,xenon-tun-count", 449 - &tuning_count)) { 437 + if (!device_property_read_u32(dev, "marvell,xenon-tun-count", 438 + &tuning_count)) { 450 439 if (unlikely(tuning_count >= XENON_TMR_RETUN_NO_PRESENT)) { 451 440 dev_err(mmc_dev(mmc), "Wrong Re-tuning Count. Set default value %d\n", 452 441 XENON_DEF_TUNING_COUNT); ··· 455 444 } 456 445 priv->tuning_count = tuning_count; 457 446 458 - return xenon_phy_parse_dt(np, host); 447 + return xenon_phy_parse_params(dev, host); 459 448 } 460 449 461 450 static int xenon_sdhc_prepare(struct sdhci_host *host) ··· 494 483 static int xenon_probe(struct platform_device *pdev) 495 484 { 496 485 struct sdhci_pltfm_host *pltfm_host; 486 + struct device *dev = &pdev->dev; 497 487 struct sdhci_host *host; 498 488 struct xenon_priv *priv; 499 489 int err; ··· 507 495 pltfm_host = sdhci_priv(host); 508 496 priv = sdhci_pltfm_priv(pltfm_host); 509 497 498 + priv->hw_version = (unsigned long)device_get_match_data(&pdev->dev); 499 + 510 500 /* 511 501 * Link Xenon specific mmc_host_ops function, 512 502 * to replace standard ones in sdhci_ops. 513 503 */ 514 504 xenon_replace_mmc_host_ops(host); 515 505 516 - pltfm_host->clk = devm_clk_get(&pdev->dev, "core"); 517 - if (IS_ERR(pltfm_host->clk)) { 518 - err = PTR_ERR(pltfm_host->clk); 519 - dev_err(&pdev->dev, "Failed to setup input clk: %d\n", err); 520 - goto free_pltfm; 521 - } 522 - err = clk_prepare_enable(pltfm_host->clk); 523 - if (err) 524 - goto free_pltfm; 525 - 526 - priv->axi_clk = devm_clk_get(&pdev->dev, "axi"); 527 - if (IS_ERR(priv->axi_clk)) { 528 - err = PTR_ERR(priv->axi_clk); 529 - if (err == -EPROBE_DEFER) 530 - goto err_clk; 531 - } else { 532 - err = clk_prepare_enable(priv->axi_clk); 506 + if (dev->of_node) { 507 + pltfm_host->clk = devm_clk_get(&pdev->dev, "core"); 508 + if (IS_ERR(pltfm_host->clk)) { 509 + err = PTR_ERR(pltfm_host->clk); 510 + dev_err(&pdev->dev, "Failed to setup input clk: %d\n", err); 511 + goto free_pltfm; 512 + } 513 + err = clk_prepare_enable(pltfm_host->clk); 533 514 if (err) 534 - goto err_clk; 515 + goto free_pltfm; 516 + 517 + priv->axi_clk = devm_clk_get(&pdev->dev, "axi"); 518 + if (IS_ERR(priv->axi_clk)) { 519 + err = PTR_ERR(priv->axi_clk); 520 + if (err == -EPROBE_DEFER) 521 + goto err_clk; 522 + } else { 523 + err = clk_prepare_enable(priv->axi_clk); 524 + if (err) 525 + goto err_clk; 526 + } 535 527 } 536 528 537 529 err = mmc_of_parse(host->mmc); 538 530 if (err) 539 531 goto err_clk_axi; 540 532 541 - sdhci_get_of_property(pdev); 533 + sdhci_get_property(pdev); 542 534 543 535 xenon_set_acg(host, false); 544 536 545 - /* Xenon specific dt parse */ 546 - err = xenon_probe_dt(pdev); 537 + /* Xenon specific parameters parse */ 538 + err = xenon_probe_params(pdev); 547 539 if (err) 548 540 goto err_clk_axi; 549 541 ··· 683 667 }; 684 668 685 669 static const struct of_device_id sdhci_xenon_dt_ids[] = { 686 - { .compatible = "marvell,armada-ap806-sdhci",}, 687 - { .compatible = "marvell,armada-cp110-sdhci",}, 688 - { .compatible = "marvell,armada-3700-sdhci",}, 670 + { .compatible = "marvell,armada-ap806-sdhci", .data = (void *)XENON_AP806}, 671 + { .compatible = "marvell,armada-cp110-sdhci", .data = (void *)XENON_CP110}, 672 + { .compatible = "marvell,armada-3700-sdhci", .data = (void *)XENON_A3700}, 689 673 {} 690 674 }; 691 675 MODULE_DEVICE_TABLE(of, sdhci_xenon_dt_ids); 676 + 677 + #ifdef CONFIG_ACPI 678 + static const struct acpi_device_id sdhci_xenon_acpi_ids[] = { 679 + { .id = "MRVL0002", XENON_AP806}, 680 + { .id = "MRVL0003", XENON_AP807}, 681 + { .id = "MRVL0004", XENON_CP110}, 682 + {} 683 + }; 684 + MODULE_DEVICE_TABLE(acpi, sdhci_xenon_acpi_ids); 685 + #endif 692 686 693 687 static struct platform_driver sdhci_xenon_driver = { 694 688 .driver = { 695 689 .name = "xenon-sdhci", 696 690 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 697 691 .of_match_table = sdhci_xenon_dt_ids, 692 + .acpi_match_table = ACPI_PTR(sdhci_xenon_acpi_ids), 698 693 .pm = &sdhci_xenon_dev_pm_ops, 699 694 }, 700 695 .probe = xenon_probe,
+10 -2
drivers/mmc/host/sdhci-xenon.h
··· 53 53 #define XENON_CTRL_HS200 0x5 54 54 #define XENON_CTRL_HS400 0x6 55 55 56 + enum xenon_variant { 57 + XENON_A3700, 58 + XENON_AP806, 59 + XENON_AP807, 60 + XENON_CP110 61 + }; 62 + 56 63 struct xenon_priv { 57 64 unsigned char tuning_count; 58 65 /* idx of SDHC */ ··· 97 90 void *phy_params; 98 91 struct xenon_emmc_phy_regs *emmc_phy_regs; 99 92 bool restore_needed; 93 + enum xenon_variant hw_version; 100 94 }; 101 95 102 96 int xenon_phy_adj(struct sdhci_host *host, struct mmc_ios *ios); 103 - int xenon_phy_parse_dt(struct device_node *np, 104 - struct sdhci_host *host); 97 + int xenon_phy_parse_params(struct device *dev, 98 + struct sdhci_host *host); 105 99 void xenon_soc_pad_ctrl(struct sdhci_host *host, 106 100 unsigned char signal_voltage); 107 101 #endif
+4 -4
drivers/mmc/host/sdhci.c
··· 3994 3994 if (host->v4_mode) 3995 3995 sdhci_do_enable_v4_mode(host); 3996 3996 3997 - of_property_read_u64(mmc_dev(host->mmc)->of_node, 3998 - "sdhci-caps-mask", &dt_caps_mask); 3999 - of_property_read_u64(mmc_dev(host->mmc)->of_node, 4000 - "sdhci-caps", &dt_caps); 3997 + device_property_read_u64(mmc_dev(host->mmc), 3998 + "sdhci-caps-mask", &dt_caps_mask); 3999 + device_property_read_u64(mmc_dev(host->mmc), 4000 + "sdhci-caps", &dt_caps); 4001 4001 4002 4002 v = ver ? *ver : sdhci_readw(host, SDHCI_HOST_VERSION); 4003 4003 host->version = (v & SDHCI_SPEC_VER_MASK) >> SDHCI_SPEC_VER_SHIFT;
+2 -1
drivers/mmc/host/sunxi-mmc.c
··· 26 26 #include <linux/mmc/sdio.h> 27 27 #include <linux/mmc/slot-gpio.h> 28 28 #include <linux/module.h> 29 + #include <linux/mod_devicetable.h> 29 30 #include <linux/of_address.h> 30 31 #include <linux/of_platform.h> 31 32 #include <linux/platform_device.h> ··· 1516 1515 .driver = { 1517 1516 .name = "sunxi-mmc", 1518 1517 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 1519 - .of_match_table = of_match_ptr(sunxi_mmc_of_match), 1518 + .of_match_table = sunxi_mmc_of_match, 1520 1519 .pm = &sunxi_mmc_pm_ops, 1521 1520 }, 1522 1521 .probe = sunxi_mmc_probe,
+1 -2
drivers/mmc/host/tmio_mmc.c
··· 174 174 if (ret) 175 175 goto host_remove; 176 176 177 - pr_info("%s at 0x%08lx irq %d\n", mmc_hostname(host->mmc), 178 - (unsigned long)host->ctl, irq); 177 + pr_info("%s at 0x%p irq %d\n", mmc_hostname(host->mmc), host->ctl, irq); 179 178 180 179 return 0; 181 180
+5 -1
drivers/mmc/host/tmio_mmc.h
··· 42 42 #define CTL_DMA_ENABLE 0xd8 43 43 #define CTL_RESET_SD 0xe0 44 44 #define CTL_VERSION 0xe2 45 - #define CTL_SDIF_MODE 0xe6 46 45 47 46 /* Definitions for values the CTL_STOP_INTERNAL_ACTION register can take */ 48 47 #define TMIO_STOP_STP BIT(0) ··· 80 81 #define CLK_CTL_SCLKEN BIT(8) 81 82 82 83 /* Definitions for values the CTL_SD_MEM_CARD_OPT register can take */ 84 + #define CARD_OPT_TOP_MASK 0xf0 85 + #define CARD_OPT_TOP_SHIFT 4 86 + #define CARD_OPT_EXTOP BIT(9) /* first appeared on R-Car Gen3 SDHI */ 83 87 #define CARD_OPT_WIDTH8 BIT(13) 88 + #define CARD_OPT_ALWAYS1 BIT(14) 84 89 #define CARD_OPT_WIDTH BIT(15) 85 90 86 91 /* Definitions for values the CTL_SDIO_STATUS register can take */ ··· 183 180 void (*reset)(struct tmio_mmc_host *host); 184 181 bool (*check_retune)(struct tmio_mmc_host *host); 185 182 void (*fixup_request)(struct tmio_mmc_host *host, struct mmc_request *mrq); 183 + unsigned int (*get_timeout_cycles)(struct tmio_mmc_host *host); 186 184 187 185 void (*prepare_hs400_tuning)(struct tmio_mmc_host *host); 188 186 void (*hs400_downgrade)(struct tmio_mmc_host *host);
+25 -1
drivers/mmc/host/tmio_mmc_core.c
··· 796 796 797 797 spin_unlock_irqrestore(&host->lock, flags); 798 798 799 - if (mrq->cmd->error || (mrq->data && mrq->data->error)) 799 + if (mrq->cmd->error || (mrq->data && mrq->data->error)) { 800 + tmio_mmc_ack_mmc_irqs(host, TMIO_MASK_IRQ); /* Clear all */ 800 801 tmio_mmc_abort_dma(host); 802 + } 801 803 802 804 /* Error means retune, but executed command was still successful */ 803 805 if (host->check_retune && host->check_retune(host)) ··· 887 885 sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, reg); 888 886 } 889 887 888 + static unsigned int tmio_mmc_get_timeout_cycles(struct tmio_mmc_host *host) 889 + { 890 + u16 val = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT); 891 + 892 + val = (val & CARD_OPT_TOP_MASK) >> CARD_OPT_TOP_SHIFT; 893 + return 1 << (13 + val); 894 + } 895 + 896 + static void tmio_mmc_max_busy_timeout(struct tmio_mmc_host *host) 897 + { 898 + unsigned int clk_rate = host->mmc->actual_clock ?: host->mmc->f_max; 899 + 900 + host->mmc->max_busy_timeout = host->get_timeout_cycles(host) / 901 + (clk_rate / MSEC_PER_SEC); 902 + } 903 + 890 904 /* Set MMC clock / power. 891 905 * Note: This controller uses a simple divider scheme therefore it cannot 892 906 * run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as ··· 960 942 tmio_mmc_set_bus_width(host, ios->bus_width); 961 943 break; 962 944 } 945 + 946 + if (host->pdata->flags & TMIO_MMC_USE_BUSY_TIMEOUT) 947 + tmio_mmc_max_busy_timeout(host); 963 948 964 949 /* Let things settle. delay taken from winCE driver */ 965 950 usleep_range(140, 200); ··· 1119 1098 1120 1099 if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) 1121 1100 _host->write16_hook = NULL; 1101 + 1102 + if (pdata->flags & TMIO_MMC_USE_BUSY_TIMEOUT && !_host->get_timeout_cycles) 1103 + _host->get_timeout_cycles = tmio_mmc_get_timeout_cycles; 1122 1104 1123 1105 _host->set_pwr = pdata->set_pwr; 1124 1106
+1
drivers/mmc/host/uniphier-sd.c
··· 586 586 587 587 tmio_data = &priv->tmio_data; 588 588 tmio_data->flags |= TMIO_MMC_32BIT_DATA_PORT; 589 + tmio_data->flags |= TMIO_MMC_USE_BUSY_TIMEOUT; 589 590 590 591 host = tmio_mmc_host_alloc(pdev, tmio_data); 591 592 if (IS_ERR(host))
+6 -1
include/linux/mfd/tmio.h
··· 55 55 */ 56 56 #define TMIO_MMC_HAS_IDLE_WAIT BIT(4) 57 57 58 - /* BIT(5) is unused */ 58 + /* 59 + * Use the busy timeout feature. Probably all TMIO versions support it. Yet, 60 + * we don't have documentation for old variants, so we enable only known good 61 + * variants with this flag. Can be removed once all variants are known good. 62 + */ 63 + #define TMIO_MMC_USE_BUSY_TIMEOUT BIT(5) 59 64 60 65 /* 61 66 * Some controllers have CMD12 automatically
+7
include/linux/mmc/host.h
··· 60 60 #define MMC_TIMING_MMC_DDR52 8 61 61 #define MMC_TIMING_MMC_HS200 9 62 62 #define MMC_TIMING_MMC_HS400 10 63 + #define MMC_TIMING_SD_EXP 11 64 + #define MMC_TIMING_SD_EXP_1_2V 12 63 65 64 66 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 65 67 ··· 175 173 */ 176 174 int (*multi_io_quirk)(struct mmc_card *card, 177 175 unsigned int direction, int blk_size); 176 + 177 + /* Initialize an SD express card, mandatory for MMC_CAP2_SD_EXP. */ 178 + int (*init_sd_express)(struct mmc_host *host, struct mmc_ios *ios); 178 179 }; 179 180 180 181 struct mmc_cqe_ops { ··· 363 358 #define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */ 364 359 #define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \ 365 360 MMC_CAP2_HS200_1_2V_SDR) 361 + #define MMC_CAP2_SD_EXP (1 << 7) /* SD express via PCIe */ 362 + #define MMC_CAP2_SD_EXP_1_2V (1 << 8) /* SD express 1.2V */ 366 363 #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */ 367 364 #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */ 368 365 #define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
+30
include/linux/rtsx_pci.h
··· 82 82 #define MS_OC_INT_EN (1 << 23) 83 83 #define SD_OC_INT_EN (1 << 22) 84 84 85 + #define RTSX_DUM_REG 0x1C 85 86 86 87 /* 87 88 * macros for easy use ··· 659 658 #define PM_WAKE_EN 0x01 660 659 #define PM_CTRL4 0xFF47 661 660 661 + /* FW config info register */ 662 + #define RTS5261_FW_CFG_INFO0 0xFF50 663 + #define RTS5261_FW_EXPRESS_TEST_MASK (0x01 << 0) 664 + #define RTS5261_FW_EA_MODE_MASK (0x01 << 5) 665 + #define RTS5261_FW_CFG0 0xFF54 666 + #define RTS5261_FW_ENTER_EXPRESS (0x01 << 0) 667 + 668 + #define RTS5261_FW_CFG1 0xFF55 669 + #define RTS5261_SYS_CLK_SEL_MCU_CLK (0x01 << 7) 670 + #define RTS5261_CRC_CLK_SEL_MCU_CLK (0x01 << 6) 671 + #define RTS5261_FAKE_MCU_CLOCK_GATING (0x01 << 5) 672 + #define RTS5261_MCU_BUS_SEL_MASK (0x01 << 4) 673 + #define RTS5261_MCU_CLOCK_SEL_MASK (0x03 << 2) 674 + #define RTS5261_MCU_CLOCK_SEL_16M (0x01 << 2) 675 + #define RTS5261_MCU_CLOCK_GATING (0x01 << 1) 676 + #define RTS5261_DRIVER_ENABLE_FW (0x01 << 0) 677 + 662 678 #define REG_CFG_OOBS_OFF_TIMER 0xFEA6 663 679 #define REG_CFG_OOBS_ON_TIMER 0xFEA7 664 680 #define REG_CFG_VCM_ON_TIMER 0xFEA8 ··· 719 701 #define RTS5260_DVCC_TUNE_MASK 0x70 720 702 #define RTS5260_DVCC_33 0x70 721 703 704 + /*RTS5261*/ 705 + #define RTS5261_LDO1_CFG0 0xFF72 706 + #define RTS5261_LDO1_OCP_THD_MASK (0x07 << 5) 707 + #define RTS5261_LDO1_OCP_EN (0x01 << 4) 708 + #define RTS5261_LDO1_OCP_LMT_THD_MASK (0x03 << 2) 709 + #define RTS5261_LDO1_OCP_LMT_EN (0x01 << 1) 710 + 722 711 #define LDO_VCC_CFG1 0xFF73 723 712 #define LDO_VCC_REF_TUNE_MASK 0x30 724 713 #define LDO_VCC_REF_1V2 0x20 ··· 766 741 767 742 #define RTS5260_AUTOLOAD_CFG4 0xFF7F 768 743 #define RTS5260_MIMO_DISABLE 0x8A 744 + /*RTS5261*/ 745 + #define RTS5261_AUX_CLK_16M_EN (1 << 5) 769 746 770 747 #define RTS5260_REG_GPIO_CTL0 0xFC1A 771 748 #define RTS5260_REG_GPIO_MASK 0x01 ··· 1220 1193 #define EXTRA_CAPS_MMC_HS200 (1 << 4) 1221 1194 #define EXTRA_CAPS_MMC_8BIT (1 << 5) 1222 1195 #define EXTRA_CAPS_NO_MMC (1 << 7) 1196 + #define EXTRA_CAPS_SD_EXPRESS (1 << 8) 1223 1197 u32 extra_caps; 1224 1198 1225 1199 #define IC_VER_A 0 ··· 1275 1247 #define PCI_PID(pcr) ((pcr)->pci->device) 1276 1248 #define is_version(pcr, pid, ver) \ 1277 1249 (CHK_PCI_PID(pcr, pid) && (pcr)->ic_version == (ver)) 1250 + #define is_version_higher_than(pcr, pid, ver) \ 1251 + (CHK_PCI_PID(pcr, pid) && (pcr)->ic_version > (ver)) 1278 1252 #define pcr_dbg(pcr, fmt, arg...) \ 1279 1253 dev_dbg(&(pcr)->pci->dev, fmt, ##arg) 1280 1254