1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-25 07:41:09 +02:00

[rdc] fix panic on boot due to invalid IORESOURCE for MFD cells, fix gpio value setting

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21459 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2010-05-15 21:26:56 +00:00
parent 255ca55ed2
commit b03ef8fa0b
6 changed files with 61 additions and 45 deletions

View File

@ -79,7 +79,7 @@ Changes from v2:
+ .name = "wdt-reg", + .name = "wdt-reg",
+ .start = RDC321X_WDT_CTRL, + .start = RDC321X_WDT_CTRL,
+ .end = RDC321X_WDT_CTRL + 0x3, + .end = RDC321X_WDT_CTRL + 0x3,
+ .flags = IORESOURCE_MEM, + .flags = IORESOURCE_IO,
+ } + }
+}; +};
+ +
@ -92,12 +92,12 @@ Changes from v2:
+ .name = "gpio-reg1", + .name = "gpio-reg1",
+ .start = RDC321X_GPIO_CTRL_REG1, + .start = RDC321X_GPIO_CTRL_REG1,
+ .end = RDC321X_GPIO_CTRL_REG1 + 0x7, + .end = RDC321X_GPIO_CTRL_REG1 + 0x7,
+ .flags = IORESOURCE_MEM, + .flags = IORESOURCE_IO,
+ }, { + }, {
+ .name = "gpio-reg2", + .name = "gpio-reg2",
+ .start = RDC321X_GPIO_CTRL_REG2, + .start = RDC321X_GPIO_CTRL_REG2,
+ .end = RDC321X_GPIO_CTRL_REG2 + 0x7, + .end = RDC321X_GPIO_CTRL_REG2 + 0x7,
+ .flags = IORESOURCE_MEM, + .flags = IORESOURCE_IO,
+ } + }
+}; +};
+ +

View File

@ -109,7 +109,7 @@ Changes from v2:
+ gpch->data_reg[reg] &= ~(1 << (gpio & 0x1f)); + gpch->data_reg[reg] &= ~(1 << (gpio & 0x1f));
+ +
+ pci_write_config_dword(gpch->sb_pdev, + pci_write_config_dword(gpch->sb_pdev,
+ reg ? gpch->reg1_data_base : gpch->reg2_data_base, + reg ? gpch->reg2_data_base : gpch->reg1_data_base,
+ gpch->data_reg[reg]); + gpch->data_reg[reg]);
+} +}
+ +
@ -171,7 +171,7 @@ Changes from v2:
+ struct rdc321x_gpio *rdc321x_gpio_dev; + struct rdc321x_gpio *rdc321x_gpio_dev;
+ struct rdc321x_gpio_pdata *pdata; + struct rdc321x_gpio_pdata *pdata;
+ +
+ pdata = pdev->dev.platform_data; + pdata = pdev->dev.driver_data;
+ if (!pdata) { + if (!pdata) {
+ dev_err(&pdev->dev, "no platform data supplied\n"); + dev_err(&pdev->dev, "no platform data supplied\n");
+ return -ENODEV; + return -ENODEV;
@ -183,7 +183,7 @@ Changes from v2:
+ return -ENOMEM; + return -ENOMEM;
+ } + }
+ +
+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpio-reg1"); + r = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpio-reg1");
+ if (!r) { + if (!r) {
+ dev_err(&pdev->dev, "failed to get gpio-reg1 resource\n"); + dev_err(&pdev->dev, "failed to get gpio-reg1 resource\n");
+ err = -ENODEV; + err = -ENODEV;
@ -195,7 +195,7 @@ Changes from v2:
+ rdc321x_gpio_dev->reg1_ctrl_base = r->start; + rdc321x_gpio_dev->reg1_ctrl_base = r->start;
+ rdc321x_gpio_dev->reg1_data_base = r->start + 0x4; + rdc321x_gpio_dev->reg1_data_base = r->start + 0x4;
+ +
+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpio-reg2"); + r = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpio-reg2");
+ if (!r) { + if (!r) {
+ dev_err(&pdev->dev, "failed to get gpio-reg2 resource\n"); + dev_err(&pdev->dev, "failed to get gpio-reg2 resource\n");
+ err = -ENODEV; + err = -ENODEV;

View File

@ -106,13 +106,13 @@ Changes from v2:
+ struct resource *r; + struct resource *r;
+ struct rdc321x_wdt_pdata *pdata; + struct rdc321x_wdt_pdata *pdata;
+ +
+ pdata = pdev->dev.platform_data; + pdata = pdev->dev.driver_data;
+ if (!pdata) { + if (!pdata) {
+ dev_err(&pdev->dev, "no platform data supplied\n"); + dev_err(&pdev->dev, "no platform data supplied\n");
+ return -ENODEV; + return -ENODEV;
+ } + }
+ +
+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wdt-reg"); + r = platform_get_resource_byname(pdev, IORESOURCE_IO, "wdt-reg");
+ if (!r) { + if (!r) {
+ dev_err(&pdev->dev, "failed to get wdt-reg resource\n"); + dev_err(&pdev->dev, "failed to get wdt-reg resource\n");
+ return -ENODEV; + return -ENODEV;

View File

@ -11,9 +11,11 @@ Changes from v2:
- removed pci_dev accessors - removed pci_dev accessors
- use DEFINE_PCI_DEVICE_TABLE - use DEFINE_PCI_DEVICE_TABLE
--- a/drivers/mfd/Kconfig Index: linux-2.6.32.10/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig ===================================================================
@@ -305,6 +305,15 @@ config EZX_PCAP --- linux-2.6.32.10.orig/drivers/mfd/Kconfig 2010-03-15 16:52:04.000000000 +0100
+++ linux-2.6.32.10/drivers/mfd/Kconfig 2010-05-15 21:48:27.000000000 +0200
@@ -305,6 +305,15 @@
This enables the PCAP ASIC present on EZX Phones. This is This enables the PCAP ASIC present on EZX Phones. This is
needed for MMC, TouchScreen, Sound, USB, etc.. needed for MMC, TouchScreen, Sound, USB, etc..
@ -29,16 +31,20 @@ Changes from v2:
endmenu endmenu
menu "Multimedia Capabilities Port drivers" menu "Multimedia Capabilities Port drivers"
--- a/drivers/mfd/Makefile Index: linux-2.6.32.10/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile ===================================================================
@@ -50,3 +50,5 @@ obj-$(CONFIG_PCF50633_ADC) += pcf50633-a --- linux-2.6.32.10.orig/drivers/mfd/Makefile 2010-03-15 16:52:04.000000000 +0100
+++ linux-2.6.32.10/drivers/mfd/Makefile 2010-05-15 21:48:27.000000000 +0200
@@ -50,3 +50,5 @@
obj-$(CONFIG_PCF50633_GPIO) += pcf50633-gpio.o obj-$(CONFIG_PCF50633_GPIO) += pcf50633-gpio.o
obj-$(CONFIG_AB3100_CORE) += ab3100-core.o obj-$(CONFIG_AB3100_CORE) += ab3100-core.o
obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o
+ +
+obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o +obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o
--- /dev/null Index: linux-2.6.32.10/drivers/mfd/rdc321x-southbridge.c
+++ b/drivers/mfd/rdc321x-southbridge.c ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.32.10/drivers/mfd/rdc321x-southbridge.c 2010-05-15 22:53:39.000000000 +0200
@@ -0,0 +1,123 @@ @@ -0,0 +1,123 @@
+/* +/*
+ * RDC321x MFD southbrige driver + * RDC321x MFD southbrige driver
@ -76,7 +82,7 @@ Changes from v2:
+ .name = "wdt-reg", + .name = "wdt-reg",
+ .start = RDC321X_WDT_CTRL, + .start = RDC321X_WDT_CTRL,
+ .end = RDC321X_WDT_CTRL + 0x3, + .end = RDC321X_WDT_CTRL + 0x3,
+ .flags = IORESOURCE_MEM, + .flags = IORESOURCE_IO,
+ } + }
+}; +};
+ +
@ -89,12 +95,12 @@ Changes from v2:
+ .name = "gpio-reg1", + .name = "gpio-reg1",
+ .start = RDC321X_GPIO_CTRL_REG1, + .start = RDC321X_GPIO_CTRL_REG1,
+ .end = RDC321X_GPIO_CTRL_REG1 + 0x7, + .end = RDC321X_GPIO_CTRL_REG1 + 0x7,
+ .flags = IORESOURCE_MEM, + .flags = IORESOURCE_IO,
+ }, { + }, {
+ .name = "gpio-reg2", + .name = "gpio-reg2",
+ .start = RDC321X_GPIO_CTRL_REG2, + .start = RDC321X_GPIO_CTRL_REG2,
+ .end = RDC321X_GPIO_CTRL_REG2 + 0x7, + .end = RDC321X_GPIO_CTRL_REG2 + 0x7,
+ .flags = IORESOURCE_MEM, + .flags = IORESOURCE_IO,
+ } + }
+}; +};
+ +
@ -163,8 +169,10 @@ Changes from v2:
+MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>"); +MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
+MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("RDC R-321x MFD southbridge driver"); +MODULE_DESCRIPTION("RDC R-321x MFD southbridge driver");
--- /dev/null Index: linux-2.6.32.10/include/linux/mfd/rdc321x.h
+++ b/include/linux/mfd/rdc321x.h ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.32.10/include/linux/mfd/rdc321x.h 2010-05-15 21:48:27.000000000 +0200
@@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
+#ifndef __RDC321X_MFD_H +#ifndef __RDC321X_MFD_H
+#define __RDC321X_MFD_H +#define __RDC321X_MFD_H

View File

@ -8,9 +8,11 @@ Changes from v2:
- use the pci_dev pointer passed as platform data - use the pci_dev pointer passed as platform data
- replaced rdc321x_pci_{read,write} - replaced rdc321x_pci_{read,write}
--- a/drivers/gpio/Kconfig Index: linux-2.6.32.10/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig ===================================================================
@@ -196,6 +196,14 @@ config GPIO_LANGWELL --- linux-2.6.32.10.orig/drivers/gpio/Kconfig 2010-05-15 22:54:31.000000000 +0200
+++ linux-2.6.32.10/drivers/gpio/Kconfig 2010-05-15 22:54:51.000000000 +0200
@@ -196,6 +196,14 @@
help help
Say Y here to support Intel Moorestown platform GPIO. Say Y here to support Intel Moorestown platform GPIO.
@ -25,15 +27,19 @@ Changes from v2:
comment "SPI GPIO expanders:" comment "SPI GPIO expanders:"
config GPIO_MAX7301 config GPIO_MAX7301
--- a/drivers/gpio/Makefile Index: linux-2.6.32.10/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile ===================================================================
@@ -19,3 +19,4 @@ obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio --- linux-2.6.32.10.orig/drivers/gpio/Makefile 2010-05-15 22:54:31.000000000 +0200
+++ linux-2.6.32.10/drivers/gpio/Makefile 2010-05-15 22:54:51.000000000 +0200
@@ -19,3 +19,4 @@
obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o
obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o
obj-$(CONFIG_GPIO_WM831X) += wm831x-gpio.o obj-$(CONFIG_GPIO_WM831X) += wm831x-gpio.o
+obj-$(CONFIG_GPIO_RDC321X) += rdc321x-gpio.o +obj-$(CONFIG_GPIO_RDC321X) += rdc321x-gpio.o
--- /dev/null Index: linux-2.6.32.10/drivers/gpio/rdc321x-gpio.c
+++ b/drivers/gpio/rdc321x-gpio.c ===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.32.10/drivers/gpio/rdc321x-gpio.c 2010-05-15 22:55:10.000000000 +0200
@@ -0,0 +1,245 @@ @@ -0,0 +1,245 @@
+/* +/*
+ * RDC321x GPIO driver + * RDC321x GPIO driver
@ -109,7 +115,7 @@ Changes from v2:
+ gpch->data_reg[reg] &= ~(1 << (gpio & 0x1f)); + gpch->data_reg[reg] &= ~(1 << (gpio & 0x1f));
+ +
+ pci_write_config_dword(gpch->sb_pdev, + pci_write_config_dword(gpch->sb_pdev,
+ reg ? gpch->reg1_data_base : gpch->reg2_data_base, + reg ? gpch->reg2_data_base : gpch->reg1_data_base,
+ gpch->data_reg[reg]); + gpch->data_reg[reg]);
+} +}
+ +
@ -171,7 +177,7 @@ Changes from v2:
+ struct rdc321x_gpio *rdc321x_gpio_dev; + struct rdc321x_gpio *rdc321x_gpio_dev;
+ struct rdc321x_gpio_pdata *pdata; + struct rdc321x_gpio_pdata *pdata;
+ +
+ pdata = pdev->dev.platform_data; + pdata = platform_get_drvdata(pdev);
+ if (!pdata) { + if (!pdata) {
+ dev_err(&pdev->dev, "no platform data supplied\n"); + dev_err(&pdev->dev, "no platform data supplied\n");
+ return -ENODEV; + return -ENODEV;
@ -183,7 +189,7 @@ Changes from v2:
+ return -ENOMEM; + return -ENOMEM;
+ } + }
+ +
+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpio-reg1"); + r = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpio-reg1");
+ if (!r) { + if (!r) {
+ dev_err(&pdev->dev, "failed to get gpio-reg1 resource\n"); + dev_err(&pdev->dev, "failed to get gpio-reg1 resource\n");
+ err = -ENODEV; + err = -ENODEV;
@ -195,7 +201,7 @@ Changes from v2:
+ rdc321x_gpio_dev->reg1_ctrl_base = r->start; + rdc321x_gpio_dev->reg1_ctrl_base = r->start;
+ rdc321x_gpio_dev->reg1_data_base = r->start + 0x4; + rdc321x_gpio_dev->reg1_data_base = r->start + 0x4;
+ +
+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpio-reg2"); + r = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpio-reg2");
+ if (!r) { + if (!r) {
+ dev_err(&pdev->dev, "failed to get gpio-reg2 resource\n"); + dev_err(&pdev->dev, "failed to get gpio-reg2 resource\n");
+ err = -ENODEV; + err = -ENODEV;

View File

@ -10,8 +10,10 @@ Changes from v2:
- replaced rdc321x_pci_{read,write} - replaced rdc321x_pci_{read,write}
- use the pci_dev pointer passed as platform_data - use the pci_dev pointer passed as platform_data
--- a/drivers/watchdog/rdc321x_wdt.c Index: linux-2.6.32.10/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c ===================================================================
--- linux-2.6.32.10.orig/drivers/watchdog/rdc321x_wdt.c 2010-05-15 22:14:28.000000000 +0200
+++ linux-2.6.32.10/drivers/watchdog/rdc321x_wdt.c 2010-05-15 22:15:24.000000000 +0200
@@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
/* /*
* RDC321x watchdog driver * RDC321x watchdog driver
@ -31,7 +33,7 @@ Changes from v2:
#define RDC_WDT_MASK 0x80000000 /* Mask */ #define RDC_WDT_MASK 0x80000000 /* Mask */
#define RDC_WDT_EN 0x00800000 /* Enable bit */ #define RDC_WDT_EN 0x00800000 /* Enable bit */
@@ -63,6 +62,8 @@ static struct { @@ -63,6 +62,8 @@
int default_ticks; int default_ticks;
unsigned long inuse; unsigned long inuse;
spinlock_t lock; spinlock_t lock;
@ -40,7 +42,7 @@ Changes from v2:
} rdc321x_wdt_device; } rdc321x_wdt_device;
/* generic helper functions */ /* generic helper functions */
@@ -70,14 +71,18 @@ static struct { @@ -70,14 +71,18 @@
static void rdc321x_wdt_trigger(unsigned long unused) static void rdc321x_wdt_trigger(unsigned long unused)
{ {
unsigned long flags; unsigned long flags;
@ -61,7 +63,7 @@ Changes from v2:
spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags);
/* requeue?? */ /* requeue?? */
@@ -105,10 +110,13 @@ static void rdc321x_wdt_start(void) @@ -105,10 +110,13 @@
/* Clear the timer */ /* Clear the timer */
spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); spin_lock_irqsave(&rdc321x_wdt_device.lock, flags);
@ -77,7 +79,7 @@ Changes from v2:
spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags);
mod_timer(&rdc321x_wdt_device.timer, mod_timer(&rdc321x_wdt_device.timer,
@@ -148,7 +156,7 @@ static long rdc321x_wdt_ioctl(struct fil @@ -148,7 +156,7 @@
unsigned long arg) unsigned long arg)
{ {
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
@ -86,7 +88,7 @@ Changes from v2:
static struct watchdog_info ident = { static struct watchdog_info ident = {
.options = WDIOF_CARDRESET, .options = WDIOF_CARDRESET,
.identity = "RDC321x WDT", .identity = "RDC321x WDT",
@@ -162,9 +170,10 @@ static long rdc321x_wdt_ioctl(struct fil @@ -162,9 +170,10 @@
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
/* Read the value from the DATA register */ /* Read the value from the DATA register */
spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); spin_lock_irqsave(&rdc321x_wdt_device.lock, flags);
@ -99,20 +101,20 @@ Changes from v2:
return -EFAULT; return -EFAULT;
break; break;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
@@ -219,17 +228,35 @@ static struct miscdevice rdc321x_wdt_mis @@ -219,17 +228,35 @@
static int __devinit rdc321x_wdt_probe(struct platform_device *pdev) static int __devinit rdc321x_wdt_probe(struct platform_device *pdev)
{ {
int err; int err;
+ struct resource *r; + struct resource *r;
+ struct rdc321x_wdt_pdata *pdata; + struct rdc321x_wdt_pdata *pdata;
+ +
+ pdata = pdev->dev.platform_data; + pdata = platform_get_drvdata(pdev);
+ if (!pdata) { + if (!pdata) {
+ dev_err(&pdev->dev, "no platform data supplied\n"); + dev_err(&pdev->dev, "no platform data supplied\n");
+ return -ENODEV; + return -ENODEV;
+ } + }
+ +
+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wdt-reg"); + r = platform_get_resource_byname(pdev, IORESOURCE_IO, "wdt-reg");
+ if (!r) { + if (!r) {
+ dev_err(&pdev->dev, "failed to get wdt-reg resource\n"); + dev_err(&pdev->dev, "failed to get wdt-reg resource\n");
+ return -ENODEV; + return -ENODEV;
@ -137,7 +139,7 @@ Changes from v2:
init_completion(&rdc321x_wdt_device.stop); init_completion(&rdc321x_wdt_device.stop);
rdc321x_wdt_device.queue = 0; rdc321x_wdt_device.queue = 0;
@@ -240,7 +267,7 @@ static int __devinit rdc321x_wdt_probe(s @@ -240,7 +267,7 @@
rdc321x_wdt_device.default_ticks = ticks; rdc321x_wdt_device.default_ticks = ticks;