diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2010-04-08 02:39:38 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-04-14 11:08:18 -0400 |
commit | 808d97ccbe8e8251b1435e86c762965fd7e8a75e (patch) | |
tree | b45e594937a226c4d346240f9d3387c4cd8e5b8a | |
parent | 771dc157e06d69fcece0b2c8a29b9010345d8e9a (diff) |
ARM: 6033/1: ARM: MMCI: pass max frequency from platform
This introduce the field f_max into the mmci_platform_data,
making it possible to pass in a desired block clocking frequency
from a board configuration. This is often more desirable than
using a module parameter. We keep the module parameter as a
fallback as well as the default frequency specified for this
parameter if a parameter is not provided.
This also adds some kerneldoc style documentation to the
platform data struct in mmci.h.
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | drivers/mmc/host/mmci.c | 13 | ||||
-rw-r--r-- | include/linux/amba/mmci.h | 23 |
2 files changed, 34 insertions, 2 deletions
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 7e70c1a06d8a..ff115d920888 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -631,7 +631,18 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
631 | 631 | ||
632 | mmc->ops = &mmci_ops; | 632 | mmc->ops = &mmci_ops; |
633 | mmc->f_min = (host->mclk + 511) / 512; | 633 | mmc->f_min = (host->mclk + 511) / 512; |
634 | mmc->f_max = min(host->mclk, fmax); | 634 | /* |
635 | * If the platform data supplies a maximum operating | ||
636 | * frequency, this takes precedence. Else, we fall back | ||
637 | * to using the module parameter, which has a (low) | ||
638 | * default value in case it is not specified. Either | ||
639 | * value must not exceed the clock rate into the block, | ||
640 | * of course. | ||
641 | */ | ||
642 | if (plat->f_max) | ||
643 | mmc->f_max = min(host->mclk, plat->f_max); | ||
644 | else | ||
645 | mmc->f_max = min(host->mclk, fmax); | ||
635 | dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max); | 646 | dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max); |
636 | 647 | ||
637 | #ifdef CONFIG_REGULATOR | 648 | #ifdef CONFIG_REGULATOR |
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index 6b4241748dda..7e466fe72025 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h | |||
@@ -6,8 +6,29 @@ | |||
6 | 6 | ||
7 | #include <linux/mmc/host.h> | 7 | #include <linux/mmc/host.h> |
8 | 8 | ||
9 | /** | ||
10 | * struct mmci_platform_data - platform configuration for the MMCI | ||
11 | * (also known as PL180) block. | ||
12 | * @f_max: the maximum operational frequency for this host in this | ||
13 | * platform configuration. When this is specified it takes precedence | ||
14 | * over the module parameter for the same frequency. | ||
15 | * @ocr_mask: available voltages on the 4 pins from the block, this | ||
16 | * is ignored if a regulator is used, see the MMC_VDD_* masks in | ||
17 | * mmc/host.h | ||
18 | * @translate_vdd: a callback function to translate a MMC_VDD_* | ||
19 | * mask into a value to be binary or:ed and written into the | ||
20 | * MMCIPWR register of the block | ||
21 | * @status: if no GPIO read function was given to the block in | ||
22 | * gpio_wp (below) this function will be called to determine | ||
23 | * whether a card is present in the MMC slot or not | ||
24 | * @gpio_wp: read this GPIO pin to see if the card is write protected | ||
25 | * @gpio_cd: read this GPIO pin to detect card insertion | ||
26 | * @capabilities: the capabilities of the block as implemented in | ||
27 | * this platform, signify anything MMC_CAP_* from mmc/host.h | ||
28 | */ | ||
9 | struct mmci_platform_data { | 29 | struct mmci_platform_data { |
10 | unsigned int ocr_mask; /* available voltages */ | 30 | unsigned int f_max; |
31 | unsigned int ocr_mask; | ||
11 | u32 (*translate_vdd)(struct device *, unsigned int); | 32 | u32 (*translate_vdd)(struct device *, unsigned int); |
12 | unsigned int (*status)(struct device *); | 33 | unsigned int (*status)(struct device *); |
13 | int gpio_wp; | 34 | int gpio_wp; |