Skip to content

Commit 4fcdff9

Browse files
nsekhargregkh
authored andcommitted
serial: 8250_omap: introduce "ti,am3352-uart" compatible property
Use of of_machine_is_compatible() for handling AM335x specific "DMA kick" quirk in 8250_omap driver makes it ugly to extend the quirk for other platforms. Instead use a new compatible. The new compatible will also make it easier to take care of other quirks on AM335x and like SoCs. In order to not break backward DTB compatibility for users of 8250_omap driver on AM335x based boards, existing use of of_machine_is_compatible() has not been removed. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6f03541 commit 4fcdff9

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

Documentation/devicetree/bindings/serial/omap_serial.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Required properties:
55
- compatible : should be "ti,omap3-uart" for OMAP3 controllers
66
- compatible : should be "ti,omap4-uart" for OMAP4 controllers
77
- compatible : should be "ti,am4372-uart" for AM437x controllers
8+
- compatible : should be "ti,am3352-uart" for AM335x controllers
89
- reg : address and length of the register space
910
- interrupts or interrupts-extended : Should contain the uart interrupt
1011
specifier or both the interrupt

arch/arm/boot/dts/am33xx.dtsi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@
210210
};
211211

212212
uart0: serial@44e09000 {
213-
compatible = "ti,omap3-uart";
213+
compatible = "ti,am3352-uart", "ti,omap3-uart";
214214
ti,hwmods = "uart1";
215215
clock-frequency = <48000000>;
216216
reg = <0x44e09000 0x2000>;
@@ -221,7 +221,7 @@
221221
};
222222

223223
uart1: serial@48022000 {
224-
compatible = "ti,omap3-uart";
224+
compatible = "ti,am3352-uart", "ti,omap3-uart";
225225
ti,hwmods = "uart2";
226226
clock-frequency = <48000000>;
227227
reg = <0x48022000 0x2000>;
@@ -232,7 +232,7 @@
232232
};
233233

234234
uart2: serial@48024000 {
235-
compatible = "ti,omap3-uart";
235+
compatible = "ti,am3352-uart", "ti,omap3-uart";
236236
ti,hwmods = "uart3";
237237
clock-frequency = <48000000>;
238238
reg = <0x48024000 0x2000>;
@@ -243,7 +243,7 @@
243243
};
244244

245245
uart3: serial@481a6000 {
246-
compatible = "ti,omap3-uart";
246+
compatible = "ti,am3352-uart", "ti,omap3-uart";
247247
ti,hwmods = "uart4";
248248
clock-frequency = <48000000>;
249249
reg = <0x481a6000 0x2000>;
@@ -252,7 +252,7 @@
252252
};
253253

254254
uart4: serial@481a8000 {
255-
compatible = "ti,omap3-uart";
255+
compatible = "ti,am3352-uart", "ti,omap3-uart";
256256
ti,hwmods = "uart5";
257257
clock-frequency = <48000000>;
258258
reg = <0x481a8000 0x2000>;
@@ -261,7 +261,7 @@
261261
};
262262

263263
uart5: serial@481aa000 {
264-
compatible = "ti,omap3-uart";
264+
compatible = "ti,am3352-uart", "ti,omap3-uart";
265265
ti,hwmods = "uart6";
266266
clock-frequency = <48000000>;
267267
reg = <0x481aa000 0x2000>;

drivers/tty/serial/8250/8250_omap.c

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/platform_device.h>
1717
#include <linux/slab.h>
1818
#include <linux/of.h>
19+
#include <linux/of_device.h>
1920
#include <linux/of_gpio.h>
2021
#include <linux/of_irq.h>
2122
#include <linux/delay.h>
@@ -537,14 +538,14 @@ static void omap_serial_fill_features_erratas(struct uart_8250_port *up,
537538

538539
switch (revision) {
539540
case OMAP_UART_REV_46:
540-
priv->habit = UART_ERRATA_i202_MDR1_ACCESS;
541+
priv->habit |= UART_ERRATA_i202_MDR1_ACCESS;
541542
break;
542543
case OMAP_UART_REV_52:
543-
priv->habit = UART_ERRATA_i202_MDR1_ACCESS |
544+
priv->habit |= UART_ERRATA_i202_MDR1_ACCESS |
544545
OMAP_UART_WER_HAS_TX_WAKEUP;
545546
break;
546547
case OMAP_UART_REV_63:
547-
priv->habit = UART_ERRATA_i202_MDR1_ACCESS |
548+
priv->habit |= UART_ERRATA_i202_MDR1_ACCESS |
548549
OMAP_UART_WER_HAS_TX_WAKEUP;
549550
break;
550551
default:
@@ -1061,6 +1062,17 @@ static int omap8250_no_handle_irq(struct uart_port *port)
10611062
return 0;
10621063
}
10631064

1065+
static const u8 am3352_habit = OMAP_DMA_TX_KICK;
1066+
1067+
static const struct of_device_id omap8250_dt_ids[] = {
1068+
{ .compatible = "ti,omap2-uart" },
1069+
{ .compatible = "ti,omap3-uart" },
1070+
{ .compatible = "ti,omap4-uart" },
1071+
{ .compatible = "ti,am3352-uart", .data = &am3352_habit, },
1072+
{},
1073+
};
1074+
MODULE_DEVICE_TABLE(of, omap8250_dt_ids);
1075+
10641076
static int omap8250_probe(struct platform_device *pdev)
10651077
{
10661078
struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1125,11 +1137,17 @@ static int omap8250_probe(struct platform_device *pdev)
11251137
up.port.unthrottle = omap_8250_unthrottle;
11261138

11271139
if (pdev->dev.of_node) {
1140+
const struct of_device_id *id;
1141+
11281142
ret = of_alias_get_id(pdev->dev.of_node, "serial");
11291143

11301144
of_property_read_u32(pdev->dev.of_node, "clock-frequency",
11311145
&up.port.uartclk);
11321146
priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
1147+
1148+
id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev);
1149+
if (id && id->data)
1150+
priv->habit |= *(u8 *)id->data;
11331151
} else {
11341152
ret = pdev->id;
11351153
}
@@ -1374,14 +1392,6 @@ static const struct dev_pm_ops omap8250_dev_pm_ops = {
13741392
.complete = omap8250_complete,
13751393
};
13761394

1377-
static const struct of_device_id omap8250_dt_ids[] = {
1378-
{ .compatible = "ti,omap2-uart" },
1379-
{ .compatible = "ti,omap3-uart" },
1380-
{ .compatible = "ti,omap4-uart" },
1381-
{},
1382-
};
1383-
MODULE_DEVICE_TABLE(of, omap8250_dt_ids);
1384-
13851395
static struct platform_driver omap8250_platform_driver = {
13861396
.driver = {
13871397
.name = "omap8250",

0 commit comments

Comments
 (0)