18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * linux/include/asm-mips/txx9/generic.h
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
58c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
68c2ecf20Sopenharmony_ci * for more details.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef __ASM_TXX9_GENERIC_H
98c2ecf20Sopenharmony_ci#define __ASM_TXX9_GENERIC_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/init.h>
128c2ecf20Sopenharmony_ci#include <linux/ioport.h>	/* for struct resource */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciextern struct resource txx9_ce_res[];
158c2ecf20Sopenharmony_ci#define TXX9_CE(n)	(unsigned long)(txx9_ce_res[(n)].start)
168c2ecf20Sopenharmony_ciextern unsigned int txx9_pcode;
178c2ecf20Sopenharmony_ciextern char txx9_pcode_str[8];
188c2ecf20Sopenharmony_civoid txx9_reg_res_init(unsigned int pcode, unsigned long base,
198c2ecf20Sopenharmony_ci		       unsigned long size);
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciextern unsigned int txx9_master_clock;
228c2ecf20Sopenharmony_ciextern unsigned int txx9_cpu_clock;
238c2ecf20Sopenharmony_ciextern unsigned int txx9_gbus_clock;
248c2ecf20Sopenharmony_ci#define TXX9_IMCLK	(txx9_gbus_clock / 2)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciextern int txx9_ccfg_toeon;
278c2ecf20Sopenharmony_cistruct uart_port;
288c2ecf20Sopenharmony_ciint early_serial_txx9_setup(struct uart_port *port);
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistruct pci_dev;
318c2ecf20Sopenharmony_cistruct txx9_board_vec {
328c2ecf20Sopenharmony_ci	const char *system;
338c2ecf20Sopenharmony_ci	void (*prom_init)(void);
348c2ecf20Sopenharmony_ci	void (*mem_setup)(void);
358c2ecf20Sopenharmony_ci	void (*irq_setup)(void);
368c2ecf20Sopenharmony_ci	void (*time_init)(void);
378c2ecf20Sopenharmony_ci	void (*arch_init)(void);
388c2ecf20Sopenharmony_ci	void (*device_init)(void);
398c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI
408c2ecf20Sopenharmony_ci	int (*pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
418c2ecf20Sopenharmony_ci#endif
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ciextern struct txx9_board_vec *txx9_board_vec;
448c2ecf20Sopenharmony_ciextern int (*txx9_irq_dispatch)(int pending);
458c2ecf20Sopenharmony_ciconst char *prom_getenv(const char *name);
468c2ecf20Sopenharmony_civoid txx9_wdt_init(unsigned long base);
478c2ecf20Sopenharmony_civoid txx9_wdt_now(unsigned long base);
488c2ecf20Sopenharmony_civoid txx9_spi_init(int busid, unsigned long base, int irq);
498c2ecf20Sopenharmony_civoid txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
508c2ecf20Sopenharmony_civoid txx9_sio_init(unsigned long baseaddr, int irq,
518c2ecf20Sopenharmony_ci		   unsigned int line, unsigned int sclk, int nocts);
528c2ecf20Sopenharmony_ci#ifdef CONFIG_EARLY_PRINTK
538c2ecf20Sopenharmony_ciextern void (*txx9_prom_putchar)(char c);
548c2ecf20Sopenharmony_civoid txx9_sio_putchar_init(unsigned long baseaddr);
558c2ecf20Sopenharmony_ci#else
568c2ecf20Sopenharmony_cistatic inline void txx9_sio_putchar_init(unsigned long baseaddr)
578c2ecf20Sopenharmony_ci{
588c2ecf20Sopenharmony_ci}
598c2ecf20Sopenharmony_ci#endif
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistruct physmap_flash_data;
628c2ecf20Sopenharmony_civoid txx9_physmap_flash_init(int no, unsigned long addr, unsigned long size,
638c2ecf20Sopenharmony_ci			     const struct physmap_flash_data *pdata);
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* 8 bit version of __fls(): find first bit set (returns 0..7) */
668c2ecf20Sopenharmony_cistatic inline unsigned int __fls8(unsigned char x)
678c2ecf20Sopenharmony_ci{
688c2ecf20Sopenharmony_ci	int r = 7;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	if (!(x & 0xf0)) {
718c2ecf20Sopenharmony_ci		r -= 4;
728c2ecf20Sopenharmony_ci		x <<= 4;
738c2ecf20Sopenharmony_ci	}
748c2ecf20Sopenharmony_ci	if (!(x & 0xc0)) {
758c2ecf20Sopenharmony_ci		r -= 2;
768c2ecf20Sopenharmony_ci		x <<= 2;
778c2ecf20Sopenharmony_ci	}
788c2ecf20Sopenharmony_ci	if (!(x & 0x80))
798c2ecf20Sopenharmony_ci		r -= 1;
808c2ecf20Sopenharmony_ci	return r;
818c2ecf20Sopenharmony_ci}
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_civoid txx9_iocled_init(unsigned long baseaddr,
848c2ecf20Sopenharmony_ci		      int basenum, unsigned int num, int lowactive,
858c2ecf20Sopenharmony_ci		      const char *color, char **deftriggers);
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* 7SEG LED */
888c2ecf20Sopenharmony_civoid txx9_7segled_init(unsigned int num,
898c2ecf20Sopenharmony_ci		       void (*putc)(unsigned int pos, unsigned char val));
908c2ecf20Sopenharmony_ciint txx9_7segled_putc(unsigned int pos, char c);
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_civoid __init txx9_aclc_init(unsigned long baseaddr, int irq,
938c2ecf20Sopenharmony_ci			   unsigned int dmac_id,
948c2ecf20Sopenharmony_ci			   unsigned int dma_chan_out,
958c2ecf20Sopenharmony_ci			   unsigned int dma_chan_in);
968c2ecf20Sopenharmony_civoid __init txx9_sramc_init(struct resource *r);
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#endif /* __ASM_TXX9_GENERIC_H */
99