blob: 8169477d14754b13c48863c130534c6865e3a11d [file] [log] [blame]
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +09001/*
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[];
Atsushi Nemoto94a4c322008-07-19 01:51:47 +090015#define TXX9_CE(n) (unsigned long)(txx9_ce_res[(n)].start)
16extern unsigned int txx9_pcode;
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090017extern 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;
Atsushi Nemoto94a4c322008-07-19 01:51:47 +090024#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);
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090029
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +090030struct pci_dev;
31struct txx9_board_vec {
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +090032 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);
Atsushi Nemoto7b226092008-07-14 00:15:04 +090045char *prom_getcmdline(void);
Atsushi Nemoto265b89d2008-08-19 22:55:07 +090046const char *prom_getenv(const char *name);
Atsushi Nemoto68314722008-07-24 00:25:18 +090047void txx9_wdt_init(unsigned long base);
Atsushi Nemoto496a3b52008-08-19 22:55:15 +090048void txx9_wdt_now(unsigned long base);
Atsushi Nemotoc49f91f2008-07-24 00:25:20 +090049void txx9_spi_init(int busid, unsigned long base, int irq);
50void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
Atsushi Nemoto7779a5e2008-07-25 23:08:06 +090051void txx9_sio_init(unsigned long baseaddr, int irq,
52 unsigned int line, unsigned int sclk, int nocts);
Atsushi Nemotoe3529532008-07-29 22:10:08 +090053void prom_putchar(char c);
54#ifdef CONFIG_EARLY_PRINTK
55extern void (*txx9_prom_putchar)(char c);
56void txx9_sio_putchar_init(unsigned long baseaddr);
57#else
58static inline void txx9_sio_putchar_init(unsigned long baseaddr)
59{
60}
61#endif
Atsushi Nemotoedcaf1a2008-07-11 23:27:54 +090062
Atsushi Nemoto51f607c2008-08-19 22:55:11 +090063struct physmap_flash_data;
64void txx9_physmap_flash_init(int no, unsigned long addr, unsigned long size,
65 const struct physmap_flash_data *pdata);
66
Atsushi Nemoto21e77df2008-09-01 22:22:37 +090067/* 8 bit version of __fls(): find first bit set (returns 0..7) */
68static inline unsigned int __fls8(unsigned char x)
69{
70 int r = 7;
71
72 if (!(x & 0xf0)) {
73 r -= 4;
74 x <<= 4;
75 }
76 if (!(x & 0xc0)) {
77 r -= 2;
78 x <<= 2;
79 }
80 if (!(x & 0x80))
81 r -= 1;
82 return r;
83}
84
Atsushi Nemotoae027ea2008-09-01 22:22:38 +090085void txx9_iocled_init(unsigned long baseaddr,
86 int basenum, unsigned int num, int lowactive,
87 const char *color, char **deftriggers);
88
Atsushi Nemotobc89b2b2008-10-20 23:28:50 +090089/* 7SEG LED */
90void txx9_7segled_init(unsigned int num,
91 void (*putc)(unsigned int pos, unsigned char val));
92int txx9_7segled_putc(unsigned int pos, char c);
93
Atsushi Nemoto742cd582009-05-19 22:12:22 +090094void __init txx9_aclc_init(unsigned long baseaddr, int irq,
95 unsigned int dmac_id,
96 unsigned int dma_chan_out,
97 unsigned int dma_chan_in);
98
Atsushi Nemoto89d63fe2008-07-11 00:33:08 +090099#endif /* __ASM_TXX9_GENERIC_H */