Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 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 | |
| 14 | extern struct resource txx9_ce_res[]; |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 15 | #define TXX9_CE(n) (unsigned long)(txx9_ce_res[(n)].start) |
| 16 | extern unsigned int txx9_pcode; |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 17 | extern char txx9_pcode_str[8]; |
| 18 | void txx9_reg_res_init(unsigned int pcode, unsigned long base, |
| 19 | unsigned long size); |
| 20 | |
| 21 | extern unsigned int txx9_master_clock; |
| 22 | extern unsigned int txx9_cpu_clock; |
| 23 | extern unsigned int txx9_gbus_clock; |
Atsushi Nemoto | 94a4c32 | 2008-07-19 01:51:47 +0900 | [diff] [blame] | 24 | #define TXX9_IMCLK (txx9_gbus_clock / 2) |
| 25 | |
| 26 | extern int txx9_ccfg_toeon; |
| 27 | struct uart_port; |
| 28 | int early_serial_txx9_setup(struct uart_port *port); |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 29 | |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 30 | struct pci_dev; |
| 31 | struct txx9_board_vec { |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 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 | }; |
| 43 | extern struct txx9_board_vec *txx9_board_vec; |
| 44 | extern int (*txx9_irq_dispatch)(int pending); |
Atsushi Nemoto | 265b89d | 2008-08-19 22:55:07 +0900 | [diff] [blame] | 45 | const char *prom_getenv(const char *name); |
Atsushi Nemoto | 6831472 | 2008-07-24 00:25:18 +0900 | [diff] [blame] | 46 | void txx9_wdt_init(unsigned long base); |
Atsushi Nemoto | 496a3b5 | 2008-08-19 22:55:15 +0900 | [diff] [blame] | 47 | void txx9_wdt_now(unsigned long base); |
Atsushi Nemoto | c49f91f | 2008-07-24 00:25:20 +0900 | [diff] [blame] | 48 | void txx9_spi_init(int busid, unsigned long base, int irq); |
| 49 | void txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr); |
Atsushi Nemoto | 7779a5e | 2008-07-25 23:08:06 +0900 | [diff] [blame] | 50 | void txx9_sio_init(unsigned long baseaddr, int irq, |
| 51 | unsigned int line, unsigned int sclk, int nocts); |
Atsushi Nemoto | e352953 | 2008-07-29 22:10:08 +0900 | [diff] [blame] | 52 | void prom_putchar(char c); |
| 53 | #ifdef CONFIG_EARLY_PRINTK |
| 54 | extern void (*txx9_prom_putchar)(char c); |
| 55 | void txx9_sio_putchar_init(unsigned long baseaddr); |
| 56 | #else |
| 57 | static inline void txx9_sio_putchar_init(unsigned long baseaddr) |
| 58 | { |
| 59 | } |
| 60 | #endif |
Atsushi Nemoto | edcaf1a | 2008-07-11 23:27:54 +0900 | [diff] [blame] | 61 | |
Atsushi Nemoto | 51f607c | 2008-08-19 22:55:11 +0900 | [diff] [blame] | 62 | struct physmap_flash_data; |
| 63 | void txx9_physmap_flash_init(int no, unsigned long addr, unsigned long size, |
| 64 | const struct physmap_flash_data *pdata); |
| 65 | |
Atsushi Nemoto | 21e77df | 2008-09-01 22:22:37 +0900 | [diff] [blame] | 66 | /* 8 bit version of __fls(): find first bit set (returns 0..7) */ |
| 67 | static inline unsigned int __fls8(unsigned char x) |
| 68 | { |
| 69 | int r = 7; |
| 70 | |
| 71 | if (!(x & 0xf0)) { |
| 72 | r -= 4; |
| 73 | x <<= 4; |
| 74 | } |
| 75 | if (!(x & 0xc0)) { |
| 76 | r -= 2; |
| 77 | x <<= 2; |
| 78 | } |
| 79 | if (!(x & 0x80)) |
| 80 | r -= 1; |
| 81 | return r; |
| 82 | } |
| 83 | |
Atsushi Nemoto | ae027ea | 2008-09-01 22:22:38 +0900 | [diff] [blame] | 84 | void txx9_iocled_init(unsigned long baseaddr, |
| 85 | int basenum, unsigned int num, int lowactive, |
| 86 | const char *color, char **deftriggers); |
| 87 | |
Atsushi Nemoto | bc89b2b | 2008-10-20 23:28:50 +0900 | [diff] [blame] | 88 | /* 7SEG LED */ |
| 89 | void txx9_7segled_init(unsigned int num, |
| 90 | void (*putc)(unsigned int pos, unsigned char val)); |
| 91 | int txx9_7segled_putc(unsigned int pos, char c); |
| 92 | |
Atsushi Nemoto | 742cd58 | 2009-05-19 22:12:22 +0900 | [diff] [blame] | 93 | void __init txx9_aclc_init(unsigned long baseaddr, int irq, |
| 94 | unsigned int dmac_id, |
| 95 | unsigned int dma_chan_out, |
| 96 | unsigned int dma_chan_in); |
Atsushi Nemoto | c3b28ae | 2009-05-25 22:04:02 +0900 | [diff] [blame] | 97 | void __init txx9_sramc_init(struct resource *r); |
Atsushi Nemoto | 742cd58 | 2009-05-19 22:12:22 +0900 | [diff] [blame] | 98 | |
Atsushi Nemoto | 89d63fe | 2008-07-11 00:33:08 +0900 | [diff] [blame] | 99 | #endif /* __ASM_TXX9_GENERIC_H */ |