ralink_regs.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Ralink SoC register definitions
  3. *
  4. * Copyright (C) 2013 John Crispin <john@phrozen.org>
  5. * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
  6. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License version 2 as published
  10. * by the Free Software Foundation.
  11. */
  12. #ifndef _RALINK_REGS_H_
  13. #define _RALINK_REGS_H_
  14. enum ralink_soc_type {
  15. RALINK_UNKNOWN = 0,
  16. RT2880_SOC,
  17. RT3883_SOC,
  18. RT305X_SOC_RT3050,
  19. RT305X_SOC_RT3052,
  20. RT305X_SOC_RT3350,
  21. RT305X_SOC_RT3352,
  22. RT305X_SOC_RT5350,
  23. MT762X_SOC_MT7620A,
  24. MT762X_SOC_MT7620N,
  25. MT762X_SOC_MT7621AT,
  26. MT762X_SOC_MT7628AN,
  27. MT762X_SOC_MT7688,
  28. };
  29. extern enum ralink_soc_type ralink_soc;
  30. extern __iomem void *rt_sysc_membase;
  31. extern __iomem void *rt_memc_membase;
  32. static inline void rt_sysc_w32(u32 val, unsigned reg)
  33. {
  34. __raw_writel(val, rt_sysc_membase + reg);
  35. }
  36. static inline u32 rt_sysc_r32(unsigned reg)
  37. {
  38. return __raw_readl(rt_sysc_membase + reg);
  39. }
  40. static inline void rt_sysc_m32(u32 clr, u32 set, unsigned reg)
  41. {
  42. u32 val = rt_sysc_r32(reg) & ~clr;
  43. __raw_writel(val | set, rt_sysc_membase + reg);
  44. }
  45. static inline void rt_memc_w32(u32 val, unsigned reg)
  46. {
  47. __raw_writel(val, rt_memc_membase + reg);
  48. }
  49. static inline u32 rt_memc_r32(unsigned reg)
  50. {
  51. return __raw_readl(rt_memc_membase + reg);
  52. }
  53. #endif /* _RALINK_REGS_H_ */