aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2012-08-13 04:36:55 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-08-13 07:53:05 -0400
commit04b13de6229621b2bd9eb1b7afaded954c3037de (patch)
tree8048c02ae7b111c165acd51c99bd3a361c1221bc
parentfcb28d2e9db7f1fc146a6e95200f166a86224066 (diff)
pinctrl/coh901: retire ancient GPIO block versions
As the non-U335 U300 variants are retired from the ARM tree, also delete the pinctrl driver codepaths for these variants. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--arch/arm/mach-u300/core.c1
-rw-r--r--arch/arm/mach-u300/include/mach/gpio-u300.h13
-rw-r--r--drivers/pinctrl/pinctrl-coh901.c218
3 files changed, 43 insertions, 189 deletions
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 17940754446e..883d5c26d50b 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1440,7 +1440,6 @@ static struct platform_device pinctrl_device = {
1440 * GPIO block, with different number of ports. 1440 * GPIO block, with different number of ports.
1441 */ 1441 */
1442static struct u300_gpio_platform u300_gpio_plat = { 1442static struct u300_gpio_platform u300_gpio_plat = {
1443 .variant = U300_GPIO_COH901571_3_BS335,
1444 .ports = 7, 1443 .ports = 7,
1445 .gpio_base = 0, 1444 .gpio_base = 0,
1446 .gpio_irq_base = IRQ_U300_GPIO_BASE, 1445 .gpio_irq_base = IRQ_U300_GPIO_BASE,
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
index e81400c1753a..30dea251b835 100644
--- a/arch/arm/mach-u300/include/mach/gpio-u300.h
+++ b/arch/arm/mach-u300/include/mach/gpio-u300.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2011 ST-Ericsson AB 2 * Copyright (C) 2007-2012 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2 3 * License terms: GNU General Public License (GPL) version 2
4 * GPIO block resgister definitions and inline macros for 4 * GPIO block resgister definitions and inline macros for
5 * U300 GPIO COH 901 335 or COH 901 571/3 5 * U300 GPIO COH 901 335 or COH 901 571/3
@@ -10,24 +10,13 @@
10#define __MACH_U300_GPIO_U300_H 10#define __MACH_U300_GPIO_U300_H
11 11
12/** 12/**
13 * enum u300_gpio_variant - the type of U300 GPIO employed
14 */
15enum u300_gpio_variant {
16 U300_GPIO_COH901335,
17 U300_GPIO_COH901571_3_BS335,
18 U300_GPIO_COH901571_3_BS365,
19};
20
21/**
22 * struct u300_gpio_platform - U300 GPIO platform data 13 * struct u300_gpio_platform - U300 GPIO platform data
23 * @variant: IP block variant
24 * @ports: number of GPIO block ports 14 * @ports: number of GPIO block ports
25 * @gpio_base: first GPIO number for this block (use a free range) 15 * @gpio_base: first GPIO number for this block (use a free range)
26 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range) 16 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
27 * @pinctrl_device: pin control device to spawn as child 17 * @pinctrl_device: pin control device to spawn as child
28 */ 18 */
29struct u300_gpio_platform { 19struct u300_gpio_platform {
30 enum u300_gpio_variant variant;
31 u8 ports; 20 u8 ports;
32 int gpio_base; 21 int gpio_base;
33 int gpio_irq_base; 22 int gpio_irq_base;
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index cc0f00d73d15..91a5dc7f6766 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -1,11 +1,8 @@
1/* 1/*
2 * U300 GPIO module. 2 * U300 GPIO module.
3 * 3 *
4 * Copyright (C) 2007-2011 ST-Ericsson AB 4 * Copyright (C) 2007-2012 ST-Ericsson AB
5 * License terms: GNU General Public License (GPL) version 2 5 * License terms: GNU General Public License (GPL) version 2
6 * This can driver either of the two basic GPIO cores
7 * available in the U300 platforms:
8 * COH 901 335 - Used in DB3150 (U300 1.0) and DB3200 (U330 1.0)
9 * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0) 6 * COH 901 571/3 - Used in DB3210 (U365 2.0) and DB3350 (U335 1.0)
10 * Author: Linus Walleij <linus.walleij@linaro.org> 7 * Author: Linus Walleij <linus.walleij@linaro.org>
11 * Author: Jonas Aaberg <jonas.aberg@stericsson.com> 8 * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
@@ -27,16 +24,19 @@
27#include <mach/gpio-u300.h> 24#include <mach/gpio-u300.h>
28#include "pinctrl-coh901.h" 25#include "pinctrl-coh901.h"
29 26
27#define U300_GPIO_PORT_STRIDE (0x30)
30/* 28/*
31 * Register definitions for COH 901 335 variant 29 * Control Register 32bit (R/W)
30 * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
31 * gives the number of GPIO pins.
32 * bit 8-2 (mask 0x000001FC) contains the core version ID.
32 */ 33 */
33#define U300_335_PORT_STRIDE (0x1C) 34#define U300_GPIO_CR (0x00)
34/* Port X Pin Data Register 32bit, this is both input and output (R/W) */ 35#define U300_GPIO_CR_SYNC_SEL_ENABLE (0x00000002UL)
35#define U300_335_PXPDIR (0x00) 36#define U300_GPIO_CR_BLOCK_CLKRQ_ENABLE (0x00000001UL)
36#define U300_335_PXPDOR (0x00) 37#define U300_GPIO_PXPDIR (0x04)
37/* Port X Pin Config Register 32bit (R/W) */ 38#define U300_GPIO_PXPDOR (0x08)
38#define U300_335_PXPCR (0x04) 39#define U300_GPIO_PXPCR (0x0C)
39/* This register layout is the same in both blocks */
40#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL) 40#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL)
41#define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL) 41#define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL)
42#define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL) 42#define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL)
@@ -44,53 +44,17 @@
44#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL) 44#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL)
45#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL) 45#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL)
46#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL) 46#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL)
47/* Port X Interrupt Event Register 32bit (R/W) */ 47#define U300_GPIO_PXPER (0x10)
48#define U300_335_PXIEV (0x08) 48#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL)
49/* Port X Interrupt Enable Register 32bit (R/W) */ 49#define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL)
50#define U300_335_PXIEN (0x0C) 50#define U300_GPIO_PXIEV (0x14)
51/* Port X Interrupt Force Register 32bit (R/W) */ 51#define U300_GPIO_PXIEN (0x18)
52#define U300_335_PXIFR (0x10) 52#define U300_GPIO_PXIFR (0x1C)
53/* Port X Interrupt Config Register 32bit (R/W) */ 53#define U300_GPIO_PXICR (0x20)
54#define U300_335_PXICR (0x14)
55/* This register layout is the same in both blocks */
56#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL) 54#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL)
57#define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL) 55#define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL)
58#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL) 56#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL)
59#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL) 57#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL)
60/* Port X Pull-up Enable Register 32bit (R/W) */
61#define U300_335_PXPER (0x18)
62/* This register layout is the same in both blocks */
63#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL)
64#define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL)
65/* Control Register 32bit (R/W) */
66#define U300_335_CR (0x54)
67#define U300_335_CR_BLOCK_CLOCK_ENABLE (0x00000001UL)
68
69/*
70 * Register definitions for COH 901 571 / 3 variant
71 */
72#define U300_571_PORT_STRIDE (0x30)
73/*
74 * Control Register 32bit (R/W)
75 * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
76 * gives the number of GPIO pins.
77 * bit 8-2 (mask 0x000001FC) contains the core version ID.
78 */
79#define U300_571_CR (0x00)
80#define U300_571_CR_SYNC_SEL_ENABLE (0x00000002UL)
81#define U300_571_CR_BLOCK_CLKRQ_ENABLE (0x00000001UL)
82/*
83 * These registers have the same layout and function as the corresponding
84 * COH 901 335 registers, just at different offset.
85 */
86#define U300_571_PXPDIR (0x04)
87#define U300_571_PXPDOR (0x08)
88#define U300_571_PXPCR (0x0C)
89#define U300_571_PXPER (0x10)
90#define U300_571_PXIEV (0x14)
91#define U300_571_PXIEN (0x18)
92#define U300_571_PXIFR (0x1C)
93#define U300_571_PXICR (0x20)
94 58
95/* 8 bits per port, no version has more than 7 ports */ 59/* 8 bits per port, no version has more than 7 ports */
96#define U300_GPIO_PINS_PER_PORT 8 60#define U300_GPIO_PINS_PER_PORT 8
@@ -149,8 +113,6 @@ struct u300_gpio_confdata {
149 113
150/* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */ 114/* BS335 has seven ports of 8 bits each = GPIO pins 0..55 */
151#define BS335_GPIO_NUM_PORTS 7 115#define BS335_GPIO_NUM_PORTS 7
152/* BS365 has five ports of 8 bits each = GPIO pins 0..39 */
153#define BS365_GPIO_NUM_PORTS 5
154 116
155#define U300_FLOATING_INPUT { \ 117#define U300_FLOATING_INPUT { \
156 .bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \ 118 .bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \
@@ -172,7 +134,6 @@ struct u300_gpio_confdata {
172 .outval = 1, \ 134 .outval = 1, \
173} 135}
174 136
175
176/* Initial configuration */ 137/* Initial configuration */
177static const struct __initconst u300_gpio_confdata 138static const struct __initconst u300_gpio_confdata
178bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = { 139bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
@@ -255,66 +216,6 @@ bs335_gpio_config[BS335_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
255 } 216 }
256}; 217};
257 218
258static const struct __initconst u300_gpio_confdata
259bs365_gpio_config[BS365_GPIO_NUM_PORTS][U300_GPIO_PINS_PER_PORT] = {
260 /* Port 0, pins 0-7 */
261 {
262 U300_FLOATING_INPUT,
263 U300_OUTPUT_LOW,
264 U300_FLOATING_INPUT,
265 U300_OUTPUT_LOW,
266 U300_OUTPUT_LOW,
267 U300_OUTPUT_LOW,
268 U300_PULL_UP_INPUT,
269 U300_FLOATING_INPUT,
270 },
271 /* Port 1, pins 0-7 */
272 {
273 U300_OUTPUT_LOW,
274 U300_FLOATING_INPUT,
275 U300_OUTPUT_LOW,
276 U300_FLOATING_INPUT,
277 U300_FLOATING_INPUT,
278 U300_OUTPUT_HIGH,
279 U300_OUTPUT_LOW,
280 U300_OUTPUT_LOW,
281 },
282 /* Port 2, pins 0-7 */
283 {
284 U300_FLOATING_INPUT,
285 U300_PULL_UP_INPUT,
286 U300_OUTPUT_LOW,
287 U300_OUTPUT_LOW,
288 U300_PULL_UP_INPUT,
289 U300_PULL_UP_INPUT,
290 U300_PULL_UP_INPUT,
291 U300_PULL_UP_INPUT,
292 },
293 /* Port 3, pins 0-7 */
294 {
295 U300_PULL_UP_INPUT,
296 U300_PULL_UP_INPUT,
297 U300_PULL_UP_INPUT,
298 U300_PULL_UP_INPUT,
299 U300_PULL_UP_INPUT,
300 U300_PULL_UP_INPUT,
301 U300_PULL_UP_INPUT,
302 U300_PULL_UP_INPUT,
303 },
304 /* Port 4, pins 0-7 */
305 {
306 U300_PULL_UP_INPUT,
307 U300_PULL_UP_INPUT,
308 U300_PULL_UP_INPUT,
309 U300_PULL_UP_INPUT,
310 /* These 4 pins doesn't exist on DB3210 */
311 U300_OUTPUT_LOW,
312 U300_OUTPUT_LOW,
313 U300_OUTPUT_LOW,
314 U300_OUTPUT_LOW,
315 }
316};
317
318/** 219/**
319 * to_u300_gpio() - get the pointer to u300_gpio 220 * to_u300_gpio() - get the pointer to u300_gpio
320 * @chip: the gpio chip member of the structure u300_gpio 221 * @chip: the gpio chip member of the structure u300_gpio
@@ -716,13 +617,7 @@ static void __init u300_gpio_init_coh901571(struct u300_gpio *gpio,
716 const struct u300_gpio_confdata *conf; 617 const struct u300_gpio_confdata *conf;
717 int offset = (i*8) + j; 618 int offset = (i*8) + j;
718 619
719 if (plat->variant == U300_GPIO_COH901571_3_BS335) 620 conf = &bs335_gpio_config[i][j];
720 conf = &bs335_gpio_config[i][j];
721 else if (plat->variant == U300_GPIO_COH901571_3_BS365)
722 conf = &bs365_gpio_config[i][j];
723 else
724 break;
725
726 u300_gpio_init_pin(gpio, offset, conf); 621 u300_gpio_init_pin(gpio, offset, conf);
727 } 622 }
728 } 623 }
@@ -796,50 +691,27 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
796 goto err_no_ioremap; 691 goto err_no_ioremap;
797 } 692 }
798 693
799 if (plat->variant == U300_GPIO_COH901335) { 694 dev_info(gpio->dev,
800 dev_info(gpio->dev, 695 "initializing GPIO Controller COH 901 571/3\n");
801 "initializing GPIO Controller COH 901 335\n"); 696 gpio->stride = U300_GPIO_PORT_STRIDE;
802 gpio->stride = U300_335_PORT_STRIDE; 697 gpio->pcr = U300_GPIO_PXPCR;
803 gpio->pcr = U300_335_PXPCR; 698 gpio->dor = U300_GPIO_PXPDOR;
804 gpio->dor = U300_335_PXPDOR; 699 gpio->dir = U300_GPIO_PXPDIR;
805 gpio->dir = U300_335_PXPDIR; 700 gpio->per = U300_GPIO_PXPER;
806 gpio->per = U300_335_PXPER; 701 gpio->icr = U300_GPIO_PXICR;
807 gpio->icr = U300_335_PXICR; 702 gpio->ien = U300_GPIO_PXIEN;
808 gpio->ien = U300_335_PXIEN; 703 gpio->iev = U300_GPIO_PXIEV;
809 gpio->iev = U300_335_PXIEV; 704 ifr = U300_GPIO_PXIFR;
810 ifr = U300_335_PXIFR; 705
811 706 val = readl(gpio->base + U300_GPIO_CR);
812 /* Turn on the GPIO block */ 707 dev_info(gpio->dev, "COH901571/3 block version: %d, " \
813 writel(U300_335_CR_BLOCK_CLOCK_ENABLE, 708 "number of cores: %d totalling %d pins\n",
814 gpio->base + U300_335_CR); 709 ((val & 0x000001FC) >> 2),
815 } else if (plat->variant == U300_GPIO_COH901571_3_BS335 || 710 ((val & 0x0000FE00) >> 9),
816 plat->variant == U300_GPIO_COH901571_3_BS365) { 711 ((val & 0x0000FE00) >> 9) * 8);
817 dev_info(gpio->dev, 712 writel(U300_GPIO_CR_BLOCK_CLKRQ_ENABLE,
818 "initializing GPIO Controller COH 901 571/3\n"); 713 gpio->base + U300_GPIO_CR);
819 gpio->stride = U300_571_PORT_STRIDE; 714 u300_gpio_init_coh901571(gpio, plat);
820 gpio->pcr = U300_571_PXPCR;
821 gpio->dor = U300_571_PXPDOR;
822 gpio->dir = U300_571_PXPDIR;
823 gpio->per = U300_571_PXPER;
824 gpio->icr = U300_571_PXICR;
825 gpio->ien = U300_571_PXIEN;
826 gpio->iev = U300_571_PXIEV;
827 ifr = U300_571_PXIFR;
828
829 val = readl(gpio->base + U300_571_CR);
830 dev_info(gpio->dev, "COH901571/3 block version: %d, " \
831 "number of cores: %d totalling %d pins\n",
832 ((val & 0x000001FC) >> 2),
833 ((val & 0x0000FE00) >> 9),
834 ((val & 0x0000FE00) >> 9) * 8);
835 writel(U300_571_CR_BLOCK_CLKRQ_ENABLE,
836 gpio->base + U300_571_CR);
837 u300_gpio_init_coh901571(gpio, plat);
838 } else {
839 dev_err(gpio->dev, "unknown block variant\n");
840 err = -ENODEV;
841 goto err_unknown_variant;
842 }
843 715
844 /* Add each port with its IRQ separately */ 716 /* Add each port with its IRQ separately */
845 INIT_LIST_HEAD(&gpio->port_list); 717 INIT_LIST_HEAD(&gpio->port_list);
@@ -906,7 +778,6 @@ err_no_pinctrl:
906err_no_chip: 778err_no_chip:
907err_no_port: 779err_no_port:
908 u300_gpio_free_ports(gpio); 780 u300_gpio_free_ports(gpio);
909err_unknown_variant:
910 iounmap(gpio->base); 781 iounmap(gpio->base);
911err_no_ioremap: 782err_no_ioremap:
912 release_mem_region(gpio->memres->start, resource_size(gpio->memres)); 783 release_mem_region(gpio->memres->start, resource_size(gpio->memres));
@@ -923,16 +794,11 @@ err_no_clk:
923 794
924static int __exit u300_gpio_remove(struct platform_device *pdev) 795static int __exit u300_gpio_remove(struct platform_device *pdev)
925{ 796{
926 struct u300_gpio_platform *plat = dev_get_platdata(&pdev->dev);
927 struct u300_gpio *gpio = platform_get_drvdata(pdev); 797 struct u300_gpio *gpio = platform_get_drvdata(pdev);
928 int err; 798 int err;
929 799
930 /* Turn off the GPIO block */ 800 /* Turn off the GPIO block */
931 if (plat->variant == U300_GPIO_COH901335) 801 writel(0x00000000U, gpio->base + U300_GPIO_CR);
932 writel(0x00000000U, gpio->base + U300_335_CR);
933 if (plat->variant == U300_GPIO_COH901571_3_BS335 ||
934 plat->variant == U300_GPIO_COH901571_3_BS365)
935 writel(0x00000000U, gpio->base + U300_571_CR);
936 802
937 err = gpiochip_remove(&gpio->chip); 803 err = gpiochip_remove(&gpio->chip);
938 if (err < 0) { 804 if (err < 0) {