xref: /openbmc/u-boot/board/freescale/t104xrdb/cpld.h (revision 9fc2ed40)
1 /**
2  * Copyright 2013 Freescale Semiconductor
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  *
6  * This file provides support for the ngPIXIS, a board-specific FPGA used on
7  * some Freescale reference boards.
8  */
9 
10 /*
11  * CPLD register set. Feel free to add board-specific #ifdefs where necessary.
12  */
13 struct cpld_data {
14 	u8 cpld_ver;		/* 0x00 - CPLD Major Revision Register */
15 	u8 cpld_ver_sub;	/* 0x01 - CPLD Minor Revision Register */
16 	u8 hw_ver;		/* 0x02 - Hardware Revision Register */
17 	u8 sw_ver;		/* 0x03 - Software Revision register */
18 	u8 res0[12];		/* 0x04 - 0x0F - not used */
19 	u8 reset_ctl1;		/* 0x10 - Reset control Register1 */
20 	u8 reset_ctl2;		/* 0x11 - Reset control Register2 */
21 	u8 int_status;		/* 0x12 - Interrupt status Register */
22 	u8 flash_ctl_status;	/* 0x13 - Flash control and status register */
23 	u8 fan_ctl_status;	/* 0x14 - Fan control and status register  */
24 	u8 led_ctl_status;	/* 0x15 - LED control and status register */
25 	u8 sfp_ctl_status;	/* 0x16 - SFP control and status register  */
26 	u8 misc_ctl_status;	/* 0x17 - Miscellanies ctrl & status register*/
27 	u8 boot_override;	/* 0x18 - Boot override register */
28 	u8 boot_config1;	/* 0x19 - Boot config override register*/
29 	u8 boot_config2;	/* 0x1A - Boot config override register*/
30 } cpld_data_t;
31 
32 
33 /* Pointer to the CPLD register set */
34 
35 u8 cpld_read(unsigned int reg);
36 void cpld_write(unsigned int reg, u8 value);
37 
38 #define CPLD_READ(reg) cpld_read(offsetof(struct cpld_data, reg))
39 #define CPLD_WRITE(reg, value)\
40 		cpld_write(offsetof(struct cpld_data, reg), value)
41