18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Defines for the TJSYS JMR-TX3927
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 * Copyright (C) 2000-2001 Toshiba Corporation
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef __ASM_TXX9_JMR3927_H
118c2ecf20Sopenharmony_ci#define __ASM_TXX9_JMR3927_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <asm/txx9/tx3927.h>
148c2ecf20Sopenharmony_ci#include <asm/addrspace.h>
158c2ecf20Sopenharmony_ci#include <asm/txx9irq.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* CS */
188c2ecf20Sopenharmony_ci#define JMR3927_ROMCE0	0x1fc00000	/* 4M */
198c2ecf20Sopenharmony_ci#define JMR3927_ROMCE1	0x1e000000	/* 4M */
208c2ecf20Sopenharmony_ci#define JMR3927_ROMCE2	0x14000000	/* 16M */
218c2ecf20Sopenharmony_ci#define JMR3927_ROMCE3	0x10000000	/* 64M */
228c2ecf20Sopenharmony_ci#define JMR3927_ROMCE5	0x1d000000	/* 4M */
238c2ecf20Sopenharmony_ci#define JMR3927_SDCS0	0x00000000	/* 32M */
248c2ecf20Sopenharmony_ci#define JMR3927_SDCS1	0x02000000	/* 32M */
258c2ecf20Sopenharmony_ci/* PCI Direct Mappings */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#define JMR3927_PCIMEM	0x08000000
288c2ecf20Sopenharmony_ci#define JMR3927_PCIMEM_SIZE	0x08000000	/* 128M */
298c2ecf20Sopenharmony_ci#define JMR3927_PCIIO	0x15000000
308c2ecf20Sopenharmony_ci#define JMR3927_PCIIO_SIZE	0x01000000	/* 16M */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define JMR3927_SDRAM_SIZE	0x02000000	/* 32M */
338c2ecf20Sopenharmony_ci#define JMR3927_PORT_BASE	KSEG1
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci/* Address map (virtual address) */
368c2ecf20Sopenharmony_ci#define JMR3927_ROM0_BASE	(KSEG1 + JMR3927_ROMCE0)
378c2ecf20Sopenharmony_ci#define JMR3927_ROM1_BASE	(KSEG1 + JMR3927_ROMCE1)
388c2ecf20Sopenharmony_ci#define JMR3927_IOC_BASE	(KSEG1 + JMR3927_ROMCE2)
398c2ecf20Sopenharmony_ci#define JMR3927_PCIMEM_BASE	(KSEG1 + JMR3927_PCIMEM)
408c2ecf20Sopenharmony_ci#define JMR3927_PCIIO_BASE	(KSEG1 + JMR3927_PCIIO)
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define JMR3927_IOC_REV_ADDR	(JMR3927_IOC_BASE + 0x00000000)
438c2ecf20Sopenharmony_ci#define JMR3927_IOC_NVRAMB_ADDR (JMR3927_IOC_BASE + 0x00010000)
448c2ecf20Sopenharmony_ci#define JMR3927_IOC_LED_ADDR	(JMR3927_IOC_BASE + 0x00020000)
458c2ecf20Sopenharmony_ci#define JMR3927_IOC_DIPSW_ADDR	(JMR3927_IOC_BASE + 0x00030000)
468c2ecf20Sopenharmony_ci#define JMR3927_IOC_BREV_ADDR	(JMR3927_IOC_BASE + 0x00040000)
478c2ecf20Sopenharmony_ci#define JMR3927_IOC_DTR_ADDR	(JMR3927_IOC_BASE + 0x00050000)
488c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTS1_ADDR	(JMR3927_IOC_BASE + 0x00080000)
498c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTS2_ADDR	(JMR3927_IOC_BASE + 0x00090000)
508c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTM_ADDR	(JMR3927_IOC_BASE + 0x000a0000)
518c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTP_ADDR	(JMR3927_IOC_BASE + 0x000b0000)
528c2ecf20Sopenharmony_ci#define JMR3927_IOC_RESET_ADDR	(JMR3927_IOC_BASE + 0x000f0000)
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* Flash ROM */
558c2ecf20Sopenharmony_ci#define JMR3927_FLASH_BASE	(JMR3927_ROM0_BASE)
568c2ecf20Sopenharmony_ci#define JMR3927_FLASH_SIZE	0x00400000
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* bits for IOC_REV/IOC_BREV (high byte) */
598c2ecf20Sopenharmony_ci#define JMR3927_IDT_MASK	0xfc
608c2ecf20Sopenharmony_ci#define JMR3927_REV_MASK	0x03
618c2ecf20Sopenharmony_ci#define JMR3927_IOC_IDT		0xe0
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* bits for IOC_INTS1/IOC_INTS2/IOC_INTM/IOC_INTP (high byte) */
648c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_PCIA	0
658c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_PCIB	1
668c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_PCIC	2
678c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_PCID	3
688c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_MODEM	4
698c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_INT6	5
708c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_INT7	6
718c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTB_SOFT	7
728c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_PCIA	(1 << JMR3927_IOC_INTF_PCIA)
738c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_PCIB	(1 << JMR3927_IOC_INTB_PCIB)
748c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_PCIC	(1 << JMR3927_IOC_INTB_PCIC)
758c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_PCID	(1 << JMR3927_IOC_INTB_PCID)
768c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_MODEM	(1 << JMR3927_IOC_INTB_MODEM)
778c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_INT6	(1 << JMR3927_IOC_INTB_INT6)
788c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_INT7	(1 << JMR3927_IOC_INTB_INT7)
798c2ecf20Sopenharmony_ci#define JMR3927_IOC_INTF_SOFT	(1 << JMR3927_IOC_INTB_SOFT)
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* bits for IOC_RESET (high byte) */
828c2ecf20Sopenharmony_ci#define JMR3927_IOC_RESET_CPU	1
838c2ecf20Sopenharmony_ci#define JMR3927_IOC_RESET_PCI	2
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci#if defined(__BIG_ENDIAN)
868c2ecf20Sopenharmony_ci#define jmr3927_ioc_reg_out(d, a)	((*(volatile unsigned char *)(a)) = (d))
878c2ecf20Sopenharmony_ci#define jmr3927_ioc_reg_in(a)		(*(volatile unsigned char *)(a))
888c2ecf20Sopenharmony_ci#elif defined(__LITTLE_ENDIAN)
898c2ecf20Sopenharmony_ci#define jmr3927_ioc_reg_out(d, a)	((*(volatile unsigned char *)((a)^1)) = (d))
908c2ecf20Sopenharmony_ci#define jmr3927_ioc_reg_in(a)		(*(volatile unsigned char *)((a)^1))
918c2ecf20Sopenharmony_ci#else
928c2ecf20Sopenharmony_ci#error "No Endian"
938c2ecf20Sopenharmony_ci#endif
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* LED macro */
968c2ecf20Sopenharmony_ci#define jmr3927_led_set(n/*0-16*/)	jmr3927_ioc_reg_out(~(n), JMR3927_IOC_LED_ADDR)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define jmr3927_led_and_set(n/*0-16*/)	jmr3927_ioc_reg_out((~(n)) & jmr3927_ioc_reg_in(JMR3927_IOC_LED_ADDR), JMR3927_IOC_LED_ADDR)
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci/* DIPSW4 macro */
1018c2ecf20Sopenharmony_ci#define jmr3927_dipsw1()	(gpio_get_value(11) == 0)
1028c2ecf20Sopenharmony_ci#define jmr3927_dipsw2()	(gpio_get_value(10) == 0)
1038c2ecf20Sopenharmony_ci#define jmr3927_dipsw3()	((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 2) == 0)
1048c2ecf20Sopenharmony_ci#define jmr3927_dipsw4()	((jmr3927_ioc_reg_in(JMR3927_IOC_DIPSW_ADDR) & 1) == 0)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/*
1078c2ecf20Sopenharmony_ci * IRQ mappings
1088c2ecf20Sopenharmony_ci */
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* These are the virtual IRQ numbers, we divide all IRQ's into
1118c2ecf20Sopenharmony_ci * 'spaces', the 'space' determines where and how to enable/disable
1128c2ecf20Sopenharmony_ci * that particular IRQ on an JMR machine.  Add new 'spaces' as new
1138c2ecf20Sopenharmony_ci * IRQ hardware is supported.
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_ci#define JMR3927_NR_IRQ_IRC	16	/* On-Chip IRC */
1168c2ecf20Sopenharmony_ci#define JMR3927_NR_IRQ_IOC	8	/* PCI/MODEM/INT[6:7] */
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC TXX9_IRQ_BASE
1198c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC (JMR3927_IRQ_IRC + JMR3927_NR_IRQ_IRC)
1208c2ecf20Sopenharmony_ci#define JMR3927_IRQ_END (JMR3927_IRQ_IOC + JMR3927_NR_IRQ_IOC)
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_INT0	(JMR3927_IRQ_IRC + TX3927_IR_INT0)
1238c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_INT1	(JMR3927_IRQ_IRC + TX3927_IR_INT1)
1248c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_INT2	(JMR3927_IRQ_IRC + TX3927_IR_INT2)
1258c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_INT3	(JMR3927_IRQ_IRC + TX3927_IR_INT3)
1268c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_INT4	(JMR3927_IRQ_IRC + TX3927_IR_INT4)
1278c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_INT5	(JMR3927_IRQ_IRC + TX3927_IR_INT5)
1288c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_SIO0	(JMR3927_IRQ_IRC + TX3927_IR_SIO0)
1298c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_SIO1	(JMR3927_IRQ_IRC + TX3927_IR_SIO1)
1308c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_SIO(ch) (JMR3927_IRQ_IRC + TX3927_IR_SIO(ch))
1318c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_DMA	(JMR3927_IRQ_IRC + TX3927_IR_DMA)
1328c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_PIO	(JMR3927_IRQ_IRC + TX3927_IR_PIO)
1338c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_PCI	(JMR3927_IRQ_IRC + TX3927_IR_PCI)
1348c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IRC_TMR(ch) (JMR3927_IRQ_IRC + TX3927_IR_TMR(ch))
1358c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_PCIA	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIA)
1368c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_PCIB	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIB)
1378c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_PCIC	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCIC)
1388c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_PCID	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_PCID)
1398c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_MODEM	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_MODEM)
1408c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_INT6	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT6)
1418c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_INT7	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_INT7)
1428c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOC_SOFT	(JMR3927_IRQ_IOC + JMR3927_IOC_INTB_SOFT)
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci/* IOC (PCI, MODEM) */
1458c2ecf20Sopenharmony_ci#define JMR3927_IRQ_IOCINT	JMR3927_IRQ_IRC_INT1
1468c2ecf20Sopenharmony_ci/* TC35815 100M Ether (JMR-TX3912:JPW4:2-3 Short) */
1478c2ecf20Sopenharmony_ci#define JMR3927_IRQ_ETHER0	JMR3927_IRQ_IRC_INT3
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* Clocks */
1508c2ecf20Sopenharmony_ci#define JMR3927_CORECLK 132710400	/* 132.7MHz */
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/*
1538c2ecf20Sopenharmony_ci * TX3927 Pin Configuration:
1548c2ecf20Sopenharmony_ci *
1558c2ecf20Sopenharmony_ci *	PCFG bits		Avail			Dead
1568c2ecf20Sopenharmony_ci *	SELSIO[1:0]:11		RXD[1:0], TXD[1:0]	PIO[6:3]
1578c2ecf20Sopenharmony_ci *	SELSIOC[0]:1		CTS[0], RTS[0]		INT[5:4]
1588c2ecf20Sopenharmony_ci *	SELSIOC[1]:0,SELDSF:0,	GSDAO[0],GPCST[3]	CTS[1], RTS[1],DSF,
1598c2ecf20Sopenharmony_ci *	  GDBGE*					  PIO[2:1]
1608c2ecf20Sopenharmony_ci *	SELDMA[2]:1		DMAREQ[2],DMAACK[2]	PIO[13:12]
1618c2ecf20Sopenharmony_ci *	SELTMR[2:0]:000					TIMER[1:0]
1628c2ecf20Sopenharmony_ci *	SELCS:0,SELDMA[1]:0	PIO[11;10]		SDCS_CE[7:6],
1638c2ecf20Sopenharmony_ci *							  DMAREQ[1],DMAACK[1]
1648c2ecf20Sopenharmony_ci *	SELDMA[0]:1		DMAREQ[0],DMAACK[0]	PIO[9:8]
1658c2ecf20Sopenharmony_ci *	SELDMA[3]:1		DMAREQ[3],DMAACK[3]	PIO[15:14]
1668c2ecf20Sopenharmony_ci *	SELDONE:1		DMADONE			PIO[7]
1678c2ecf20Sopenharmony_ci *
1688c2ecf20Sopenharmony_ci * Usable pins are:
1698c2ecf20Sopenharmony_ci *	RXD[1;0],TXD[1:0],CTS[0],RTS[0],
1708c2ecf20Sopenharmony_ci *	DMAREQ[0,2,3],DMAACK[0,2,3],DMADONE,PIO[0,10,11]
1718c2ecf20Sopenharmony_ci *	INT[3:0]
1728c2ecf20Sopenharmony_ci */
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_civoid jmr3927_prom_init(void);
1758c2ecf20Sopenharmony_civoid jmr3927_irq_setup(void);
1768c2ecf20Sopenharmony_cistruct pci_dev;
1778c2ecf20Sopenharmony_ciint jmr3927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci#endif /* __ASM_TXX9_JMR3927_H */
180