18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 1995 - 1998 by Andreas Busse and Ralf Baechle
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci#ifndef __ASM_JAZZ_H
98c2ecf20Sopenharmony_ci#define __ASM_JAZZ_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/*
128c2ecf20Sopenharmony_ci * The addresses below are virtual address. The mappings are
138c2ecf20Sopenharmony_ci * created on startup via wired entries in the tlb. The Mips
148c2ecf20Sopenharmony_ci * Magnum R3000 and R4000 machines are similar in many aspects,
158c2ecf20Sopenharmony_ci * but many hardware register are accessible at 0xb9000000 in
168c2ecf20Sopenharmony_ci * instead of 0xe0000000.
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define JAZZ_LOCAL_IO_SPACE	0xe0000000
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * Revision numbers in PICA_ASIC_REVISION
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * 0xf0000000 - Rev1
258c2ecf20Sopenharmony_ci * 0xf0000001 - Rev2
268c2ecf20Sopenharmony_ci * 0xf0000002 - Rev3
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ci#define PICA_ASIC_REVISION	0xe0000008
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * The segments of the seven segment LED are mapped
328c2ecf20Sopenharmony_ci * to the control bits as follows:
338c2ecf20Sopenharmony_ci *
348c2ecf20Sopenharmony_ci *	   (7)
358c2ecf20Sopenharmony_ci *	---------
368c2ecf20Sopenharmony_ci *	|	|
378c2ecf20Sopenharmony_ci *  (2) |	| (6)
388c2ecf20Sopenharmony_ci *	|  (1)	|
398c2ecf20Sopenharmony_ci *	---------
408c2ecf20Sopenharmony_ci *	|	|
418c2ecf20Sopenharmony_ci *  (3) |	| (5)
428c2ecf20Sopenharmony_ci *	|  (4)	|
438c2ecf20Sopenharmony_ci *	--------- . (0)
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ci#define PICA_LED		0xe000f000
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/*
488c2ecf20Sopenharmony_ci * Some characters for the LED control registers
498c2ecf20Sopenharmony_ci * The original Mips machines seem to have a LED display
508c2ecf20Sopenharmony_ci * with integrated decoder while the Acer machines can
518c2ecf20Sopenharmony_ci * control each of the seven segments and the dot independently.
528c2ecf20Sopenharmony_ci * It's only a toy, anyway...
538c2ecf20Sopenharmony_ci */
548c2ecf20Sopenharmony_ci#define LED_DOT			0x01
558c2ecf20Sopenharmony_ci#define LED_SPACE		0x00
568c2ecf20Sopenharmony_ci#define LED_0			0xfc
578c2ecf20Sopenharmony_ci#define LED_1			0x60
588c2ecf20Sopenharmony_ci#define LED_2			0xda
598c2ecf20Sopenharmony_ci#define LED_3			0xf2
608c2ecf20Sopenharmony_ci#define LED_4			0x66
618c2ecf20Sopenharmony_ci#define LED_5			0xb6
628c2ecf20Sopenharmony_ci#define LED_6			0xbe
638c2ecf20Sopenharmony_ci#define LED_7			0xe0
648c2ecf20Sopenharmony_ci#define LED_8			0xfe
658c2ecf20Sopenharmony_ci#define LED_9			0xf6
668c2ecf20Sopenharmony_ci#define LED_A			0xee
678c2ecf20Sopenharmony_ci#define LED_b			0x3e
688c2ecf20Sopenharmony_ci#define LED_C			0x9c
698c2ecf20Sopenharmony_ci#define LED_d			0x7a
708c2ecf20Sopenharmony_ci#define LED_E			0x9e
718c2ecf20Sopenharmony_ci#define LED_F			0x8e
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic __inline__ void pica_set_led(unsigned int bits)
768c2ecf20Sopenharmony_ci{
778c2ecf20Sopenharmony_ci	volatile unsigned int *led_register = (unsigned int *) PICA_LED;
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci	*led_register = bits;
808c2ecf20Sopenharmony_ci}
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/*
858c2ecf20Sopenharmony_ci * Base address of the Sonic Ethernet adapter in Jazz machines.
868c2ecf20Sopenharmony_ci */
878c2ecf20Sopenharmony_ci#define JAZZ_ETHERNET_BASE  0xe0001000
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci/*
908c2ecf20Sopenharmony_ci * Base address of the 53C94 SCSI hostadapter in Jazz machines.
918c2ecf20Sopenharmony_ci */
928c2ecf20Sopenharmony_ci#define JAZZ_SCSI_BASE		0xe0002000
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/*
958c2ecf20Sopenharmony_ci * i8042 keyboard controller for JAZZ and PICA chipsets.
968c2ecf20Sopenharmony_ci * This address is just a guess and seems to differ from
978c2ecf20Sopenharmony_ci * other mips machines such as RC3xxx...
988c2ecf20Sopenharmony_ci */
998c2ecf20Sopenharmony_ci#define JAZZ_KEYBOARD_ADDRESS	0xe0005000
1008c2ecf20Sopenharmony_ci#define JAZZ_KEYBOARD_DATA	0xe0005000
1018c2ecf20Sopenharmony_ci#define JAZZ_KEYBOARD_COMMAND	0xe0005001
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_citypedef struct {
1068c2ecf20Sopenharmony_ci	unsigned char data;
1078c2ecf20Sopenharmony_ci	unsigned char command;
1088c2ecf20Sopenharmony_ci} jazz_keyboard_hardware;
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#define jazz_kh ((keyboard_hardware *) JAZZ_KEYBOARD_ADDRESS)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_citypedef struct {
1138c2ecf20Sopenharmony_ci	unsigned char pad0[3];
1148c2ecf20Sopenharmony_ci	unsigned char data;
1158c2ecf20Sopenharmony_ci	unsigned char pad1[3];
1168c2ecf20Sopenharmony_ci	unsigned char command;
1178c2ecf20Sopenharmony_ci} mips_keyboard_hardware;
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/*
1208c2ecf20Sopenharmony_ci * For now. Needs to be changed for RC3xxx support. See below.
1218c2ecf20Sopenharmony_ci */
1228c2ecf20Sopenharmony_ci#define keyboard_hardware	jazz_keyboard_hardware
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/*
1278c2ecf20Sopenharmony_ci * i8042 keyboard controller for most other Mips machines.
1288c2ecf20Sopenharmony_ci */
1298c2ecf20Sopenharmony_ci#define MIPS_KEYBOARD_ADDRESS	0xb9005000
1308c2ecf20Sopenharmony_ci#define MIPS_KEYBOARD_DATA	0xb9005003
1318c2ecf20Sopenharmony_ci#define MIPS_KEYBOARD_COMMAND	0xb9005007
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/*
1348c2ecf20Sopenharmony_ci * Serial and parallel ports (WD 16C552) on the Mips JAZZ
1358c2ecf20Sopenharmony_ci */
1368c2ecf20Sopenharmony_ci#define JAZZ_SERIAL1_BASE	(unsigned int)0xe0006000
1378c2ecf20Sopenharmony_ci#define JAZZ_SERIAL2_BASE	(unsigned int)0xe0007000
1388c2ecf20Sopenharmony_ci#define JAZZ_PARALLEL_BASE	(unsigned int)0xe0008000
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci/*
1418c2ecf20Sopenharmony_ci * Dummy Device Address. Used in jazzdma.c
1428c2ecf20Sopenharmony_ci */
1438c2ecf20Sopenharmony_ci#define JAZZ_DUMMY_DEVICE	0xe000d000
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/*
1468c2ecf20Sopenharmony_ci * JAZZ timer registers and interrupt no.
1478c2ecf20Sopenharmony_ci * Note that the hardware timer interrupt is actually on
1488c2ecf20Sopenharmony_ci * cpu level 6, but to keep compatibility with PC stuff
1498c2ecf20Sopenharmony_ci * it is remapped to vector 0. See arch/mips/kernel/entry.S.
1508c2ecf20Sopenharmony_ci */
1518c2ecf20Sopenharmony_ci#define JAZZ_TIMER_INTERVAL	0xe0000228
1528c2ecf20Sopenharmony_ci#define JAZZ_TIMER_REGISTER	0xe0000230
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/*
1558c2ecf20Sopenharmony_ci * DRAM configuration register
1568c2ecf20Sopenharmony_ci */
1578c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
1588c2ecf20Sopenharmony_ci#ifdef __MIPSEL__
1598c2ecf20Sopenharmony_citypedef struct {
1608c2ecf20Sopenharmony_ci	unsigned int bank2 : 3;
1618c2ecf20Sopenharmony_ci	unsigned int bank1 : 3;
1628c2ecf20Sopenharmony_ci	unsigned int mem_bus_width : 1;
1638c2ecf20Sopenharmony_ci	unsigned int reserved2 : 1;
1648c2ecf20Sopenharmony_ci	unsigned int page_mode : 1;
1658c2ecf20Sopenharmony_ci	unsigned int reserved1 : 23;
1668c2ecf20Sopenharmony_ci} dram_configuration;
1678c2ecf20Sopenharmony_ci#else /* defined (__MIPSEB__) */
1688c2ecf20Sopenharmony_citypedef struct {
1698c2ecf20Sopenharmony_ci	unsigned int reserved1 : 23;
1708c2ecf20Sopenharmony_ci	unsigned int page_mode : 1;
1718c2ecf20Sopenharmony_ci	unsigned int reserved2 : 1;
1728c2ecf20Sopenharmony_ci	unsigned int mem_bus_width : 1;
1738c2ecf20Sopenharmony_ci	unsigned int bank1 : 3;
1748c2ecf20Sopenharmony_ci	unsigned int bank2 : 3;
1758c2ecf20Sopenharmony_ci} dram_configuration;
1768c2ecf20Sopenharmony_ci#endif
1778c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#define PICA_DRAM_CONFIG	0xe00fffe0
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/*
1828c2ecf20Sopenharmony_ci * JAZZ interrupt control registers
1838c2ecf20Sopenharmony_ci */
1848c2ecf20Sopenharmony_ci#define JAZZ_IO_IRQ_SOURCE	0xe0010000
1858c2ecf20Sopenharmony_ci#define JAZZ_IO_IRQ_ENABLE	0xe0010002
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci/*
1888c2ecf20Sopenharmony_ci * JAZZ Interrupt Level definitions
1898c2ecf20Sopenharmony_ci *
1908c2ecf20Sopenharmony_ci * This is somewhat broken.  For reasons which nobody can remember anymore
1918c2ecf20Sopenharmony_ci * we remap the Jazz interrupts to the usual ISA style interrupt numbers.
1928c2ecf20Sopenharmony_ci */
1938c2ecf20Sopenharmony_ci#define JAZZ_IRQ_START		24
1948c2ecf20Sopenharmony_ci#define JAZZ_IRQ_END		(24 + 9)
1958c2ecf20Sopenharmony_ci#define JAZZ_PARALLEL_IRQ	(JAZZ_IRQ_START + 0)
1968c2ecf20Sopenharmony_ci#define JAZZ_FLOPPY_IRQ		(JAZZ_IRQ_START + 1)
1978c2ecf20Sopenharmony_ci#define JAZZ_SOUND_IRQ		(JAZZ_IRQ_START + 2)
1988c2ecf20Sopenharmony_ci#define JAZZ_VIDEO_IRQ		(JAZZ_IRQ_START + 3)
1998c2ecf20Sopenharmony_ci#define JAZZ_ETHERNET_IRQ	(JAZZ_IRQ_START + 4)
2008c2ecf20Sopenharmony_ci#define JAZZ_SCSI_IRQ		(JAZZ_IRQ_START + 5)
2018c2ecf20Sopenharmony_ci#define JAZZ_KEYBOARD_IRQ	(JAZZ_IRQ_START + 6)
2028c2ecf20Sopenharmony_ci#define JAZZ_MOUSE_IRQ		(JAZZ_IRQ_START + 7)
2038c2ecf20Sopenharmony_ci#define JAZZ_SERIAL1_IRQ	(JAZZ_IRQ_START + 8)
2048c2ecf20Sopenharmony_ci#define JAZZ_SERIAL2_IRQ	(JAZZ_IRQ_START + 9)
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define JAZZ_TIMER_IRQ		(MIPS_CPU_IRQ_BASE+6)
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci/*
2108c2ecf20Sopenharmony_ci * JAZZ DMA Channels
2118c2ecf20Sopenharmony_ci * Note: Channels 4...7 are not used with respect to the Acer PICA-61
2128c2ecf20Sopenharmony_ci * chipset which does not provide these DMA channels.
2138c2ecf20Sopenharmony_ci */
2148c2ecf20Sopenharmony_ci#define JAZZ_SCSI_DMA		0	       /* SCSI */
2158c2ecf20Sopenharmony_ci#define JAZZ_FLOPPY_DMA		1	       /* FLOPPY */
2168c2ecf20Sopenharmony_ci#define JAZZ_AUDIOL_DMA		2	       /* AUDIO L */
2178c2ecf20Sopenharmony_ci#define JAZZ_AUDIOR_DMA		3	       /* AUDIO R */
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci/*
2208c2ecf20Sopenharmony_ci * JAZZ R4030 MCT_ADR chip (DMA controller)
2218c2ecf20Sopenharmony_ci * Note: Virtual Addresses !
2228c2ecf20Sopenharmony_ci */
2238c2ecf20Sopenharmony_ci#define JAZZ_R4030_CONFIG	0xE0000000	/* R4030 config register */
2248c2ecf20Sopenharmony_ci#define JAZZ_R4030_REVISION	0xE0000008	/* same as PICA_ASIC_REVISION */
2258c2ecf20Sopenharmony_ci#define JAZZ_R4030_INV_ADDR	0xE0000010	/* Invalid Address register */
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci#define JAZZ_R4030_TRSTBL_BASE	0xE0000018	/* Translation Table Base */
2288c2ecf20Sopenharmony_ci#define JAZZ_R4030_TRSTBL_LIM	0xE0000020	/* Translation Table Limit */
2298c2ecf20Sopenharmony_ci#define JAZZ_R4030_TRSTBL_INV	0xE0000028	/* Translation Table Invalidate */
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci#define JAZZ_R4030_CACHE_MTNC	0xE0000030	/* Cache Maintenance */
2328c2ecf20Sopenharmony_ci#define JAZZ_R4030_R_FAIL_ADDR	0xE0000038	/* Remote Failed Address */
2338c2ecf20Sopenharmony_ci#define JAZZ_R4030_M_FAIL_ADDR	0xE0000040	/* Memory Failed Address */
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci#define JAZZ_R4030_CACHE_PTAG	0xE0000048	/* I/O Cache Physical Tag */
2368c2ecf20Sopenharmony_ci#define JAZZ_R4030_CACHE_LTAG	0xE0000050	/* I/O Cache Logical Tag */
2378c2ecf20Sopenharmony_ci#define JAZZ_R4030_CACHE_BMASK	0xE0000058	/* I/O Cache Byte Mask */
2388c2ecf20Sopenharmony_ci#define JAZZ_R4030_CACHE_BWIN	0xE0000060	/* I/O Cache Buffer Window */
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci/*
2418c2ecf20Sopenharmony_ci * Remote Speed Registers.
2428c2ecf20Sopenharmony_ci *
2438c2ecf20Sopenharmony_ci *  0: free,	  1: Ethernet,	2: SCSI,      3: Floppy,
2448c2ecf20Sopenharmony_ci *  4: RTC,	  5: Kb./Mouse	6: serial 1,  7: serial 2,
2458c2ecf20Sopenharmony_ci *  8: parallel,  9: NVRAM,    10: CPU,	     11: PROM,
2468c2ecf20Sopenharmony_ci * 12: reserved, 13: free,     14: 7seg LED, 15: ???
2478c2ecf20Sopenharmony_ci */
2488c2ecf20Sopenharmony_ci#define JAZZ_R4030_REM_SPEED	0xE0000070	/* 16 Remote Speed Registers */
2498c2ecf20Sopenharmony_ci						/* 0xE0000070,78,80... 0xE00000E8 */
2508c2ecf20Sopenharmony_ci#define JAZZ_R4030_IRQ_ENABLE	0xE00000E8	/* Internal Interrupt Enable */
2518c2ecf20Sopenharmony_ci#define JAZZ_R4030_INVAL_ADDR	0xE0000010	/* Invalid address Register */
2528c2ecf20Sopenharmony_ci#define JAZZ_R4030_IRQ_SOURCE	0xE0000200	/* Interrupt Source Register */
2538c2ecf20Sopenharmony_ci#define JAZZ_R4030_I386_ERROR	0xE0000208	/* i386/EISA Bus Error */
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci/*
2568c2ecf20Sopenharmony_ci * Virtual (E)ISA controller address
2578c2ecf20Sopenharmony_ci */
2588c2ecf20Sopenharmony_ci#define JAZZ_EISA_IRQ_ACK	0xE0000238	/* EISA interrupt acknowledge */
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci/*
2618c2ecf20Sopenharmony_ci * Access the R4030 DMA and I/O Controller
2628c2ecf20Sopenharmony_ci */
2638c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_cistatic inline void r4030_delay(void)
2668c2ecf20Sopenharmony_ci{
2678c2ecf20Sopenharmony_ci__asm__ __volatile__(
2688c2ecf20Sopenharmony_ci	".set\tnoreorder\n\t"
2698c2ecf20Sopenharmony_ci	"nop\n\t"
2708c2ecf20Sopenharmony_ci	"nop\n\t"
2718c2ecf20Sopenharmony_ci	"nop\n\t"
2728c2ecf20Sopenharmony_ci	"nop\n\t"
2738c2ecf20Sopenharmony_ci	".set\treorder");
2748c2ecf20Sopenharmony_ci}
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_cistatic inline unsigned short r4030_read_reg16(unsigned long addr)
2778c2ecf20Sopenharmony_ci{
2788c2ecf20Sopenharmony_ci	unsigned short ret = *((volatile unsigned short *)addr);
2798c2ecf20Sopenharmony_ci	r4030_delay();
2808c2ecf20Sopenharmony_ci	return ret;
2818c2ecf20Sopenharmony_ci}
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_cistatic inline unsigned int r4030_read_reg32(unsigned long addr)
2848c2ecf20Sopenharmony_ci{
2858c2ecf20Sopenharmony_ci	unsigned int ret = *((volatile unsigned int *)addr);
2868c2ecf20Sopenharmony_ci	r4030_delay();
2878c2ecf20Sopenharmony_ci	return ret;
2888c2ecf20Sopenharmony_ci}
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_cistatic inline void r4030_write_reg16(unsigned long addr, unsigned val)
2918c2ecf20Sopenharmony_ci{
2928c2ecf20Sopenharmony_ci	*((volatile unsigned short *)addr) = val;
2938c2ecf20Sopenharmony_ci	r4030_delay();
2948c2ecf20Sopenharmony_ci}
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_cistatic inline void r4030_write_reg32(unsigned long addr, unsigned val)
2978c2ecf20Sopenharmony_ci{
2988c2ecf20Sopenharmony_ci	*((volatile unsigned int *)addr) = val;
2998c2ecf20Sopenharmony_ci	r4030_delay();
3008c2ecf20Sopenharmony_ci}
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci#define JAZZ_FDC_BASE	0xe0003000
3058c2ecf20Sopenharmony_ci#define JAZZ_RTC_BASE	0xe0004000
3068c2ecf20Sopenharmony_ci#define JAZZ_PORT_BASE	0xe2000000
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci#define JAZZ_EISA_BASE	0xe3000000
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci#endif /* __ASM_JAZZ_H */
311