halmac_pwr_seq_cmd.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2016 - 2018 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. ******************************************************************************/
  15. #ifndef HALMAC_POWER_SEQUENCE_CMD
  16. #define HALMAC_POWER_SEQUENCE_CMD
  17. #include "halmac_2_platform.h"
  18. #define HALMAC_PWR_POLLING_CNT 20000
  19. /* The value of cmd : 4 bits */
  20. /* offset : the read register offset
  21. * msk : the mask of the read value
  22. * value : N/A, left by 0
  23. * Note : dirver shall implement this function by read & msk
  24. */
  25. #define HALMAC_PWR_CMD_READ 0x00
  26. /* offset: the read register offset
  27. * msk: the mask of the write bits
  28. * value: write value
  29. * Note: driver shall implement this cmd by read & msk after write
  30. */
  31. #define HALMAC_PWR_CMD_WRITE 0x01
  32. /* offset: the read register offset
  33. * msk: the mask of the polled value
  34. * value: the value to be polled, masked by the msd field.
  35. * Note: driver shall implement this cmd by
  36. * do{
  37. * if( (Read(offset) & msk) == (value & msk) )
  38. * break;
  39. * } while(not timeout);
  40. */
  41. #define HALMAC_PWR_CMD_POLLING 0x02
  42. /* offset: the value to delay
  43. * msk: N/A
  44. * value: the unit of delay, 0: us, 1: ms
  45. */
  46. #define HALMAC_PWR_CMD_DELAY 0x03
  47. /* offset: N/A
  48. * msk: N/A
  49. * value: N/A
  50. */
  51. #define HALMAC_PWR_CMD_END 0x04
  52. /* The value of base : 4 bits */
  53. /* define the base address of each block */
  54. #define HALMAC_PWR_ADDR_MAC 0x00
  55. #define HALMAC_PWR_ADDR_USB 0x01
  56. #define HALMAC_PWR_ADDR_PCIE 0x02
  57. #define HALMAC_PWR_ADDR_SDIO 0x03
  58. /* The value of interface_msk : 4 bits */
  59. #define HALMAC_PWR_INTF_SDIO_MSK BIT(0)
  60. #define HALMAC_PWR_INTF_USB_MSK BIT(1)
  61. #define HALMAC_PWR_INTF_PCI_MSK BIT(2)
  62. #define HALMAC_PWR_INTF_ALL_MSK (BIT(0) | BIT(1) | BIT(2) | BIT(3))
  63. /* The value of cut_msk : 8 bits */
  64. #define HALMAC_PWR_CUT_TESTCHIP_MSK BIT(0)
  65. #define HALMAC_PWR_CUT_A_MSK BIT(1)
  66. #define HALMAC_PWR_CUT_B_MSK BIT(2)
  67. #define HALMAC_PWR_CUT_C_MSK BIT(3)
  68. #define HALMAC_PWR_CUT_D_MSK BIT(4)
  69. #define HALMAC_PWR_CUT_E_MSK BIT(5)
  70. #define HALMAC_PWR_CUT_F_MSK BIT(6)
  71. #define HALMAC_PWR_CUT_G_MSK BIT(7)
  72. #define HALMAC_PWR_CUT_ALL_MSK 0xFF
  73. enum halmac_pwrseq_cmd_delay_unit {
  74. HALMAC_PWR_DELAY_US,
  75. HALMAC_PWR_DELAY_MS,
  76. };
  77. struct halmac_wlan_pwr_cfg {
  78. u16 offset;
  79. u8 cut_msk;
  80. u8 interface_msk;
  81. u8 base:4;
  82. u8 cmd:4;
  83. u8 msk;
  84. u8 value;
  85. };
  86. #endif