162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * linux/include/asm-mips/txx9/generic.h 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 562306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 662306a36Sopenharmony_ci * for more details. 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci#ifndef __ASM_TXX9_GENERIC_H 962306a36Sopenharmony_ci#define __ASM_TXX9_GENERIC_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/init.h> 1262306a36Sopenharmony_ci#include <linux/ioport.h> /* for struct resource */ 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciextern struct resource txx9_ce_res[]; 1562306a36Sopenharmony_ci#define TXX9_CE(n) (unsigned long)(txx9_ce_res[(n)].start) 1662306a36Sopenharmony_ciextern unsigned int txx9_pcode; 1762306a36Sopenharmony_ciextern char txx9_pcode_str[8]; 1862306a36Sopenharmony_civoid txx9_reg_res_init(unsigned int pcode, unsigned long base, 1962306a36Sopenharmony_ci unsigned long size); 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ciextern unsigned int txx9_master_clock; 2262306a36Sopenharmony_ciextern unsigned int txx9_cpu_clock; 2362306a36Sopenharmony_ciextern unsigned int txx9_gbus_clock; 2462306a36Sopenharmony_ci#define TXX9_IMCLK (txx9_gbus_clock / 2) 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciextern int txx9_ccfg_toeon; 2762306a36Sopenharmony_cistruct uart_port; 2862306a36Sopenharmony_ciint early_serial_txx9_setup(struct uart_port *port); 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_cistruct pci_dev; 3162306a36Sopenharmony_cistruct txx9_board_vec { 3262306a36Sopenharmony_ci const char *system; 3362306a36Sopenharmony_ci void (*prom_init)(void); 3462306a36Sopenharmony_ci void (*mem_setup)(void); 3562306a36Sopenharmony_ci void (*irq_setup)(void); 3662306a36Sopenharmony_ci void (*time_init)(void); 3762306a36Sopenharmony_ci void (*arch_init)(void); 3862306a36Sopenharmony_ci void (*device_init)(void); 3962306a36Sopenharmony_ci#ifdef CONFIG_PCI 4062306a36Sopenharmony_ci int (*pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin); 4162306a36Sopenharmony_ci#endif 4262306a36Sopenharmony_ci}; 4362306a36Sopenharmony_ciextern struct txx9_board_vec *txx9_board_vec; 4462306a36Sopenharmony_ciextern int (*txx9_irq_dispatch)(int pending); 4562306a36Sopenharmony_ciconst char *prom_getenv(const char *name); 4662306a36Sopenharmony_civoid txx9_wdt_init(unsigned long base); 4762306a36Sopenharmony_civoid txx9_wdt_now(unsigned long base); 4862306a36Sopenharmony_civoid txx9_spi_init(int busid, unsigned long base, int irq); 4962306a36Sopenharmony_civoid txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr); 5062306a36Sopenharmony_civoid txx9_sio_init(unsigned long baseaddr, int irq, 5162306a36Sopenharmony_ci unsigned int line, unsigned int sclk, int nocts); 5262306a36Sopenharmony_ci#ifdef CONFIG_EARLY_PRINTK 5362306a36Sopenharmony_ciextern void (*txx9_prom_putchar)(char c); 5462306a36Sopenharmony_civoid txx9_sio_putchar_init(unsigned long baseaddr); 5562306a36Sopenharmony_ci#else 5662306a36Sopenharmony_cistatic inline void txx9_sio_putchar_init(unsigned long baseaddr) 5762306a36Sopenharmony_ci{ 5862306a36Sopenharmony_ci} 5962306a36Sopenharmony_ci#endif 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_cistruct physmap_flash_data; 6262306a36Sopenharmony_civoid txx9_physmap_flash_init(int no, unsigned long addr, unsigned long size, 6362306a36Sopenharmony_ci const struct physmap_flash_data *pdata); 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci/* 8 bit version of __fls(): find first bit set (returns 0..7) */ 6662306a36Sopenharmony_cistatic inline unsigned int __fls8(unsigned char x) 6762306a36Sopenharmony_ci{ 6862306a36Sopenharmony_ci int r = 7; 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci if (!(x & 0xf0)) { 7162306a36Sopenharmony_ci r -= 4; 7262306a36Sopenharmony_ci x <<= 4; 7362306a36Sopenharmony_ci } 7462306a36Sopenharmony_ci if (!(x & 0xc0)) { 7562306a36Sopenharmony_ci r -= 2; 7662306a36Sopenharmony_ci x <<= 2; 7762306a36Sopenharmony_ci } 7862306a36Sopenharmony_ci if (!(x & 0x80)) 7962306a36Sopenharmony_ci r -= 1; 8062306a36Sopenharmony_ci return r; 8162306a36Sopenharmony_ci} 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_civoid txx9_iocled_init(unsigned long baseaddr, 8462306a36Sopenharmony_ci int basenum, unsigned int num, int lowactive, 8562306a36Sopenharmony_ci const char *color, char **deftriggers); 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci/* 7SEG LED */ 8862306a36Sopenharmony_civoid txx9_7segled_init(unsigned int num, 8962306a36Sopenharmony_ci void (*putc)(unsigned int pos, unsigned char val)); 9062306a36Sopenharmony_ciint txx9_7segled_putc(unsigned int pos, char c); 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_civoid __init txx9_aclc_init(unsigned long baseaddr, int irq, 9362306a36Sopenharmony_ci unsigned int dmac_id, 9462306a36Sopenharmony_ci unsigned int dma_chan_out, 9562306a36Sopenharmony_ci unsigned int dma_chan_in); 9662306a36Sopenharmony_civoid __init txx9_sramc_init(struct resource *r); 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#endif /* __ASM_TXX9_GENERIC_H */ 99