From 928da83f5beb644cb706ca41ddc8742035929cde Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sat, 15 May 2010 21:26:56 +0000 Subject: [PATCH] fix panic on boot due to invalid IORESOURCE for MFD cells, fix gpio value setting SVN-Revision: 21459 --- .../001-rdc321x_mfd_southbridge.patch | 6 ++-- .../rdc/patches-2.6.30/002-rdc321x_gpio.patch | 8 ++--- .../003-rdc321x_watchdog_southbridge.patch | 4 +-- .../001-rdc321x_mfd_southbridge.patch | 34 ++++++++++++------- .../rdc/patches-2.6.32/002-rdc321x_gpio.patch | 30 +++++++++------- .../003-rdc321x_watchdog_southbridge.patch | 24 +++++++------ 6 files changed, 61 insertions(+), 45 deletions(-) diff --git a/target/linux/rdc/patches-2.6.30/001-rdc321x_mfd_southbridge.patch b/target/linux/rdc/patches-2.6.30/001-rdc321x_mfd_southbridge.patch index 12dca0b997..b4970cf99c 100644 --- a/target/linux/rdc/patches-2.6.30/001-rdc321x_mfd_southbridge.patch +++ b/target/linux/rdc/patches-2.6.30/001-rdc321x_mfd_southbridge.patch @@ -79,7 +79,7 @@ Changes from v2: + .name = "wdt-reg", + .start = RDC321X_WDT_CTRL, + .end = RDC321X_WDT_CTRL + 0x3, -+ .flags = IORESOURCE_MEM, ++ .flags = IORESOURCE_IO, + } +}; + @@ -92,12 +92,12 @@ Changes from v2: + .name = "gpio-reg1", + .start = RDC321X_GPIO_CTRL_REG1, + .end = RDC321X_GPIO_CTRL_REG1 + 0x7, -+ .flags = IORESOURCE_MEM, ++ .flags = IORESOURCE_IO, + }, { + .name = "gpio-reg2", + .start = RDC321X_GPIO_CTRL_REG2, + .end = RDC321X_GPIO_CTRL_REG2 + 0x7, -+ .flags = IORESOURCE_MEM, ++ .flags = IORESOURCE_IO, + } +}; + diff --git a/target/linux/rdc/patches-2.6.30/002-rdc321x_gpio.patch b/target/linux/rdc/patches-2.6.30/002-rdc321x_gpio.patch index a9e6348f7c..592d86ab05 100644 --- a/target/linux/rdc/patches-2.6.30/002-rdc321x_gpio.patch +++ b/target/linux/rdc/patches-2.6.30/002-rdc321x_gpio.patch @@ -109,7 +109,7 @@ Changes from v2: + gpch->data_reg[reg] &= ~(1 << (gpio & 0x1f)); + + 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]); +} + @@ -171,7 +171,7 @@ Changes from v2: + struct rdc321x_gpio *rdc321x_gpio_dev; + struct rdc321x_gpio_pdata *pdata; + -+ pdata = pdev->dev.platform_data; ++ pdata = pdev->dev.driver_data; + if (!pdata) { + dev_err(&pdev->dev, "no platform data supplied\n"); + return -ENODEV; @@ -183,7 +183,7 @@ Changes from v2: + return -ENOMEM; + } + -+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpio-reg1"); ++ r = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpio-reg1"); + if (!r) { + dev_err(&pdev->dev, "failed to get gpio-reg1 resource\n"); + err = -ENODEV; @@ -195,7 +195,7 @@ Changes from v2: + rdc321x_gpio_dev->reg1_ctrl_base = r->start; + 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) { + dev_err(&pdev->dev, "failed to get gpio-reg2 resource\n"); + err = -ENODEV; diff --git a/target/linux/rdc/patches-2.6.30/003-rdc321x_watchdog_southbridge.patch b/target/linux/rdc/patches-2.6.30/003-rdc321x_watchdog_southbridge.patch index 2671fb17cd..56b3005f4a 100644 --- a/target/linux/rdc/patches-2.6.30/003-rdc321x_watchdog_southbridge.patch +++ b/target/linux/rdc/patches-2.6.30/003-rdc321x_watchdog_southbridge.patch @@ -106,13 +106,13 @@ Changes from v2: + struct resource *r; + struct rdc321x_wdt_pdata *pdata; + -+ pdata = pdev->dev.platform_data; ++ pdata = pdev->dev.driver_data; + if (!pdata) { + dev_err(&pdev->dev, "no platform data supplied\n"); + return -ENODEV; + } + -+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wdt-reg"); ++ r = platform_get_resource_byname(pdev, IORESOURCE_IO, "wdt-reg"); + if (!r) { + dev_err(&pdev->dev, "failed to get wdt-reg resource\n"); + return -ENODEV; diff --git a/target/linux/rdc/patches-2.6.32/001-rdc321x_mfd_southbridge.patch b/target/linux/rdc/patches-2.6.32/001-rdc321x_mfd_southbridge.patch index 036e7318a2..df75563353 100644 --- a/target/linux/rdc/patches-2.6.32/001-rdc321x_mfd_southbridge.patch +++ b/target/linux/rdc/patches-2.6.32/001-rdc321x_mfd_southbridge.patch @@ -11,9 +11,11 @@ Changes from v2: - removed pci_dev accessors - use DEFINE_PCI_DEVICE_TABLE ---- a/drivers/mfd/Kconfig -+++ b/drivers/mfd/Kconfig -@@ -305,6 +305,15 @@ config EZX_PCAP +Index: linux-2.6.32.10/drivers/mfd/Kconfig +=================================================================== +--- 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 needed for MMC, TouchScreen, Sound, USB, etc.. @@ -29,16 +31,20 @@ Changes from v2: endmenu menu "Multimedia Capabilities Port drivers" ---- a/drivers/mfd/Makefile -+++ b/drivers/mfd/Makefile -@@ -50,3 +50,5 @@ obj-$(CONFIG_PCF50633_ADC) += pcf50633-a +Index: linux-2.6.32.10/drivers/mfd/Makefile +=================================================================== +--- 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_AB3100_CORE) += ab3100-core.o obj-$(CONFIG_AB3100_OTP) += ab3100-otp.o + +obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o ---- /dev/null -+++ b/drivers/mfd/rdc321x-southbridge.c +Index: linux-2.6.32.10/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 @@ +/* + * RDC321x MFD southbrige driver @@ -76,7 +82,7 @@ Changes from v2: + .name = "wdt-reg", + .start = RDC321X_WDT_CTRL, + .end = RDC321X_WDT_CTRL + 0x3, -+ .flags = IORESOURCE_MEM, ++ .flags = IORESOURCE_IO, + } +}; + @@ -89,12 +95,12 @@ Changes from v2: + .name = "gpio-reg1", + .start = RDC321X_GPIO_CTRL_REG1, + .end = RDC321X_GPIO_CTRL_REG1 + 0x7, -+ .flags = IORESOURCE_MEM, ++ .flags = IORESOURCE_IO, + }, { + .name = "gpio-reg2", + .start = RDC321X_GPIO_CTRL_REG2, + .end = RDC321X_GPIO_CTRL_REG2 + 0x7, -+ .flags = IORESOURCE_MEM, ++ .flags = IORESOURCE_IO, + } +}; + @@ -163,8 +169,10 @@ Changes from v2: +MODULE_AUTHOR("Florian Fainelli "); +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("RDC R-321x MFD southbridge driver"); ---- /dev/null -+++ b/include/linux/mfd/rdc321x.h +Index: linux-2.6.32.10/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 @@ +#ifndef __RDC321X_MFD_H +#define __RDC321X_MFD_H diff --git a/target/linux/rdc/patches-2.6.32/002-rdc321x_gpio.patch b/target/linux/rdc/patches-2.6.32/002-rdc321x_gpio.patch index e1aa46e8a4..c2365b7bf5 100644 --- a/target/linux/rdc/patches-2.6.32/002-rdc321x_gpio.patch +++ b/target/linux/rdc/patches-2.6.32/002-rdc321x_gpio.patch @@ -8,9 +8,11 @@ Changes from v2: - use the pci_dev pointer passed as platform data - replaced rdc321x_pci_{read,write} ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -196,6 +196,14 @@ config GPIO_LANGWELL +Index: linux-2.6.32.10/drivers/gpio/Kconfig +=================================================================== +--- 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 Say Y here to support Intel Moorestown platform GPIO. @@ -25,15 +27,19 @@ Changes from v2: comment "SPI GPIO expanders:" config GPIO_MAX7301 ---- a/drivers/gpio/Makefile -+++ b/drivers/gpio/Makefile -@@ -19,3 +19,4 @@ obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio +Index: linux-2.6.32.10/drivers/gpio/Makefile +=================================================================== +--- 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_VR41XX) += vr41xx_giu.o obj-$(CONFIG_GPIO_WM831X) += wm831x-gpio.o +obj-$(CONFIG_GPIO_RDC321X) += rdc321x-gpio.o ---- /dev/null -+++ b/drivers/gpio/rdc321x-gpio.c +Index: linux-2.6.32.10/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 @@ +/* + * RDC321x GPIO driver @@ -109,7 +115,7 @@ Changes from v2: + gpch->data_reg[reg] &= ~(1 << (gpio & 0x1f)); + + 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]); +} + @@ -171,7 +177,7 @@ Changes from v2: + struct rdc321x_gpio *rdc321x_gpio_dev; + struct rdc321x_gpio_pdata *pdata; + -+ pdata = pdev->dev.platform_data; ++ pdata = platform_get_drvdata(pdev); + if (!pdata) { + dev_err(&pdev->dev, "no platform data supplied\n"); + return -ENODEV; @@ -183,7 +189,7 @@ Changes from v2: + return -ENOMEM; + } + -+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gpio-reg1"); ++ r = platform_get_resource_byname(pdev, IORESOURCE_IO, "gpio-reg1"); + if (!r) { + dev_err(&pdev->dev, "failed to get gpio-reg1 resource\n"); + err = -ENODEV; @@ -195,7 +201,7 @@ Changes from v2: + rdc321x_gpio_dev->reg1_ctrl_base = r->start; + 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) { + dev_err(&pdev->dev, "failed to get gpio-reg2 resource\n"); + err = -ENODEV; diff --git a/target/linux/rdc/patches-2.6.32/003-rdc321x_watchdog_southbridge.patch b/target/linux/rdc/patches-2.6.32/003-rdc321x_watchdog_southbridge.patch index 2671fb17cd..dafa7e49a6 100644 --- a/target/linux/rdc/patches-2.6.32/003-rdc321x_watchdog_southbridge.patch +++ b/target/linux/rdc/patches-2.6.32/003-rdc321x_watchdog_southbridge.patch @@ -10,8 +10,10 @@ Changes from v2: - replaced rdc321x_pci_{read,write} - use the pci_dev pointer passed as platform_data ---- a/drivers/watchdog/rdc321x_wdt.c -+++ b/drivers/watchdog/rdc321x_wdt.c +Index: linux-2.6.32.10/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 @@ /* * RDC321x watchdog driver @@ -31,7 +33,7 @@ Changes from v2: #define RDC_WDT_MASK 0x80000000 /* Mask */ #define RDC_WDT_EN 0x00800000 /* Enable bit */ -@@ -63,6 +62,8 @@ static struct { +@@ -63,6 +62,8 @@ int default_ticks; unsigned long inuse; spinlock_t lock; @@ -40,7 +42,7 @@ Changes from v2: } rdc321x_wdt_device; /* generic helper functions */ -@@ -70,14 +71,18 @@ static struct { +@@ -70,14 +71,18 @@ static void rdc321x_wdt_trigger(unsigned long unused) { unsigned long flags; @@ -61,7 +63,7 @@ Changes from v2: spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); /* requeue?? */ -@@ -105,10 +110,13 @@ static void rdc321x_wdt_start(void) +@@ -105,10 +110,13 @@ /* Clear the timer */ spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); @@ -77,7 +79,7 @@ Changes from v2: spin_unlock_irqrestore(&rdc321x_wdt_device.lock, flags); mod_timer(&rdc321x_wdt_device.timer, -@@ -148,7 +156,7 @@ static long rdc321x_wdt_ioctl(struct fil +@@ -148,7 +156,7 @@ unsigned long arg) { void __user *argp = (void __user *)arg; @@ -86,7 +88,7 @@ Changes from v2: static struct watchdog_info ident = { .options = WDIOF_CARDRESET, .identity = "RDC321x WDT", -@@ -162,9 +170,10 @@ static long rdc321x_wdt_ioctl(struct fil +@@ -162,9 +170,10 @@ case WDIOC_GETSTATUS: /* Read the value from the DATA register */ spin_lock_irqsave(&rdc321x_wdt_device.lock, flags); @@ -99,20 +101,20 @@ Changes from v2: return -EFAULT; break; 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) { int err; + struct resource *r; + struct rdc321x_wdt_pdata *pdata; + -+ pdata = pdev->dev.platform_data; ++ pdata = platform_get_drvdata(pdev); + if (!pdata) { + dev_err(&pdev->dev, "no platform data supplied\n"); + return -ENODEV; + } + -+ r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wdt-reg"); ++ r = platform_get_resource_byname(pdev, IORESOURCE_IO, "wdt-reg"); + if (!r) { + dev_err(&pdev->dev, "failed to get wdt-reg resource\n"); + return -ENODEV; @@ -137,7 +139,7 @@ Changes from v2: init_completion(&rdc321x_wdt_device.stop); 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; -- 2.25.1