|  | @@ -0,0 +1,101 @@
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/*
 | 
	
		
			
				|  |  | + * 68360 Communication Processor Module.
 | 
	
		
			
				|  |  | + * Copyright (c) 2000 Michael Leslie <mleslie@lineo.com> (mc68360) after:
 | 
	
		
			
				|  |  | + * Copyright (c) 1997 Dan Malek <dmalek@jlc.net> (mpc8xx)
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * This file contains structures and information for the communication
 | 
	
		
			
				|  |  | + * processor channels.  Some CPM control and status is available
 | 
	
		
			
				|  |  | + * through the 68360 internal memory map.  See include/asm/360_immap.h for details.
 | 
	
		
			
				|  |  | + * This file is not a complete map of all of the 360 QUICC's capabilities
 | 
	
		
			
				|  |  | + *
 | 
	
		
			
				|  |  | + * On the MBX board, EPPC-Bug loads CPM microcode into the first 512
 | 
	
		
			
				|  |  | + * bytes of the DP RAM and relocates the I2C parameter area to the
 | 
	
		
			
				|  |  | + * IDMA1 space.  The remaining DP RAM is available for buffer descriptors
 | 
	
		
			
				|  |  | + * or other use.
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +#ifndef __CPM_360__
 | 
	
		
			
				|  |  | +#define __CPM_360__
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* CPM Command register masks: */
 | 
	
		
			
				|  |  | +#define CPM_CR_RST	((ushort)0x8000)
 | 
	
		
			
				|  |  | +#define CPM_CR_OPCODE	((ushort)0x0f00)
 | 
	
		
			
				|  |  | +#define CPM_CR_CHAN	((ushort)0x00f0)
 | 
	
		
			
				|  |  | +#define CPM_CR_FLG	((ushort)0x0001)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* CPM Command set (opcodes): */
 | 
	
		
			
				|  |  | +#define CPM_CR_INIT_TRX		((ushort)0x0000)
 | 
	
		
			
				|  |  | +#define CPM_CR_INIT_RX		((ushort)0x0001)
 | 
	
		
			
				|  |  | +#define CPM_CR_INIT_TX		((ushort)0x0002)
 | 
	
		
			
				|  |  | +#define CPM_CR_HUNT_MODE	((ushort)0x0003)
 | 
	
		
			
				|  |  | +#define CPM_CR_STOP_TX		((ushort)0x0004)
 | 
	
		
			
				|  |  | +#define CPM_CR_GRSTOP_TX	((ushort)0x0005)
 | 
	
		
			
				|  |  | +#define CPM_CR_RESTART_TX	((ushort)0x0006)
 | 
	
		
			
				|  |  | +#define CPM_CR_CLOSE_RXBD	((ushort)0x0007)
 | 
	
		
			
				|  |  | +#define CPM_CR_SET_GADDR	((ushort)0x0008)
 | 
	
		
			
				|  |  | +#define CPM_CR_GCI_TIMEOUT	((ushort)0x0009)
 | 
	
		
			
				|  |  | +#define CPM_CR_GCI_ABORT	((ushort)0x000a)
 | 
	
		
			
				|  |  | +#define CPM_CR_RESET_BCS	((ushort)0x000a)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* CPM Channel numbers. */
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_SCC1	((ushort)0x0000)
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_SCC2	((ushort)0x0004)
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_SPI	((ushort)0x0005)	/* SPI / Timers */
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_TMR	((ushort)0x0005)
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_SCC3	((ushort)0x0008)
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_SMC1	((ushort)0x0009)	/* SMC1 / IDMA1 */
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_IDMA1	((ushort)0x0009)
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_SCC4	((ushort)0x000c)
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_SMC2	((ushort)0x000d)	/* SMC2 / IDMA2 */
 | 
	
		
			
				|  |  | +#define CPM_CR_CH_IDMA2	((ushort)0x000d)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define mk_cr_cmd(CH, CMD)	((CMD << 8) | (CH << 4))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#if 1 /* mleslie: I dinna think we have any such restrictions on
 | 
	
		
			
				|  |  | +       * DP RAM aboard the 360 board - see the MC68360UM p.3-3 */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* The dual ported RAM is multi-functional.  Some areas can be (and are
 | 
	
		
			
				|  |  | + * being) used for microcode.  There is an area that can only be used
 | 
	
		
			
				|  |  | + * as data ram for buffer descriptors, which is all we use right now.
 | 
	
		
			
				|  |  | + * Currently the first 512 and last 256 bytes are used for microcode.
 | 
	
		
			
				|  |  | + */
 | 
	
		
			
				|  |  | +/* mleslie: The uCquicc board is using no extra microcode in DPRAM */
 | 
	
		
			
				|  |  | +#define CPM_DATAONLY_BASE	((uint)0x0000)
 | 
	
		
			
				|  |  | +#define CPM_DATAONLY_SIZE	((uint)0x0800)
 | 
	
		
			
				|  |  | +#define CPM_DP_NOSPACE		((uint)0x7fffffff)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* Export the base address of the communication processor registers
 | 
	
		
			
				|  |  | + * and dual port ram. */
 | 
	
		
			
				|  |  | +/* extern	cpm360_t	*cpmp; */		/* Pointer to comm processor */
 | 
	
		
			
				|  |  | +extern QUICC *pquicc;
 | 
	
		
			
				|  |  | +uint         m360_cpm_dpalloc(uint size);
 | 
	
		
			
				|  |  | +/* void         *m360_cpm_hostalloc(uint size); */
 | 
	
		
			
				|  |  | +void	      m360_cpm_setbrg(uint brg, uint rate);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#if 0 /* use QUICC_BD declared in include/asm/m68360_quicc.h  */
 | 
	
		
			
				|  |  | +/* Buffer descriptors used by many of the CPM protocols. */
 | 
	
		
			
				|  |  | +typedef struct cpm_buf_desc {
 | 
	
		
			
				|  |  | +	ushort	cbd_sc;		/* Status and Control */
 | 
	
		
			
				|  |  | +	ushort	cbd_datlen;	/* Data length in buffer */
 | 
	
		
			
				|  |  | +	uint	cbd_bufaddr;	/* Buffer address in host memory */
 | 
	
		
			
				|  |  | +} cbd_t;
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +/* rx bd status/control bits */
 | 
	
		
			
				|  |  | +#define BD_SC_EMPTY	((ushort)0x8000)	/* Receive is empty */
 | 
	
		
			
				|  |  | +#define BD_SC_WRAP	((ushort)0x2000)	/* Last buffer descriptor in table */
 | 
	
		
			
				|  |  | +#define BD_SC_INTRPT	((ushort)0x1000)	/* Interrupt on change */
 | 
	
		
			
				|  |  | +#define BD_SC_LAST	((ushort)0x0800)	/* Last buffer in frame OR control char */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define BD_SC_FIRST	((ushort)0x0400)	/* 1st buffer in an HDLC frame */
 | 
	
		
			
				|  |  | +#define BD_SC_ADDR	((ushort)0x0400)	/* 1st byte is a multidrop address */
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#define BD_SC_CM	((ushort)0x0200)	/* Continuous mode */
 | 
	
		
			
				|  |  | +#define BD_SC_ID	((ushort)0x0100)	/* Received too many idles */
 | 
	
		
			
				|  |  | +
 |