1 /* linux/drivers/serial/samsung.h
3 * Driver for Samsung SoC onboard UARTs.
5 * Ben Dooks, Copyright (c) 2003-2005,2008 Simtec Electronics
6 * http://armlinux.simtec.co.uk/
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.
13 struct s3c24xx_uart_info
{
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
;
24 /* clock source control */
26 int (*get_clksrc
)(struct uart_port
*, struct s3c24xx_uart_clksrc
*clk
);
27 int (*set_clksrc
)(struct uart_port
*, struct s3c24xx_uart_clksrc
*clk
);
30 int (*reset_port
)(struct uart_port
*, struct s3c2410_uartcfg
*);
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
;
42 struct s3c24xx_uart_info
*info
;
43 struct s3c24xx_uart_clksrc
*clksrc
;
46 struct uart_port port
;
48 #ifdef CONFIG_CPU_FREQ
49 struct notifier_block freq_transition
;
53 /* conversion functions */
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)
58 /* register access controls */
60 #define portaddr(port, reg) ((port)->membase + (reg))
62 #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
63 #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
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))
68 extern int s3c24xx_serial_probe(struct platform_device
*dev
,
69 struct s3c24xx_uart_info
*uart
);
71 extern int s3c24xx_serial_remove(struct platform_device
*dev
);
73 extern int s3c24xx_serial_initconsole(struct platform_driver
*drv
,
74 struct s3c24xx_uart_info
*uart
);
76 extern int s3c24xx_serial_init(struct platform_driver
*drv
,
77 struct s3c24xx_uart_info
*info
);
79 #ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
81 #define s3c24xx_console_init(__drv, __inf) \
82 static int __init s3c_serial_console_init(void) \
84 return s3c24xx_serial_initconsole(__drv, __inf); \
87 console_initcall(s3c_serial_console_init)
90 #define s3c24xx_console_init(drv, inf) extern void no_console(void)
93 #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
95 extern void printascii(const char *);
97 static void dbg(const char *fmt
, ...)
103 vsprintf(buff
, fmt
, va
);
110 #define dbg(x...) do { } while (0)