diff --git a/target/linux/xburst/files-2.6.31/arch/mips/include/asm/mach-jz4740/gpio.h b/target/linux/xburst/files-2.6.31/arch/mips/include/asm/mach-jz4740/gpio.h index 8723d4214..00253964a 100644 --- a/target/linux/xburst/files-2.6.31/arch/mips/include/asm/mach-jz4740/gpio.h +++ b/target/linux/xburst/files-2.6.31/arch/mips/include/asm/mach-jz4740/gpio.h @@ -19,13 +19,12 @@ #include enum jz_gpio_function { - JZ_GPIO_FUNC_NONE, - JZ_GPIO_FUNC1, - JZ_GPIO_FUNC2, - JZ_GPIO_FUNC3, + JZ_GPIO_FUNC_NONE, + JZ_GPIO_FUNC1, + JZ_GPIO_FUNC2, + JZ_GPIO_FUNC3, }; - /* Usually a driver for a SoC component has to request several gpio pins and configure them as funcion pins. @@ -39,13 +38,13 @@ enum jz_gpio_function { inside the probe function: - ret = jz_gpio_bulk_request(i2c_pins, ARRAY_SIZE(i2c_pins)); - if (ret) { + ret = jz_gpio_bulk_request(i2c_pins, ARRAY_SIZE(i2c_pins)); + if (ret) { ... inside the remove function: - jz_gpio_bulk_free(i2c_pins, ARRAY_SIZE(i2c_pins)); + jz_gpio_bulk_free(i2c_pins, ARRAY_SIZE(i2c_pins)); */ @@ -56,13 +55,15 @@ struct jz_gpio_bulk_request { }; #define JZ_GPIO_BULK_PIN(pin) { \ - .gpio = JZ_GPIO_ ## pin, \ - .name = #pin, \ - .function = JZ_GPIO_FUNC_ ## pin \ + .gpio = JZ_GPIO_ ## pin, \ + .name = #pin, \ + .function = JZ_GPIO_FUNC_ ## pin \ } int jz_gpio_bulk_request(const struct jz_gpio_bulk_request *request, size_t num); void jz_gpio_bulk_free(const struct jz_gpio_bulk_request *request, size_t num); +void jz_gpio_bulk_suspend(const struct jz_gpio_bulk_request *request, size_t num); +void jz_gpio_bulk_resume(const struct jz_gpio_bulk_request *request, size_t num); void jz_gpio_enable_pullup(unsigned gpio); void jz_gpio_disable_pullup(unsigned gpio); int jz_gpio_set_function(int gpio, enum jz_gpio_function function); @@ -192,7 +193,7 @@ int jz_gpio_set_function(int gpio, enum jz_gpio_function function); #define JZ_GPIO_FUNC_MEM_ADDR14 JZ_GPIO_FUNC1 #define JZ_GPIO_FUNC_MEM_ADDR15 JZ_GPIO_FUNC1 #define JZ_GPIO_FUNC_MEM_ADDR16 JZ_GPIO_FUNC1 -#define JZ_GPIO_FUNC_MEM_CLS JZ_GPIO_FUNC1 +#define JZ_GPIO_FUNC_MEM_CLS JZ_GPIO_FUNC1 #define JZ_GPIO_FUNC_MEM_SPL JZ_GPIO_FUNC1 #define JZ_GPIO_FUNC_MEM_DCS JZ_GPIO_FUNC1 #define JZ_GPIO_FUNC_MEM_RAS JZ_GPIO_FUNC1 diff --git a/target/linux/xburst/files-2.6.31/arch/mips/jz4740/gpio.c b/target/linux/xburst/files-2.6.31/arch/mips/jz4740/gpio.c index 12189909d..79f406631 100644 --- a/target/linux/xburst/files-2.6.31/arch/mips/jz4740/gpio.c +++ b/target/linux/xburst/files-2.6.31/arch/mips/jz4740/gpio.c @@ -78,6 +78,7 @@ #define GPIO_TO_SEL_REG(gpio) GPIO_TO_REG(gpio, 0x50) #define GPIO_TO_SEL_SET_REG(gpio) GPIO_TO_REG(gpio, 0x54) #define GPIO_TO_SEL_CLEAR_REG(gpio) GPIO_TO_REG(gpio, 0x58) +#define GPIO_TO_DIRECTION_CLEAR_REG(chip) GPIO_TO_REG(chip, 0x68) #define GPIO_TO_TRIGGER_REG(gpio) GPIO_TO_REG(gpio, 0x70) #define GPIO_TO_TRIGGER_SET_REG(gpio) GPIO_TO_REG(gpio, 0x74) #define GPIO_TO_TRIGGER_CLEAR_REG(gpio) GPIO_TO_REG(gpio, 0x78) @@ -162,6 +163,28 @@ void jz_gpio_bulk_free(const struct jz_gpio_bulk_request *request, size_t num) } EXPORT_SYMBOL_GPL(jz_gpio_bulk_free); +void jz_gpio_bulk_suspend(const struct jz_gpio_bulk_request *request, size_t num) +{ + size_t i; + + for (i = 0; i < num; ++i, ++request) { + jz_gpio_set_function(request->gpio, JZ_GPIO_FUNC_NONE); + writel(BIT(request->gpio), GPIO_TO_DIRECTION_CLEAR_REG(request->gpio)); + } +} +EXPORT_SYMBOL_GPL(jz_gpio_bulk_suspend); + +void jz_gpio_bulk_resume(const struct jz_gpio_bulk_request *request, size_t num) +{ + size_t i; + + for (i = 0; i < num; ++i, ++request) { + jz_gpio_set_function(request->gpio, request->function); + } +} +EXPORT_SYMBOL_GPL(jz_gpio_bulk_resume); + + void jz_gpio_enable_pullup(unsigned gpio) { writel(GPIO_TO_BIT(gpio), GPIO_TO_PULL_CLEAR_REG(gpio)); diff --git a/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c b/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c index eba4a0656..f46c691f4 100644 --- a/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c +++ b/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c @@ -45,7 +45,6 @@ #define JZ_REG_MMC_RXFIFO 0x38 #define JZ_REG_MMC_TXFIFO 0x3C - #define JZ_MMC_STRPCL_EXIT_MULTIPLE BIT(7) #define JZ_MMC_STRPCL_EXIT_TRANSFER BIT(6) #define JZ_MMC_STRPCL_START_READWAIT BIT(5)