Commit 79fd9281880974f076c5b4b354b57faa6e0cc146

Authored by Marek Vasut
Committed by Tom Rini
1 parent 65f83802b7

serial: 16550: Add port type as driver data

Add driver data to each compatible string to identify the type of
the port. Since all the ports in the driver are entirely compatible
with 16550 for now, all are marked with PORT_NS16550. But, there
are ports which have specific quirks, like the JZ4780 UART, which
do not have any DT property to denote the quirks. Instead, Linux
uses the compatible string to discern such ports and enable the
necessary quirks.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 16 additions and 10 deletions Side-by-side Diff

drivers/serial/ns16550.c
... ... @@ -360,6 +360,12 @@
360 360 return 0;
361 361 }
362 362  
  363 +#if CONFIG_IS_ENABLED(OF_CONTROL)
  364 +enum {
  365 + PORT_NS16550 = 0,
  366 +};
  367 +#endif
  368 +
363 369 #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
364 370 int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
365 371 {
... ... @@ -453,16 +459,16 @@
453 459 * compatible string to your dts.
454 460 */
455 461 static const struct udevice_id ns16550_serial_ids[] = {
456   - { .compatible = "ns16550" },
457   - { .compatible = "ns16550a" },
458   - { .compatible = "nvidia,tegra20-uart" },
459   - { .compatible = "snps,dw-apb-uart" },
460   - { .compatible = "ti,omap2-uart" },
461   - { .compatible = "ti,omap3-uart" },
462   - { .compatible = "ti,omap4-uart" },
463   - { .compatible = "ti,am3352-uart" },
464   - { .compatible = "ti,am4372-uart" },
465   - { .compatible = "ti,dra742-uart" },
  462 + { .compatible = "ns16550", .data = PORT_NS16550 },
  463 + { .compatible = "ns16550a", .data = PORT_NS16550 },
  464 + { .compatible = "nvidia,tegra20-uart", .data = PORT_NS16550 },
  465 + { .compatible = "snps,dw-apb-uart", .data = PORT_NS16550 },
  466 + { .compatible = "ti,omap2-uart", .data = PORT_NS16550 },
  467 + { .compatible = "ti,omap3-uart", .data = PORT_NS16550 },
  468 + { .compatible = "ti,omap4-uart", .data = PORT_NS16550 },
  469 + { .compatible = "ti,am3352-uart", .data = PORT_NS16550 },
  470 + { .compatible = "ti,am4372-uart", .data = PORT_NS16550 },
  471 + { .compatible = "ti,dra742-uart", .data = PORT_NS16550 },
466 472 {}
467 473 };
468 474 #endif