PageRenderTime 15ms CodeModel.GetById 11ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/tty/serial/samsung.h

https://bitbucket.org/cyanogenmod/android_kernel_asus_tf300t
C Header | 100 lines | 59 code | 26 blank | 15 comment | 1 complexity | c46c3458fb3abb9dd251eb399f1240bd MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
  1/*
  2 * Driver for Samsung SoC onboard UARTs.
  3 *
  4 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
  5 *	http://armlinux.simtec.co.uk/
  6 *
  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.
 10*/
 11
 12struct 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
 23	/* uart port features */
 24
 25	unsigned int		has_divslot:1;
 26
 27	/* clock source control */
 28
 29	int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
 30	int (*set_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);
 31
 32	/* uart controls */
 33	int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
 34};
 35
 36struct s3c24xx_uart_port {
 37	unsigned char			rx_claimed;
 38	unsigned char			tx_claimed;
 39	unsigned int			pm_level;
 40	unsigned long			baudclk_rate;
 41
 42	unsigned int			rx_irq;
 43	unsigned int			tx_irq;
 44
 45	struct s3c24xx_uart_info	*info;
 46	struct s3c24xx_uart_clksrc	*clksrc;
 47	struct clk			*clk;
 48	struct clk			*baudclk;
 49	struct uart_port		port;
 50
 51#ifdef CONFIG_CPU_FREQ
 52	struct notifier_block		freq_transition;
 53#endif
 54};
 55
 56/* conversion functions */
 57
 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)
 60
 61/* register access controls */
 62
 63#define portaddr(port, reg) ((port)->membase + (reg))
 64
 65#define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
 66#define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
 67
 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))
 70
 71extern int s3c24xx_serial_probe(struct platform_device *dev,
 72				struct s3c24xx_uart_info *uart);
 73
 74extern int __devexit s3c24xx_serial_remove(struct platform_device *dev);
 75
 76extern int s3c24xx_serial_initconsole(struct platform_driver *drv,
 77				      struct s3c24xx_uart_info **uart);
 78
 79extern int s3c24xx_serial_init(struct platform_driver *drv,
 80			       struct s3c24xx_uart_info *info);
 81
 82#ifdef CONFIG_SERIAL_SAMSUNG_DEBUG
 83
 84extern void printascii(const char *);
 85
 86static void dbg(const char *fmt, ...)
 87{
 88	va_list va;
 89	char buff[256];
 90
 91	va_start(va, fmt);
 92	vsprintf(buff, fmt, va);
 93	va_end(va);
 94
 95	printascii(buff);
 96}
 97
 98#else
 99#define dbg(x...) do { } while (0)
100#endif