aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/max3107.h
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2010-06-30 12:58:38 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 16:47:44 -0400
commit61fd15262bb9c88a05fd89af22add9317dc1b1f4 (patch)
tree5bd8a7ac29f098b344eb71b0d472787e651057c1 /drivers/serial/max3107.h
parent44318feb93327e36108b2a9cf94ac9f7ccabf047 (diff)
serial: max3107: Abstract out the platform specific bits
At the moment there is only one platform type supported and there is is hard wired, but with these changes the infrastructure is now there for anyone else to provide methods for their hardware. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial/max3107.h')
-rw-r--r--drivers/serial/max3107.h85
1 files changed, 83 insertions, 2 deletions
diff --git a/drivers/serial/max3107.h b/drivers/serial/max3107.h
index a5625d1f263d..72b30415f417 100644
--- a/drivers/serial/max3107.h
+++ b/drivers/serial/max3107.h
@@ -10,8 +10,8 @@
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12 12
13#ifndef _LINUX_SERIAL_MAX3107_H 13#ifndef _MAX3107_H
14#define _LINUX_SERIAL_MAX3107_H 14#define _MAX3107_H
15 15
16/* Serial error status definitions */ 16/* Serial error status definitions */
17#define MAX3107_PARITY_ERROR 1 17#define MAX3107_PARITY_ERROR 1
@@ -355,4 +355,85 @@
355#define MAX3107_BRG13_IB460800 (0x000000 | 0x00) 355#define MAX3107_BRG13_IB460800 (0x000000 | 0x00)
356#define MAX3107_BRG13_IB921600 (0x000000 | 0x00) 356#define MAX3107_BRG13_IB921600 (0x000000 | 0x00)
357 357
358
359struct baud_table {
360 int baud;
361 u32 new_brg;
362};
363
364struct max3107_port {
365 /* UART port structure */
366 struct uart_port port;
367
368 /* SPI device structure */
369 struct spi_device *spi;
370
371 /* GPIO chip stucture */
372 struct gpio_chip chip;
373
374 /* Workqueue that does all the magic */
375 struct workqueue_struct *workqueue;
376 struct work_struct work;
377
378 /* Lock for shared data */
379 spinlock_t data_lock;
380
381 /* Device configuration */
382 int ext_clk; /* 1 if external clock used */
383 int loopback; /* Current loopback mode state */
384 int baud; /* Current baud rate */
385
386 /* State flags */
387 int suspended; /* Indicates suspend mode */
388 int tx_fifo_empty; /* Flag for TX FIFO state */
389 int rx_enabled; /* Flag for receiver state */
390 int tx_enabled; /* Flag for transmitter state */
391
392 u16 irqen_reg; /* Current IRQ enable register value */
393 /* Shared data */
394 u16 mode1_reg; /* Current mode1 register value*/
395 int mode1_commit; /* Flag for setting new mode1 register value */
396 u16 lcr_reg; /* Current LCR register value */
397 int lcr_commit; /* Flag for setting new LCR register value */
398 u32 brg_cfg; /* Current Baud rate generator config */
399 int brg_commit; /* Flag for setting new baud rate generator
400 * config
401 */
402 struct baud_table *baud_tbl;
403 int handle_irq; /* Indicates that IRQ should be handled */
404
405 /* Rx buffer and str*/
406 u16 *rxbuf;
407 u8 *rxstr;
408 /* Tx buffer*/
409 u16 *txbuf;
410
411 struct max3107_plat *pdata; /* Platform data */
412};
413
414/* Platform data structure */
415struct max3107_plat {
416 /* Loopback mode enable */
417 int loopback;
418 /* External clock enable */
419 int ext_clk;
420 /* Called during the register initialisation */
421 void (*init)(struct max3107_port *s);
422 /* Called when the port is found and configured */
423 int (*configure)(struct max3107_port *s);
424 /* HW suspend function */
425 void (*hw_suspend) (struct max3107_port *s, int suspend);
426 /* Polling mode enable */
427 int polled_mode;
428 /* Polling period if polling mode enabled */
429 int poll_time;
430};
431
432extern int max3107_rw(struct max3107_port *s, u8 *tx, u8 *rx, int len);
433extern void max3107_hw_susp(struct max3107_port *s, int suspend);
434extern int max3107_probe(struct spi_device *spi, struct max3107_plat *pdata);
435extern int max3107_remove(struct spi_device *spi);
436extern int max3107_suspend(struct spi_device *spi, pm_message_t state);
437extern int max3107_resume(struct spi_device *spi);
438
358#endif /* _LINUX_SERIAL_MAX3107_H */ 439#endif /* _LINUX_SERIAL_MAX3107_H */