ngpixis.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /**
  3. * Copyright 2010-2011 Freescale Semiconductor
  4. * Author: Timur Tabi <timur@freescale.com>
  5. *
  6. * This file provides support for the ngPIXIS, a board-specific FPGA used on
  7. * some Freescale reference boards.
  8. */
  9. /* ngPIXIS register set. Hopefully, this won't change too much over time.
  10. * Feel free to add board-specific #ifdefs where necessary.
  11. */
  12. typedef struct ngpixis {
  13. u8 id;
  14. u8 arch;
  15. u8 scver;
  16. u8 csr;
  17. u8 rst;
  18. u8 serclk;
  19. u8 aux;
  20. u8 spd;
  21. u8 brdcfg0;
  22. u8 brdcfg1; /* On some boards, this register is called 'dma' */
  23. u8 addr;
  24. u8 brdcfg2;
  25. u8 gpiodir;
  26. u8 data;
  27. u8 led;
  28. u8 tag;
  29. u8 vctl;
  30. u8 vstat;
  31. u8 vcfgen0;
  32. u8 res4;
  33. u8 ocmcsr;
  34. u8 ocmmsg;
  35. u8 gmdbg;
  36. u8 res5[2];
  37. u8 sclk[3];
  38. u8 dclk[3];
  39. u8 watch;
  40. struct {
  41. u8 sw;
  42. u8 en;
  43. } s[9]; /* s[0]..s[7] is SW1..SW8, and s[8] is SW11 */
  44. } __attribute__ ((packed)) ngpixis_t;
  45. /* Pointer to the PIXIS register set */
  46. #define pixis ((ngpixis_t *)PIXIS_BASE)
  47. /* The PIXIS SW register that corresponds to board switch X, where x >= 1 */
  48. #define PIXIS_SW(x) (pixis->s[(x) - 1].sw)
  49. /* The PIXIS EN register that corresponds to board switch X, where x >= 1 */
  50. #define PIXIS_EN(x) (pixis->s[(x) - 1].en)
  51. u8 pixis_read(unsigned int reg);
  52. void pixis_write(unsigned int reg, u8 value);
  53. #define PIXIS_READ(reg) pixis_read(offsetof(ngpixis_t, reg))
  54. #define PIXIS_WRITE(reg, value) pixis_write(offsetof(ngpixis_t, reg), value)