diff options
Diffstat (limited to 'arch/arm/mach-s5pv210/setup-sdhci-gpio.c')
-rw-r--r-- | arch/arm/mach-s5pv210/setup-sdhci-gpio.c | 135 |
1 files changed, 89 insertions, 46 deletions
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c index 3e3ac05..0ecc905 100644 --- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c +++ b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c @@ -23,82 +23,125 @@ #include <plat/regs-sdhci.h> #include <plat/sdhci.h> +#include "herring.h" + void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) { - struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; - - /* Set all the necessary GPG0/GPG1 pins to special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG0(0), 2, S3C_GPIO_SFN(2)); + unsigned int gpio; switch (width) { + /* Channel 0 supports 4 and 8-bit bus width */ case 8: - /* GPG1[3:6] special-function 3 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(3)); + /* Set all the necessary GPIO function and pull up/down */ + for (gpio = S5PV210_GPG1(3); gpio <= S5PV210_GPG1(6); gpio++) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); + s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X); + } + + case 0: + case 1: case 4: - /* GPG0[3:6] special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG0(3), 4, S3C_GPIO_SFN(2)); - default: + /* Set all the necessary GPIO function and pull up/down */ + for (gpio = S5PV210_GPG0(0); gpio <= S5PV210_GPG0(6); gpio++) { + if (gpio != S5PV210_GPG0(2)) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); + } + s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X); + } break; + default: + printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width); + } + + if (machine_is_herring()) { + s3c_gpio_cfgpin(S5PV210_GPJ2(7), S3C_GPIO_OUTPUT); + s3c_gpio_setpull(S5PV210_GPJ2(7), S3C_GPIO_PULL_NONE); + gpio_set_value(S5PV210_GPJ2(7), 1); } - if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { - s3c_gpio_setpull(S5PV210_GPG0(2), S3C_GPIO_PULL_UP); - s3c_gpio_cfgpin(S5PV210_GPG0(2), S3C_GPIO_SFN(2)); + if (machine_is_herring()) { + gpio_direction_output(S5PV210_GPJ2(7), 1); + s3c_gpio_setpull(S5PV210_GPJ2(7), S3C_GPIO_PULL_NONE); } } void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) { - struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; + unsigned int gpio; - /* Set all the necessary GPG1[0:1] pins to special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG1(0), 2, S3C_GPIO_SFN(2)); - - /* Data pin GPG1[3:6] to special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(2)); - - if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { - s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP); - s3c_gpio_cfgpin(S5PV210_GPG1(2), S3C_GPIO_SFN(2)); + switch (width) { + /* Channel 1 supports 4-bit bus width */ + case 0: + case 1: + case 4: + /* Set all the necessary GPIO function and pull up/down */ + for (gpio = S5PV210_GPG1(0); gpio <= S5PV210_GPG1(6); gpio++) { + if (gpio != S5PV210_GPG1(2)) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); + } + s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X); + } + break; + default: + printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width); } } void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) { - struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; - - /* Set all the necessary GPG2[0:1] pins to special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG2(0), 2, S3C_GPIO_SFN(2)); + unsigned int gpio; switch (width) { + /* Channel 2 supports 4 and 8-bit bus width */ case 8: - /* Data pin GPG3[3:6] to special-function 3 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(3)); + /* Set all the necessary GPIO function and pull up/down */ + for (gpio = S5PV210_GPG3(3); gpio <= S5PV210_GPG3(6); gpio++) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); + s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X); + } + + case 0: + case 1: case 4: - /* Data pin GPG2[3:6] to special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG2(3), 4, S3C_GPIO_SFN(2)); - default: + if (machine_is_herring() && herring_is_cdma_wimax_dev()) + break; + /* Set all the necessary GPIO function and pull up/down */ + for (gpio = S5PV210_GPG2(0); gpio <= S5PV210_GPG2(6); gpio++) { + if (gpio != S5PV210_GPG2(2)) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); + } + s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X); + } break; - } - - if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { - s3c_gpio_setpull(S5PV210_GPG2(2), S3C_GPIO_PULL_UP); - s3c_gpio_cfgpin(S5PV210_GPG2(2), S3C_GPIO_SFN(2)); + default: + printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width); } } void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width) { - struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; - - /* Set all the necessary GPG3[0:1] pins to special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG3(0), 2, S3C_GPIO_SFN(2)); + unsigned int gpio; - /* Data pin GPG3[3:6] to special-function 2 */ - s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(2)); - - if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { - s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP); - s3c_gpio_cfgpin(S5PV210_GPG3(2), S3C_GPIO_SFN(2)); + switch (width) { + /* Channel 3 supports 4-bit bus width */ + case 0: + case 1: + case 4: + /* Set all the necessary GPIO function and pull up/down */ + for (gpio = S5PV210_GPG3(0); gpio <= S5PV210_GPG3(6); gpio++) { + if (gpio != S5PV210_GPG3(2)) { + s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); + s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); + } + s3c_gpio_set_drvstrength(gpio, S3C_GPIO_DRVSTR_2X); + } + break; + default: + printk(KERN_ERR "Wrong SD/MMC bus width : %d\n", width); } } |