.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* linux/drivers/mmc/host/sdhci-s3c.c |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright 2008 Openmoko Inc. |
---|
.. | .. |
---|
6 | 7 | * http://armlinux.simtec.co.uk/ |
---|
7 | 8 | * |
---|
8 | 9 | * 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. |
---|
13 | 10 | */ |
---|
14 | 11 | |
---|
15 | 12 | #include <linux/spinlock.h> |
---|
.. | .. |
---|
110 | 107 | * @ioarea: The resource created when we claimed the IO area. |
---|
111 | 108 | * @pdata: The platform data for this controller. |
---|
112 | 109 | * @cur_clk: The index of the current bus clock. |
---|
| 110 | + * @ext_cd_irq: External card detect interrupt. |
---|
113 | 111 | * @clk_io: The clock for the internal bus interface. |
---|
| 112 | + * @clk_rates: Clock frequencies. |
---|
114 | 113 | * @clk_bus: The clocks that are available for the SD/MMC bus clock. |
---|
| 114 | + * @no_divider: No or non-standard internal clock divider. |
---|
115 | 115 | */ |
---|
116 | 116 | struct sdhci_s3c { |
---|
117 | 117 | struct sdhci_host *host; |
---|
.. | .. |
---|
120 | 120 | struct s3c_sdhci_platdata *pdata; |
---|
121 | 121 | int cur_clk; |
---|
122 | 122 | int ext_cd_irq; |
---|
123 | | - int ext_cd_gpio; |
---|
124 | 123 | |
---|
125 | 124 | struct clk *clk_io; |
---|
126 | 125 | struct clk *clk_bus[MAX_BUS_CLK]; |
---|
.. | .. |
---|
132 | 131 | /** |
---|
133 | 132 | * struct sdhci_s3c_driver_data - S3C SDHCI platform specific driver data |
---|
134 | 133 | * @sdhci_quirks: sdhci host specific quirks. |
---|
| 134 | + * @no_divider: no or non-standard internal clock divider. |
---|
135 | 135 | * |
---|
136 | 136 | * Specifies platform specific configuration of sdhci controller. |
---|
137 | 137 | * Note: A structure for driver specific platform data is used for future |
---|
.. | .. |
---|
461 | 461 | } |
---|
462 | 462 | #endif |
---|
463 | 463 | |
---|
| 464 | +#ifdef CONFIG_OF |
---|
464 | 465 | static const struct of_device_id sdhci_s3c_dt_match[]; |
---|
| 466 | +#endif |
---|
465 | 467 | |
---|
466 | 468 | static inline struct sdhci_s3c_drv_data *sdhci_s3c_get_driver_data( |
---|
467 | 469 | struct platform_device *pdev) |
---|
.. | .. |
---|
484 | 486 | struct device *dev = &pdev->dev; |
---|
485 | 487 | struct sdhci_host *host; |
---|
486 | 488 | struct sdhci_s3c *sc; |
---|
487 | | - struct resource *res; |
---|
488 | 489 | int ret, irq, ptr, clks; |
---|
489 | 490 | |
---|
490 | 491 | if (!pdev->dev.platform_data && !pdev->dev.of_node) { |
---|
.. | .. |
---|
493 | 494 | } |
---|
494 | 495 | |
---|
495 | 496 | irq = platform_get_irq(pdev, 0); |
---|
496 | | - if (irq < 0) { |
---|
497 | | - dev_err(dev, "no irq specified\n"); |
---|
| 497 | + if (irq < 0) |
---|
498 | 498 | return irq; |
---|
499 | | - } |
---|
500 | 499 | |
---|
501 | 500 | host = sdhci_alloc_host(dev, sizeof(struct sdhci_s3c)); |
---|
502 | 501 | if (IS_ERR(host)) { |
---|
.. | .. |
---|
517 | 516 | goto err_pdata_io_clk; |
---|
518 | 517 | } else { |
---|
519 | 518 | memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata)); |
---|
520 | | - sc->ext_cd_gpio = -1; /* invalid gpio number */ |
---|
521 | 519 | } |
---|
522 | 520 | |
---|
523 | 521 | drv_data = sdhci_s3c_get_driver_data(pdev); |
---|
.. | .. |
---|
560 | 558 | goto err_no_busclks; |
---|
561 | 559 | } |
---|
562 | 560 | |
---|
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); |
---|
565 | 562 | if (IS_ERR(host->ioaddr)) { |
---|
566 | 563 | ret = PTR_ERR(host->ioaddr); |
---|
567 | 564 | goto err_req_regs; |
---|
.. | .. |
---|
614 | 611 | switch (pdata->max_width) { |
---|
615 | 612 | case 8: |
---|
616 | 613 | host->mmc->caps |= MMC_CAP_8_BIT_DATA; |
---|
| 614 | + fallthrough; |
---|
617 | 615 | case 4: |
---|
618 | 616 | host->mmc->caps |= MMC_CAP_4_BIT_DATA; |
---|
619 | 617 | break; |
---|
.. | .. |
---|
748 | 746 | clk_prepare_enable(busclk); |
---|
749 | 747 | if (ourhost->cur_clk >= 0) |
---|
750 | 748 | clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]); |
---|
751 | | - ret = sdhci_runtime_resume_host(host); |
---|
| 749 | + ret = sdhci_runtime_resume_host(host, 0); |
---|
752 | 750 | return ret; |
---|
753 | 751 | } |
---|
754 | 752 | #endif |
---|
.. | .. |
---|
788 | 786 | .id_table = sdhci_s3c_driver_ids, |
---|
789 | 787 | .driver = { |
---|
790 | 788 | .name = "s3c-sdhci", |
---|
| 789 | + .probe_type = PROBE_PREFER_ASYNCHRONOUS, |
---|
791 | 790 | .of_match_table = of_match_ptr(sdhci_s3c_dt_match), |
---|
792 | 791 | .pm = &sdhci_s3c_pmops, |
---|
793 | 792 | }, |
---|