[PATCH 03/14] mmc: bcm2835: remove bcm2835_set_power

Stefan Wahren stefan.wahren at i2se.com
Sat Jan 7 04:51:03 PST 2017


Instead of encapsulating a single write, we better use self
explaining defines and avoid another function call.

Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 drivers/mmc/host/bcm2835.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index fe0915e..19541fb 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -99,6 +99,9 @@
 #define SDHCFG_WIDE_INT_BUS	BIT(1)
 #define SDHCFG_REL_CMD_LINE	BIT(0)
 
+#define SDVDD_POWER_OFF		0
+#define SDVDD_POWER_ON		1
+
 #define SDEDM_FORCE_DATA_MODE	BIT(19)
 #define SDEDM_CLOCK_PULSE	BIT(20)
 #define SDEDM_BYPASS		BIT(21)
@@ -244,17 +247,11 @@ static void bcm2835_dumpregs(struct bcm2835_host *host)
 	dev_dbg(&host->pdev->dev, "===========================================\n");
 }
 
-static void bcm2835_set_power(struct bcm2835_host *host, bool on)
-{
-	writel(on ? 1 : 0, host->ioaddr + SDVDD);
-}
-
 static void bcm2835_reset_internal(struct bcm2835_host *host)
 {
 	u32 temp;
 
-	bcm2835_set_power(host, false);
-
+	writel(SDVDD_POWER_OFF, host->ioaddr + SDVDD);
 	writel(0, host->ioaddr + SDCMD);
 	writel(0, host->ioaddr + SDARG);
 	writel(0xf00000, host->ioaddr + SDTOUT);
@@ -272,7 +269,7 @@ static void bcm2835_reset_internal(struct bcm2835_host *host)
 		(FIFO_WRITE_THRESHOLD << SDEDM_WRITE_THRESHOLD_SHIFT);
 	writel(temp, host->ioaddr + SDEDM);
 	msleep(20);
-	bcm2835_set_power(host, true);
+	writel(SDVDD_POWER_ON, host->ioaddr + SDVDD);
 	msleep(20);
 	host->clock = 0;
 	writel(host->hcfg, host->ioaddr + SDHCFG);
@@ -1552,7 +1549,7 @@ static int bcm2835_remove(struct platform_device *pdev)
 
 	mmc_remove_host(host->mmc);
 
-	bcm2835_set_power(host, false);
+	writel(SDVDD_POWER_OFF, host->ioaddr + SDVDD);
 
 	free_irq(host->irq, host);
 
-- 
1.7.9.5




More information about the linux-rpi-kernel mailing list