legacy_serial.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. #include <linux/kernel.h>
  2. #include <linux/serial.h>
  3. #include <linux/serial_8250.h>
  4. #include <linux/serial_core.h>
  5. #include <linux/console.h>
  6. #include <linux/pci.h>
  7. #include <linux/of_address.h>
  8. #include <linux/of_device.h>
  9. #include <linux/serial_reg.h>
  10. #include <asm/io.h>
  11. #include <asm/mmu.h>
  12. #include <asm/prom.h>
  13. #include <asm/serial.h>
  14. #include <asm/udbg.h>
  15. #include <asm/pci-bridge.h>
  16. #include <asm/ppc-pci.h>
  17. #undef DEBUG
  18. #ifdef DEBUG
  19. #define DBG(fmt...) do { printk(fmt); } while(0)
  20. #else
  21. #define DBG(fmt...) do { } while(0)
  22. #endif
  23. #define MAX_LEGACY_SERIAL_PORTS 8
  24. static struct plat_serial8250_port
  25. legacy_serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
  26. static struct legacy_serial_info {
  27. struct device_node *np;
  28. unsigned int speed;
  29. unsigned int clock;
  30. int irq_check_parent;
  31. phys_addr_t taddr;
  32. } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
  33. static struct __initdata of_device_id legacy_serial_parents[] = {
  34. {.type = "soc",},
  35. {.type = "tsi-bridge",},
  36. {.type = "opb", },
  37. {.compatible = "ibm,opb",},
  38. {.compatible = "simple-bus",},
  39. {.compatible = "wrs,epld-localbus",},
  40. {},
  41. };
  42. static unsigned int legacy_serial_count;
  43. static int legacy_serial_console = -1;
  44. static unsigned int tsi_serial_in(struct uart_port *p, int offset)
  45. {
  46. unsigned int tmp;
  47. offset = offset << p->regshift;
  48. if (offset == UART_IIR) {
  49. tmp = readl(p->membase + (UART_IIR & ~3));
  50. return (tmp >> 16) & 0xff; /* UART_IIR % 4 == 2 */
  51. } else
  52. return readb(p->membase + offset);
  53. }
  54. static void tsi_serial_out(struct uart_port *p, int offset, int value)
  55. {
  56. offset = offset << p->regshift;
  57. if (!((offset == UART_IER) && (value & UART_IER_UUE)))
  58. writeb(value, p->membase + offset);
  59. }
  60. static int __init add_legacy_port(struct device_node *np, int want_index,
  61. int iotype, phys_addr_t base,
  62. phys_addr_t taddr, unsigned long irq,
  63. upf_t flags, int irq_check_parent)
  64. {
  65. const __be32 *clk, *spd;
  66. u32 clock = BASE_BAUD * 16;
  67. int index;
  68. /* get clock freq. if present */
  69. clk = of_get_property(np, "clock-frequency", NULL);
  70. if (clk && *clk)
  71. clock = be32_to_cpup(clk);
  72. /* get default speed if present */
  73. spd = of_get_property(np, "current-speed", NULL);
  74. /* If we have a location index, then try to use it */
  75. if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
  76. index = want_index;
  77. else
  78. index = legacy_serial_count;
  79. /* if our index is still out of range, that mean that
  80. * array is full, we could scan for a free slot but that
  81. * make little sense to bother, just skip the port
  82. */
  83. if (index >= MAX_LEGACY_SERIAL_PORTS)
  84. return -1;
  85. if (index >= legacy_serial_count)
  86. legacy_serial_count = index + 1;
  87. /* Check if there is a port who already claimed our slot */
  88. if (legacy_serial_infos[index].np != NULL) {
  89. /* if we still have some room, move it, else override */
  90. if (legacy_serial_count < MAX_LEGACY_SERIAL_PORTS) {
  91. printk(KERN_DEBUG "Moved legacy port %d -> %d\n",
  92. index, legacy_serial_count);
  93. legacy_serial_ports[legacy_serial_count] =
  94. legacy_serial_ports[index];
  95. legacy_serial_infos[legacy_serial_count] =
  96. legacy_serial_infos[index];
  97. legacy_serial_count++;
  98. } else {
  99. printk(KERN_DEBUG "Replacing legacy port %d\n", index);
  100. }
  101. }
  102. /* Now fill the entry */
  103. memset(&legacy_serial_ports[index], 0,
  104. sizeof(struct plat_serial8250_port));
  105. if (iotype == UPIO_PORT)
  106. legacy_serial_ports[index].iobase = base;
  107. else
  108. legacy_serial_ports[index].mapbase = base;
  109. legacy_serial_ports[index].iotype = iotype;
  110. legacy_serial_ports[index].uartclk = clock;
  111. legacy_serial_ports[index].irq = irq;
  112. legacy_serial_ports[index].flags = flags;
  113. legacy_serial_infos[index].taddr = taddr;
  114. legacy_serial_infos[index].np = of_node_get(np);
  115. legacy_serial_infos[index].clock = clock;
  116. legacy_serial_infos[index].speed = spd ? be32_to_cpup(spd) : 0;
  117. legacy_serial_infos[index].irq_check_parent = irq_check_parent;
  118. if (iotype == UPIO_TSI) {
  119. legacy_serial_ports[index].serial_in = tsi_serial_in;
  120. legacy_serial_ports[index].serial_out = tsi_serial_out;
  121. }
  122. printk(KERN_DEBUG "Found legacy serial port %d for %s\n",
  123. index, np->full_name);
  124. printk(KERN_DEBUG " %s=%llx, taddr=%llx, irq=%lx, clk=%d, speed=%d\n",
  125. (iotype == UPIO_PORT) ? "port" : "mem",
  126. (unsigned long long)base, (unsigned long long)taddr, irq,
  127. legacy_serial_ports[index].uartclk,
  128. legacy_serial_infos[index].speed);
  129. return index;
  130. }
  131. static int __init add_legacy_soc_port(struct device_node *np,
  132. struct device_node *soc_dev)
  133. {
  134. u64 addr;
  135. const __be32 *addrp;
  136. upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ
  137. | UPF_FIXED_PORT;
  138. struct device_node *tsi = of_get_parent(np);
  139. /* We only support ports that have a clock frequency properly
  140. * encoded in the device-tree.
  141. */
  142. if (of_get_property(np, "clock-frequency", NULL) == NULL)
  143. return -1;
  144. /* if reg-shift or offset, don't try to use it */
  145. if ((of_get_property(np, "reg-shift", NULL) != NULL) ||
  146. (of_get_property(np, "reg-offset", NULL) != NULL))
  147. return -1;
  148. /* if rtas uses this device, don't try to use it as well */
  149. if (of_get_property(np, "used-by-rtas", NULL) != NULL)
  150. return -1;
  151. /* Get the address */
  152. addrp = of_get_address(soc_dev, 0, NULL, NULL);
  153. if (addrp == NULL)
  154. return -1;
  155. addr = of_translate_address(soc_dev, addrp);
  156. if (addr == OF_BAD_ADDR)
  157. return -1;
  158. /* Add port, irq will be dealt with later. We passed a translated
  159. * IO port value. It will be fixed up later along with the irq
  160. */
  161. if (tsi && !strcmp(tsi->type, "tsi-bridge"))
  162. return add_legacy_port(np, -1, UPIO_TSI, addr, addr, NO_IRQ, flags, 0);
  163. else
  164. return add_legacy_port(np, -1, UPIO_MEM, addr, addr, NO_IRQ, flags, 0);
  165. }
  166. static int __init add_legacy_isa_port(struct device_node *np,
  167. struct device_node *isa_brg)
  168. {
  169. const __be32 *reg;
  170. const char *typep;
  171. int index = -1;
  172. u64 taddr;
  173. DBG(" -> add_legacy_isa_port(%s)\n", np->full_name);
  174. /* Get the ISA port number */
  175. reg = of_get_property(np, "reg", NULL);
  176. if (reg == NULL)
  177. return -1;
  178. /* Verify it's an IO port, we don't support anything else */
  179. if (!(be32_to_cpu(reg[0]) & 0x00000001))
  180. return -1;
  181. /* Now look for an "ibm,aix-loc" property that gives us ordering
  182. * if any...
  183. */
  184. typep = of_get_property(np, "ibm,aix-loc", NULL);
  185. /* If we have a location index, then use it */
  186. if (typep && *typep == 'S')
  187. index = simple_strtol(typep+1, NULL, 0) - 1;
  188. /* Translate ISA address. If it fails, we still register the port
  189. * with no translated address so that it can be picked up as an IO
  190. * port later by the serial driver
  191. *
  192. * Note: Don't even try on P8 lpc, we know it's not directly mapped
  193. */
  194. if (!of_device_is_compatible(isa_brg, "ibm,power8-lpc")) {
  195. taddr = of_translate_address(np, reg);
  196. if (taddr == OF_BAD_ADDR)
  197. taddr = 0;
  198. } else
  199. taddr = 0;
  200. /* Add port, irq will be dealt with later */
  201. return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]),
  202. taddr, NO_IRQ, UPF_BOOT_AUTOCONF, 0);
  203. }
  204. #ifdef CONFIG_PCI
  205. static int __init add_legacy_pci_port(struct device_node *np,
  206. struct device_node *pci_dev)
  207. {
  208. u64 addr, base;
  209. const __be32 *addrp;
  210. unsigned int flags;
  211. int iotype, index = -1, lindex = 0;
  212. DBG(" -> add_legacy_pci_port(%s)\n", np->full_name);
  213. /* We only support ports that have a clock frequency properly
  214. * encoded in the device-tree (that is have an fcode). Anything
  215. * else can't be used that early and will be normally probed by
  216. * the generic 8250_pci driver later on. The reason is that 8250
  217. * compatible UARTs on PCI need all sort of quirks (port offsets
  218. * etc...) that this code doesn't know about
  219. */
  220. if (of_get_property(np, "clock-frequency", NULL) == NULL)
  221. return -1;
  222. /* Get the PCI address. Assume BAR 0 */
  223. addrp = of_get_pci_address(pci_dev, 0, NULL, &flags);
  224. if (addrp == NULL)
  225. return -1;
  226. /* We only support BAR 0 for now */
  227. iotype = (flags & IORESOURCE_MEM) ? UPIO_MEM : UPIO_PORT;
  228. addr = of_translate_address(pci_dev, addrp);
  229. if (addr == OF_BAD_ADDR)
  230. return -1;
  231. /* Set the IO base to the same as the translated address for MMIO,
  232. * or to the domain local IO base for PIO (it will be fixed up later)
  233. */
  234. if (iotype == UPIO_MEM)
  235. base = addr;
  236. else
  237. base = of_read_number(&addrp[2], 1);
  238. /* Try to guess an index... If we have subdevices of the pci dev,
  239. * we get to their "reg" property
  240. */
  241. if (np != pci_dev) {
  242. const __be32 *reg = of_get_property(np, "reg", NULL);
  243. if (reg && (be32_to_cpup(reg) < 4))
  244. index = lindex = be32_to_cpup(reg);
  245. }
  246. /* Local index means it's the Nth port in the PCI chip. Unfortunately
  247. * the offset to add here is device specific. We know about those
  248. * EXAR ports and we default to the most common case. If your UART
  249. * doesn't work for these settings, you'll have to add your own special
  250. * cases here
  251. */
  252. if (of_device_is_compatible(pci_dev, "pci13a8,152") ||
  253. of_device_is_compatible(pci_dev, "pci13a8,154") ||
  254. of_device_is_compatible(pci_dev, "pci13a8,158")) {
  255. addr += 0x200 * lindex;
  256. base += 0x200 * lindex;
  257. } else {
  258. addr += 8 * lindex;
  259. base += 8 * lindex;
  260. }
  261. /* Add port, irq will be dealt with later. We passed a translated
  262. * IO port value. It will be fixed up later along with the irq
  263. */
  264. return add_legacy_port(np, index, iotype, base, addr, NO_IRQ,
  265. UPF_BOOT_AUTOCONF, np != pci_dev);
  266. }
  267. #endif
  268. static void __init setup_legacy_serial_console(int console)
  269. {
  270. struct legacy_serial_info *info = &legacy_serial_infos[console];
  271. struct plat_serial8250_port *port = &legacy_serial_ports[console];
  272. void __iomem *addr;
  273. /* Check if a translated MMIO address has been found */
  274. if (info->taddr) {
  275. addr = ioremap(info->taddr, 0x1000);
  276. if (addr == NULL)
  277. return;
  278. udbg_uart_init_mmio(addr, 1);
  279. } else {
  280. /* Check if it's PIO and we support untranslated PIO */
  281. if (port->iotype == UPIO_PORT && isa_io_special)
  282. udbg_uart_init_pio(port->iobase, 1);
  283. else
  284. return;
  285. }
  286. /* Try to query the current speed */
  287. if (info->speed == 0)
  288. info->speed = udbg_probe_uart_speed(info->clock);
  289. /* Set it up */
  290. DBG("default console speed = %d\n", info->speed);
  291. udbg_uart_setup(info->speed, info->clock);
  292. }
  293. /*
  294. * This is called very early, as part of setup_system() or eventually
  295. * setup_arch(), basically before anything else in this file. This function
  296. * will try to build a list of all the available 8250-compatible serial ports
  297. * in the machine using the Open Firmware device-tree. It currently only deals
  298. * with ISA and PCI busses but could be extended. It allows a very early boot
  299. * console to be initialized, that list is also used later to provide 8250 with
  300. * the machine non-PCI ports and to properly pick the default console port
  301. */
  302. void __init find_legacy_serial_ports(void)
  303. {
  304. struct device_node *np, *stdout = NULL;
  305. const char *path;
  306. int index;
  307. DBG(" -> find_legacy_serial_port()\n");
  308. /* Now find out if one of these is out firmware console */
  309. path = of_get_property(of_chosen, "linux,stdout-path", NULL);
  310. if (path != NULL) {
  311. stdout = of_find_node_by_path(path);
  312. if (stdout)
  313. DBG("stdout is %s\n", stdout->full_name);
  314. } else {
  315. DBG(" no linux,stdout-path !\n");
  316. }
  317. /* Iterate over all the 16550 ports, looking for known parents */
  318. for_each_compatible_node(np, "serial", "ns16550") {
  319. struct device_node *parent = of_get_parent(np);
  320. if (!parent)
  321. continue;
  322. if (of_match_node(legacy_serial_parents, parent) != NULL) {
  323. if (of_device_is_available(np)) {
  324. index = add_legacy_soc_port(np, np);
  325. if (index >= 0 && np == stdout)
  326. legacy_serial_console = index;
  327. }
  328. }
  329. of_node_put(parent);
  330. }
  331. /* Next, fill our array with ISA ports */
  332. for_each_node_by_type(np, "serial") {
  333. struct device_node *isa = of_get_parent(np);
  334. if (isa && (!strcmp(isa->name, "isa") ||
  335. !strcmp(isa->name, "lpc"))) {
  336. if (of_device_is_available(np)) {
  337. index = add_legacy_isa_port(np, isa);
  338. if (index >= 0 && np == stdout)
  339. legacy_serial_console = index;
  340. }
  341. }
  342. of_node_put(isa);
  343. }
  344. #ifdef CONFIG_PCI
  345. /* Next, try to locate PCI ports */
  346. for (np = NULL; (np = of_find_all_nodes(np));) {
  347. struct device_node *pci, *parent = of_get_parent(np);
  348. if (parent && !strcmp(parent->name, "isa")) {
  349. of_node_put(parent);
  350. continue;
  351. }
  352. if (strcmp(np->name, "serial") && strcmp(np->type, "serial")) {
  353. of_node_put(parent);
  354. continue;
  355. }
  356. /* Check for known pciclass, and also check whether we have
  357. * a device with child nodes for ports or not
  358. */
  359. if (of_device_is_compatible(np, "pciclass,0700") ||
  360. of_device_is_compatible(np, "pciclass,070002"))
  361. pci = np;
  362. else if (of_device_is_compatible(parent, "pciclass,0700") ||
  363. of_device_is_compatible(parent, "pciclass,070002"))
  364. pci = parent;
  365. else {
  366. of_node_put(parent);
  367. continue;
  368. }
  369. index = add_legacy_pci_port(np, pci);
  370. if (index >= 0 && np == stdout)
  371. legacy_serial_console = index;
  372. of_node_put(parent);
  373. }
  374. #endif
  375. DBG("legacy_serial_console = %d\n", legacy_serial_console);
  376. if (legacy_serial_console >= 0)
  377. setup_legacy_serial_console(legacy_serial_console);
  378. DBG(" <- find_legacy_serial_port()\n");
  379. }
  380. static struct platform_device serial_device = {
  381. .name = "serial8250",
  382. .id = PLAT8250_DEV_PLATFORM,
  383. .dev = {
  384. .platform_data = legacy_serial_ports,
  385. },
  386. };
  387. static void __init fixup_port_irq(int index,
  388. struct device_node *np,
  389. struct plat_serial8250_port *port)
  390. {
  391. unsigned int virq;
  392. DBG("fixup_port_irq(%d)\n", index);
  393. virq = irq_of_parse_and_map(np, 0);
  394. if (virq == NO_IRQ && legacy_serial_infos[index].irq_check_parent) {
  395. np = of_get_parent(np);
  396. if (np == NULL)
  397. return;
  398. virq = irq_of_parse_and_map(np, 0);
  399. of_node_put(np);
  400. }
  401. if (virq == NO_IRQ)
  402. return;
  403. port->irq = virq;
  404. #ifdef CONFIG_SERIAL_8250_FSL
  405. if (of_device_is_compatible(np, "fsl,ns16550"))
  406. port->handle_irq = fsl8250_handle_irq;
  407. #endif
  408. }
  409. static void __init fixup_port_pio(int index,
  410. struct device_node *np,
  411. struct plat_serial8250_port *port)
  412. {
  413. #ifdef CONFIG_PCI
  414. struct pci_controller *hose;
  415. DBG("fixup_port_pio(%d)\n", index);
  416. hose = pci_find_hose_for_OF_device(np);
  417. if (hose) {
  418. unsigned long offset = (unsigned long)hose->io_base_virt -
  419. #ifdef CONFIG_PPC64
  420. pci_io_base;
  421. #else
  422. isa_io_base;
  423. #endif
  424. DBG("port %d, IO %lx -> %lx\n",
  425. index, port->iobase, port->iobase + offset);
  426. port->iobase += offset;
  427. }
  428. #endif
  429. }
  430. static void __init fixup_port_mmio(int index,
  431. struct device_node *np,
  432. struct plat_serial8250_port *port)
  433. {
  434. DBG("fixup_port_mmio(%d)\n", index);
  435. port->membase = ioremap(port->mapbase, 0x100);
  436. }
  437. /*
  438. * This is called as an arch initcall, hopefully before the PCI bus is
  439. * probed and/or the 8250 driver loaded since we need to register our
  440. * platform devices before 8250 PCI ones are detected as some of them
  441. * must properly "override" the platform ones.
  442. *
  443. * This function fixes up the interrupt value for platform ports as it
  444. * couldn't be done earlier before interrupt maps have been parsed. It
  445. * also "corrects" the IO address for PIO ports for the same reason,
  446. * since earlier, the PHBs virtual IO space wasn't assigned yet. It then
  447. * registers all those platform ports for use by the 8250 driver when it
  448. * finally loads.
  449. */
  450. static int __init serial_dev_init(void)
  451. {
  452. int i;
  453. if (legacy_serial_count == 0)
  454. return -ENODEV;
  455. /*
  456. * Before we register the platform serial devices, we need
  457. * to fixup their interrupts and their IO ports.
  458. */
  459. DBG("Fixing serial ports interrupts and IO ports ...\n");
  460. for (i = 0; i < legacy_serial_count; i++) {
  461. struct plat_serial8250_port *port = &legacy_serial_ports[i];
  462. struct device_node *np = legacy_serial_infos[i].np;
  463. if (port->irq == NO_IRQ)
  464. fixup_port_irq(i, np, port);
  465. if (port->iotype == UPIO_PORT)
  466. fixup_port_pio(i, np, port);
  467. if ((port->iotype == UPIO_MEM) || (port->iotype == UPIO_TSI))
  468. fixup_port_mmio(i, np, port);
  469. }
  470. DBG("Registering platform serial ports\n");
  471. return platform_device_register(&serial_device);
  472. }
  473. device_initcall(serial_dev_init);
  474. #ifdef CONFIG_SERIAL_8250_CONSOLE
  475. /*
  476. * This is called very early, as part of console_init() (typically just after
  477. * time_init()). This function is respondible for trying to find a good
  478. * default console on serial ports. It tries to match the open firmware
  479. * default output with one of the available serial console drivers that have
  480. * been probed earlier by find_legacy_serial_ports()
  481. */
  482. static int __init check_legacy_serial_console(void)
  483. {
  484. struct device_node *prom_stdout = NULL;
  485. int i, speed = 0, offset = 0;
  486. const char *name;
  487. const __be32 *spd;
  488. DBG(" -> check_legacy_serial_console()\n");
  489. /* The user has requested a console so this is already set up. */
  490. if (strstr(boot_command_line, "console=")) {
  491. DBG(" console was specified !\n");
  492. return -EBUSY;
  493. }
  494. if (!of_chosen) {
  495. DBG(" of_chosen is NULL !\n");
  496. return -ENODEV;
  497. }
  498. if (legacy_serial_console < 0) {
  499. DBG(" legacy_serial_console not found !\n");
  500. return -ENODEV;
  501. }
  502. /* We are getting a weird phandle from OF ... */
  503. /* ... So use the full path instead */
  504. name = of_get_property(of_chosen, "linux,stdout-path", NULL);
  505. if (name == NULL) {
  506. DBG(" no linux,stdout-path !\n");
  507. return -ENODEV;
  508. }
  509. prom_stdout = of_find_node_by_path(name);
  510. if (!prom_stdout) {
  511. DBG(" can't find stdout package %s !\n", name);
  512. return -ENODEV;
  513. }
  514. DBG("stdout is %s\n", prom_stdout->full_name);
  515. name = of_get_property(prom_stdout, "name", NULL);
  516. if (!name) {
  517. DBG(" stdout package has no name !\n");
  518. goto not_found;
  519. }
  520. spd = of_get_property(prom_stdout, "current-speed", NULL);
  521. if (spd)
  522. speed = be32_to_cpup(spd);
  523. if (strcmp(name, "serial") != 0)
  524. goto not_found;
  525. /* Look for it in probed array */
  526. for (i = 0; i < legacy_serial_count; i++) {
  527. if (prom_stdout != legacy_serial_infos[i].np)
  528. continue;
  529. offset = i;
  530. speed = legacy_serial_infos[i].speed;
  531. break;
  532. }
  533. if (i >= legacy_serial_count)
  534. goto not_found;
  535. of_node_put(prom_stdout);
  536. DBG("Found serial console at ttyS%d\n", offset);
  537. if (speed) {
  538. static char __initdata opt[16];
  539. sprintf(opt, "%d", speed);
  540. return add_preferred_console("ttyS", offset, opt);
  541. } else
  542. return add_preferred_console("ttyS", offset, NULL);
  543. not_found:
  544. DBG("No preferred console found !\n");
  545. of_node_put(prom_stdout);
  546. return -ENODEV;
  547. }
  548. console_initcall(check_legacy_serial_console);
  549. #endif /* CONFIG_SERIAL_8250_CONSOLE */