xref: /rk3399_rockchip-uboot/include/ioports.h (revision 0f89ba4320c42f9df753c7c5527aed1d8eaeca93)
1*0f89ba43Swdenk /*
2*0f89ba43Swdenk  * definitions for MPC8260 I/O Ports
3*0f89ba43Swdenk  *
4*0f89ba43Swdenk  * (in addition to those provided in <asm/immap_8260.h>)
5*0f89ba43Swdenk  *
6*0f89ba43Swdenk  * Murray.Jensen@cmst.csiro.au, 20-Oct-00
7*0f89ba43Swdenk  */
8*0f89ba43Swdenk 
9*0f89ba43Swdenk /*
10*0f89ba43Swdenk  * this structure mirrors the layout of the five port registers in
11*0f89ba43Swdenk  * the internal memory map - see iop8260_t in <asm/immap_8260.h>
12*0f89ba43Swdenk  */
13*0f89ba43Swdenk typedef struct {
14*0f89ba43Swdenk     unsigned int pdir;		/* Port Data Direction Register (35-3) */
15*0f89ba43Swdenk     unsigned int ppar;		/* Port Pin Assignment Register (35-4) */
16*0f89ba43Swdenk     unsigned int psor;		/* Port Special Options Register (35-5) */
17*0f89ba43Swdenk     unsigned int podr;		/* Port Open Drain Register (35-2) */
18*0f89ba43Swdenk     unsigned int pdat;		/* Port Data Register (35-3) */
19*0f89ba43Swdenk } ioport_t;
20*0f89ba43Swdenk 
21*0f89ba43Swdenk /*
22*0f89ba43Swdenk  * this macro calculates the address within the internal
23*0f89ba43Swdenk  * memory map (im) of the set of registers for a port (idx)
24*0f89ba43Swdenk  *
25*0f89ba43Swdenk  * the internal memory map aligns the above structure on
26*0f89ba43Swdenk  * a 0x20 byte boundary
27*0f89ba43Swdenk  */
28*0f89ba43Swdenk #define ioport_addr(im, idx) (ioport_t *)((uint)&(im)->im_ioport + ((idx)*0x20))
29*0f89ba43Swdenk 
30*0f89ba43Swdenk /*
31*0f89ba43Swdenk  * this structure provides configuration
32*0f89ba43Swdenk  * information for one port pin
33*0f89ba43Swdenk  */
34*0f89ba43Swdenk typedef struct {
35*0f89ba43Swdenk     unsigned char conf:1;	/* if 1, configure this port */
36*0f89ba43Swdenk     unsigned char ppar:1;	/* Port Pin Assignment Register (35-4) */
37*0f89ba43Swdenk     unsigned char psor:1;	/* Port Special Options Register (35-2) */
38*0f89ba43Swdenk     unsigned char pdir:1;	/* Port Data Direction Register (35-3) */
39*0f89ba43Swdenk     unsigned char podr:1;	/* Port Open Drain Register (35-2) */
40*0f89ba43Swdenk     unsigned char pdat:1;	/* Port Data Register (35-2) */
41*0f89ba43Swdenk } iop_conf_t;
42*0f89ba43Swdenk 
43*0f89ba43Swdenk /*
44*0f89ba43Swdenk  * a table that contains configuration information for all 32 pins
45*0f89ba43Swdenk  * of all four MPC8260 I/O ports.
46*0f89ba43Swdenk  *
47*0f89ba43Swdenk  * NOTE: in the second dimension of this table, index 0 refers to pin 31
48*0f89ba43Swdenk  * and index 31 refers to pin 0. this made the code in the table look more
49*0f89ba43Swdenk  * like the table in the 8260UM (and in the hymod manuals).
50*0f89ba43Swdenk  */
51*0f89ba43Swdenk extern const iop_conf_t iop_conf_tab[4][32];
52