Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / drivers / tty / serial / samsung.h
blob8827e5424cef7d13420114650bdcfa19cad91ea0
1 /*
2 * Driver for Samsung SoC onboard UARTs.
4 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 struct s3c24xx_uart_info {
13 char *name;
14 unsigned int type;
15 unsigned int fifosize;
16 unsigned long rx_fifomask;
17 unsigned long rx_fifoshift;
18 unsigned long rx_fifofull;
19 unsigned long tx_fifomask;
20 unsigned long tx_fifoshift;
21 unsigned long tx_fifofull;
22 unsigned int def_clk_sel;
23 unsigned long num_clks;
24 unsigned long clksel_mask;
25 unsigned long clksel_shift;
27 /* uart port features */
29 unsigned int has_divslot:1;
31 /* uart controls */
32 int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
35 struct s3c24xx_serial_drv_data {
36 struct s3c24xx_uart_info *info;
37 struct s3c2410_uartcfg *def_cfg;
38 unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
41 struct s3c24xx_uart_port {
42 unsigned char rx_claimed;
43 unsigned char tx_claimed;
44 unsigned int pm_level;
45 unsigned long baudclk_rate;
47 unsigned int rx_irq;
48 unsigned int tx_irq;
50 struct s3c24xx_uart_info *info;
51 struct clk *clk;
52 struct clk *baudclk;
53 struct uart_port port;
54 struct s3c24xx_serial_drv_data *drv_data;
56 /* reference to platform data */
57 struct s3c2410_uartcfg *cfg;
59 #ifdef CONFIG_CPU_FREQ
60 struct notifier_block freq_transition;
61 #endif
64 /* conversion functions */
66 #define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev)
68 /* register access controls */
70 #define portaddr(port, reg) ((port)->membase + (reg))
71 #define portaddrl(port, reg) \
72 ((unsigned long *)(unsigned long)((port)->membase + (reg)))
74 #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
75 #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
77 #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
78 #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
80 #if defined(CONFIG_SERIAL_SAMSUNG_DEBUG) && \
81 defined(CONFIG_DEBUG_LL) && \
82 !defined(MODULE)
84 extern void printascii(const char *);
86 static void dbg(const char *fmt, ...)
88 va_list va;
89 char buff[256];
91 va_start(va, fmt);
92 vsprintf(buff, fmt, va);
93 va_end(va);
95 printascii(buff);
98 #else
99 #define dbg(x...) do { } while (0)
100 #endif