Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fcdff9b authored by Sekhar Nori's avatar Sekhar Nori Committed by Greg Kroah-Hartman
Browse files

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: default avatarSekhar Nori <nsekhar@ti.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Reviewed-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6f03541f
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,7 @@ Required properties:
- compatible : should be "ti,omap3-uart" for OMAP3 controllers
- compatible : should be "ti,omap3-uart" for OMAP3 controllers
- compatible : should be "ti,omap4-uart" for OMAP4 controllers
- compatible : should be "ti,omap4-uart" for OMAP4 controllers
- compatible : should be "ti,am4372-uart" for AM437x controllers
- compatible : should be "ti,am4372-uart" for AM437x controllers
- compatible : should be "ti,am3352-uart" for AM335x controllers
- reg : address and length of the register space
- reg : address and length of the register space
- interrupts or interrupts-extended : Should contain the uart interrupt
- interrupts or interrupts-extended : Should contain the uart interrupt
                                      specifier or both the interrupt
                                      specifier or both the interrupt
+6 −6
Original line number Original line Diff line number Diff line
@@ -210,7 +210,7 @@
		};
		};


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


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


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


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


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


		uart5: serial@481aa000 {
		uart5: serial@481aa000 {
			compatible = "ti,omap3-uart";
			compatible = "ti,am3352-uart", "ti,omap3-uart";
			ti,hwmods = "uart6";
			ti,hwmods = "uart6";
			clock-frequency = <48000000>;
			clock-frequency = <48000000>;
			reg = <0x481aa000 0x2000>;
			reg = <0x481aa000 0x2000>;
+21 −11
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h>
#include <linux/of_irq.h>
#include <linux/delay.h>
#include <linux/delay.h>
@@ -537,14 +538,14 @@ static void omap_serial_fill_features_erratas(struct uart_8250_port *up,


	switch (revision) {
	switch (revision) {
	case OMAP_UART_REV_46:
	case OMAP_UART_REV_46:
		priv->habit = UART_ERRATA_i202_MDR1_ACCESS;
		priv->habit |= UART_ERRATA_i202_MDR1_ACCESS;
		break;
		break;
	case OMAP_UART_REV_52:
	case OMAP_UART_REV_52:
		priv->habit = UART_ERRATA_i202_MDR1_ACCESS |
		priv->habit |= UART_ERRATA_i202_MDR1_ACCESS |
				OMAP_UART_WER_HAS_TX_WAKEUP;
				OMAP_UART_WER_HAS_TX_WAKEUP;
		break;
		break;
	case OMAP_UART_REV_63:
	case OMAP_UART_REV_63:
		priv->habit = UART_ERRATA_i202_MDR1_ACCESS |
		priv->habit |= UART_ERRATA_i202_MDR1_ACCESS |
			OMAP_UART_WER_HAS_TX_WAKEUP;
			OMAP_UART_WER_HAS_TX_WAKEUP;
		break;
		break;
	default:
	default:
@@ -1061,6 +1062,17 @@ static int omap8250_no_handle_irq(struct uart_port *port)
	return 0;
	return 0;
}
}


static const u8 am3352_habit = OMAP_DMA_TX_KICK;

static const struct of_device_id omap8250_dt_ids[] = {
	{ .compatible = "ti,omap2-uart" },
	{ .compatible = "ti,omap3-uart" },
	{ .compatible = "ti,omap4-uart" },
	{ .compatible = "ti,am3352-uart", .data = &am3352_habit, },
	{},
};
MODULE_DEVICE_TABLE(of, omap8250_dt_ids);

static int omap8250_probe(struct platform_device *pdev)
static int omap8250_probe(struct platform_device *pdev)
{
{
	struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	struct resource *regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1125,11 +1137,17 @@ static int omap8250_probe(struct platform_device *pdev)
	up.port.unthrottle = omap_8250_unthrottle;
	up.port.unthrottle = omap_8250_unthrottle;


	if (pdev->dev.of_node) {
	if (pdev->dev.of_node) {
		const struct of_device_id *id;

		ret = of_alias_get_id(pdev->dev.of_node, "serial");
		ret = of_alias_get_id(pdev->dev.of_node, "serial");


		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
				     &up.port.uartclk);
				     &up.port.uartclk);
		priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
		priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);

		id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev);
		if (id && id->data)
			priv->habit |= *(u8 *)id->data;
	} else {
	} else {
		ret = pdev->id;
		ret = pdev->id;
	}
	}
@@ -1374,14 +1392,6 @@ static const struct dev_pm_ops omap8250_dev_pm_ops = {
	.complete       = omap8250_complete,
	.complete       = omap8250_complete,
};
};


static const struct of_device_id omap8250_dt_ids[] = {
	{ .compatible = "ti,omap2-uart" },
	{ .compatible = "ti,omap3-uart" },
	{ .compatible = "ti,omap4-uart" },
	{},
};
MODULE_DEVICE_TABLE(of, omap8250_dt_ids);

static struct platform_driver omap8250_platform_driver = {
static struct platform_driver omap8250_platform_driver = {
	.driver = {
	.driver = {
		.name		= "omap8250",
		.name		= "omap8250",