etraxfs_eth.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. /*
  2. * QEMU ETRAX Ethernet Controller.
  3. *
  4. * Copyright (c) 2008 Edgar E. Iglesias, Axis Communications AB.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to deal
  8. * in the Software without restriction, including without limitation the rights
  9. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. * copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  22. * THE SOFTWARE.
  23. */
  24. #include "qemu/osdep.h"
  25. #include "qapi/error.h"
  26. #include "hw/sysbus.h"
  27. #include "net/net.h"
  28. #include "hw/cris/etraxfs.h"
  29. #include "qemu/error-report.h"
  30. #include "qemu/module.h"
  31. #include "trace.h"
  32. #define D(x)
  33. /* Advertisement control register. */
  34. #define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */
  35. #define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */
  36. #define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */
  37. #define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */
  38. /*
  39. * The MDIO extensions in the TDK PHY model were reversed engineered from the
  40. * linux driver (PHYID and Diagnostics reg).
  41. * TODO: Add friendly names for the register nums.
  42. */
  43. struct qemu_phy
  44. {
  45. uint32_t regs[32];
  46. int link;
  47. unsigned int (*read)(struct qemu_phy *phy, unsigned int req);
  48. void (*write)(struct qemu_phy *phy, unsigned int req, unsigned int data);
  49. };
  50. static unsigned int tdk_read(struct qemu_phy *phy, unsigned int req)
  51. {
  52. int regnum;
  53. unsigned r = 0;
  54. regnum = req & 0x1f;
  55. switch (regnum) {
  56. case 1:
  57. if (!phy->link) {
  58. break;
  59. }
  60. /* MR1. */
  61. /* Speeds and modes. */
  62. r |= (1 << 13) | (1 << 14);
  63. r |= (1 << 11) | (1 << 12);
  64. r |= (1 << 5); /* Autoneg complete. */
  65. r |= (1 << 3); /* Autoneg able. */
  66. r |= (1 << 2); /* link. */
  67. break;
  68. case 5:
  69. /* Link partner ability.
  70. We are kind; always agree with whatever best mode
  71. the guest advertises. */
  72. r = 1 << 14; /* Success. */
  73. /* Copy advertised modes. */
  74. r |= phy->regs[4] & (15 << 5);
  75. /* Autoneg support. */
  76. r |= 1;
  77. break;
  78. case 18:
  79. {
  80. /* Diagnostics reg. */
  81. int duplex = 0;
  82. int speed_100 = 0;
  83. if (!phy->link) {
  84. break;
  85. }
  86. /* Are we advertising 100 half or 100 duplex ? */
  87. speed_100 = !!(phy->regs[4] & ADVERTISE_100HALF);
  88. speed_100 |= !!(phy->regs[4] & ADVERTISE_100FULL);
  89. /* Are we advertising 10 duplex or 100 duplex ? */
  90. duplex = !!(phy->regs[4] & ADVERTISE_100FULL);
  91. duplex |= !!(phy->regs[4] & ADVERTISE_10FULL);
  92. r = (speed_100 << 10) | (duplex << 11);
  93. }
  94. break;
  95. default:
  96. r = phy->regs[regnum];
  97. break;
  98. }
  99. trace_mdio_phy_read(regnum, r);
  100. return r;
  101. }
  102. static void
  103. tdk_write(struct qemu_phy *phy, unsigned int req, unsigned int data)
  104. {
  105. int regnum;
  106. regnum = req & 0x1f;
  107. trace_mdio_phy_write(regnum, data);
  108. switch (regnum) {
  109. default:
  110. phy->regs[regnum] = data;
  111. break;
  112. }
  113. }
  114. static void
  115. tdk_reset(struct qemu_phy *phy)
  116. {
  117. phy->regs[0] = 0x3100;
  118. /* PHY Id. */
  119. phy->regs[2] = 0x0300;
  120. phy->regs[3] = 0xe400;
  121. /* Autonegotiation advertisement reg. */
  122. phy->regs[4] = 0x01E1;
  123. phy->link = 1;
  124. }
  125. struct qemu_mdio
  126. {
  127. /* bus. */
  128. int mdc;
  129. int mdio;
  130. /* decoder. */
  131. enum {
  132. PREAMBLE,
  133. SOF,
  134. OPC,
  135. ADDR,
  136. REQ,
  137. TURNAROUND,
  138. DATA
  139. } state;
  140. unsigned int drive;
  141. unsigned int cnt;
  142. unsigned int addr;
  143. unsigned int opc;
  144. unsigned int req;
  145. unsigned int data;
  146. struct qemu_phy *devs[32];
  147. };
  148. static void
  149. mdio_attach(struct qemu_mdio *bus, struct qemu_phy *phy, unsigned int addr)
  150. {
  151. bus->devs[addr & 0x1f] = phy;
  152. }
  153. #ifdef USE_THIS_DEAD_CODE
  154. static void
  155. mdio_detach(struct qemu_mdio *bus, struct qemu_phy *phy, unsigned int addr)
  156. {
  157. bus->devs[addr & 0x1f] = NULL;
  158. }
  159. #endif
  160. static void mdio_read_req(struct qemu_mdio *bus)
  161. {
  162. struct qemu_phy *phy;
  163. phy = bus->devs[bus->addr];
  164. if (phy && phy->read) {
  165. bus->data = phy->read(phy, bus->req);
  166. } else {
  167. bus->data = 0xffff;
  168. }
  169. }
  170. static void mdio_write_req(struct qemu_mdio *bus)
  171. {
  172. struct qemu_phy *phy;
  173. phy = bus->devs[bus->addr];
  174. if (phy && phy->write) {
  175. phy->write(phy, bus->req, bus->data);
  176. }
  177. }
  178. static void mdio_cycle(struct qemu_mdio *bus)
  179. {
  180. bus->cnt++;
  181. trace_mdio_bitbang(bus->mdc, bus->mdio, bus->state, bus->cnt, bus->drive);
  182. #if 0
  183. if (bus->mdc) {
  184. printf("%d", bus->mdio);
  185. }
  186. #endif
  187. switch (bus->state) {
  188. case PREAMBLE:
  189. if (bus->mdc) {
  190. if (bus->cnt >= (32 * 2) && !bus->mdio) {
  191. bus->cnt = 0;
  192. bus->state = SOF;
  193. bus->data = 0;
  194. }
  195. }
  196. break;
  197. case SOF:
  198. if (bus->mdc) {
  199. if (bus->mdio != 1) {
  200. printf("WARNING: no SOF\n");
  201. }
  202. if (bus->cnt == 1*2) {
  203. bus->cnt = 0;
  204. bus->opc = 0;
  205. bus->state = OPC;
  206. }
  207. }
  208. break;
  209. case OPC:
  210. if (bus->mdc) {
  211. bus->opc <<= 1;
  212. bus->opc |= bus->mdio & 1;
  213. if (bus->cnt == 2*2) {
  214. bus->cnt = 0;
  215. bus->addr = 0;
  216. bus->state = ADDR;
  217. }
  218. }
  219. break;
  220. case ADDR:
  221. if (bus->mdc) {
  222. bus->addr <<= 1;
  223. bus->addr |= bus->mdio & 1;
  224. if (bus->cnt == 5*2) {
  225. bus->cnt = 0;
  226. bus->req = 0;
  227. bus->state = REQ;
  228. }
  229. }
  230. break;
  231. case REQ:
  232. if (bus->mdc) {
  233. bus->req <<= 1;
  234. bus->req |= bus->mdio & 1;
  235. if (bus->cnt == 5*2) {
  236. bus->cnt = 0;
  237. bus->state = TURNAROUND;
  238. }
  239. }
  240. break;
  241. case TURNAROUND:
  242. if (bus->mdc && bus->cnt == 2*2) {
  243. bus->mdio = 0;
  244. bus->cnt = 0;
  245. if (bus->opc == 2) {
  246. bus->drive = 1;
  247. mdio_read_req(bus);
  248. bus->mdio = bus->data & 1;
  249. }
  250. bus->state = DATA;
  251. }
  252. break;
  253. case DATA:
  254. if (!bus->mdc) {
  255. if (bus->drive) {
  256. bus->mdio = !!(bus->data & (1 << 15));
  257. bus->data <<= 1;
  258. }
  259. } else {
  260. if (!bus->drive) {
  261. bus->data <<= 1;
  262. bus->data |= bus->mdio;
  263. }
  264. if (bus->cnt == 16 * 2) {
  265. bus->cnt = 0;
  266. bus->state = PREAMBLE;
  267. if (!bus->drive) {
  268. mdio_write_req(bus);
  269. }
  270. bus->drive = 0;
  271. }
  272. }
  273. break;
  274. default:
  275. break;
  276. }
  277. }
  278. /* ETRAX-FS Ethernet MAC block starts here. */
  279. #define RW_MA0_LO 0x00
  280. #define RW_MA0_HI 0x01
  281. #define RW_MA1_LO 0x02
  282. #define RW_MA1_HI 0x03
  283. #define RW_GA_LO 0x04
  284. #define RW_GA_HI 0x05
  285. #define RW_GEN_CTRL 0x06
  286. #define RW_REC_CTRL 0x07
  287. #define RW_TR_CTRL 0x08
  288. #define RW_CLR_ERR 0x09
  289. #define RW_MGM_CTRL 0x0a
  290. #define R_STAT 0x0b
  291. #define FS_ETH_MAX_REGS 0x17
  292. #define TYPE_ETRAX_FS_ETH "etraxfs-eth"
  293. #define ETRAX_FS_ETH(obj) \
  294. OBJECT_CHECK(ETRAXFSEthState, (obj), TYPE_ETRAX_FS_ETH)
  295. typedef struct ETRAXFSEthState
  296. {
  297. SysBusDevice parent_obj;
  298. MemoryRegion mmio;
  299. NICState *nic;
  300. NICConf conf;
  301. /* Two addrs in the filter. */
  302. uint8_t macaddr[2][6];
  303. uint32_t regs[FS_ETH_MAX_REGS];
  304. union {
  305. void *vdma_out;
  306. struct etraxfs_dma_client *dma_out;
  307. };
  308. union {
  309. void *vdma_in;
  310. struct etraxfs_dma_client *dma_in;
  311. };
  312. /* MDIO bus. */
  313. struct qemu_mdio mdio_bus;
  314. unsigned int phyaddr;
  315. int duplex_mismatch;
  316. /* PHY. */
  317. struct qemu_phy phy;
  318. } ETRAXFSEthState;
  319. static void eth_validate_duplex(ETRAXFSEthState *eth)
  320. {
  321. struct qemu_phy *phy;
  322. unsigned int phy_duplex;
  323. unsigned int mac_duplex;
  324. int new_mm = 0;
  325. phy = eth->mdio_bus.devs[eth->phyaddr];
  326. phy_duplex = !!(phy->read(phy, 18) & (1 << 11));
  327. mac_duplex = !!(eth->regs[RW_REC_CTRL] & 128);
  328. if (mac_duplex != phy_duplex) {
  329. new_mm = 1;
  330. }
  331. if (eth->regs[RW_GEN_CTRL] & 1) {
  332. if (new_mm != eth->duplex_mismatch) {
  333. if (new_mm) {
  334. printf("HW: WARNING ETH duplex mismatch MAC=%d PHY=%d\n",
  335. mac_duplex, phy_duplex);
  336. } else {
  337. printf("HW: ETH duplex ok.\n");
  338. }
  339. }
  340. eth->duplex_mismatch = new_mm;
  341. }
  342. }
  343. static uint64_t
  344. eth_read(void *opaque, hwaddr addr, unsigned int size)
  345. {
  346. ETRAXFSEthState *eth = opaque;
  347. uint32_t r = 0;
  348. addr >>= 2;
  349. switch (addr) {
  350. case R_STAT:
  351. r = eth->mdio_bus.mdio & 1;
  352. break;
  353. default:
  354. r = eth->regs[addr];
  355. D(printf("%s %x\n", __func__, addr * 4));
  356. break;
  357. }
  358. return r;
  359. }
  360. static void eth_update_ma(ETRAXFSEthState *eth, int ma)
  361. {
  362. int reg;
  363. int i = 0;
  364. ma &= 1;
  365. reg = RW_MA0_LO;
  366. if (ma) {
  367. reg = RW_MA1_LO;
  368. }
  369. eth->macaddr[ma][i++] = eth->regs[reg];
  370. eth->macaddr[ma][i++] = eth->regs[reg] >> 8;
  371. eth->macaddr[ma][i++] = eth->regs[reg] >> 16;
  372. eth->macaddr[ma][i++] = eth->regs[reg] >> 24;
  373. eth->macaddr[ma][i++] = eth->regs[reg + 1];
  374. eth->macaddr[ma][i] = eth->regs[reg + 1] >> 8;
  375. D(printf("set mac%d=%x.%x.%x.%x.%x.%x\n", ma,
  376. eth->macaddr[ma][0], eth->macaddr[ma][1],
  377. eth->macaddr[ma][2], eth->macaddr[ma][3],
  378. eth->macaddr[ma][4], eth->macaddr[ma][5]));
  379. }
  380. static void
  381. eth_write(void *opaque, hwaddr addr,
  382. uint64_t val64, unsigned int size)
  383. {
  384. ETRAXFSEthState *eth = opaque;
  385. uint32_t value = val64;
  386. addr >>= 2;
  387. switch (addr) {
  388. case RW_MA0_LO:
  389. case RW_MA0_HI:
  390. eth->regs[addr] = value;
  391. eth_update_ma(eth, 0);
  392. break;
  393. case RW_MA1_LO:
  394. case RW_MA1_HI:
  395. eth->regs[addr] = value;
  396. eth_update_ma(eth, 1);
  397. break;
  398. case RW_MGM_CTRL:
  399. /* Attach an MDIO/PHY abstraction. */
  400. if (value & 2) {
  401. eth->mdio_bus.mdio = value & 1;
  402. }
  403. if (eth->mdio_bus.mdc != (value & 4)) {
  404. mdio_cycle(&eth->mdio_bus);
  405. eth_validate_duplex(eth);
  406. }
  407. eth->mdio_bus.mdc = !!(value & 4);
  408. eth->regs[addr] = value;
  409. break;
  410. case RW_REC_CTRL:
  411. eth->regs[addr] = value;
  412. eth_validate_duplex(eth);
  413. break;
  414. default:
  415. eth->regs[addr] = value;
  416. D(printf("%s %x %x\n", __func__, addr, value));
  417. break;
  418. }
  419. }
  420. /* The ETRAX FS has a groupt address table (GAT) which works like a k=1 bloom
  421. filter dropping group addresses we have not joined. The filter has 64
  422. bits (m). The has function is a simple nible xor of the group addr. */
  423. static int eth_match_groupaddr(ETRAXFSEthState *eth, const unsigned char *sa)
  424. {
  425. unsigned int hsh;
  426. int m_individual = eth->regs[RW_REC_CTRL] & 4;
  427. int match;
  428. /* First bit on the wire of a MAC address signals multicast or
  429. physical address. */
  430. if (!m_individual && !(sa[0] & 1)) {
  431. return 0;
  432. }
  433. /* Calculate the hash index for the GA registers. */
  434. hsh = 0;
  435. hsh ^= (*sa) & 0x3f;
  436. hsh ^= ((*sa) >> 6) & 0x03;
  437. ++sa;
  438. hsh ^= ((*sa) << 2) & 0x03c;
  439. hsh ^= ((*sa) >> 4) & 0xf;
  440. ++sa;
  441. hsh ^= ((*sa) << 4) & 0x30;
  442. hsh ^= ((*sa) >> 2) & 0x3f;
  443. ++sa;
  444. hsh ^= (*sa) & 0x3f;
  445. hsh ^= ((*sa) >> 6) & 0x03;
  446. ++sa;
  447. hsh ^= ((*sa) << 2) & 0x03c;
  448. hsh ^= ((*sa) >> 4) & 0xf;
  449. ++sa;
  450. hsh ^= ((*sa) << 4) & 0x30;
  451. hsh ^= ((*sa) >> 2) & 0x3f;
  452. hsh &= 63;
  453. if (hsh > 31) {
  454. match = eth->regs[RW_GA_HI] & (1 << (hsh - 32));
  455. } else {
  456. match = eth->regs[RW_GA_LO] & (1 << hsh);
  457. }
  458. D(printf("hsh=%x ga=%x.%x mtch=%d\n", hsh,
  459. eth->regs[RW_GA_HI], eth->regs[RW_GA_LO], match));
  460. return match;
  461. }
  462. static ssize_t eth_receive(NetClientState *nc, const uint8_t *buf, size_t size)
  463. {
  464. unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
  465. ETRAXFSEthState *eth = qemu_get_nic_opaque(nc);
  466. int use_ma0 = eth->regs[RW_REC_CTRL] & 1;
  467. int use_ma1 = eth->regs[RW_REC_CTRL] & 2;
  468. int r_bcast = eth->regs[RW_REC_CTRL] & 8;
  469. if (size < 12) {
  470. return -1;
  471. }
  472. D(printf("%x.%x.%x.%x.%x.%x ma=%d %d bc=%d\n",
  473. buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
  474. use_ma0, use_ma1, r_bcast));
  475. /* Does the frame get through the address filters? */
  476. if ((!use_ma0 || memcmp(buf, eth->macaddr[0], 6))
  477. && (!use_ma1 || memcmp(buf, eth->macaddr[1], 6))
  478. && (!r_bcast || memcmp(buf, sa_bcast, 6))
  479. && !eth_match_groupaddr(eth, buf)) {
  480. return size;
  481. }
  482. /* FIXME: Find another way to pass on the fake csum. */
  483. etraxfs_dmac_input(eth->dma_in, (void *)buf, size + 4, 1);
  484. return size;
  485. }
  486. static int eth_tx_push(void *opaque, unsigned char *buf, int len, bool eop)
  487. {
  488. ETRAXFSEthState *eth = opaque;
  489. D(printf("%s buf=%p len=%d\n", __func__, buf, len));
  490. qemu_send_packet(qemu_get_queue(eth->nic), buf, len);
  491. return len;
  492. }
  493. static void eth_set_link(NetClientState *nc)
  494. {
  495. ETRAXFSEthState *eth = qemu_get_nic_opaque(nc);
  496. D(printf("%s %d\n", __func__, nc->link_down));
  497. eth->phy.link = !nc->link_down;
  498. }
  499. static const MemoryRegionOps eth_ops = {
  500. .read = eth_read,
  501. .write = eth_write,
  502. .endianness = DEVICE_LITTLE_ENDIAN,
  503. .valid = {
  504. .min_access_size = 4,
  505. .max_access_size = 4
  506. }
  507. };
  508. static NetClientInfo net_etraxfs_info = {
  509. .type = NET_CLIENT_DRIVER_NIC,
  510. .size = sizeof(NICState),
  511. .receive = eth_receive,
  512. .link_status_changed = eth_set_link,
  513. };
  514. static void etraxfs_eth_reset(DeviceState *dev)
  515. {
  516. ETRAXFSEthState *s = ETRAX_FS_ETH(dev);
  517. memset(s->regs, 0, sizeof(s->regs));
  518. memset(s->macaddr, 0, sizeof(s->macaddr));
  519. s->duplex_mismatch = 0;
  520. s->mdio_bus.mdc = 0;
  521. s->mdio_bus.mdio = 0;
  522. s->mdio_bus.state = 0;
  523. s->mdio_bus.drive = 0;
  524. s->mdio_bus.cnt = 0;
  525. s->mdio_bus.addr = 0;
  526. s->mdio_bus.opc = 0;
  527. s->mdio_bus.req = 0;
  528. s->mdio_bus.data = 0;
  529. tdk_reset(&s->phy);
  530. }
  531. static void etraxfs_eth_realize(DeviceState *dev, Error **errp)
  532. {
  533. SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
  534. ETRAXFSEthState *s = ETRAX_FS_ETH(dev);
  535. if (!s->dma_out || !s->dma_in) {
  536. error_setg(errp, "Unconnected ETRAX-FS Ethernet MAC");
  537. return;
  538. }
  539. s->dma_out->client.push = eth_tx_push;
  540. s->dma_out->client.opaque = s;
  541. s->dma_in->client.opaque = s;
  542. s->dma_in->client.pull = NULL;
  543. memory_region_init_io(&s->mmio, OBJECT(dev), &eth_ops, s,
  544. "etraxfs-eth", 0x5c);
  545. sysbus_init_mmio(sbd, &s->mmio);
  546. qemu_macaddr_default_if_unset(&s->conf.macaddr);
  547. s->nic = qemu_new_nic(&net_etraxfs_info, &s->conf,
  548. object_get_typename(OBJECT(s)), dev->id, s);
  549. qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
  550. s->phy.read = tdk_read;
  551. s->phy.write = tdk_write;
  552. mdio_attach(&s->mdio_bus, &s->phy, s->phyaddr);
  553. }
  554. static Property etraxfs_eth_properties[] = {
  555. DEFINE_PROP_UINT32("phyaddr", ETRAXFSEthState, phyaddr, 1),
  556. DEFINE_PROP_PTR("dma_out", ETRAXFSEthState, vdma_out),
  557. DEFINE_PROP_PTR("dma_in", ETRAXFSEthState, vdma_in),
  558. DEFINE_NIC_PROPERTIES(ETRAXFSEthState, conf),
  559. DEFINE_PROP_END_OF_LIST(),
  560. };
  561. static void etraxfs_eth_class_init(ObjectClass *klass, void *data)
  562. {
  563. DeviceClass *dc = DEVICE_CLASS(klass);
  564. dc->realize = etraxfs_eth_realize;
  565. dc->reset = etraxfs_eth_reset;
  566. dc->props = etraxfs_eth_properties;
  567. /* Reason: pointer properties "dma_out", "dma_in" */
  568. dc->user_creatable = false;
  569. }
  570. static const TypeInfo etraxfs_eth_info = {
  571. .name = TYPE_ETRAX_FS_ETH,
  572. .parent = TYPE_SYS_BUS_DEVICE,
  573. .instance_size = sizeof(ETRAXFSEthState),
  574. .class_init = etraxfs_eth_class_init,
  575. };
  576. static void etraxfs_eth_register_types(void)
  577. {
  578. type_register_static(&etraxfs_eth_info);
  579. }
  580. type_init(etraxfs_eth_register_types)