2 * sdhci-brcmstb.c Support for SDHCI on Broadcom BRCMSTB SoC's
4 * Copyright (C) 2015 Broadcom Corporation
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
18 #include <linux/mmc/host.h>
19 #include <linux/module.h>
22 #include "sdhci-pltfm.h"
24 static const struct sdhci_ops sdhci_brcmstb_ops
= {
25 .set_clock
= sdhci_set_clock
,
26 .set_bus_width
= sdhci_set_bus_width
,
28 .set_uhs_signaling
= sdhci_set_uhs_signaling
,
31 static const struct sdhci_pltfm_data sdhci_brcmstb_pdata
= {
32 .ops
= &sdhci_brcmstb_ops
,
35 static int sdhci_brcmstb_probe(struct platform_device
*pdev
)
37 struct sdhci_host
*host
;
38 struct sdhci_pltfm_host
*pltfm_host
;
42 clk
= devm_clk_get(&pdev
->dev
, NULL
);
44 dev_err(&pdev
->dev
, "Clock not found in Device Tree\n");
47 res
= clk_prepare_enable(clk
);
51 host
= sdhci_pltfm_init(pdev
, &sdhci_brcmstb_pdata
, 0);
57 sdhci_get_of_property(pdev
);
58 res
= mmc_of_parse(host
->mmc
);
63 * Supply the existing CAPS, but clear the UHS modes. This
64 * will allow these modes to be specified by device tree
65 * properties through mmc_of_parse().
67 host
->caps
= sdhci_readl(host
, SDHCI_CAPABILITIES
);
68 if (of_device_is_compatible(pdev
->dev
.of_node
, "brcm,bcm7425-sdhci"))
69 host
->caps
&= ~SDHCI_CAN_64BIT
;
70 host
->caps1
= sdhci_readl(host
, SDHCI_CAPABILITIES_1
);
71 host
->caps1
&= ~(SDHCI_SUPPORT_SDR50
| SDHCI_SUPPORT_SDR104
|
73 host
->quirks
|= SDHCI_QUIRK_MISSING_CAPS
|
74 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
;
76 res
= sdhci_add_host(host
);
80 pltfm_host
= sdhci_priv(host
);
81 pltfm_host
->clk
= clk
;
85 sdhci_pltfm_free(pdev
);
87 clk_disable_unprepare(clk
);
91 static const struct of_device_id sdhci_brcm_of_match
[] = {
92 { .compatible
= "brcm,bcm7425-sdhci" },
93 { .compatible
= "brcm,bcm7445-sdhci" },
96 MODULE_DEVICE_TABLE(of
, sdhci_brcm_of_match
);
98 static struct platform_driver sdhci_brcmstb_driver
= {
100 .name
= "sdhci-brcmstb",
101 .pm
= &sdhci_pltfm_pmops
,
102 .of_match_table
= of_match_ptr(sdhci_brcm_of_match
),
104 .probe
= sdhci_brcmstb_probe
,
105 .remove
= sdhci_pltfm_unregister
,
108 module_platform_driver(sdhci_brcmstb_driver
);
110 MODULE_DESCRIPTION("SDHCI driver for Broadcom BRCMSTB SoCs");
111 MODULE_AUTHOR("Broadcom");
112 MODULE_LICENSE("GPL v2");