Skip to contentSkip to conversation

Adding support for STA2x11/ConneXt PCIexpress function 0xCC0C.

PATCH In review Anders Wallin 2 participants 3 messages Sep 23, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Adding support for STA2x11/ConneXt PCIexpress function 0xCC0C.

From: Anders Wallin <[email protected]>

This function enable access to multiple IP-blocks including 4 GPIO blocks,
one System Control block and one Timer block. Access to the PCIe device is managed by a MUX driver.
The pl061_pci gpio driver is based on the ARM pl061 IP block, but the functionality is not a one to one map. The gpio driver needs the generic "gpio_to_irq" support.

Anders Wallin (1):
Adding support for STA2x11/Connext PCIexpress function 0xCC0C.

 arch/x86/include/asm/gpio.h   |    2 +-
 drivers/gpio/Kconfig          |   14 +
 drivers/gpio/Makefile         |    1 +
 drivers/gpio/pl061_pci.c      |  860 +++++++++++++++++++++++++++++++++++++++++
 drivers/gpio/pl061_pci.h      |   29 ++
 drivers/misc/Kconfig          |   23 ++
 drivers/misc/Makefile         |    3 +
 drivers/misc/sta2x11_apbreg.c |  177 +++++++++
 drivers/misc/sta2x11_apbreg.h |   39 ++
 drivers/misc/sta2x11_mux.c    |  265 +++++++++++++
 drivers/misc/sta2x11_mux.h    |   50 +++
 drivers/misc/sta2x11_sctl.c   |  189 +++++++++
 drivers/misc/sta2x11_sctl.h   |  143 +++++++
 13 files changed, 1794 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/pl061_pci.c
 create mode 100644 drivers/gpio/pl061_pci.h
 create mode 100644 drivers/misc/sta2x11_apbreg.c
 create mode 100644 drivers/misc/sta2x11_apbreg.h
 create mode 100644 drivers/misc/sta2x11_mux.c
 create mode 100644 drivers/misc/sta2x11_mux.h
 create mode 100644 drivers/misc/sta2x11_sctl.c
 create mode 100644 drivers/misc/sta2x11_sctl.h
#1 lore raw

PATCH 1/1 Adding support for STA2x11/Connext PCIexpress function 0xCC0C.

From: Anders Wallin <[email protected]>

---
 arch/x86/include/asm/gpio.h   |    2 +-
 drivers/gpio/Kconfig          |   14 +
 drivers/gpio/Makefile         |    1 +
 drivers/gpio/pl061_pci.c      |  860 +++++++++++++++++++++++++++++++++++++++++
 drivers/gpio/pl061_pci.h      |   29 ++
 drivers/misc/Kconfig          |   23 ++
 drivers/misc/Makefile         |    3 +
 drivers/misc/sta2x11_apbreg.c |  177 +++++++++
 drivers/misc/sta2x11_apbreg.h |   39 ++
 drivers/misc/sta2x11_mux.c    |  265 +++++++++++++
 drivers/misc/sta2x11_mux.h    |   50 +++
 drivers/misc/sta2x11_sctl.c   |  189 +++++++++
 drivers/misc/sta2x11_sctl.h   |  143 +++++++
 13 files changed, 1794 insertions(+), 1 deletions(-)
 create mode 100644 drivers/gpio/pl061_pci.c
 create mode 100644 drivers/gpio/pl061_pci.h
 create mode 100644 drivers/misc/sta2x11_apbreg.c
 create mode 100644 drivers/misc/sta2x11_apbreg.h
 create mode 100644 drivers/misc/sta2x11_mux.c
 create mode 100644 drivers/misc/sta2x11_mux.h
 create mode 100644 drivers/misc/sta2x11_sctl.c
 create mode 100644 drivers/misc/sta2x11_sctl.h
arch/x86/include/asm/gpio.h +1 -1
index 49dbfdf..9da6f01 100644
@@ -43,7 +43,7 @@ static inline int gpio_cansleep(unsigned int gpio)
  */
 static inline int gpio_to_irq(unsigned int gpio)
 {
-	return -ENOSYS;
+	return __gpio_to_irq(gpio);
 }
 
 static inline int irq_to_gpio(unsigned int irq)
drivers/gpio/Kconfig +14 -0
index 510aa20..7afbabb 100644
@@ -361,4 +361,18 @@ config GPIO_JANZ_TTL
 	  This driver provides support for driving the pins in output
 	  mode only. Input mode is not supported.
 
+config GPIO_PL061_PCI
+	bool "STA2x11/ConneXt PL061_PCI GPIO support"
+	depends on STA2X11_PCI_MUX
+	help
+	  Say yes here to support the STA2x11/ConneXt PL061_PCI GPIO device
+
+config GPIO_PL061_PCI_IRQ
+	bool "ConneXt PL061_PCI gpio_to_irq support"
+	depends on GPIO_PL061_PCI
+	help
+	  The gpiolib has a function called gpio_to_irq that has
+	  the requirement that the number returned should be usable by
+	  calling request_irq.
+
 endif
drivers/gpio/Makefile +1 -0
index fc6019d..0480109 100644
@@ -8,6 +8,7 @@ ccflags-$(CONFIG_DEBUG_GPIO)	+= -DDEBUG
 
 obj-$(CONFIG_GPIOLIB)		+= gpiolib.o
 
+obj-$(CONFIG_GPIO_PL061_PCI)	+= pl061_pci.o
 obj-$(CONFIG_GPIO_ADP5520)	+= adp5520-gpio.o
 obj-$(CONFIG_GPIO_ADP5588)	+= adp5588-gpio.o
 obj-$(CONFIG_GPIO_LANGWELL)	+= langwell_gpio.o
drivers/gpio/pl061_pci.c new file +860 -0

860 lines not on this page · raw message

drivers/gpio/pl061_pci.h new file +29 -0
new file mode 100644
index 0000000..5360900
@@ -0,0 +1,29 @@
+/*
+ * linux/driver/gpio/pl061_pci.h, pl061 GPIO driver for ConneXt
+ *
+ * STMicroelectronics ConneXt (STA2X11/STA2X10) GPIO file
+ * derived from from linux/driver/gpio/pl061.c
+ *
+ * Copyright (c) 2009-2010 Wind River Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+int pl061_pci_read_pdis(unsigned nr);
+int pl061_pci_read_afsela(unsigned nr);
+int pl061_pci_set_pdis(unsigned nr);
+int pl061_pci_set_afsela(unsigned nr);
+int pl061_pci_clear_pdis(unsigned nr);
+int pl061_pci_clear_afsela(unsigned nr);
drivers/misc/Kconfig +23 -0
index 0b591b6..3c9f207 100644
@@ -390,6 +390,29 @@ config BMP085
 	  To compile this driver as a module, choose M here: the
 	  module will be called bmp085.
 
+config STA2X11_PCI_MUX
+	bool "STA2x11 PCI mux"
+	depends on PCI
+	help
+	  The STMicroelectronics ConneXt (STA2x11)
+	  chip has several unrelated functions in one PCI endpoint function.
+	  This driver is a resource handler for the different drivers.
+
+config STA2X11_PCI_SCTL
+	bool "STA2x11 System control"
+	depends on STA2X11_PCI_MUX
+	help
+	  The STMicroelectronics ConneXt (STA2x11) system control block.
+	  Many ConneXt driver need this and it will be auto selected.
+
+config STA2X11_PCI_APBREG
+	bool "STA2x11 AHB-APB Bridge"
+	depends on STA2X11_PCI_MUX
+	help
+	  The STMicroelectronics ConneXt (STA2x11) AHB-APB Bridge.
+	  CAN/MLB and SaRaC ConneXt driver need this and it will
+	  be auto selected.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +3 -0
index 255a80d..0af12b1 100644
@@ -35,3 +35,6 @@ obj-y				+= eeprom/
 obj-y				+= cb710/
 obj-$(CONFIG_VMWARE_BALLOON)	+= vmware_balloon.o
 obj-$(CONFIG_ARM_CHARLCD)	+= arm-charlcd.o
+obj-$(CONFIG_STA2X11_PCI_MUX)   += sta2x11_mux.o
+obj-$(CONFIG_STA2X11_PCI_SCTL)  += sta2x11_sctl.o
+obj-$(CONFIG_STA2X11_PCI_APBREG)+= sta2x11_apbreg.o
drivers/misc/sta2x11_apbreg.c new file +177 -0

177 lines not on this page · raw message

drivers/misc/sta2x11_apbreg.h new file +39 -0
new file mode 100644
index 0000000..31f7dd3
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2010 Wind River Systems, Inc.
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+* See the GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*
+*/
+
+#ifndef __STA2X11_APBREG_H
+#define __STA2X11_APBREG_H
+
+#define APBREG_BSR	0x00	/* Bridge Status Register */
+#define APBREG_PAER	0x08	/* Peripherals Address Error Register */
+#define APBREG_PWAC	0x20	/* Peripheral Write Access Control register */
+#define APBREG_PRAC	0x40	/* Peripheral Read Access Control register */
+#define APBREG_PCG	0x60	/* Peripheral Clock Gating Register */
+#define APBREG_PUR	0x80	/* Peripheral Under Reset Register */
+#define APBREG_EMU_PCG	0xA0	/* Emulator Peripheral Clock Gating Register */
+
+#define APBREG_CAN      (1 << 1)
+#define APBREG_SARAC	(1 << 2)
+#define APBREG_MLB	(1 << 3)
+
+void sta2x11_apbreg_write(int reg, int value);
+int sta2x11_apbreg_read(int reg);
+int sta2x11_apbreg_set(int reg, int value);
+int sta2x11_apbreg_clear(int reg, int value);
+
+#endif /* __STA2X11_APBREG_H */
drivers/misc/sta2x11_mux.c new file +265 -0

265 lines not on this page · raw message

drivers/misc/sta2x11_mux.h new file +50 -0

50 lines not on this page · raw message

drivers/misc/sta2x11_sctl.c new file +189 -0

189 lines not on this page · raw message

drivers/misc/sta2x11_sctl.h new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
1.7.0.5
#2 lore raw
In reply to Anders Wallin
Quoted 5 lines · On Thu, 23 Sep 2010 20:25:31 +0200 Anders Wallin wrote:

From: Anders Wallin <[email protected]>

This function enable access to multiple IP-blocks including 4 GPIO blocks,
one System Control block and one Timer block. Access to the PCIe device is managed by a MUX driver.
The pl061_pci gpio driver is based on the ARM pl061 IP block, but the functionality is not a one to one map. The gpio driver needs the generic "gpio_to_irq" support.

This patch description should be in patch 1/1. The diffstat can go there also. No need to patch 0/1 email at all.

Thanks.

Quoted 17 lines

Anders Wallin (1):
Adding support for STA2x11/Connext PCIexpress function 0xCC0C.

 arch/x86/include/asm/gpio.h   |    2 +-
 drivers/gpio/Kconfig          |   14 +
 drivers/gpio/Makefile         |    1 +
 drivers/gpio/pl061_pci.c      |  860 +++++++++++++++++++++++++++++++++++++++++
 drivers/gpio/pl061_pci.h      |   29 ++
 drivers/misc/Kconfig          |   23 ++
 drivers/misc/Makefile         |    3 +
 drivers/misc/sta2x11_apbreg.c |  177 +++++++++
 drivers/misc/sta2x11_apbreg.h |   39 ++
 drivers/misc/sta2x11_mux.c    |  265 +++++++++++++
 drivers/misc/sta2x11_mux.h    |   50 +++
 drivers/misc/sta2x11_sctl.c   |  189 +++++++++
 drivers/misc/sta2x11_sctl.h   |  143 +++++++
 13 files changed, 1794 insertions(+), 1 deletions(-)
Quoted 8 lines
 create mode 100644 drivers/gpio/pl061_pci.c
 create mode 100644 drivers/gpio/pl061_pci.h
 create mode 100644 drivers/misc/sta2x11_apbreg.c
 create mode 100644 drivers/misc/sta2x11_apbreg.h
 create mode 100644 drivers/misc/sta2x11_mux.c
 create mode 100644 drivers/misc/sta2x11_mux.h
 create mode 100644 drivers/misc/sta2x11_sctl.c
 create mode 100644 drivers/misc/sta2x11_sctl.h

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***