Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-pxa/ssp.c |
| 3 | * |
| 4 | * based on linux/arch/arm/mach-sa1100/ssp.c by Russell King |
| 5 | * |
| 6 | * Copyright (C) 2003 Russell King. |
| 7 | * Copyright (C) 2003 Wolfson Microelectronics PLC |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * PXA2xx SSP driver. This provides the generic core for simple |
| 14 | * IO-based SSP applications and allows easy port setup for DMA access. |
| 15 | * |
| 16 | * Author: Liam Girdwood <liam.girdwood@wolfsonmicro.com> |
| 17 | * |
| 18 | * Revision history: |
| 19 | * 22nd Aug 2003 Initial version. |
| 20 | * 20th Dec 2004 Added ssp_config for changing port config without |
| 21 | * closing the port. |
Liam Girdwood | b216c01 | 2005-11-10 17:45:39 +0000 | [diff] [blame] | 22 | * 4th Aug 2005 Added option to disable irq handler registration and |
| 23 | * cleaned up irq and clock detection. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | */ |
| 25 | |
| 26 | #include <linux/module.h> |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/sched.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/errno.h> |
| 31 | #include <linux/interrupt.h> |
| 32 | #include <linux/ioport.h> |
| 33 | #include <linux/init.h> |
Arjan van de Ven | 0043170 | 2006-01-12 18:42:23 +0000 | [diff] [blame] | 34 | #include <linux/mutex.h> |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 35 | #include <linux/clk.h> |
| 36 | #include <linux/err.h> |
| 37 | #include <linux/platform_device.h> |
| 38 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #include <asm/io.h> |
| 40 | #include <asm/irq.h> |
| 41 | #include <asm/hardware.h> |
| 42 | #include <asm/arch/ssp.h> |
| 43 | #include <asm/arch/pxa-regs.h> |
eric miao | 0aea1fd | 2007-11-21 16:57:12 +0800 | [diff] [blame^] | 44 | #include <asm/arch/regs-ssp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 46 | #define TIMEOUT 100000 |
| 47 | |
Linus Torvalds | 0cd61b6 | 2006-10-06 10:53:39 -0700 | [diff] [blame] | 48 | static irqreturn_t ssp_interrupt(int irq, void *dev_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | { |
| 50 | struct ssp_dev *dev = (struct ssp_dev*) dev_id; |
| 51 | unsigned int status = SSSR_P(dev->port); |
| 52 | |
| 53 | SSSR_P(dev->port) = status; /* clear status bits */ |
| 54 | |
| 55 | if (status & SSSR_ROR) |
| 56 | printk(KERN_WARNING "SSP(%d): receiver overrun\n", dev->port); |
| 57 | |
| 58 | if (status & SSSR_TUR) |
| 59 | printk(KERN_WARNING "SSP(%d): transmitter underrun\n", dev->port); |
| 60 | |
| 61 | if (status & SSSR_BCE) |
| 62 | printk(KERN_WARNING "SSP(%d): bit count error\n", dev->port); |
| 63 | |
| 64 | return IRQ_HANDLED; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * ssp_write_word - write a word to the SSP port |
| 69 | * @data: 32-bit, MSB justified data to write. |
| 70 | * |
| 71 | * Wait for a free entry in the SSP transmit FIFO, and write a data |
| 72 | * word to the SSP port. |
| 73 | * |
| 74 | * The caller is expected to perform the necessary locking. |
| 75 | * |
| 76 | * Returns: |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 77 | * %-ETIMEDOUT timeout occurred |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | * 0 success |
| 79 | */ |
| 80 | int ssp_write_word(struct ssp_dev *dev, u32 data) |
| 81 | { |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 82 | int timeout = TIMEOUT; |
| 83 | |
| 84 | while (!(SSSR_P(dev->port) & SSSR_TNF)) { |
| 85 | if (!--timeout) |
| 86 | return -ETIMEDOUT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | cpu_relax(); |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 88 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | |
| 90 | SSDR_P(dev->port) = data; |
| 91 | |
| 92 | return 0; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * ssp_read_word - read a word from the SSP port |
| 97 | * |
| 98 | * Wait for a data word in the SSP receive FIFO, and return the |
| 99 | * received data. Data is LSB justified. |
| 100 | * |
| 101 | * Note: Currently, if data is not expected to be received, this |
| 102 | * function will wait for ever. |
| 103 | * |
| 104 | * The caller is expected to perform the necessary locking. |
| 105 | * |
| 106 | * Returns: |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 107 | * %-ETIMEDOUT timeout occurred |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | * 32-bit data success |
| 109 | */ |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 110 | int ssp_read_word(struct ssp_dev *dev, u32 *data) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | { |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 112 | int timeout = TIMEOUT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 114 | while (!(SSSR_P(dev->port) & SSSR_RNE)) { |
| 115 | if (!--timeout) |
| 116 | return -ETIMEDOUT; |
| 117 | cpu_relax(); |
| 118 | } |
| 119 | |
| 120 | *data = SSDR_P(dev->port); |
| 121 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | /** |
| 125 | * ssp_flush - flush the transmit and receive FIFOs |
| 126 | * |
| 127 | * Wait for the SSP to idle, and ensure that the receive FIFO |
| 128 | * is empty. |
| 129 | * |
| 130 | * The caller is expected to perform the necessary locking. |
| 131 | */ |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 132 | int ssp_flush(struct ssp_dev *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | { |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 134 | int timeout = TIMEOUT * 2; |
| 135 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | do { |
| 137 | while (SSSR_P(dev->port) & SSSR_RNE) { |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 138 | if (!--timeout) |
| 139 | return -ETIMEDOUT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | (void) SSDR_P(dev->port); |
| 141 | } |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 142 | if (!--timeout) |
| 143 | return -ETIMEDOUT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | } while (SSSR_P(dev->port) & SSSR_BSY); |
Paul Sokolovsky | 8f1bf87 | 2006-08-27 12:54:56 +0100 | [diff] [blame] | 145 | |
| 146 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | /** |
| 150 | * ssp_enable - enable the SSP port |
| 151 | * |
| 152 | * Turn on the SSP port. |
| 153 | */ |
| 154 | void ssp_enable(struct ssp_dev *dev) |
| 155 | { |
| 156 | SSCR0_P(dev->port) |= SSCR0_SSE; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * ssp_disable - shut down the SSP port |
| 161 | * |
| 162 | * Turn off the SSP port, optionally powering it down. |
| 163 | */ |
| 164 | void ssp_disable(struct ssp_dev *dev) |
| 165 | { |
| 166 | SSCR0_P(dev->port) &= ~SSCR0_SSE; |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * ssp_save_state - save the SSP configuration |
| 171 | * @ssp: pointer to structure to save SSP configuration |
| 172 | * |
| 173 | * Save the configured SSP state for suspend. |
| 174 | */ |
| 175 | void ssp_save_state(struct ssp_dev *dev, struct ssp_state *ssp) |
| 176 | { |
| 177 | ssp->cr0 = SSCR0_P(dev->port); |
| 178 | ssp->cr1 = SSCR1_P(dev->port); |
| 179 | ssp->to = SSTO_P(dev->port); |
| 180 | ssp->psp = SSPSP_P(dev->port); |
| 181 | |
| 182 | SSCR0_P(dev->port) &= ~SSCR0_SSE; |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * ssp_restore_state - restore a previously saved SSP configuration |
| 187 | * @ssp: pointer to configuration saved by ssp_save_state |
| 188 | * |
| 189 | * Restore the SSP configuration saved previously by ssp_save_state. |
| 190 | */ |
| 191 | void ssp_restore_state(struct ssp_dev *dev, struct ssp_state *ssp) |
| 192 | { |
| 193 | SSSR_P(dev->port) = SSSR_ROR | SSSR_TUR | SSSR_BCE; |
| 194 | |
| 195 | SSCR0_P(dev->port) = ssp->cr0 & ~SSCR0_SSE; |
| 196 | SSCR1_P(dev->port) = ssp->cr1; |
| 197 | SSTO_P(dev->port) = ssp->to; |
| 198 | SSPSP_P(dev->port) = ssp->psp; |
| 199 | |
| 200 | SSCR0_P(dev->port) = ssp->cr0; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * ssp_config - configure SSP port settings |
| 205 | * @mode: port operating mode |
| 206 | * @flags: port config flags |
| 207 | * @psp_flags: port PSP config flags |
| 208 | * @speed: port speed |
| 209 | * |
| 210 | * Port MUST be disabled by ssp_disable before making any config changes. |
| 211 | */ |
| 212 | int ssp_config(struct ssp_dev *dev, u32 mode, u32 flags, u32 psp_flags, u32 speed) |
| 213 | { |
| 214 | dev->mode = mode; |
| 215 | dev->flags = flags; |
| 216 | dev->psp_flags = psp_flags; |
| 217 | dev->speed = speed; |
| 218 | |
| 219 | /* set up port type, speed, port settings */ |
| 220 | SSCR0_P(dev->port) = (dev->speed | dev->mode); |
| 221 | SSCR1_P(dev->port) = dev->flags; |
| 222 | SSPSP_P(dev->port) = dev->psp_flags; |
| 223 | |
| 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * ssp_init - setup the SSP port |
| 229 | * |
| 230 | * initialise and claim resources for the SSP port. |
| 231 | * |
| 232 | * Returns: |
| 233 | * %-ENODEV if the SSP port is unavailable |
| 234 | * %-EBUSY if the resources are already in use |
| 235 | * %0 on success |
| 236 | */ |
Liam Girdwood | b216c01 | 2005-11-10 17:45:39 +0000 | [diff] [blame] | 237 | int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | { |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 239 | struct ssp_device *ssp; |
Liam Girdwood | b216c01 | 2005-11-10 17:45:39 +0000 | [diff] [blame] | 240 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 242 | ssp = ssp_request(port, "SSP"); |
| 243 | if (ssp == NULL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | return -ENODEV; |
| 245 | |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 246 | dev->ssp = ssp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | dev->port = port; |
| 248 | |
Liam Girdwood | b216c01 | 2005-11-10 17:45:39 +0000 | [diff] [blame] | 249 | /* do we need to get irq */ |
| 250 | if (!(init_flags & SSP_NO_IRQ)) { |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 251 | ret = request_irq(ssp->irq, ssp_interrupt, |
Liam Girdwood | b216c01 | 2005-11-10 17:45:39 +0000 | [diff] [blame] | 252 | 0, "SSP", dev); |
| 253 | if (ret) |
| 254 | goto out_region; |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 255 | dev->irq = ssp->irq; |
Liam Girdwood | b216c01 | 2005-11-10 17:45:39 +0000 | [diff] [blame] | 256 | } else |
| 257 | dev->irq = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
| 259 | /* turn on SSP port clock */ |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 260 | clk_enable(ssp->clk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | return 0; |
| 262 | |
| 263 | out_region: |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 264 | ssp_free(ssp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | return ret; |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * ssp_exit - undo the effects of ssp_init |
| 270 | * |
| 271 | * release and free resources for the SSP port. |
| 272 | */ |
| 273 | void ssp_exit(struct ssp_dev *dev) |
| 274 | { |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 275 | struct ssp_device *ssp = dev->ssp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 277 | SSCR0_P(dev->port) &= ~SSCR0_SSE; |
| 278 | free_irq(dev->irq, dev); |
| 279 | clk_disable(ssp->clk); |
| 280 | ssp_free(ssp); |
| 281 | } |
| 282 | |
| 283 | static DEFINE_MUTEX(ssp_lock); |
| 284 | static LIST_HEAD(ssp_list); |
| 285 | |
| 286 | struct ssp_device *ssp_request(int port, const char *label) |
| 287 | { |
| 288 | struct ssp_device *ssp = NULL; |
| 289 | |
| 290 | mutex_lock(&ssp_lock); |
| 291 | |
| 292 | list_for_each_entry(ssp, &ssp_list, node) { |
| 293 | if (ssp->port_id == port && ssp->use_count == 0) { |
| 294 | ssp->use_count++; |
| 295 | ssp->label = label; |
| 296 | break; |
| 297 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | } |
| 299 | |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 300 | mutex_unlock(&ssp_lock); |
| 301 | |
| 302 | if (ssp->port_id != port) |
| 303 | return NULL; |
| 304 | |
| 305 | return ssp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | } |
eric miao | 8828645 | 2007-12-06 17:56:42 +0800 | [diff] [blame] | 307 | EXPORT_SYMBOL(ssp_request); |
| 308 | |
| 309 | void ssp_free(struct ssp_device *ssp) |
| 310 | { |
| 311 | mutex_lock(&ssp_lock); |
| 312 | if (ssp->use_count) { |
| 313 | ssp->use_count--; |
| 314 | ssp->label = NULL; |
| 315 | } else |
| 316 | dev_err(&ssp->pdev->dev, "device already free\n"); |
| 317 | mutex_unlock(&ssp_lock); |
| 318 | } |
| 319 | EXPORT_SYMBOL(ssp_free); |
| 320 | |
| 321 | static int __devinit ssp_probe(struct platform_device *pdev, int type) |
| 322 | { |
| 323 | struct resource *res; |
| 324 | struct ssp_device *ssp; |
| 325 | int ret = 0; |
| 326 | |
| 327 | ssp = kzalloc(sizeof(struct ssp_device), GFP_KERNEL); |
| 328 | if (ssp == NULL) { |
| 329 | dev_err(&pdev->dev, "failed to allocate memory"); |
| 330 | return -ENOMEM; |
| 331 | } |
| 332 | |
| 333 | ssp->clk = clk_get(&pdev->dev, "SSPCLK"); |
| 334 | if (IS_ERR(ssp->clk)) { |
| 335 | ret = PTR_ERR(ssp->clk); |
| 336 | goto err_free; |
| 337 | } |
| 338 | |
| 339 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 340 | if (res == NULL) { |
| 341 | dev_err(&pdev->dev, "no memory resource defined\n"); |
| 342 | ret = -ENODEV; |
| 343 | goto err_free_clk; |
| 344 | } |
| 345 | |
| 346 | res = request_mem_region(res->start, res->end - res->start + 1, |
| 347 | pdev->name); |
| 348 | if (res == NULL) { |
| 349 | dev_err(&pdev->dev, "failed to request memory resource\n"); |
| 350 | ret = -EBUSY; |
| 351 | goto err_free_clk; |
| 352 | } |
| 353 | |
| 354 | ssp->phys_base = res->start; |
| 355 | |
| 356 | ssp->mmio_base = ioremap(res->start, res->end - res->start + 1); |
| 357 | if (ssp->mmio_base == NULL) { |
| 358 | dev_err(&pdev->dev, "failed to ioremap() registers\n"); |
| 359 | ret = -ENODEV; |
| 360 | goto err_free_mem; |
| 361 | } |
| 362 | |
| 363 | ssp->irq = platform_get_irq(pdev, 0); |
| 364 | if (ssp->irq < 0) { |
| 365 | dev_err(&pdev->dev, "no IRQ resource defined\n"); |
| 366 | ret = -ENODEV; |
| 367 | goto err_free_io; |
| 368 | } |
| 369 | |
| 370 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
| 371 | if (res == NULL) { |
| 372 | dev_err(&pdev->dev, "no SSP RX DRCMR defined\n"); |
| 373 | ret = -ENODEV; |
| 374 | goto err_free_io; |
| 375 | } |
| 376 | ssp->drcmr_rx = res->start; |
| 377 | |
| 378 | res = platform_get_resource(pdev, IORESOURCE_DMA, 1); |
| 379 | if (res == NULL) { |
| 380 | dev_err(&pdev->dev, "no SSP TX DRCMR defined\n"); |
| 381 | ret = -ENODEV; |
| 382 | goto err_free_io; |
| 383 | } |
| 384 | ssp->drcmr_tx = res->start; |
| 385 | |
| 386 | /* PXA2xx/3xx SSP ports starts from 1 and the internal pdev->id |
| 387 | * starts from 0, do a translation here |
| 388 | */ |
| 389 | ssp->port_id = pdev->id + 1; |
| 390 | ssp->use_count = 0; |
| 391 | ssp->type = type; |
| 392 | |
| 393 | mutex_lock(&ssp_lock); |
| 394 | list_add(&ssp->node, &ssp_list); |
| 395 | mutex_unlock(&ssp_lock); |
| 396 | |
| 397 | platform_set_drvdata(pdev, ssp); |
| 398 | return 0; |
| 399 | |
| 400 | err_free_io: |
| 401 | iounmap(ssp->mmio_base); |
| 402 | err_free_mem: |
| 403 | release_mem_region(res->start, res->end - res->start + 1); |
| 404 | err_free_clk: |
| 405 | clk_put(ssp->clk); |
| 406 | err_free: |
| 407 | kfree(ssp); |
| 408 | return ret; |
| 409 | } |
| 410 | |
| 411 | static int __devexit ssp_remove(struct platform_device *pdev) |
| 412 | { |
| 413 | struct resource *res; |
| 414 | struct ssp_device *ssp; |
| 415 | |
| 416 | ssp = platform_get_drvdata(pdev); |
| 417 | if (ssp == NULL) |
| 418 | return -ENODEV; |
| 419 | |
| 420 | iounmap(ssp->mmio_base); |
| 421 | |
| 422 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 423 | release_mem_region(res->start, res->end - res->start + 1); |
| 424 | |
| 425 | clk_put(ssp->clk); |
| 426 | |
| 427 | mutex_lock(&ssp_lock); |
| 428 | list_del(&ssp->node); |
| 429 | mutex_unlock(&ssp_lock); |
| 430 | |
| 431 | kfree(ssp); |
| 432 | return 0; |
| 433 | } |
| 434 | |
| 435 | static int __devinit pxa25x_ssp_probe(struct platform_device *pdev) |
| 436 | { |
| 437 | return ssp_probe(pdev, PXA25x_SSP); |
| 438 | } |
| 439 | |
| 440 | static int __devinit pxa25x_nssp_probe(struct platform_device *pdev) |
| 441 | { |
| 442 | return ssp_probe(pdev, PXA25x_NSSP); |
| 443 | } |
| 444 | |
| 445 | static int __devinit pxa27x_ssp_probe(struct platform_device *pdev) |
| 446 | { |
| 447 | return ssp_probe(pdev, PXA27x_SSP); |
| 448 | } |
| 449 | |
| 450 | static struct platform_driver pxa25x_ssp_driver = { |
| 451 | .driver = { |
| 452 | .name = "pxa25x-ssp", |
| 453 | }, |
| 454 | .probe = pxa25x_ssp_probe, |
| 455 | .remove = __devexit_p(ssp_remove), |
| 456 | }; |
| 457 | |
| 458 | static struct platform_driver pxa25x_nssp_driver = { |
| 459 | .driver = { |
| 460 | .name = "pxa25x-nssp", |
| 461 | }, |
| 462 | .probe = pxa25x_nssp_probe, |
| 463 | .remove = __devexit_p(ssp_remove), |
| 464 | }; |
| 465 | |
| 466 | static struct platform_driver pxa27x_ssp_driver = { |
| 467 | .driver = { |
| 468 | .name = "pxa27x-ssp", |
| 469 | }, |
| 470 | .probe = pxa27x_ssp_probe, |
| 471 | .remove = __devexit_p(ssp_remove), |
| 472 | }; |
| 473 | |
| 474 | static int __init pxa_ssp_init(void) |
| 475 | { |
| 476 | int ret = 0; |
| 477 | |
| 478 | ret = platform_driver_register(&pxa25x_ssp_driver); |
| 479 | if (ret) { |
| 480 | printk(KERN_ERR "failed to register pxa25x_ssp_driver"); |
| 481 | return ret; |
| 482 | } |
| 483 | |
| 484 | ret = platform_driver_register(&pxa25x_nssp_driver); |
| 485 | if (ret) { |
| 486 | printk(KERN_ERR "failed to register pxa25x_nssp_driver"); |
| 487 | return ret; |
| 488 | } |
| 489 | |
| 490 | ret = platform_driver_register(&pxa27x_ssp_driver); |
| 491 | if (ret) { |
| 492 | printk(KERN_ERR "failed to register pxa27x_ssp_driver"); |
| 493 | return ret; |
| 494 | } |
| 495 | |
| 496 | return ret; |
| 497 | } |
| 498 | |
| 499 | static void __exit pxa_ssp_exit(void) |
| 500 | { |
| 501 | platform_driver_unregister(&pxa25x_ssp_driver); |
| 502 | platform_driver_unregister(&pxa25x_nssp_driver); |
| 503 | platform_driver_unregister(&pxa27x_ssp_driver); |
| 504 | } |
| 505 | |
| 506 | module_init(pxa_ssp_init); |
| 507 | module_exit(pxa_ssp_exit); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 508 | |
| 509 | EXPORT_SYMBOL(ssp_write_word); |
| 510 | EXPORT_SYMBOL(ssp_read_word); |
| 511 | EXPORT_SYMBOL(ssp_flush); |
| 512 | EXPORT_SYMBOL(ssp_enable); |
| 513 | EXPORT_SYMBOL(ssp_disable); |
| 514 | EXPORT_SYMBOL(ssp_save_state); |
| 515 | EXPORT_SYMBOL(ssp_restore_state); |
| 516 | EXPORT_SYMBOL(ssp_init); |
| 517 | EXPORT_SYMBOL(ssp_exit); |
| 518 | EXPORT_SYMBOL(ssp_config); |
| 519 | |
| 520 | MODULE_DESCRIPTION("PXA SSP driver"); |
| 521 | MODULE_AUTHOR("Liam Girdwood"); |
| 522 | MODULE_LICENSE("GPL"); |
| 523 | |