diff options
author | lars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-03-05 02:56:25 +0000 |
---|---|---|
committer | lars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2010-03-05 02:56:25 +0000 |
commit | 474eca73a833826ab13ce37a9885b787f666025a (patch) | |
tree | 33bd0d9a5e1978bf3a7307ca4d9267ed52b52dc8 /target/linux/xburst/files-2.6.32/arch/mips/jz4740/gpio.c | |
parent | 03d2078bc26e389a66cbab30107adb5192e0b117 (diff) |
[xburst] jz4740 pm: Fix gpio suspend/resume. Turn pll off while in suspend and gate
clocks off which arn't handeld by their subsystems yet.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19984 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/xburst/files-2.6.32/arch/mips/jz4740/gpio.c')
-rw-r--r-- | target/linux/xburst/files-2.6.32/arch/mips/jz4740/gpio.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/target/linux/xburst/files-2.6.32/arch/mips/jz4740/gpio.c b/target/linux/xburst/files-2.6.32/arch/mips/jz4740/gpio.c index 30f83fa09..60d605384 100644 --- a/target/linux/xburst/files-2.6.32/arch/mips/jz4740/gpio.c +++ b/target/linux/xburst/files-2.6.32/arch/mips/jz4740/gpio.c @@ -106,6 +106,7 @@ int jz_gpio_set_function(int gpio, enum jz_gpio_function function) jz_gpio_write_bit(gpio, JZ_REG_GPIO_TRIGGER_CLEAR); } else { jz_gpio_write_bit(gpio, JZ_REG_GPIO_FUNC_SET); + jz_gpio_write_bit(gpio, JZ_REG_GPIO_TRIGGER_CLEAR); switch (function) { case JZ_GPIO_FUNC1: jz_gpio_write_bit(gpio, JZ_REG_GPIO_SELECT_CLEAR); @@ -164,7 +165,8 @@ void jz_gpio_bulk_suspend(const struct jz_gpio_bulk_request *request, size_t num for (i = 0; i < num; ++i, ++request) { jz_gpio_set_function(request->gpio, JZ_GPIO_FUNC_NONE); - jz_gpio_write_bit(request->gpio, JZ_REG_GPIO_DIRECTION_SET); + jz_gpio_write_bit(request->gpio, JZ_REG_GPIO_DIRECTION_CLEAR); + jz_gpio_write_bit(request->gpio, JZ_REG_GPIO_PULL_SET); } } EXPORT_SYMBOL_GPL(jz_gpio_bulk_suspend); @@ -431,20 +433,35 @@ static struct jz_gpio_chip jz_gpio_chips[] = { JZ_GPIO_CHIP(D), }; -static int jz_gpio_suspend(struct sys_device *dev, pm_message_t state) +int jz_gpio_suspend(void) { struct jz_gpio_chip *chip = jz_gpio_chips; int i, gpio; + for (i = 0; i < ARRAY_SIZE(jz_gpio_chips); ++i, ++chip) { gpio = chip->gpio_chip.base; chip->suspend_mask = readl(GPIO_TO_REG(gpio, JZ_REG_GPIO_MASK)); writel(~(chip->wakeup), GPIO_TO_REG(gpio, JZ_REG_GPIO_MASK_SET)); } + chip = jz_gpio_chips; +#if 0 + for (i = 0; i < ARRAY_SIZE(jz_gpio_chips); ++i, ++chip) { + printk("GPIO %d: \n", i); + printk("\tPin: %.8x\n", readl(CHIP_TO_REG(&chip->gpio_chip, JZ_REG_GPIO_PIN))); + printk("\tData: %.8x\n", readl(CHIP_TO_REG(&chip->gpio_chip, JZ_REG_GPIO_DATA))); + printk("\tPull: %.8x\n", readl(CHIP_TO_REG(&chip->gpio_chip, JZ_REG_GPIO_PULL))); + printk("\tFunc: %.8x\n", readl(CHIP_TO_REG(&chip->gpio_chip, JZ_REG_GPIO_FUNC))); + printk("\tSelect: %.8x\n", readl(CHIP_TO_REG(&chip->gpio_chip, JZ_REG_GPIO_SELECT))); + printk("\tDirection: %.8x\n", readl(CHIP_TO_REG(&chip->gpio_chip, JZ_REG_GPIO_DIRECTION))); + printk("\tTrigger: %.8x\n", readl(CHIP_TO_REG(&chip->gpio_chip, JZ_REG_GPIO_TRIGGER))); + } +#endif + return 0; } -static int jz_gpio_resume(struct sys_device *dev) +int jz_gpio_resume(void) { struct jz_gpio_chip *chip = jz_gpio_chips; int i; @@ -455,12 +472,6 @@ static int jz_gpio_resume(struct sys_device *dev) return 0; } -static struct sysdev_class jz_gpio_sysdev = { - .name = "JZ4740 GPIO", - .suspend = jz_gpio_suspend, - .resume = jz_gpio_resume, -}; - int __init jz_gpiolib_init(void) { struct jz_gpio_chip *chip = jz_gpio_chips; @@ -480,11 +491,7 @@ int __init jz_gpiolib_init(void) } } - sysdev_class_register(&jz_gpio_sysdev); - printk("JZ GPIO initalized\n"); return 0; } - - |