Skip to content

Commit 4593df2

Browse files
author
Ulf Hansson
committed
mmc: mmci: Enforce DT for signal direction and feedback clock
Remove the option to provide signal direction configuration and feeback clock as platform data, enforce it through DT. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 363b8b4 commit 4593df2

3 files changed

Lines changed: 25 additions & 36 deletions

File tree

‎drivers/mmc/host/mmci.c‎

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
12871287
* indicating signal direction for the signals in
12881288
* the SD/MMC bus and feedback-clock usage.
12891289
*/
1290-
pwr |= host->plat->sigdir;
1290+
pwr |= host->pwr_reg_add;
12911291

12921292
if (ios->bus_width == MMC_BUS_WIDTH_4)
12931293
pwr &= ~MCI_ST_DATA74DIREN;
@@ -1386,29 +1386,26 @@ static struct mmc_host_ops mmci_ops = {
13861386
.start_signal_voltage_switch = mmci_sig_volt_switch,
13871387
};
13881388

1389-
static void mmci_dt_populate_generic_pdata(struct device_node *np,
1390-
struct mmci_platform_data *pdata)
1389+
static int mmci_of_parse(struct device_node *np, struct mmc_host *mmc)
13911390
{
1391+
struct mmci_host *host = mmc_priv(mmc);
1392+
int ret = mmc_of_parse(mmc);
1393+
1394+
if (ret)
1395+
return ret;
1396+
13921397
if (of_get_property(np, "st,sig-dir-dat0", NULL))
1393-
pdata->sigdir |= MCI_ST_DATA0DIREN;
1398+
host->pwr_reg_add |= MCI_ST_DATA0DIREN;
13941399
if (of_get_property(np, "st,sig-dir-dat2", NULL))
1395-
pdata->sigdir |= MCI_ST_DATA2DIREN;
1400+
host->pwr_reg_add |= MCI_ST_DATA2DIREN;
13961401
if (of_get_property(np, "st,sig-dir-dat31", NULL))
1397-
pdata->sigdir |= MCI_ST_DATA31DIREN;
1402+
host->pwr_reg_add |= MCI_ST_DATA31DIREN;
13981403
if (of_get_property(np, "st,sig-dir-dat74", NULL))
1399-
pdata->sigdir |= MCI_ST_DATA74DIREN;
1404+
host->pwr_reg_add |= MCI_ST_DATA74DIREN;
14001405
if (of_get_property(np, "st,sig-dir-cmd", NULL))
1401-
pdata->sigdir |= MCI_ST_CMDDIREN;
1406+
host->pwr_reg_add |= MCI_ST_CMDDIREN;
14021407
if (of_get_property(np, "st,sig-pin-fbclk", NULL))
1403-
pdata->sigdir |= MCI_ST_FBCLKEN;
1404-
}
1405-
1406-
static int mmci_of_parse(struct device_node *np, struct mmc_host *mmc)
1407-
{
1408-
int ret = mmc_of_parse(mmc);
1409-
1410-
if (ret)
1411-
return ret;
1408+
host->pwr_reg_add |= MCI_ST_FBCLKEN;
14121409

14131410
if (of_get_property(np, "mmc-cap-mmc-highspeed", NULL))
14141411
mmc->caps |= MMC_CAP_MMC_HIGHSPEED;
@@ -1440,9 +1437,6 @@ static int mmci_probe(struct amba_device *dev,
14401437
return -ENOMEM;
14411438
}
14421439

1443-
if (np)
1444-
mmci_dt_populate_generic_pdata(np, plat);
1445-
14461440
mmc = mmc_alloc_host(sizeof(struct mmci_host), &dev->dev);
14471441
if (!mmc)
14481442
return -ENOMEM;

‎drivers/mmc/host/mmci.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@
1313
#define MCI_PWR_ON 0x03
1414
#define MCI_OD (1 << 6)
1515
#define MCI_ROD (1 << 7)
16+
/*
17+
* The ST Micro version does not have ROD and reuse the voltage registers for
18+
* direction settings.
19+
*/
20+
#define MCI_ST_DATA2DIREN (1 << 2)
21+
#define MCI_ST_CMDDIREN (1 << 3)
22+
#define MCI_ST_DATA0DIREN (1 << 4)
23+
#define MCI_ST_DATA31DIREN (1 << 5)
24+
#define MCI_ST_FBCLKEN (1 << 7)
25+
#define MCI_ST_DATA74DIREN (1 << 8)
1626

1727
#define MMCICLOCK 0x004
1828
#define MCI_CLK_ENABLE (1 << 8)
@@ -183,6 +193,7 @@ struct mmci_host {
183193
unsigned int mclk;
184194
unsigned int cclk;
185195
u32 pwr_reg;
196+
u32 pwr_reg_add;
186197
u32 clk_reg;
187198
u32 datactrl_reg;
188199
u32 busy_status;

‎include/linux/amba/mmci.h‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@
66

77
#include <linux/mmc/host.h>
88

9-
10-
/*
11-
* These defines is places here due to access is needed from machine
12-
* configuration files. The ST Micro version does not have ROD and
13-
* reuse the voltage registers for direction settings.
14-
*/
15-
#define MCI_ST_DATA2DIREN (1 << 2)
16-
#define MCI_ST_CMDDIREN (1 << 3)
17-
#define MCI_ST_DATA0DIREN (1 << 4)
18-
#define MCI_ST_DATA31DIREN (1 << 5)
19-
#define MCI_ST_FBCLKEN (1 << 7)
20-
#define MCI_ST_DATA74DIREN (1 << 8)
21-
229
/* Just some dummy forwarding */
2310
struct dma_chan;
2411

@@ -45,8 +32,6 @@ struct dma_chan;
4532
* @capabilities: the capabilities of the block as implemented in
4633
* this platform, signify anything MMC_CAP_* from mmc/host.h
4734
* @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h
48-
* @sigdir: a bit field indicating for what bits in the MMC bus the host
49-
* should enable signal direction indication.
5035
* @dma_filter: function used to select an appropriate RX and TX
5136
* DMA channel to be used for DMA, if and only if you're deploying the
5237
* generic DMA engine
@@ -69,7 +54,6 @@ struct mmci_platform_data {
6954
bool cd_invert;
7055
unsigned long capabilities;
7156
unsigned long capabilities2;
72-
u32 sigdir;
7357
bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
7458
void *dma_rx_param;
7559
void *dma_tx_param;

0 commit comments

Comments
 (0)