microchip_t1s.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Driver for Microchip 10BASE-T1S PHYs
  4. *
  5. * Support: Microchip Phys:
  6. * lan8670/1/2 Rev.B1/C1/C2/D0
  7. * lan8650/1 Rev.B0/B1 Internal PHYs
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/module.h>
  11. #include <linux/phy.h>
  12. #define PHY_ID_LAN867X_REVB1 0x0007C162
  13. #define PHY_ID_LAN867X_REVC1 0x0007C164
  14. #define PHY_ID_LAN867X_REVC2 0x0007C165
  15. #define PHY_ID_LAN867X_REVD0 0x0007C166
  16. /* Both Rev.B0 and B1 clause 22 PHYID's are same due to B1 chip limitation */
  17. #define PHY_ID_LAN865X_REVB 0x0007C1B3
  18. #define LAN867X_REG_STS2 0x0019
  19. #define LAN867x_RESET_COMPLETE_STS BIT(11)
  20. #define LAN865X_REG_CFGPARAM_ADDR 0x00D8
  21. #define LAN865X_REG_CFGPARAM_DATA 0x00D9
  22. #define LAN865X_REG_CFGPARAM_CTRL 0x00DA
  23. #define LAN865X_REG_STS2 0x0019
  24. /* Collision Detector Control 0 Register */
  25. #define LAN86XX_REG_COL_DET_CTRL0 0x0087
  26. #define COL_DET_CTRL0_ENABLE_BIT_MASK BIT(15)
  27. #define COL_DET_ENABLE BIT(15)
  28. #define COL_DET_DISABLE 0x0000
  29. /* LAN8670/1/2 Rev.D0 Link Status Selection Register */
  30. #define LAN867X_REG_LINK_STATUS_CTRL 0x0012
  31. #define LINK_STATUS_CONFIGURATION GENMASK(12, 11)
  32. #define LINK_STATUS_SEMAPHORE BIT(0)
  33. /* Link Status Configuration */
  34. #define LINK_STATUS_CONFIG_PLCA_STATUS 0x1
  35. #define LINK_STATUS_CONFIG_SEMAPHORE 0x2
  36. #define LINK_STATUS_SEMAPHORE_SET 0x1
  37. #define LAN865X_CFGPARAM_READ_ENABLE BIT(1)
  38. /* The arrays below are pulled from the following table from AN1699
  39. * Access MMD Address Value Mask
  40. * RMW 0x1F 0x00D0 0x0002 0x0E03
  41. * RMW 0x1F 0x00D1 0x0000 0x0300
  42. * RMW 0x1F 0x0084 0x3380 0xFFC0
  43. * RMW 0x1F 0x0085 0x0006 0x000F
  44. * RMW 0x1F 0x008A 0xC000 0xF800
  45. * RMW 0x1F 0x0087 0x801C 0x801C
  46. * RMW 0x1F 0x0088 0x033F 0x1FFF
  47. * W 0x1F 0x008B 0x0404 ------
  48. * RMW 0x1F 0x0080 0x0600 0x0600
  49. * RMW 0x1F 0x00F1 0x2400 0x7F00
  50. * RMW 0x1F 0x0096 0x2000 0x2000
  51. * W 0x1F 0x0099 0x7F80 ------
  52. */
  53. static const u32 lan867x_revb1_fixup_registers[12] = {
  54. 0x00D0, 0x00D1, 0x0084, 0x0085,
  55. 0x008A, 0x0087, 0x0088, 0x008B,
  56. 0x0080, 0x00F1, 0x0096, 0x0099,
  57. };
  58. static const u16 lan867x_revb1_fixup_values[12] = {
  59. 0x0002, 0x0000, 0x3380, 0x0006,
  60. 0xC000, 0x801C, 0x033F, 0x0404,
  61. 0x0600, 0x2400, 0x2000, 0x7F80,
  62. };
  63. static const u16 lan867x_revb1_fixup_masks[12] = {
  64. 0x0E03, 0x0300, 0xFFC0, 0x000F,
  65. 0xF800, 0x801C, 0x1FFF, 0xFFFF,
  66. 0x0600, 0x7F00, 0x2000, 0xFFFF,
  67. };
  68. /* LAN865x Rev.B0/B1 configuration parameters from AN1760
  69. * As per the Configuration Application Note AN1760 published in the below link,
  70. * https://www.microchip.com/en-us/application-notes/an1760
  71. * Revision F (DS60001760G - June 2024)
  72. */
  73. static const u32 lan865x_revb_fixup_registers[17] = {
  74. 0x00D0, 0x00E0, 0x00E9, 0x00F5,
  75. 0x00F4, 0x00F8, 0x00F9, 0x0081,
  76. 0x0091, 0x0043, 0x0044, 0x0045,
  77. 0x0053, 0x0054, 0x0055, 0x0040,
  78. 0x0050,
  79. };
  80. static const u16 lan865x_revb_fixup_values[17] = {
  81. 0x3F31, 0xC000, 0x9E50, 0x1CF8,
  82. 0xC020, 0xB900, 0x4E53, 0x0080,
  83. 0x9660, 0x00FF, 0xFFFF, 0x0000,
  84. 0x00FF, 0xFFFF, 0x0000, 0x0002,
  85. 0x0002,
  86. };
  87. static const u16 lan865x_revb_fixup_cfg_regs[2] = {
  88. 0x0084, 0x008A,
  89. };
  90. static const u32 lan865x_revb_sqi_fixup_regs[12] = {
  91. 0x00B0, 0x00B1, 0x00B2, 0x00B3,
  92. 0x00B4, 0x00B5, 0x00B6, 0x00B7,
  93. 0x00B8, 0x00B9, 0x00BA, 0x00BB,
  94. };
  95. static const u16 lan865x_revb_sqi_fixup_values[12] = {
  96. 0x0103, 0x0910, 0x1D26, 0x002A,
  97. 0x0103, 0x070D, 0x1720, 0x0027,
  98. 0x0509, 0x0E13, 0x1C25, 0x002B,
  99. };
  100. static const u16 lan865x_revb_sqi_fixup_cfg_regs[3] = {
  101. 0x00AD, 0x00AE, 0x00AF,
  102. };
  103. /* LAN867x Rev.D0 configuration parameters from AN1699
  104. * As per the Configuration Application Note AN1699 published in the below link,
  105. * https://www.microchip.com/en-us/application-notes/an1699
  106. * Revision G (DS60001699G - October 2025)
  107. */
  108. static const u16 lan867x_revd0_fixup_regs[8] = {
  109. 0x0037, 0x008A, 0x0118, 0x00D6,
  110. 0x0082, 0x00FD, 0x00FD, 0x0091,
  111. };
  112. static const u16 lan867x_revd0_fixup_values[8] = {
  113. 0x0800, 0xBFC0, 0x029C, 0x1001,
  114. 0x001C, 0x0C0B, 0x8C07, 0x9660,
  115. };
  116. /* Pulled from AN1760 describing 'indirect read'
  117. *
  118. * write_register(0x4, 0x00D8, addr)
  119. * write_register(0x4, 0x00DA, 0x2)
  120. * return (int8)(read_register(0x4, 0x00D9))
  121. *
  122. * 0x4 refers to memory map selector 4, which maps to MDIO_MMD_VEND2
  123. */
  124. static int lan865x_revb_indirect_read(struct phy_device *phydev, u16 addr)
  125. {
  126. int ret;
  127. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, LAN865X_REG_CFGPARAM_ADDR,
  128. addr);
  129. if (ret)
  130. return ret;
  131. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, LAN865X_REG_CFGPARAM_CTRL,
  132. LAN865X_CFGPARAM_READ_ENABLE);
  133. if (ret)
  134. return ret;
  135. return phy_read_mmd(phydev, MDIO_MMD_VEND2, LAN865X_REG_CFGPARAM_DATA);
  136. }
  137. /* This is pulled straight from AN1760 from 'calculation of offset 1' &
  138. * 'calculation of offset 2'
  139. */
  140. static int lan865x_generate_cfg_offsets(struct phy_device *phydev, s8 offsets[])
  141. {
  142. const u16 fixup_regs[2] = {0x0004, 0x0008};
  143. int ret;
  144. for (int i = 0; i < ARRAY_SIZE(fixup_regs); i++) {
  145. ret = lan865x_revb_indirect_read(phydev, fixup_regs[i]);
  146. if (ret < 0)
  147. return ret;
  148. /* 5-bit signed value, sign extend */
  149. ret &= GENMASK(4, 0);
  150. if (ret & BIT(4))
  151. offsets[i] = ret | 0xE0;
  152. else
  153. offsets[i] = ret;
  154. }
  155. return 0;
  156. }
  157. static int lan865x_read_cfg_params(struct phy_device *phydev,
  158. const u16 cfg_regs[], u16 cfg_params[],
  159. u8 count)
  160. {
  161. int ret;
  162. for (int i = 0; i < count; i++) {
  163. ret = phy_read_mmd(phydev, MDIO_MMD_VEND2,
  164. cfg_regs[i]);
  165. if (ret < 0)
  166. return ret;
  167. cfg_params[i] = (u16)ret;
  168. }
  169. return 0;
  170. }
  171. static int lan865x_write_cfg_params(struct phy_device *phydev,
  172. const u16 cfg_regs[], u16 cfg_params[],
  173. u8 count)
  174. {
  175. int ret;
  176. for (int i = 0; i < count; i++) {
  177. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2, cfg_regs[i],
  178. cfg_params[i]);
  179. if (ret)
  180. return ret;
  181. }
  182. return 0;
  183. }
  184. static int lan865x_setup_cfgparam(struct phy_device *phydev, s8 offsets[])
  185. {
  186. u16 cfg_results[ARRAY_SIZE(lan865x_revb_fixup_cfg_regs)];
  187. u16 cfg_params[ARRAY_SIZE(lan865x_revb_fixup_cfg_regs)];
  188. int ret;
  189. ret = lan865x_read_cfg_params(phydev, lan865x_revb_fixup_cfg_regs,
  190. cfg_params, ARRAY_SIZE(cfg_params));
  191. if (ret)
  192. return ret;
  193. cfg_results[0] = FIELD_PREP(GENMASK(15, 10), 9 + offsets[0]) |
  194. FIELD_PREP(GENMASK(9, 4), 14 + offsets[0]) |
  195. 0x03;
  196. cfg_results[1] = FIELD_PREP(GENMASK(15, 10), 40 + offsets[1]);
  197. return lan865x_write_cfg_params(phydev, lan865x_revb_fixup_cfg_regs,
  198. cfg_results, ARRAY_SIZE(cfg_results));
  199. }
  200. static int lan865x_setup_sqi_cfgparam(struct phy_device *phydev, s8 offsets[])
  201. {
  202. u16 cfg_results[ARRAY_SIZE(lan865x_revb_sqi_fixup_cfg_regs)];
  203. u16 cfg_params[ARRAY_SIZE(lan865x_revb_sqi_fixup_cfg_regs)];
  204. int ret;
  205. ret = lan865x_read_cfg_params(phydev, lan865x_revb_sqi_fixup_cfg_regs,
  206. cfg_params, ARRAY_SIZE(cfg_params));
  207. if (ret)
  208. return ret;
  209. cfg_results[0] = FIELD_PREP(GENMASK(13, 8), 5 + offsets[0]) |
  210. (9 + offsets[0]);
  211. cfg_results[1] = FIELD_PREP(GENMASK(13, 8), 9 + offsets[0]) |
  212. (14 + offsets[0]);
  213. cfg_results[2] = FIELD_PREP(GENMASK(13, 8), 17 + offsets[0]) |
  214. (22 + offsets[0]);
  215. return lan865x_write_cfg_params(phydev, lan865x_revb_sqi_fixup_cfg_regs,
  216. cfg_results, ARRAY_SIZE(cfg_results));
  217. }
  218. static int lan865x_revb_config_init(struct phy_device *phydev)
  219. {
  220. s8 offsets[2];
  221. int ret;
  222. /* Reference to AN1760
  223. * https://ww1.microchip.com/downloads/aemDocuments/documents/AIS/ProductDocuments/SupportingCollateral/AN-LAN8650-1-Configuration-60001760.pdf
  224. */
  225. ret = lan865x_generate_cfg_offsets(phydev, offsets);
  226. if (ret)
  227. return ret;
  228. for (int i = 0; i < ARRAY_SIZE(lan865x_revb_fixup_registers); i++) {
  229. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
  230. lan865x_revb_fixup_registers[i],
  231. lan865x_revb_fixup_values[i]);
  232. if (ret)
  233. return ret;
  234. if (i == 1) {
  235. ret = lan865x_setup_cfgparam(phydev, offsets);
  236. if (ret)
  237. return ret;
  238. }
  239. }
  240. ret = lan865x_setup_sqi_cfgparam(phydev, offsets);
  241. if (ret)
  242. return ret;
  243. for (int i = 0; i < ARRAY_SIZE(lan865x_revb_sqi_fixup_regs); i++) {
  244. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
  245. lan865x_revb_sqi_fixup_regs[i],
  246. lan865x_revb_sqi_fixup_values[i]);
  247. if (ret)
  248. return ret;
  249. }
  250. return 0;
  251. }
  252. static int lan867x_check_reset_complete(struct phy_device *phydev)
  253. {
  254. int err;
  255. /* The chip completes a reset in 3us, we might get here earlier than
  256. * that, as an added margin we'll conditionally sleep 5us.
  257. */
  258. err = phy_read_mmd(phydev, MDIO_MMD_VEND2, LAN867X_REG_STS2);
  259. if (err < 0)
  260. return err;
  261. if (!(err & LAN867x_RESET_COMPLETE_STS)) {
  262. udelay(5);
  263. err = phy_read_mmd(phydev, MDIO_MMD_VEND2, LAN867X_REG_STS2);
  264. if (err < 0)
  265. return err;
  266. if (!(err & LAN867x_RESET_COMPLETE_STS)) {
  267. phydev_err(phydev, "PHY reset failed\n");
  268. return -ENODEV;
  269. }
  270. }
  271. return 0;
  272. }
  273. static int lan867x_revc_config_init(struct phy_device *phydev)
  274. {
  275. s8 offsets[2];
  276. int ret;
  277. ret = lan867x_check_reset_complete(phydev);
  278. if (ret)
  279. return ret;
  280. ret = lan865x_generate_cfg_offsets(phydev, offsets);
  281. if (ret)
  282. return ret;
  283. /* LAN867x Rev.C1/C2 configuration settings are equal to the first 9
  284. * configuration settings and all the sqi fixup settings from LAN865x
  285. * Rev.B0/B1. So the same fixup registers and values from LAN865x
  286. * Rev.B0/B1 are used for LAN867x Rev.C1/C2 to avoid duplication.
  287. * Refer the below links for the comparison.
  288. * https://www.microchip.com/en-us/application-notes/an1760
  289. * Revision F (DS60001760G - June 2024)
  290. * https://www.microchip.com/en-us/application-notes/an1699
  291. * Revision E (DS60001699F - June 2024)
  292. */
  293. for (int i = 0; i < 9; i++) {
  294. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
  295. lan865x_revb_fixup_registers[i],
  296. lan865x_revb_fixup_values[i]);
  297. if (ret)
  298. return ret;
  299. if (i == 1) {
  300. ret = lan865x_setup_cfgparam(phydev, offsets);
  301. if (ret)
  302. return ret;
  303. }
  304. }
  305. ret = lan865x_setup_sqi_cfgparam(phydev, offsets);
  306. if (ret)
  307. return ret;
  308. for (int i = 0; i < ARRAY_SIZE(lan865x_revb_sqi_fixup_regs); i++) {
  309. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
  310. lan865x_revb_sqi_fixup_regs[i],
  311. lan865x_revb_sqi_fixup_values[i]);
  312. if (ret)
  313. return ret;
  314. }
  315. return 0;
  316. }
  317. static int lan867x_revb1_config_init(struct phy_device *phydev)
  318. {
  319. int err;
  320. err = lan867x_check_reset_complete(phydev);
  321. if (err)
  322. return err;
  323. /* Reference to AN1699
  324. * https://ww1.microchip.com/downloads/aemDocuments/documents/AIS/ProductDocuments/SupportingCollateral/AN-LAN8670-1-2-config-60001699.pdf
  325. * AN1699 says Read, Modify, Write, but the Write is not required if the
  326. * register already has the required value. So it is safe to use
  327. * phy_modify_mmd here.
  328. */
  329. for (int i = 0; i < ARRAY_SIZE(lan867x_revb1_fixup_registers); i++) {
  330. err = phy_modify_mmd(phydev, MDIO_MMD_VEND2,
  331. lan867x_revb1_fixup_registers[i],
  332. lan867x_revb1_fixup_masks[i],
  333. lan867x_revb1_fixup_values[i]);
  334. if (err)
  335. return err;
  336. }
  337. return 0;
  338. }
  339. static int lan867x_revd0_link_active_selection(struct phy_device *phydev,
  340. bool plca_enabled)
  341. {
  342. u16 value;
  343. if (plca_enabled) {
  344. /* 0x1 - When PLCA is enabled: link status reflects plca_status.
  345. */
  346. value = FIELD_PREP(LINK_STATUS_CONFIGURATION,
  347. LINK_STATUS_CONFIG_PLCA_STATUS);
  348. } else {
  349. /* 0x2 - Link status is controlled by the value written into the
  350. * LINK_STATUS_SEMAPHORE bit written. Here the link semaphore
  351. * bit is written with 0x1 to set the link always active in
  352. * CSMA/CD mode as it doesn't support autoneg.
  353. */
  354. value = FIELD_PREP(LINK_STATUS_CONFIGURATION,
  355. LINK_STATUS_CONFIG_SEMAPHORE) |
  356. FIELD_PREP(LINK_STATUS_SEMAPHORE,
  357. LINK_STATUS_SEMAPHORE_SET);
  358. }
  359. return phy_write_mmd(phydev, MDIO_MMD_VEND2,
  360. LAN867X_REG_LINK_STATUS_CTRL, value);
  361. }
  362. /* As per LAN8650/1 Rev.B0/B1 AN1760 (Revision F (DS60001760G - June 2024)) and
  363. * LAN8670/1/2 Rev.C1/C2 AN1699 (Revision E (DS60001699F - June 2024)), under
  364. * normal operation, the device should be operated in PLCA mode. Disabling
  365. * collision detection is recommended to allow the device to operate in noisy
  366. * environments or when reflections and other inherent transmission line
  367. * distortion cause poor signal quality. Collision detection must be re-enabled
  368. * if the device is configured to operate in CSMA/CD mode.
  369. *
  370. * AN1760: https://www.microchip.com/en-us/application-notes/an1760
  371. * AN1699: https://www.microchip.com/en-us/application-notes/an1699
  372. */
  373. static int lan86xx_plca_set_cfg(struct phy_device *phydev,
  374. const struct phy_plca_cfg *plca_cfg)
  375. {
  376. int ret;
  377. /* Link status selection must be configured for LAN8670/1/2 Rev.D0 */
  378. if (phydev->phy_id == PHY_ID_LAN867X_REVD0) {
  379. ret = lan867x_revd0_link_active_selection(phydev,
  380. plca_cfg->enabled);
  381. if (ret)
  382. return ret;
  383. }
  384. ret = genphy_c45_plca_set_cfg(phydev, plca_cfg);
  385. if (ret)
  386. return ret;
  387. if (plca_cfg->enabled)
  388. return phy_modify_mmd(phydev, MDIO_MMD_VEND2,
  389. LAN86XX_REG_COL_DET_CTRL0,
  390. COL_DET_CTRL0_ENABLE_BIT_MASK,
  391. COL_DET_DISABLE);
  392. return phy_modify_mmd(phydev, MDIO_MMD_VEND2, LAN86XX_REG_COL_DET_CTRL0,
  393. COL_DET_CTRL0_ENABLE_BIT_MASK, COL_DET_ENABLE);
  394. }
  395. static int lan867x_revd0_config_init(struct phy_device *phydev)
  396. {
  397. int ret;
  398. ret = lan867x_check_reset_complete(phydev);
  399. if (ret)
  400. return ret;
  401. for (int i = 0; i < ARRAY_SIZE(lan867x_revd0_fixup_regs); i++) {
  402. ret = phy_write_mmd(phydev, MDIO_MMD_VEND2,
  403. lan867x_revd0_fixup_regs[i],
  404. lan867x_revd0_fixup_values[i]);
  405. if (ret)
  406. return ret;
  407. }
  408. /* Initially the PHY will be in CSMA/CD mode by default. So it is
  409. * required to set the link always active as it doesn't support
  410. * autoneg.
  411. */
  412. return lan867x_revd0_link_active_selection(phydev, false);
  413. }
  414. static int lan86xx_read_status(struct phy_device *phydev)
  415. {
  416. /* The phy has some limitations, namely:
  417. * - always reports link up
  418. * - only supports 10MBit half duplex
  419. * - does not support auto negotiate
  420. */
  421. phydev->link = 1;
  422. phydev->duplex = DUPLEX_HALF;
  423. phydev->speed = SPEED_10;
  424. phydev->autoneg = AUTONEG_DISABLE;
  425. return 0;
  426. }
  427. /* OPEN Alliance 10BASE-T1x compliance MAC-PHYs will have both C22 and
  428. * C45 registers space. If the PHY is discovered via C22 bus protocol it assumes
  429. * it uses C22 protocol and always uses C22 registers indirect access to access
  430. * C45 registers. This is because, we don't have a clean separation between
  431. * C22/C45 register space and C22/C45 MDIO bus protocols. Resulting, PHY C45
  432. * registers direct access can't be used which can save multiple SPI bus access.
  433. * To support this feature, set .read_mmd/.write_mmd in the PHY driver to call
  434. * .read_c45/.write_c45 in the OPEN Alliance framework
  435. * drivers/net/ethernet/oa_tc6.c
  436. */
  437. static int lan865x_phy_read_mmd(struct phy_device *phydev, int devnum,
  438. u16 regnum)
  439. {
  440. struct mii_bus *bus = phydev->mdio.bus;
  441. int addr = phydev->mdio.addr;
  442. return __mdiobus_c45_read(bus, addr, devnum, regnum);
  443. }
  444. static int lan865x_phy_write_mmd(struct phy_device *phydev, int devnum,
  445. u16 regnum, u16 val)
  446. {
  447. struct mii_bus *bus = phydev->mdio.bus;
  448. int addr = phydev->mdio.addr;
  449. return __mdiobus_c45_write(bus, addr, devnum, regnum, val);
  450. }
  451. static struct phy_driver microchip_t1s_driver[] = {
  452. {
  453. PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1),
  454. .name = "LAN867X Rev.B1",
  455. .features = PHY_BASIC_T1S_P2MP_FEATURES,
  456. .config_init = lan867x_revb1_config_init,
  457. .read_status = lan86xx_read_status,
  458. .get_plca_cfg = genphy_c45_plca_get_cfg,
  459. .set_plca_cfg = genphy_c45_plca_set_cfg,
  460. .get_plca_status = genphy_c45_plca_get_status,
  461. },
  462. {
  463. PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC1),
  464. .name = "LAN867X Rev.C1",
  465. .features = PHY_BASIC_T1S_P2MP_FEATURES,
  466. .config_init = lan867x_revc_config_init,
  467. .read_status = lan86xx_read_status,
  468. .get_plca_cfg = genphy_c45_plca_get_cfg,
  469. .set_plca_cfg = lan86xx_plca_set_cfg,
  470. .get_plca_status = genphy_c45_plca_get_status,
  471. },
  472. {
  473. PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC2),
  474. .name = "LAN867X Rev.C2",
  475. .features = PHY_BASIC_T1S_P2MP_FEATURES,
  476. .config_init = lan867x_revc_config_init,
  477. .read_status = lan86xx_read_status,
  478. .get_plca_cfg = genphy_c45_plca_get_cfg,
  479. .set_plca_cfg = lan86xx_plca_set_cfg,
  480. .get_plca_status = genphy_c45_plca_get_status,
  481. },
  482. {
  483. PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVD0),
  484. .name = "LAN867X Rev.D0",
  485. .features = PHY_BASIC_T1S_P2MP_FEATURES,
  486. .config_init = lan867x_revd0_config_init,
  487. .get_plca_cfg = genphy_c45_plca_get_cfg,
  488. .set_plca_cfg = lan86xx_plca_set_cfg,
  489. .get_plca_status = genphy_c45_plca_get_status,
  490. .cable_test_start = genphy_c45_oatc14_cable_test_start,
  491. .cable_test_get_status = genphy_c45_oatc14_cable_test_get_status,
  492. .get_sqi = genphy_c45_oatc14_get_sqi,
  493. .get_sqi_max = genphy_c45_oatc14_get_sqi_max,
  494. },
  495. {
  496. PHY_ID_MATCH_EXACT(PHY_ID_LAN865X_REVB),
  497. .name = "LAN865X Rev.B0/B1 Internal Phy",
  498. .features = PHY_BASIC_T1S_P2MP_FEATURES,
  499. .config_init = lan865x_revb_config_init,
  500. .read_status = lan86xx_read_status,
  501. .read_mmd = lan865x_phy_read_mmd,
  502. .write_mmd = lan865x_phy_write_mmd,
  503. .get_plca_cfg = genphy_c45_plca_get_cfg,
  504. .set_plca_cfg = lan86xx_plca_set_cfg,
  505. .get_plca_status = genphy_c45_plca_get_status,
  506. },
  507. };
  508. module_phy_driver(microchip_t1s_driver);
  509. static const struct mdio_device_id __maybe_unused tbl[] = {
  510. { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVB1) },
  511. { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC1) },
  512. { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVC2) },
  513. { PHY_ID_MATCH_EXACT(PHY_ID_LAN867X_REVD0) },
  514. { PHY_ID_MATCH_EXACT(PHY_ID_LAN865X_REVB) },
  515. { }
  516. };
  517. MODULE_DEVICE_TABLE(mdio, tbl);
  518. MODULE_DESCRIPTION("Microchip 10BASE-T1S PHYs driver");
  519. MODULE_AUTHOR("Ramón Nordin Rodriguez");
  520. MODULE_LICENSE("GPL");