15a469608STimur Tabi /**
2aa8d3fb8STimur Tabi  * Copyright 2010-2011 Freescale Semiconductor
35a469608STimur Tabi  * Author: Timur Tabi <timur@freescale.com>
45a469608STimur Tabi  *
55a469608STimur Tabi  * This program is free software; you can redistribute it and/or modify it
65a469608STimur Tabi  * under the terms of the GNU General Public License as published by the Free
75a469608STimur Tabi  * Software Foundation; either version 2 of the License, or (at your option)
85a469608STimur Tabi  * any later version.
95a469608STimur Tabi  *
105a469608STimur Tabi  * This file provides support for the ngPIXIS, a board-specific FPGA used on
115a469608STimur Tabi  * some Freescale reference boards.
125a469608STimur Tabi  */
135a469608STimur Tabi 
145a469608STimur Tabi /* ngPIXIS register set. Hopefully, this won't change too much over time.
155a469608STimur Tabi  * Feel free to add board-specific #ifdefs where necessary.
165a469608STimur Tabi  */
175a469608STimur Tabi typedef struct ngpixis {
185a469608STimur Tabi 	u8 id;
195a469608STimur Tabi 	u8 arch;
205a469608STimur Tabi 	u8 scver;
215a469608STimur Tabi 	u8 csr;
225a469608STimur Tabi 	u8 rst;
23*e02aea61SKumar Gala 	u8 serclk;
245a469608STimur Tabi 	u8 aux;
255a469608STimur Tabi 	u8 spd;
265a469608STimur Tabi 	u8 brdcfg0;
275f4d3682STimur Tabi 	u8 brdcfg1;	/* On some boards, this register is called 'dma' */
285a469608STimur Tabi 	u8 addr;
29*e02aea61SKumar Gala 	u8 brdcfg2;
30*e02aea61SKumar Gala 	u8 gpiodir;
315a469608STimur Tabi 	u8 data;
325a469608STimur Tabi 	u8 led;
33*e02aea61SKumar Gala 	u8 tag;
345a469608STimur Tabi 	u8 vctl;
355a469608STimur Tabi 	u8 vstat;
365a469608STimur Tabi 	u8 vcfgen0;
375a469608STimur Tabi 	u8 res4;
385a469608STimur Tabi 	u8 ocmcsr;
395a469608STimur Tabi 	u8 ocmmsg;
405a469608STimur Tabi 	u8 gmdbg;
415a469608STimur Tabi 	u8 res5[2];
425a469608STimur Tabi 	u8 sclk[3];
435a469608STimur Tabi 	u8 dclk[3];
445a469608STimur Tabi 	u8 watch;
455a469608STimur Tabi 	struct {
465a469608STimur Tabi 		u8 sw;
475a469608STimur Tabi 		u8 en;
485a469608STimur Tabi 	} s[8];
49b4a60e52SKumar Gala } __attribute__ ((packed)) ngpixis_t;
505a469608STimur Tabi 
515a469608STimur Tabi /* Pointer to the PIXIS register set */
525a469608STimur Tabi #define pixis ((ngpixis_t *)PIXIS_BASE)
535a469608STimur Tabi 
545a469608STimur Tabi /* The PIXIS SW register that corresponds to board switch X, where x >= 1 */
555a469608STimur Tabi #define PIXIS_SW(x)		(pixis->s[(x) - 1].sw)
565a469608STimur Tabi 
575a469608STimur Tabi /* The PIXIS EN register that corresponds to board switch X, where x >= 1 */
585a469608STimur Tabi #define PIXIS_EN(x)		(pixis->s[(x) - 1].en)
59aa8d3fb8STimur Tabi 
60aa8d3fb8STimur Tabi u8 pixis_read(unsigned int reg);
61aa8d3fb8STimur Tabi void pixis_write(unsigned int reg, u8 value);
62aa8d3fb8STimur Tabi 
63aa8d3fb8STimur Tabi #define PIXIS_READ(reg) pixis_read(offsetof(ngpixis_t, reg))
64aa8d3fb8STimur Tabi #define PIXIS_WRITE(reg, value) pixis_write(offsetof(ngpixis_t, reg), value)
65