gpio: add Penwell gpio support
PATCH 1/1 gpio: add Penwell gpio support
Quoted 1 line
From
963f6e83843b0f94f8a5337def6e897ec5bb99bfMon Sep 17 00:00:00 2001
From: Alek Du <[email protected]>
Date: Thu, 25 Feb 2010 14:32:46 +0800
Subject: [PATCH] gpio: add Penwell gpio support
Intel Penwell chip has two 96 pins GPIO blocks, which are very similiar as Intel Langwell chip GPIO block, except for pin number difference. This patch expends the original Langwell GPIO driver to support Penwell's.
--- drivers/gpio/Kconfig | 4 +- drivers/gpio/langwell_gpio.c | 83 ++++++++++++++++++++++++++---------------- 2 files changed, 53 insertions(+), 34 deletions(-)
drivers/gpio/Kconfig +2 -2
@@ -264,10 +264,10 @@ config GPIO_BT8XX If unsure, say N. config GPIO_LANGWELL - bool "Intel Moorestown Platform Langwell GPIO support" + bool "Intel Langwell/Penwell GPIO support" depends on PCI help - Say Y here to support Intel Moorestown platform GPIO. + Say Y here to support Intel Langwell/Penwell GPIO. config GPIO_TIMBERDALE bool "Support for timberdale GPIO IP"
drivers/gpio/langwell_gpio.c +51 -32
168 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Quoted 9 lines · Alek
Quoted 1 line
From
963f6e83843b0f94f8a5337def6e897ec5bb99bfMon Sep 17 00:00:00 2001From: Alek Du <[email protected]>
Date: Thu, 25 Feb 2010 14:32:46 +0800
Subject: [PATCH] gpio: add Penwell gpio supportIntel Penwell chip has two 96 pins GPIO blocks, which are very similiar as Intel Langwell chip GPIO block, except for pin number difference. This patch expends the original Langwell GPIO driver to support Penwell's.
Has the driver been retested on Moorestown?
drivers/gpio/langwell_gpio.c line 76
Quoted 13 lines
drivers/gpio/langwell_gpio.c +8
-2-static int lnw_gpio_get (struct gpio_chip *chip,unsigned offset) +static inline void __iomem *gpio_reg (struct gpio_chip *chip,unsigned offset, +enum GPIO_REG reg_type) { struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); +unsigned nreg = chip->ngpio /32 ;u8 reg = offset /32 ; -void __iomem *gplr; +void __iomem *ptr; + + ptr = (void __iomem *)(lnw->reg_base + reg_type * nreg *4 + reg *4 ); +return ptr; +}
inlining this function was probably the wrong thing to do. But modern gcc's often just ignore the `inline' and do the right thing anyway.
drivers/gpio/langwell_gpio.c static struct irq_chip lnw_irqchip = { · line 182
Quoted 7 lines
drivers/gpio/langwell_gpio.c +4
-2-static struct pci_device_id lnw_gpio_ids[] = { - {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x080f ) }, +static struct pci_device_id lnw_gpio_ids[] = {/* pin number */ + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x080f ), .driver_data =64 }, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x081f ), .driver_data =96 }, + {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x081a ), .driver_data =96 }, {0 , }
I suppose we should be using DEFINE_PCI_DEVICE_TABLE() here.
Quoted 8 lines · On Fri, 21 May 2010 05:28:21 +0800 Andrew Morton <[email protected]>…
Quoted 5 lines · Alek
Quoted 1 line
From
963f6e83843b0f94f8a5337def6e897ec5bb99bfMon Sep 17 00:00:00 2001From: Alek Du <[email protected]>
Date: Thu, 25 Feb 2010 14:32:46 +0800
Subject: [PATCH] gpio: add Penwell gpio support
Quoted 6 lines
Quoted 4 lines
Intel Penwell chip has two 96 pins GPIO blocks, which are very similiar as Intel Langwell chip GPIO block, except for pin number difference. This patch expends the original Langwell GPIO driver to support Penwell's.
Has the driver been retested on Moorestown?
Yes, retested with Moorestown platform.
Quoted 18 lines
Quoted 4 lines
(quoted diff) +2
-1-static int lnw_gpio_get(struct gpio_chip *chip, unsigned offset) +static inline void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset, + enum GPIO_REG reg_type)Review
Quoted 10 lines
(quoted diff) +6
-1{ struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); + unsigned nreg = chip->ngpio / 32; u8 reg = offset / 32; - void __iomem *gplr; + void __iomem *ptr; + + ptr = (void __iomem *)(lnw->reg_base + reg_type * nreg * 4 + reg * 4); + return ptr; +}inlining this function was probably the wrong thing to do. But modern gcc's often just ignore the `inline' and do the right thing anyway.
Yes, as I looked at the assembly code, the function is too big. I should remove "inline".
Quoted 12 lines
Review
Quoted 8 lines
(quoted diff) +4
-2-static struct pci_device_id lnw_gpio_ids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080f) }, +static struct pci_device_id lnw_gpio_ids[] = { /* pin number */ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080f), .driver_data = 64 }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081f), .driver_data = 96 }, + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081a), .driver_data = 96 }, { 0, }I suppose we should be using
DEFINE_PCI_DEVICE_TABLE()here.
Yes, here is the incremental patch against previous one (I got the mail said the previous one is in mm tree now):
Quoted 1 line
From
47b561649890807a1a66fd8c4b07ded87df485c2Mon Sep 17 00:00:00 2001
From: Alek Du <[email protected]>
Date: Fri, 21 May 2010 11:16:40 +0800
Subject: [PATCH] gpio: langwell/penwell gpio driver style fix
* remove gpio_reg inline, due to the fact the func is too big to inline
* use standard DEFINE_PCI_DEVICE_TABLE
--- drivers/gpio/langwell_gpio.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/langwell_gpio.c +2 -2
@@ -63,7 +63,7 @@ struct lnw_gpio {unsigned irq_base; }; -static inline void __iomem *gpio_reg (struct gpio_chip *chip,unsigned offset, +static void __iomem *gpio_reg (struct gpio_chip *chip,unsigned offset,enum GPIO_REG reg_type) { struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip);
@@ -175,7 +175,7 @@ static struct irq_chip lnw_irqchip = { .set_type = lnw_irq_type, }; -static struct pci_device_id lnw_gpio_ids[] = {/* pin number */ +static DEFINE_PCI_DEVICE_TABLE (lnw_gpio_ids) = {/* pin number */ {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x080f ), .driver_data =64 }, {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x081f ), .driver_data =96 }, {PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x081a ), .driver_data =96 },
Signature · 1 line
1.7.0.4