ksz_common.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  1. /*
  2. * Microchip switch driver main logic
  3. *
  4. * Copyright (C) 2017
  5. *
  6. * Permission to use, copy, modify, and/or distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. #include <linux/delay.h>
  19. #include <linux/export.h>
  20. #include <linux/gpio.h>
  21. #include <linux/kernel.h>
  22. #include <linux/module.h>
  23. #include <linux/platform_data/microchip-ksz.h>
  24. #include <linux/phy.h>
  25. #include <linux/etherdevice.h>
  26. #include <linux/if_bridge.h>
  27. #include <net/dsa.h>
  28. #include <net/switchdev.h>
  29. #include "ksz_priv.h"
  30. static const struct {
  31. int index;
  32. char string[ETH_GSTRING_LEN];
  33. } mib_names[TOTAL_SWITCH_COUNTER_NUM] = {
  34. { 0x00, "rx_hi" },
  35. { 0x01, "rx_undersize" },
  36. { 0x02, "rx_fragments" },
  37. { 0x03, "rx_oversize" },
  38. { 0x04, "rx_jabbers" },
  39. { 0x05, "rx_symbol_err" },
  40. { 0x06, "rx_crc_err" },
  41. { 0x07, "rx_align_err" },
  42. { 0x08, "rx_mac_ctrl" },
  43. { 0x09, "rx_pause" },
  44. { 0x0A, "rx_bcast" },
  45. { 0x0B, "rx_mcast" },
  46. { 0x0C, "rx_ucast" },
  47. { 0x0D, "rx_64_or_less" },
  48. { 0x0E, "rx_65_127" },
  49. { 0x0F, "rx_128_255" },
  50. { 0x10, "rx_256_511" },
  51. { 0x11, "rx_512_1023" },
  52. { 0x12, "rx_1024_1522" },
  53. { 0x13, "rx_1523_2000" },
  54. { 0x14, "rx_2001" },
  55. { 0x15, "tx_hi" },
  56. { 0x16, "tx_late_col" },
  57. { 0x17, "tx_pause" },
  58. { 0x18, "tx_bcast" },
  59. { 0x19, "tx_mcast" },
  60. { 0x1A, "tx_ucast" },
  61. { 0x1B, "tx_deferred" },
  62. { 0x1C, "tx_total_col" },
  63. { 0x1D, "tx_exc_col" },
  64. { 0x1E, "tx_single_col" },
  65. { 0x1F, "tx_mult_col" },
  66. { 0x80, "rx_total" },
  67. { 0x81, "tx_total" },
  68. { 0x82, "rx_discards" },
  69. { 0x83, "tx_discards" },
  70. };
  71. static void ksz_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set)
  72. {
  73. u8 data;
  74. ksz_read8(dev, addr, &data);
  75. if (set)
  76. data |= bits;
  77. else
  78. data &= ~bits;
  79. ksz_write8(dev, addr, data);
  80. }
  81. static void ksz_cfg32(struct ksz_device *dev, u32 addr, u32 bits, bool set)
  82. {
  83. u32 data;
  84. ksz_read32(dev, addr, &data);
  85. if (set)
  86. data |= bits;
  87. else
  88. data &= ~bits;
  89. ksz_write32(dev, addr, data);
  90. }
  91. static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits,
  92. bool set)
  93. {
  94. u32 addr;
  95. u8 data;
  96. addr = PORT_CTRL_ADDR(port, offset);
  97. ksz_read8(dev, addr, &data);
  98. if (set)
  99. data |= bits;
  100. else
  101. data &= ~bits;
  102. ksz_write8(dev, addr, data);
  103. }
  104. static void ksz_port_cfg32(struct ksz_device *dev, int port, int offset,
  105. u32 bits, bool set)
  106. {
  107. u32 addr;
  108. u32 data;
  109. addr = PORT_CTRL_ADDR(port, offset);
  110. ksz_read32(dev, addr, &data);
  111. if (set)
  112. data |= bits;
  113. else
  114. data &= ~bits;
  115. ksz_write32(dev, addr, data);
  116. }
  117. static int wait_vlan_ctrl_ready(struct ksz_device *dev, u32 waiton, int timeout)
  118. {
  119. u8 data;
  120. do {
  121. ksz_read8(dev, REG_SW_VLAN_CTRL, &data);
  122. if (!(data & waiton))
  123. break;
  124. usleep_range(1, 10);
  125. } while (timeout-- > 0);
  126. if (timeout <= 0)
  127. return -ETIMEDOUT;
  128. return 0;
  129. }
  130. static int get_vlan_table(struct dsa_switch *ds, u16 vid, u32 *vlan_table)
  131. {
  132. struct ksz_device *dev = ds->priv;
  133. int ret;
  134. mutex_lock(&dev->vlan_mutex);
  135. ksz_write16(dev, REG_SW_VLAN_ENTRY_INDEX__2, vid & VLAN_INDEX_M);
  136. ksz_write8(dev, REG_SW_VLAN_CTRL, VLAN_READ | VLAN_START);
  137. /* wait to be cleared */
  138. ret = wait_vlan_ctrl_ready(dev, VLAN_START, 1000);
  139. if (ret < 0) {
  140. dev_dbg(dev->dev, "Failed to read vlan table\n");
  141. goto exit;
  142. }
  143. ksz_read32(dev, REG_SW_VLAN_ENTRY__4, &vlan_table[0]);
  144. ksz_read32(dev, REG_SW_VLAN_ENTRY_UNTAG__4, &vlan_table[1]);
  145. ksz_read32(dev, REG_SW_VLAN_ENTRY_PORTS__4, &vlan_table[2]);
  146. ksz_write8(dev, REG_SW_VLAN_CTRL, 0);
  147. exit:
  148. mutex_unlock(&dev->vlan_mutex);
  149. return ret;
  150. }
  151. static int set_vlan_table(struct dsa_switch *ds, u16 vid, u32 *vlan_table)
  152. {
  153. struct ksz_device *dev = ds->priv;
  154. int ret;
  155. mutex_lock(&dev->vlan_mutex);
  156. ksz_write32(dev, REG_SW_VLAN_ENTRY__4, vlan_table[0]);
  157. ksz_write32(dev, REG_SW_VLAN_ENTRY_UNTAG__4, vlan_table[1]);
  158. ksz_write32(dev, REG_SW_VLAN_ENTRY_PORTS__4, vlan_table[2]);
  159. ksz_write16(dev, REG_SW_VLAN_ENTRY_INDEX__2, vid & VLAN_INDEX_M);
  160. ksz_write8(dev, REG_SW_VLAN_CTRL, VLAN_START | VLAN_WRITE);
  161. /* wait to be cleared */
  162. ret = wait_vlan_ctrl_ready(dev, VLAN_START, 1000);
  163. if (ret < 0) {
  164. dev_dbg(dev->dev, "Failed to write vlan table\n");
  165. goto exit;
  166. }
  167. ksz_write8(dev, REG_SW_VLAN_CTRL, 0);
  168. /* update vlan cache table */
  169. dev->vlan_cache[vid].table[0] = vlan_table[0];
  170. dev->vlan_cache[vid].table[1] = vlan_table[1];
  171. dev->vlan_cache[vid].table[2] = vlan_table[2];
  172. exit:
  173. mutex_unlock(&dev->vlan_mutex);
  174. return ret;
  175. }
  176. static void read_table(struct dsa_switch *ds, u32 *table)
  177. {
  178. struct ksz_device *dev = ds->priv;
  179. ksz_read32(dev, REG_SW_ALU_VAL_A, &table[0]);
  180. ksz_read32(dev, REG_SW_ALU_VAL_B, &table[1]);
  181. ksz_read32(dev, REG_SW_ALU_VAL_C, &table[2]);
  182. ksz_read32(dev, REG_SW_ALU_VAL_D, &table[3]);
  183. }
  184. static void write_table(struct dsa_switch *ds, u32 *table)
  185. {
  186. struct ksz_device *dev = ds->priv;
  187. ksz_write32(dev, REG_SW_ALU_VAL_A, table[0]);
  188. ksz_write32(dev, REG_SW_ALU_VAL_B, table[1]);
  189. ksz_write32(dev, REG_SW_ALU_VAL_C, table[2]);
  190. ksz_write32(dev, REG_SW_ALU_VAL_D, table[3]);
  191. }
  192. static int wait_alu_ready(struct ksz_device *dev, u32 waiton, int timeout)
  193. {
  194. u32 data;
  195. do {
  196. ksz_read32(dev, REG_SW_ALU_CTRL__4, &data);
  197. if (!(data & waiton))
  198. break;
  199. usleep_range(1, 10);
  200. } while (timeout-- > 0);
  201. if (timeout <= 0)
  202. return -ETIMEDOUT;
  203. return 0;
  204. }
  205. static int wait_alu_sta_ready(struct ksz_device *dev, u32 waiton, int timeout)
  206. {
  207. u32 data;
  208. do {
  209. ksz_read32(dev, REG_SW_ALU_STAT_CTRL__4, &data);
  210. if (!(data & waiton))
  211. break;
  212. usleep_range(1, 10);
  213. } while (timeout-- > 0);
  214. if (timeout <= 0)
  215. return -ETIMEDOUT;
  216. return 0;
  217. }
  218. static int ksz_reset_switch(struct dsa_switch *ds)
  219. {
  220. struct ksz_device *dev = ds->priv;
  221. u8 data8;
  222. u16 data16;
  223. u32 data32;
  224. /* reset switch */
  225. ksz_cfg(dev, REG_SW_OPERATION, SW_RESET, true);
  226. /* turn off SPI DO Edge select */
  227. ksz_read8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, &data8);
  228. data8 &= ~SPI_AUTO_EDGE_DETECTION;
  229. ksz_write8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, data8);
  230. /* default configuration */
  231. ksz_read8(dev, REG_SW_LUE_CTRL_1, &data8);
  232. data8 = SW_AGING_ENABLE | SW_LINK_AUTO_AGING |
  233. SW_SRC_ADDR_FILTER | SW_FLUSH_STP_TABLE | SW_FLUSH_MSTP_TABLE;
  234. ksz_write8(dev, REG_SW_LUE_CTRL_1, data8);
  235. /* disable interrupts */
  236. ksz_write32(dev, REG_SW_INT_MASK__4, SWITCH_INT_MASK);
  237. ksz_write32(dev, REG_SW_PORT_INT_MASK__4, 0x7F);
  238. ksz_read32(dev, REG_SW_PORT_INT_STATUS__4, &data32);
  239. /* set broadcast storm protection 10% rate */
  240. ksz_read16(dev, REG_SW_MAC_CTRL_2, &data16);
  241. data16 &= ~BROADCAST_STORM_RATE;
  242. data16 |= (BROADCAST_STORM_VALUE * BROADCAST_STORM_PROT_RATE) / 100;
  243. ksz_write16(dev, REG_SW_MAC_CTRL_2, data16);
  244. return 0;
  245. }
  246. static void port_setup(struct ksz_device *dev, int port, bool cpu_port)
  247. {
  248. u8 data8;
  249. u16 data16;
  250. /* enable tag tail for host port */
  251. if (cpu_port)
  252. ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_TAIL_TAG_ENABLE,
  253. true);
  254. ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_MAC_LOOPBACK, false);
  255. /* set back pressure */
  256. ksz_port_cfg(dev, port, REG_PORT_MAC_CTRL_1, PORT_BACK_PRESSURE, true);
  257. /* set flow control */
  258. ksz_port_cfg(dev, port, REG_PORT_CTRL_0,
  259. PORT_FORCE_TX_FLOW_CTRL | PORT_FORCE_RX_FLOW_CTRL, true);
  260. /* enable broadcast storm limit */
  261. ksz_port_cfg(dev, port, P_BCAST_STORM_CTRL, PORT_BROADCAST_STORM, true);
  262. /* disable DiffServ priority */
  263. ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_DIFFSERV_PRIO_ENABLE, false);
  264. /* replace priority */
  265. ksz_port_cfg(dev, port, REG_PORT_MRI_MAC_CTRL, PORT_USER_PRIO_CEILING,
  266. false);
  267. ksz_port_cfg32(dev, port, REG_PORT_MTI_QUEUE_CTRL_0__4,
  268. MTI_PVID_REPLACE, false);
  269. /* enable 802.1p priority */
  270. ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_PRIO_ENABLE, true);
  271. /* configure MAC to 1G & RGMII mode */
  272. ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
  273. data8 |= PORT_RGMII_ID_EG_ENABLE;
  274. data8 &= ~PORT_MII_NOT_1GBIT;
  275. data8 &= ~PORT_MII_SEL_M;
  276. data8 |= PORT_RGMII_SEL;
  277. ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_1, data8);
  278. /* clear pending interrupts */
  279. ksz_pread16(dev, port, REG_PORT_PHY_INT_ENABLE, &data16);
  280. }
  281. static void ksz_config_cpu_port(struct dsa_switch *ds)
  282. {
  283. struct ksz_device *dev = ds->priv;
  284. int i;
  285. ds->num_ports = dev->port_cnt;
  286. for (i = 0; i < ds->num_ports; i++) {
  287. if (dsa_is_cpu_port(ds, i) && (dev->cpu_ports & (1 << i))) {
  288. dev->cpu_port = i;
  289. /* enable cpu port */
  290. port_setup(dev, i, true);
  291. }
  292. }
  293. }
  294. static int ksz_setup(struct dsa_switch *ds)
  295. {
  296. struct ksz_device *dev = ds->priv;
  297. int ret = 0;
  298. dev->vlan_cache = devm_kcalloc(dev->dev, sizeof(struct vlan_table),
  299. dev->num_vlans, GFP_KERNEL);
  300. if (!dev->vlan_cache)
  301. return -ENOMEM;
  302. ret = ksz_reset_switch(ds);
  303. if (ret) {
  304. dev_err(ds->dev, "failed to reset switch\n");
  305. return ret;
  306. }
  307. /* accept packet up to 2000bytes */
  308. ksz_cfg(dev, REG_SW_MAC_CTRL_1, SW_LEGAL_PACKET_DISABLE, true);
  309. ksz_config_cpu_port(ds);
  310. ksz_cfg(dev, REG_SW_MAC_CTRL_1, MULTICAST_STORM_DISABLE, true);
  311. /* queue based egress rate limit */
  312. ksz_cfg(dev, REG_SW_MAC_CTRL_5, SW_OUT_RATE_LIMIT_QUEUE_BASED, true);
  313. /* start switch */
  314. ksz_cfg(dev, REG_SW_OPERATION, SW_START, true);
  315. return 0;
  316. }
  317. static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
  318. int port)
  319. {
  320. return DSA_TAG_PROTO_KSZ;
  321. }
  322. static int ksz_phy_read16(struct dsa_switch *ds, int addr, int reg)
  323. {
  324. struct ksz_device *dev = ds->priv;
  325. u16 val = 0;
  326. ksz_pread16(dev, addr, 0x100 + (reg << 1), &val);
  327. return val;
  328. }
  329. static int ksz_phy_write16(struct dsa_switch *ds, int addr, int reg, u16 val)
  330. {
  331. struct ksz_device *dev = ds->priv;
  332. ksz_pwrite16(dev, addr, 0x100 + (reg << 1), val);
  333. return 0;
  334. }
  335. static int ksz_enable_port(struct dsa_switch *ds, int port,
  336. struct phy_device *phy)
  337. {
  338. struct ksz_device *dev = ds->priv;
  339. /* setup slave port */
  340. port_setup(dev, port, false);
  341. return 0;
  342. }
  343. static void ksz_disable_port(struct dsa_switch *ds, int port,
  344. struct phy_device *phy)
  345. {
  346. struct ksz_device *dev = ds->priv;
  347. /* there is no port disable */
  348. ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_MAC_LOOPBACK, true);
  349. }
  350. static int ksz_sset_count(struct dsa_switch *ds, int port)
  351. {
  352. return TOTAL_SWITCH_COUNTER_NUM;
  353. }
  354. static void ksz_get_strings(struct dsa_switch *ds, int port, uint8_t *buf)
  355. {
  356. int i;
  357. for (i = 0; i < TOTAL_SWITCH_COUNTER_NUM; i++) {
  358. memcpy(buf + i * ETH_GSTRING_LEN, mib_names[i].string,
  359. ETH_GSTRING_LEN);
  360. }
  361. }
  362. static void ksz_get_ethtool_stats(struct dsa_switch *ds, int port,
  363. uint64_t *buf)
  364. {
  365. struct ksz_device *dev = ds->priv;
  366. int i;
  367. u32 data;
  368. int timeout;
  369. mutex_lock(&dev->stats_mutex);
  370. for (i = 0; i < TOTAL_SWITCH_COUNTER_NUM; i++) {
  371. data = MIB_COUNTER_READ;
  372. data |= ((mib_names[i].index & 0xFF) << MIB_COUNTER_INDEX_S);
  373. ksz_pwrite32(dev, port, REG_PORT_MIB_CTRL_STAT__4, data);
  374. timeout = 1000;
  375. do {
  376. ksz_pread32(dev, port, REG_PORT_MIB_CTRL_STAT__4,
  377. &data);
  378. usleep_range(1, 10);
  379. if (!(data & MIB_COUNTER_READ))
  380. break;
  381. } while (timeout-- > 0);
  382. /* failed to read MIB. get out of loop */
  383. if (!timeout) {
  384. dev_dbg(dev->dev, "Failed to get MIB\n");
  385. break;
  386. }
  387. /* count resets upon read */
  388. ksz_pread32(dev, port, REG_PORT_MIB_DATA, &data);
  389. dev->mib_value[i] += (uint64_t)data;
  390. buf[i] = dev->mib_value[i];
  391. }
  392. mutex_unlock(&dev->stats_mutex);
  393. }
  394. static void ksz_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
  395. {
  396. struct ksz_device *dev = ds->priv;
  397. u8 data;
  398. ksz_pread8(dev, port, P_STP_CTRL, &data);
  399. data &= ~(PORT_TX_ENABLE | PORT_RX_ENABLE | PORT_LEARN_DISABLE);
  400. switch (state) {
  401. case BR_STATE_DISABLED:
  402. data |= PORT_LEARN_DISABLE;
  403. break;
  404. case BR_STATE_LISTENING:
  405. data |= (PORT_RX_ENABLE | PORT_LEARN_DISABLE);
  406. break;
  407. case BR_STATE_LEARNING:
  408. data |= PORT_RX_ENABLE;
  409. break;
  410. case BR_STATE_FORWARDING:
  411. data |= (PORT_TX_ENABLE | PORT_RX_ENABLE);
  412. break;
  413. case BR_STATE_BLOCKING:
  414. data |= PORT_LEARN_DISABLE;
  415. break;
  416. default:
  417. dev_err(ds->dev, "invalid STP state: %d\n", state);
  418. return;
  419. }
  420. ksz_pwrite8(dev, port, P_STP_CTRL, data);
  421. }
  422. static void ksz_port_fast_age(struct dsa_switch *ds, int port)
  423. {
  424. struct ksz_device *dev = ds->priv;
  425. u8 data8;
  426. ksz_read8(dev, REG_SW_LUE_CTRL_1, &data8);
  427. data8 |= SW_FAST_AGING;
  428. ksz_write8(dev, REG_SW_LUE_CTRL_1, data8);
  429. data8 &= ~SW_FAST_AGING;
  430. ksz_write8(dev, REG_SW_LUE_CTRL_1, data8);
  431. }
  432. static int ksz_port_vlan_filtering(struct dsa_switch *ds, int port, bool flag)
  433. {
  434. struct ksz_device *dev = ds->priv;
  435. if (flag) {
  436. ksz_port_cfg(dev, port, REG_PORT_LUE_CTRL,
  437. PORT_VLAN_LOOKUP_VID_0, true);
  438. ksz_cfg32(dev, REG_SW_QM_CTRL__4, UNICAST_VLAN_BOUNDARY, true);
  439. ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_VLAN_ENABLE, true);
  440. } else {
  441. ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_VLAN_ENABLE, false);
  442. ksz_cfg32(dev, REG_SW_QM_CTRL__4, UNICAST_VLAN_BOUNDARY, false);
  443. ksz_port_cfg(dev, port, REG_PORT_LUE_CTRL,
  444. PORT_VLAN_LOOKUP_VID_0, false);
  445. }
  446. return 0;
  447. }
  448. static int ksz_port_vlan_prepare(struct dsa_switch *ds, int port,
  449. const struct switchdev_obj_port_vlan *vlan)
  450. {
  451. /* nothing needed */
  452. return 0;
  453. }
  454. static void ksz_port_vlan_add(struct dsa_switch *ds, int port,
  455. const struct switchdev_obj_port_vlan *vlan)
  456. {
  457. struct ksz_device *dev = ds->priv;
  458. u32 vlan_table[3];
  459. u16 vid;
  460. bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
  461. for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
  462. if (get_vlan_table(ds, vid, vlan_table)) {
  463. dev_dbg(dev->dev, "Failed to get vlan table\n");
  464. return;
  465. }
  466. vlan_table[0] = VLAN_VALID | (vid & VLAN_FID_M);
  467. if (untagged)
  468. vlan_table[1] |= BIT(port);
  469. else
  470. vlan_table[1] &= ~BIT(port);
  471. vlan_table[1] &= ~(BIT(dev->cpu_port));
  472. vlan_table[2] |= BIT(port) | BIT(dev->cpu_port);
  473. if (set_vlan_table(ds, vid, vlan_table)) {
  474. dev_dbg(dev->dev, "Failed to set vlan table\n");
  475. return;
  476. }
  477. /* change PVID */
  478. if (vlan->flags & BRIDGE_VLAN_INFO_PVID)
  479. ksz_pwrite16(dev, port, REG_PORT_DEFAULT_VID, vid);
  480. }
  481. }
  482. static int ksz_port_vlan_del(struct dsa_switch *ds, int port,
  483. const struct switchdev_obj_port_vlan *vlan)
  484. {
  485. struct ksz_device *dev = ds->priv;
  486. bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
  487. u32 vlan_table[3];
  488. u16 vid;
  489. u16 pvid;
  490. ksz_pread16(dev, port, REG_PORT_DEFAULT_VID, &pvid);
  491. pvid = pvid & 0xFFF;
  492. for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
  493. if (get_vlan_table(ds, vid, vlan_table)) {
  494. dev_dbg(dev->dev, "Failed to get vlan table\n");
  495. return -ETIMEDOUT;
  496. }
  497. vlan_table[2] &= ~BIT(port);
  498. if (pvid == vid)
  499. pvid = 1;
  500. if (untagged)
  501. vlan_table[1] &= ~BIT(port);
  502. if (set_vlan_table(ds, vid, vlan_table)) {
  503. dev_dbg(dev->dev, "Failed to set vlan table\n");
  504. return -ETIMEDOUT;
  505. }
  506. }
  507. ksz_pwrite16(dev, port, REG_PORT_DEFAULT_VID, pvid);
  508. return 0;
  509. }
  510. struct alu_struct {
  511. /* entry 1 */
  512. u8 is_static:1;
  513. u8 is_src_filter:1;
  514. u8 is_dst_filter:1;
  515. u8 prio_age:3;
  516. u32 _reserv_0_1:23;
  517. u8 mstp:3;
  518. /* entry 2 */
  519. u8 is_override:1;
  520. u8 is_use_fid:1;
  521. u32 _reserv_1_1:23;
  522. u8 port_forward:7;
  523. /* entry 3 & 4*/
  524. u32 _reserv_2_1:9;
  525. u8 fid:7;
  526. u8 mac[ETH_ALEN];
  527. };
  528. static int ksz_port_fdb_add(struct dsa_switch *ds, int port,
  529. const unsigned char *addr, u16 vid)
  530. {
  531. struct ksz_device *dev = ds->priv;
  532. u32 alu_table[4];
  533. u32 data;
  534. int ret = 0;
  535. mutex_lock(&dev->alu_mutex);
  536. /* find any entry with mac & vid */
  537. data = vid << ALU_FID_INDEX_S;
  538. data |= ((addr[0] << 8) | addr[1]);
  539. ksz_write32(dev, REG_SW_ALU_INDEX_0, data);
  540. data = ((addr[2] << 24) | (addr[3] << 16));
  541. data |= ((addr[4] << 8) | addr[5]);
  542. ksz_write32(dev, REG_SW_ALU_INDEX_1, data);
  543. /* start read operation */
  544. ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_READ | ALU_START);
  545. /* wait to be finished */
  546. ret = wait_alu_ready(dev, ALU_START, 1000);
  547. if (ret < 0) {
  548. dev_dbg(dev->dev, "Failed to read ALU\n");
  549. goto exit;
  550. }
  551. /* read ALU entry */
  552. read_table(ds, alu_table);
  553. /* update ALU entry */
  554. alu_table[0] = ALU_V_STATIC_VALID;
  555. alu_table[1] |= BIT(port);
  556. if (vid)
  557. alu_table[1] |= ALU_V_USE_FID;
  558. alu_table[2] = (vid << ALU_V_FID_S);
  559. alu_table[2] |= ((addr[0] << 8) | addr[1]);
  560. alu_table[3] = ((addr[2] << 24) | (addr[3] << 16));
  561. alu_table[3] |= ((addr[4] << 8) | addr[5]);
  562. write_table(ds, alu_table);
  563. ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_WRITE | ALU_START);
  564. /* wait to be finished */
  565. ret = wait_alu_ready(dev, ALU_START, 1000);
  566. if (ret < 0)
  567. dev_dbg(dev->dev, "Failed to write ALU\n");
  568. exit:
  569. mutex_unlock(&dev->alu_mutex);
  570. return ret;
  571. }
  572. static int ksz_port_fdb_del(struct dsa_switch *ds, int port,
  573. const unsigned char *addr, u16 vid)
  574. {
  575. struct ksz_device *dev = ds->priv;
  576. u32 alu_table[4];
  577. u32 data;
  578. int ret = 0;
  579. mutex_lock(&dev->alu_mutex);
  580. /* read any entry with mac & vid */
  581. data = vid << ALU_FID_INDEX_S;
  582. data |= ((addr[0] << 8) | addr[1]);
  583. ksz_write32(dev, REG_SW_ALU_INDEX_0, data);
  584. data = ((addr[2] << 24) | (addr[3] << 16));
  585. data |= ((addr[4] << 8) | addr[5]);
  586. ksz_write32(dev, REG_SW_ALU_INDEX_1, data);
  587. /* start read operation */
  588. ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_READ | ALU_START);
  589. /* wait to be finished */
  590. ret = wait_alu_ready(dev, ALU_START, 1000);
  591. if (ret < 0) {
  592. dev_dbg(dev->dev, "Failed to read ALU\n");
  593. goto exit;
  594. }
  595. ksz_read32(dev, REG_SW_ALU_VAL_A, &alu_table[0]);
  596. if (alu_table[0] & ALU_V_STATIC_VALID) {
  597. ksz_read32(dev, REG_SW_ALU_VAL_B, &alu_table[1]);
  598. ksz_read32(dev, REG_SW_ALU_VAL_C, &alu_table[2]);
  599. ksz_read32(dev, REG_SW_ALU_VAL_D, &alu_table[3]);
  600. /* clear forwarding port */
  601. alu_table[2] &= ~BIT(port);
  602. /* if there is no port to forward, clear table */
  603. if ((alu_table[2] & ALU_V_PORT_MAP) == 0) {
  604. alu_table[0] = 0;
  605. alu_table[1] = 0;
  606. alu_table[2] = 0;
  607. alu_table[3] = 0;
  608. }
  609. } else {
  610. alu_table[0] = 0;
  611. alu_table[1] = 0;
  612. alu_table[2] = 0;
  613. alu_table[3] = 0;
  614. }
  615. write_table(ds, alu_table);
  616. ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_WRITE | ALU_START);
  617. /* wait to be finished */
  618. ret = wait_alu_ready(dev, ALU_START, 1000);
  619. if (ret < 0)
  620. dev_dbg(dev->dev, "Failed to write ALU\n");
  621. exit:
  622. mutex_unlock(&dev->alu_mutex);
  623. return ret;
  624. }
  625. static void convert_alu(struct alu_struct *alu, u32 *alu_table)
  626. {
  627. alu->is_static = !!(alu_table[0] & ALU_V_STATIC_VALID);
  628. alu->is_src_filter = !!(alu_table[0] & ALU_V_SRC_FILTER);
  629. alu->is_dst_filter = !!(alu_table[0] & ALU_V_DST_FILTER);
  630. alu->prio_age = (alu_table[0] >> ALU_V_PRIO_AGE_CNT_S) &
  631. ALU_V_PRIO_AGE_CNT_M;
  632. alu->mstp = alu_table[0] & ALU_V_MSTP_M;
  633. alu->is_override = !!(alu_table[1] & ALU_V_OVERRIDE);
  634. alu->is_use_fid = !!(alu_table[1] & ALU_V_USE_FID);
  635. alu->port_forward = alu_table[1] & ALU_V_PORT_MAP;
  636. alu->fid = (alu_table[2] >> ALU_V_FID_S) & ALU_V_FID_M;
  637. alu->mac[0] = (alu_table[2] >> 8) & 0xFF;
  638. alu->mac[1] = alu_table[2] & 0xFF;
  639. alu->mac[2] = (alu_table[3] >> 24) & 0xFF;
  640. alu->mac[3] = (alu_table[3] >> 16) & 0xFF;
  641. alu->mac[4] = (alu_table[3] >> 8) & 0xFF;
  642. alu->mac[5] = alu_table[3] & 0xFF;
  643. }
  644. static int ksz_port_fdb_dump(struct dsa_switch *ds, int port,
  645. dsa_fdb_dump_cb_t *cb, void *data)
  646. {
  647. struct ksz_device *dev = ds->priv;
  648. int ret = 0;
  649. u32 ksz_data;
  650. u32 alu_table[4];
  651. struct alu_struct alu;
  652. int timeout;
  653. mutex_lock(&dev->alu_mutex);
  654. /* start ALU search */
  655. ksz_write32(dev, REG_SW_ALU_CTRL__4, ALU_START | ALU_SEARCH);
  656. do {
  657. timeout = 1000;
  658. do {
  659. ksz_read32(dev, REG_SW_ALU_CTRL__4, &ksz_data);
  660. if ((ksz_data & ALU_VALID) || !(ksz_data & ALU_START))
  661. break;
  662. usleep_range(1, 10);
  663. } while (timeout-- > 0);
  664. if (!timeout) {
  665. dev_dbg(dev->dev, "Failed to search ALU\n");
  666. ret = -ETIMEDOUT;
  667. goto exit;
  668. }
  669. /* read ALU table */
  670. read_table(ds, alu_table);
  671. convert_alu(&alu, alu_table);
  672. if (alu.port_forward & BIT(port)) {
  673. ret = cb(alu.mac, alu.fid, alu.is_static, data);
  674. if (ret)
  675. goto exit;
  676. }
  677. } while (ksz_data & ALU_START);
  678. exit:
  679. /* stop ALU search */
  680. ksz_write32(dev, REG_SW_ALU_CTRL__4, 0);
  681. mutex_unlock(&dev->alu_mutex);
  682. return ret;
  683. }
  684. static int ksz_port_mdb_prepare(struct dsa_switch *ds, int port,
  685. const struct switchdev_obj_port_mdb *mdb)
  686. {
  687. /* nothing to do */
  688. return 0;
  689. }
  690. static void ksz_port_mdb_add(struct dsa_switch *ds, int port,
  691. const struct switchdev_obj_port_mdb *mdb)
  692. {
  693. struct ksz_device *dev = ds->priv;
  694. u32 static_table[4];
  695. u32 data;
  696. int index;
  697. u32 mac_hi, mac_lo;
  698. mac_hi = ((mdb->addr[0] << 8) | mdb->addr[1]);
  699. mac_lo = ((mdb->addr[2] << 24) | (mdb->addr[3] << 16));
  700. mac_lo |= ((mdb->addr[4] << 8) | mdb->addr[5]);
  701. mutex_lock(&dev->alu_mutex);
  702. for (index = 0; index < dev->num_statics; index++) {
  703. /* find empty slot first */
  704. data = (index << ALU_STAT_INDEX_S) |
  705. ALU_STAT_READ | ALU_STAT_START;
  706. ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
  707. /* wait to be finished */
  708. if (wait_alu_sta_ready(dev, ALU_STAT_START, 1000) < 0) {
  709. dev_dbg(dev->dev, "Failed to read ALU STATIC\n");
  710. goto exit;
  711. }
  712. /* read ALU static table */
  713. read_table(ds, static_table);
  714. if (static_table[0] & ALU_V_STATIC_VALID) {
  715. /* check this has same vid & mac address */
  716. if (((static_table[2] >> ALU_V_FID_S) == (mdb->vid)) &&
  717. ((static_table[2] & ALU_V_MAC_ADDR_HI) == mac_hi) &&
  718. (static_table[3] == mac_lo)) {
  719. /* found matching one */
  720. break;
  721. }
  722. } else {
  723. /* found empty one */
  724. break;
  725. }
  726. }
  727. /* no available entry */
  728. if (index == dev->num_statics)
  729. goto exit;
  730. /* add entry */
  731. static_table[0] = ALU_V_STATIC_VALID;
  732. static_table[1] |= BIT(port);
  733. if (mdb->vid)
  734. static_table[1] |= ALU_V_USE_FID;
  735. static_table[2] = (mdb->vid << ALU_V_FID_S);
  736. static_table[2] |= mac_hi;
  737. static_table[3] = mac_lo;
  738. write_table(ds, static_table);
  739. data = (index << ALU_STAT_INDEX_S) | ALU_STAT_START;
  740. ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
  741. /* wait to be finished */
  742. if (wait_alu_sta_ready(dev, ALU_STAT_START, 1000) < 0)
  743. dev_dbg(dev->dev, "Failed to read ALU STATIC\n");
  744. exit:
  745. mutex_unlock(&dev->alu_mutex);
  746. }
  747. static int ksz_port_mdb_del(struct dsa_switch *ds, int port,
  748. const struct switchdev_obj_port_mdb *mdb)
  749. {
  750. struct ksz_device *dev = ds->priv;
  751. u32 static_table[4];
  752. u32 data;
  753. int index;
  754. int ret = 0;
  755. u32 mac_hi, mac_lo;
  756. mac_hi = ((mdb->addr[0] << 8) | mdb->addr[1]);
  757. mac_lo = ((mdb->addr[2] << 24) | (mdb->addr[3] << 16));
  758. mac_lo |= ((mdb->addr[4] << 8) | mdb->addr[5]);
  759. mutex_lock(&dev->alu_mutex);
  760. for (index = 0; index < dev->num_statics; index++) {
  761. /* find empty slot first */
  762. data = (index << ALU_STAT_INDEX_S) |
  763. ALU_STAT_READ | ALU_STAT_START;
  764. ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
  765. /* wait to be finished */
  766. ret = wait_alu_sta_ready(dev, ALU_STAT_START, 1000);
  767. if (ret < 0) {
  768. dev_dbg(dev->dev, "Failed to read ALU STATIC\n");
  769. goto exit;
  770. }
  771. /* read ALU static table */
  772. read_table(ds, static_table);
  773. if (static_table[0] & ALU_V_STATIC_VALID) {
  774. /* check this has same vid & mac address */
  775. if (((static_table[2] >> ALU_V_FID_S) == (mdb->vid)) &&
  776. ((static_table[2] & ALU_V_MAC_ADDR_HI) == mac_hi) &&
  777. (static_table[3] == mac_lo)) {
  778. /* found matching one */
  779. break;
  780. }
  781. }
  782. }
  783. /* no available entry */
  784. if (index == dev->num_statics) {
  785. ret = -EINVAL;
  786. goto exit;
  787. }
  788. /* clear port */
  789. static_table[1] &= ~BIT(port);
  790. if ((static_table[1] & ALU_V_PORT_MAP) == 0) {
  791. /* delete entry */
  792. static_table[0] = 0;
  793. static_table[1] = 0;
  794. static_table[2] = 0;
  795. static_table[3] = 0;
  796. }
  797. write_table(ds, static_table);
  798. data = (index << ALU_STAT_INDEX_S) | ALU_STAT_START;
  799. ksz_write32(dev, REG_SW_ALU_STAT_CTRL__4, data);
  800. /* wait to be finished */
  801. ret = wait_alu_sta_ready(dev, ALU_STAT_START, 1000);
  802. if (ret < 0)
  803. dev_dbg(dev->dev, "Failed to read ALU STATIC\n");
  804. exit:
  805. mutex_unlock(&dev->alu_mutex);
  806. return ret;
  807. }
  808. static int ksz_port_mirror_add(struct dsa_switch *ds, int port,
  809. struct dsa_mall_mirror_tc_entry *mirror,
  810. bool ingress)
  811. {
  812. struct ksz_device *dev = ds->priv;
  813. if (ingress)
  814. ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_RX, true);
  815. else
  816. ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_TX, true);
  817. ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_SNIFFER, false);
  818. /* configure mirror port */
  819. ksz_port_cfg(dev, mirror->to_local_port, P_MIRROR_CTRL,
  820. PORT_MIRROR_SNIFFER, true);
  821. ksz_cfg(dev, S_MIRROR_CTRL, SW_MIRROR_RX_TX, false);
  822. return 0;
  823. }
  824. static void ksz_port_mirror_del(struct dsa_switch *ds, int port,
  825. struct dsa_mall_mirror_tc_entry *mirror)
  826. {
  827. struct ksz_device *dev = ds->priv;
  828. u8 data;
  829. if (mirror->ingress)
  830. ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_RX, false);
  831. else
  832. ksz_port_cfg(dev, port, P_MIRROR_CTRL, PORT_MIRROR_TX, false);
  833. ksz_pread8(dev, port, P_MIRROR_CTRL, &data);
  834. if (!(data & (PORT_MIRROR_RX | PORT_MIRROR_TX)))
  835. ksz_port_cfg(dev, mirror->to_local_port, P_MIRROR_CTRL,
  836. PORT_MIRROR_SNIFFER, false);
  837. }
  838. static const struct dsa_switch_ops ksz_switch_ops = {
  839. .get_tag_protocol = ksz_get_tag_protocol,
  840. .setup = ksz_setup,
  841. .phy_read = ksz_phy_read16,
  842. .phy_write = ksz_phy_write16,
  843. .port_enable = ksz_enable_port,
  844. .port_disable = ksz_disable_port,
  845. .get_strings = ksz_get_strings,
  846. .get_ethtool_stats = ksz_get_ethtool_stats,
  847. .get_sset_count = ksz_sset_count,
  848. .port_stp_state_set = ksz_port_stp_state_set,
  849. .port_fast_age = ksz_port_fast_age,
  850. .port_vlan_filtering = ksz_port_vlan_filtering,
  851. .port_vlan_prepare = ksz_port_vlan_prepare,
  852. .port_vlan_add = ksz_port_vlan_add,
  853. .port_vlan_del = ksz_port_vlan_del,
  854. .port_fdb_dump = ksz_port_fdb_dump,
  855. .port_fdb_add = ksz_port_fdb_add,
  856. .port_fdb_del = ksz_port_fdb_del,
  857. .port_mdb_prepare = ksz_port_mdb_prepare,
  858. .port_mdb_add = ksz_port_mdb_add,
  859. .port_mdb_del = ksz_port_mdb_del,
  860. .port_mirror_add = ksz_port_mirror_add,
  861. .port_mirror_del = ksz_port_mirror_del,
  862. };
  863. struct ksz_chip_data {
  864. u32 chip_id;
  865. const char *dev_name;
  866. int num_vlans;
  867. int num_alus;
  868. int num_statics;
  869. int cpu_ports;
  870. int port_cnt;
  871. };
  872. static const struct ksz_chip_data ksz_switch_chips[] = {
  873. {
  874. .chip_id = 0x00947700,
  875. .dev_name = "KSZ9477",
  876. .num_vlans = 4096,
  877. .num_alus = 4096,
  878. .num_statics = 16,
  879. .cpu_ports = 0x7F, /* can be configured as cpu port */
  880. .port_cnt = 7, /* total physical port count */
  881. },
  882. };
  883. static int ksz_switch_init(struct ksz_device *dev)
  884. {
  885. int i;
  886. mutex_init(&dev->reg_mutex);
  887. mutex_init(&dev->stats_mutex);
  888. mutex_init(&dev->alu_mutex);
  889. mutex_init(&dev->vlan_mutex);
  890. dev->ds->ops = &ksz_switch_ops;
  891. for (i = 0; i < ARRAY_SIZE(ksz_switch_chips); i++) {
  892. const struct ksz_chip_data *chip = &ksz_switch_chips[i];
  893. if (dev->chip_id == chip->chip_id) {
  894. dev->name = chip->dev_name;
  895. dev->num_vlans = chip->num_vlans;
  896. dev->num_alus = chip->num_alus;
  897. dev->num_statics = chip->num_statics;
  898. dev->port_cnt = chip->port_cnt;
  899. dev->cpu_ports = chip->cpu_ports;
  900. break;
  901. }
  902. }
  903. /* no switch found */
  904. if (!dev->port_cnt)
  905. return -ENODEV;
  906. return 0;
  907. }
  908. struct ksz_device *ksz_switch_alloc(struct device *base,
  909. const struct ksz_io_ops *ops,
  910. void *priv)
  911. {
  912. struct dsa_switch *ds;
  913. struct ksz_device *swdev;
  914. ds = dsa_switch_alloc(base, DSA_MAX_PORTS);
  915. if (!ds)
  916. return NULL;
  917. swdev = devm_kzalloc(base, sizeof(*swdev), GFP_KERNEL);
  918. if (!swdev)
  919. return NULL;
  920. ds->priv = swdev;
  921. swdev->dev = base;
  922. swdev->ds = ds;
  923. swdev->priv = priv;
  924. swdev->ops = ops;
  925. return swdev;
  926. }
  927. EXPORT_SYMBOL(ksz_switch_alloc);
  928. int ksz_switch_detect(struct ksz_device *dev)
  929. {
  930. u8 data8;
  931. u32 id32;
  932. int ret;
  933. /* turn off SPI DO Edge select */
  934. ret = ksz_read8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, &data8);
  935. if (ret)
  936. return ret;
  937. data8 &= ~SPI_AUTO_EDGE_DETECTION;
  938. ret = ksz_write8(dev, REG_SW_GLOBAL_SERIAL_CTRL_0, data8);
  939. if (ret)
  940. return ret;
  941. /* read chip id */
  942. ret = ksz_read32(dev, REG_CHIP_ID0__1, &id32);
  943. if (ret)
  944. return ret;
  945. dev->chip_id = id32;
  946. return 0;
  947. }
  948. EXPORT_SYMBOL(ksz_switch_detect);
  949. int ksz_switch_register(struct ksz_device *dev)
  950. {
  951. int ret;
  952. if (dev->pdata)
  953. dev->chip_id = dev->pdata->chip_id;
  954. if (ksz_switch_detect(dev))
  955. return -EINVAL;
  956. ret = ksz_switch_init(dev);
  957. if (ret)
  958. return ret;
  959. return dsa_register_switch(dev->ds);
  960. }
  961. EXPORT_SYMBOL(ksz_switch_register);
  962. void ksz_switch_remove(struct ksz_device *dev)
  963. {
  964. dsa_unregister_switch(dev->ds);
  965. }
  966. EXPORT_SYMBOL(ksz_switch_remove);
  967. MODULE_AUTHOR("Woojung Huh <Woojung.Huh@microchip.com>");
  968. MODULE_DESCRIPTION("Microchip KSZ Series Switch DSA Driver");
  969. MODULE_LICENSE("GPL");