diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-09-25 15:11:48 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-09-27 15:58:59 -0400 |
commit | 8d48427ecb0639593ccf14e807479b7873254ccb (patch) | |
tree | 7bcc5f49faf33515d5d65fae53d6670cfe76e5c3 /arch/arm/mach-sa1100/collie.c | |
parent | 2dc94310bd94d0906febea7d0f7c188da620c952 (diff) |
[ARM] 3847/2: Convert LOMOMO to use struct device for GPIOs
Convert LOMOMO to use struct device * for GPIOs instead of struct
locomo_dev. This enables access to the GPIOs from code which is not
a locomo device itself (such as audio). Access for gpio 31 is removed
for error handling (no such hardware exists).
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-sa1100/collie.c')
-rw-r--r-- | arch/arm/mach-sa1100/collie.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index a0dfa390e34b..6496eb645cee 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -91,30 +91,29 @@ static struct mcp_plat_data collie_mcp_data = { | |||
91 | /* | 91 | /* |
92 | * low-level UART features. | 92 | * low-level UART features. |
93 | */ | 93 | */ |
94 | static struct locomo_dev *uart_dev = NULL; | 94 | struct platform_device collie_locomo_device; |
95 | 95 | ||
96 | static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl) | 96 | static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl) |
97 | { | 97 | { |
98 | if (!uart_dev) return; | ||
99 | |||
100 | if (mctrl & TIOCM_RTS) | 98 | if (mctrl & TIOCM_RTS) |
101 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_RTS, 0); | 99 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 0); |
102 | else | 100 | else |
103 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_RTS, 1); | 101 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 1); |
104 | 102 | ||
105 | if (mctrl & TIOCM_DTR) | 103 | if (mctrl & TIOCM_DTR) |
106 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_DTR, 0); | 104 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 0); |
107 | else | 105 | else |
108 | locomo_gpio_write(uart_dev, LOCOMO_GPIO_DTR, 1); | 106 | locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 1); |
109 | } | 107 | } |
110 | 108 | ||
111 | static u_int collie_uart_get_mctrl(struct uart_port *port) | 109 | static u_int collie_uart_get_mctrl(struct uart_port *port) |
112 | { | 110 | { |
113 | int ret = TIOCM_CD; | 111 | int ret = TIOCM_CD; |
114 | unsigned int r; | 112 | unsigned int r; |
115 | if (!uart_dev) return ret; | ||
116 | 113 | ||
117 | r = locomo_gpio_read_output(uart_dev, LOCOMO_GPIO_CTS & LOCOMO_GPIO_DSR); | 114 | r = locomo_gpio_read_output(&collie_locomo_device.dev, LOCOMO_GPIO_CTS & LOCOMO_GPIO_DSR); |
115 | if (r == -ENODEV) | ||
116 | return ret; | ||
118 | if (r & LOCOMO_GPIO_CTS) | 117 | if (r & LOCOMO_GPIO_CTS) |
119 | ret |= TIOCM_CTS; | 118 | ret |= TIOCM_CTS; |
120 | if (r & LOCOMO_GPIO_DSR) | 119 | if (r & LOCOMO_GPIO_DSR) |
@@ -130,13 +129,11 @@ static struct sa1100_port_fns collie_port_fns __initdata = { | |||
130 | 129 | ||
131 | static int collie_uart_probe(struct locomo_dev *dev) | 130 | static int collie_uart_probe(struct locomo_dev *dev) |
132 | { | 131 | { |
133 | uart_dev = dev; | ||
134 | return 0; | 132 | return 0; |
135 | } | 133 | } |
136 | 134 | ||
137 | static int collie_uart_remove(struct locomo_dev *dev) | 135 | static int collie_uart_remove(struct locomo_dev *dev) |
138 | { | 136 | { |
139 | uart_dev = NULL; | ||
140 | return 0; | 137 | return 0; |
141 | } | 138 | } |
142 | 139 | ||
@@ -170,7 +167,7 @@ static struct resource locomo_resources[] = { | |||
170 | }, | 167 | }, |
171 | }; | 168 | }; |
172 | 169 | ||
173 | static struct platform_device locomo_device = { | 170 | struct platform_device collie_locomo_device = { |
174 | .name = "locomo", | 171 | .name = "locomo", |
175 | .id = 0, | 172 | .id = 0, |
176 | .num_resources = ARRAY_SIZE(locomo_resources), | 173 | .num_resources = ARRAY_SIZE(locomo_resources), |
@@ -178,7 +175,7 @@ static struct platform_device locomo_device = { | |||
178 | }; | 175 | }; |
179 | 176 | ||
180 | static struct platform_device *devices[] __initdata = { | 177 | static struct platform_device *devices[] __initdata = { |
181 | &locomo_device, | 178 | &collie_locomo_device, |
182 | &colliescoop_device, | 179 | &colliescoop_device, |
183 | }; | 180 | }; |
184 | 181 | ||