xref: /rk3399_rockchip-uboot/board/freescale/common/ngpixis.h (revision 326ea986ac150acdc7656d57fca647db80b50158)
15a469608STimur Tabi /**
2aa8d3fb8STimur Tabi  * Copyright 2010-2011 Freescale Semiconductor
35a469608STimur Tabi  * Author: Timur Tabi <timur@freescale.com>
45a469608STimur Tabi  *
5*1a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
65a469608STimur Tabi  *
75a469608STimur Tabi  * This file provides support for the ngPIXIS, a board-specific FPGA used on
85a469608STimur Tabi  * some Freescale reference boards.
95a469608STimur Tabi  */
105a469608STimur Tabi 
115a469608STimur Tabi /* ngPIXIS register set. Hopefully, this won't change too much over time.
125a469608STimur Tabi  * Feel free to add board-specific #ifdefs where necessary.
135a469608STimur Tabi  */
145a469608STimur Tabi typedef struct ngpixis {
155a469608STimur Tabi 	u8 id;
165a469608STimur Tabi 	u8 arch;
175a469608STimur Tabi 	u8 scver;
185a469608STimur Tabi 	u8 csr;
195a469608STimur Tabi 	u8 rst;
20e02aea61SKumar Gala 	u8 serclk;
215a469608STimur Tabi 	u8 aux;
225a469608STimur Tabi 	u8 spd;
235a469608STimur Tabi 	u8 brdcfg0;
245f4d3682STimur Tabi 	u8 brdcfg1;	/* On some boards, this register is called 'dma' */
255a469608STimur Tabi 	u8 addr;
26e02aea61SKumar Gala 	u8 brdcfg2;
27e02aea61SKumar Gala 	u8 gpiodir;
285a469608STimur Tabi 	u8 data;
295a469608STimur Tabi 	u8 led;
30e02aea61SKumar Gala 	u8 tag;
315a469608STimur Tabi 	u8 vctl;
325a469608STimur Tabi 	u8 vstat;
335a469608STimur Tabi 	u8 vcfgen0;
345a469608STimur Tabi 	u8 res4;
355a469608STimur Tabi 	u8 ocmcsr;
365a469608STimur Tabi 	u8 ocmmsg;
375a469608STimur Tabi 	u8 gmdbg;
385a469608STimur Tabi 	u8 res5[2];
395a469608STimur Tabi 	u8 sclk[3];
405a469608STimur Tabi 	u8 dclk[3];
415a469608STimur Tabi 	u8 watch;
425a469608STimur Tabi 	struct {
435a469608STimur Tabi 		u8 sw;
445a469608STimur Tabi 		u8 en;
45d31e53b4STimur Tabi 	} s[9];		/* s[0]..s[7] is SW1..SW8, and s[8] is SW11 */
46b4a60e52SKumar Gala } __attribute__ ((packed)) ngpixis_t;
475a469608STimur Tabi 
485a469608STimur Tabi /* Pointer to the PIXIS register set */
495a469608STimur Tabi #define pixis ((ngpixis_t *)PIXIS_BASE)
505a469608STimur Tabi 
515a469608STimur Tabi /* The PIXIS SW register that corresponds to board switch X, where x >= 1 */
525a469608STimur Tabi #define PIXIS_SW(x)		(pixis->s[(x) - 1].sw)
535a469608STimur Tabi 
545a469608STimur Tabi /* The PIXIS EN register that corresponds to board switch X, where x >= 1 */
555a469608STimur Tabi #define PIXIS_EN(x)		(pixis->s[(x) - 1].en)
56aa8d3fb8STimur Tabi 
57aa8d3fb8STimur Tabi u8 pixis_read(unsigned int reg);
58aa8d3fb8STimur Tabi void pixis_write(unsigned int reg, u8 value);
59aa8d3fb8STimur Tabi 
60aa8d3fb8STimur Tabi #define PIXIS_READ(reg) pixis_read(offsetof(ngpixis_t, reg))
61aa8d3fb8STimur Tabi #define PIXIS_WRITE(reg, value) pixis_write(offsetof(ngpixis_t, reg), value)
62