ftahbc020s.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (C) 2011 Andes Technology Corporation
  3. * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. /* FTAHBC020S - AHB Controller (Arbiter/Decoder) definitions */
  20. #ifndef __FTAHBC020S_H
  21. #define __FTAHBC202S_H
  22. /* Registers Offsets */
  23. /*
  24. * AHB Slave BSR, offset: n * 4, n=0~31
  25. */
  26. #ifndef __ASSEMBLY__
  27. struct ftahbc02s {
  28. unsigned int s_bsr[32]; /* 0x00-0x7c - Slave n Base/Size Reg */
  29. unsigned int pcr; /* 0x80 - Priority Ctrl Reg */
  30. unsigned int tcrg; /* 0x84 - Transfer Ctrl Reg */
  31. unsigned int cr; /* 0x88 - Ctrl Reg */
  32. };
  33. #endif /* __ASSEMBLY__ */
  34. /*
  35. * FTAHBC020S_SLAVE_BSR - Slave n Base / Size Register
  36. */
  37. #define FTAHBC020S_SLAVE_BSR_BASE(x) (((x) & 0xfff) << 20)
  38. #define FTAHBC020S_SLAVE_BSR_SIZE(x) (((x) & 0xf) << 16)
  39. /* The value of b(16:19)SLAVE_BSR_SIZE: 1M-2048M, must be power of 2 */
  40. #define FTAHBC020S_BSR_SIZE(x) (ffs(x) - 1) /* size of Addr Space */
  41. /*
  42. * FTAHBC020S_PCR - Priority Control Register
  43. */
  44. #define FTAHBC020S_PCR_PLEVEL_(x) (1 << (x)) /* x: 1-15 */
  45. /*
  46. * FTAHBC020S_CR - Interrupt Control Register
  47. */
  48. #define FTAHBC020S_CR_INTSTS (1 << 24)
  49. #define FTAHBC020S_CR_RESP(x) (((x) & 0x3) << 20)
  50. #define FTAHBC020S_CR_INTSMASK (1 << 16)
  51. #define FTAHBC020S_CR_REMAP (1 << 0)
  52. #endif /* __FTAHBC020S_H */