summaryrefslogtreecommitdiff
path: root/board/st/u8500/mmc_host.c
diff options
context:
space:
mode:
authorJoakim Axelsson <joakim.axelsson@stericsson.com>2010-10-20 14:11:49 +0200
committerMichael BRANDT <michael.brandt@stericsson.com>2010-12-08 16:20:27 +0100
commit307a253778d0918a8e0f10c2ea9a350450e37677 (patch)
tree4f41a9000a90c1b48e3778866abddb3db6eb8efa /board/st/u8500/mmc_host.c
parentc6b4e8c0340357c795f5898cf5e4141e845a2801 (diff)
db8500: New GPIO driver and config, from Linux kernel
Copied the GPIO configurator written for the Linux kernel. The Nomadik db8500 GPIO driver. Purpose is to be able to just cut-n-paste the GPIO config from Linux to U-boot. Also at the same time remove the obsolete and old gpio_alt_funcenable/disable methods. Now all is configured using a table in u8500.c. Now drivers doesn't have to worry about setting up the GPIO pins. Actually no driver today uses GPIO pins directly, only via hardware blocks within db8500. Functions are still added to be able to interact directly with a GPIO pin. This also cleaned up a lot of driver by not having to bit manipulate GPIO registers them self. The new driver is called db8500_gpio and placed in driver/gpio/. Functions are in include/db8500_gpio.h: void db8500_gpio_set_pull(unsigned gpio, enum db8500_gpio_pull pull); void db8500_gpio_make_input(unsigned gpio); int db8500_gpio_get_input(unsigned gpio); void db8500_gpio_make_output(unsigned gpio, int val); void db8500_gpio_set_output(unsigned gpio, int val); And for the configurator in include/db8500_pincfg.h: void db8500_gpio_config_pins(pin_cfg_t *cfgs, size_t num); All in all the final binary size has decreased. This is only done for db8500 nomadik GPIO. The code for gpio expanders has not been touched. All references to Nomadik has been removed in this driver. Only db8500 is left. ST-Ericsson ID: None Signed-off-by: Joakim Axelsson <joakim.axelsson@stericsson.com> Change-Id: I90aa1d46c813ffb5a777c3492b5751f5054f71cf Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/9904 Reviewed-by: QATOOLS Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com>
Diffstat (limited to 'board/st/u8500/mmc_host.c')
-rw-r--r--board/st/u8500/mmc_host.c62
1 files changed, 1 insertions, 61 deletions
diff --git a/board/st/u8500/mmc_host.c b/board/st/u8500/mmc_host.c
index 8a2e0b3dd..a4f4de9bf 100644
--- a/board/st/u8500/mmc_host.c
+++ b/board/st/u8500/mmc_host.c
@@ -14,10 +14,10 @@
#define DBG_LVL_INFO (1)
#define DBG_LVL_VERBOSE (2)
+#include <asm/io.h>
#include <asm/arch/common.h>
#include <asm/arch/cpu.h>
#include <mmc.h>
-#include <asm/arch/gpio.h>
#include "mmc_host.h"
#include <malloc.h>
#include <div64.h>
@@ -449,15 +449,6 @@ struct mmc *alloc_mmc_struct(void)
return NULL;
}
-static int host_poweroff(struct mmc *dev)
-{
- struct mmc_host *host = dev->priv;
- u32 sdi_pwr = ~SDI_PWR_PWRCTRL_ON;
- debugX(DBG_LVL_VERBOSE, "SDI_PWR <= 0x%08X\n", sdi_pwr);
- writel(sdi_pwr, &host->base->power);
- return 0;
-}
-
/*
* emmc_host_init - initialize the emmc controller.
* Configure GPIO settings, set initial clock and power for emmc slot.
@@ -466,38 +457,15 @@ static int host_poweroff(struct mmc *dev)
static int emmc_host_init(struct mmc *dev)
{
struct mmc_host *host = dev->priv;
- gpio_error gpioerror;
u32 sdi_u32;
/* TODO: Investigate what is actually needed of the below. */
if (u8500_is_earlydrop()) {
debugX(DBG_LVL_VERBOSE, "configuring EMMC for ED\n");
- /* Initialize the gpio alternate function for eMMC */
- struct gpio_register *p_gpio_register =
- (void *)IO_ADDRESS(CFG_GPIO_6_BASE);
- p_gpio_register->gpio_dats |= 0x0000FFE0;
- p_gpio_register->gpio_pdis &= ~0x0000FFE0;
-
- gpioerror = gpio_altfuncenable(GPIO_ALT_EMMC, "EMMC");
- if (GPIO_OK != gpioerror) {
- printf(
- "emmc_host_init() gpio_altfuncenable %d failed\n",
- gpioerror);
- goto end;
- }
-
host->base = (struct sdi_registers *)CFG_EMMC_BASE_ED;
} else {
debugX(DBG_LVL_VERBOSE, "configuring EMMC for V1\n");
- /* enable the alternate function of PoP EMMC */
- gpioerror = gpio_altfuncenable(GPIO_ALT_POP_EMMC, "EMMC");
- if (gpioerror != GPIO_OK) {
- printf(
- "emmc_host_init() gpio_altfuncenable %d failed \n",
- gpioerror);
- goto end;
- }
host->base = (struct sdi_registers *)CFG_EMMC_BASE_V1;
}
@@ -524,15 +492,6 @@ static int emmc_host_init(struct mmc *dev)
dev->f_max = MCLK / 2;
dev->ddr_en = 0;
return 0;
-
- end:
- if (u8500_is_earlydrop())
- gpio_altfuncdisable(GPIO_ALT_EMMC, "EMMC");
- else
- gpio_altfuncdisable(GPIO_ALT_POP_EMMC, "EMMC");
-
- host_poweroff(dev);
- return MMC_UNSUPPORTED_HW;
}
/*
@@ -543,22 +502,8 @@ static int emmc_host_init(struct mmc *dev)
static int mmc_host_init(struct mmc *dev)
{
struct mmc_host *host = dev->priv;
- gpio_error gpioerror;
- struct gpio_register *gpio_base_address;
u32 sdi_u32;
- gpio_base_address = (void *) IO_ADDRESS(CFG_GPIO_0_BASE);
- gpio_base_address->gpio_dats |= 0xFFC0000;
- gpio_base_address->gpio_pdis &= ~0xFFC0000;
-
- /* save the GPIO0 AFSELA register */
- gpioerror = gpio_altfuncenable(GPIO_ALT_SD_CARD0, "MMC");
- if (gpioerror != GPIO_OK) {
- printf("mmc_host_init() gpio_altfuncenable %d failed \n",
- gpioerror);
- goto end;
- }
-
host->base = (struct sdi_registers *)CFG_MMC_BASE;
sdi_u32 = 0xBF;
debugX(DBG_LVL_VERBOSE, "SDI_PWR <= 0x%08X\n", sdi_u32);
@@ -583,11 +528,6 @@ static int mmc_host_init(struct mmc *dev)
dev->f_max = MCLK / 2;
dev->ddr_en = 0;
return 0;
-
- end:
- gpio_altfuncdisable(GPIO_ALT_SD_CARD0, "MMC");
- host_poweroff(dev);
- return MMC_UNSUPPORTED_HW;
}
/*