PATCH: Enable sdhci-bcm2708 build as a module

Tom Cook tom.k.cook at gmail.com
Wed Jun 26 10:39:10 EDT 2013


See the patch below.  In summary:
 * arch/arm/mach-bcm2708/bcm2708.c modified so that the platform
device is created for both built-in and module cases.  Also export
symbol frc_clock_ticks32.
 * Move the enable_llm parameter from sdhci-bcm2708 to sdhci - that is
where it is used.
 * Export sdhci_spin_lock and sdhci_spin_unlock from sdhci.c.

The patch is against the 3.8.y branch but not much seems to have
changed here in other branches.  Tested on RPI model B.

What's the right process to get this into the github repository?

Regards,
Tom

>From ca4afa3722b4f6c95fa61f5bb570c41abdc25702 Mon Sep 17 00:00:00 2001
From: Tom Cook <tom at ringer>
Date: Wed, 26 Jun 2013 15:30:02 +0100
Subject: [PATCH] Made sdhci-bcm2708 compilable as a module.

---
 arch/arm/mach-bcm2708/bcm2708.c  |    6 ++++--
 drivers/mmc/host/sdhci-bcm2708.c |    5 -----
 drivers/mmc/host/sdhci.c         |   12 +++++++++---
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 4f15872..f747493 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -187,6 +187,7 @@ unsigned long frc_clock_ticks32(void)
 {
  return timer_read();
 }
+EXPORT_SYMBOL_GPL(frc_clock_ticks32);

 static void __init bcm2708_clocksource_init(void)
 {
@@ -463,7 +464,8 @@ static struct platform_device bcm2708_systemtimer_device = {
  },
 };

-#ifdef CONFIG_MMC_SDHCI_BCM2708 /* Arasan emmc SD */
+/* Arasan emmc SD */
+#if defined CONFIG_MMC_SDHCI_BCM2708 | defined CONFIG_MMC_SDHCI_BCM2708_MODULE
 static struct resource bcm2708_emmc_resources[] = {
  [0] = {
        .start = EMMC_BASE,
@@ -735,7 +737,7 @@ void __init bcm2708_init(void)
  bcm_register_device(&bcm2708_uart1_device);
  bcm_register_device(&bcm2708_powerman_device);

-#ifdef CONFIG_MMC_SDHCI_BCM2708
+#if defined CONFIG_MMC_SDHCI_BCM2708 | defined CONFIG_MMC_SDHCI_BCM2708_MODULE
  bcm_register_device(&bcm2708_emmc_device);
 #endif
  bcm2708_init_led();
diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c
index c2409b9..3a9cd3a 100644
--- a/drivers/mmc/host/sdhci-bcm2708.c
+++ b/drivers/mmc/host/sdhci-bcm2708.c
@@ -138,7 +138,6 @@ static int emmc_clock_freq = BCM2708_EMMC_CLOCK_FREQ;
 static bool sync_after_dma = 1;
 static bool missing_status = 1;
 static bool spurious_crc_acmd51 = 0;
-bool enable_llm = 1;
 bool extra_messages = 0;

 #if 0
@@ -1204,8 +1203,6 @@ static int sdhci_bcm2708_probe(struct
platform_device *pdev)
  }


- printk("sdhci: %s low-latency mode\n",enable_llm?"Enable":"Disable");
-
  host->hw_name = "BCM2708_Arasan";
  host->ops = &sdhci_bcm2708_ops;
  host->irq = platform_get_irq(pdev, 0);
@@ -1400,7 +1397,6 @@ module_param(emmc_clock_freq, int, 0444);
 module_param(sync_after_dma, bool, 0444);
 module_param(missing_status, bool, 0444);
 module_param(spurious_crc_acmd51, bool, 0444);
-module_param(enable_llm, bool, 0444);
 module_param(cycle_delay, int, 0444);
 module_param(extra_messages, bool, 0444);

@@ -1414,7 +1410,6 @@ MODULE_PARM_DESC(emmc_clock_freq, "Specify the
speed of emmc clock");
 MODULE_PARM_DESC(sync_after_dma, "Block in driver until dma complete");
 MODULE_PARM_DESC(missing_status, "Use the missing status quirk");
 MODULE_PARM_DESC(spurious_crc_acmd51, "Use the spurious crc quirk for
reading SCR (ACMD51)");
-MODULE_PARM_DESC(enable_llm, "Enable low-latency mode");
 MODULE_PARM_DESC(extra_messages, "Enable more sdcard warning messages");


diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 134154b..cbd4fce 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -123,7 +123,8 @@ static void sdhci_dumpregs(struct sdhci_host *host)
  * Low level functions                                                       *
  *                                                                           *
 \*****************************************************************************/
-extern bool enable_llm;
+bool enable_llm = 1;
+EXPORT_SYMBOL_GPL(enable_llm);
 static int sdhci_locked=0;
 void sdhci_spin_lock(struct sdhci_host *host)
 {
@@ -138,6 +139,7 @@ void sdhci_spin_lock(struct sdhci_host *host)
  }
 #endif
 }
+EXPORT_SYMBOL_GPL(sdhci_spin_lock);

 void sdhci_spin_unlock(struct sdhci_host *host)
 {
@@ -152,6 +154,7 @@ void sdhci_spin_unlock(struct sdhci_host *host)
 #endif
  spin_unlock(&host->lock);
 }
+EXPORT_SYMBOL_GPL(sdhci_spin_unlock);

 void sdhci_spin_lock_irqsave(struct sdhci_host *host,unsigned long *flags)
 {
@@ -1280,9 +1283,9 @@ static void sdhci_set_clock(struct sdhci_host
*host, unsigned int clock)
  return;
  }
  timeout--;
- sdhci_spin_enable_schedule(host);
+ //sdhci_spin_enable_schedule(host);
  mdelay(1);
- sdhci_spin_disable_schedule(host);
+ //sdhci_spin_disable_schedule(host);
  }

  clk |= SDHCI_CLOCK_CARD_EN;
@@ -3402,6 +3405,7 @@ module_exit(sdhci_drv_exit);

 module_param(debug_quirks, uint, 0444);
 module_param(debug_quirks2, uint, 0444);
+module_param(enable_llm, bool, 0444);

 MODULE_AUTHOR("Pierre Ossman <pierre at ossman.eu>");
 MODULE_DESCRIPTION("Secure Digital Host Controller Interface core driver");
@@ -3409,3 +3413,5 @@ MODULE_LICENSE("GPL");

 MODULE_PARM_DESC(debug_quirks, "Force certain quirks.");
 MODULE_PARM_DESC(debug_quirks2, "Force certain other quirks.");
+MODULE_PARM_DESC(enable_llm, "Enable low-latency mode");
+
--
1.7.9.5



More information about the linux-rpi-kernel mailing list