ll_temac_main.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. /*
  2. * Driver for Xilinx TEMAC Ethernet device
  3. *
  4. * Copyright (c) 2008 Nissin Systems Co., Ltd., Yoshio Kashiwagi
  5. * Copyright (c) 2005-2008 DLA Systems, David H. Lynch Jr. <dhlii@dlasys.net>
  6. * Copyright (c) 2008-2009 Secret Lab Technologies Ltd.
  7. *
  8. * This is a driver for the Xilinx ll_temac ipcore which is often used
  9. * in the Virtex and Spartan series of chips.
  10. *
  11. * Notes:
  12. * - The ll_temac hardware uses indirect access for many of the TEMAC
  13. * registers, include the MDIO bus. However, indirect access to MDIO
  14. * registers take considerably more clock cycles than to TEMAC registers.
  15. * MDIO accesses are long, so threads doing them should probably sleep
  16. * rather than busywait. However, since only one indirect access can be
  17. * in progress at any given time, that means that *all* indirect accesses
  18. * could end up sleeping (to wait for an MDIO access to complete).
  19. * Fortunately none of the indirect accesses are on the 'hot' path for tx
  20. * or rx, so this should be okay.
  21. *
  22. * TODO:
  23. * - Factor out locallink DMA code into separate driver
  24. * - Fix multicast assignment.
  25. * - Fix support for hardware checksumming.
  26. * - Testing. Lots and lots of testing.
  27. *
  28. */
  29. #include <linux/delay.h>
  30. #include <linux/etherdevice.h>
  31. #include <linux/mii.h>
  32. #include <linux/module.h>
  33. #include <linux/mutex.h>
  34. #include <linux/netdevice.h>
  35. #include <linux/of.h>
  36. #include <linux/of_device.h>
  37. #include <linux/of_irq.h>
  38. #include <linux/of_mdio.h>
  39. #include <linux/of_platform.h>
  40. #include <linux/of_address.h>
  41. #include <linux/skbuff.h>
  42. #include <linux/spinlock.h>
  43. #include <linux/tcp.h> /* needed for sizeof(tcphdr) */
  44. #include <linux/udp.h> /* needed for sizeof(udphdr) */
  45. #include <linux/phy.h>
  46. #include <linux/in.h>
  47. #include <linux/io.h>
  48. #include <linux/ip.h>
  49. #include <linux/slab.h>
  50. #include <linux/interrupt.h>
  51. #include <linux/dma-mapping.h>
  52. #include "ll_temac.h"
  53. #define TX_BD_NUM 64
  54. #define RX_BD_NUM 128
  55. /* ---------------------------------------------------------------------
  56. * Low level register access functions
  57. */
  58. u32 temac_ior(struct temac_local *lp, int offset)
  59. {
  60. return in_be32((u32 *)(lp->regs + offset));
  61. }
  62. void temac_iow(struct temac_local *lp, int offset, u32 value)
  63. {
  64. out_be32((u32 *) (lp->regs + offset), value);
  65. }
  66. int temac_indirect_busywait(struct temac_local *lp)
  67. {
  68. unsigned long end = jiffies + 2;
  69. while (!(temac_ior(lp, XTE_RDY0_OFFSET) & XTE_RDY0_HARD_ACS_RDY_MASK)) {
  70. if (time_before_eq(end, jiffies)) {
  71. WARN_ON(1);
  72. return -ETIMEDOUT;
  73. }
  74. msleep(1);
  75. }
  76. return 0;
  77. }
  78. /**
  79. * temac_indirect_in32
  80. *
  81. * lp->indirect_mutex must be held when calling this function
  82. */
  83. u32 temac_indirect_in32(struct temac_local *lp, int reg)
  84. {
  85. u32 val;
  86. if (temac_indirect_busywait(lp))
  87. return -ETIMEDOUT;
  88. temac_iow(lp, XTE_CTL0_OFFSET, reg);
  89. if (temac_indirect_busywait(lp))
  90. return -ETIMEDOUT;
  91. val = temac_ior(lp, XTE_LSW0_OFFSET);
  92. return val;
  93. }
  94. /**
  95. * temac_indirect_out32
  96. *
  97. * lp->indirect_mutex must be held when calling this function
  98. */
  99. void temac_indirect_out32(struct temac_local *lp, int reg, u32 value)
  100. {
  101. if (temac_indirect_busywait(lp))
  102. return;
  103. temac_iow(lp, XTE_LSW0_OFFSET, value);
  104. temac_iow(lp, XTE_CTL0_OFFSET, CNTLREG_WRITE_ENABLE_MASK | reg);
  105. temac_indirect_busywait(lp);
  106. }
  107. /**
  108. * temac_dma_in32 - Memory mapped DMA read, this function expects a
  109. * register input that is based on DCR word addresses which
  110. * are then converted to memory mapped byte addresses
  111. */
  112. static u32 temac_dma_in32(struct temac_local *lp, int reg)
  113. {
  114. return in_be32((u32 *)(lp->sdma_regs + (reg << 2)));
  115. }
  116. /**
  117. * temac_dma_out32 - Memory mapped DMA read, this function expects a
  118. * register input that is based on DCR word addresses which
  119. * are then converted to memory mapped byte addresses
  120. */
  121. static void temac_dma_out32(struct temac_local *lp, int reg, u32 value)
  122. {
  123. out_be32((u32 *)(lp->sdma_regs + (reg << 2)), value);
  124. }
  125. /* DMA register access functions can be DCR based or memory mapped.
  126. * The PowerPC 440 is DCR based, the PowerPC 405 and MicroBlaze are both
  127. * memory mapped.
  128. */
  129. #ifdef CONFIG_PPC_DCR
  130. /**
  131. * temac_dma_dcr_in32 - DCR based DMA read
  132. */
  133. static u32 temac_dma_dcr_in(struct temac_local *lp, int reg)
  134. {
  135. return dcr_read(lp->sdma_dcrs, reg);
  136. }
  137. /**
  138. * temac_dma_dcr_out32 - DCR based DMA write
  139. */
  140. static void temac_dma_dcr_out(struct temac_local *lp, int reg, u32 value)
  141. {
  142. dcr_write(lp->sdma_dcrs, reg, value);
  143. }
  144. /**
  145. * temac_dcr_setup - If the DMA is DCR based, then setup the address and
  146. * I/O functions
  147. */
  148. static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op,
  149. struct device_node *np)
  150. {
  151. unsigned int dcrs;
  152. /* setup the dcr address mapping if it's in the device tree */
  153. dcrs = dcr_resource_start(np, 0);
  154. if (dcrs != 0) {
  155. lp->sdma_dcrs = dcr_map(np, dcrs, dcr_resource_len(np, 0));
  156. lp->dma_in = temac_dma_dcr_in;
  157. lp->dma_out = temac_dma_dcr_out;
  158. dev_dbg(&op->dev, "DCR base: %x\n", dcrs);
  159. return 0;
  160. }
  161. /* no DCR in the device tree, indicate a failure */
  162. return -1;
  163. }
  164. #else
  165. /*
  166. * temac_dcr_setup - This is a stub for when DCR is not supported,
  167. * such as with MicroBlaze
  168. */
  169. static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op,
  170. struct device_node *np)
  171. {
  172. return -1;
  173. }
  174. #endif
  175. /**
  176. * temac_dma_bd_release - Release buffer descriptor rings
  177. */
  178. static void temac_dma_bd_release(struct net_device *ndev)
  179. {
  180. struct temac_local *lp = netdev_priv(ndev);
  181. int i;
  182. /* Reset Local Link (DMA) */
  183. lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
  184. for (i = 0; i < RX_BD_NUM; i++) {
  185. if (!lp->rx_skb[i])
  186. break;
  187. else {
  188. dma_unmap_single(ndev->dev.parent, lp->rx_bd_v[i].phys,
  189. XTE_MAX_JUMBO_FRAME_SIZE, DMA_FROM_DEVICE);
  190. dev_kfree_skb(lp->rx_skb[i]);
  191. }
  192. }
  193. if (lp->rx_bd_v)
  194. dma_free_coherent(ndev->dev.parent,
  195. sizeof(*lp->rx_bd_v) * RX_BD_NUM,
  196. lp->rx_bd_v, lp->rx_bd_p);
  197. if (lp->tx_bd_v)
  198. dma_free_coherent(ndev->dev.parent,
  199. sizeof(*lp->tx_bd_v) * TX_BD_NUM,
  200. lp->tx_bd_v, lp->tx_bd_p);
  201. kfree(lp->rx_skb);
  202. }
  203. /**
  204. * temac_dma_bd_init - Setup buffer descriptor rings
  205. */
  206. static int temac_dma_bd_init(struct net_device *ndev)
  207. {
  208. struct temac_local *lp = netdev_priv(ndev);
  209. struct sk_buff *skb;
  210. int i;
  211. lp->rx_skb = kcalloc(RX_BD_NUM, sizeof(*lp->rx_skb), GFP_KERNEL);
  212. if (!lp->rx_skb)
  213. goto out;
  214. /* allocate the tx and rx ring buffer descriptors. */
  215. /* returns a virtual address and a physical address. */
  216. lp->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
  217. sizeof(*lp->tx_bd_v) * TX_BD_NUM,
  218. &lp->tx_bd_p, GFP_KERNEL);
  219. if (!lp->tx_bd_v)
  220. goto out;
  221. lp->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
  222. sizeof(*lp->rx_bd_v) * RX_BD_NUM,
  223. &lp->rx_bd_p, GFP_KERNEL);
  224. if (!lp->rx_bd_v)
  225. goto out;
  226. for (i = 0; i < TX_BD_NUM; i++) {
  227. lp->tx_bd_v[i].next = lp->tx_bd_p +
  228. sizeof(*lp->tx_bd_v) * ((i + 1) % TX_BD_NUM);
  229. }
  230. for (i = 0; i < RX_BD_NUM; i++) {
  231. lp->rx_bd_v[i].next = lp->rx_bd_p +
  232. sizeof(*lp->rx_bd_v) * ((i + 1) % RX_BD_NUM);
  233. skb = netdev_alloc_skb_ip_align(ndev,
  234. XTE_MAX_JUMBO_FRAME_SIZE);
  235. if (!skb)
  236. goto out;
  237. lp->rx_skb[i] = skb;
  238. /* returns physical address of skb->data */
  239. lp->rx_bd_v[i].phys = dma_map_single(ndev->dev.parent,
  240. skb->data,
  241. XTE_MAX_JUMBO_FRAME_SIZE,
  242. DMA_FROM_DEVICE);
  243. lp->rx_bd_v[i].len = XTE_MAX_JUMBO_FRAME_SIZE;
  244. lp->rx_bd_v[i].app0 = STS_CTRL_APP0_IRQONEND;
  245. }
  246. lp->dma_out(lp, TX_CHNL_CTRL, 0x10220400 |
  247. CHNL_CTRL_IRQ_EN |
  248. CHNL_CTRL_IRQ_DLY_EN |
  249. CHNL_CTRL_IRQ_COAL_EN);
  250. /* 0x10220483 */
  251. /* 0x00100483 */
  252. lp->dma_out(lp, RX_CHNL_CTRL, 0xff070000 |
  253. CHNL_CTRL_IRQ_EN |
  254. CHNL_CTRL_IRQ_DLY_EN |
  255. CHNL_CTRL_IRQ_COAL_EN |
  256. CHNL_CTRL_IRQ_IOE);
  257. /* 0xff010283 */
  258. lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p);
  259. lp->dma_out(lp, RX_TAILDESC_PTR,
  260. lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * (RX_BD_NUM - 1)));
  261. lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p);
  262. /* Init descriptor indexes */
  263. lp->tx_bd_ci = 0;
  264. lp->tx_bd_next = 0;
  265. lp->tx_bd_tail = 0;
  266. lp->rx_bd_ci = 0;
  267. return 0;
  268. out:
  269. temac_dma_bd_release(ndev);
  270. return -ENOMEM;
  271. }
  272. /* ---------------------------------------------------------------------
  273. * net_device_ops
  274. */
  275. static void temac_do_set_mac_address(struct net_device *ndev)
  276. {
  277. struct temac_local *lp = netdev_priv(ndev);
  278. /* set up unicast MAC address filter set its mac address */
  279. mutex_lock(&lp->indirect_mutex);
  280. temac_indirect_out32(lp, XTE_UAW0_OFFSET,
  281. (ndev->dev_addr[0]) |
  282. (ndev->dev_addr[1] << 8) |
  283. (ndev->dev_addr[2] << 16) |
  284. (ndev->dev_addr[3] << 24));
  285. /* There are reserved bits in EUAW1
  286. * so don't affect them Set MAC bits [47:32] in EUAW1 */
  287. temac_indirect_out32(lp, XTE_UAW1_OFFSET,
  288. (ndev->dev_addr[4] & 0x000000ff) |
  289. (ndev->dev_addr[5] << 8));
  290. mutex_unlock(&lp->indirect_mutex);
  291. }
  292. static int temac_init_mac_address(struct net_device *ndev, void *address)
  293. {
  294. memcpy(ndev->dev_addr, address, ETH_ALEN);
  295. if (!is_valid_ether_addr(ndev->dev_addr))
  296. eth_hw_addr_random(ndev);
  297. temac_do_set_mac_address(ndev);
  298. return 0;
  299. }
  300. static int temac_set_mac_address(struct net_device *ndev, void *p)
  301. {
  302. struct sockaddr *addr = p;
  303. if (!is_valid_ether_addr(addr->sa_data))
  304. return -EADDRNOTAVAIL;
  305. memcpy(ndev->dev_addr, addr->sa_data, ETH_ALEN);
  306. temac_do_set_mac_address(ndev);
  307. return 0;
  308. }
  309. static void temac_set_multicast_list(struct net_device *ndev)
  310. {
  311. struct temac_local *lp = netdev_priv(ndev);
  312. u32 multi_addr_msw, multi_addr_lsw, val;
  313. int i;
  314. mutex_lock(&lp->indirect_mutex);
  315. if (ndev->flags & (IFF_ALLMULTI | IFF_PROMISC) ||
  316. netdev_mc_count(ndev) > MULTICAST_CAM_TABLE_NUM) {
  317. /*
  318. * We must make the kernel realise we had to move
  319. * into promisc mode or we start all out war on
  320. * the cable. If it was a promisc request the
  321. * flag is already set. If not we assert it.
  322. */
  323. ndev->flags |= IFF_PROMISC;
  324. temac_indirect_out32(lp, XTE_AFM_OFFSET, XTE_AFM_EPPRM_MASK);
  325. dev_info(&ndev->dev, "Promiscuous mode enabled.\n");
  326. } else if (!netdev_mc_empty(ndev)) {
  327. struct netdev_hw_addr *ha;
  328. i = 0;
  329. netdev_for_each_mc_addr(ha, ndev) {
  330. if (i >= MULTICAST_CAM_TABLE_NUM)
  331. break;
  332. multi_addr_msw = ((ha->addr[3] << 24) |
  333. (ha->addr[2] << 16) |
  334. (ha->addr[1] << 8) |
  335. (ha->addr[0]));
  336. temac_indirect_out32(lp, XTE_MAW0_OFFSET,
  337. multi_addr_msw);
  338. multi_addr_lsw = ((ha->addr[5] << 8) |
  339. (ha->addr[4]) | (i << 16));
  340. temac_indirect_out32(lp, XTE_MAW1_OFFSET,
  341. multi_addr_lsw);
  342. i++;
  343. }
  344. } else {
  345. val = temac_indirect_in32(lp, XTE_AFM_OFFSET);
  346. temac_indirect_out32(lp, XTE_AFM_OFFSET,
  347. val & ~XTE_AFM_EPPRM_MASK);
  348. temac_indirect_out32(lp, XTE_MAW0_OFFSET, 0);
  349. temac_indirect_out32(lp, XTE_MAW1_OFFSET, 0);
  350. dev_info(&ndev->dev, "Promiscuous mode disabled.\n");
  351. }
  352. mutex_unlock(&lp->indirect_mutex);
  353. }
  354. struct temac_option {
  355. int flg;
  356. u32 opt;
  357. u32 reg;
  358. u32 m_or;
  359. u32 m_and;
  360. } temac_options[] = {
  361. /* Turn on jumbo packet support for both Rx and Tx */
  362. {
  363. .opt = XTE_OPTION_JUMBO,
  364. .reg = XTE_TXC_OFFSET,
  365. .m_or = XTE_TXC_TXJMBO_MASK,
  366. },
  367. {
  368. .opt = XTE_OPTION_JUMBO,
  369. .reg = XTE_RXC1_OFFSET,
  370. .m_or =XTE_RXC1_RXJMBO_MASK,
  371. },
  372. /* Turn on VLAN packet support for both Rx and Tx */
  373. {
  374. .opt = XTE_OPTION_VLAN,
  375. .reg = XTE_TXC_OFFSET,
  376. .m_or =XTE_TXC_TXVLAN_MASK,
  377. },
  378. {
  379. .opt = XTE_OPTION_VLAN,
  380. .reg = XTE_RXC1_OFFSET,
  381. .m_or =XTE_RXC1_RXVLAN_MASK,
  382. },
  383. /* Turn on FCS stripping on receive packets */
  384. {
  385. .opt = XTE_OPTION_FCS_STRIP,
  386. .reg = XTE_RXC1_OFFSET,
  387. .m_or =XTE_RXC1_RXFCS_MASK,
  388. },
  389. /* Turn on FCS insertion on transmit packets */
  390. {
  391. .opt = XTE_OPTION_FCS_INSERT,
  392. .reg = XTE_TXC_OFFSET,
  393. .m_or =XTE_TXC_TXFCS_MASK,
  394. },
  395. /* Turn on length/type field checking on receive packets */
  396. {
  397. .opt = XTE_OPTION_LENTYPE_ERR,
  398. .reg = XTE_RXC1_OFFSET,
  399. .m_or =XTE_RXC1_RXLT_MASK,
  400. },
  401. /* Turn on flow control */
  402. {
  403. .opt = XTE_OPTION_FLOW_CONTROL,
  404. .reg = XTE_FCC_OFFSET,
  405. .m_or =XTE_FCC_RXFLO_MASK,
  406. },
  407. /* Turn on flow control */
  408. {
  409. .opt = XTE_OPTION_FLOW_CONTROL,
  410. .reg = XTE_FCC_OFFSET,
  411. .m_or =XTE_FCC_TXFLO_MASK,
  412. },
  413. /* Turn on promiscuous frame filtering (all frames are received ) */
  414. {
  415. .opt = XTE_OPTION_PROMISC,
  416. .reg = XTE_AFM_OFFSET,
  417. .m_or =XTE_AFM_EPPRM_MASK,
  418. },
  419. /* Enable transmitter if not already enabled */
  420. {
  421. .opt = XTE_OPTION_TXEN,
  422. .reg = XTE_TXC_OFFSET,
  423. .m_or =XTE_TXC_TXEN_MASK,
  424. },
  425. /* Enable receiver? */
  426. {
  427. .opt = XTE_OPTION_RXEN,
  428. .reg = XTE_RXC1_OFFSET,
  429. .m_or =XTE_RXC1_RXEN_MASK,
  430. },
  431. {}
  432. };
  433. /**
  434. * temac_setoptions
  435. */
  436. static u32 temac_setoptions(struct net_device *ndev, u32 options)
  437. {
  438. struct temac_local *lp = netdev_priv(ndev);
  439. struct temac_option *tp = &temac_options[0];
  440. int reg;
  441. mutex_lock(&lp->indirect_mutex);
  442. while (tp->opt) {
  443. reg = temac_indirect_in32(lp, tp->reg) & ~tp->m_or;
  444. if (options & tp->opt)
  445. reg |= tp->m_or;
  446. temac_indirect_out32(lp, tp->reg, reg);
  447. tp++;
  448. }
  449. lp->options |= options;
  450. mutex_unlock(&lp->indirect_mutex);
  451. return 0;
  452. }
  453. /* Initialize temac */
  454. static void temac_device_reset(struct net_device *ndev)
  455. {
  456. struct temac_local *lp = netdev_priv(ndev);
  457. u32 timeout;
  458. u32 val;
  459. /* Perform a software reset */
  460. /* 0x300 host enable bit ? */
  461. /* reset PHY through control register ?:1 */
  462. dev_dbg(&ndev->dev, "%s()\n", __func__);
  463. mutex_lock(&lp->indirect_mutex);
  464. /* Reset the receiver and wait for it to finish reset */
  465. temac_indirect_out32(lp, XTE_RXC1_OFFSET, XTE_RXC1_RXRST_MASK);
  466. timeout = 1000;
  467. while (temac_indirect_in32(lp, XTE_RXC1_OFFSET) & XTE_RXC1_RXRST_MASK) {
  468. udelay(1);
  469. if (--timeout == 0) {
  470. dev_err(&ndev->dev,
  471. "temac_device_reset RX reset timeout!!\n");
  472. break;
  473. }
  474. }
  475. /* Reset the transmitter and wait for it to finish reset */
  476. temac_indirect_out32(lp, XTE_TXC_OFFSET, XTE_TXC_TXRST_MASK);
  477. timeout = 1000;
  478. while (temac_indirect_in32(lp, XTE_TXC_OFFSET) & XTE_TXC_TXRST_MASK) {
  479. udelay(1);
  480. if (--timeout == 0) {
  481. dev_err(&ndev->dev,
  482. "temac_device_reset TX reset timeout!!\n");
  483. break;
  484. }
  485. }
  486. /* Disable the receiver */
  487. val = temac_indirect_in32(lp, XTE_RXC1_OFFSET);
  488. temac_indirect_out32(lp, XTE_RXC1_OFFSET, val & ~XTE_RXC1_RXEN_MASK);
  489. /* Reset Local Link (DMA) */
  490. lp->dma_out(lp, DMA_CONTROL_REG, DMA_CONTROL_RST);
  491. timeout = 1000;
  492. while (lp->dma_in(lp, DMA_CONTROL_REG) & DMA_CONTROL_RST) {
  493. udelay(1);
  494. if (--timeout == 0) {
  495. dev_err(&ndev->dev,
  496. "temac_device_reset DMA reset timeout!!\n");
  497. break;
  498. }
  499. }
  500. lp->dma_out(lp, DMA_CONTROL_REG, DMA_TAIL_ENABLE);
  501. if (temac_dma_bd_init(ndev)) {
  502. dev_err(&ndev->dev,
  503. "temac_device_reset descriptor allocation failed\n");
  504. }
  505. temac_indirect_out32(lp, XTE_RXC0_OFFSET, 0);
  506. temac_indirect_out32(lp, XTE_RXC1_OFFSET, 0);
  507. temac_indirect_out32(lp, XTE_TXC_OFFSET, 0);
  508. temac_indirect_out32(lp, XTE_FCC_OFFSET, XTE_FCC_RXFLO_MASK);
  509. mutex_unlock(&lp->indirect_mutex);
  510. /* Sync default options with HW
  511. * but leave receiver and transmitter disabled. */
  512. temac_setoptions(ndev,
  513. lp->options & ~(XTE_OPTION_TXEN | XTE_OPTION_RXEN));
  514. temac_do_set_mac_address(ndev);
  515. /* Set address filter table */
  516. temac_set_multicast_list(ndev);
  517. if (temac_setoptions(ndev, lp->options))
  518. dev_err(&ndev->dev, "Error setting TEMAC options\n");
  519. /* Init Driver variable */
  520. ndev->trans_start = jiffies; /* prevent tx timeout */
  521. }
  522. void temac_adjust_link(struct net_device *ndev)
  523. {
  524. struct temac_local *lp = netdev_priv(ndev);
  525. struct phy_device *phy = lp->phy_dev;
  526. u32 mii_speed;
  527. int link_state;
  528. /* hash together the state values to decide if something has changed */
  529. link_state = phy->speed | (phy->duplex << 1) | phy->link;
  530. mutex_lock(&lp->indirect_mutex);
  531. if (lp->last_link != link_state) {
  532. mii_speed = temac_indirect_in32(lp, XTE_EMCFG_OFFSET);
  533. mii_speed &= ~XTE_EMCFG_LINKSPD_MASK;
  534. switch (phy->speed) {
  535. case SPEED_1000: mii_speed |= XTE_EMCFG_LINKSPD_1000; break;
  536. case SPEED_100: mii_speed |= XTE_EMCFG_LINKSPD_100; break;
  537. case SPEED_10: mii_speed |= XTE_EMCFG_LINKSPD_10; break;
  538. }
  539. /* Write new speed setting out to TEMAC */
  540. temac_indirect_out32(lp, XTE_EMCFG_OFFSET, mii_speed);
  541. lp->last_link = link_state;
  542. phy_print_status(phy);
  543. }
  544. mutex_unlock(&lp->indirect_mutex);
  545. }
  546. static void temac_start_xmit_done(struct net_device *ndev)
  547. {
  548. struct temac_local *lp = netdev_priv(ndev);
  549. struct cdmac_bd *cur_p;
  550. unsigned int stat = 0;
  551. cur_p = &lp->tx_bd_v[lp->tx_bd_ci];
  552. stat = cur_p->app0;
  553. while (stat & STS_CTRL_APP0_CMPLT) {
  554. dma_unmap_single(ndev->dev.parent, cur_p->phys, cur_p->len,
  555. DMA_TO_DEVICE);
  556. if (cur_p->app4)
  557. dev_kfree_skb_irq((struct sk_buff *)cur_p->app4);
  558. cur_p->app0 = 0;
  559. cur_p->app1 = 0;
  560. cur_p->app2 = 0;
  561. cur_p->app3 = 0;
  562. cur_p->app4 = 0;
  563. ndev->stats.tx_packets++;
  564. ndev->stats.tx_bytes += cur_p->len;
  565. lp->tx_bd_ci++;
  566. if (lp->tx_bd_ci >= TX_BD_NUM)
  567. lp->tx_bd_ci = 0;
  568. cur_p = &lp->tx_bd_v[lp->tx_bd_ci];
  569. stat = cur_p->app0;
  570. }
  571. netif_wake_queue(ndev);
  572. }
  573. static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag)
  574. {
  575. struct cdmac_bd *cur_p;
  576. int tail;
  577. tail = lp->tx_bd_tail;
  578. cur_p = &lp->tx_bd_v[tail];
  579. do {
  580. if (cur_p->app0)
  581. return NETDEV_TX_BUSY;
  582. tail++;
  583. if (tail >= TX_BD_NUM)
  584. tail = 0;
  585. cur_p = &lp->tx_bd_v[tail];
  586. num_frag--;
  587. } while (num_frag >= 0);
  588. return 0;
  589. }
  590. static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
  591. {
  592. struct temac_local *lp = netdev_priv(ndev);
  593. struct cdmac_bd *cur_p;
  594. dma_addr_t start_p, tail_p;
  595. int ii;
  596. unsigned long num_frag;
  597. skb_frag_t *frag;
  598. num_frag = skb_shinfo(skb)->nr_frags;
  599. frag = &skb_shinfo(skb)->frags[0];
  600. start_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail;
  601. cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
  602. if (temac_check_tx_bd_space(lp, num_frag)) {
  603. if (!netif_queue_stopped(ndev)) {
  604. netif_stop_queue(ndev);
  605. return NETDEV_TX_BUSY;
  606. }
  607. return NETDEV_TX_BUSY;
  608. }
  609. cur_p->app0 = 0;
  610. if (skb->ip_summed == CHECKSUM_PARTIAL) {
  611. unsigned int csum_start_off = skb_checksum_start_offset(skb);
  612. unsigned int csum_index_off = csum_start_off + skb->csum_offset;
  613. cur_p->app0 |= 1; /* TX Checksum Enabled */
  614. cur_p->app1 = (csum_start_off << 16) | csum_index_off;
  615. cur_p->app2 = 0; /* initial checksum seed */
  616. }
  617. cur_p->app0 |= STS_CTRL_APP0_SOP;
  618. cur_p->len = skb_headlen(skb);
  619. cur_p->phys = dma_map_single(ndev->dev.parent, skb->data, skb->len,
  620. DMA_TO_DEVICE);
  621. cur_p->app4 = (unsigned long)skb;
  622. for (ii = 0; ii < num_frag; ii++) {
  623. lp->tx_bd_tail++;
  624. if (lp->tx_bd_tail >= TX_BD_NUM)
  625. lp->tx_bd_tail = 0;
  626. cur_p = &lp->tx_bd_v[lp->tx_bd_tail];
  627. cur_p->phys = dma_map_single(ndev->dev.parent,
  628. skb_frag_address(frag),
  629. skb_frag_size(frag), DMA_TO_DEVICE);
  630. cur_p->len = skb_frag_size(frag);
  631. cur_p->app0 = 0;
  632. frag++;
  633. }
  634. cur_p->app0 |= STS_CTRL_APP0_EOP;
  635. tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail;
  636. lp->tx_bd_tail++;
  637. if (lp->tx_bd_tail >= TX_BD_NUM)
  638. lp->tx_bd_tail = 0;
  639. skb_tx_timestamp(skb);
  640. /* Kick off the transfer */
  641. lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
  642. return NETDEV_TX_OK;
  643. }
  644. static void ll_temac_recv(struct net_device *ndev)
  645. {
  646. struct temac_local *lp = netdev_priv(ndev);
  647. struct sk_buff *skb, *new_skb;
  648. unsigned int bdstat;
  649. struct cdmac_bd *cur_p;
  650. dma_addr_t tail_p;
  651. int length;
  652. unsigned long flags;
  653. spin_lock_irqsave(&lp->rx_lock, flags);
  654. tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci;
  655. cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
  656. bdstat = cur_p->app0;
  657. while ((bdstat & STS_CTRL_APP0_CMPLT)) {
  658. skb = lp->rx_skb[lp->rx_bd_ci];
  659. length = cur_p->app4 & 0x3FFF;
  660. dma_unmap_single(ndev->dev.parent, cur_p->phys, length,
  661. DMA_FROM_DEVICE);
  662. skb_put(skb, length);
  663. skb->protocol = eth_type_trans(skb, ndev);
  664. skb_checksum_none_assert(skb);
  665. /* if we're doing rx csum offload, set it up */
  666. if (((lp->temac_features & TEMAC_FEATURE_RX_CSUM) != 0) &&
  667. (skb->protocol == htons(ETH_P_IP)) &&
  668. (skb->len > 64)) {
  669. skb->csum = cur_p->app3 & 0xFFFF;
  670. skb->ip_summed = CHECKSUM_COMPLETE;
  671. }
  672. if (!skb_defer_rx_timestamp(skb))
  673. netif_rx(skb);
  674. ndev->stats.rx_packets++;
  675. ndev->stats.rx_bytes += length;
  676. new_skb = netdev_alloc_skb_ip_align(ndev,
  677. XTE_MAX_JUMBO_FRAME_SIZE);
  678. if (!new_skb) {
  679. spin_unlock_irqrestore(&lp->rx_lock, flags);
  680. return;
  681. }
  682. cur_p->app0 = STS_CTRL_APP0_IRQONEND;
  683. cur_p->phys = dma_map_single(ndev->dev.parent, new_skb->data,
  684. XTE_MAX_JUMBO_FRAME_SIZE,
  685. DMA_FROM_DEVICE);
  686. cur_p->len = XTE_MAX_JUMBO_FRAME_SIZE;
  687. lp->rx_skb[lp->rx_bd_ci] = new_skb;
  688. lp->rx_bd_ci++;
  689. if (lp->rx_bd_ci >= RX_BD_NUM)
  690. lp->rx_bd_ci = 0;
  691. cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
  692. bdstat = cur_p->app0;
  693. }
  694. lp->dma_out(lp, RX_TAILDESC_PTR, tail_p);
  695. spin_unlock_irqrestore(&lp->rx_lock, flags);
  696. }
  697. static irqreturn_t ll_temac_tx_irq(int irq, void *_ndev)
  698. {
  699. struct net_device *ndev = _ndev;
  700. struct temac_local *lp = netdev_priv(ndev);
  701. unsigned int status;
  702. status = lp->dma_in(lp, TX_IRQ_REG);
  703. lp->dma_out(lp, TX_IRQ_REG, status);
  704. if (status & (IRQ_COAL | IRQ_DLY))
  705. temac_start_xmit_done(lp->ndev);
  706. if (status & 0x080)
  707. dev_err(&ndev->dev, "DMA error 0x%x\n", status);
  708. return IRQ_HANDLED;
  709. }
  710. static irqreturn_t ll_temac_rx_irq(int irq, void *_ndev)
  711. {
  712. struct net_device *ndev = _ndev;
  713. struct temac_local *lp = netdev_priv(ndev);
  714. unsigned int status;
  715. /* Read and clear the status registers */
  716. status = lp->dma_in(lp, RX_IRQ_REG);
  717. lp->dma_out(lp, RX_IRQ_REG, status);
  718. if (status & (IRQ_COAL | IRQ_DLY))
  719. ll_temac_recv(lp->ndev);
  720. return IRQ_HANDLED;
  721. }
  722. static int temac_open(struct net_device *ndev)
  723. {
  724. struct temac_local *lp = netdev_priv(ndev);
  725. int rc;
  726. dev_dbg(&ndev->dev, "temac_open()\n");
  727. if (lp->phy_node) {
  728. lp->phy_dev = of_phy_connect(lp->ndev, lp->phy_node,
  729. temac_adjust_link, 0, 0);
  730. if (!lp->phy_dev) {
  731. dev_err(lp->dev, "of_phy_connect() failed\n");
  732. return -ENODEV;
  733. }
  734. phy_start(lp->phy_dev);
  735. }
  736. temac_device_reset(ndev);
  737. rc = request_irq(lp->tx_irq, ll_temac_tx_irq, 0, ndev->name, ndev);
  738. if (rc)
  739. goto err_tx_irq;
  740. rc = request_irq(lp->rx_irq, ll_temac_rx_irq, 0, ndev->name, ndev);
  741. if (rc)
  742. goto err_rx_irq;
  743. return 0;
  744. err_rx_irq:
  745. free_irq(lp->tx_irq, ndev);
  746. err_tx_irq:
  747. if (lp->phy_dev)
  748. phy_disconnect(lp->phy_dev);
  749. lp->phy_dev = NULL;
  750. dev_err(lp->dev, "request_irq() failed\n");
  751. return rc;
  752. }
  753. static int temac_stop(struct net_device *ndev)
  754. {
  755. struct temac_local *lp = netdev_priv(ndev);
  756. dev_dbg(&ndev->dev, "temac_close()\n");
  757. free_irq(lp->tx_irq, ndev);
  758. free_irq(lp->rx_irq, ndev);
  759. if (lp->phy_dev)
  760. phy_disconnect(lp->phy_dev);
  761. lp->phy_dev = NULL;
  762. temac_dma_bd_release(ndev);
  763. return 0;
  764. }
  765. #ifdef CONFIG_NET_POLL_CONTROLLER
  766. static void
  767. temac_poll_controller(struct net_device *ndev)
  768. {
  769. struct temac_local *lp = netdev_priv(ndev);
  770. disable_irq(lp->tx_irq);
  771. disable_irq(lp->rx_irq);
  772. ll_temac_rx_irq(lp->tx_irq, ndev);
  773. ll_temac_tx_irq(lp->rx_irq, ndev);
  774. enable_irq(lp->tx_irq);
  775. enable_irq(lp->rx_irq);
  776. }
  777. #endif
  778. static int temac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
  779. {
  780. struct temac_local *lp = netdev_priv(ndev);
  781. if (!netif_running(ndev))
  782. return -EINVAL;
  783. if (!lp->phy_dev)
  784. return -EINVAL;
  785. return phy_mii_ioctl(lp->phy_dev, rq, cmd);
  786. }
  787. static const struct net_device_ops temac_netdev_ops = {
  788. .ndo_open = temac_open,
  789. .ndo_stop = temac_stop,
  790. .ndo_start_xmit = temac_start_xmit,
  791. .ndo_set_mac_address = temac_set_mac_address,
  792. .ndo_validate_addr = eth_validate_addr,
  793. .ndo_do_ioctl = temac_ioctl,
  794. #ifdef CONFIG_NET_POLL_CONTROLLER
  795. .ndo_poll_controller = temac_poll_controller,
  796. #endif
  797. };
  798. /* ---------------------------------------------------------------------
  799. * SYSFS device attributes
  800. */
  801. static ssize_t temac_show_llink_regs(struct device *dev,
  802. struct device_attribute *attr, char *buf)
  803. {
  804. struct net_device *ndev = dev_get_drvdata(dev);
  805. struct temac_local *lp = netdev_priv(ndev);
  806. int i, len = 0;
  807. for (i = 0; i < 0x11; i++)
  808. len += sprintf(buf + len, "%.8x%s", lp->dma_in(lp, i),
  809. (i % 8) == 7 ? "\n" : " ");
  810. len += sprintf(buf + len, "\n");
  811. return len;
  812. }
  813. static DEVICE_ATTR(llink_regs, 0440, temac_show_llink_regs, NULL);
  814. static struct attribute *temac_device_attrs[] = {
  815. &dev_attr_llink_regs.attr,
  816. NULL,
  817. };
  818. static const struct attribute_group temac_attr_group = {
  819. .attrs = temac_device_attrs,
  820. };
  821. /* ethtool support */
  822. static int temac_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
  823. {
  824. struct temac_local *lp = netdev_priv(ndev);
  825. return phy_ethtool_gset(lp->phy_dev, cmd);
  826. }
  827. static int temac_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
  828. {
  829. struct temac_local *lp = netdev_priv(ndev);
  830. return phy_ethtool_sset(lp->phy_dev, cmd);
  831. }
  832. static int temac_nway_reset(struct net_device *ndev)
  833. {
  834. struct temac_local *lp = netdev_priv(ndev);
  835. return phy_start_aneg(lp->phy_dev);
  836. }
  837. static const struct ethtool_ops temac_ethtool_ops = {
  838. .get_settings = temac_get_settings,
  839. .set_settings = temac_set_settings,
  840. .nway_reset = temac_nway_reset,
  841. .get_link = ethtool_op_get_link,
  842. .get_ts_info = ethtool_op_get_ts_info,
  843. };
  844. static int temac_of_probe(struct platform_device *op)
  845. {
  846. struct device_node *np;
  847. struct temac_local *lp;
  848. struct net_device *ndev;
  849. const void *addr;
  850. __be32 *p;
  851. int size, rc = 0;
  852. /* Init network device structure */
  853. ndev = alloc_etherdev(sizeof(*lp));
  854. if (!ndev)
  855. return -ENOMEM;
  856. platform_set_drvdata(op, ndev);
  857. SET_NETDEV_DEV(ndev, &op->dev);
  858. ndev->flags &= ~IFF_MULTICAST; /* clear multicast */
  859. ndev->features = NETIF_F_SG;
  860. ndev->netdev_ops = &temac_netdev_ops;
  861. ndev->ethtool_ops = &temac_ethtool_ops;
  862. #if 0
  863. ndev->features |= NETIF_F_IP_CSUM; /* Can checksum TCP/UDP over IPv4. */
  864. ndev->features |= NETIF_F_HW_CSUM; /* Can checksum all the packets. */
  865. ndev->features |= NETIF_F_IPV6_CSUM; /* Can checksum IPV6 TCP/UDP */
  866. ndev->features |= NETIF_F_HIGHDMA; /* Can DMA to high memory. */
  867. ndev->features |= NETIF_F_HW_VLAN_CTAG_TX; /* Transmit VLAN hw accel */
  868. ndev->features |= NETIF_F_HW_VLAN_CTAG_RX; /* Receive VLAN hw acceleration */
  869. ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; /* Receive VLAN filtering */
  870. ndev->features |= NETIF_F_VLAN_CHALLENGED; /* cannot handle VLAN pkts */
  871. ndev->features |= NETIF_F_GSO; /* Enable software GSO. */
  872. ndev->features |= NETIF_F_MULTI_QUEUE; /* Has multiple TX/RX queues */
  873. ndev->features |= NETIF_F_LRO; /* large receive offload */
  874. #endif
  875. /* setup temac private info structure */
  876. lp = netdev_priv(ndev);
  877. lp->ndev = ndev;
  878. lp->dev = &op->dev;
  879. lp->options = XTE_OPTION_DEFAULTS;
  880. spin_lock_init(&lp->rx_lock);
  881. mutex_init(&lp->indirect_mutex);
  882. /* map device registers */
  883. lp->regs = of_iomap(op->dev.of_node, 0);
  884. if (!lp->regs) {
  885. dev_err(&op->dev, "could not map temac regs.\n");
  886. rc = -ENOMEM;
  887. goto nodev;
  888. }
  889. /* Setup checksum offload, but default to off if not specified */
  890. lp->temac_features = 0;
  891. p = (__be32 *)of_get_property(op->dev.of_node, "xlnx,txcsum", NULL);
  892. if (p && be32_to_cpu(*p)) {
  893. lp->temac_features |= TEMAC_FEATURE_TX_CSUM;
  894. /* Can checksum TCP/UDP over IPv4. */
  895. ndev->features |= NETIF_F_IP_CSUM;
  896. }
  897. p = (__be32 *)of_get_property(op->dev.of_node, "xlnx,rxcsum", NULL);
  898. if (p && be32_to_cpu(*p))
  899. lp->temac_features |= TEMAC_FEATURE_RX_CSUM;
  900. /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */
  901. np = of_parse_phandle(op->dev.of_node, "llink-connected", 0);
  902. if (!np) {
  903. dev_err(&op->dev, "could not find DMA node\n");
  904. rc = -ENODEV;
  905. goto err_iounmap;
  906. }
  907. /* Setup the DMA register accesses, could be DCR or memory mapped */
  908. if (temac_dcr_setup(lp, op, np)) {
  909. /* no DCR in the device tree, try non-DCR */
  910. lp->sdma_regs = of_iomap(np, 0);
  911. if (lp->sdma_regs) {
  912. lp->dma_in = temac_dma_in32;
  913. lp->dma_out = temac_dma_out32;
  914. dev_dbg(&op->dev, "MEM base: %p\n", lp->sdma_regs);
  915. } else {
  916. dev_err(&op->dev, "unable to map DMA registers\n");
  917. of_node_put(np);
  918. goto err_iounmap;
  919. }
  920. }
  921. lp->rx_irq = irq_of_parse_and_map(np, 0);
  922. lp->tx_irq = irq_of_parse_and_map(np, 1);
  923. of_node_put(np); /* Finished with the DMA node; drop the reference */
  924. if (!lp->rx_irq || !lp->tx_irq) {
  925. dev_err(&op->dev, "could not determine irqs\n");
  926. rc = -ENOMEM;
  927. goto err_iounmap_2;
  928. }
  929. /* Retrieve the MAC address */
  930. addr = of_get_property(op->dev.of_node, "local-mac-address", &size);
  931. if ((!addr) || (size != 6)) {
  932. dev_err(&op->dev, "could not find MAC address\n");
  933. rc = -ENODEV;
  934. goto err_iounmap_2;
  935. }
  936. temac_init_mac_address(ndev, (void *)addr);
  937. rc = temac_mdio_setup(lp, op->dev.of_node);
  938. if (rc)
  939. dev_warn(&op->dev, "error registering MDIO bus\n");
  940. lp->phy_node = of_parse_phandle(op->dev.of_node, "phy-handle", 0);
  941. if (lp->phy_node)
  942. dev_dbg(lp->dev, "using PHY node %s (%p)\n", np->full_name, np);
  943. /* Add the device attributes */
  944. rc = sysfs_create_group(&lp->dev->kobj, &temac_attr_group);
  945. if (rc) {
  946. dev_err(lp->dev, "Error creating sysfs files\n");
  947. goto err_iounmap_2;
  948. }
  949. rc = register_netdev(lp->ndev);
  950. if (rc) {
  951. dev_err(lp->dev, "register_netdev() error (%i)\n", rc);
  952. goto err_register_ndev;
  953. }
  954. return 0;
  955. err_register_ndev:
  956. sysfs_remove_group(&lp->dev->kobj, &temac_attr_group);
  957. err_iounmap_2:
  958. if (lp->sdma_regs)
  959. iounmap(lp->sdma_regs);
  960. err_iounmap:
  961. iounmap(lp->regs);
  962. nodev:
  963. free_netdev(ndev);
  964. ndev = NULL;
  965. return rc;
  966. }
  967. static int temac_of_remove(struct platform_device *op)
  968. {
  969. struct net_device *ndev = platform_get_drvdata(op);
  970. struct temac_local *lp = netdev_priv(ndev);
  971. temac_mdio_teardown(lp);
  972. unregister_netdev(ndev);
  973. sysfs_remove_group(&lp->dev->kobj, &temac_attr_group);
  974. of_node_put(lp->phy_node);
  975. lp->phy_node = NULL;
  976. iounmap(lp->regs);
  977. if (lp->sdma_regs)
  978. iounmap(lp->sdma_regs);
  979. free_netdev(ndev);
  980. return 0;
  981. }
  982. static struct of_device_id temac_of_match[] = {
  983. { .compatible = "xlnx,xps-ll-temac-1.01.b", },
  984. { .compatible = "xlnx,xps-ll-temac-2.00.a", },
  985. { .compatible = "xlnx,xps-ll-temac-2.02.a", },
  986. { .compatible = "xlnx,xps-ll-temac-2.03.a", },
  987. {},
  988. };
  989. MODULE_DEVICE_TABLE(of, temac_of_match);
  990. static struct platform_driver temac_of_driver = {
  991. .probe = temac_of_probe,
  992. .remove = temac_of_remove,
  993. .driver = {
  994. .name = "xilinx_temac",
  995. .of_match_table = temac_of_match,
  996. },
  997. };
  998. module_platform_driver(temac_of_driver);
  999. MODULE_DESCRIPTION("Xilinx LL_TEMAC Ethernet driver");
  1000. MODULE_AUTHOR("Yoshio Kashiwagi");
  1001. MODULE_LICENSE("GPL");