qlge: bugfix: Move netif_napi_del() to common call point.
[safe/jmp/linux-2.6] / drivers / serial / samsung.h
1 /* linux/drivers/serial/samsung.h
2  *
3  * Driver for Samsung SoC onboard UARTs.
4  *
5  * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
6  *      http://armlinux.simtec.co.uk/
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11 */
12
13 struct s3c24xx_uart_info {
14         char                    *name;
15         unsigned int            type;
16         unsigned int            fifosize;
17         unsigned long           rx_fifomask;
18         unsigned long           rx_fifoshift;
19         unsigned long           rx_fifofull;
20         unsigned long           tx_fifomask;
21         unsigned long           tx_fifoshift;
22         unsigned long           tx_fifofull;
23
24         /* clock source control */
25
26         int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
27         int (*set_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
28
29         /* uart controls */
30         int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
31 };
32
33 struct s3c24xx_uart_port {
34         unsigned char                   rx_claimed;
35         unsigned char                   tx_claimed;
36         unsigned int                    pm_level;
37         unsigned long                   baudclk_rate;
38
39         unsigned int                    rx_irq;
40         unsigned int                    tx_irq;
41
42         struct s3c24xx_uart_info        *info;
43         struct s3c24xx_uart_clksrc      *clksrc;
44         struct clk                      *clk;
45         struct clk                      *baudclk;
46         struct uart_port                port;
47
48 #ifdef CONFIG_CPU_FREQ
49         struct notifier_block           freq_transition;
50 #endif
51 };
52
53 /* conversion functions */
54
55 #define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
56 #define s3c24xx_dev_to_cfg(__dev) (struct s3c2410_uartcfg *)((__dev)->platform_data)
57
58 /* register access controls */
59
60 #define portaddr(port, reg) ((port)->membase + (reg))
61
62 #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
63 #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
64
65 #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
66 #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
67
68 extern int s3c24xx_serial_probe(struct platform_device *dev,
69                                 struct s3c24xx_uart_info *uart);
70
71 extern int s3c24xx_serial_remove(struct platform_device *dev);
72
73 extern int s3c24xx_serial_initconsole(struct platform_driver *drv,
74                                       struct s3c24xx_uart_info *uart);
75
76 extern int s3c24xx_serial_init(struct platform_driver *drv,
77                                struct s3c24xx_uart_info *info);
78
79 #ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
80
81 #define s3c24xx_console_init(__drv, __inf)                      \
82 static int __init s3c_serial_console_init(void)                 \
83 {                                                               \
84         return s3c24xx_serial_initconsole(__drv, __inf);        \
85 }                                                               \
86                                                                 \
87 console_initcall(s3c_serial_console_init)
88
89 #else
90 #define s3c24xx_console_init(drv, inf) extern void no_console(void)
91 #endif
92
93 #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
94
95 extern void printascii(const char *);
96
97 static void dbg(const char *fmt, ...)
98 {
99         va_list va;
100         char buff[256];
101
102         va_start(va, fmt);
103         vsprintf(buff, fmt, va);
104         va_end(va);
105
106         printascii(buff);
107 }
108
109 #else
110 #define dbg(x...) do { } while (0)
111 #endif