rtl8411.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. /* Driver for Realtek PCI-Express card reader
  2. *
  3. * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2, or (at your option) any
  8. * later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * Author:
  19. * Wei WANG <wei_wang@realsil.com.cn>
  20. * Roger Tseng <rogerable@realtek.com>
  21. */
  22. #include <linux/module.h>
  23. #include <linux/bitops.h>
  24. #include <linux/delay.h>
  25. #include <linux/mfd/rtsx_pci.h>
  26. #include "rtsx_pcr.h"
  27. static u8 rtl8411_get_ic_version(struct rtsx_pcr *pcr)
  28. {
  29. u8 val;
  30. rtsx_pci_read_register(pcr, SYS_VER, &val);
  31. return val & 0x0F;
  32. }
  33. static int rtl8411b_is_qfn48(struct rtsx_pcr *pcr)
  34. {
  35. u8 val = 0;
  36. rtsx_pci_read_register(pcr, RTL8411B_PACKAGE_MODE, &val);
  37. if (val & 0x2)
  38. return 1;
  39. else
  40. return 0;
  41. }
  42. static void rtl8411_fetch_vendor_settings(struct rtsx_pcr *pcr)
  43. {
  44. u32 reg1 = 0;
  45. u8 reg3 = 0;
  46. rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg1);
  47. pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg1);
  48. if (!rtsx_vendor_setting_valid(reg1))
  49. return;
  50. pcr->aspm_en = rtsx_reg_to_aspm(reg1);
  51. pcr->sd30_drive_sel_1v8 =
  52. map_sd_drive(rtsx_reg_to_sd30_drive_sel_1v8(reg1));
  53. pcr->card_drive_sel &= 0x3F;
  54. pcr->card_drive_sel |= rtsx_reg_to_card_drive_sel(reg1);
  55. rtsx_pci_read_config_byte(pcr, PCR_SETTING_REG3, &reg3);
  56. pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG3, reg3);
  57. pcr->sd30_drive_sel_3v3 = rtl8411_reg_to_sd30_drive_sel_3v3(reg3);
  58. }
  59. static void rtl8411b_fetch_vendor_settings(struct rtsx_pcr *pcr)
  60. {
  61. u32 reg = 0;
  62. rtsx_pci_read_config_dword(pcr, PCR_SETTING_REG1, &reg);
  63. pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", PCR_SETTING_REG1, reg);
  64. if (!rtsx_vendor_setting_valid(reg))
  65. return;
  66. pcr->aspm_en = rtsx_reg_to_aspm(reg);
  67. pcr->sd30_drive_sel_1v8 =
  68. map_sd_drive(rtsx_reg_to_sd30_drive_sel_1v8(reg));
  69. pcr->sd30_drive_sel_3v3 =
  70. map_sd_drive(rtl8411b_reg_to_sd30_drive_sel_3v3(reg));
  71. }
  72. static void rtl8411_force_power_down(struct rtsx_pcr *pcr, u8 pm_state)
  73. {
  74. rtsx_pci_write_register(pcr, FPDCTL, 0x07, 0x07);
  75. }
  76. static int rtl8411_extra_init_hw(struct rtsx_pcr *pcr)
  77. {
  78. rtsx_pci_init_cmd(pcr);
  79. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DRIVE_SEL,
  80. 0xFF, pcr->sd30_drive_sel_3v3);
  81. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CD_PAD_CTL,
  82. CD_DISABLE_MASK | CD_AUTO_DISABLE, CD_ENABLE);
  83. return rtsx_pci_send_cmd(pcr, 100);
  84. }
  85. static int rtl8411b_extra_init_hw(struct rtsx_pcr *pcr)
  86. {
  87. rtsx_pci_init_cmd(pcr);
  88. if (rtl8411b_is_qfn48(pcr))
  89. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD,
  90. CARD_PULL_CTL3, 0xFF, 0xF5);
  91. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SD30_DRIVE_SEL,
  92. 0xFF, pcr->sd30_drive_sel_3v3);
  93. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CD_PAD_CTL,
  94. CD_DISABLE_MASK | CD_AUTO_DISABLE, CD_ENABLE);
  95. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, FUNC_FORCE_CTL,
  96. 0x06, 0x00);
  97. return rtsx_pci_send_cmd(pcr, 100);
  98. }
  99. static int rtl8411_turn_on_led(struct rtsx_pcr *pcr)
  100. {
  101. return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x00);
  102. }
  103. static int rtl8411_turn_off_led(struct rtsx_pcr *pcr)
  104. {
  105. return rtsx_pci_write_register(pcr, CARD_GPIO, 0x01, 0x01);
  106. }
  107. static int rtl8411_enable_auto_blink(struct rtsx_pcr *pcr)
  108. {
  109. return rtsx_pci_write_register(pcr, CARD_AUTO_BLINK, 0xFF, 0x0D);
  110. }
  111. static int rtl8411_disable_auto_blink(struct rtsx_pcr *pcr)
  112. {
  113. return rtsx_pci_write_register(pcr, CARD_AUTO_BLINK, 0x08, 0x00);
  114. }
  115. static int rtl8411_card_power_on(struct rtsx_pcr *pcr, int card)
  116. {
  117. int err;
  118. rtsx_pci_init_cmd(pcr);
  119. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, CARD_PWR_CTL,
  120. BPP_POWER_MASK, BPP_POWER_5_PERCENT_ON);
  121. rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, LDO_CTL,
  122. BPP_LDO_POWB, BPP_LDO_SUSPEND);
  123. err = rtsx_pci_send_cmd(pcr, 100);
  124. if (err < 0)
  125. return err;
  126. /* To avoid too large in-rush current */
  127. udelay(150);
  128. err = rtsx_pci_write_register(pcr, CARD_PWR_CTL,
  129. BPP_POWER_MASK, BPP_POWER_10_PERCENT_ON);
  130. if (err < 0)
  131. return err;
  132. udelay(150);
  133. err = rtsx_pci_write_register(pcr, CARD_PWR_CTL,
  134. BPP_POWER_MASK, BPP_POWER_15_PERCENT_ON);
  135. if (err < 0)
  136. return err;
  137. udelay(150);
  138. err = rtsx_pci_write_register(pcr, CARD_PWR_CTL,
  139. BPP_POWER_MASK, BPP_POWER_ON);
  140. if (err < 0)
  141. return err;
  142. return rtsx_pci_write_register(pcr, LDO_CTL, BPP_LDO_POWB, BPP_LDO_ON);
  143. }
  144. static int rtl8411_card_power_off(struct rtsx_pcr *pcr, int card)
  145. {
  146. int err;
  147. err = rtsx_pci_write_register(pcr, CARD_PWR_CTL,
  148. BPP_POWER_MASK, BPP_POWER_OFF);
  149. if (err < 0)
  150. return err;
  151. return rtsx_pci_write_register(pcr, LDO_CTL,
  152. BPP_LDO_POWB, BPP_LDO_SUSPEND);
  153. }
  154. static int rtl8411_do_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage,
  155. int bpp_tuned18_shift, int bpp_asic_1v8)
  156. {
  157. u8 mask, val;
  158. int err;
  159. mask = (BPP_REG_TUNED18 << bpp_tuned18_shift) | BPP_PAD_MASK;
  160. if (voltage == OUTPUT_3V3) {
  161. err = rtsx_pci_write_register(pcr,
  162. SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_3v3);
  163. if (err < 0)
  164. return err;
  165. val = (BPP_ASIC_3V3 << bpp_tuned18_shift) | BPP_PAD_3V3;
  166. } else if (voltage == OUTPUT_1V8) {
  167. err = rtsx_pci_write_register(pcr,
  168. SD30_DRIVE_SEL, 0x07, pcr->sd30_drive_sel_1v8);
  169. if (err < 0)
  170. return err;
  171. val = (bpp_asic_1v8 << bpp_tuned18_shift) | BPP_PAD_1V8;
  172. } else {
  173. return -EINVAL;
  174. }
  175. return rtsx_pci_write_register(pcr, LDO_CTL, mask, val);
  176. }
  177. static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
  178. {
  179. return rtl8411_do_switch_output_voltage(pcr, voltage,
  180. BPP_TUNED18_SHIFT_8411, BPP_ASIC_1V8);
  181. }
  182. static int rtl8402_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage)
  183. {
  184. return rtl8411_do_switch_output_voltage(pcr, voltage,
  185. BPP_TUNED18_SHIFT_8402, BPP_ASIC_2V0);
  186. }
  187. static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr)
  188. {
  189. unsigned int card_exist;
  190. card_exist = rtsx_pci_readl(pcr, RTSX_BIPR);
  191. card_exist &= CARD_EXIST;
  192. if (!card_exist) {
  193. /* Enable card CD */
  194. rtsx_pci_write_register(pcr, CD_PAD_CTL,
  195. CD_DISABLE_MASK, CD_ENABLE);
  196. /* Enable card interrupt */
  197. rtsx_pci_write_register(pcr, EFUSE_CONTENT, 0xe0, 0x00);
  198. return 0;
  199. }
  200. if (hweight32(card_exist) > 1) {
  201. rtsx_pci_write_register(pcr, CARD_PWR_CTL,
  202. BPP_POWER_MASK, BPP_POWER_5_PERCENT_ON);
  203. msleep(100);
  204. card_exist = rtsx_pci_readl(pcr, RTSX_BIPR);
  205. if (card_exist & MS_EXIST)
  206. card_exist = MS_EXIST;
  207. else if (card_exist & SD_EXIST)
  208. card_exist = SD_EXIST;
  209. else
  210. card_exist = 0;
  211. rtsx_pci_write_register(pcr, CARD_PWR_CTL,
  212. BPP_POWER_MASK, BPP_POWER_OFF);
  213. pcr_dbg(pcr, "After CD deglitch, card_exist = 0x%x\n",
  214. card_exist);
  215. }
  216. if (card_exist & MS_EXIST) {
  217. /* Disable SD interrupt */
  218. rtsx_pci_write_register(pcr, EFUSE_CONTENT, 0xe0, 0x40);
  219. rtsx_pci_write_register(pcr, CD_PAD_CTL,
  220. CD_DISABLE_MASK, MS_CD_EN_ONLY);
  221. } else if (card_exist & SD_EXIST) {
  222. /* Disable MS interrupt */
  223. rtsx_pci_write_register(pcr, EFUSE_CONTENT, 0xe0, 0x80);
  224. rtsx_pci_write_register(pcr, CD_PAD_CTL,
  225. CD_DISABLE_MASK, SD_CD_EN_ONLY);
  226. }
  227. return card_exist;
  228. }
  229. static int rtl8411_conv_clk_and_div_n(int input, int dir)
  230. {
  231. int output;
  232. if (dir == CLK_TO_DIV_N)
  233. output = input * 4 / 5 - 2;
  234. else
  235. output = (input + 2) * 5 / 4;
  236. return output;
  237. }
  238. static const struct pcr_ops rtl8411_pcr_ops = {
  239. .fetch_vendor_settings = rtl8411_fetch_vendor_settings,
  240. .extra_init_hw = rtl8411_extra_init_hw,
  241. .optimize_phy = NULL,
  242. .turn_on_led = rtl8411_turn_on_led,
  243. .turn_off_led = rtl8411_turn_off_led,
  244. .enable_auto_blink = rtl8411_enable_auto_blink,
  245. .disable_auto_blink = rtl8411_disable_auto_blink,
  246. .card_power_on = rtl8411_card_power_on,
  247. .card_power_off = rtl8411_card_power_off,
  248. .switch_output_voltage = rtl8411_switch_output_voltage,
  249. .cd_deglitch = rtl8411_cd_deglitch,
  250. .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n,
  251. .force_power_down = rtl8411_force_power_down,
  252. };
  253. static const struct pcr_ops rtl8402_pcr_ops = {
  254. .fetch_vendor_settings = rtl8411_fetch_vendor_settings,
  255. .extra_init_hw = rtl8411_extra_init_hw,
  256. .optimize_phy = NULL,
  257. .turn_on_led = rtl8411_turn_on_led,
  258. .turn_off_led = rtl8411_turn_off_led,
  259. .enable_auto_blink = rtl8411_enable_auto_blink,
  260. .disable_auto_blink = rtl8411_disable_auto_blink,
  261. .card_power_on = rtl8411_card_power_on,
  262. .card_power_off = rtl8411_card_power_off,
  263. .switch_output_voltage = rtl8402_switch_output_voltage,
  264. .cd_deglitch = rtl8411_cd_deglitch,
  265. .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n,
  266. .force_power_down = rtl8411_force_power_down,
  267. };
  268. static const struct pcr_ops rtl8411b_pcr_ops = {
  269. .fetch_vendor_settings = rtl8411b_fetch_vendor_settings,
  270. .extra_init_hw = rtl8411b_extra_init_hw,
  271. .optimize_phy = NULL,
  272. .turn_on_led = rtl8411_turn_on_led,
  273. .turn_off_led = rtl8411_turn_off_led,
  274. .enable_auto_blink = rtl8411_enable_auto_blink,
  275. .disable_auto_blink = rtl8411_disable_auto_blink,
  276. .card_power_on = rtl8411_card_power_on,
  277. .card_power_off = rtl8411_card_power_off,
  278. .switch_output_voltage = rtl8411_switch_output_voltage,
  279. .cd_deglitch = rtl8411_cd_deglitch,
  280. .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n,
  281. .force_power_down = rtl8411_force_power_down,
  282. };
  283. /* SD Pull Control Enable:
  284. * SD_DAT[3:0] ==> pull up
  285. * SD_CD ==> pull up
  286. * SD_WP ==> pull up
  287. * SD_CMD ==> pull up
  288. * SD_CLK ==> pull down
  289. */
  290. static const u32 rtl8411_sd_pull_ctl_enable_tbl[] = {
  291. RTSX_REG_PAIR(CARD_PULL_CTL1, 0xAA),
  292. RTSX_REG_PAIR(CARD_PULL_CTL2, 0xAA),
  293. RTSX_REG_PAIR(CARD_PULL_CTL3, 0xA9),
  294. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09),
  295. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x09),
  296. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04),
  297. 0,
  298. };
  299. /* SD Pull Control Disable:
  300. * SD_DAT[3:0] ==> pull down
  301. * SD_CD ==> pull up
  302. * SD_WP ==> pull down
  303. * SD_CMD ==> pull down
  304. * SD_CLK ==> pull down
  305. */
  306. static const u32 rtl8411_sd_pull_ctl_disable_tbl[] = {
  307. RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65),
  308. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  309. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x95),
  310. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09),
  311. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05),
  312. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04),
  313. 0,
  314. };
  315. /* MS Pull Control Enable:
  316. * MS CD ==> pull up
  317. * others ==> pull down
  318. */
  319. static const u32 rtl8411_ms_pull_ctl_enable_tbl[] = {
  320. RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65),
  321. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  322. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x95),
  323. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x05),
  324. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05),
  325. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04),
  326. 0,
  327. };
  328. /* MS Pull Control Disable:
  329. * MS CD ==> pull up
  330. * others ==> pull down
  331. */
  332. static const u32 rtl8411_ms_pull_ctl_disable_tbl[] = {
  333. RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65),
  334. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  335. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x95),
  336. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09),
  337. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05),
  338. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04),
  339. 0,
  340. };
  341. static const u32 rtl8411b_qfn64_sd_pull_ctl_enable_tbl[] = {
  342. RTSX_REG_PAIR(CARD_PULL_CTL1, 0xAA),
  343. RTSX_REG_PAIR(CARD_PULL_CTL2, 0xAA),
  344. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x09 | 0xD0),
  345. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09 | 0x50),
  346. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50),
  347. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11),
  348. 0,
  349. };
  350. static const u32 rtl8411b_qfn48_sd_pull_ctl_enable_tbl[] = {
  351. RTSX_REG_PAIR(CARD_PULL_CTL2, 0xAA),
  352. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x69 | 0x90),
  353. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x08 | 0x11),
  354. 0,
  355. };
  356. static const u32 rtl8411b_qfn64_sd_pull_ctl_disable_tbl[] = {
  357. RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65),
  358. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  359. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x05 | 0xD0),
  360. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09 | 0x50),
  361. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50),
  362. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11),
  363. 0,
  364. };
  365. static const u32 rtl8411b_qfn48_sd_pull_ctl_disable_tbl[] = {
  366. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  367. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x65 | 0x90),
  368. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11),
  369. 0,
  370. };
  371. static const u32 rtl8411b_qfn64_ms_pull_ctl_enable_tbl[] = {
  372. RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65),
  373. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  374. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x05 | 0xD0),
  375. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x05 | 0x50),
  376. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50),
  377. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11),
  378. 0,
  379. };
  380. static const u32 rtl8411b_qfn48_ms_pull_ctl_enable_tbl[] = {
  381. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  382. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x65 | 0x90),
  383. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11),
  384. 0,
  385. };
  386. static const u32 rtl8411b_qfn64_ms_pull_ctl_disable_tbl[] = {
  387. RTSX_REG_PAIR(CARD_PULL_CTL1, 0x65),
  388. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  389. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x05 | 0xD0),
  390. RTSX_REG_PAIR(CARD_PULL_CTL4, 0x09 | 0x50),
  391. RTSX_REG_PAIR(CARD_PULL_CTL5, 0x05 | 0x50),
  392. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11),
  393. 0,
  394. };
  395. static const u32 rtl8411b_qfn48_ms_pull_ctl_disable_tbl[] = {
  396. RTSX_REG_PAIR(CARD_PULL_CTL2, 0x55),
  397. RTSX_REG_PAIR(CARD_PULL_CTL3, 0x65 | 0x90),
  398. RTSX_REG_PAIR(CARD_PULL_CTL6, 0x04 | 0x11),
  399. 0,
  400. };
  401. static void rtl8411_init_common_params(struct rtsx_pcr *pcr)
  402. {
  403. pcr->extra_caps = EXTRA_CAPS_SD_SDR50 | EXTRA_CAPS_SD_SDR104;
  404. pcr->num_slots = 2;
  405. pcr->flags = 0;
  406. pcr->card_drive_sel = RTL8411_CARD_DRIVE_DEFAULT;
  407. pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
  408. pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
  409. pcr->aspm_en = ASPM_L1_EN;
  410. pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
  411. pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
  412. pcr->ic_version = rtl8411_get_ic_version(pcr);
  413. }
  414. void rtl8411_init_params(struct rtsx_pcr *pcr)
  415. {
  416. rtl8411_init_common_params(pcr);
  417. pcr->ops = &rtl8411_pcr_ops;
  418. set_pull_ctrl_tables(pcr, rtl8411);
  419. }
  420. void rtl8411b_init_params(struct rtsx_pcr *pcr)
  421. {
  422. rtl8411_init_common_params(pcr);
  423. pcr->ops = &rtl8411b_pcr_ops;
  424. if (rtl8411b_is_qfn48(pcr))
  425. set_pull_ctrl_tables(pcr, rtl8411b_qfn48);
  426. else
  427. set_pull_ctrl_tables(pcr, rtl8411b_qfn64);
  428. }
  429. void rtl8402_init_params(struct rtsx_pcr *pcr)
  430. {
  431. rtl8411_init_common_params(pcr);
  432. pcr->ops = &rtl8402_pcr_ops;
  433. set_pull_ctrl_tables(pcr, rtl8411);
  434. }