forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/mmc/host/sdhci-s3c.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* linux/drivers/mmc/host/sdhci-s3c.c
23 *
34 * Copyright 2008 Openmoko Inc.
....@@ -6,10 +7,6 @@
67 * http://armlinux.simtec.co.uk/
78 *
89 * SDHCI (HSMMC) support for Samsung SoC
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
1310 */
1411
1512 #include <linux/spinlock.h>
....@@ -110,8 +107,11 @@
110107 * @ioarea: The resource created when we claimed the IO area.
111108 * @pdata: The platform data for this controller.
112109 * @cur_clk: The index of the current bus clock.
110
+ * @ext_cd_irq: External card detect interrupt.
113111 * @clk_io: The clock for the internal bus interface.
112
+ * @clk_rates: Clock frequencies.
114113 * @clk_bus: The clocks that are available for the SD/MMC bus clock.
114
+ * @no_divider: No or non-standard internal clock divider.
115115 */
116116 struct sdhci_s3c {
117117 struct sdhci_host *host;
....@@ -120,7 +120,6 @@
120120 struct s3c_sdhci_platdata *pdata;
121121 int cur_clk;
122122 int ext_cd_irq;
123
- int ext_cd_gpio;
124123
125124 struct clk *clk_io;
126125 struct clk *clk_bus[MAX_BUS_CLK];
....@@ -132,6 +131,7 @@
132131 /**
133132 * struct sdhci_s3c_driver_data - S3C SDHCI platform specific driver data
134133 * @sdhci_quirks: sdhci host specific quirks.
134
+ * @no_divider: no or non-standard internal clock divider.
135135 *
136136 * Specifies platform specific configuration of sdhci controller.
137137 * Note: A structure for driver specific platform data is used for future
....@@ -461,7 +461,9 @@
461461 }
462462 #endif
463463
464
+#ifdef CONFIG_OF
464465 static const struct of_device_id sdhci_s3c_dt_match[];
466
+#endif
465467
466468 static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data(
467469 struct platform_device *pdev)
....@@ -484,7 +486,6 @@
484486 struct device *dev = &pdev->dev;
485487 struct sdhci_host *host;
486488 struct sdhci_s3c *sc;
487
- struct resource *res;
488489 int ret, irq, ptr, clks;
489490
490491 if (!pdev->dev.platform_data && !pdev->dev.of_node) {
....@@ -493,10 +494,8 @@
493494 }
494495
495496 irq = platform_get_irq(pdev, 0);
496
- if (irq < 0) {
497
- dev_err(dev, "no irq specified\n");
497
+ if (irq < 0)
498498 return irq;
499
- }
500499
501500 host = sdhci_alloc_host(dev, sizeof(struct sdhci_s3c));
502501 if (IS_ERR(host)) {
....@@ -517,7 +516,6 @@
517516 goto err_pdata_io_clk;
518517 } else {
519518 memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata));
520
- sc->ext_cd_gpio = -1; /* invalid gpio number */
521519 }
522520
523521 drv_data = sdhci_s3c_get_driver_data(pdev);
....@@ -560,8 +558,7 @@
560558 goto err_no_busclks;
561559 }
562560
563
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
564
- host->ioaddr = devm_ioremap_resource(&pdev->dev, res);
561
+ host->ioaddr = devm_platform_ioremap_resource(pdev, 0);
565562 if (IS_ERR(host->ioaddr)) {
566563 ret = PTR_ERR(host->ioaddr);
567564 goto err_req_regs;
....@@ -614,6 +611,7 @@
614611 switch (pdata->max_width) {
615612 case 8:
616613 host->mmc->caps |= MMC_CAP_8_BIT_DATA;
614
+ fallthrough;
617615 case 4:
618616 host->mmc->caps |= MMC_CAP_4_BIT_DATA;
619617 break;
....@@ -748,7 +746,7 @@
748746 clk_prepare_enable(busclk);
749747 if (ourhost->cur_clk >= 0)
750748 clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]);
751
- ret = sdhci_runtime_resume_host(host);
749
+ ret = sdhci_runtime_resume_host(host, 0);
752750 return ret;
753751 }
754752 #endif
....@@ -788,6 +786,7 @@
788786 .id_table = sdhci_s3c_driver_ids,
789787 .driver = {
790788 .name = "s3c-sdhci",
789
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
791790 .of_match_table = of_match_ptr(sdhci_s3c_dt_match),
792791 .pm = &sdhci_s3c_pmops,
793792 },