blob: 364e74954ebe4693ca83352195499c0665013964 [file] [log] [blame]
Timur Tabi4f332d22010-04-01 10:49:42 -05001/**
Timur Tabi746e2f32011-01-21 16:03:57 -06002 * Copyright 2010-2011 Freescale Semiconductor
Timur Tabi4f332d22010-04-01 10:49:42 -05003 * Author: Timur Tabi <timur@freescale.com>
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Timur Tabi4f332d22010-04-01 10:49:42 -05006 *
7 * This file provides support for the ngPIXIS, a board-specific FPGA used on
8 * some Freescale reference boards.
9 */
10
11/* ngPIXIS register set. Hopefully, this won't change too much over time.
12 * Feel free to add board-specific #ifdefs where necessary.
13 */
14typedef struct ngpixis {
15 u8 id;
16 u8 arch;
17 u8 scver;
18 u8 csr;
19 u8 rst;
Kumar Galae38209e2011-02-09 02:00:08 +000020 u8 serclk;
Timur Tabi4f332d22010-04-01 10:49:42 -050021 u8 aux;
22 u8 spd;
23 u8 brdcfg0;
Timur Tabi00072362010-05-20 11:16:16 -050024 u8 brdcfg1; /* On some boards, this register is called 'dma' */
Timur Tabi4f332d22010-04-01 10:49:42 -050025 u8 addr;
Kumar Galae38209e2011-02-09 02:00:08 +000026 u8 brdcfg2;
27 u8 gpiodir;
Timur Tabi4f332d22010-04-01 10:49:42 -050028 u8 data;
29 u8 led;
Kumar Galae38209e2011-02-09 02:00:08 +000030 u8 tag;
Timur Tabi4f332d22010-04-01 10:49:42 -050031 u8 vctl;
32 u8 vstat;
33 u8 vcfgen0;
34 u8 res4;
35 u8 ocmcsr;
36 u8 ocmmsg;
37 u8 gmdbg;
38 u8 res5[2];
39 u8 sclk[3];
40 u8 dclk[3];
41 u8 watch;
42 struct {
43 u8 sw;
44 u8 en;
Timur Tabi04b4a882012-10-23 09:40:22 +000045 } s[9]; /* s[0]..s[7] is SW1..SW8, and s[8] is SW11 */
Kumar Galaf2f5d7b2010-05-22 17:25:47 -050046} __attribute__ ((packed)) ngpixis_t;
Timur Tabi4f332d22010-04-01 10:49:42 -050047
48/* Pointer to the PIXIS register set */
49#define pixis ((ngpixis_t *)PIXIS_BASE)
50
51/* The PIXIS SW register that corresponds to board switch X, where x >= 1 */
52#define PIXIS_SW(x) (pixis->s[(x) - 1].sw)
53
54/* The PIXIS EN register that corresponds to board switch X, where x >= 1 */
55#define PIXIS_EN(x) (pixis->s[(x) - 1].en)
Timur Tabi746e2f32011-01-21 16:03:57 -060056
57u8 pixis_read(unsigned int reg);
58void pixis_write(unsigned int reg, u8 value);
59
60#define PIXIS_READ(reg) pixis_read(offsetof(ngpixis_t, reg))
61#define PIXIS_WRITE(reg, value) pixis_write(offsetof(ngpixis_t, reg), value)