mt7620.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * This program is free software; you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License version 2 as published
  4. * by the Free Software Foundation.
  5. *
  6. * Parts of this file are based on Ralink's 2.6.21 BSP
  7. *
  8. * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
  9. * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
  10. * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
  11. */
  12. #ifndef _MT7620_REGS_H_
  13. #define _MT7620_REGS_H_
  14. #define MT7620_SYSC_BASE 0x10000000
  15. #define SYSC_REG_CHIP_NAME0 0x00
  16. #define SYSC_REG_CHIP_NAME1 0x04
  17. #define SYSC_REG_CHIP_REV 0x0c
  18. #define SYSC_REG_SYSTEM_CONFIG0 0x10
  19. #define SYSC_REG_SYSTEM_CONFIG1 0x14
  20. #define SYSC_REG_CPLL_CONFIG0 0x54
  21. #define SYSC_REG_CPLL_CONFIG1 0x58
  22. #define MT7620N_CHIP_NAME0 0x33365452
  23. #define MT7620N_CHIP_NAME1 0x20203235
  24. #define MT7620A_CHIP_NAME0 0x3637544d
  25. #define MT7620A_CHIP_NAME1 0x20203032
  26. #define CHIP_REV_PKG_MASK 0x1
  27. #define CHIP_REV_PKG_SHIFT 16
  28. #define CHIP_REV_VER_MASK 0xf
  29. #define CHIP_REV_VER_SHIFT 8
  30. #define CHIP_REV_ECO_MASK 0xf
  31. #define CPLL_SW_CONFIG_SHIFT 31
  32. #define CPLL_SW_CONFIG_MASK 0x1
  33. #define CPLL_CPU_CLK_SHIFT 24
  34. #define CPLL_CPU_CLK_MASK 0x1
  35. #define CPLL_MULT_RATIO_SHIFT 16
  36. #define CPLL_MULT_RATIO 0x7
  37. #define CPLL_DIV_RATIO_SHIFT 10
  38. #define CPLL_DIV_RATIO 0x3
  39. #define SYSCFG0_DRAM_TYPE_MASK 0x3
  40. #define SYSCFG0_DRAM_TYPE_SHIFT 4
  41. #define SYSCFG0_DRAM_TYPE_SDRAM 0
  42. #define SYSCFG0_DRAM_TYPE_DDR1 1
  43. #define SYSCFG0_DRAM_TYPE_DDR2 2
  44. #define MT7620_DRAM_BASE 0x0
  45. #define MT7620_SDRAM_SIZE_MIN 2
  46. #define MT7620_SDRAM_SIZE_MAX 64
  47. #define MT7620_DDR1_SIZE_MIN 32
  48. #define MT7620_DDR1_SIZE_MAX 128
  49. #define MT7620_DDR2_SIZE_MIN 32
  50. #define MT7620_DDR2_SIZE_MAX 256
  51. #define MT7620_GPIO_MODE_I2C BIT(0)
  52. #define MT7620_GPIO_MODE_UART0_SHIFT 2
  53. #define MT7620_GPIO_MODE_UART0_MASK 0x7
  54. #define MT7620_GPIO_MODE_UART0(x) ((x) << MT7620_GPIO_MODE_UART0_SHIFT)
  55. #define MT7620_GPIO_MODE_UARTF 0x0
  56. #define MT7620_GPIO_MODE_PCM_UARTF 0x1
  57. #define MT7620_GPIO_MODE_PCM_I2S 0x2
  58. #define MT7620_GPIO_MODE_I2S_UARTF 0x3
  59. #define MT7620_GPIO_MODE_PCM_GPIO 0x4
  60. #define MT7620_GPIO_MODE_GPIO_UARTF 0x5
  61. #define MT7620_GPIO_MODE_GPIO_I2S 0x6
  62. #define MT7620_GPIO_MODE_GPIO 0x7
  63. #define MT7620_GPIO_MODE_UART1 BIT(5)
  64. #define MT7620_GPIO_MODE_MDIO BIT(8)
  65. #define MT7620_GPIO_MODE_RGMII1 BIT(9)
  66. #define MT7620_GPIO_MODE_RGMII2 BIT(10)
  67. #define MT7620_GPIO_MODE_SPI BIT(11)
  68. #define MT7620_GPIO_MODE_SPI_REF_CLK BIT(12)
  69. #define MT7620_GPIO_MODE_WLED BIT(13)
  70. #define MT7620_GPIO_MODE_JTAG BIT(15)
  71. #define MT7620_GPIO_MODE_EPHY BIT(15)
  72. #define MT7620_GPIO_MODE_WDT BIT(22)
  73. #endif