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 mmc_of_parse(host
->mmc
);
61 * Supply the existing CAPS, but clear the UHS modes. This
62 * will allow these modes to be specified by device tree
63 * properties through mmc_of_parse().
65 host
->caps
= sdhci_readl(host
, SDHCI_CAPABILITIES
);
66 if (of_device_is_compatible(pdev
->dev
.of_node
, "brcm,bcm7425-sdhci"))
67 host
->caps
&= ~SDHCI_CAN_64BIT
;
68 host
->caps1
= sdhci_readl(host
, SDHCI_CAPABILITIES_1
);
69 host
->caps1
&= ~(SDHCI_SUPPORT_SDR50
| SDHCI_SUPPORT_SDR104
|
71 host
->quirks
|= SDHCI_QUIRK_MISSING_CAPS
|
72 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
;
74 res
= sdhci_add_host(host
);
78 pltfm_host
= sdhci_priv(host
);
79 pltfm_host
->clk
= clk
;
83 sdhci_pltfm_free(pdev
);
85 clk_disable_unprepare(clk
);
89 static const struct of_device_id sdhci_brcm_of_match
[] = {
90 { .compatible
= "brcm,bcm7425-sdhci" },
91 { .compatible
= "brcm,bcm7445-sdhci" },
94 MODULE_DEVICE_TABLE(of
, sdhci_brcm_of_match
);
96 static struct platform_driver sdhci_brcmstb_driver
= {
98 .name
= "sdhci-brcmstb",
99 .pm
= &sdhci_pltfm_pmops
,
100 .of_match_table
= of_match_ptr(sdhci_brcm_of_match
),
102 .probe
= sdhci_brcmstb_probe
,
103 .remove
= sdhci_pltfm_unregister
,
106 module_platform_driver(sdhci_brcmstb_driver
);
108 MODULE_DESCRIPTION("SDHCI driver for Broadcom BRCMSTB SoCs");
109 MODULE_AUTHOR("Broadcom");
110 MODULE_LICENSE("GPL v2");