mcu.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
  3. * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
  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 version 2
  7. * as published by the Free Software Foundation
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef __MT7601U_MCU_H
  15. #define __MT7601U_MCU_H
  16. struct mt7601u_dev;
  17. /* Register definitions */
  18. #define MT_MCU_RESET_CTL 0x070C
  19. #define MT_MCU_INT_LEVEL 0x0718
  20. #define MT_MCU_COM_REG0 0x0730
  21. #define MT_MCU_COM_REG1 0x0734
  22. #define MT_MCU_COM_REG2 0x0738
  23. #define MT_MCU_COM_REG3 0x073C
  24. #define MT_MCU_IVB_SIZE 0x40
  25. #define MT_MCU_DLM_OFFSET 0x80000
  26. #define MT_MCU_MEMMAP_WLAN 0x00410000
  27. #define MT_MCU_MEMMAP_BBP 0x40000000
  28. #define MT_MCU_MEMMAP_RF 0x80000000
  29. #define INBAND_PACKET_MAX_LEN 192
  30. enum mcu_cmd {
  31. CMD_FUN_SET_OP = 1,
  32. CMD_LOAD_CR = 2,
  33. CMD_INIT_GAIN_OP = 3,
  34. CMD_DYNC_VGA_OP = 6,
  35. CMD_TDLS_CH_SW = 7,
  36. CMD_BURST_WRITE = 8,
  37. CMD_READ_MODIFY_WRITE = 9,
  38. CMD_RANDOM_READ = 10,
  39. CMD_BURST_READ = 11,
  40. CMD_RANDOM_WRITE = 12,
  41. CMD_LED_MODE_OP = 16,
  42. CMD_POWER_SAVING_OP = 20,
  43. CMD_WOW_CONFIG = 21,
  44. CMD_WOW_QUERY = 22,
  45. CMD_WOW_FEATURE = 24,
  46. CMD_CARRIER_DETECT_OP = 28,
  47. CMD_RADOR_DETECT_OP = 29,
  48. CMD_SWITCH_CHANNEL_OP = 30,
  49. CMD_CALIBRATION_OP = 31,
  50. CMD_BEACON_OP = 32,
  51. CMD_ANTENNA_OP = 33,
  52. };
  53. enum mcu_function {
  54. Q_SELECT = 1,
  55. ATOMIC_TSSI_SETTING = 5,
  56. };
  57. enum mcu_power_mode {
  58. RADIO_OFF = 0x30,
  59. RADIO_ON = 0x31,
  60. RADIO_OFF_AUTO_WAKEUP = 0x32,
  61. RADIO_OFF_ADVANCE = 0x33,
  62. RADIO_ON_ADVANCE = 0x34,
  63. };
  64. enum mcu_calibrate {
  65. MCU_CAL_R = 1,
  66. MCU_CAL_DCOC,
  67. MCU_CAL_LC,
  68. MCU_CAL_LOFT,
  69. MCU_CAL_TXIQ,
  70. MCU_CAL_BW,
  71. MCU_CAL_DPD,
  72. MCU_CAL_RXIQ,
  73. MCU_CAL_TXDCOC,
  74. };
  75. int mt7601u_mcu_init(struct mt7601u_dev *dev);
  76. int mt7601u_mcu_cmd_init(struct mt7601u_dev *dev);
  77. void mt7601u_mcu_cmd_deinit(struct mt7601u_dev *dev);
  78. int
  79. mt7601u_mcu_calibrate(struct mt7601u_dev *dev, enum mcu_calibrate cal, u32 val);
  80. int mt7601u_mcu_tssi_read_kick(struct mt7601u_dev *dev, int use_hvga);
  81. #endif