Skip to contentSkip to conversation

OMAP serial device tree support

PATCH Superseded Rajendra Nayak 3 participants 12 messages Nov 22, 2011 – Nov 29, 2011

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover OMAP serial device tree support

v2 is based on the latest omap-serial runtime patches, which can be found here[1]

The series passes minimal data that allows serial console boot, with UART's initialised from device tree. However some of low power support for UART and remote wakeup needs more work.
Boot tested on OMAP4 panda and OMAP4 sdp boards.

Patches can be found here..
git://gitorious.org/omap-pm/linux.git for-dt/serial

Changes in v2:
-1- Got rid of binding to define which uart is console -2- Added checks to default clock speed to 48Mhz -3- Added compatible for each OMAP family
-4- Used of_alias_get_id to populate port.line

regards,
Rajendra

[1] git://gitorious.org/runtime_3-0/runtime_3-0.git 3.2-rc2_uart_runtime

Rajendra Nayak (4):
omap-serial: Get rid of all pdev->id usage
omap-serial: Use default clock speed (48Mhz) if not specified
omap-serial: Add minimal device tree support
ARM: omap: pass minimal SoC/board data for UART from dt

 .../devicetree/bindings/serial/omap_serial.txt     |   10 +++
 arch/arm/boot/dts/omap3.dtsi                       |   31 ++++++++
 arch/arm/boot/dts/omap4.dtsi                       |   28 +++++++
 arch/arm/mach-omap2/board-generic.c                |    1 -
 drivers/tty/serial/omap-serial.c                   |   80 +++++++++++++++----
 5 files changed, 132 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/omap_serial.txt
#1 lore raw

PATCH v2 1/4 omap-serial: Get rid of all pdev->id usage

With Device tree, pdev->id would no longer be Valid. Hence get rid of all instances of its usage in the driver. Device tree support for the driver is added in subsequent patches.

---
 drivers/tty/serial/omap-serial.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
drivers/tty/serial/omap-serial.c +15 -15
index f3ff0ca..a02cc9f 100644
@@ -115,7 +115,7 @@ static void serial_omap_enable_ms(struct uart_port *port)
 {
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
 
-	dev_dbg(up->port.dev, "serial_omap_enable_ms+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_enable_ms+%d\n", up->port.line);
 
 	pm_runtime_get_sync(&up->pdev->dev);
 	up->ier |= UART_IER_MSI;
@@ -418,7 +418,7 @@ static unsigned int serial_omap_tx_empty(struct uart_port *port)
 	unsigned int ret = 0;
 
 	pm_runtime_get_sync(&up->pdev->dev);
-	dev_dbg(up->port.dev, "serial_omap_tx_empty+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_tx_empty+%d\n", up->port.line);
 	spin_lock_irqsave(&up->port.lock, flags);
 	ret = serial_in(up, UART_LSR) & UART_LSR_TEMT ? TIOCSER_TEMT : 0;
 	spin_unlock_irqrestore(&up->port.lock, flags);
@@ -436,7 +436,7 @@ static unsigned int serial_omap_get_mctrl(struct uart_port *port)
 	status = check_modem_status(up);
 	pm_runtime_put(&up->pdev->dev);
 
-	dev_dbg(up->port.dev, "serial_omap_get_mctrl+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_get_mctrl+%d\n", up->port.line);
 
 	if (status & UART_MSR_DCD)
 		ret |= TIOCM_CAR;
@@ -454,7 +454,7 @@ static void serial_omap_set_mctrl(struct uart_port *port, unsigned int mctrl)
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
 	unsigned char mcr = 0;
 
-	dev_dbg(up->port.dev, "serial_omap_set_mctrl+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_set_mctrl+%d\n", up->port.line);
 	if (mctrl & TIOCM_RTS)
 		mcr |= UART_MCR_RTS;
 	if (mctrl & TIOCM_DTR)
@@ -478,7 +478,7 @@ static void serial_omap_break_ctl(struct uart_port *port, int break_state)
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
 	unsigned long flags = 0;
 
-	dev_dbg(up->port.dev, "serial_omap_break_ctl+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_break_ctl+%d\n", up->port.line);
 	pm_runtime_get_sync(&up->pdev->dev);
 	spin_lock_irqsave(&up->port.lock, flags);
 	if (break_state == -1)
@@ -504,7 +504,7 @@ static int serial_omap_startup(struct uart_port *port)
 	if (retval)
 		return retval;
 
-	dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_startup+%d\n", up->port.line);
 
 	pm_runtime_get_sync(&up->pdev->dev);
 	/*
@@ -545,7 +545,7 @@ static int serial_omap_startup(struct uart_port *port)
 			0);
 		init_timer(&(up->uart_dma.rx_timer));
 		up->uart_dma.rx_timer.function = serial_omap_rxdma_poll;
-		up->uart_dma.rx_timer.data = up->pdev->id;
+		up->uart_dma.rx_timer.data = up->port.line;
 		/* Currently the buffer size is 4KB. Can increase it */
 		up->uart_dma.rx_buf = dma_alloc_coherent(NULL,
 			up->uart_dma.rx_buf_size,
@@ -573,7 +573,7 @@ static void serial_omap_shutdown(struct uart_port *port)
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
 	unsigned long flags = 0;
 
-	dev_dbg(up->port.dev, "serial_omap_shutdown+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_shutdown+%d\n", up->port.line);
 
 	pm_runtime_get_sync(&up->pdev->dev);
 	/*
@@ -883,7 +883,7 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
 
 	spin_unlock_irqrestore(&up->port.lock, flags);
 	pm_runtime_put(&up->pdev->dev);
-	dev_dbg(up->port.dev, "serial_omap_set_termios+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_set_termios+%d\n", up->port.line);
 }
 
 static void
@@ -893,7 +893,7 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
 	unsigned char efr;
 
-	dev_dbg(up->port.dev, "serial_omap_pm+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_pm+%d\n", up->port.line);
 
 	pm_runtime_get_sync(&up->pdev->dev);
 	serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
@@ -932,7 +932,7 @@ static void serial_omap_config_port(struct uart_port *port, int flags)
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
 
 	dev_dbg(up->port.dev, "serial_omap_config_port+%d\n",
-							up->pdev->id);
+							up->port.line);
 	up->port.type = PORT_OMAP;
 }
 
@@ -949,7 +949,7 @@ serial_omap_type(struct uart_port *port)
 {
 	struct uart_omap_port *up = (struct uart_omap_port *)port;
 
-	dev_dbg(up->port.dev, "serial_omap_type+%d\n", up->pdev->id);
+	dev_dbg(up->port.dev, "serial_omap_type+%d\n", up->port.line);
 	return up->name;
 }
 
@@ -1110,7 +1110,7 @@ static struct console serial_omap_console = {
 
 static void serial_omap_add_console_port(struct uart_omap_port *up)
 {
-	serial_omap_console_ports[up->pdev->id] = up;
+	serial_omap_console_ports[up->port.line] = up;
 }
 
 #define OMAP_CONSOLE	(&serial_omap_console)
@@ -1364,7 +1364,6 @@ static int serial_omap_probe(struct platform_device *pdev)
 		ret = -ENOMEM;
 		goto do_release_region;
 	}
-	sprintf(up->name, "OMAP UART%d", pdev->id);
 	up->pdev = pdev;
 	up->port.dev = &pdev->dev;
 	up->port.type = PORT_OMAP;
@@ -1375,6 +1374,7 @@ static int serial_omap_probe(struct platform_device *pdev)
 	up->port.fifosize = 64;
 	up->port.ops = &serial_omap_pops;
 	up->port.line = pdev->id;
+	sprintf(up->name, "OMAP UART%d", up->port.line);
 
 	up->port.mapbase = mem->start;
 	up->port.membase = ioremap(mem->start, resource_size(mem));
@@ -1417,7 +1417,7 @@ static int serial_omap_probe(struct platform_device *pdev)
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_get_sync(&pdev->dev);
 
-	ui[pdev->id] = up;
+	ui[up->port.line] = up;
 	serial_omap_add_console_port(up);
 
 	ret = uart_add_one_port(&serial_omap_reg, &up->port);
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/4 omap-serial: Use default clock speed (48Mhz) if not specified

In reply to Rajendra Nayak

Use a default clock speed of 48Mhz, instead of ending up with 0, if platforms fail to specify a valid clock speed.

---
 drivers/tty/serial/omap-serial.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
drivers/tty/serial/omap-serial.c +7 -0
index a02cc9f..f14b9c5 100644
@@ -43,6 +43,8 @@
 #include <plat/dmtimer.h>
 #include <plat/omap-serial.h>
 
+#define DEFAULT_CLK_SPEED 48000000 /* 48Mhz*/
+
 static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
 
 /* Forward declaration of functions */
@@ -1386,6 +1388,11 @@ static int serial_omap_probe(struct platform_device *pdev)
 
 	up->port.flags = omap_up_info->flags;
 	up->port.uartclk = omap_up_info->uartclk;
+	if (!up->port.uartclk) {
+		up->port.uartclk = DEFAULT_CLK_SPEED;
+		dev_warn(&pdev->dev, "No clock speed specified: using default:"
+						"%d\n", DEFAULT_CLK_SPEED);
+	}
 	up->uart_dma.uart_base = mem->start;
 	up->errata = omap_up_info->errata;
 
Signature · 1 line
1.7.1
#3 lore raw

PATCH v2 3/4 omap-serial: Add minimal device tree support

In reply to Rajendra Nayak

Adapt the driver to device tree and pass minimal platform data from device tree needed for console boot. No power management features will be suppported for now since it requires more tweaks around OCP settings to toggle forceidle/noidle/smaridle bits and handling remote wakeup and dynamic muxing.

---
 .../devicetree/bindings/serial/omap_serial.txt     |   10 ++++
 drivers/tty/serial/omap-serial.c                   |   45 ++++++++++++++++++-
 2 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/omap_serial.txt
Documentation/devicetree/bindings/serial/omap_serial.txt new file +10 -0
new file mode 100644
index 0000000..342eedd
@@ -0,0 +1,10 @@
+OMAP UART controller
+
+Required properties:
+- compatible : should be "ti,omap2-uart" for OMAP2 controllers
+- compatible : should be "ti,omap3-uart" for OMAP3 controllers
+- compatible : should be "ti,omap4-uart" for OMAP4 controllers
+- ti,hwmods : Must be "uart<n>", n being the instance number (1-based)
+
+Optional properties:
+- clock-frequency : frequency of the clock input to the UART
drivers/tty/serial/omap-serial.c +42 -3

88 lines not on this page · raw message

Signature · 1 line
1.7.1
#4 lore raw

PATCH v2 3/4 omap-serial: Add minimal device tree support

Quoted 5 lines · Rajendra Nayak

Adapt the driver to device tree and pass minimal platform data from device tree needed for console boot. No power management features will be suppported for now since it requires more tweaks around OCP settings to toggle forceidle/noidle/smaridle bits and handling

typo: smartidle

Quoted 3 lines

remote wakeup and dynamic muxing.

Rob

Quoted 120 lines
---
 .../devicetree/bindings/serial/omap_serial.txt     |   10 ++++
 drivers/tty/serial/omap-serial.c                   |   45 ++++++++++++++++++-
 2 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/omap_serial.txt
Documentation/devicetree/bindings/serial/omap_serial.txt new file +10 -0
new file mode 100644
index 0000000..342eedd
@@ -0,0 +1,10 @@
+OMAP UART controller
+
+Required properties:
+- compatible : should be "ti,omap2-uart" for OMAP2 controllers
+- compatible : should be "ti,omap3-uart" for OMAP3 controllers
+- compatible : should be "ti,omap4-uart" for OMAP4 controllers
+- ti,hwmods : Must be "uart<n>", n being the instance number (1-based)
+
+Optional properties:
+- clock-frequency : frequency of the clock input to the UART
drivers/tty/serial/omap-serial.c +42 -3
index f14b9c5..5aa524e 100644
@@ -38,6 +38,7 @@
 #include <linux/serial_core.h>
 #include <linux/irq.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
 
 #include <plat/dma.h>
 #include <plat/dmtimer.h>
@@ -1324,6 +1325,19 @@ static void uart_tx_dma_callback(int lch, u16 ch_status, void *data)
 	return;
 }
 
+static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)
+{
+	struct omap_uart_port_info *omap_up_info;
+
+	omap_up_info = devm_kzalloc(dev, sizeof(*omap_up_info), GFP_KERNEL);
+	if (!omap_up_info)
+		return NULL; /* out of memory */
+
+	of_property_read_u32(dev->of_node, "clock-frequency",
+					 &omap_up_info->uartclk);
+	return omap_up_info;
+}
+
 static int serial_omap_probe(struct platform_device *pdev)
 {
 	struct uart_omap_port	*up;
@@ -1331,6 +1345,9 @@ static int serial_omap_probe(struct platform_device *pdev)
 	struct omap_uart_port_info *omap_up_info = pdev->dev.platform_data;
 	int ret = -ENOSPC;
 
+	if (pdev->dev.of_node)
+		omap_up_info = of_get_uart_port_info(&pdev->dev);
+
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!mem) {
 		dev_err(&pdev->dev, "no mem resource?\n");
@@ -1375,9 +1392,20 @@ static int serial_omap_probe(struct platform_device *pdev)
 	up->port.regshift = 2;
 	up->port.fifosize = 64;
 	up->port.ops = &serial_omap_pops;
-	up->port.line = pdev->id;
-	sprintf(up->name, "OMAP UART%d", up->port.line);
 
+	if (pdev->dev.of_node)
+		up->port.line = of_alias_get_id(pdev->dev.of_node, "serial");
+	else
+		up->port.line = pdev->id;
+
+	if (up->port.line < 0) {
+		dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
+								up->port.line);
+		ret = -ENODEV;
+		goto err;
+	}
+
+	sprintf(up->name, "OMAP UART%d", up->port.line);
 	up->port.mapbase = mem->start;
 	up->port.membase = ioremap(mem->start, resource_size(mem));
 	if (!up->port.membase) {
@@ -1530,7 +1558,7 @@ static int serial_omap_runtime_suspend(struct device *dev)
 	if (!up)
 		return -EINVAL;
 
-	if (!pdata->enable_wakeup)
+	if (!pdata || !pdata->enable_wakeup)
 		return 0;
 
 	if (pdata->get_context_loss_count)
@@ -1591,12 +1619,23 @@ static const struct dev_pm_ops serial_omap_dev_pm_ops = {
 				serial_omap_runtime_resume, NULL)
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id omap_serial_of_match[] = {
+	{ .compatible = "ti,omap2-uart" },
+	{ .compatible = "ti,omap3-uart" },
+	{ .compatible = "ti,omap4-uart" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, omap_serial_of_match);
+#endif
+
 static struct platform_driver serial_omap_driver = {
 	.probe          = serial_omap_probe,
 	.remove         = serial_omap_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
 		.pm	= &serial_omap_dev_pm_ops,
+		.of_match_table = of_match_ptr(omap_serial_of_match),
 	},
 };
 
#5 lore raw

PATCH v2 3/4 omap-serial: Add minimal device tree support

Quoted 7 lines · Rob Herring
Quoted 5 lines · Rajendra Nayak

Adapt the driver to device tree and pass minimal platform data from device tree needed for console boot. No power management features will be suppported for now since it requires more tweaks around OCP settings to toggle forceidle/noidle/smaridle bits and handling

Quoted 7 lines

typo: smartidle

Quoted 3 lines

remote wakeup and dynamic muxing.

Thanks Rob, will fix the above typo.

Quoted 124 lines

Rob

Quoted 120 lines
---
  .../devicetree/bindings/serial/omap_serial.txt     |   10 ++++
  drivers/tty/serial/omap-serial.c                   |   45 ++++++++++++++++++-
  2 files changed, 52 insertions(+), 3 deletions(-)

create mode 100644 Documentation/devicetree/bindings/serial/omap_serial.txt

Documentation/devicetree/bindings/serial/omap_serial.txt new file +10 -0
new file mode 100644
index 0000000..342eedd
@@ -0,0 +1,10 @@
+OMAP UART controller
+
+Required properties:
+- compatible : should be "ti,omap2-uart" for OMAP2 controllers
+- compatible : should be "ti,omap3-uart" for OMAP3 controllers
+- compatible : should be "ti,omap4-uart" for OMAP4 controllers
+- ti,hwmods : Must be "uart<n>", n being the instance number (1-based)
+
+Optional properties:
+- clock-frequency : frequency of the clock input to the UART
drivers/tty/serial/omap-serial.c +42 -3
index f14b9c5..5aa524e 100644
@@ -38,6 +38,7 @@
  #include<linux/serial_core.h>
  #include<linux/irq.h>
  #include<linux/pm_runtime.h>
+#include<linux/of.h>
 
  #include<plat/dma.h>
  #include<plat/dmtimer.h>
@@ -1324,6 +1325,19 @@ static void uart_tx_dma_callback(int lch, u16 ch_status, void *data)
  	return;
  }
 
+static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)
+{
+	struct omap_uart_port_info *omap_up_info;
+
+	omap_up_info = devm_kzalloc(dev, sizeof(*omap_up_info), GFP_KERNEL);
+	if (!omap_up_info)
+		return NULL; /* out of memory */
+
+	of_property_read_u32(dev->of_node, "clock-frequency",
+					&omap_up_info->uartclk);
+	return omap_up_info;
+}
+
  static int serial_omap_probe(struct platform_device *pdev)
  {
  	struct uart_omap_port	*up;
@@ -1331,6 +1345,9 @@ static int serial_omap_probe(struct platform_device *pdev)
  	struct omap_uart_port_info *omap_up_info = pdev->dev.platform_data;
  	int ret = -ENOSPC;
 
+	if (pdev->dev.of_node)
+		omap_up_info = of_get_uart_port_info(&pdev->dev);
+
  	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  	if (!mem) {
  		dev_err(&pdev->dev, "no mem resource?\n");
@@ -1375,9 +1392,20 @@ static int serial_omap_probe(struct platform_device *pdev)
  	up->port.regshift = 2;
  	up->port.fifosize = 64;
  	up->port.ops =&serial_omap_pops;
-	up->port.line = pdev->id;
-	sprintf(up->name, "OMAP UART%d", up->port.line);
 
+	if (pdev->dev.of_node)
+		up->port.line = of_alias_get_id(pdev->dev.of_node, "serial");
+	else
+		up->port.line = pdev->id;
+
+	if (up->port.line<  0) {
+		dev_err(&pdev->dev, "failed to get alias/pdev id, errno %d\n",
+								up->port.line);
+		ret = -ENODEV;
+		goto err;
+	}
+
+	sprintf(up->name, "OMAP UART%d", up->port.line);
  	up->port.mapbase = mem->start;
  	up->port.membase = ioremap(mem->start, resource_size(mem));
  	if (!up->port.membase) {
@@ -1530,7 +1558,7 @@ static int serial_omap_runtime_suspend(struct device *dev)
  	if (!up)
  		return -EINVAL;
 
-	if (!pdata->enable_wakeup)
+	if (!pdata || !pdata->enable_wakeup)
  		return 0;
 
  	if (pdata->get_context_loss_count)
@@ -1591,12 +1619,23 @@ static const struct dev_pm_ops serial_omap_dev_pm_ops = {
  				serial_omap_runtime_resume, NULL)
  };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id omap_serial_of_match[] = {
+	{ .compatible = "ti,omap2-uart" },
+	{ .compatible = "ti,omap3-uart" },
+	{ .compatible = "ti,omap4-uart" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, omap_serial_of_match);
+#endif
+
  static struct platform_driver serial_omap_driver = {
  	.probe          = serial_omap_probe,
  	.remove         = serial_omap_remove,
  	.driver		= {
  		.name	= DRIVER_NAME,
  		.pm	=&serial_omap_dev_pm_ops,
+		.of_match_table = of_match_ptr(omap_serial_of_match),
  	},
  };
 
#6 lore raw

PATCH v2 4/4 ARM: omap: pass minimal SoC/board data for UART from dt

In reply to Rajendra Nayak

Pass minimal data needed for console boot, from dt, for OMAP4 panda/sdp and OMAP3 beagle boards, and get rid of the static initialization from generic board file.

---
 arch/arm/boot/dts/omap3.dtsi        |   31 +++++++++++++++++++++++++++++++
 arch/arm/boot/dts/omap4.dtsi        |   28 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/board-generic.c |    1 -
 3 files changed, 59 insertions(+), 1 deletions(-)
arch/arm/boot/dts/omap3.dtsi +31 -0
index d202bb5..216c331 100644
@@ -13,6 +13,13 @@
 / {
 	compatible = "ti,omap3430", "ti,omap3";
 
+	aliases {
+		serial0 = &uart1;
+		serial1 = &uart2;
+		serial2 = &uart3;
+		serial3 = &uart4;
+	};
+
 	cpus {
 		cpu at 0 {
 			compatible = "arm,cortex-a8";
@@ -59,5 +66,29 @@
 			interrupt-controller;
 			#interrupt-cells = <1>;
 		};
+
+		uart1: serial at 0x4806a000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart1";
+			clock-frequency = <48000000>;
+		};
+
+		uart2: serial at 0x4806c000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart2";
+			clock-frequency = <48000000>;
+		};
+
+		uart3: serial at 0x49020000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart3";
+			clock-frequency = <48000000>;
+		};
+
+		uart4: serial at 0x49042000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart4";
+			clock-frequency = <48000000>;
+		};
 	};
 };
arch/arm/boot/dts/omap4.dtsi +28 -0
index 4c61c82..e8fe75f 100644
@@ -21,6 +21,10 @@
 	interrupt-parent = <&gic>;
 
 	aliases {
+		serial0 = &uart1;
+		serial1 = &uart2;
+		serial2 = &uart3;
+		serial3 = &uart4;
 	};
 
 	cpus {
@@ -99,5 +103,29 @@
 			reg = <0x48241000 0x1000>,
 			      <0x48240100 0x0100>;
 		};
+
+		uart1: serial at 0x4806a000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart1";
+			clock-frequency = <48000000>;
+		};
+
+		uart2: serial at 0x4806c000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart2";
+			clock-frequency = <48000000>;
+		};
+
+		uart3: serial at 0x48020000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart3";
+			clock-frequency = <48000000>;
+		};
+
+		uart4: serial at 0x4806e000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart4";
+			clock-frequency = <48000000>;
+		};
 	};
 };
arch/arm/mach-omap2/board-generic.c +0 -1
index fb55fa3..bb72809 100644
@@ -70,7 +70,6 @@ static void __init omap_generic_init(void)
 	if (node)
 		irq_domain_add_simple(node, 0);
 
-	omap_serial_init();
 	omap_sdrc_init(NULL, NULL);
 
 	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
Signature · 1 line
1.7.1
#7 lore raw

PATCH v2 4/4 ARM: omap: pass minimal SoC/board data for UART from dt

Quoted 5 lines · Rajendra Nayak

Pass minimal data needed for console boot, from dt, for OMAP4 panda/sdp and OMAP3 beagle boards, and get rid of the static initialization from generic board file.

Rob

Quoted 111 lines
---
 arch/arm/boot/dts/omap3.dtsi        |   31 +++++++++++++++++++++++++++++++
 arch/arm/boot/dts/omap4.dtsi        |   28 ++++++++++++++++++++++++++++
 arch/arm/mach-omap2/board-generic.c |    1 -
 3 files changed, 59 insertions(+), 1 deletions(-)
arch/arm/boot/dts/omap3.dtsi +31 -0
index d202bb5..216c331 100644
@@ -13,6 +13,13 @@
 / {
 	compatible = "ti,omap3430", "ti,omap3";
 
+	aliases {
+		serial0 = &uart1;
+		serial1 = &uart2;
+		serial2 = &uart3;
+		serial3 = &uart4;
+	};
+
 	cpus {
 		cpu at 0 {
 			compatible = "arm,cortex-a8";
@@ -59,5 +66,29 @@
 			interrupt-controller;
 			#interrupt-cells = <1>;
 		};
+
+		uart1: serial at 0x4806a000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart1";
+			clock-frequency = <48000000>;
+		};
+
+		uart2: serial at 0x4806c000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart2";
+			clock-frequency = <48000000>;
+		};
+
+		uart3: serial at 0x49020000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart3";
+			clock-frequency = <48000000>;
+		};
+
+		uart4: serial at 0x49042000 {
+			compatible = "ti,omap3-uart";
+			ti,hwmods = "uart4";
+			clock-frequency = <48000000>;
+		};
 	};
 };
arch/arm/boot/dts/omap4.dtsi +28 -0
index 4c61c82..e8fe75f 100644
@@ -21,6 +21,10 @@
 	interrupt-parent = <&gic>;
 
 	aliases {
+		serial0 = &uart1;
+		serial1 = &uart2;
+		serial2 = &uart3;
+		serial3 = &uart4;
 	};
 
 	cpus {
@@ -99,5 +103,29 @@
 			reg = <0x48241000 0x1000>,
 			      <0x48240100 0x0100>;
 		};
+
+		uart1: serial at 0x4806a000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart1";
+			clock-frequency = <48000000>;
+		};
+
+		uart2: serial at 0x4806c000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart2";
+			clock-frequency = <48000000>;
+		};
+
+		uart3: serial at 0x48020000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart3";
+			clock-frequency = <48000000>;
+		};
+
+		uart4: serial at 0x4806e000 {
+			compatible = "ti,omap4-uart";
+			ti,hwmods = "uart4";
+			clock-frequency = <48000000>;
+		};
 	};
 };
arch/arm/mach-omap2/board-generic.c +0 -1
index fb55fa3..bb72809 100644
@@ -70,7 +70,6 @@ static void __init omap_generic_init(void)
 	if (node)
 		irq_domain_add_simple(node, 0);
 
-	omap_serial_init();
 	omap_sdrc_init(NULL, NULL);
 
 	of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
#8 lore raw

v2 cover OMAP serial device tree support

In reply to Rajendra Nayak
Quoted 11 lines · Rajendra Nayak

v2 is based on the latest omap-serial runtime patches, which can be found here[1]

The series passes minimal data that allows serial console boot, with UART's initialised from device tree. However some of low power support for UART and remote wakeup needs more work.
Boot tested on OMAP4 panda and OMAP4 sdp boards.

Patches can be found here..
git://gitorious.org/omap-pm/linux.git for-dt/serial

What tree are these going to go through, some device tree one, or do you want me to take the serial driver patches?

thanks,

greg k-h

#9 lore raw

v2 cover OMAP serial device tree support

Quoted 10 lines · Greg KH
Quoted 9 lines · Rajendra Nayak

v2 is based on the latest omap-serial runtime patches, which can be found here[1]

The series passes minimal data that allows serial console boot, with UART's initialised from device tree. However some of low power support for UART and remote wakeup needs more work.
Boot tested on OMAP4 panda and OMAP4 sdp boards.

Quoted 5 lines
Quoted 2 lines

Patches can be found here..
git://gitorious.org/omap-pm/linux.git for-dt/serial

What tree are these going to go through, some device tree one, or do you want me to take the serial driver patches?

Hi Greg,

These patches have a dependency on the omap-serial runtime series. So once that makes it in, through the serial driver tree, and once we have the necessary Acks from the Device Tree maintainers on the relevant patches from this series, these could go through the serial driver tree as well.

thanks,
Rajendra

Quoted 4 lines

thanks,

greg k-h

#10 lore raw

v2 cover OMAP serial device tree support

Quoted 17 lines · Rajendra Nayak
Quoted 10 lines · Greg KH
Quoted 9 lines · Rajendra Nayak

v2 is based on the latest omap-serial runtime patches, which can be found here[1]

The series passes minimal data that allows serial console boot, with UART's initialised from device tree. However some of low power support for UART and remote wakeup needs more work.
Boot tested on OMAP4 panda and OMAP4 sdp boards.

Quoted 5 lines
Quoted 2 lines

Patches can be found here..
git://gitorious.org/omap-pm/linux.git for-dt/serial

What tree are these going to go through, some device tree one, or do you want me to take the serial driver patches?

Quoted 7 lines

Hi Greg,

These patches have a dependency on the omap-serial runtime series. So once that makes it in, through the serial driver tree, and once we have the necessary Acks from the Device Tree maintainers on the relevant patches from this series, these could go through the serial driver tree as well.

Then all of these should probably go through the device tree tree.

thanks,

greg k-h

#11 lore raw

v2 cover OMAP serial device tree support

Quoted 20 lines · Greg KH
Quoted 19 lines · Rajendra Nayak
Quoted 10 lines · Greg KH
Quoted 9 lines · Rajendra Nayak

v2 is based on the latest omap-serial runtime patches, which can be found here[1]

The series passes minimal data that allows serial console boot, with UART's initialised from device tree. However some of low power support for UART and remote wakeup needs more work.
Boot tested on OMAP4 panda and OMAP4 sdp boards.

Quoted 5 lines
Quoted 2 lines

Patches can be found here..
git://gitorious.org/omap-pm/linux.git for-dt/serial

What tree are these going to go through, some device tree one, or do you want me to take the serial driver patches?

Hi Greg,

Quoted 7 lines
Quoted 5 lines

These patches have a dependency on the omap-serial runtime series. So once that makes it in, through the serial driver tree, and once we have the necessary Acks from the Device Tree maintainers on the relevant patches from this series, these could go through the serial driver tree as well.

Then all of these should probably go through the device tree tree.

Generally, DT related driver changes go in thru the respective driver trees.

Rob