Timur Tabi | 4f332d2 | 2010-04-01 10:49:42 -0500 | [diff] [blame] | 1 | /** |
Timur Tabi | 746e2f3 | 2011-01-21 16:03:57 -0600 | [diff] [blame] | 2 | * Copyright 2010-2011 Freescale Semiconductor |
Timur Tabi | 4f332d2 | 2010-04-01 10:49:42 -0500 | [diff] [blame] | 3 | * Author: Timur Tabi <timur@freescale.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License as published by the Free |
| 7 | * Software Foundation; either version 2 of the License, or (at your option) |
| 8 | * any later version. |
| 9 | * |
| 10 | * This file provides support for the ngPIXIS, a board-specific FPGA used on |
| 11 | * some Freescale reference boards. |
| 12 | */ |
| 13 | |
| 14 | /* ngPIXIS register set. Hopefully, this won't change too much over time. |
| 15 | * Feel free to add board-specific #ifdefs where necessary. |
| 16 | */ |
| 17 | typedef struct ngpixis { |
| 18 | u8 id; |
| 19 | u8 arch; |
| 20 | u8 scver; |
| 21 | u8 csr; |
| 22 | u8 rst; |
Kumar Gala | e38209e | 2011-02-09 02:00:08 +0000 | [diff] [blame^] | 23 | u8 serclk; |
Timur Tabi | 4f332d2 | 2010-04-01 10:49:42 -0500 | [diff] [blame] | 24 | u8 aux; |
| 25 | u8 spd; |
| 26 | u8 brdcfg0; |
Timur Tabi | 0007236 | 2010-05-20 11:16:16 -0500 | [diff] [blame] | 27 | u8 brdcfg1; /* On some boards, this register is called 'dma' */ |
Timur Tabi | 4f332d2 | 2010-04-01 10:49:42 -0500 | [diff] [blame] | 28 | u8 addr; |
Kumar Gala | e38209e | 2011-02-09 02:00:08 +0000 | [diff] [blame^] | 29 | u8 brdcfg2; |
| 30 | u8 gpiodir; |
Timur Tabi | 4f332d2 | 2010-04-01 10:49:42 -0500 | [diff] [blame] | 31 | u8 data; |
| 32 | u8 led; |
Kumar Gala | e38209e | 2011-02-09 02:00:08 +0000 | [diff] [blame^] | 33 | u8 tag; |
Timur Tabi | 4f332d2 | 2010-04-01 10:49:42 -0500 | [diff] [blame] | 34 | u8 vctl; |
| 35 | u8 vstat; |
| 36 | u8 vcfgen0; |
| 37 | u8 res4; |
| 38 | u8 ocmcsr; |
| 39 | u8 ocmmsg; |
| 40 | u8 gmdbg; |
| 41 | u8 res5[2]; |
| 42 | u8 sclk[3]; |
| 43 | u8 dclk[3]; |
| 44 | u8 watch; |
| 45 | struct { |
| 46 | u8 sw; |
| 47 | u8 en; |
| 48 | } s[8]; |
Kumar Gala | f2f5d7b | 2010-05-22 17:25:47 -0500 | [diff] [blame] | 49 | } __attribute__ ((packed)) ngpixis_t; |
Timur Tabi | 4f332d2 | 2010-04-01 10:49:42 -0500 | [diff] [blame] | 50 | |
| 51 | /* Pointer to the PIXIS register set */ |
| 52 | #define pixis ((ngpixis_t *)PIXIS_BASE) |
| 53 | |
| 54 | /* The PIXIS SW register that corresponds to board switch X, where x >= 1 */ |
| 55 | #define PIXIS_SW(x) (pixis->s[(x) - 1].sw) |
| 56 | |
| 57 | /* The PIXIS EN register that corresponds to board switch X, where x >= 1 */ |
| 58 | #define PIXIS_EN(x) (pixis->s[(x) - 1].en) |
Timur Tabi | 746e2f3 | 2011-01-21 16:03:57 -0600 | [diff] [blame] | 59 | |
| 60 | u8 pixis_read(unsigned int reg); |
| 61 | void pixis_write(unsigned int reg, u8 value); |
| 62 | |
| 63 | #define PIXIS_READ(reg) pixis_read(offsetof(ngpixis_t, reg)) |
| 64 | #define PIXIS_WRITE(reg, value) pixis_write(offsetof(ngpixis_t, reg), value) |