GPIO: Add support for GPIO on CLPS711X-target platform
Subsystems (3)
PATCH v3 1/1 GPIO: Add support for GPIO on CLPS711X-target platform
The CLPS711X CPUs provide some GPIOs for use in the system. This driver provides support for these via gpiolib. Due to platform limitations, driver does not support interrupts, only inputs and outputs.
--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/include/mach/gpio.h | 27 +++++ drivers/gpio/Kconfig | 4 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-clps711x.c | 152 ++++++++++++++++++++++++++++ 5 files changed, 185 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-clps711x/include/mach/gpio.h create mode 100644 drivers/gpio/gpio-clps711x.c
arch/arm/Kconfig +1 -0
@@ -384,6 +384,7 @@ config ARCH_CLPS711X bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" select CPU_ARM720T select ARCH_USES_GETTIMEOFFSET + select ARCH_REQUIRE_GPIOLIB select NEED_MACH_MEMORY_H help Support for Cirrus Logic 711x/721x/731x based boards.
arch/arm/mach-clps711x/include/mach/gpio.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* This file contains the CLPS711X GPIO definitions. +* +* Copyright (C) 2012 Alexander Shiyan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +/* Simple helper for convert port & pin to GPIO number */ +#define CLPS711X_GPIO (port, bit) ((port) * 8 + (bit)) + +/* Temporaty definitions for GPIO-ports */ +/* Will be removed after remove clps_read(write) macros */ +#include <mach/hardware.h> +#define _PADR (CLPS711X_VIRT_BASE + PADR) +#define _PBDR (CLPS711X_VIRT_BASE + PBDR) +#define _PCDR (CLPS711X_VIRT_BASE + PCDR) +#define _PDDR (CLPS711X_VIRT_BASE + PDDR) +#define _PADDR (CLPS711X_VIRT_BASE + PADDR) +#define _PBDDR (CLPS711X_VIRT_BASE + PBDDR) +#define _PCDDR (CLPS711X_VIRT_BASE + PCDDR) +#define _PDDDR (CLPS711X_VIRT_BASE + PDDDR) +#define _PEDR (CLPS711X_VIRT_BASE + PEDR) +#define _PEDDR (CLPS711X_VIRT_BASE + PEDDR)
drivers/gpio/Kconfig +4 -0
@@ -91,6 +91,10 @@ config GPIO_MAX730X comment "Memory mapped GPIO drivers:" +config GPIO_CLPS711X + def_bool y + depends on ARCH_CLPS711X + config GPIO_GENERIC_PLATFORM tristate "Generic memory-mapped GPIO controller support (MMIO platform device)" select GPIO_GENERIC
drivers/gpio/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o +obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o obj-$(CONFIG_GPIO_DA9052) += gpio-da9052.o obj-$(CONFIG_ARCH_DAVINCI) += gpio-davinci.o
drivers/gpio/gpio-clps711x.c new file +152 -0
152 lines not on this page · raw message
Signature · 1 line
1.7.8.6
PATCH v3 1/1 GPIO: Add support for GPIO on CLPS711X-target platform
Quoted 51 lines · Alexander Shiyan
The CLPS711X CPUs provide some GPIOs for use in the system. This driver provides support for these via gpiolib. Due to platform limitations, driver does not support interrupts, only inputs and outputs.
Signed-off-by Alexander Shiyan <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/include/mach/gpio.h | 27 +++++ drivers/gpio/Kconfig | 4 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-clps711x.c | 152 ++++++++++++++++++++++++++++ 5 files changed, 185 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-clps711x/include/mach/gpio.h create mode 100644 drivers/gpio/gpio-clps711x.carch/arm/Kconfig +1
-0@@ -384,6 +384,7 @@ config ARCH_CLPS711X bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" select CPU_ARM720T select ARCH_USES_GETTIMEOFFSET + select ARCH_REQUIRE_GPIOLIB select NEED_MACH_MEMORY_H help Support for Cirrus Logic 711x/721x/731x based boards.arch/arm/mach-clps711x/include/mach/gpio.h new file +17
-0@@ -0,0 +1,27 @@ +/* +* This file contains the CLPS711X GPIO definitions. +* +* Copyright (C) 2012 Alexander Shiyan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +/* Simple helper for convert port & pin to GPIO number */ +#define CLPS711X_GPIO (port, bit) ((port) * 8 + (bit)) + +/* Temporaty definitions for GPIO-ports */ +/* Will be removed after remove clps_read(write) macros */ +#include <mach/hardware.h>
arch/arm/mach-clps711x/include/mach/gpio.h line 27
Quoted 10 lines
arch/arm/mach-clps711x/include/mach/gpio.h new file +10
-0+#define _PADR (CLPS711X_VIRT_BASE + PADR) +#define _PBDR (CLPS711X_VIRT_BASE + PBDR) +#define _PCDR (CLPS711X_VIRT_BASE + PCDR) +#define _PDDR (CLPS711X_VIRT_BASE + PDDR) +#define _PADDR (CLPS711X_VIRT_BASE + PADDR) +#define _PBDDR (CLPS711X_VIRT_BASE + PBDDR) +#define _PCDDR (CLPS711X_VIRT_BASE + PCDDR) +#define _PDDDR (CLPS711X_VIRT_BASE + PDDDR) +#define _PEDR (CLPS711X_VIRT_BASE + PEDR) +#define _PEDDR (CLPS711X_VIRT_BASE + PEDDR)
Why can't this file (or the bulk of it) live in drivers/gpio ?
PATCH v3 1/1 GPIO: Add support for GPIO on CLPS711X-target platform
Quoted 5 lines · On Fri, 5 Oct 2012 10:02:04 +0100 Russell King - ARM Linux…
Quoted 4 lines · Alexander Shiyan
The CLPS711X CPUs provide some GPIOs for use in the system. This driver provides support for these via gpiolib. Due to platform limitations, driver does not support interrupts, only inputs and outputs.
...
Quoted 23 lines
Quoted 23 lines
+++
b/arch/arm/mach-clps711x/include/mach/gpio.harch/arm/mach-clps711x/include/mach/gpio.h new file +21
-0@@ -0,0 +1,27 @@ +/* +* This file contains the CLPS711X GPIO definitions. +* +* Copyright (C) 2012 Alexander Shiyan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +/* Simple helper for convert port & pin to GPIO number */ +#define CLPS711X_GPIO (port, bit) ((port) * 8 + (bit)) + +/* Temporaty definitions for GPIO-ports */ +/* Will be removed after remove clps_read(write) macros */ +#include <mach/hardware.h> +#define _PADR (CLPS711X_VIRT_BASE + PADR) +#define _PBDR (CLPS711X_VIRT_BASE + PBDR) +#define _PCDR (CLPS711X_VIRT_BASE + PCDR) +#define _PDDR (CLPS711X_VIRT_BASE + PDDR)
Quoted 8 lines
arch/arm/mach-clps711x/include/mach/gpio.h line 27
Quoted 6 lines
arch/arm/mach-clps711x/include/mach/gpio.h new file +6
-0+#define _PADDR (CLPS711X_VIRT_BASE + PADDR) +#define _PBDDR (CLPS711X_VIRT_BASE + PBDDR) +#define _PCDDR (CLPS711X_VIRT_BASE + PCDDR) +#define _PDDDR (CLPS711X_VIRT_BASE + PDDDR) +#define _PEDR (CLPS711X_VIRT_BASE + PEDR) +#define _PEDDR (CLPS711X_VIRT_BASE + PEDDR)Why can't this file (or the bulk of it) live in
drivers/gpio?
We should have access for macros in gpio.h from board support files and other drivers. From drivers/gpio it not possible.
If you ask about port definitions, as I say before, it will be removed later after rework on platform hardware definitions.
Signature · 1 line
Alexander Shiyan <[email protected]>
PATCH v3 1/1 GPIO: Add support for GPIO on CLPS711X-target platform
Quoted 40 lines · Alexander Shiyan
Quoted 5 lines · On Fri, 5 Oct 2012 10:02:04 +0100 Russell King - ARM Linux…
Quoted 4 lines · Alexander Shiyan
The CLPS711X CPUs provide some GPIOs for use in the system. This driver provides support for these via gpiolib. Due to platform limitations, driver does not support interrupts, only inputs and outputs.
...
Quoted 23 lines
Quoted 23 lines
+++
b/arch/arm/mach-clps711x/include/mach/gpio.harch/arm/mach-clps711x/include/mach/gpio.h new file +21
-0@@ -0,0 +1,27 @@ +/* +* This file contains the CLPS711X GPIO definitions. +* +* Copyright (C) 2012 Alexander Shiyan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +/* Simple helper for convert port & pin to GPIO number */ +#define CLPS711X_GPIO (port, bit) ((port) * 8 + (bit)) + +/* Temporaty definitions for GPIO-ports */ +/* Will be removed after remove clps_read(write) macros */ +#include <mach/hardware.h> +#define _PADR (CLPS711X_VIRT_BASE + PADR) +#define _PBDR (CLPS711X_VIRT_BASE + PBDR) +#define _PCDR (CLPS711X_VIRT_BASE + PCDR) +#define _PDDR (CLPS711X_VIRT_BASE + PDDR)Quoted 8 lines
arch/arm/mach-clps711x/include/mach/gpio.h line 27
Quoted 6 lines
arch/arm/mach-clps711x/include/mach/gpio.h new file +6
-0+#define _PADDR (CLPS711X_VIRT_BASE + PADDR) +#define _PBDDR (CLPS711X_VIRT_BASE + PBDDR) +#define _PCDDR (CLPS711X_VIRT_BASE + PCDDR) +#define _PDDDR (CLPS711X_VIRT_BASE + PDDDR) +#define _PEDR (CLPS711X_VIRT_BASE + PEDR) +#define _PEDDR (CLPS711X_VIRT_BASE + PEDDR)Why can't this file (or the bulk of it) live in
drivers/gpio?
Quoted 4 lines
We should have access for macros in
gpio.hfrom board support files and other drivers. Fromdrivers/gpioit not possible.
If you ask about port definitions, as I say before, it will be removed later after rework on platform hardware definitions.
No other drivers should be directly accessing the GPIO registers - doing so is likely a bug because of the inherent lack of locking, which will cause race conditions.
All accesses to GPIOs should be done via gpiolib, even from board support files.
PATCH v3 1/1 GPIO: Add support for GPIO on CLPS711X-target platform
Quoted 37 lines · On Sun, 7 Oct 2012 11:28:03 +0100 Russell King - ARM Linux…
Quoted 32 lines
...
Quoted 23 lines
Quoted 23 lines
+++
b/arch/arm/mach-clps711x/include/mach/gpio.harch/arm/mach-clps711x/include/mach/gpio.h new file +21
-0@@ -0,0 +1,27 @@ +/* +* This file contains the CLPS711X GPIO definitions. +* +* Copyright (C) 2012 Alexander Shiyan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +/* Simple helper for convert port & pin to GPIO number */ +#define CLPS711X_GPIO (port, bit) ((port) * 8 + (bit)) + +/* Temporaty definitions for GPIO-ports */ +/* Will be removed after remove clps_read(write) macros */ +#include <mach/hardware.h> +#define _PADR (CLPS711X_VIRT_BASE + PADR) +#define _PBDR (CLPS711X_VIRT_BASE + PBDR) +#define _PCDR (CLPS711X_VIRT_BASE + PCDR) +#define _PDDR (CLPS711X_VIRT_BASE + PDDR)Quoted 8 lines
arch/arm/mach-clps711x/include/mach/gpio.h line 27
Quoted 6 lines
arch/arm/mach-clps711x/include/mach/gpio.h new file +6
-0+#define _PADDR (CLPS711X_VIRT_BASE + PADDR) +#define _PBDDR (CLPS711X_VIRT_BASE + PBDDR) +#define _PCDDR (CLPS711X_VIRT_BASE + PCDDR) +#define _PDDDR (CLPS711X_VIRT_BASE + PDDDR) +#define _PEDR (CLPS711X_VIRT_BASE + PEDR) +#define _PEDDR (CLPS711X_VIRT_BASE + PEDDR)Why can't this file (or the bulk of it) live in
drivers/gpio?Quoted 4 lines
We should have access for macros in
gpio.hfrom board support files and other drivers. Fromdrivers/gpioit not possible.
If you ask about port definitions, as I say before, it will be removed later after rework on platform hardware definitions.
Quoted 6 lines
No other drivers should be directly accessing the GPIO registers - doing so is likely a bug because of the inherent lack of locking, which will cause race conditions.
All accesses to GPIOs should be done via gpiolib, even from board support files.
Yes, and I am say only about macro that calculate GPIO-number from port number and bit position. Access to this is a helpful for understand source code.
Signature · 1 line
Alexander Shiyan <[email protected]>
PATCH v3 1/1 GPIO: Add support for GPIO on CLPS711X-target platform
Quoted 44 lines · Alexander Shiyan
Quoted 41 lines · On Sun, 7 Oct 2012 11:28:03 +0100 Russell King - ARM Linux…
Quoted 32 lines
...
Quoted 23 lines
Quoted 23 lines
+++
b/arch/arm/mach-clps711x/include/mach/gpio.harch/arm/mach-clps711x/include/mach/gpio.h new file +21
-0@@ -0,0 +1,27 @@ +/* +* This file contains the CLPS711X GPIO definitions. +* +* Copyright (C) 2012 Alexander Shiyan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +/* Simple helper for convert port & pin to GPIO number */ +#define CLPS711X_GPIO (port, bit) ((port) * 8 + (bit)) + +/* Temporaty definitions for GPIO-ports */ +/* Will be removed after remove clps_read(write) macros */ +#include <mach/hardware.h> +#define _PADR (CLPS711X_VIRT_BASE + PADR) +#define _PBDR (CLPS711X_VIRT_BASE + PBDR) +#define _PCDR (CLPS711X_VIRT_BASE + PCDR) +#define _PDDR (CLPS711X_VIRT_BASE + PDDR)Quoted 8 lines
arch/arm/mach-clps711x/include/mach/gpio.h line 27
Quoted 6 lines
arch/arm/mach-clps711x/include/mach/gpio.h new file +6
-0+#define _PADDR (CLPS711X_VIRT_BASE + PADDR) +#define _PBDDR (CLPS711X_VIRT_BASE + PBDDR) +#define _PCDDR (CLPS711X_VIRT_BASE + PCDDR) +#define _PDDDR (CLPS711X_VIRT_BASE + PDDDR) +#define _PEDR (CLPS711X_VIRT_BASE + PEDR) +#define _PEDDR (CLPS711X_VIRT_BASE + PEDDR)Why can't this file (or the bulk of it) live in
drivers/gpio?Quoted 4 lines
We should have access for macros in
gpio.hfrom board support files and other drivers. Fromdrivers/gpioit not possible.
If you ask about port definitions, as I say before, it will be removed later after rework on platform hardware definitions.No other drivers should be directly accessing the GPIO registers - doing so is likely a bug because of the inherent lack of locking, which will cause race conditions.
Quoted 6 lines
Quoted 2 lines
All accesses to GPIOs should be done via gpiolib, even from board support files.
Yes, and I am say only about macro that calculate GPIO-number from port number and bit position. Access to this is a helpful for understand source code.
Sorry, I don't think you're understanding.
Why can't you put:
#define _PADR (CLPS711X_VIRT_BASE + PADR)
and the other macros inside drivers/gpio/gpio-clps711x.c ? This should be the _only_ file which uses them.
PATCH v3 1/1 GPIO: Add support for GPIO on CLPS711X-target platform
In reply to Alexander ShiyanQuoted 6 lines · Alexander Shiyan
The CLPS711X CPUs provide some GPIOs for use in the system. This driver provides support for these via gpiolib. Due to platform limitations, driver does not support interrupts, only inputs and outputs.
Signed-off-by Alexander Shiyan <[email protected]>
I agree with Russell's comment that all register access macros need to be pushed down to drivers/gpio/gpio-clps711x.c.
Preferably they should also be replaced by register #defines and ioremap:ed accesses but I'm not going to be pushy about that since the driver certainly looks way better after this than before, so it can be fixed up later.
Yours,
Linus Walleij