1/*
2 * linux/include/asm-mips/txx9/generic.h
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License.  See the file "COPYING" in the main directory of this archive
6 * for more details.
7 */
8#ifndef __ASM_TXX9_GENERIC_H
9#define __ASM_TXX9_GENERIC_H
10
11#include <linux/init.h>
12#include <linux/ioport.h>	/* for struct resource */
13
14extern struct resource txx9_ce_res[];
15#define TXX9_CE(n)	(unsigned long)(txx9_ce_res[(n)].start)
16extern unsigned int txx9_pcode;
17extern char txx9_pcode_str[8];
18void txx9_reg_res_init(unsigned int pcode, unsigned long base,
19		       unsigned long size);
20
21extern unsigned int txx9_master_clock;
22extern unsigned int txx9_cpu_clock;
23extern unsigned int txx9_gbus_clock;
24#define TXX9_IMCLK	(txx9_gbus_clock / 2)
25
26extern int txx9_ccfg_toeon;
27struct uart_port;
28int early_serial_txx9_setup(struct uart_port *port);
29
30struct pci_dev;
31struct txx9_board_vec {
32	const char *system;
33	void (*prom_init)(void);
34	void (*mem_setup)(void);
35	void (*irq_setup)(void);
36	void (*time_init)(void);
37	void (*arch_init)(void);
38	void (*device_init)(void);
39#ifdef CONFIG_PCI
40	int (*pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
41#endif
42};
43extern struct txx9_board_vec *txx9_board_vec;
44extern int (*txx9_irq_dispatch)(int pending);
45const char *prom_getenv(const char *name);
46void txx9_wdt_init(unsigned long base);
47void txx9_wdt_now(unsigned long base);
48void txx9_spi_init(int busid, unsigned long base, int irq);
49void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
50void txx9_sio_init(unsigned long baseaddr, int irq,
51		   unsigned int line, unsigned int sclk, int nocts);
52#ifdef CONFIG_EARLY_PRINTK
53extern void (*txx9_prom_putchar)(char c);
54void txx9_sio_putchar_init(unsigned long baseaddr);
55#else
56static inline void txx9_sio_putchar_init(unsigned long baseaddr)
57{
58}
59#endif
60
61struct physmap_flash_data;
62void txx9_physmap_flash_init(int no, unsigned long addr, unsigned long size,
63			     const struct physmap_flash_data *pdata);
64
65/* 8 bit version of __fls(): find first bit set (returns 0..7) */
66static inline unsigned int __fls8(unsigned char x)
67{
68	int r = 7;
69
70	if (!(x & 0xf0)) {
71		r -= 4;
72		x <<= 4;
73	}
74	if (!(x & 0xc0)) {
75		r -= 2;
76		x <<= 2;
77	}
78	if (!(x & 0x80))
79		r -= 1;
80	return r;
81}
82
83void txx9_iocled_init(unsigned long baseaddr,
84		      int basenum, unsigned int num, int lowactive,
85		      const char *color, char **deftriggers);
86
87/* 7SEG LED */
88void txx9_7segled_init(unsigned int num,
89		       void (*putc)(unsigned int pos, unsigned char val));
90int txx9_7segled_putc(unsigned int pos, char c);
91
92void __init txx9_aclc_init(unsigned long baseaddr, int irq,
93			   unsigned int dmac_id,
94			   unsigned int dma_chan_out,
95			   unsigned int dma_chan_in);
96void __init txx9_sramc_init(struct resource *r);
97
98#endif /* __ASM_TXX9_GENERIC_H */
99