189d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto/*
289d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto * linux/include/asm-mips/txx9/generic.h
389d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto *
489d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto * This file is subject to the terms and conditions of the GNU General Public
589d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto * License.  See the file "COPYING" in the main directory of this archive
689d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto * for more details.
789d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto */
889d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto#ifndef __ASM_TXX9_GENERIC_H
989d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto#define __ASM_TXX9_GENERIC_H
1089d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto
1189d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto#include <linux/init.h>
1289d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto#include <linux/ioport.h>	/* for struct resource */
1389d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto
1489d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemotoextern struct resource txx9_ce_res[];
1594a4c32939dede9328c6e4face335eb8441fc18dAtsushi Nemoto#define TXX9_CE(n)	(unsigned long)(txx9_ce_res[(n)].start)
1694a4c32939dede9328c6e4face335eb8441fc18dAtsushi Nemotoextern unsigned int txx9_pcode;
1789d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemotoextern char txx9_pcode_str[8];
1889d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemotovoid txx9_reg_res_init(unsigned int pcode, unsigned long base,
1989d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto		       unsigned long size);
2089d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto
2189d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemotoextern unsigned int txx9_master_clock;
2289d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemotoextern unsigned int txx9_cpu_clock;
2389d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemotoextern unsigned int txx9_gbus_clock;
2494a4c32939dede9328c6e4face335eb8441fc18dAtsushi Nemoto#define TXX9_IMCLK	(txx9_gbus_clock / 2)
2594a4c32939dede9328c6e4face335eb8441fc18dAtsushi Nemoto
2694a4c32939dede9328c6e4face335eb8441fc18dAtsushi Nemotoextern int txx9_ccfg_toeon;
2794a4c32939dede9328c6e4face335eb8441fc18dAtsushi Nemotostruct uart_port;
2894a4c32939dede9328c6e4face335eb8441fc18dAtsushi Nemotoint early_serial_txx9_setup(struct uart_port *port);
2989d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto
30edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemotostruct pci_dev;
31edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemotostruct txx9_board_vec {
32edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	const char *system;
33edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	void (*prom_init)(void);
34edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	void (*mem_setup)(void);
35edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	void (*irq_setup)(void);
36edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	void (*time_init)(void);
37edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	void (*arch_init)(void);
38edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	void (*device_init)(void);
39edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto#ifdef CONFIG_PCI
40edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto	int (*pci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
41edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto#endif
42edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto};
43edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemotoextern struct txx9_board_vec *txx9_board_vec;
44edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemotoextern int (*txx9_irq_dispatch)(int pending);
45265b89db1058124ddbf0091ba3f8c020e3a5ae9dAtsushi Nemotoconst char *prom_getenv(const char *name);
46683147254ef7e69ebbbe55280ba6a3c5ae2325d8Atsushi Nemotovoid txx9_wdt_init(unsigned long base);
47496a3b5c2c188e8af07261792b3d4e6cf1c1dab9Atsushi Nemotovoid txx9_wdt_now(unsigned long base);
48c49f91f51e3cca796494f69fd967a7f72df5d457Atsushi Nemotovoid txx9_spi_init(int busid, unsigned long base, int irq);
49c49f91f51e3cca796494f69fd967a7f72df5d457Atsushi Nemotovoid txx9_ethaddr_init(unsigned int id, unsigned char *ethaddr);
507779a5e07d33fe316fe468e7afe7975fb686a831Atsushi Nemotovoid txx9_sio_init(unsigned long baseaddr, int irq,
517779a5e07d33fe316fe468e7afe7975fb686a831Atsushi Nemoto		   unsigned int line, unsigned int sclk, int nocts);
52e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemotovoid prom_putchar(char c);
53e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemoto#ifdef CONFIG_EARLY_PRINTK
54e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemotoextern void (*txx9_prom_putchar)(char c);
55e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemotovoid txx9_sio_putchar_init(unsigned long baseaddr);
56e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemoto#else
57e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemotostatic inline void txx9_sio_putchar_init(unsigned long baseaddr)
58e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemoto{
59e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemoto}
60e352953ce00bb870124e9054dbbbda2262f9269cAtsushi Nemoto#endif
61edcaf1a6a77315562e9781245cc8e028c9a921dcAtsushi Nemoto
6251f607c76e1e7bd089dcad97b6b0a58649be06a3Atsushi Nemotostruct physmap_flash_data;
6351f607c76e1e7bd089dcad97b6b0a58649be06a3Atsushi Nemotovoid txx9_physmap_flash_init(int no, unsigned long addr, unsigned long size,
6451f607c76e1e7bd089dcad97b6b0a58649be06a3Atsushi Nemoto			     const struct physmap_flash_data *pdata);
6551f607c76e1e7bd089dcad97b6b0a58649be06a3Atsushi Nemoto
6621e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto/* 8 bit version of __fls(): find first bit set (returns 0..7) */
6721e77df215e58523a755b5dd006cb17610616f20Atsushi Nemotostatic inline unsigned int __fls8(unsigned char x)
6821e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto{
6921e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto	int r = 7;
7021e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto
7121e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto	if (!(x & 0xf0)) {
7221e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto		r -= 4;
7321e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto		x <<= 4;
7421e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto	}
7521e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto	if (!(x & 0xc0)) {
7621e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto		r -= 2;
7721e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto		x <<= 2;
7821e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto	}
7921e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto	if (!(x & 0x80))
8021e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto		r -= 1;
8121e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto	return r;
8221e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto}
8321e77df215e58523a755b5dd006cb17610616f20Atsushi Nemoto
84ae027ead87b13cff99b4f48da7696aa4fe75393bAtsushi Nemotovoid txx9_iocled_init(unsigned long baseaddr,
85ae027ead87b13cff99b4f48da7696aa4fe75393bAtsushi Nemoto		      int basenum, unsigned int num, int lowactive,
86ae027ead87b13cff99b4f48da7696aa4fe75393bAtsushi Nemoto		      const char *color, char **deftriggers);
87ae027ead87b13cff99b4f48da7696aa4fe75393bAtsushi Nemoto
88bc89b2bdefa5f56133d0b19a220880d4ada62560Atsushi Nemoto/* 7SEG LED */
89bc89b2bdefa5f56133d0b19a220880d4ada62560Atsushi Nemotovoid txx9_7segled_init(unsigned int num,
90bc89b2bdefa5f56133d0b19a220880d4ada62560Atsushi Nemoto		       void (*putc)(unsigned int pos, unsigned char val));
91bc89b2bdefa5f56133d0b19a220880d4ada62560Atsushi Nemotoint txx9_7segled_putc(unsigned int pos, char c);
92bc89b2bdefa5f56133d0b19a220880d4ada62560Atsushi Nemoto
93742cd5867b2ef7ce865d7ab67574c4e3aa1fb155Atsushi Nemotovoid __init txx9_aclc_init(unsigned long baseaddr, int irq,
94742cd5867b2ef7ce865d7ab67574c4e3aa1fb155Atsushi Nemoto			   unsigned int dmac_id,
95742cd5867b2ef7ce865d7ab67574c4e3aa1fb155Atsushi Nemoto			   unsigned int dma_chan_out,
96742cd5867b2ef7ce865d7ab67574c4e3aa1fb155Atsushi Nemoto			   unsigned int dma_chan_in);
97c3b28ae260d99a5364a31210a36a3246bd9647f7Atsushi Nemotovoid __init txx9_sramc_init(struct resource *r);
98742cd5867b2ef7ce865d7ab67574c4e3aa1fb155Atsushi Nemoto
9989d63fe179520b11f54de1f26755b7444c79e73aAtsushi Nemoto#endif /* __ASM_TXX9_GENERIC_H */
100