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
{
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
;
23 /* uart port features */
25 unsigned int has_divslot
:1;
27 /* clock source control */
29 int (*get_clksrc
)(struct uart_port
*, struct s3c24xx_uart_clksrc
*clk
);
30 int (*set_clksrc
)(struct uart_port
*, struct s3c24xx_uart_clksrc
*clk
);
33 int (*reset_port
)(struct uart_port
*, struct s3c2410_uartcfg
*);
36 struct s3c24xx_uart_port
{
37 unsigned char rx_claimed
;
38 unsigned char tx_claimed
;
39 unsigned int pm_level
;
40 unsigned long baudclk_rate
;
45 struct s3c24xx_uart_info
*info
;
46 struct s3c24xx_uart_clksrc
*clksrc
;
49 struct uart_port port
;
51 #ifdef CONFIG_CPU_FREQ
52 struct notifier_block freq_transition
;
56 /* conversion functions */
58 #define s3c24xx_dev_to_port(__dev) (struct uart_port *)dev_get_drvdata(__dev)
59 #define s3c24xx_dev_to_cfg(__dev) (struct s3c2410_uartcfg *)((__dev)->platform_data)
61 /* register access controls */
63 #define portaddr(port, reg) ((port)->membase + (reg))
65 #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
66 #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
68 #define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
69 #define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
71 extern int s3c24xx_serial_probe(struct platform_device
*dev
,
72 struct s3c24xx_uart_info
*uart
);
74 extern int __devexit
s3c24xx_serial_remove(struct platform_device
*dev
);
76 extern int s3c24xx_serial_initconsole(struct platform_driver
*drv
,
77 struct s3c24xx_uart_info
**uart
);
79 extern int s3c24xx_serial_init(struct platform_driver
*drv
,
80 struct s3c24xx_uart_info
*info
);
82 #ifdef CONFIG_SERIAL_SAMSUNG_CONSOLE
84 #define s3c24xx_console_init(__drv, __inf) \
85 static int __init s3c_serial_console_init(void) \
87 struct s3c24xx_uart_info *uinfo[CONFIG_SERIAL_SAMSUNG_UARTS]; \
90 for (i = 0; i < CONFIG_SERIAL_SAMSUNG_UARTS; i++) \
92 return s3c24xx_serial_initconsole(__drv, uinfo); \
95 console_initcall(s3c_serial_console_init)
98 #define s3c24xx_console_init(drv, inf) extern void no_console(void)
101 #ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
103 extern void printascii(const char *);
105 static void dbg(const char *fmt
, ...)
111 vsprintf(buff
, fmt
, va
);
118 #define dbg(x...) do { } while (0)