aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2010-07-21 07:54:40 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-07-29 10:39:56 -0400
commit4956e10903fd3459306dd9438c1e714ba3068a2a (patch)
tree2604ac9ef417563c1ef6fc98867d8c88993c256e /drivers
parentbb8f563c848faa113059973f68c24a3bb6a9585e (diff)
ARM: 6244/1: mmci: add variant data and default MCICLOCK support
Add a variant_data structure to handle the differences between the various variants of this peripheral. Add a first quirk for a default MCICLOCK value, required on the Ux500 variant where the enable bit needs to be always set, since it controls access to some registers. Acked-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/mmci.c31
-rw-r--r--drivers/mmc/host/mmci.h2
2 files changed, 32 insertions, 1 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 7ae3eeeefc29..fd2e7acbed39 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -36,12 +36,30 @@
36 36
37static unsigned int fmax = 515633; 37static unsigned int fmax = 515633;
38 38
39/**
40 * struct variant_data - MMCI variant-specific quirks
41 * @clkreg: default value for MCICLOCK register
42 */
43struct variant_data {
44 unsigned int clkreg;
45};
46
47static struct variant_data variant_arm = {
48};
49
50static struct variant_data variant_u300 = {
51};
52
53static struct variant_data variant_ux500 = {
54 .clkreg = MCI_CLK_ENABLE,
55};
39/* 56/*
40 * This must be called with host->lock held 57 * This must be called with host->lock held
41 */ 58 */
42static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) 59static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired)
43{ 60{
44 u32 clk = 0; 61 struct variant_data *variant = host->variant;
62 u32 clk = variant->clkreg;
45 63
46 if (desired) { 64 if (desired) {
47 if (desired >= host->mclk) { 65 if (desired >= host->mclk) {
@@ -563,6 +581,7 @@ static const struct mmc_host_ops mmci_ops = {
563static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) 581static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
564{ 582{
565 struct mmci_platform_data *plat = dev->dev.platform_data; 583 struct mmci_platform_data *plat = dev->dev.platform_data;
584 struct variant_data *variant = id->data;
566 struct mmci_host *host; 585 struct mmci_host *host;
567 struct mmc_host *mmc; 586 struct mmc_host *mmc;
568 int ret; 587 int ret;
@@ -606,6 +625,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
606 goto clk_free; 625 goto clk_free;
607 626
608 host->plat = plat; 627 host->plat = plat;
628 host->variant = variant;
609 host->mclk = clk_get_rate(host->clk); 629 host->mclk = clk_get_rate(host->clk);
610 /* 630 /*
611 * According to the spec, mclk is max 100 MHz, 631 * According to the spec, mclk is max 100 MHz,
@@ -845,19 +865,28 @@ static struct amba_id mmci_ids[] = {
845 { 865 {
846 .id = 0x00041180, 866 .id = 0x00041180,
847 .mask = 0x000fffff, 867 .mask = 0x000fffff,
868 .data = &variant_arm,
848 }, 869 },
849 { 870 {
850 .id = 0x00041181, 871 .id = 0x00041181,
851 .mask = 0x000fffff, 872 .mask = 0x000fffff,
873 .data = &variant_arm,
852 }, 874 },
853 /* ST Micro variants */ 875 /* ST Micro variants */
854 { 876 {
855 .id = 0x00180180, 877 .id = 0x00180180,
856 .mask = 0x00ffffff, 878 .mask = 0x00ffffff,
879 .data = &variant_u300,
857 }, 880 },
858 { 881 {
859 .id = 0x00280180, 882 .id = 0x00280180,
860 .mask = 0x00ffffff, 883 .mask = 0x00ffffff,
884 .data = &variant_u300,
885 },
886 {
887 .id = 0x00480180,
888 .mask = 0x00ffffff,
889 .data = &variant_ux500,
861 }, 890 },
862 { 0, 0 }, 891 { 0, 0 },
863}; 892};
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h
index 7cb24ab1eecc..b98cc782402a 100644
--- a/drivers/mmc/host/mmci.h
+++ b/drivers/mmc/host/mmci.h
@@ -145,6 +145,7 @@
145#define NR_SG 16 145#define NR_SG 16
146 146
147struct clk; 147struct clk;
148struct variant_data;
148 149
149struct mmci_host { 150struct mmci_host {
150 void __iomem *base; 151 void __iomem *base;
@@ -164,6 +165,7 @@ struct mmci_host {
164 unsigned int cclk; 165 unsigned int cclk;
165 u32 pwr; 166 u32 pwr;
166 struct mmci_platform_data *plat; 167 struct mmci_platform_data *plat;
168 struct variant_data *variant;
167 169
168 u8 hw_designer; 170 u8 hw_designer;
169 u8 hw_revision:4; 171 u8 hw_revision:4;