samsung.h 2.0 KB
Newer Older
J
Joe Perches 已提交
1 2 3
#ifndef __SAMSUNG_H
#define __SAMSUNG_H

4
/*
5 6
 * Driver for Samsung SoC onboard UARTs.
 *
7
 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *	http://armlinux.simtec.co.uk/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

struct s3c24xx_uart_info {
	char			*name;
	unsigned int		type;
	unsigned int		fifosize;
	unsigned long		rx_fifomask;
	unsigned long		rx_fifoshift;
	unsigned long		rx_fifofull;
	unsigned long		tx_fifomask;
	unsigned long		tx_fifoshift;
	unsigned long		tx_fifofull;
25 26 27 28
	unsigned int		def_clk_sel;
	unsigned long		num_clks;
	unsigned long		clksel_mask;
	unsigned long		clksel_shift;
29

30 31 32 33
	/* uart port features */

	unsigned int		has_divslot:1;

34 35 36 37
	/* uart controls */
	int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
};

38 39 40 41 42 43
struct s3c24xx_serial_drv_data {
	struct s3c24xx_uart_info	*info;
	struct s3c2410_uartcfg		*def_cfg;
	unsigned int			fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
};

44 45 46
struct s3c24xx_uart_port {
	unsigned char			rx_claimed;
	unsigned char			tx_claimed;
47 48
	unsigned int			pm_level;
	unsigned long			baudclk_rate;
49

50 51 52
	unsigned int			rx_irq;
	unsigned int			tx_irq;

53 54 55 56
	struct s3c24xx_uart_info	*info;
	struct clk			*clk;
	struct clk			*baudclk;
	struct uart_port		port;
57
	struct s3c24xx_serial_drv_data	*drv_data;
58

59 60 61
	/* reference to platform data */
	struct s3c2410_uartcfg		*cfg;

62 63 64
#ifdef CONFIG_CPU_FREQ
	struct notifier_block		freq_transition;
#endif
65 66 67 68
};

/* conversion functions */

69
#define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev)
70 71 72 73

/* register access controls */

#define portaddr(port, reg) ((port)->membase + (reg))
74 75
#define portaddrl(port, reg) \
	((unsigned long *)(unsigned long)((port)->membase + (reg)))
76 77 78 79 80 81 82 83

#define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
#define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))

#define wr_regb(port, reg, val) __raw_writeb(val, portaddr(port, reg))
#define wr_regl(port, reg, val) __raw_writel(val, portaddr(port, reg))

#endif