Skip to content

Commit 4956e10

Browse files
vitkyrkaRussell King
authored andcommitted
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 <[email protected]> Signed-off-by: Rabin Vincent <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent bb8f563 commit 4956e10

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

drivers/mmc/host/mmci.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,30 @@
3636

3737
static unsigned int fmax = 515633;
3838

39+
/**
40+
* struct variant_data - MMCI variant-specific quirks
41+
* @clkreg: default value for MCICLOCK register
42+
*/
43+
struct variant_data {
44+
unsigned int clkreg;
45+
};
46+
47+
static struct variant_data variant_arm = {
48+
};
49+
50+
static struct variant_data variant_u300 = {
51+
};
52+
53+
static struct variant_data variant_ux500 = {
54+
.clkreg = MCI_CLK_ENABLE,
55+
};
3956
/*
4057
* This must be called with host->lock held
4158
*/
4259
static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired)
4360
{
44-
u32 clk = 0;
61+
struct variant_data *variant = host->variant;
62+
u32 clk = variant->clkreg;
4563

4664
if (desired) {
4765
if (desired >= host->mclk) {
@@ -563,6 +581,7 @@ static const struct mmc_host_ops mmci_ops = {
563581
static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
564582
{
565583
struct mmci_platform_data *plat = dev->dev.platform_data;
584+
struct variant_data *variant = id->data;
566585
struct mmci_host *host;
567586
struct mmc_host *mmc;
568587
int ret;
@@ -606,6 +625,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
606625
goto clk_free;
607626

608627
host->plat = plat;
628+
host->variant = variant;
609629
host->mclk = clk_get_rate(host->clk);
610630
/*
611631
* According to the spec, mclk is max 100 MHz,
@@ -845,19 +865,28 @@ static struct amba_id mmci_ids[] = {
845865
{
846866
.id = 0x00041180,
847867
.mask = 0x000fffff,
868+
.data = &variant_arm,
848869
},
849870
{
850871
.id = 0x00041181,
851872
.mask = 0x000fffff,
873+
.data = &variant_arm,
852874
},
853875
/* ST Micro variants */
854876
{
855877
.id = 0x00180180,
856878
.mask = 0x00ffffff,
879+
.data = &variant_u300,
857880
},
858881
{
859882
.id = 0x00280180,
860883
.mask = 0x00ffffff,
884+
.data = &variant_u300,
885+
},
886+
{
887+
.id = 0x00480180,
888+
.mask = 0x00ffffff,
889+
.data = &variant_ux500,
861890
},
862891
{ 0, 0 },
863892
};

drivers/mmc/host/mmci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
#define NR_SG 16
146146

147147
struct clk;
148+
struct variant_data;
148149

149150
struct mmci_host {
150151
void __iomem *base;
@@ -164,6 +165,7 @@ struct mmci_host {
164165
unsigned int cclk;
165166
u32 pwr;
166167
struct mmci_platform_data *plat;
168+
struct variant_data *variant;
167169

168170
u8 hw_designer;
169171
u8 hw_revision:4;

0 commit comments

Comments
 (0)