ts78xx-setup.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. * arch/arm/mach-orion5x/ts78xx-setup.c
  3. *
  4. * Maintainer: Alexander Clouter <alex@digriz.org.uk>
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/sysfs.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/mv643xx_eth.h>
  15. #include <linux/ata_platform.h>
  16. #include <linux/m48t86.h>
  17. #include <linux/mtd/nand.h>
  18. #include <linux/mtd/partitions.h>
  19. #include <linux/timeriomem-rng.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <mach/orion5x.h>
  24. #include "common.h"
  25. #include "mpp.h"
  26. #include "ts78xx-fpga.h"
  27. /*****************************************************************************
  28. * TS-78xx Info
  29. ****************************************************************************/
  30. /*
  31. * FPGA - lives where the PCI bus would be at ORION5X_PCI_MEM_PHYS_BASE
  32. */
  33. #define TS78XX_FPGA_REGS_PHYS_BASE 0xe8000000
  34. #define TS78XX_FPGA_REGS_VIRT_BASE 0xff900000
  35. #define TS78XX_FPGA_REGS_SIZE SZ_1M
  36. static struct ts78xx_fpga_data ts78xx_fpga = {
  37. .id = 0,
  38. .state = 1,
  39. /* .supports = ... - populated by ts78xx_fpga_supports() */
  40. };
  41. /*****************************************************************************
  42. * I/O Address Mapping
  43. ****************************************************************************/
  44. static struct map_desc ts78xx_io_desc[] __initdata = {
  45. {
  46. .virtual = TS78XX_FPGA_REGS_VIRT_BASE,
  47. .pfn = __phys_to_pfn(TS78XX_FPGA_REGS_PHYS_BASE),
  48. .length = TS78XX_FPGA_REGS_SIZE,
  49. .type = MT_DEVICE,
  50. },
  51. };
  52. void __init ts78xx_map_io(void)
  53. {
  54. orion5x_map_io();
  55. iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc));
  56. }
  57. /*****************************************************************************
  58. * Ethernet
  59. ****************************************************************************/
  60. static struct mv643xx_eth_platform_data ts78xx_eth_data = {
  61. .phy_addr = MV643XX_ETH_PHY_ADDR(0),
  62. };
  63. /*****************************************************************************
  64. * SATA
  65. ****************************************************************************/
  66. static struct mv_sata_platform_data ts78xx_sata_data = {
  67. .n_ports = 2,
  68. };
  69. /*****************************************************************************
  70. * RTC M48T86 - nicked^Wborrowed from arch/arm/mach-ep93xx/ts72xx.c
  71. ****************************************************************************/
  72. #define TS_RTC_CTRL (TS78XX_FPGA_REGS_VIRT_BASE | 0x808)
  73. #define TS_RTC_DATA (TS78XX_FPGA_REGS_VIRT_BASE | 0x80c)
  74. static unsigned char ts78xx_ts_rtc_readbyte(unsigned long addr)
  75. {
  76. writeb(addr, TS_RTC_CTRL);
  77. return readb(TS_RTC_DATA);
  78. }
  79. static void ts78xx_ts_rtc_writebyte(unsigned char value, unsigned long addr)
  80. {
  81. writeb(addr, TS_RTC_CTRL);
  82. writeb(value, TS_RTC_DATA);
  83. }
  84. static struct m48t86_ops ts78xx_ts_rtc_ops = {
  85. .readbyte = ts78xx_ts_rtc_readbyte,
  86. .writebyte = ts78xx_ts_rtc_writebyte,
  87. };
  88. static struct platform_device ts78xx_ts_rtc_device = {
  89. .name = "rtc-m48t86",
  90. .id = -1,
  91. .dev = {
  92. .platform_data = &ts78xx_ts_rtc_ops,
  93. },
  94. .num_resources = 0,
  95. };
  96. /*
  97. * TS uses some of the user storage space on the RTC chip so see if it is
  98. * present; as it's an optional feature at purchase time and not all boards
  99. * will have it present
  100. *
  101. * I've used the method TS use in their rtc7800.c example for the detection
  102. *
  103. * TODO: track down a guinea pig without an RTC to see if we can work out a
  104. * better RTC detection routine
  105. */
  106. static int ts78xx_ts_rtc_load(void)
  107. {
  108. int rc;
  109. unsigned char tmp_rtc0, tmp_rtc1;
  110. tmp_rtc0 = ts78xx_ts_rtc_readbyte(126);
  111. tmp_rtc1 = ts78xx_ts_rtc_readbyte(127);
  112. ts78xx_ts_rtc_writebyte(0x00, 126);
  113. ts78xx_ts_rtc_writebyte(0x55, 127);
  114. if (ts78xx_ts_rtc_readbyte(127) == 0x55) {
  115. ts78xx_ts_rtc_writebyte(0xaa, 127);
  116. if (ts78xx_ts_rtc_readbyte(127) == 0xaa
  117. && ts78xx_ts_rtc_readbyte(126) == 0x00) {
  118. ts78xx_ts_rtc_writebyte(tmp_rtc0, 126);
  119. ts78xx_ts_rtc_writebyte(tmp_rtc1, 127);
  120. if (ts78xx_fpga.supports.ts_rtc.init == 0) {
  121. rc = platform_device_register(&ts78xx_ts_rtc_device);
  122. if (!rc)
  123. ts78xx_fpga.supports.ts_rtc.init = 1;
  124. } else
  125. rc = platform_device_add(&ts78xx_ts_rtc_device);
  126. return rc;
  127. }
  128. }
  129. return -ENODEV;
  130. };
  131. static void ts78xx_ts_rtc_unload(void)
  132. {
  133. platform_device_del(&ts78xx_ts_rtc_device);
  134. }
  135. /*****************************************************************************
  136. * NAND Flash
  137. ****************************************************************************/
  138. #define TS_NAND_CTRL (TS78XX_FPGA_REGS_VIRT_BASE | 0x800) /* VIRT */
  139. #define TS_NAND_DATA (TS78XX_FPGA_REGS_PHYS_BASE | 0x804) /* PHYS */
  140. /*
  141. * hardware specific access to control-lines
  142. *
  143. * ctrl:
  144. * NAND_NCE: bit 0 -> bit 2
  145. * NAND_CLE: bit 1 -> bit 1
  146. * NAND_ALE: bit 2 -> bit 0
  147. */
  148. static void ts78xx_ts_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
  149. unsigned int ctrl)
  150. {
  151. struct nand_chip *this = mtd->priv;
  152. if (ctrl & NAND_CTRL_CHANGE) {
  153. unsigned char bits;
  154. bits = (ctrl & NAND_NCE) << 2;
  155. bits |= ctrl & NAND_CLE;
  156. bits |= (ctrl & NAND_ALE) >> 2;
  157. writeb((readb(TS_NAND_CTRL) & ~0x7) | bits, TS_NAND_CTRL);
  158. }
  159. if (cmd != NAND_CMD_NONE)
  160. writeb(cmd, this->IO_ADDR_W);
  161. }
  162. static int ts78xx_ts_nand_dev_ready(struct mtd_info *mtd)
  163. {
  164. return readb(TS_NAND_CTRL) & 0x20;
  165. }
  166. static void ts78xx_ts_nand_write_buf(struct mtd_info *mtd,
  167. const uint8_t *buf, int len)
  168. {
  169. struct nand_chip *chip = mtd->priv;
  170. void __iomem *io_base = chip->IO_ADDR_W;
  171. unsigned long off = ((unsigned long)buf & 3);
  172. int sz;
  173. if (off) {
  174. sz = min_t(int, 4 - off, len);
  175. writesb(io_base, buf, sz);
  176. buf += sz;
  177. len -= sz;
  178. }
  179. sz = len >> 2;
  180. if (sz) {
  181. u32 *buf32 = (u32 *)buf;
  182. writesl(io_base, buf32, sz);
  183. buf += sz << 2;
  184. len -= sz << 2;
  185. }
  186. if (len)
  187. writesb(io_base, buf, len);
  188. }
  189. static void ts78xx_ts_nand_read_buf(struct mtd_info *mtd,
  190. uint8_t *buf, int len)
  191. {
  192. struct nand_chip *chip = mtd->priv;
  193. void __iomem *io_base = chip->IO_ADDR_R;
  194. unsigned long off = ((unsigned long)buf & 3);
  195. int sz;
  196. if (off) {
  197. sz = min_t(int, 4 - off, len);
  198. readsb(io_base, buf, sz);
  199. buf += sz;
  200. len -= sz;
  201. }
  202. sz = len >> 2;
  203. if (sz) {
  204. u32 *buf32 = (u32 *)buf;
  205. readsl(io_base, buf32, sz);
  206. buf += sz << 2;
  207. len -= sz << 2;
  208. }
  209. if (len)
  210. readsb(io_base, buf, len);
  211. }
  212. static struct mtd_partition ts78xx_ts_nand_parts[] = {
  213. {
  214. .name = "mbr",
  215. .offset = 0,
  216. .size = SZ_128K,
  217. .mask_flags = MTD_WRITEABLE,
  218. }, {
  219. .name = "kernel",
  220. .offset = MTDPART_OFS_APPEND,
  221. .size = SZ_4M,
  222. }, {
  223. .name = "initrd",
  224. .offset = MTDPART_OFS_APPEND,
  225. .size = SZ_4M,
  226. }, {
  227. .name = "rootfs",
  228. .offset = MTDPART_OFS_APPEND,
  229. .size = MTDPART_SIZ_FULL,
  230. }
  231. };
  232. static struct platform_nand_data ts78xx_ts_nand_data = {
  233. .chip = {
  234. .nr_chips = 1,
  235. .partitions = ts78xx_ts_nand_parts,
  236. .nr_partitions = ARRAY_SIZE(ts78xx_ts_nand_parts),
  237. .chip_delay = 15,
  238. .bbt_options = NAND_BBT_USE_FLASH,
  239. },
  240. .ctrl = {
  241. /*
  242. * The HW ECC offloading functions, used to give about a 9%
  243. * performance increase for 'dd if=/dev/mtdblockX' and 5% for
  244. * nanddump. This all however was changed by git commit
  245. * e6cf5df1838c28bb060ac45b5585e48e71bbc740 so now there is
  246. * no performance advantage to be had so we no longer bother
  247. */
  248. .cmd_ctrl = ts78xx_ts_nand_cmd_ctrl,
  249. .dev_ready = ts78xx_ts_nand_dev_ready,
  250. .write_buf = ts78xx_ts_nand_write_buf,
  251. .read_buf = ts78xx_ts_nand_read_buf,
  252. },
  253. };
  254. static struct resource ts78xx_ts_nand_resources = {
  255. .start = TS_NAND_DATA,
  256. .end = TS_NAND_DATA + 4,
  257. .flags = IORESOURCE_MEM,
  258. };
  259. static struct platform_device ts78xx_ts_nand_device = {
  260. .name = "gen_nand",
  261. .id = -1,
  262. .dev = {
  263. .platform_data = &ts78xx_ts_nand_data,
  264. },
  265. .resource = &ts78xx_ts_nand_resources,
  266. .num_resources = 1,
  267. };
  268. static int ts78xx_ts_nand_load(void)
  269. {
  270. int rc;
  271. if (ts78xx_fpga.supports.ts_nand.init == 0) {
  272. rc = platform_device_register(&ts78xx_ts_nand_device);
  273. if (!rc)
  274. ts78xx_fpga.supports.ts_nand.init = 1;
  275. } else
  276. rc = platform_device_add(&ts78xx_ts_nand_device);
  277. return rc;
  278. };
  279. static void ts78xx_ts_nand_unload(void)
  280. {
  281. platform_device_del(&ts78xx_ts_nand_device);
  282. }
  283. /*****************************************************************************
  284. * HW RNG
  285. ****************************************************************************/
  286. #define TS_RNG_DATA (TS78XX_FPGA_REGS_PHYS_BASE | 0x044)
  287. static struct resource ts78xx_ts_rng_resource = {
  288. .flags = IORESOURCE_MEM,
  289. .start = TS_RNG_DATA,
  290. .end = TS_RNG_DATA + 4 - 1,
  291. };
  292. static struct timeriomem_rng_data ts78xx_ts_rng_data = {
  293. .period = 1000000, /* one second */
  294. };
  295. static struct platform_device ts78xx_ts_rng_device = {
  296. .name = "timeriomem_rng",
  297. .id = -1,
  298. .dev = {
  299. .platform_data = &ts78xx_ts_rng_data,
  300. },
  301. .resource = &ts78xx_ts_rng_resource,
  302. .num_resources = 1,
  303. };
  304. static int ts78xx_ts_rng_load(void)
  305. {
  306. int rc;
  307. if (ts78xx_fpga.supports.ts_rng.init == 0) {
  308. rc = platform_device_register(&ts78xx_ts_rng_device);
  309. if (!rc)
  310. ts78xx_fpga.supports.ts_rng.init = 1;
  311. } else
  312. rc = platform_device_add(&ts78xx_ts_rng_device);
  313. return rc;
  314. };
  315. static void ts78xx_ts_rng_unload(void)
  316. {
  317. platform_device_del(&ts78xx_ts_rng_device);
  318. }
  319. /*****************************************************************************
  320. * FPGA 'hotplug' support code
  321. ****************************************************************************/
  322. static void ts78xx_fpga_devices_zero_init(void)
  323. {
  324. ts78xx_fpga.supports.ts_rtc.init = 0;
  325. ts78xx_fpga.supports.ts_nand.init = 0;
  326. ts78xx_fpga.supports.ts_rng.init = 0;
  327. }
  328. static void ts78xx_fpga_supports(void)
  329. {
  330. /* TODO: put this 'table' into ts78xx-fpga.h */
  331. switch (ts78xx_fpga.id) {
  332. case TS7800_REV_1:
  333. case TS7800_REV_2:
  334. case TS7800_REV_3:
  335. case TS7800_REV_4:
  336. case TS7800_REV_5:
  337. case TS7800_REV_6:
  338. case TS7800_REV_7:
  339. case TS7800_REV_8:
  340. case TS7800_REV_9:
  341. ts78xx_fpga.supports.ts_rtc.present = 1;
  342. ts78xx_fpga.supports.ts_nand.present = 1;
  343. ts78xx_fpga.supports.ts_rng.present = 1;
  344. break;
  345. default:
  346. /* enable devices if magic matches */
  347. switch ((ts78xx_fpga.id >> 8) & 0xffffff) {
  348. case TS7800_FPGA_MAGIC:
  349. pr_warning("TS-7800 FPGA: unrecognized revision 0x%.2x\n",
  350. ts78xx_fpga.id & 0xff);
  351. ts78xx_fpga.supports.ts_rtc.present = 1;
  352. ts78xx_fpga.supports.ts_nand.present = 1;
  353. ts78xx_fpga.supports.ts_rng.present = 1;
  354. break;
  355. default:
  356. ts78xx_fpga.supports.ts_rtc.present = 0;
  357. ts78xx_fpga.supports.ts_nand.present = 0;
  358. ts78xx_fpga.supports.ts_rng.present = 0;
  359. }
  360. }
  361. }
  362. static int ts78xx_fpga_load_devices(void)
  363. {
  364. int tmp, ret = 0;
  365. if (ts78xx_fpga.supports.ts_rtc.present == 1) {
  366. tmp = ts78xx_ts_rtc_load();
  367. if (tmp) {
  368. pr_info("TS-78xx: RTC not registered\n");
  369. ts78xx_fpga.supports.ts_rtc.present = 0;
  370. }
  371. ret |= tmp;
  372. }
  373. if (ts78xx_fpga.supports.ts_nand.present == 1) {
  374. tmp = ts78xx_ts_nand_load();
  375. if (tmp) {
  376. pr_info("TS-78xx: NAND not registered\n");
  377. ts78xx_fpga.supports.ts_nand.present = 0;
  378. }
  379. ret |= tmp;
  380. }
  381. if (ts78xx_fpga.supports.ts_rng.present == 1) {
  382. tmp = ts78xx_ts_rng_load();
  383. if (tmp) {
  384. pr_info("TS-78xx: RNG not registered\n");
  385. ts78xx_fpga.supports.ts_rng.present = 0;
  386. }
  387. ret |= tmp;
  388. }
  389. return ret;
  390. }
  391. static int ts78xx_fpga_unload_devices(void)
  392. {
  393. int ret = 0;
  394. if (ts78xx_fpga.supports.ts_rtc.present == 1)
  395. ts78xx_ts_rtc_unload();
  396. if (ts78xx_fpga.supports.ts_nand.present == 1)
  397. ts78xx_ts_nand_unload();
  398. if (ts78xx_fpga.supports.ts_rng.present == 1)
  399. ts78xx_ts_rng_unload();
  400. return ret;
  401. }
  402. static int ts78xx_fpga_load(void)
  403. {
  404. ts78xx_fpga.id = readl(TS78XX_FPGA_REGS_VIRT_BASE);
  405. pr_info("TS-78xx FPGA: magic=0x%.6x, rev=0x%.2x\n",
  406. (ts78xx_fpga.id >> 8) & 0xffffff,
  407. ts78xx_fpga.id & 0xff);
  408. ts78xx_fpga_supports();
  409. if (ts78xx_fpga_load_devices()) {
  410. ts78xx_fpga.state = -1;
  411. return -EBUSY;
  412. }
  413. return 0;
  414. };
  415. static int ts78xx_fpga_unload(void)
  416. {
  417. unsigned int fpga_id;
  418. fpga_id = readl(TS78XX_FPGA_REGS_VIRT_BASE);
  419. /*
  420. * There does not seem to be a feasible way to block access to the GPIO
  421. * pins from userspace (/dev/mem). This if clause should hopefully warn
  422. * those foolish enough not to follow 'policy' :)
  423. *
  424. * UrJTAG SVN since r1381 can be used to reprogram the FPGA
  425. */
  426. if (ts78xx_fpga.id != fpga_id) {
  427. pr_err("TS-78xx FPGA: magic/rev mismatch\n"
  428. "TS-78xx FPGA: was 0x%.6x/%.2x but now 0x%.6x/%.2x\n",
  429. (ts78xx_fpga.id >> 8) & 0xffffff, ts78xx_fpga.id & 0xff,
  430. (fpga_id >> 8) & 0xffffff, fpga_id & 0xff);
  431. ts78xx_fpga.state = -1;
  432. return -EBUSY;
  433. }
  434. if (ts78xx_fpga_unload_devices()) {
  435. ts78xx_fpga.state = -1;
  436. return -EBUSY;
  437. }
  438. return 0;
  439. };
  440. static ssize_t ts78xx_fpga_show(struct kobject *kobj,
  441. struct kobj_attribute *attr, char *buf)
  442. {
  443. if (ts78xx_fpga.state < 0)
  444. return sprintf(buf, "borked\n");
  445. return sprintf(buf, "%s\n", (ts78xx_fpga.state) ? "online" : "offline");
  446. }
  447. static ssize_t ts78xx_fpga_store(struct kobject *kobj,
  448. struct kobj_attribute *attr, const char *buf, size_t n)
  449. {
  450. int value, ret;
  451. if (ts78xx_fpga.state < 0) {
  452. pr_err("TS-78xx FPGA: borked, you must powercycle asap\n");
  453. return -EBUSY;
  454. }
  455. if (strncmp(buf, "online", sizeof("online") - 1) == 0)
  456. value = 1;
  457. else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0)
  458. value = 0;
  459. else {
  460. pr_err("ts78xx_fpga_store: Invalid value\n");
  461. return -EINVAL;
  462. }
  463. if (ts78xx_fpga.state == value)
  464. return n;
  465. ret = (ts78xx_fpga.state == 0)
  466. ? ts78xx_fpga_load()
  467. : ts78xx_fpga_unload();
  468. if (!(ret < 0))
  469. ts78xx_fpga.state = value;
  470. return n;
  471. }
  472. static struct kobj_attribute ts78xx_fpga_attr =
  473. __ATTR(ts78xx_fpga, 0644, ts78xx_fpga_show, ts78xx_fpga_store);
  474. /*****************************************************************************
  475. * General Setup
  476. ****************************************************************************/
  477. static unsigned int ts78xx_mpp_modes[] __initdata = {
  478. MPP0_UNUSED,
  479. MPP1_GPIO, /* JTAG Clock */
  480. MPP2_GPIO, /* JTAG Data In */
  481. MPP3_GPIO, /* Lat ECP2 256 FPGA - PB2B */
  482. MPP4_GPIO, /* JTAG Data Out */
  483. MPP5_GPIO, /* JTAG TMS */
  484. MPP6_GPIO, /* Lat ECP2 256 FPGA - PB31A_CLK4+ */
  485. MPP7_GPIO, /* Lat ECP2 256 FPGA - PB22B */
  486. MPP8_UNUSED,
  487. MPP9_UNUSED,
  488. MPP10_UNUSED,
  489. MPP11_UNUSED,
  490. MPP12_UNUSED,
  491. MPP13_UNUSED,
  492. MPP14_UNUSED,
  493. MPP15_UNUSED,
  494. MPP16_UART,
  495. MPP17_UART,
  496. MPP18_UART,
  497. MPP19_UART,
  498. /*
  499. * MPP[20] PCI Clock Out 1
  500. * MPP[21] PCI Clock Out 0
  501. * MPP[22] Unused
  502. * MPP[23] Unused
  503. * MPP[24] Unused
  504. * MPP[25] Unused
  505. */
  506. 0,
  507. };
  508. static void __init ts78xx_init(void)
  509. {
  510. int ret;
  511. /*
  512. * Setup basic Orion functions. Need to be called early.
  513. */
  514. orion5x_init();
  515. orion5x_mpp_conf(ts78xx_mpp_modes);
  516. /*
  517. * Configure peripherals.
  518. */
  519. orion5x_ehci0_init();
  520. orion5x_ehci1_init();
  521. orion5x_eth_init(&ts78xx_eth_data);
  522. orion5x_sata_init(&ts78xx_sata_data);
  523. orion5x_uart0_init();
  524. orion5x_uart1_init();
  525. orion5x_xor_init();
  526. /* FPGA init */
  527. ts78xx_fpga_devices_zero_init();
  528. ret = ts78xx_fpga_load();
  529. ret = sysfs_create_file(power_kobj, &ts78xx_fpga_attr.attr);
  530. if (ret)
  531. pr_err("sysfs_create_file failed: %d\n", ret);
  532. }
  533. MACHINE_START(TS78XX, "Technologic Systems TS-78xx SBC")
  534. /* Maintainer: Alexander Clouter <alex@digriz.org.uk> */
  535. .atag_offset = 0x100,
  536. .init_machine = ts78xx_init,
  537. .map_io = ts78xx_map_io,
  538. .init_early = orion5x_init_early,
  539. .init_irq = orion5x_init_irq,
  540. .timer = &orion5x_timer,
  541. .restart = orion5x_restart,
  542. MACHINE_END