Skip to contentSkip to conversation

Topcliff: Update PCH_GPIO driver to 2.6.35

PATCH Superseded Masayuki Ohtak 3 participants 3 messages Sep 28, 2010 GPIO

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Topcliff: Update PCH_GPIO driver to 2.6.35

GPIO driver of Topcliff PCH

Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has GPIO I/F. Using this I/F, it is able to access system devices connected to GPIO.

---
 drivers/gpio/Kconfig    |    8 ++
 drivers/gpio/Makefile   |    1 +
 drivers/gpio/pch_gpio.c |  317 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 326 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/pch_gpio.c
drivers/gpio/Kconfig +8 -0
index 7face91..76701f6 100644
@@ -113,6 +113,14 @@ config GPIO_SCH
 
 comment "I2C GPIO expanders:"
 
+config PCH_GPIO
+	tristate "PCH GPIO"
+	depends on PCI
+	help
+	  This driver is for PCH GPIO of Topcliff which is an IOH for x86
+	  embedded processor.
+	  This driver can access PCH GPIO device.
+
 config GPIO_MAX7300
 	tristate "Maxim MAX7300 GPIO expander"
 	depends on I2C
drivers/gpio/Makefile +1 -0
index e53dcff..eda01b6 100644
@@ -35,3 +35,4 @@ obj-$(CONFIG_GPIO_WM8994)	+= wm8994-gpio.o
 obj-$(CONFIG_GPIO_SCH)		+= sch_gpio.o
 obj-$(CONFIG_GPIO_RDC321X)	+= rdc321x-gpio.o
 obj-$(CONFIG_GPIO_JANZ_TTL)	+= janz-ttl.o
+obj-$(CONFIG_PCH_GPIO)	+= pch_gpio.o
drivers/gpio/pch_gpio.c new file +317 -0

317 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 8 lines · Masayuki Ohtak
drivers/gpio/Kconfig +0 -0

 comment "I2C GPIO expanders:"

+config PCH_GPIO
+       tristate "PCH GPIO"
+       depends on PCI

this is connected to a PCI bus, not I2C, so it shouldnt be under the I2C comment. move it to a diff place in the file.

Quoted 7 lines
drivers/gpio/Makefile +0 -0
@@ -35,3 +35,4 @@ obj-$(CONFIG_GPIO_WM8994)     += wm8994-gpio.o

 obj-$(CONFIG_GPIO_SCH)         += sch_gpio.o
 obj-$(CONFIG_GPIO_RDC321X)     += rdc321x-gpio.o
 obj-$(CONFIG_GPIO_JANZ_TTL)    += janz-ttl.o
+obj-$(CONFIG_PCH_GPIO) += pch_gpio.o

there is a clear standard of naming things CONFIG_GPIO_XXX, so i'd change your CONFIG_PCH_GPIO to CONFIG_GPIO_PCH

Quoted 1 line

+#include <linux/cdev.h>

you dont actually use cdev anywhere. punt the header.

Quoted 1 line

+#define MODULE_NAME "pch_gpio"

KBUILD_MODNAME already exists

Quoted 1 line

+#define PCI_DEVICE_ID_PCH_GPIO 0x8803

considering you use this define in one place, i dont see why you need a define at all. just put the id in the one structure.

drivers/gpio/Makefile

Quoted 3 lines
drivers/gpio/Makefile +3 -0
+#ifdef CONFIG_PM
+static s32 pch_gpio_suspend(struct pci_dev *pdev, pm_message_t state)
+static s32 pch_gpio_resume(struct pci_dev *pdev)

suspend/resume funcs return "int", not "s32"

Quoted 1 line

+static struct pci_device_id pch_gpio_pcidev_id[] = {

should be const

Quoted 2 lines

+static s32 __devinit pch_gpio_probe(struct pci_dev *pdev,
+                                   const struct pci_device_id *id)

return value is "int", not "s32"

Quoted 1 line

+       chip = kzalloc(sizeof(struct pch_gpio_chip), GFP_KERNEL);

sizeof(*chip)

Quoted 1 line

+               printk(KERN_ERR "PCH gpio: Failed to register GPIO\n");

use dev_err()

drivers/gpio/Makefile

Quoted 5 lines
drivers/gpio/Makefile +5 -0
+static s32 __init pch_gpio_pci_init(void)
+{
+       return pci_register_driver(&pch_gpio_driver);
+}
+module_init(pch_gpio_pci_init);

module_init funcs return "int", not "s32"
-mike

#2 lore raw
In reply to Masayuki Ohtak

drivers/gpio/pch_gpio.c line 267

Quoted 3 lines · Masayuki Ohtak
drivers/gpio/pch_gpio.c new file +2 -0
+	gpio->base = (u32)chip->pch_gpio_base_address;
 
+	chip->reg = chip->pch_gpio_base_address;

The GPIO base passed to gpiolib should be the base GPIO number for the device, not the address of the control registers. Normally this would be passed in via platform data or set to -1 to allow the core to assign a slot.