blob: eb071dd19b2d13deb189afba8a9bf6364d29e9ed [file] [log] [blame]
Joe Perchese4ac92d2014-05-20 14:05:50 -07001#ifndef __SAMSUNG_H
2#define __SAMSUNG_H
3
Jovi Zhang99edb3d2011-03-30 05:30:41 -04004/*
Ben Dooksb4975492008-07-03 12:32:51 +01005 * Driver for Samsung SoC onboard UARTs.
6 *
Ben Dooksccae9412009-11-13 22:54:14 +00007 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
Ben Dooksb4975492008-07-03 12:32:51 +01008 * http://armlinux.simtec.co.uk/
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15struct s3c24xx_uart_info {
16 char *name;
17 unsigned int type;
18 unsigned int fifosize;
19 unsigned long rx_fifomask;
20 unsigned long rx_fifoshift;
21 unsigned long rx_fifofull;
22 unsigned long tx_fifomask;
23 unsigned long tx_fifoshift;
24 unsigned long tx_fifofull;
Thomas Abraham5f5a7a52011-10-24 11:47:46 +020025 unsigned int def_clk_sel;
26 unsigned long num_clks;
27 unsigned long clksel_mask;
28 unsigned long clksel_shift;
Ben Dooksb4975492008-07-03 12:32:51 +010029
Ben Dooks090f8482008-12-12 00:24:21 +000030 /* uart port features */
31
32 unsigned int has_divslot:1;
33
Ben Dooksb4975492008-07-03 12:32:51 +010034 /* uart controls */
35 int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
36};
37
Thomas Abrahamda121502011-11-02 19:23:25 +090038struct s3c24xx_serial_drv_data {
39 struct s3c24xx_uart_info *info;
40 struct s3c2410_uartcfg *def_cfg;
41 unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
42};
43
Ben Dooksb4975492008-07-03 12:32:51 +010044struct s3c24xx_uart_port {
45 unsigned char rx_claimed;
46 unsigned char tx_claimed;
Ben Dooks30555472008-10-21 14:06:36 +010047 unsigned int pm_level;
48 unsigned long baudclk_rate;
Ben Dooksb4975492008-07-03 12:32:51 +010049
Ben Dooksb73c289c2008-10-21 14:07:04 +010050 unsigned int rx_irq;
51 unsigned int tx_irq;
52
Ben Dooksb4975492008-07-03 12:32:51 +010053 struct s3c24xx_uart_info *info;
Ben Dooksb4975492008-07-03 12:32:51 +010054 struct clk *clk;
55 struct clk *baudclk;
56 struct uart_port port;
Thomas Abrahamda121502011-11-02 19:23:25 +090057 struct s3c24xx_serial_drv_data *drv_data;
Ben Dooks30555472008-10-21 14:06:36 +010058
Thomas Abraham4d84e972011-10-24 11:47:25 +020059 /* reference to platform data */
60 struct s3c2410_uartcfg *cfg;
61
Ben Dooks30555472008-10-21 14:06:36 +010062#ifdef CONFIG_CPU_FREQ
63 struct notifier_block freq_transition;
64#endif
Ben Dooksb4975492008-07-03 12:32:51 +010065};
66
67/* conversion functions */
68
Jingoo Hand4aab202013-09-09 14:10:30 +090069#define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev)
Ben Dooksb4975492008-07-03 12:32:51 +010070
71/* register access controls */
72
73#define portaddr(port, reg) ((port)->membase + (reg))
Jingoo Han9fdedf52013-08-08 17:29:48 +090074#define portaddrl(port, reg) \
75 ((unsigned long *)(unsigned long)((port)->membase + (reg)))
Ben Dooksb4975492008-07-03 12:32:51 +010076
77#define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
78#define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
79
80#define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
81#define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))
82
Ben Dooksb4975492008-07-03 12:32:51 +010083#endif