pfe_driver.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2015-2016 Freescale Semiconductor, Inc.
  4. * Copyright 2017 NXP
  5. */
  6. #include <net/pfe_eth/pfe_eth.h>
  7. #include <net/pfe_eth/pfe_firmware.h>
  8. static struct tx_desc_s *g_tx_desc;
  9. static struct rx_desc_s *g_rx_desc;
  10. /*
  11. * HIF Rx interface function
  12. * Reads the rx descriptor from the current location (rx_to_read).
  13. * - If the descriptor has a valid data/pkt, then get the data pointer
  14. * - check for the input rx phy number
  15. * - increment the rx data pointer by pkt_head_room_size
  16. * - decrement the data length by pkt_head_room_size
  17. * - handover the packet to caller.
  18. *
  19. * @param[out] pkt_ptr - Pointer to store rx packet
  20. * @param[out] phy_port - Pointer to store recv phy port
  21. *
  22. * @return -1 if no packet, else return length of packet.
  23. */
  24. int pfe_recv(uchar **pkt_ptr, int *phy_port)
  25. {
  26. struct rx_desc_s *rx_desc = g_rx_desc;
  27. struct buf_desc *bd;
  28. int len = 0;
  29. struct hif_header_s *hif_header;
  30. bd = rx_desc->rx_base + rx_desc->rx_to_read;
  31. if (readl(&bd->ctrl) & BD_CTRL_DESC_EN)
  32. return len; /* No pending Rx packet */
  33. /* this len include hif_header(8 bytes) */
  34. len = readl(&bd->ctrl) & 0xFFFF;
  35. hif_header = (struct hif_header_s *)DDR_PFE_TO_VIRT(readl(&bd->data));
  36. /* Get the receive port info from the packet */
  37. debug("Pkt received:");
  38. debug(" Pkt ptr(%p), len(%d), gemac_port(%d) status(%08x)\n",
  39. hif_header, len, hif_header->port_no, readl(&bd->status));
  40. #ifdef DEBUG
  41. {
  42. int i;
  43. unsigned char *p = (unsigned char *)hif_header;
  44. for (i = 0; i < len; i++) {
  45. if (!(i % 16))
  46. printf("\n");
  47. printf(" %02x", p[i]);
  48. }
  49. printf("\n");
  50. }
  51. #endif
  52. *pkt_ptr = (uchar *)(hif_header + 1);
  53. *phy_port = hif_header->port_no;
  54. len -= sizeof(struct hif_header_s);
  55. return len;
  56. }
  57. /*
  58. * HIF function to check the Rx done
  59. * This function will check the rx done indication of the current rx_to_read
  60. * locations
  61. * if success, moves the rx_to_read to next location.
  62. */
  63. int pfe_eth_free_pkt(struct udevice *dev, uchar *packet, int length)
  64. {
  65. struct rx_desc_s *rx_desc = g_rx_desc;
  66. struct buf_desc *bd;
  67. debug("%s:rx_base: %p, rx_to_read: %d\n", __func__, rx_desc->rx_base,
  68. rx_desc->rx_to_read);
  69. bd = rx_desc->rx_base + rx_desc->rx_to_read;
  70. /* reset the control field */
  71. writel((MAX_FRAME_SIZE | BD_CTRL_LIFM | BD_CTRL_DESC_EN
  72. | BD_CTRL_DIR), &bd->ctrl);
  73. writel(0, &bd->status);
  74. debug("Rx Done : status: %08x, ctrl: %08x\n", readl(&bd->status),
  75. readl(&bd->ctrl));
  76. /* Give START_STROBE to BDP to fetch the descriptor __NOW__,
  77. * BDP need not wait for rx_poll_cycle time to fetch the descriptor,
  78. * In idle state (ie., no rx pkt), BDP will not fetch
  79. * the descriptor even if strobe is given.
  80. */
  81. writel((readl(HIF_RX_CTRL) | HIF_CTRL_BDP_CH_START_WSTB), HIF_RX_CTRL);
  82. /* increment the rx_to_read index to next location */
  83. rx_desc->rx_to_read = (rx_desc->rx_to_read + 1)
  84. & (rx_desc->rx_ring_size - 1);
  85. debug("Rx next pkt location: %d\n", rx_desc->rx_to_read);
  86. return 0;
  87. }
  88. /*
  89. * HIF Tx interface function
  90. * This function sends a single packet to PFE from HIF interface.
  91. * - No interrupt indication on tx completion.
  92. * - Data is copied to tx buffers before tx descriptor is updated
  93. * and TX DMA is enabled.
  94. *
  95. * @param[in] phy_port Phy port number to send out this packet
  96. * @param[in] data Pointer to the data
  97. * @param[in] length Length of the ethernet packet to be transferred.
  98. *
  99. * @return -1 if tx Q is full, else returns the tx location where the pkt is
  100. * placed.
  101. */
  102. int pfe_send(int phy_port, void *data, int length)
  103. {
  104. struct tx_desc_s *tx_desc = g_tx_desc;
  105. struct buf_desc *bd;
  106. struct hif_header_s hif_header;
  107. u8 *tx_buf_va;
  108. debug("%s:pkt: %p, len: %d, tx_base: %p, tx_to_send: %d\n", __func__,
  109. data, length, tx_desc->tx_base, tx_desc->tx_to_send);
  110. bd = tx_desc->tx_base + tx_desc->tx_to_send;
  111. /* check queue-full condition */
  112. if (readl(&bd->ctrl) & BD_CTRL_DESC_EN)
  113. return -1;
  114. /* PFE checks for min pkt size */
  115. if (length < MIN_PKT_SIZE)
  116. length = MIN_PKT_SIZE;
  117. tx_buf_va = (void *)DDR_PFE_TO_VIRT(readl(&bd->data));
  118. debug("%s: tx_buf_va: %p, tx_buf_pa: %08x\n", __func__, tx_buf_va,
  119. readl(&bd->data));
  120. /* Fill the gemac/phy port number to send this packet out */
  121. memset(&hif_header, 0, sizeof(struct hif_header_s));
  122. hif_header.port_no = phy_port;
  123. memcpy(tx_buf_va, (u8 *)&hif_header, sizeof(struct hif_header_s));
  124. memcpy(tx_buf_va + sizeof(struct hif_header_s), data, length);
  125. length += sizeof(struct hif_header_s);
  126. #ifdef DEBUG
  127. {
  128. int i;
  129. unsigned char *p = (unsigned char *)tx_buf_va;
  130. for (i = 0; i < length; i++) {
  131. if (!(i % 16))
  132. printf("\n");
  133. printf("%02x ", p[i]);
  134. }
  135. }
  136. #endif
  137. debug("Tx Done: status: %08x, ctrl: %08x\n", readl(&bd->status),
  138. readl(&bd->ctrl));
  139. /* fill the tx desc */
  140. writel((u32)(BD_CTRL_DESC_EN | BD_CTRL_LIFM | (length & 0xFFFF)),
  141. &bd->ctrl);
  142. writel(0, &bd->status);
  143. writel((HIF_CTRL_DMA_EN | HIF_CTRL_BDP_CH_START_WSTB), HIF_TX_CTRL);
  144. udelay(100);
  145. return tx_desc->tx_to_send;
  146. }
  147. /*
  148. * HIF function to check the Tx done
  149. * This function will check the tx done indication of the current tx_to_send
  150. * locations
  151. * if success, moves the tx_to_send to next location.
  152. *
  153. * @return -1 if TX ownership bit is not cleared by hw.
  154. * else on success (tx done completion) return zero.
  155. */
  156. int pfe_tx_done(void)
  157. {
  158. struct tx_desc_s *tx_desc = g_tx_desc;
  159. struct buf_desc *bd;
  160. debug("%s:tx_base: %p, tx_to_send: %d\n", __func__, tx_desc->tx_base,
  161. tx_desc->tx_to_send);
  162. bd = tx_desc->tx_base + tx_desc->tx_to_send;
  163. /* check queue-full condition */
  164. if (readl(&bd->ctrl) & BD_CTRL_DESC_EN)
  165. return -1;
  166. /* reset the control field */
  167. writel(0, &bd->ctrl);
  168. writel(0, &bd->status);
  169. debug("Tx Done : status: %08x, ctrl: %08x\n", readl(&bd->status),
  170. readl(&bd->ctrl));
  171. /* increment the txtosend index to next location */
  172. tx_desc->tx_to_send = (tx_desc->tx_to_send + 1)
  173. & (tx_desc->tx_ring_size - 1);
  174. debug("Tx next pkt location: %d\n", tx_desc->tx_to_send);
  175. return 0;
  176. }
  177. /*
  178. * Helper function to dump Rx descriptors.
  179. */
  180. static inline void hif_rx_desc_dump(void)
  181. {
  182. struct buf_desc *bd_va;
  183. int i;
  184. struct rx_desc_s *rx_desc;
  185. if (!g_rx_desc) {
  186. printf("%s: HIF Rx desc no init\n", __func__);
  187. return;
  188. }
  189. rx_desc = g_rx_desc;
  190. bd_va = rx_desc->rx_base;
  191. debug("HIF rx desc: base_va: %p, base_pa: %08x\n", rx_desc->rx_base,
  192. rx_desc->rx_base_pa);
  193. for (i = 0; i < rx_desc->rx_ring_size; i++) {
  194. debug("status: %08x, ctrl: %08x, data: %08x, next: 0x%08x\n",
  195. readl(&bd_va->status),
  196. readl(&bd_va->ctrl),
  197. readl(&bd_va->data),
  198. readl(&bd_va->next));
  199. bd_va++;
  200. }
  201. }
  202. /*
  203. * This function mark all Rx descriptors as LAST_BD.
  204. */
  205. void hif_rx_desc_disable(void)
  206. {
  207. int i;
  208. struct rx_desc_s *rx_desc;
  209. struct buf_desc *bd_va;
  210. if (!g_rx_desc) {
  211. printf("%s: HIF Rx desc not initialized\n", __func__);
  212. return;
  213. }
  214. rx_desc = g_rx_desc;
  215. bd_va = rx_desc->rx_base;
  216. for (i = 0; i < rx_desc->rx_ring_size; i++) {
  217. writel(readl(&bd_va->ctrl) | BD_CTRL_LAST_BD, &bd_va->ctrl);
  218. bd_va++;
  219. }
  220. }
  221. /*
  222. * HIF Rx Desc initialization function.
  223. */
  224. static int hif_rx_desc_init(struct pfe_ddr_address *pfe_addr)
  225. {
  226. u32 ctrl;
  227. struct buf_desc *bd_va;
  228. struct buf_desc *bd_pa;
  229. struct rx_desc_s *rx_desc;
  230. u32 rx_buf_pa;
  231. int i;
  232. /* sanity check */
  233. if (g_rx_desc) {
  234. printf("%s: HIF Rx desc re-init request\n", __func__);
  235. return 0;
  236. }
  237. rx_desc = (struct rx_desc_s *)malloc(sizeof(struct rx_desc_s));
  238. if (!rx_desc) {
  239. printf("%s: Memory allocation failure\n", __func__);
  240. return -ENOMEM;
  241. }
  242. memset(rx_desc, 0, sizeof(struct rx_desc_s));
  243. /* init: Rx ring buffer */
  244. rx_desc->rx_ring_size = HIF_RX_DESC_NT;
  245. /* NOTE: must be 64bit aligned */
  246. bd_va = (struct buf_desc *)(pfe_addr->ddr_pfe_baseaddr
  247. + RX_BD_BASEADDR);
  248. bd_pa = (struct buf_desc *)(pfe_addr->ddr_pfe_phys_baseaddr
  249. + RX_BD_BASEADDR);
  250. rx_desc->rx_base = bd_va;
  251. rx_desc->rx_base_pa = (unsigned long)bd_pa;
  252. rx_buf_pa = pfe_addr->ddr_pfe_phys_baseaddr + HIF_RX_PKT_DDR_BASEADDR;
  253. debug("%s: Rx desc base: %p, base_pa: %08x, desc_count: %d\n",
  254. __func__, rx_desc->rx_base, rx_desc->rx_base_pa,
  255. rx_desc->rx_ring_size);
  256. memset(bd_va, 0, sizeof(struct buf_desc) * rx_desc->rx_ring_size);
  257. ctrl = (MAX_FRAME_SIZE | BD_CTRL_DESC_EN | BD_CTRL_DIR | BD_CTRL_LIFM);
  258. for (i = 0; i < rx_desc->rx_ring_size; i++) {
  259. writel((unsigned long)(bd_pa + 1), &bd_va->next);
  260. writel(ctrl, &bd_va->ctrl);
  261. writel(rx_buf_pa + (i * MAX_FRAME_SIZE), &bd_va->data);
  262. bd_va++;
  263. bd_pa++;
  264. }
  265. --bd_va;
  266. writel((u32)rx_desc->rx_base_pa, &bd_va->next);
  267. writel(rx_desc->rx_base_pa, HIF_RX_BDP_ADDR);
  268. writel((readl(HIF_RX_CTRL) | HIF_CTRL_BDP_CH_START_WSTB), HIF_RX_CTRL);
  269. g_rx_desc = rx_desc;
  270. return 0;
  271. }
  272. /*
  273. * Helper function to dump Tx Descriptors.
  274. */
  275. static inline void hif_tx_desc_dump(void)
  276. {
  277. struct tx_desc_s *tx_desc;
  278. int i;
  279. struct buf_desc *bd_va;
  280. if (!g_tx_desc) {
  281. printf("%s: HIF Tx desc no init\n", __func__);
  282. return;
  283. }
  284. tx_desc = g_tx_desc;
  285. bd_va = tx_desc->tx_base;
  286. debug("HIF tx desc: base_va: %p, base_pa: %08x\n", tx_desc->tx_base,
  287. tx_desc->tx_base_pa);
  288. for (i = 0; i < tx_desc->tx_ring_size; i++)
  289. bd_va++;
  290. }
  291. /*
  292. * HIF Tx descriptor initialization function.
  293. */
  294. static int hif_tx_desc_init(struct pfe_ddr_address *pfe_addr)
  295. {
  296. struct buf_desc *bd_va;
  297. struct buf_desc *bd_pa;
  298. int i;
  299. struct tx_desc_s *tx_desc;
  300. u32 tx_buf_pa;
  301. /* sanity check */
  302. if (g_tx_desc) {
  303. printf("%s: HIF Tx desc re-init request\n", __func__);
  304. return 0;
  305. }
  306. tx_desc = (struct tx_desc_s *)malloc(sizeof(struct tx_desc_s));
  307. if (!tx_desc) {
  308. printf("%s:%d:Memory allocation failure\n", __func__,
  309. __LINE__);
  310. return -ENOMEM;
  311. }
  312. memset(tx_desc, 0, sizeof(struct tx_desc_s));
  313. /* init: Tx ring buffer */
  314. tx_desc->tx_ring_size = HIF_TX_DESC_NT;
  315. /* NOTE: must be 64bit aligned */
  316. bd_va = (struct buf_desc *)(pfe_addr->ddr_pfe_baseaddr
  317. + TX_BD_BASEADDR);
  318. bd_pa = (struct buf_desc *)(pfe_addr->ddr_pfe_phys_baseaddr
  319. + TX_BD_BASEADDR);
  320. tx_desc->tx_base_pa = (unsigned long)bd_pa;
  321. tx_desc->tx_base = bd_va;
  322. debug("%s: Tx desc_base: %p, base_pa: %08x, desc_count: %d\n",
  323. __func__, tx_desc->tx_base, tx_desc->tx_base_pa,
  324. tx_desc->tx_ring_size);
  325. memset(bd_va, 0, sizeof(struct buf_desc) * tx_desc->tx_ring_size);
  326. tx_buf_pa = pfe_addr->ddr_pfe_phys_baseaddr + HIF_TX_PKT_DDR_BASEADDR;
  327. for (i = 0; i < tx_desc->tx_ring_size; i++) {
  328. writel((unsigned long)(bd_pa + 1), &bd_va->next);
  329. writel(tx_buf_pa + (i * MAX_FRAME_SIZE), &bd_va->data);
  330. bd_va++;
  331. bd_pa++;
  332. }
  333. --bd_va;
  334. writel((u32)tx_desc->tx_base_pa, &bd_va->next);
  335. writel(tx_desc->tx_base_pa, HIF_TX_BDP_ADDR);
  336. g_tx_desc = tx_desc;
  337. return 0;
  338. }
  339. /*
  340. * PFE/Class initialization.
  341. */
  342. static void pfe_class_init(struct pfe_ddr_address *pfe_addr)
  343. {
  344. struct class_cfg class_cfg = {
  345. .route_table_baseaddr = pfe_addr->ddr_pfe_phys_baseaddr +
  346. ROUTE_TABLE_BASEADDR,
  347. .route_table_hash_bits = ROUTE_TABLE_HASH_BITS,
  348. };
  349. class_init(&class_cfg);
  350. debug("class init complete\n");
  351. }
  352. /*
  353. * PFE/TMU initialization.
  354. */
  355. static void pfe_tmu_init(struct pfe_ddr_address *pfe_addr)
  356. {
  357. struct tmu_cfg tmu_cfg = {
  358. .llm_base_addr = pfe_addr->ddr_pfe_phys_baseaddr
  359. + TMU_LLM_BASEADDR,
  360. .llm_queue_len = TMU_LLM_QUEUE_LEN,
  361. };
  362. tmu_init(&tmu_cfg);
  363. debug("tmu init complete\n");
  364. }
  365. /*
  366. * PFE/BMU (both BMU1 & BMU2) initialization.
  367. */
  368. static void pfe_bmu_init(struct pfe_ddr_address *pfe_addr)
  369. {
  370. struct bmu_cfg bmu1_cfg = {
  371. .baseaddr = CBUS_VIRT_TO_PFE(LMEM_BASE_ADDR +
  372. BMU1_LMEM_BASEADDR),
  373. .count = BMU1_BUF_COUNT,
  374. .size = BMU1_BUF_SIZE,
  375. };
  376. struct bmu_cfg bmu2_cfg = {
  377. .baseaddr = pfe_addr->ddr_pfe_phys_baseaddr + BMU2_DDR_BASEADDR,
  378. .count = BMU2_BUF_COUNT,
  379. .size = BMU2_BUF_SIZE,
  380. };
  381. bmu_init(BMU1_BASE_ADDR, &bmu1_cfg);
  382. debug("bmu1 init: done\n");
  383. bmu_init(BMU2_BASE_ADDR, &bmu2_cfg);
  384. debug("bmu2 init: done\n");
  385. }
  386. /*
  387. * PFE/GPI initialization function.
  388. * - egpi1, egpi2, egpi3, hgpi
  389. */
  390. static void pfe_gpi_init(struct pfe_ddr_address *pfe_addr)
  391. {
  392. struct gpi_cfg egpi1_cfg = {
  393. .lmem_rtry_cnt = EGPI1_LMEM_RTRY_CNT,
  394. .tmlf_txthres = EGPI1_TMLF_TXTHRES,
  395. .aseq_len = EGPI1_ASEQ_LEN,
  396. };
  397. struct gpi_cfg egpi2_cfg = {
  398. .lmem_rtry_cnt = EGPI2_LMEM_RTRY_CNT,
  399. .tmlf_txthres = EGPI2_TMLF_TXTHRES,
  400. .aseq_len = EGPI2_ASEQ_LEN,
  401. };
  402. struct gpi_cfg hgpi_cfg = {
  403. .lmem_rtry_cnt = HGPI_LMEM_RTRY_CNT,
  404. .tmlf_txthres = HGPI_TMLF_TXTHRES,
  405. .aseq_len = HGPI_ASEQ_LEN,
  406. };
  407. gpi_init(EGPI1_BASE_ADDR, &egpi1_cfg);
  408. debug("GPI1 init complete\n");
  409. gpi_init(EGPI2_BASE_ADDR, &egpi2_cfg);
  410. debug("GPI2 init complete\n");
  411. gpi_init(HGPI_BASE_ADDR, &hgpi_cfg);
  412. debug("HGPI init complete\n");
  413. }
  414. /*
  415. * PFE/HIF initialization function.
  416. */
  417. static int pfe_hif_init(struct pfe_ddr_address *pfe_addr)
  418. {
  419. int ret = 0;
  420. hif_tx_disable();
  421. hif_rx_disable();
  422. ret = hif_tx_desc_init(pfe_addr);
  423. if (ret)
  424. return ret;
  425. ret = hif_rx_desc_init(pfe_addr);
  426. if (ret)
  427. return ret;
  428. hif_init();
  429. hif_tx_enable();
  430. hif_rx_enable();
  431. hif_rx_desc_dump();
  432. hif_tx_desc_dump();
  433. debug("HIF init complete\n");
  434. return ret;
  435. }
  436. /*
  437. * PFE initialization
  438. * - Firmware loading (CLASS-PE and TMU-PE)
  439. * - BMU1 and BMU2 init
  440. * - GEMAC init
  441. * - GPI init
  442. * - CLASS-PE init
  443. * - TMU-PE init
  444. * - HIF tx and rx descriptors init
  445. *
  446. * @param[in] edev Pointer to eth device structure.
  447. *
  448. * @return 0, on success.
  449. */
  450. static int pfe_hw_init(struct pfe_ddr_address *pfe_addr)
  451. {
  452. int ret = 0;
  453. debug("%s: start\n", __func__);
  454. writel(0x3, CLASS_PE_SYS_CLK_RATIO);
  455. writel(0x3, TMU_PE_SYS_CLK_RATIO);
  456. writel(0x3, UTIL_PE_SYS_CLK_RATIO);
  457. udelay(10);
  458. pfe_class_init(pfe_addr);
  459. pfe_tmu_init(pfe_addr);
  460. pfe_bmu_init(pfe_addr);
  461. pfe_gpi_init(pfe_addr);
  462. ret = pfe_hif_init(pfe_addr);
  463. if (ret)
  464. return ret;
  465. bmu_enable(BMU1_BASE_ADDR);
  466. debug("bmu1 enabled\n");
  467. bmu_enable(BMU2_BASE_ADDR);
  468. debug("bmu2 enabled\n");
  469. debug("%s: done\n", __func__);
  470. return ret;
  471. }
  472. /*
  473. * PFE driver init function.
  474. * - Initializes pfe_lib
  475. * - pfe hw init
  476. * - fw loading and enables PEs
  477. * - should be executed once.
  478. *
  479. * @param[in] pfe Pointer the pfe control block
  480. */
  481. int pfe_drv_init(struct pfe_ddr_address *pfe_addr)
  482. {
  483. int ret = 0;
  484. pfe_lib_init();
  485. ret = pfe_hw_init(pfe_addr);
  486. if (ret)
  487. return ret;
  488. /* Load the class,TM, Util fw.
  489. * By now pfe is:
  490. * - out of reset + disabled + configured.
  491. * Fw loading should be done after pfe_hw_init()
  492. */
  493. /* It loads default inbuilt sbl firmware */
  494. pfe_firmware_init();
  495. return ret;
  496. }
  497. /*
  498. * PFE remove function
  499. * - stops PEs
  500. * - frees tx/rx descriptor resources
  501. * - should be called once.
  502. *
  503. * @param[in] pfe Pointer to pfe control block.
  504. */
  505. int pfe_eth_remove(struct udevice *dev)
  506. {
  507. if (g_tx_desc)
  508. free(g_tx_desc);
  509. if (g_rx_desc)
  510. free(g_rx_desc);
  511. pfe_firmware_exit();
  512. return 0;
  513. }