Skip to contentSkip to conversation

PINCTRL: SiRF: add GPIO and GPIO irq support in CSR SiRFprimaII

PATCH New Barry Song 3 participants 3 messages Jun 19, 2012 – Jun 20, 2012

Subsystems (3)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v2 1/1 PINCTRL: SiRF: add GPIO and GPIO irq support in CSR SiRFprimaII

From: Barry Song <[email protected]>

In SiRFprimaII, Each GPIO pin can be configured as input or output independently. If a GPIO is configured as input, it can also be enabled as an interrupt source (either edge or level triggered).

These pins must be either MUXed as GPIO or other function pads.

---
-v2:
merge into pinctrl-sirf.c since it is pinmux, gpio and irq source; use irq domain according to Linus Walleij's feedback; some other cleanup to Linus Walleij's feedback

 arch/arm/Kconfig                         |    1 +
 arch/arm/mach-prima2/include/mach/gpio.h |   13 +
 arch/arm/mach-prima2/include/mach/irqs.h |    2 +-
 drivers/pinctrl/pinctrl-sirf.c           |  489 +++++++++++++++++++++++++++++-
 4 files changed, 503 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-prima2/include/mach/gpio.h
arch/arm/Kconfig +1 -0
index b1b2752..6ee51a0 100644
@@ -389,6 +389,7 @@ config ARCH_PRIMA2
 	bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform"
 	select CPU_V7
 	select NO_IOPORT
+	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select GENERIC_CLOCKEVENTS
 	select CLKDEV_LOOKUP
 	select GENERIC_IRQ_CHIP
arch/arm/mach-prima2/include/mach/gpio.h new file +13 -0
new file mode 100644
index 0000000..1904bb0
@@ -0,0 +1,13 @@
+#ifndef __MACH_GPIO_H
+#define __MACH_GPIO_H
+
+/* Pull up/down values */
+enum sirfsoc_gpio_pull {
+	SIRFSOC_GPIO_PULL_NONE,
+	SIRFSOC_GPIO_PULL_UP,
+	SIRFSOC_GPIO_PULL_DOWN,
+};
+
+void sirfsoc_gpio_set_pull(unsigned gpio, unsigned mode);
+
+#endif
arch/arm/mach-prima2/include/mach/irqs.h +1 -1
index bb354f9..f6014a0 100644
@@ -11,7 +11,7 @@
 
 #define SIRFSOC_INTENAL_IRQ_START  0
 #define SIRFSOC_INTENAL_IRQ_END    59
-
+#define SIRFSOC_GPIO_IRQ_START     (SIRFSOC_INTENAL_IRQ_END + 1)
 #define NR_IRQS	220
 
 #endif
drivers/pinctrl/pinctrl-sirf.c +488 -1

519 lines not on this page · raw message

Signature · 6 lines
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
#1 lore raw

PATCH v2 1/1 PINCTRL: SiRF: add GPIO and GPIO irq support in CSR SiRFprimaII

Quoted 8 lines · Barry Song

In SiRFprimaII, Each GPIO pin can be configured as input or output independently. If a GPIO is configured as input, it can also be enabled as an interrupt source (either edge or level triggered).

These pins must be either MUXed as GPIO or other function pads.

This is looking great!

I assume you will merge this through the ARM SoC tree and the PrimaII branch? Tell me if you need it to be merged through the pinctrl tree.

arch/arm/mach-prima2/include/mach/gpio.h line 9

Quoted 6 lines
arch/arm/mach-prima2/include/mach/gpio.h new file +6 -0
+/* Pull up/down values */
+enum sirfsoc_gpio_pull {
+ ? ? ? SIRFSOC_GPIO_PULL_NONE,
+ ? ? ? SIRFSOC_GPIO_PULL_UP,
+ ? ? ? SIRFSOC_GPIO_PULL_DOWN,
+};

As noted you can use pinconf-generic and friends, but it's definately not a requirement. You can also do that as a refactoring on top of this patch if you want to.

Yours,
Linus Walleij

#2 lore raw

PATCH v2 1/1 PINCTRL: SiRF: add GPIO and GPIO irq support in CSR SiRFprimaII

Hi Linus,

2012/6/20 Linus Walleij <[email protected]>:

Quoted 11 lines · Barry Song
Quoted 9 lines

In SiRFprimaII, Each GPIO pin can be configured as input or output independently. If a GPIO is configured as input, it can also be enabled as an interrupt source (either edge or level triggered).

These pins must be either MUXed as GPIO or other function pads.

Quoted 6 lines

This is looking great!

I assume you will merge this through the ARM SoC tree and the PrimaII branch? Tell me if you need it to be merged through the pinctrl tree.

Thanks. i'll handle it in primaII tree.

Quoted 12 lines

arch/arm/mach-prima2/include/mach/gpio.h line 9

Quoted 7 lines
arch/arm/mach-prima2/include/mach/gpio.h new file +6 -0
+/* Pull up/down values */
+enum sirfsoc_gpio_pull {
+ ? ? ? SIRFSOC_GPIO_PULL_NONE,
+ ? ? ? SIRFSOC_GPIO_PULL_UP,
+ ? ? ? SIRFSOC_GPIO_PULL_DOWN,
+};

As noted you can use pinconf-generic and friends, but it's definately not a requirement. You can also do that as a refactoring on top of this patch if you want to.

Quoted 3 lines

Yours,
Linus Walleij

-barry