All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type
@ 2023-02-10 20:34 Biju Das
  2023-02-10 20:34 ` [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe() Biju Das
                   ` (3 more replies)
  0 siblings, 4 replies; 35+ messages in thread
From: Biju Das @ 2023-02-10 20:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Biju Das, Jiri Slaby, Ilpo Järvinen, Andy Shevchenko,
	Uwe Kleine-König, Maciej W. Rozycki, Eric Tremblay,
	Wander Lairson Costa, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

The Renesas RZ/V2M UART compatible with the general-purpose 16750 UART chip.
This patch updates Renesas RZ/V2M UART type from 16550a->16750 and also
enables 64-bytes fifo.

This patch series also simplifies 8250_em_probe() and also updates the
RZ/V2M specific register handling for the below restriction mentioned in
hardware manual

40.6.1 Point for Caution when Changing the Register Settings:

When changing the settings of the following registers, a PRESETn master
reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7]) must be input to
re-initialize them.

Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.

v2->v3:
 * Dropped sclk from priv.
 * Dropped unneeded clk_disable_unprepare from remove().
 * Retained Rb tags from Geert,Andy and Ilpo as the changes are trivial.
 * Replaced of_device_get_match_data()->device_get_match_data().
 * Replaced of_device.h->property.h
 * Dropped struct serial8250_em_hw_info *info from priv and started
   using a local variable info in probe().
 * Retained Rb tag from Ilpo as changes are trivial.
 * Replaced readl/writel()->serial8250_em_serial_in/out() in serial8250_rzv2m_
   reg_update() to avoid duplication of offset trickery.
 * Added support for HCR0 read/write in serial8250_em_{serial_in, serial_out}
 * Added UART_LCR macro support in serial8250_em_serial_in() to read LCR
 * Reordered serial8250_em_{serial_in, serial_out} above serial8250_rzv2m_
   reg_update().
 * Replaced priv->info->serial_out to info->serial_out.
v1->v2:
 * Dropped patch#1 from previous series
 * Replaced devm_clk_get->devm_clk_get_enabled() and updated clk
   handling in probe().
 * Added Rb tag from Geert.
 * Added patch for updating Renesas RZ/V2M UART type from 16550a->16750
   and also enables 64-bytes fifo.
 * Used .data for taking h/w differences between EMMA mobile and RZ/V2M UART.
 * Added serial_out() to struct serial8250_em_hw_info for the write register
   differences between EMMA mobile and RZ/V2M UART.
Biju Das (3):
  serial: 8250_em: Use dev_err_probe()
  serial: 8250_em: Update RZ/V2M port type as PORT_16750
  serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info

 drivers/tty/serial/8250/8250_em.c | 128 ++++++++++++++++++++++++------
 1 file changed, 102 insertions(+), 26 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 35+ messages in thread

* [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe()
  2023-02-10 20:34 [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Biju Das
@ 2023-02-10 20:34 ` Biju Das
  2023-02-13  6:23   ` Jiri Slaby
  2023-02-10 20:34 ` [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750 Biju Das
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 35+ messages in thread
From: Biju Das @ 2023-02-10 20:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Biju Das, Jiri Slaby, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc, Andy Shevchenko

This patch simplifies probe() function by using dev_err_probe()
instead of dev_err in probe().

While at it, remove the unused header file slab.h and added a
local variable 'dev' to replace '&pdev->dev' in probe().

Also replace devm_clk_get->devm_clk_get_enabled and updated the
clk handling in probe() and remove().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2->v3:
 * Dropped sclk from priv.
 * Dropped unneeded clk_disable_unprepare from remove().
 * Retained Rb tags from Geert and Andy as the changes are trivial.
v1->v2:
 * replaced devm_clk_get->devm_clk_get_enabled() and updated clk
   handling in probe().
 * Added Rb tag from Geert.
---
 drivers/tty/serial/8250/8250_em.c | 33 +++++++++++--------------------
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index f8e99995eee9..9781bf73ed0c 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -13,7 +13,6 @@
 #include <linux/serial_reg.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
-#include <linux/slab.h>
 
 #include "8250.h"
 
@@ -21,7 +20,6 @@
 #define UART_DLM_EM 10
 
 struct serial8250_em_priv {
-	struct clk *sclk;
 	int line;
 };
 
@@ -79,8 +77,10 @@ static void serial8250_em_serial_dl_write(struct uart_8250_port *up, int value)
 static int serial8250_em_probe(struct platform_device *pdev)
 {
 	struct serial8250_em_priv *priv;
+	struct device *dev = &pdev->dev;
 	struct uart_8250_port up;
 	struct resource *regs;
+	struct clk *sclk;
 	int irq, ret;
 
 	irq = platform_get_irq(pdev, 0);
@@ -88,31 +88,26 @@ static int serial8250_em_probe(struct platform_device *pdev)
 		return irq;
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!regs) {
-		dev_err(&pdev->dev, "missing registers\n");
-		return -EINVAL;
-	}
+	if (!regs)
+		return dev_err_probe(dev, -EINVAL, "missing registers\n");
 
-	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	priv->sclk = devm_clk_get(&pdev->dev, "sclk");
-	if (IS_ERR(priv->sclk)) {
-		dev_err(&pdev->dev, "unable to get clock\n");
-		return PTR_ERR(priv->sclk);
-	}
+	sclk = devm_clk_get_enabled(dev, "sclk");
+	if (IS_ERR(sclk))
+		return dev_err_probe(dev, PTR_ERR(sclk), "unable to get clock\n");
 
 	memset(&up, 0, sizeof(up));
 	up.port.mapbase = regs->start;
 	up.port.irq = irq;
 	up.port.type = PORT_UNKNOWN;
 	up.port.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP;
-	up.port.dev = &pdev->dev;
+	up.port.dev = dev;
 	up.port.private_data = priv;
 
-	clk_prepare_enable(priv->sclk);
-	up.port.uartclk = clk_get_rate(priv->sclk);
+	up.port.uartclk = clk_get_rate(sclk);
 
 	up.port.iotype = UPIO_MEM32;
 	up.port.serial_in = serial8250_em_serial_in;
@@ -121,11 +116,8 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	up.dl_write = serial8250_em_serial_dl_write;
 
 	ret = serial8250_register_8250_port(&up);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "unable to register 8250 port\n");
-		clk_disable_unprepare(priv->sclk);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "unable to register 8250 port\n");
 
 	priv->line = ret;
 	platform_set_drvdata(pdev, priv);
@@ -137,7 +129,6 @@ static int serial8250_em_remove(struct platform_device *pdev)
 	struct serial8250_em_priv *priv = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(priv->line);
-	clk_disable_unprepare(priv->sclk);
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750
  2023-02-10 20:34 [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Biju Das
  2023-02-10 20:34 ` [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe() Biju Das
@ 2023-02-10 20:34 ` Biju Das
  2023-02-12 11:02   ` Andy Shevchenko
  2023-02-13  6:26   ` Jiri Slaby
  2023-02-10 20:34 ` [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info Biju Das
  2023-02-13  8:37 ` [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Ilpo Järvinen
  3 siblings, 2 replies; 35+ messages in thread
From: Biju Das @ 2023-02-10 20:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Biju Das, Jiri Slaby, Geert Uytterhoeven, linux-serial,
	Fabrizio Castro, linux-renesas-soc, Ilpo Järvinen

The UART IP found on RZ/V2M SoC is Register-compatible with the
general-purpose 16750 UART chip. This patch updates RZ/V2M
port type from 16550A->16750 and also enables 64-bytes fifo support.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
v2->v3:
 * Replaced of_device_get_match_data()->device_get_match_data().
 * Replaced of_device.h->property.h
 * Dropped struct serial8250_em_hw_info *info from priv and started
   using a local variable info in probe().
 * Retained Rb tag from Ilpo as changes are trivial.
v2:
 * New patch
---
 drivers/tty/serial/8250/8250_em.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index 9781bf73ed0c..69cd3b611501 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -9,6 +9,7 @@
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
+#include <linux/property.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
 #include <linux/platform_device.h>
@@ -19,6 +20,11 @@
 #define UART_DLL_EM 9
 #define UART_DLM_EM 10
 
+struct serial8250_em_hw_info {
+	unsigned int type;
+	upf_t flags;
+};
+
 struct serial8250_em_priv {
 	int line;
 };
@@ -76,6 +82,7 @@ static void serial8250_em_serial_dl_write(struct uart_8250_port *up, int value)
 
 static int serial8250_em_probe(struct platform_device *pdev)
 {
+	const struct serial8250_em_hw_info *info;
 	struct serial8250_em_priv *priv;
 	struct device *dev = &pdev->dev;
 	struct uart_8250_port up;
@@ -83,6 +90,8 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	struct clk *sclk;
 	int irq, ret;
 
+	info = device_get_match_data(dev);
+
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
@@ -102,8 +111,8 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	memset(&up, 0, sizeof(up));
 	up.port.mapbase = regs->start;
 	up.port.irq = irq;
-	up.port.type = PORT_UNKNOWN;
-	up.port.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP;
+	up.port.type = info->type;
+	up.port.flags = info->flags;
 	up.port.dev = dev;
 	up.port.private_data = priv;
 
@@ -132,9 +141,20 @@ static int serial8250_em_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct serial8250_em_hw_info emma_mobile_uart_hw_info = {
+	.type = PORT_UNKNOWN,
+	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
+};
+
+static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
+	.type = PORT_16750,
+	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP | UPF_FIXED_TYPE,
+};
+
 static const struct of_device_id serial8250_em_dt_ids[] = {
-	{ .compatible = "renesas,em-uart", },
-	{},
+	{ .compatible = "renesas,r9a09g011-uart", .data = &rzv2m_uart_hw_info },
+	{ .compatible = "renesas,em-uart", .data = &emma_mobile_uart_hw_info },
+	{ /* Sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, serial8250_em_dt_ids);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-10 20:34 [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Biju Das
  2023-02-10 20:34 ` [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe() Biju Das
  2023-02-10 20:34 ` [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750 Biju Das
@ 2023-02-10 20:34 ` Biju Das
  2023-02-12 11:09   ` Andy Shevchenko
  2023-02-13  8:42   ` Ilpo Järvinen
  2023-02-13  8:37 ` [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Ilpo Järvinen
  3 siblings, 2 replies; 35+ messages in thread
From: Biju Das @ 2023-02-10 20:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Biju Das, Jiri Slaby, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

As per HW manual section 40.6.1, we need to perform FIFO reset + SW
reset before updating the below registers.

FCR[7:5], FCR[3:0], LCR[7][5:0], MCR[6:4], DLL[7:0], DLM[7:0] and
HCR0[6:5][3:2].

This patch adds serial_out() to struct serial8250_em_hw_info to
handle this difference between emma mobile and rz/v2m.

DLL/DLM register can be updated only by setting LCR[7]. So the
updation of LCR[7] will perform reset for DLL/DLM register changes.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2->v3:
 * Replaced readl/writel()->serial8250_em_serial_in/out() in serial8250_rzv2m_
   reg_update() to avoid duplication of offset trickery.
 * Added support for HCR0 read/write in serial8250_em_{serial_in, serial_out}
 * Added UART_LCR macro support in serial8250_em_serial_in() to read LCR
 * Reordered serial8250_em_{serial_in, serial_out} above serial8250_rzv2m_
   reg_update().
 * Replaced priv->info->serial_out to info->serial_out.
v1->v2:
 * Added serial_out to struct serial8250_em_hw_info
---
 drivers/tty/serial/8250/8250_em.c | 67 ++++++++++++++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index 69cd3b611501..a90a5cc4234a 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -19,10 +19,14 @@
 
 #define UART_DLL_EM 9
 #define UART_DLM_EM 10
+#define UART_HCR0 11
+
+#define UART_HCR0_SW_RESET	BIT(7) /* SW Reset */
 
 struct serial8250_em_hw_info {
 	unsigned int type;
 	upf_t flags;
+	void (*serial_out)(struct uart_port *p, int off, int value);
 };
 
 struct serial8250_em_priv {
@@ -46,6 +50,7 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
 		fallthrough;
 	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
 	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
+	case UART_HCR0: /* HCR0 @ 0x2c */
 		writel(value, p->membase + (offset << 2));
 	}
 }
@@ -55,6 +60,7 @@ static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
 	switch (offset) {
 	case UART_RX: /* RX @ 0x00 */
 		return readb(p->membase);
+	case UART_LCR: /* LCR @ 0x10 (+1) */
 	case UART_MCR: /* MCR @ 0x14 (+1) */
 	case UART_LSR: /* LSR @ 0x18 (+1) */
 	case UART_MSR: /* MSR @ 0x1c (+1) */
@@ -64,11 +70,68 @@ static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
 	case UART_IIR: /* IIR @ 0x08 */
 	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
 	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
+	case UART_HCR0: /* HCR0 @ 0x2c */
 		return readl(p->membase + (offset << 2));
 	}
 	return 0;
 }
 
+static void serial8250_rzv2m_reg_update(struct uart_port *p, int off, int value)
+{
+	unsigned int ier, fcr, lcr, mcr, hcr0;
+
+	ier = serial8250_em_serial_in(p, UART_IER);
+	lcr = serial8250_em_serial_in(p, UART_LCR);
+	mcr = serial8250_em_serial_in(p, UART_MCR);
+	hcr0 = serial8250_em_serial_in(p, UART_HCR0);
+	/*
+	 * The value of UART_IIR and UART_FCR are 2, but corresponding
+	 * RZ/V2M address offset are different(0x08 and 0x0c). So we need to
+	 * use readl() here.
+	 */
+	fcr = readl(p->membase + ((UART_FCR + 1) << 2));
+
+	serial8250_em_serial_out(p, UART_FCR, fcr | UART_FCR_CLEAR_RCVR |
+				 UART_FCR_CLEAR_XMIT);
+	serial8250_em_serial_out(p, UART_HCR0, hcr0 | UART_HCR0_SW_RESET);
+	serial8250_em_serial_out(p, UART_HCR0, hcr0 & ~UART_HCR0_SW_RESET);
+
+	switch (off) {
+	case UART_FCR:
+		fcr = value;
+		break;
+	case UART_LCR:
+		lcr = value;
+		break;
+	case UART_MCR:
+		mcr = value;
+		break;
+	}
+
+	serial8250_em_serial_out(p, UART_IER, ier);
+	serial8250_em_serial_out(p, UART_FCR, fcr);
+	serial8250_em_serial_out(p, UART_MCR, mcr);
+	serial8250_em_serial_out(p, UART_LCR, lcr);
+	serial8250_em_serial_out(p, UART_HCR0, hcr0);
+}
+
+static void serial8250_em_rzv2m_serial_out(struct uart_port *p, int offset, int value)
+{
+	switch (offset) {
+	case UART_TX:
+	case UART_SCR:
+	case UART_IER:
+	case UART_DLL_EM:
+	case UART_DLM_EM:
+		serial8250_em_serial_out(p, offset, value);
+		break;
+	case UART_FCR:
+	case UART_LCR:
+	case UART_MCR:
+		serial8250_rzv2m_reg_update(p, offset, value);
+	}
+}
+
 static int serial8250_em_serial_dl_read(struct uart_8250_port *up)
 {
 	return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
@@ -120,7 +183,7 @@ static int serial8250_em_probe(struct platform_device *pdev)
 
 	up.port.iotype = UPIO_MEM32;
 	up.port.serial_in = serial8250_em_serial_in;
-	up.port.serial_out = serial8250_em_serial_out;
+	up.port.serial_out = info->serial_out;
 	up.dl_read = serial8250_em_serial_dl_read;
 	up.dl_write = serial8250_em_serial_dl_write;
 
@@ -144,11 +207,13 @@ static int serial8250_em_remove(struct platform_device *pdev)
 static const struct serial8250_em_hw_info emma_mobile_uart_hw_info = {
 	.type = PORT_UNKNOWN,
 	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
+	.serial_out = serial8250_em_serial_out,
 };
 
 static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
 	.type = PORT_16750,
 	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP | UPF_FIXED_TYPE,
+	.serial_out = serial8250_em_rzv2m_serial_out,
 };
 
 static const struct of_device_id serial8250_em_dt_ids[] = {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750
  2023-02-10 20:34 ` [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750 Biju Das
@ 2023-02-12 11:02   ` Andy Shevchenko
  2023-02-13  6:26   ` Jiri Slaby
  1 sibling, 0 replies; 35+ messages in thread
From: Andy Shevchenko @ 2023-02-12 11:02 UTC (permalink / raw)
  To: Biju Das
  Cc: Greg Kroah-Hartman, Jiri Slaby, Geert Uytterhoeven, linux-serial,
	Fabrizio Castro, linux-renesas-soc, Ilpo Järvinen

On Fri, Feb 10, 2023 at 08:34:38PM +0000, Biju Das wrote:
> The UART IP found on RZ/V2M SoC is Register-compatible with the
> general-purpose 16750 UART chip. This patch updates RZ/V2M
> port type from 16550A->16750 and also enables 64-bytes fifo support.

LGTM,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> v2->v3:
>  * Replaced of_device_get_match_data()->device_get_match_data().
>  * Replaced of_device.h->property.h
>  * Dropped struct serial8250_em_hw_info *info from priv and started
>    using a local variable info in probe().
>  * Retained Rb tag from Ilpo as changes are trivial.
> v2:
>  * New patch
> ---
>  drivers/tty/serial/8250/8250_em.c | 28 ++++++++++++++++++++++++----
>  1 file changed, 24 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
> index 9781bf73ed0c..69cd3b611501 100644
> --- a/drivers/tty/serial/8250/8250_em.c
> +++ b/drivers/tty/serial/8250/8250_em.c
> @@ -9,6 +9,7 @@
>  #include <linux/io.h>
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
> +#include <linux/property.h>
>  #include <linux/serial_8250.h>
>  #include <linux/serial_reg.h>
>  #include <linux/platform_device.h>
> @@ -19,6 +20,11 @@
>  #define UART_DLL_EM 9
>  #define UART_DLM_EM 10
>  
> +struct serial8250_em_hw_info {
> +	unsigned int type;
> +	upf_t flags;
> +};
> +
>  struct serial8250_em_priv {
>  	int line;
>  };
> @@ -76,6 +82,7 @@ static void serial8250_em_serial_dl_write(struct uart_8250_port *up, int value)
>  
>  static int serial8250_em_probe(struct platform_device *pdev)
>  {
> +	const struct serial8250_em_hw_info *info;
>  	struct serial8250_em_priv *priv;
>  	struct device *dev = &pdev->dev;
>  	struct uart_8250_port up;
> @@ -83,6 +90,8 @@ static int serial8250_em_probe(struct platform_device *pdev)
>  	struct clk *sclk;
>  	int irq, ret;
>  
> +	info = device_get_match_data(dev);
> +
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>  		return irq;
> @@ -102,8 +111,8 @@ static int serial8250_em_probe(struct platform_device *pdev)
>  	memset(&up, 0, sizeof(up));
>  	up.port.mapbase = regs->start;
>  	up.port.irq = irq;
> -	up.port.type = PORT_UNKNOWN;
> -	up.port.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP;
> +	up.port.type = info->type;
> +	up.port.flags = info->flags;
>  	up.port.dev = dev;
>  	up.port.private_data = priv;
>  
> @@ -132,9 +141,20 @@ static int serial8250_em_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct serial8250_em_hw_info emma_mobile_uart_hw_info = {
> +	.type = PORT_UNKNOWN,
> +	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
> +};
> +
> +static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
> +	.type = PORT_16750,
> +	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP | UPF_FIXED_TYPE,
> +};
> +
>  static const struct of_device_id serial8250_em_dt_ids[] = {
> -	{ .compatible = "renesas,em-uart", },
> -	{},
> +	{ .compatible = "renesas,r9a09g011-uart", .data = &rzv2m_uart_hw_info },
> +	{ .compatible = "renesas,em-uart", .data = &emma_mobile_uart_hw_info },
> +	{ /* Sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, serial8250_em_dt_ids);
>  
> -- 
> 2.25.1
> 
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-10 20:34 ` [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info Biju Das
@ 2023-02-12 11:09   ` Andy Shevchenko
  2023-02-13  8:42   ` Ilpo Järvinen
  1 sibling, 0 replies; 35+ messages in thread
From: Andy Shevchenko @ 2023-02-12 11:09 UTC (permalink / raw)
  To: Biju Das
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On Fri, Feb 10, 2023 at 08:34:39PM +0000, Biju Das wrote:
> As per HW manual section 40.6.1, we need to perform FIFO reset + SW
> reset before updating the below registers.
> 
> FCR[7:5], FCR[3:0], LCR[7][5:0], MCR[6:4], DLL[7:0], DLM[7:0] and
> HCR0[6:5][3:2].
> 
> This patch adds serial_out() to struct serial8250_em_hw_info to
> handle this difference between emma mobile and rz/v2m.
> 
> DLL/DLM register can be updated only by setting LCR[7]. So the
> updation of LCR[7] will perform reset for DLL/DLM register changes.

...

>  #define UART_DLL_EM 9
>  #define UART_DLM_EM 10
> +#define UART_HCR0 11

Can we continue using _EM suffix?

...

> +	/*
> +	 * The value of UART_IIR and UART_FCR are 2, but corresponding
> +	 * RZ/V2M address offset are different(0x08 and 0x0c). So we need to
> +	 * use readl() here.
> +	 */
> +	fcr = readl(p->membase + ((UART_FCR + 1) << 2));

So, what does prevent you to define above

#define UART_IIR_EM	3 // or whatever name it should have

and use again same helper here?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe()
  2023-02-10 20:34 ` [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe() Biju Das
@ 2023-02-13  6:23   ` Jiri Slaby
  2023-02-14 11:07     ` Biju Das
  0 siblings, 1 reply; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  6:23 UTC (permalink / raw)
  To: Biju Das, Greg Kroah-Hartman
  Cc: linux-serial, Geert Uytterhoeven, Fabrizio Castro,
	linux-renesas-soc, Andy Shevchenko

On 10. 02. 23, 21:34, Biju Das wrote:
> This patch simplifies probe() function by using dev_err_probe()
> instead of dev_err in probe().
> 
> While at it, remove the unused header file slab.h and added a
> local variable 'dev' to replace '&pdev->dev' in probe().
> 
> Also replace devm_clk_get->devm_clk_get_enabled and updated the
> clk handling in probe() and remove().

Sorry, this "While at it" and "Also" is not allowed in a single patch. 
You do three completely distinct things in a single patch. Please 
separate (like prints+&dev, slab.h, and clk changes).

And pretty please, don't send 3 (!) versions a day. Wait a week or so 
for reviews of a single version. No need to haste.

thanks,
-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750
  2023-02-10 20:34 ` [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750 Biju Das
  2023-02-12 11:02   ` Andy Shevchenko
@ 2023-02-13  6:26   ` Jiri Slaby
  2023-02-13 16:02     ` Biju Das
  1 sibling, 1 reply; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  6:26 UTC (permalink / raw)
  To: Biju Das, Greg Kroah-Hartman
  Cc: Geert Uytterhoeven, linux-serial, Fabrizio Castro,
	linux-renesas-soc, Ilpo Järvinen

On 10. 02. 23, 21:34, Biju Das wrote:
> The UART IP found on RZ/V2M SoC is Register-compatible with the
> general-purpose 16750 UART chip. This patch updates RZ/V2M
> port type from 16550A->16750 and also enables 64-bytes fifo support.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type
  2023-02-10 20:34 [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Biju Das
                   ` (2 preceding siblings ...)
  2023-02-10 20:34 ` [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info Biju Das
@ 2023-02-13  8:37 ` Ilpo Järvinen
  3 siblings, 0 replies; 35+ messages in thread
From: Ilpo Järvinen @ 2023-02-13  8:37 UTC (permalink / raw)
  To: Biju Das
  Cc: Greg Kroah-Hartman, Jiri Slaby, Andy Shevchenko,
	Uwe Kleine-König, Maciej W. Rozycki, Eric Tremblay,
	Wander Lairson Costa, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On Fri, 10 Feb 2023, Biju Das wrote:

> RZ/V2M specific register handling for the below restriction mentioned in
> hardware manual
> 
> 40.6.1 Point for Caution when Changing the Register Settings:
> 
> When changing the settings of the following registers, a PRESETn master
> reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7]) must be input to
> re-initialize them.
> 
> Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.

This information should appear in the changelog of 3/3!

-- 
 i.

> v2->v3:
>  * Dropped sclk from priv.
>  * Dropped unneeded clk_disable_unprepare from remove().
>  * Retained Rb tags from Geert,Andy and Ilpo as the changes are trivial.
>  * Replaced of_device_get_match_data()->device_get_match_data().
>  * Replaced of_device.h->property.h
>  * Dropped struct serial8250_em_hw_info *info from priv and started
>    using a local variable info in probe().
>  * Retained Rb tag from Ilpo as changes are trivial.
>  * Replaced readl/writel()->serial8250_em_serial_in/out() in serial8250_rzv2m_
>    reg_update() to avoid duplication of offset trickery.
>  * Added support for HCR0 read/write in serial8250_em_{serial_in, serial_out}
>  * Added UART_LCR macro support in serial8250_em_serial_in() to read LCR
>  * Reordered serial8250_em_{serial_in, serial_out} above serial8250_rzv2m_
>    reg_update().
>  * Replaced priv->info->serial_out to info->serial_out.
> v1->v2:
>  * Dropped patch#1 from previous series
>  * Replaced devm_clk_get->devm_clk_get_enabled() and updated clk
>    handling in probe().
>  * Added Rb tag from Geert.
>  * Added patch for updating Renesas RZ/V2M UART type from 16550a->16750
>    and also enables 64-bytes fifo.
>  * Used .data for taking h/w differences between EMMA mobile and RZ/V2M UART.
>  * Added serial_out() to struct serial8250_em_hw_info for the write register
>    differences between EMMA mobile and RZ/V2M UART.
> Biju Das (3):
>   serial: 8250_em: Use dev_err_probe()
>   serial: 8250_em: Update RZ/V2M port type as PORT_16750
>   serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
> 
>  drivers/tty/serial/8250/8250_em.c | 128 ++++++++++++++++++++++++------
>  1 file changed, 102 insertions(+), 26 deletions(-)
> 
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-10 20:34 ` [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info Biju Das
  2023-02-12 11:09   ` Andy Shevchenko
@ 2023-02-13  8:42   ` Ilpo Järvinen
  2023-02-13  8:53     ` Biju Das
  1 sibling, 1 reply; 35+ messages in thread
From: Ilpo Järvinen @ 2023-02-13  8:42 UTC (permalink / raw)
  To: Biju Das
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On Fri, 10 Feb 2023, Biju Das wrote:

> As per HW manual section 40.6.1, we need to perform FIFO reset + SW
> reset before updating the below registers.
> 
> FCR[7:5], FCR[3:0], LCR[7][5:0], MCR[6:4], DLL[7:0], DLM[7:0] and
> HCR0[6:5][3:2].
> 
> This patch adds serial_out() to struct serial8250_em_hw_info to
> handle this difference between emma mobile and rz/v2m.
> 
> DLL/DLM register can be updated only by setting LCR[7]. So the
> updation of LCR[7] will perform reset for DLL/DLM register changes.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> v2->v3:
>  * Replaced readl/writel()->serial8250_em_serial_in/out() in serial8250_rzv2m_
>    reg_update() to avoid duplication of offset trickery.
>  * Added support for HCR0 read/write in serial8250_em_{serial_in, serial_out}
>  * Added UART_LCR macro support in serial8250_em_serial_in() to read LCR
>  * Reordered serial8250_em_{serial_in, serial_out} above serial8250_rzv2m_
>    reg_update().
>  * Replaced priv->info->serial_out to info->serial_out.
> v1->v2:
>  * Added serial_out to struct serial8250_em_hw_info
> ---
>  drivers/tty/serial/8250/8250_em.c | 67 ++++++++++++++++++++++++++++++-
>  1 file changed, 66 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
> index 69cd3b611501..a90a5cc4234a 100644
> --- a/drivers/tty/serial/8250/8250_em.c
> +++ b/drivers/tty/serial/8250/8250_em.c
> @@ -19,10 +19,14 @@
>  
>  #define UART_DLL_EM 9
>  #define UART_DLM_EM 10
> +#define UART_HCR0 11
> +
> +#define UART_HCR0_SW_RESET	BIT(7) /* SW Reset */
>  
>  struct serial8250_em_hw_info {
>  	unsigned int type;
>  	upf_t flags;
> +	void (*serial_out)(struct uart_port *p, int off, int value);
>  };
>  
>  struct serial8250_em_priv {
> @@ -46,6 +50,7 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
>  		fallthrough;
>  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
>  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> +	case UART_HCR0: /* HCR0 @ 0x2c */
>  		writel(value, p->membase + (offset << 2));
>  	}
>  }
> @@ -55,6 +60,7 @@ static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
>  	switch (offset) {
>  	case UART_RX: /* RX @ 0x00 */
>  		return readb(p->membase);
> +	case UART_LCR: /* LCR @ 0x10 (+1) */
>  	case UART_MCR: /* MCR @ 0x14 (+1) */
>  	case UART_LSR: /* LSR @ 0x18 (+1) */
>  	case UART_MSR: /* MSR @ 0x1c (+1) */
> @@ -64,11 +70,68 @@ static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
>  	case UART_IIR: /* IIR @ 0x08 */
>  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
>  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> +	case UART_HCR0: /* HCR0 @ 0x2c */
>  		return readl(p->membase + (offset << 2));
>  	}
>  	return 0;
>  }
>  
> +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off, int value)
> +{
> +	unsigned int ier, fcr, lcr, mcr, hcr0;
> +
> +	ier = serial8250_em_serial_in(p, UART_IER);
> +	lcr = serial8250_em_serial_in(p, UART_LCR);
> +	mcr = serial8250_em_serial_in(p, UART_MCR);
> +	hcr0 = serial8250_em_serial_in(p, UART_HCR0);
> +	/*
> +	 * The value of UART_IIR and UART_FCR are 2, but corresponding
> +	 * RZ/V2M address offset are different(0x08 and 0x0c). So we need to
> +	 * use readl() here.
> +	 */
> +	fcr = readl(p->membase + ((UART_FCR + 1) << 2));

I don't get the meaning of that comment. It doesn't seem to match what 
your code does as the code seemingly has nothing to do with IIR (and 
none of you changelogs refer to IIR either)?

Is the only reason for this that serial8250_em_serial_in() currently
lacks case UART_FCR: ? Why cannot that just be added there?

-- 
 i.

> +	serial8250_em_serial_out(p, UART_FCR, fcr | UART_FCR_CLEAR_RCVR |
> +				 UART_FCR_CLEAR_XMIT);
> +	serial8250_em_serial_out(p, UART_HCR0, hcr0 | UART_HCR0_SW_RESET);
> +	serial8250_em_serial_out(p, UART_HCR0, hcr0 & ~UART_HCR0_SW_RESET);
> +
> +	switch (off) {
> +	case UART_FCR:
> +		fcr = value;
> +		break;
> +	case UART_LCR:
> +		lcr = value;
> +		break;
> +	case UART_MCR:
> +		mcr = value;
> +		break;
> +	}
> +
> +	serial8250_em_serial_out(p, UART_IER, ier);
> +	serial8250_em_serial_out(p, UART_FCR, fcr);
> +	serial8250_em_serial_out(p, UART_MCR, mcr);
> +	serial8250_em_serial_out(p, UART_LCR, lcr);
> +	serial8250_em_serial_out(p, UART_HCR0, hcr0);
> +}
> +
> +static void serial8250_em_rzv2m_serial_out(struct uart_port *p, int offset, int value)
> +{
> +	switch (offset) {
> +	case UART_TX:
> +	case UART_SCR:
> +	case UART_IER:
> +	case UART_DLL_EM:
> +	case UART_DLM_EM:
> +		serial8250_em_serial_out(p, offset, value);
> +		break;
> +	case UART_FCR:
> +	case UART_LCR:
> +	case UART_MCR:
> +		serial8250_rzv2m_reg_update(p, offset, value);
> +	}
> +}
> +
>  static int serial8250_em_serial_dl_read(struct uart_8250_port *up)
>  {
>  	return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
> @@ -120,7 +183,7 @@ static int serial8250_em_probe(struct platform_device *pdev)
>  
>  	up.port.iotype = UPIO_MEM32;
>  	up.port.serial_in = serial8250_em_serial_in;
> -	up.port.serial_out = serial8250_em_serial_out;
> +	up.port.serial_out = info->serial_out;
>  	up.dl_read = serial8250_em_serial_dl_read;
>  	up.dl_write = serial8250_em_serial_dl_write;
>  
> @@ -144,11 +207,13 @@ static int serial8250_em_remove(struct platform_device *pdev)
>  static const struct serial8250_em_hw_info emma_mobile_uart_hw_info = {
>  	.type = PORT_UNKNOWN,
>  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
> +	.serial_out = serial8250_em_serial_out,
>  };
>  
>  static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
>  	.type = PORT_16750,
>  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP | UPF_FIXED_TYPE,
> +	.serial_out = serial8250_em_rzv2m_serial_out,
>  };
>  
>  static const struct of_device_id serial8250_em_dt_ids[] = {
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  8:42   ` Ilpo Järvinen
@ 2023-02-13  8:53     ` Biju Das
  2023-02-13  9:10       ` Jiri Slaby
  2023-02-13  9:12       ` Ilpo Järvinen
  0 siblings, 2 replies; 35+ messages in thread
From: Biju Das @ 2023-02-13  8:53 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

HI Ilpo,

Thanks for the feedback.

> Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> On Fri, 10 Feb 2023, Biju Das wrote:
> 
> > As per HW manual section 40.6.1, we need to perform FIFO reset + SW
> > reset before updating the below registers.
> >
> > FCR[7:5], FCR[3:0], LCR[7][5:0], MCR[6:4], DLL[7:0], DLM[7:0] and
> > HCR0[6:5][3:2].
> >
> > This patch adds serial_out() to struct serial8250_em_hw_info to handle
> > this difference between emma mobile and rz/v2m.
> >
> > DLL/DLM register can be updated only by setting LCR[7]. So the
> > updation of LCR[7] will perform reset for DLL/DLM register changes.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > v2->v3:
> >  * Replaced readl/writel()->serial8250_em_serial_in/out() in
> serial8250_rzv2m_
> >    reg_update() to avoid duplication of offset trickery.
> >  * Added support for HCR0 read/write in serial8250_em_{serial_in,
> > serial_out}
> >  * Added UART_LCR macro support in serial8250_em_serial_in() to read
> > LCR
> >  * Reordered serial8250_em_{serial_in, serial_out} above serial8250_rzv2m_
> >    reg_update().
> >  * Replaced priv->info->serial_out to info->serial_out.
> > v1->v2:
> >  * Added serial_out to struct serial8250_em_hw_info
> > ---
> >  drivers/tty/serial/8250/8250_em.c | 67
> > ++++++++++++++++++++++++++++++-
> >  1 file changed, 66 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_em.c
> > b/drivers/tty/serial/8250/8250_em.c
> > index 69cd3b611501..a90a5cc4234a 100644
> > --- a/drivers/tty/serial/8250/8250_em.c
> > +++ b/drivers/tty/serial/8250/8250_em.c
> > @@ -19,10 +19,14 @@
> >
> >  #define UART_DLL_EM 9
> >  #define UART_DLM_EM 10
> > +#define UART_HCR0 11
> > +
> > +#define UART_HCR0_SW_RESET	BIT(7) /* SW Reset */
> >
> >  struct serial8250_em_hw_info {
> >  	unsigned int type;
> >  	upf_t flags;
> > +	void (*serial_out)(struct uart_port *p, int off, int value);
> >  };
> >
> >  struct serial8250_em_priv {
> > @@ -46,6 +50,7 @@ static void serial8250_em_serial_out(struct uart_port
> *p, int offset, int value)
> >  		fallthrough;
> >  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
> >  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> > +	case UART_HCR0: /* HCR0 @ 0x2c */
> >  		writel(value, p->membase + (offset << 2));
> >  	}
> >  }
> > @@ -55,6 +60,7 @@ static unsigned int serial8250_em_serial_in(struct
> uart_port *p, int offset)
> >  	switch (offset) {
> >  	case UART_RX: /* RX @ 0x00 */
> >  		return readb(p->membase);
> > +	case UART_LCR: /* LCR @ 0x10 (+1) */
> >  	case UART_MCR: /* MCR @ 0x14 (+1) */
> >  	case UART_LSR: /* LSR @ 0x18 (+1) */
> >  	case UART_MSR: /* MSR @ 0x1c (+1) */ @@ -64,11 +70,68 @@ static
> > unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
> >  	case UART_IIR: /* IIR @ 0x08 */
> >  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
> >  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> > +	case UART_HCR0: /* HCR0 @ 0x2c */
> >  		return readl(p->membase + (offset << 2));
> >  	}
> >  	return 0;
> >  }
> >
> > +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
> > +int value) {
> > +	unsigned int ier, fcr, lcr, mcr, hcr0;
> > +
> > +	ier = serial8250_em_serial_in(p, UART_IER);
> > +	lcr = serial8250_em_serial_in(p, UART_LCR);
> > +	mcr = serial8250_em_serial_in(p, UART_MCR);
> > +	hcr0 = serial8250_em_serial_in(p, UART_HCR0);
> > +	/*
> > +	 * The value of UART_IIR and UART_FCR are 2, but corresponding
> > +	 * RZ/V2M address offset are different(0x08 and 0x0c). So we need to
> > +	 * use readl() here.
> > +	 */
> > +	fcr = readl(p->membase + ((UART_FCR + 1) << 2));
> 
> I don't get the meaning of that comment. It doesn't seem to match what your
> code does as the code seemingly has nothing to do with IIR (and none of you
> changelogs refer to IIR either)?

The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a value of 2.

The RZ/V2M register offset don't match with standard ones, we are doing remapping
inside case statements in serial8250_em_serial_in() and serial8250_em_serial_out().

Currently IIR is already present in serial8250_em_serial_in(), so no issue.

But when I tried to add UART_FCR in case, it gives the compilation error.
You cannot have same case values inside switch.

> 
> Is the only reason for this that serial8250_em_serial_in() currently lacks
> case UART_FCR: ? Why cannot that just be added there?

Yes, It gives build error. 

Cheers,
Biju

> 
> --
>  i.
> 
> > +	serial8250_em_serial_out(p, UART_FCR, fcr | UART_FCR_CLEAR_RCVR |
> > +				 UART_FCR_CLEAR_XMIT);
> > +	serial8250_em_serial_out(p, UART_HCR0, hcr0 | UART_HCR0_SW_RESET);
> > +	serial8250_em_serial_out(p, UART_HCR0, hcr0 & ~UART_HCR0_SW_RESET);
> > +
> > +	switch (off) {
> > +	case UART_FCR:
> > +		fcr = value;
> > +		break;
> > +	case UART_LCR:
> > +		lcr = value;
> > +		break;
> > +	case UART_MCR:
> > +		mcr = value;
> > +		break;
> > +	}
> > +
> > +	serial8250_em_serial_out(p, UART_IER, ier);
> > +	serial8250_em_serial_out(p, UART_FCR, fcr);
> > +	serial8250_em_serial_out(p, UART_MCR, mcr);
> > +	serial8250_em_serial_out(p, UART_LCR, lcr);
> > +	serial8250_em_serial_out(p, UART_HCR0, hcr0); }
> > +
> > +static void serial8250_em_rzv2m_serial_out(struct uart_port *p, int
> > +offset, int value) {
> > +	switch (offset) {
> > +	case UART_TX:
> > +	case UART_SCR:
> > +	case UART_IER:
> > +	case UART_DLL_EM:
> > +	case UART_DLM_EM:
> > +		serial8250_em_serial_out(p, offset, value);
> > +		break;
> > +	case UART_FCR:
> > +	case UART_LCR:
> > +	case UART_MCR:
> > +		serial8250_rzv2m_reg_update(p, offset, value);
> > +	}
> > +}
> > +
> >  static int serial8250_em_serial_dl_read(struct uart_8250_port *up)  {
> >  	return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
> > @@ -120,7 +183,7 @@ static int serial8250_em_probe(struct
> > platform_device *pdev)
> >
> >  	up.port.iotype = UPIO_MEM32;
> >  	up.port.serial_in = serial8250_em_serial_in;
> > -	up.port.serial_out = serial8250_em_serial_out;
> > +	up.port.serial_out = info->serial_out;
> >  	up.dl_read = serial8250_em_serial_dl_read;
> >  	up.dl_write = serial8250_em_serial_dl_write;
> >
> > @@ -144,11 +207,13 @@ static int serial8250_em_remove(struct
> > platform_device *pdev)  static const struct serial8250_em_hw_info
> emma_mobile_uart_hw_info = {
> >  	.type = PORT_UNKNOWN,
> >  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
> > +	.serial_out = serial8250_em_serial_out,
> >  };
> >
> >  static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
> >  	.type = PORT_16750,
> >  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP |
> > UPF_FIXED_TYPE,
> > +	.serial_out = serial8250_em_rzv2m_serial_out,
> >  };
> >
> >  static const struct of_device_id serial8250_em_dt_ids[] = {
> >

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  8:53     ` Biju Das
@ 2023-02-13  9:10       ` Jiri Slaby
  2023-02-13  9:12         ` Jiri Slaby
  2023-02-13  9:12       ` Ilpo Järvinen
  1 sibling, 1 reply; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  9:10 UTC (permalink / raw)
  To: Biju Das, Ilpo Järvinen
  Cc: Greg Kroah-Hartman, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On 13. 02. 23, 9:53, Biju Das wrote:
>>> +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
>>> +int value) {
>>> +	unsigned int ier, fcr, lcr, mcr, hcr0;
>>> +
>>> +	ier = serial8250_em_serial_in(p, UART_IER);
>>> +	lcr = serial8250_em_serial_in(p, UART_LCR);
>>> +	mcr = serial8250_em_serial_in(p, UART_MCR);
>>> +	hcr0 = serial8250_em_serial_in(p, UART_HCR0);
>>> +	/*
>>> +	 * The value of UART_IIR and UART_FCR are 2, but corresponding
>>> +	 * RZ/V2M address offset are different(0x08 and 0x0c). So we need to
>>> +	 * use readl() here.
>>> +	 */
>>> +	fcr = readl(p->membase + ((UART_FCR + 1) << 2));
>>
>> I don't get the meaning of that comment. It doesn't seem to match what your
>> code does as the code seemingly has nothing to do with IIR (and none of you
>> changelogs refer to IIR either)?
> 
> The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a value of 2.

Sure, IIR is normally WO and FCR RO and share the same register. I would 
simply define UART_FCR_RZ (or alike) for 0x12.

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:10       ` Jiri Slaby
@ 2023-02-13  9:12         ` Jiri Slaby
  2023-02-13  9:14           ` Jiri Slaby
  2023-02-13  9:22           ` Ilpo Järvinen
  0 siblings, 2 replies; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  9:12 UTC (permalink / raw)
  To: Biju Das, Ilpo Järvinen
  Cc: Greg Kroah-Hartman, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On 13. 02. 23, 10:10, Jiri Slaby wrote:
> On 13. 02. 23, 9:53, Biju Das wrote:
>>>> +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
>>>> +int value) {
>>>> +    unsigned int ier, fcr, lcr, mcr, hcr0;
>>>> +
>>>> +    ier = serial8250_em_serial_in(p, UART_IER);
>>>> +    lcr = serial8250_em_serial_in(p, UART_LCR);
>>>> +    mcr = serial8250_em_serial_in(p, UART_MCR);
>>>> +    hcr0 = serial8250_em_serial_in(p, UART_HCR0);
>>>> +    /*
>>>> +     * The value of UART_IIR and UART_FCR are 2, but corresponding
>>>> +     * RZ/V2M address offset are different(0x08 and 0x0c). So we 
>>>> need to
>>>> +     * use readl() here.
>>>> +     */
>>>> +    fcr = readl(p->membase + ((UART_FCR + 1) << 2));
>>>
>>> I don't get the meaning of that comment. It doesn't seem to match 
>>> what your
>>> code does as the code seemingly has nothing to do with IIR (and none 
>>> of you
>>> changelogs refer to IIR either)?
>>
>> The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a 
>> value of 2.
> 
> Sure, IIR is normally WO and FCR RO and share the same register. I would 
> simply define UART_FCR_RZ (or alike)

Or even UART_FCR_RO_RZ?

> for 0x12.

I mean 12 or 0xc.

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  8:53     ` Biju Das
  2023-02-13  9:10       ` Jiri Slaby
@ 2023-02-13  9:12       ` Ilpo Järvinen
  1 sibling, 0 replies; 35+ messages in thread
From: Ilpo Järvinen @ 2023-02-13  9:12 UTC (permalink / raw)
  To: Biju Das
  Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On Mon, 13 Feb 2023, Biju Das wrote:

> HI Ilpo,
> 
> Thanks for the feedback.
> 
> > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> > serial8250_em_hw_info
> > 
> > On Fri, 10 Feb 2023, Biju Das wrote:
> > 
> > > As per HW manual section 40.6.1, we need to perform FIFO reset + SW
> > > reset before updating the below registers.
> > >
> > > FCR[7:5], FCR[3:0], LCR[7][5:0], MCR[6:4], DLL[7:0], DLM[7:0] and
> > > HCR0[6:5][3:2].
> > >
> > > This patch adds serial_out() to struct serial8250_em_hw_info to handle
> > > this difference between emma mobile and rz/v2m.
> > >
> > > DLL/DLM register can be updated only by setting LCR[7]. So the
> > > updation of LCR[7] will perform reset for DLL/DLM register changes.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > > v2->v3:
> > >  * Replaced readl/writel()->serial8250_em_serial_in/out() in
> > serial8250_rzv2m_
> > >    reg_update() to avoid duplication of offset trickery.
> > >  * Added support for HCR0 read/write in serial8250_em_{serial_in,
> > > serial_out}
> > >  * Added UART_LCR macro support in serial8250_em_serial_in() to read
> > > LCR
> > >  * Reordered serial8250_em_{serial_in, serial_out} above serial8250_rzv2m_
> > >    reg_update().
> > >  * Replaced priv->info->serial_out to info->serial_out.
> > > v1->v2:
> > >  * Added serial_out to struct serial8250_em_hw_info
> > > ---
> > >  drivers/tty/serial/8250/8250_em.c | 67
> > > ++++++++++++++++++++++++++++++-
> > >  1 file changed, 66 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/tty/serial/8250/8250_em.c
> > > b/drivers/tty/serial/8250/8250_em.c
> > > index 69cd3b611501..a90a5cc4234a 100644
> > > --- a/drivers/tty/serial/8250/8250_em.c
> > > +++ b/drivers/tty/serial/8250/8250_em.c
> > > @@ -19,10 +19,14 @@
> > >
> > >  #define UART_DLL_EM 9
> > >  #define UART_DLM_EM 10
> > > +#define UART_HCR0 11
> > > +
> > > +#define UART_HCR0_SW_RESET	BIT(7) /* SW Reset */
> > >
> > >  struct serial8250_em_hw_info {
> > >  	unsigned int type;
> > >  	upf_t flags;
> > > +	void (*serial_out)(struct uart_port *p, int off, int value);
> > >  };
> > >
> > >  struct serial8250_em_priv {
> > > @@ -46,6 +50,7 @@ static void serial8250_em_serial_out(struct uart_port
> > *p, int offset, int value)
> > >  		fallthrough;
> > >  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
> > >  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> > > +	case UART_HCR0: /* HCR0 @ 0x2c */
> > >  		writel(value, p->membase + (offset << 2));
> > >  	}
> > >  }
> > > @@ -55,6 +60,7 @@ static unsigned int serial8250_em_serial_in(struct
> > uart_port *p, int offset)
> > >  	switch (offset) {
> > >  	case UART_RX: /* RX @ 0x00 */
> > >  		return readb(p->membase);
> > > +	case UART_LCR: /* LCR @ 0x10 (+1) */
> > >  	case UART_MCR: /* MCR @ 0x14 (+1) */
> > >  	case UART_LSR: /* LSR @ 0x18 (+1) */
> > >  	case UART_MSR: /* MSR @ 0x1c (+1) */ @@ -64,11 +70,68 @@ static
> > > unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
> > >  	case UART_IIR: /* IIR @ 0x08 */
> > >  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
> > >  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> > > +	case UART_HCR0: /* HCR0 @ 0x2c */
> > >  		return readl(p->membase + (offset << 2));
> > >  	}
> > >  	return 0;
> > >  }
> > >
> > > +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
> > > +int value) {
> > > +	unsigned int ier, fcr, lcr, mcr, hcr0;
> > > +
> > > +	ier = serial8250_em_serial_in(p, UART_IER);
> > > +	lcr = serial8250_em_serial_in(p, UART_LCR);
> > > +	mcr = serial8250_em_serial_in(p, UART_MCR);
> > > +	hcr0 = serial8250_em_serial_in(p, UART_HCR0);
> > > +	/*
> > > +	 * The value of UART_IIR and UART_FCR are 2, but corresponding
> > > +	 * RZ/V2M address offset are different(0x08 and 0x0c). So we need to
> > > +	 * use readl() here.
> > > +	 */
> > > +	fcr = readl(p->membase + ((UART_FCR + 1) << 2));
> > 
> > I don't get the meaning of that comment. It doesn't seem to match what your
> > code does as the code seemingly has nothing to do with IIR (and none of you
> > changelogs refer to IIR either)?
> 
> The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a value of 2.
> 
> The RZ/V2M register offset don't match with standard ones, we are doing remapping
> inside case statements in serial8250_em_serial_in() and serial8250_em_serial_out().
> 
> Currently IIR is already present in serial8250_em_serial_in(), so no issue.
> 
> But when I tried to add UART_FCR in case, it gives the compilation error.
> You cannot have same case values inside switch.
> 
> > 
> > Is the only reason for this that serial8250_em_serial_in() currently lacks
> > case UART_FCR: ? Why cannot that just be added there?
> 
> Yes, It gives build error. 

Ok, thanks for explaining. I guess adding case UART_FCR_EM: with 
the correct value has a risk colliding with UART_LCR reads? I'm actually a 
bit surprised serial8250_em_serial_in() doesn't map LCR at all.

One option would be to just invent some big (bogus) number for UART_FCR_EM 
and correct the offset in serial8250_em_serial_in() into 0x0c. And just
add a comment to the define that you cannot use the correct value to avoid
overlapping with existing register defines.

-- 
 i.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:12         ` Jiri Slaby
@ 2023-02-13  9:14           ` Jiri Slaby
  2023-02-13  9:31             ` Biju Das
  2023-02-13  9:22           ` Ilpo Järvinen
  1 sibling, 1 reply; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  9:14 UTC (permalink / raw)
  To: Biju Das, Ilpo Järvinen
  Cc: Greg Kroah-Hartman, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On 13. 02. 23, 10:12, Jiri Slaby wrote:
> On 13. 02. 23, 10:10, Jiri Slaby wrote:
>> On 13. 02. 23, 9:53, Biju Das wrote:
>>>>> +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
>>>>> +int value) {
>>>>> +    unsigned int ier, fcr, lcr, mcr, hcr0;
>>>>> +
>>>>> +    ier = serial8250_em_serial_in(p, UART_IER);
>>>>> +    lcr = serial8250_em_serial_in(p, UART_LCR);
>>>>> +    mcr = serial8250_em_serial_in(p, UART_MCR);
>>>>> +    hcr0 = serial8250_em_serial_in(p, UART_HCR0);
>>>>> +    /*
>>>>> +     * The value of UART_IIR and UART_FCR are 2, but corresponding
>>>>> +     * RZ/V2M address offset are different(0x08 and 0x0c). So we 
>>>>> need to
>>>>> +     * use readl() here.
>>>>> +     */
>>>>> +    fcr = readl(p->membase + ((UART_FCR + 1) << 2));
>>>>
>>>> I don't get the meaning of that comment. It doesn't seem to match 
>>>> what your
>>>> code does as the code seemingly has nothing to do with IIR (and none 
>>>> of you
>>>> changelogs refer to IIR either)?
>>>
>>> The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a 
>>> value of 2.
>>
>> Sure, IIR is normally WO and FCR RO

What was I thinking? Switch that WO and RO, of course.

> and share the same register. I 
>> would simply define UART_FCR_RZ (or alike)
> 
> Or even UART_FCR_RO_RZ?
> 
>> for 0x12.
> 
> I mean 12 or 0xc.
> 

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:12         ` Jiri Slaby
  2023-02-13  9:14           ` Jiri Slaby
@ 2023-02-13  9:22           ` Ilpo Järvinen
  2023-02-13  9:28             ` Jiri Slaby
  1 sibling, 1 reply; 35+ messages in thread
From: Ilpo Järvinen @ 2023-02-13  9:22 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Biju Das, Greg Kroah-Hartman, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]

On Mon, 13 Feb 2023, Jiri Slaby wrote:

> On 13. 02. 23, 10:10, Jiri Slaby wrote:
> > On 13. 02. 23, 9:53, Biju Das wrote:
> > > > > +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
> > > > > +int value) {
> > > > > +    unsigned int ier, fcr, lcr, mcr, hcr0;
> > > > > +
> > > > > +    ier = serial8250_em_serial_in(p, UART_IER);
> > > > > +    lcr = serial8250_em_serial_in(p, UART_LCR);
> > > > > +    mcr = serial8250_em_serial_in(p, UART_MCR);
> > > > > +    hcr0 = serial8250_em_serial_in(p, UART_HCR0);
> > > > > +    /*
> > > > > +     * The value of UART_IIR and UART_FCR are 2, but corresponding
> > > > > +     * RZ/V2M address offset are different(0x08 and 0x0c). So we need
> > > > > to
> > > > > +     * use readl() here.
> > > > > +     */
> > > > > +    fcr = readl(p->membase + ((UART_FCR + 1) << 2));
> > > > 
> > > > I don't get the meaning of that comment. It doesn't seem to match what
> > > > your
> > > > code does as the code seemingly has nothing to do with IIR (and none of
> > > > you
> > > > changelogs refer to IIR either)?
> > > 
> > > The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a value
> > > of 2.
> > 
> > Sure, IIR is normally WO and FCR RO and share the same register. I would
> > simply define UART_FCR_RZ (or alike)
> 
> Or even UART_FCR_RO_RZ?
> 
> > for 0x12.
> 
> I mean 12 or 0xc.

Won't that collide with LCR reads then? They are currently mapped by 
return 0; but after adding a case for UART_FCR_RO_RZ they'll read from 
what is the FCR register on this HW?


-- 
 i.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:22           ` Ilpo Järvinen
@ 2023-02-13  9:28             ` Jiri Slaby
  2023-02-13  9:40               ` Ilpo Järvinen
  0 siblings, 1 reply; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  9:28 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Biju Das, Greg Kroah-Hartman, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On 13. 02. 23, 10:22, Ilpo Järvinen wrote:
> On Mon, 13 Feb 2023, Jiri Slaby wrote:
> 
>> On 13. 02. 23, 10:10, Jiri Slaby wrote:
>>> On 13. 02. 23, 9:53, Biju Das wrote:
>>>>>> +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off,
>>>>>> +int value) {
>>>>>> +    unsigned int ier, fcr, lcr, mcr, hcr0;
>>>>>> +
>>>>>> +    ier = serial8250_em_serial_in(p, UART_IER);
>>>>>> +    lcr = serial8250_em_serial_in(p, UART_LCR);
>>>>>> +    mcr = serial8250_em_serial_in(p, UART_MCR);
>>>>>> +    hcr0 = serial8250_em_serial_in(p, UART_HCR0);
>>>>>> +    /*
>>>>>> +     * The value of UART_IIR and UART_FCR are 2, but corresponding
>>>>>> +     * RZ/V2M address offset are different(0x08 and 0x0c). So we need
>>>>>> to
>>>>>> +     * use readl() here.
>>>>>> +     */
>>>>>> +    fcr = readl(p->membase + ((UART_FCR + 1) << 2));
>>>>>
>>>>> I don't get the meaning of that comment. It doesn't seem to match what
>>>>> your
>>>>> code does as the code seemingly has nothing to do with IIR (and none of
>>>>> you
>>>>> changelogs refer to IIR either)?
>>>>
>>>> The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a value
>>>> of 2.
>>>
>>> Sure, IIR is normally WO and FCR RO and share the same register. I would
>>> simply define UART_FCR_RZ (or alike)
>>
>> Or even UART_FCR_RO_RZ?
>>
>>> for 0x12.
>>
>> I mean 12 or 0xc.
> 
> Won't that collide with LCR reads then? They are currently mapped by
> return 0; but after adding a case for UART_FCR_RO_RZ they'll read from
> what is the FCR register on this HW?

LCR is WO, right? But maybe I'm confused by this really weird HW design?

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:14           ` Jiri Slaby
@ 2023-02-13  9:31             ` Biju Das
  2023-02-13  9:32               ` Jiri Slaby
  2023-02-13  9:57               ` Niklas Söderlund
  0 siblings, 2 replies; 35+ messages in thread
From: Biju Das @ 2023-02-13  9:31 UTC (permalink / raw)
  To: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Niklas Söderlund
  Cc: Greg Kroah-Hartman, linux-serial, Fabrizio Castro, linux-renesas-soc

Hi Jiri Slaby and Ilpo,

Thanks for feedback.

> Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> On 13. 02. 23, 10:12, Jiri Slaby wrote:
> > On 13. 02. 23, 10:10, Jiri Slaby wrote:
> >> On 13. 02. 23, 9:53, Biju Das wrote:
> >>>>> +static void serial8250_rzv2m_reg_update(struct uart_port *p, int
> >>>>> +off, int value) {
> >>>>> +    unsigned int ier, fcr, lcr, mcr, hcr0;
> >>>>> +
> >>>>> +    ier = serial8250_em_serial_in(p, UART_IER);
> >>>>> +    lcr = serial8250_em_serial_in(p, UART_LCR);
> >>>>> +    mcr = serial8250_em_serial_in(p, UART_MCR);
> >>>>> +    hcr0 = serial8250_em_serial_in(p, UART_HCR0);
> >>>>> +    /*
> >>>>> +     * The value of UART_IIR and UART_FCR are 2, but
> >>>>> +corresponding
> >>>>> +     * RZ/V2M address offset are different(0x08 and 0x0c). So we
> >>>>> need to
> >>>>> +     * use readl() here.
> >>>>> +     */
> >>>>> +    fcr = readl(p->membase + ((UART_FCR + 1) << 2));
> >>>>
> >>>> I don't get the meaning of that comment. It doesn't seem to match
> >>>> what your code does as the code seemingly has nothing to do with
> >>>> IIR (and none of you changelogs refer to IIR either)?
> >>>
> >>> The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a
> >>> value of 2.
> >>
> >> Sure, IIR is normally WO and FCR RO
> 
> What was I thinking? Switch that WO and RO, of course.
> 
> > and share the same register. I
> >> would simply define UART_FCR_RZ (or alike)
> >
> > Or even UART_FCR_RO_RZ?
> >
> >> for 0x12.
> >
> > I mean 12 or 0xc.

As per Geert,

"According to R19UH0040EJ0400 Rev.4.00 it is available on EMEV2, and the
layout looks identical to RZ/V2M."

Adding Magnus and Niklas to test on EMMA mobile platform to check the port type detected
On that platform?

So looks like similar to other macros, UART_FCR_EM (0x3) is sensible one.

UART_FCR_RO_OFFSET (9)
UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)


static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
case UART_FCR_RO_EM:
	return readl(p->membase + (offset - UART_FCR_RO_OFFSET << 2));


Cheers,
Biju


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:31             ` Biju Das
@ 2023-02-13  9:32               ` Jiri Slaby
  2023-02-13 11:12                 ` Biju Das
  2023-02-13  9:57               ` Niklas Söderlund
  1 sibling, 1 reply; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  9:32 UTC (permalink / raw)
  To: Biju Das, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Niklas Söderlund
  Cc: Greg Kroah-Hartman, linux-serial, Fabrizio Castro, linux-renesas-soc

On 13. 02. 23, 10:31, Biju Das wrote:
> So looks like similar to other macros, UART_FCR_EM (0x3) is sensible one.
> 
> UART_FCR_RO_OFFSET (9)
> UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)
> 
> 
> static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
> case UART_FCR_RO_EM:
> 	return readl(p->membase + (offset - UART_FCR_RO_OFFSET << 2));


Please send a complete patch as a reply. I am completely lost now.

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:28             ` Jiri Slaby
@ 2023-02-13  9:40               ` Ilpo Järvinen
  2023-02-13  9:53                 ` Jiri Slaby
  0 siblings, 1 reply; 35+ messages in thread
From: Ilpo Järvinen @ 2023-02-13  9:40 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Biju Das, Greg Kroah-Hartman, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

On Mon, 13 Feb 2023, Jiri Slaby wrote:

> On 13. 02. 23, 10:22, Ilpo Järvinen wrote:
> > On Mon, 13 Feb 2023, Jiri Slaby wrote:
> > 
> > > On 13. 02. 23, 10:10, Jiri Slaby wrote:
> > > > On 13. 02. 23, 9:53, Biju Das wrote:
> > > > > > > +static void serial8250_rzv2m_reg_update(struct uart_port *p, int
> > > > > > > off,
> > > > > > > +int value) {
> > > > > > > +    unsigned int ier, fcr, lcr, mcr, hcr0;
> > > > > > > +
> > > > > > > +    ier = serial8250_em_serial_in(p, UART_IER);
> > > > > > > +    lcr = serial8250_em_serial_in(p, UART_LCR);
> > > > > > > +    mcr = serial8250_em_serial_in(p, UART_MCR);
> > > > > > > +    hcr0 = serial8250_em_serial_in(p, UART_HCR0);
> > > > > > > +    /*
> > > > > > > +     * The value of UART_IIR and UART_FCR are 2, but
> > > > > > > corresponding
> > > > > > > +     * RZ/V2M address offset are different(0x08 and 0x0c). So we
> > > > > > > need
> > > > > > > to
> > > > > > > +     * use readl() here.
> > > > > > > +     */
> > > > > > > +    fcr = readl(p->membase + ((UART_FCR + 1) << 2));
> > > > > > 
> > > > > > I don't get the meaning of that comment. It doesn't seem to match
> > > > > > what
> > > > > > your
> > > > > > code does as the code seemingly has nothing to do with IIR (and none
> > > > > > of
> > > > > > you
> > > > > > changelogs refer to IIR either)?
> > > > > 
> > > > > The generic macro UART_IIR and UART_FCR in linux/serial_reg.h has a
> > > > > value
> > > > > of 2.
> > > > 
> > > > Sure, IIR is normally WO and FCR RO and share the same register. I would
> > > > simply define UART_FCR_RZ (or alike)
> > > 
> > > Or even UART_FCR_RO_RZ?
> > > 
> > > > for 0x12.
> > > 
> > > I mean 12 or 0xc.
> > 
> > Won't that collide with LCR reads then? They are currently mapped by
> > return 0; but after adding a case for UART_FCR_RO_RZ they'll read from
> > what is the FCR register on this HW?
> 
> LCR is WO, right? But maybe I'm confused by this really weird HW design?

LCR is not WO and it is read during autoconfig too:

8250_port.c=static int size_fifo(struct uart_8250_port *up)
8250_port.c:    old_lcr = serial_in(up, UART_LCR);
8250_port.c=static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
8250_port.c:    old_lcr = serial_in(p, UART_LCR);
8250_port.c=static void autoconfig(struct uart_8250_port *up)
8250_port.c:    save_lcr = serial_in(up, UART_LCR);

Although the only thing the value is used for is to write it back to LCR.


-- 
 i.

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:40               ` Ilpo Järvinen
@ 2023-02-13  9:53                 ` Jiri Slaby
  0 siblings, 0 replies; 35+ messages in thread
From: Jiri Slaby @ 2023-02-13  9:53 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Biju Das, Greg Kroah-Hartman, linux-serial, Geert Uytterhoeven,
	Fabrizio Castro, linux-renesas-soc

On 13. 02. 23, 10:40, Ilpo Järvinen wrote:
>> LCR is WO, right? But maybe I'm confused by this really weird HW design?
> 
> LCR is not WO and it is read during autoconfig too:
> 
> 8250_port.c=static int size_fifo(struct uart_8250_port *up)
> 8250_port.c:    old_lcr = serial_in(up, UART_LCR);
> 8250_port.c=static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
> 8250_port.c:    old_lcr = serial_in(p, UART_LCR);
> 8250_port.c=static void autoconfig(struct uart_8250_port *up)
> 8250_port.c:    save_lcr = serial_in(up, UART_LCR);
> 
> Although the only thing the value is used for is to write it back to LCR.

Yeah, of course LCR is RW and is NOT shared.

-- 
js
suse labs


^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:31             ` Biju Das
  2023-02-13  9:32               ` Jiri Slaby
@ 2023-02-13  9:57               ` Niklas Söderlund
  2023-02-13 10:06                 ` Biju Das
  1 sibling, 1 reply; 35+ messages in thread
From: Niklas Söderlund @ 2023-02-13  9:57 UTC (permalink / raw)
  To: Biju Das
  Cc: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Greg Kroah-Hartman, linux-serial, Fabrizio Castro,
	linux-renesas-soc

Hi Biju,

On 2023-02-13 09:31:27 +0000, Biju Das wrote:
> Adding Magnus and Niklas to test on EMMA mobile platform to check the 
> port type detected
> On that platform?

I don't know what you want me to check, I don't know much about serial. I 
wired up the platform during the weekend, here is a boot log running on 
v6.1. If you want to to check / test something I'm happy to, but will need 
instructions.

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.1.0 (neg@sleipner) (arm-linux-gnueabihf-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #1 SMP Sun Feb 12 18:44:55 CET 2023
[    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: EMEV2 KZM9D Board
[    0.000000] printk: debug: ignoring loglevel setting.
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Failed to reserve 128 MiB
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000040000000-0x0000000047ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000047ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000047ffffff]
[    0.000000] percpu: Embedded 13 pages/cpu s32468 r0 d20780 u53248
[    0.000000] pcpu-alloc: s32468 r0 d20780 u53248 alloc=13*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: ignore_loglevel rw root=/dev/nfs ip=on
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 116072K/131072K available (8192K kernel code, 1152K rwdata, 2436K rodata, 1024K init, 259K bss, 15000K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] trace event string verifier disabled
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: enabling workaround for broken byte access
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] timer_probe: no matching timers found
[    0.000000] Console: colour dummy device 80x30
[    0.000000] printk: console [tty0] enabled
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
[    0.000000] Calibrating delay loop (skipped) preset value.. 1066.00 BogoMIPS (lpj=5330000)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] CPU: Testing write buffer coherency: ok
[    0.000000] CPU0: Spectre v2: using BPIALL workaround
[    0.000000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.000000] Setting up static identity map for 0x40100000 - 0x40100060
[    0.000000] rcu: Hierarchical SRCU implementation.
[    0.000000] rcu: 	Max phase no-delay instances is 1000.
[    0.000000] smp: Bringing up secondary CPUs ...
[    0.000000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.000000] CPU1: Spectre v2: using BPIALL workaround
[    0.000000] smp: Brought up 1 node, 2 CPUs
[    0.000000] SMP: Total of 2 processors activated (2132.00 BogoMIPS).
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] devtmpfs: initialized
[    0.000000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 1
[    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.000000] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.000000] pinctrl core: initialized pinctrl subsystem
[    0.000000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.000000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.000000] thermal_sys: Registered thermal governor 'step_wise'
[    0.000000] No ATAGs?
[    0.000000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[    0.000000] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.000000] sh-pfc e0140200.pinctrl: emev2_pfc support registered
[    0.000000] SCSI subsystem initialized
[    0.000000] libata version 3.00 loaded.
[    0.000000] usbcore: registered new interface driver usbfs
[    0.000000] usbcore: registered new interface driver hub
[    0.000000] usbcore: registered new device driver usb
[    0.000000] mc: Linux media interface: v0.10
[    0.000000] videodev: Linux video capture interface: v2.00
[    0.000000] pps_core: LinuxPPS API ver. 1 registered
[    0.000000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.000000] PTP clock support registered
[    0.000000] em_sti e0180000.timer: used for clock events
[    0.000000] em_sti e0180000.timer: used for oneshot clock events
[    0.000000] em_sti e0180000.timer: used as clock source
[    0.000000] clocksource: e0180000.timer: mask: 0xffffffffffff max_cycles: 0x1ef4687b1, max_idle_ns: 112843571739654 ns
[    0.000000] Advanced Linux Sound Architecture Driver Initialized.
[    0.000000] vgaarb: loaded
[    0.940000] clocksource: Switched to clocksource e0180000.timer
[    0.950000] Clockevents: could not switch to one-shot mode:
[    0.950000] Clockevents: could not switch to one-shot mode: dummy_timer is not functional.
[    0.950000]  dummy_timer is not functional.
[    0.960000] NET: Registered PF_INET protocol family
[    0.960000] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.960000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.960000] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.960000] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.960000] TCP bind hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.960000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.960000] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.960000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.960000] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.960000] RPC: Registered named UNIX socket transport module.
[    0.960000] RPC: Registered udp transport module.
[    0.960000] RPC: Registered tcp transport module.
[    0.960000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.960000] PCI: CLS 0 bytes, default 64
[    1.000000] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
[    1.000000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    1.000000] NFS: Registering the id_resolver key type
[    1.000000] Key type id_resolver registered
[    1.000000] Key type id_legacy registered
[    1.000000] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.000000] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    1.000000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[    1.000000] io scheduler mq-deadline registered
[    1.000000] io scheduler kyber registered
[    1.010000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.020000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37, base_baud = 796444) is a 16550A
[    1.020000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38, base_baud = 7168000) is a 16550A
[    1.690000] printk: console [ttyS1] enabled
[    1.700000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39, base_baud = 14336000) is a 16550A
[    1.710000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40, base_baud = 2389333) is a 16550A
[    1.720000] SuperH (H)SCI(F) driver initialized
[    1.730000] CAN device driver interface
[    1.800000] smsc911x 20000000.ethernet eth0: MAC Address: 00:0a:a3:02:12:92
[    1.810000] UDC core: g_ether: couldn't find an available UDC
[    1.810000] i2c_dev: i2c /dev entries driver
[    1.820000] em-i2c e0070000.i2c: Added i2c controller 0, irq 42
[    1.830000] em-i2c e10a0000.i2c: Added i2c controller 1, irq 43
[    1.830000] cpu cpu0: OPP table can't be empty
[    1.840000] usbcore: registered new interface driver usbhid
[    1.850000] usbhid: USB HID core driver
[    1.850000] NET: Registered PF_INET6 protocol family
[    1.860000] Segment Routing with IPv6
[    1.870000] In-situ OAM (IOAM) with IPv6
[    1.870000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.880000] NET: Registered PF_PACKET protocol family
[    1.880000] can: controller area network core
[    1.890000] NET: Registered PF_CAN protocol family
[    1.890000] can: raw protocol
[    1.900000] can: broadcast manager protocol
[    1.900000] can: netlink gateway - max_hops=1
[    1.900000] Key type dns_resolver registered
[    1.910000] Registering SWP/SWPB emulation handler
[    1.920000] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    1.980000] SMSC LAN8700 20000000.ethernet-ffffffff:01: attached PHY driver (mii_bus:phy_addr=20000000.ethernet-ffffffff:01, irq=POLL)
[    2.020000] smsc911x 20000000.ethernet eth0: SMSC911x/921x identified at 0xc8920000, IRQ: 41
[    4.160000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    4.210000] Sending DHCP requests ., OK
[    4.250000] IP-Config: Got DHCP answer from 10.0.1.1, my address is 10.0.1.2
[    4.260000] IP-Config: Complete:
[    4.260000]      device=eth0, hwaddr=00:0a:a3:02:12:92, ipaddr=10.0.1.2, mask=255.255.255.0, gw=10.0.1.1
[    4.270000]      host=10.0.1.2, domain=dyn.berto.se, nis-domain=(none)
[    4.280000]      bootserver=10.0.1.1, rootserver=10.0.1.1, rootpath=/srv/nfs4/arch,tcp,v3
[    4.280000]      nameserver0=192.168.20.1
[    4.290000] ALSA device list:
[    4.290000]   No soundcards found.
[    4.320000] VFS: Mounted root (nfs filesystem) on device 0:15.
[    4.320000] devtmpfs: mounted
[    4.330000] Freeing unused kernel image (initmem) memory: 1024K
[    4.390000] Run /sbin/init as init process
[    4.390000]   with arguments:
[    4.390000]     /sbin/init
[    4.400000]   with environment:
[    4.400000]     HOME=/
[    4.400000]     TERM=linux
[    6.040000] systemd[1]: System time before build time, advancing clock.
[    6.100000] systemd[1]: Failed to find module 'autofs4'
[    6.220000] systemd[1]: systemd 252.5-1-arch running in system mode (+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
[    6.240000] systemd[1]: Detected architecture arm.
[    6.290000] systemd[1]: Hostname set to <arm>.
[    6.520000] systemd[1]: bpf-lsm: BPF LSM hook not enabled in the kernel, BPF LSM not supported
[    8.710000] systemd[1]: Queued start job for default target Graphical Interface.
[    8.730000] systemd[1]: Created slice Slice /system/getty.
[    8.770000] systemd[1]: Created slice Slice /system/modprobe.
[    8.810000] systemd[1]: Created slice Slice /system/serial-getty.
[    8.850000] systemd[1]: Created slice User and Session Slice.
[    8.890000] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[    8.930000] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    8.970000] systemd[1]: Arbitrary Executable File Formats File System Automount Point was skipped because of an unmet condition check (ConditionPathExists=/proc/sys/fs/binfmt_misc).
[    8.980000] systemd[1]: Reached target Local Encrypted Volumes.
[    9.020000] systemd[1]: Reached target Local Integrity Protected Volumes.
[    9.060000] systemd[1]: Reached target Network is Online.
[    9.100000] systemd[1]: Reached target Path Units.
[    9.130000] systemd[1]: Reached target Slice Units.
[    9.170000] systemd[1]: Reached target Swaps.
[    9.200000] systemd[1]: Reached target Local Verity Protected Volumes.
[    9.240000] systemd[1]: Listening on Device-mapper event daemon FIFOs.
[    9.300000] systemd[1]: Listening on Process Core Dump Socket.
[    9.340000] systemd[1]: Journal Audit Socket was skipped because of an unmet condition check (ConditionSecurity=audit).
[    9.350000] systemd[1]: Listening on Journal Socket (/dev/log).
[    9.390000] systemd[1]: Listening on Journal Socket.
[    9.430000] systemd[1]: Listening on udev Control Socket.
[    9.470000] systemd[1]: Listening on udev Kernel Socket.
[    9.510000] systemd[1]: Huge Pages File System was skipped because of an unmet condition check (ConditionPathExists=/sys/kernel/mm/hugepages).
[    9.520000] systemd[1]: POSIX Message Queue File System was skipped because of an unmet condition check (ConditionPathExists=/proc/sys/fs/mqueue).
[    9.590000] systemd[1]: Mounting /root/shared...
[    9.620000] systemd[1]: Mounting Kernel Debug File System...
[    9.680000] systemd[1]: Mounting Kernel Trace File System...
[    9.780000] systemd[1]: Mounting Temporary Directory /tmp...
[    9.820000] systemd[1]: Create List of Static Device Nodes was skipped because of an unmet condition check (ConditionFileNotEmpty=/lib/modules/6.1.0/modules.devname).
[    9.850000] systemd[1]: Starting Load Kernel Module configfs...
[    9.960000] systemd[1]: Starting Load Kernel Module drm...
[   10.010000] systemd[1]: Starting Load Kernel Module fuse...
[   10.070000] systemd[1]: Load Kernel Modules was skipped because no trigger condition checks were met.
[   10.120000] systemd[1]: Starting Remount Root and Kernel File Systems...
[   10.190000] systemd[1]: Repartition Root Disk was skipped because no trigger condition checks were met.
[   10.250000] systemd[1]: Starting Apply Kernel Variables...
[   10.310000] systemd[1]: Starting Coldplug All udev Devices...
[   10.390000] systemd[1]: Mounted Kernel Debug File System.
[   10.410000] systemd[1]: Mounted Kernel Trace File System.
[   10.450000] systemd[1]: Mounted Temporary Directory /tmp.
[   10.490000] systemd[1]: modprobe@configfs.service: Deactivated successfully.
[   10.520000] systemd[1]: Finished Load Kernel Module configfs.
[   10.550000] systemd[1]: modprobe@drm.service: Deactivated successfully.
[   10.550000] systemd[1]: Finished Load Kernel Module drm.
[   10.600000] systemd[1]: modprobe@fuse.service: Deactivated successfully.
[   10.610000] systemd[1]: Finished Load Kernel Module fuse.
[   10.650000] systemd[1]: Finished Remount Root and Kernel File Systems.
[   10.670000] systemd[1]: Finished Apply Kernel Variables.
[   10.890000] systemd[1]: Reached target Host and Network Name Lookups.
[   10.940000] systemd[1]: Listening on RPCbind Server Activation Socket.
[   10.990000] systemd[1]: Reached target RPC Port Mapper.
[   11.030000] systemd[1]: FUSE Control File System was skipped because of an unmet condition check (ConditionPathExists=/sys/fs/fuse/connections).
[   11.090000] systemd[1]: Mounting Kernel Configuration File System...
[   11.130000] systemd[1]: Starting NFS status monitor for NFSv2/3 locking....
[   11.180000] systemd[1]: First Boot Wizard was skipped because of an unmet condition check (ConditionFirstBoot=yes).
[   11.210000] systemd[1]: Rebuild Hardware Database was skipped because of an unmet condition check (ConditionNeedsUpdate=/etc).
[   11.290000] systemd[1]: Starting Load/Save Random Seed...
[   11.330000] systemd[1]: Create System Users was skipped because no trigger condition checks were met.
[   11.380000] systemd[1]: Starting Create Static Device Nodes in /dev...
[   11.500000] systemd[1]: Finished Coldplug All udev Devices.
[   11.540000] systemd[1]: Mounted Kernel Configuration File System.
[   11.620000] systemd[1]: Starting RPC Bind...
[   12.160000] systemd[1]: Finished Create Static Device Nodes in /dev.
[   12.200000] systemd[1]: Started RPC Bind.
[   12.240000] systemd[1]: Reached target Preparation for Local File Systems.
[   12.290000] systemd[1]: Virtual Machine and Container Storage (Compatibility) was skipped because of an unmet condition check (ConditionPathExists=/var/lib/machines.raw).
[   12.310000] systemd[1]: Reached target Local File Systems.
[   12.350000] systemd[1]: Entropy Daemon based on the HAVEGE algorithm was skipped because of an unmet condition check (ConditionKernelVersion=<5.6).
[   12.360000] systemd[1]: Rebuild Dynamic Linker Cache was skipped because no trigger condition checks were met.
[   12.420000] systemd[1]: Starting Notify NFS peers of a restart...
[   12.460000] systemd[1]: Set Up Additional Binary Formats was skipped because no trigger condition checks were met.
[   12.480000] systemd[1]: systemd-journald.service: unit configures an IP firewall, but the local system does not support BPF/cgroup firewalling.
[   12.490000] systemd[1]: (This warning is only shown for the first unit using IP firewalling.)
[   12.570000] systemd[1]: Starting Journal Service...
[   12.620000] systemd[1]: Starting Rule-based Manager for Device Events and Files...
[   12.700000] systemd[1]: Started NFS status monitor for NFSv2/3 locking..
[   12.740000] systemd[1]: Started Notify NFS peers of a restart.
[   12.990000] systemd[1]: Started Journal Service.
[   16.860000] systemd-journald[87]: Received client request to flush runtime journal.
[   21.360000] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[   22.190000] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[   39.150000] random: crng init done

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:57               ` Niklas Söderlund
@ 2023-02-13 10:06                 ` Biju Das
  2023-02-13 10:29                   ` Niklas Söderlund
  0 siblings, 1 reply; 35+ messages in thread
From: Biju Das @ 2023-02-13 10:06 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Greg Kroah-Hartman, linux-serial, Fabrizio Castro,
	linux-renesas-soc

Hi Niklas,

Thanks for testing.

> -----Original Message-----
> From: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> Sent: Monday, February 13, 2023 9:58 AM
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Jiri Slaby <jirislaby@kernel.org>; Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com>; Geert Uytterhoeven
> <geert+renesas@glider.be>; Magnus Damm <magnus.damm@gmail.com>; Greg Kroah-
> Hartman <gregkh@linuxfoundation.org>; linux-serial <linux-
> serial@vger.kernel.org>; Fabrizio Castro <fabrizio.castro.jz@renesas.com>;
> linux-renesas-soc@vger.kernel.org
> Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> Hi Biju,
> 
> On 2023-02-13 09:31:27 +0000, Biju Das wrote:
> > Adding Magnus and Niklas to test on EMMA mobile platform to check the
> > port type detected On that platform?
> 
> I don't know what you want me to check, I don't know much about serial. I
> wired up the platform during the weekend, here is a boot log running on
> v6.1. If you want to to check / test something I'm happy to, but will need
> instructions.

As per Geert the register layout is same as RZ/V2M,
So The UART is register compatible with standard 16750 chip.

But below log shows that it is 16550A and using only 16-bytes fifo,
Eventhough it has 64-bytes fifo.

[    1.020000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37, base_baud = 796444) is a 16550A
[    1.020000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38, base_baud = 7168000) is a 16550A
[    1.690000] printk: console [ttyS1] enabled
[    1.700000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39, base_baud = 14336000) is a 16550A
[    1.710000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40, base_baud = 2389333) is a 16550A

So if you apply, this patch series, and add below changes it should detect as 16750

https://lore.kernel.org/linux-renesas-soc/8585f736-cf3b-b63c-753f-892d4051ada3@linux.intel.com/T/#mce8d222e3670321e8a8e39faacc4d6dd061fdbd6

and for quick testing please do below change for emma mobile.

+ { .compatible = "renesas,em-uart", .data = &rzv2m_uart_hw_info },

Cheers,
Biju



> 
> [    0.000000] Booting Linux on physical CPU 0x0
> [    0.000000] Linux version 6.1.0 (neg@sleipner) (arm-linux-gnueabihf-gcc
> (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #1 SMP Sun Feb 12 18:44:55 CET
> 2023
> [    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7),
> cr=10c5387d
> [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
> instruction cache
> [    0.000000] OF: fdt: Machine model: EMEV2 KZM9D Board
> [    0.000000] printk: debug: ignoring loglevel setting.
> [    0.000000] Memory policy: Data cache writealloc
> [    0.000000] cma: Failed to reserve 128 MiB
> [    0.000000] Zone ranges:
> [    0.000000]   Normal   [mem 0x0000000040000000-0x0000000047ffffff]
> [    0.000000]   HighMem  empty
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x0000000040000000-0x0000000047ffffff]
> [    0.000000] Initmem setup node 0 [mem 0x0000000040000000-
> 0x0000000047ffffff]
> [    0.000000] percpu: Embedded 13 pages/cpu s32468 r0 d20780 u53248
> [    0.000000] pcpu-alloc: s32468 r0 d20780 u53248 alloc=13*4096
> [    0.000000] pcpu-alloc: [0] 0 [0] 1
> [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
> [    0.000000] Kernel command line: ignore_loglevel rw root=/dev/nfs ip=on
> [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536
> bytes, linear)
> [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes,
> linear)
> [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> [    0.000000] Memory: 116072K/131072K available (8192K kernel code, 1152K
> rwdata, 2436K rodata, 1024K init, 259K bss, 15000K reserved, 0K cma-
> reserved, 0K highmem)
> [    0.000000] trace event string verifier disabled
> [    0.000000] rcu: Hierarchical RCU implementation.
> [    0.000000] rcu: 	RCU event tracing is enabled.
> [    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to
> nr_cpu_ids=2.
> [    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10
> jiffies.
> [    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
> [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
> [    0.000000] GIC: enabling workaround for broken byte access
> [    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on
> contention.
> [    0.000000] timer_probe: no matching timers found
> [    0.000000] Console: colour dummy device 80x30
> [    0.000000] printk: console [tty0] enabled
> [    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps
> every 21474836475000000ns
> [    0.000000] Calibrating delay loop (skipped) preset value.. 1066.00
> BogoMIPS (lpj=5330000)
> [    0.000000] pid_max: default: 32768 minimum: 301
> [    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes,
> linear)
> [    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
> bytes, linear)
> [    0.000000] CPU: Testing write buffer coherency: ok
> [    0.000000] CPU0: Spectre v2: using BPIALL workaround
> [    0.000000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
> [    0.000000] Setting up static identity map for 0x40100000 - 0x40100060
> [    0.000000] rcu: Hierarchical SRCU implementation.
> [    0.000000] rcu: 	Max phase no-delay instances is 1000.
> [    0.000000] smp: Bringing up secondary CPUs ...
> [    0.000000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
> [    0.000000] CPU1: Spectre v2: using BPIALL workaround
> [    0.000000] smp: Brought up 1 node, 2 CPUs
> [    0.000000] SMP: Total of 2 processors activated (2132.00 BogoMIPS).
> [    0.000000] CPU: All CPU(s) started in SVC mode.
> [    0.000000] devtmpfs: initialized
> [    0.000000] VFP support v0.3: implementor 41 architecture 3 part 30
> variant 9 rev 1
> [    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles:
> 0xffffffff, max_idle_ns: 19112604462750000 ns
> [    0.000000] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
> [    0.000000] pinctrl core: initialized pinctrl subsystem
> [    0.000000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
> [    0.000000] DMA: preallocated 256 KiB pool for atomic coherent
> allocations
> [    0.000000] thermal_sys: Registered thermal governor 'step_wise'
> [    0.000000] No ATAGs?
> [    0.000000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1
> watchpoint registers.
> [    0.000000] hw-breakpoint: maximum watchpoint size is 4 bytes.
> [    0.000000] sh-pfc e0140200.pinctrl: emev2_pfc support registered
> [    0.000000] SCSI subsystem initialized
> [    0.000000] libata version 3.00 loaded.
> [    0.000000] usbcore: registered new interface driver usbfs
> [    0.000000] usbcore: registered new interface driver hub
> [    0.000000] usbcore: registered new device driver usb
> [    0.000000] mc: Linux media interface: v0.10
> [    0.000000] videodev: Linux video capture interface: v2.00
> [    0.000000] pps_core: LinuxPPS API ver. 1 registered
> [    0.000000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
> Giometti <giometti@linux.it>
> [    0.000000] PTP clock support registered
> [    0.000000] em_sti e0180000.timer: used for clock events
> [    0.000000] em_sti e0180000.timer: used for oneshot clock events
> [    0.000000] em_sti e0180000.timer: used as clock source
> [    0.000000] clocksource: e0180000.timer: mask: 0xffffffffffff max_cycles:
> 0x1ef4687b1, max_idle_ns: 112843571739654 ns
> [    0.000000] Advanced Linux Sound Architecture Driver Initialized.
> [    0.000000] vgaarb: loaded
> [    0.940000] clocksource: Switched to clocksource e0180000.timer
> [    0.950000] Clockevents: could not switch to one-shot mode:
> [    0.950000] Clockevents: could not switch to one-shot mode: dummy_timer
> is not functional.
> [    0.950000]  dummy_timer is not functional.
> [    0.960000] NET: Registered PF_INET protocol family
> [    0.960000] IP idents hash table entries: 2048 (order: 2, 16384 bytes,
> linear)
> [    0.960000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0,
> 4096 bytes, linear)
> [    0.960000] Table-perturb hash table entries: 65536 (order: 6, 262144
> bytes, linear)
> [    0.960000] TCP established hash table entries: 1024 (order: 0, 4096
> bytes, linear)
> [    0.960000] TCP bind hash table entries: 1024 (order: 2, 16384 bytes,
> linear)
> [    0.960000] TCP: Hash tables configured (established 1024 bind 1024)
> [    0.960000] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
> [    0.960000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes,
> linear)
> [    0.960000] NET: Registered PF_UNIX/PF_LOCAL protocol family
> [    0.960000] RPC: Registered named UNIX socket transport module.
> [    0.960000] RPC: Registered udp transport module.
> [    0.960000] RPC: Registered tcp transport module.
> [    0.960000] RPC: Registered tcp NFSv4.1 backchannel transport module.
> [    0.960000] PCI: CLS 0 bytes, default 64
> [    1.000000] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7
> counters available
> [    1.000000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
> [    1.000000] NFS: Registering the id_resolver key type
> [    1.000000] Key type id_resolver registered
> [    1.000000] Key type id_legacy registered
> [    1.000000] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
> [    1.000000] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver
> Registering...
> [    1.000000] Block layer SCSI generic (bsg) driver version 0.4 loaded
> (major 246)
> [    1.000000] io scheduler mq-deadline registered
> [    1.000000] io scheduler kyber registered
> [    1.010000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> [    1.020000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37,
> base_baud = 796444) is a 16550A
> [    1.020000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38,
> base_baud = 7168000) is a 16550A
> [    1.690000] printk: console [ttyS1] enabled
> [    1.700000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39,
> base_baud = 14336000) is a 16550A
> [    1.710000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40,
> base_baud = 2389333) is a 16550A
> [    1.720000] SuperH (H)SCI(F) driver initialized
> [    1.730000] CAN device driver interface
> [    1.800000] smsc911x 20000000.ethernet eth0: MAC Address:
> 00:0a:a3:02:12:92
> [    1.810000] UDC core: g_ether: couldn't find an available UDC
> [    1.810000] i2c_dev: i2c /dev entries driver
> [    1.820000] em-i2c e0070000.i2c: Added i2c controller 0, irq 42
> [    1.830000] em-i2c e10a0000.i2c: Added i2c controller 1, irq 43
> [    1.830000] cpu cpu0: OPP table can't be empty
> [    1.840000] usbcore: registered new interface driver usbhid
> [    1.850000] usbhid: USB HID core driver
> [    1.850000] NET: Registered PF_INET6 protocol family
> [    1.860000] Segment Routing with IPv6
> [    1.870000] In-situ OAM (IOAM) with IPv6
> [    1.870000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
> [    1.880000] NET: Registered PF_PACKET protocol family
> [    1.880000] can: controller area network core
> [    1.890000] NET: Registered PF_CAN protocol family
> [    1.890000] can: raw protocol
> [    1.900000] can: broadcast manager protocol
> [    1.900000] can: netlink gateway - max_hops=1
> [    1.900000] Key type dns_resolver registered
> [    1.910000] Registering SWP/SWPB emulation handler
> [    1.920000] input: gpio_keys as /devices/platform/gpio_keys/input/input0
> [    1.980000] SMSC LAN8700 20000000.ethernet-ffffffff:01: attached PHY
> driver (mii_bus:phy_addr=20000000.ethernet-ffffffff:01, irq=POLL)
> [    2.020000] smsc911x 20000000.ethernet eth0: SMSC911x/921x identified at
> 0xc8920000, IRQ: 41
> [    4.160000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> [    4.210000] Sending DHCP requests ., OK
> [    4.250000] IP-Config: Got DHCP answer from 10.0.1.1, my address is
> 10.0.1.2
> [    4.260000] IP-Config: Complete:
> [    4.260000]      device=eth0, hwaddr=00:0a:a3:02:12:92, ipaddr=10.0.1.2,
> mask=255.255.255.0, gw=10.0.1.1
> [    4.270000]      host=10.0.1.2, domain=dyn.berto.se, nis-domain=(none)
> [    4.280000]      bootserver=10.0.1.1, rootserver=10.0.1.1,
> rootpath=/srv/nfs4/arch,tcp,v3
> [    4.280000]      nameserver0=192.168.20.1
> [    4.290000] ALSA device list:
> [    4.290000]   No soundcards found.
> [    4.320000] VFS: Mounted root (nfs filesystem) on device 0:15.
> [    4.320000] devtmpfs: mounted
> [    4.330000] Freeing unused kernel image (initmem) memory: 1024K
> [    4.390000] Run /sbin/init as init process
> [    4.390000]   with arguments:
> [    4.390000]     /sbin/init
> [    4.400000]   with environment:
> [    4.400000]     HOME=/
> [    4.400000]     TERM=linux
> [    6.040000] systemd[1]: System time before build time, advancing clock.
> [    6.100000] systemd[1]: Failed to find module 'autofs4'
> [    6.220000] systemd[1]: systemd 252.5-1-arch running in system mode (+PAM
> +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL
> +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP
> +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB
> +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
> [    6.240000] systemd[1]: Detected architecture arm.
> [    6.290000] systemd[1]: Hostname set to <arm>.
> [    6.520000] systemd[1]: bpf-lsm: BPF LSM hook not enabled in the kernel,
> BPF LSM not supported
> [    8.710000] systemd[1]: Queued start job for default target Graphical
> Interface.
> [    8.730000] systemd[1]: Created slice Slice /system/getty.
> [    8.770000] systemd[1]: Created slice Slice /system/modprobe.
> [    8.810000] systemd[1]: Created slice Slice /system/serial-getty.
> [    8.850000] systemd[1]: Created slice User and Session Slice.
> [    8.890000] systemd[1]: Started Dispatch Password Requests to Console
> Directory Watch.
> [    8.930000] systemd[1]: Started Forward Password Requests to Wall
> Directory Watch.
> [    8.970000] systemd[1]: Arbitrary Executable File Formats File System
> Automount Point was skipped because of an unmet condition check
> (ConditionPathExists=/proc/sys/fs/binfmt_misc).
> [    8.980000] systemd[1]: Reached target Local Encrypted Volumes.
> [    9.020000] systemd[1]: Reached target Local Integrity Protected Volumes.
> [    9.060000] systemd[1]: Reached target Network is Online.
> [    9.100000] systemd[1]: Reached target Path Units.
> [    9.130000] systemd[1]: Reached target Slice Units.
> [    9.170000] systemd[1]: Reached target Swaps.
> [    9.200000] systemd[1]: Reached target Local Verity Protected Volumes.
> [    9.240000] systemd[1]: Listening on Device-mapper event daemon FIFOs.
> [    9.300000] systemd[1]: Listening on Process Core Dump Socket.
> [    9.340000] systemd[1]: Journal Audit Socket was skipped because of an
> unmet condition check (ConditionSecurity=audit).
> [    9.350000] systemd[1]: Listening on Journal Socket (/dev/log).
> [    9.390000] systemd[1]: Listening on Journal Socket.
> [    9.430000] systemd[1]: Listening on udev Control Socket.
> [    9.470000] systemd[1]: Listening on udev Kernel Socket.
> [    9.510000] systemd[1]: Huge Pages File System was skipped because of an
> unmet condition check (ConditionPathExists=/sys/kernel/mm/hugepages).
> [    9.520000] systemd[1]: POSIX Message Queue File System was skipped
> because of an unmet condition check
> (ConditionPathExists=/proc/sys/fs/mqueue).
> [    9.590000] systemd[1]: Mounting /root/shared...
> [    9.620000] systemd[1]: Mounting Kernel Debug File System...
> [    9.680000] systemd[1]: Mounting Kernel Trace File System...
> [    9.780000] systemd[1]: Mounting Temporary Directory /tmp...
> [    9.820000] systemd[1]: Create List of Static Device Nodes was skipped
> because of an unmet condition check
> (ConditionFileNotEmpty=/lib/modules/6.1.0/modules.devname).
> [    9.850000] systemd[1]: Starting Load Kernel Module configfs...
> [    9.960000] systemd[1]: Starting Load Kernel Module drm...
> [   10.010000] systemd[1]: Starting Load Kernel Module fuse...
> [   10.070000] systemd[1]: Load Kernel Modules was skipped because no
> trigger condition checks were met.
> [   10.120000] systemd[1]: Starting Remount Root and Kernel File Systems...
> [   10.190000] systemd[1]: Repartition Root Disk was skipped because no
> trigger condition checks were met.
> [   10.250000] systemd[1]: Starting Apply Kernel Variables...
> [   10.310000] systemd[1]: Starting Coldplug All udev Devices...
> [   10.390000] systemd[1]: Mounted Kernel Debug File System.
> [   10.410000] systemd[1]: Mounted Kernel Trace File System.
> [   10.450000] systemd[1]: Mounted Temporary Directory /tmp.
> [   10.490000] systemd[1]: modprobe@configfs.service: Deactivated
> successfully.
> [   10.520000] systemd[1]: Finished Load Kernel Module configfs.
> [   10.550000] systemd[1]: modprobe@drm.service: Deactivated successfully.
> [   10.550000] systemd[1]: Finished Load Kernel Module drm.
> [   10.600000] systemd[1]: modprobe@fuse.service: Deactivated successfully.
> [   10.610000] systemd[1]: Finished Load Kernel Module fuse.
> [   10.650000] systemd[1]: Finished Remount Root and Kernel File Systems.
> [   10.670000] systemd[1]: Finished Apply Kernel Variables.
> [   10.890000] systemd[1]: Reached target Host and Network Name Lookups.
> [   10.940000] systemd[1]: Listening on RPCbind Server Activation Socket.
> [   10.990000] systemd[1]: Reached target RPC Port Mapper.
> [   11.030000] systemd[1]: FUSE Control File System was skipped because of
> an unmet condition check (ConditionPathExists=/sys/fs/fuse/connections).
> [   11.090000] systemd[1]: Mounting Kernel Configuration File System...
> [   11.130000] systemd[1]: Starting NFS status monitor for NFSv2/3
> locking....
> [   11.180000] systemd[1]: First Boot Wizard was skipped because of an unmet
> condition check (ConditionFirstBoot=yes).
> [   11.210000] systemd[1]: Rebuild Hardware Database was skipped because of
> an unmet condition check (ConditionNeedsUpdate=/etc).
> [   11.290000] systemd[1]: Starting Load/Save Random Seed...
> [   11.330000] systemd[1]: Create System Users was skipped because no
> trigger condition checks were met.
> [   11.380000] systemd[1]: Starting Create Static Device Nodes in /dev...
> [   11.500000] systemd[1]: Finished Coldplug All udev Devices.
> [   11.540000] systemd[1]: Mounted Kernel Configuration File System.
> [   11.620000] systemd[1]: Starting RPC Bind...
> [   12.160000] systemd[1]: Finished Create Static Device Nodes in /dev.
> [   12.200000] systemd[1]: Started RPC Bind.
> [   12.240000] systemd[1]: Reached target Preparation for Local File
> Systems.
> [   12.290000] systemd[1]: Virtual Machine and Container Storage
> (Compatibility) was skipped because of an unmet condition check
> (ConditionPathExists=/var/lib/machines.raw).
> [   12.310000] systemd[1]: Reached target Local File Systems.
> [   12.350000] systemd[1]: Entropy Daemon based on the HAVEGE algorithm was
> skipped because of an unmet condition check (ConditionKernelVersion=<5.6).
> [   12.360000] systemd[1]: Rebuild Dynamic Linker Cache was skipped because
> no trigger condition checks were met.
> [   12.420000] systemd[1]: Starting Notify NFS peers of a restart...
> [   12.460000] systemd[1]: Set Up Additional Binary Formats was skipped
> because no trigger condition checks were met.
> [   12.480000] systemd[1]: systemd-journald.service: unit configures an IP
> firewall, but the local system does not support BPF/cgroup firewalling.
> [   12.490000] systemd[1]: (This warning is only shown for the first unit
> using IP firewalling.)
> [   12.570000] systemd[1]: Starting Journal Service...
> [   12.620000] systemd[1]: Starting Rule-based Manager for Device Events and
> Files...
> [   12.700000] systemd[1]: Started NFS status monitor for NFSv2/3 locking..
> [   12.740000] systemd[1]: Started Notify NFS peers of a restart.
> [   12.990000] systemd[1]: Started Journal Service.
> [   16.860000] systemd-journald[87]: Received client request to flush
> runtime journal.
> [   21.360000] random: dbus-daemon: uninitialized urandom read (12 bytes
> read)
> [   22.190000] random: dbus-daemon: uninitialized urandom read (12 bytes
> read)
> [   39.150000] random: crng init done
> 
> --
> Kind Regards,
> Niklas Söderlund

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 10:06                 ` Biju Das
@ 2023-02-13 10:29                   ` Niklas Söderlund
  2023-02-13 13:01                     ` Biju Das
  0 siblings, 1 reply; 35+ messages in thread
From: Niklas Söderlund @ 2023-02-13 10:29 UTC (permalink / raw)
  To: Biju Das
  Cc: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Greg Kroah-Hartman, linux-serial, Fabrizio Castro,
	linux-renesas-soc

Hi Biju,

On 2023-02-13 10:06:04 +0000, Biju Das wrote:
> Hi Niklas,
> 
> Thanks for testing.
> 
> > -----Original Message-----
> > From: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > Sent: Monday, February 13, 2023 9:58 AM
> > To: Biju Das <biju.das.jz@bp.renesas.com>
> > Cc: Jiri Slaby <jirislaby@kernel.org>; Ilpo Järvinen
> > <ilpo.jarvinen@linux.intel.com>; Geert Uytterhoeven
> > <geert+renesas@glider.be>; Magnus Damm <magnus.damm@gmail.com>; Greg Kroah-
> > Hartman <gregkh@linuxfoundation.org>; linux-serial <linux-
> > serial@vger.kernel.org>; Fabrizio Castro <fabrizio.castro.jz@renesas.com>;
> > linux-renesas-soc@vger.kernel.org
> > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> > serial8250_em_hw_info
> > 
> > Hi Biju,
> > 
> > On 2023-02-13 09:31:27 +0000, Biju Das wrote:
> > > Adding Magnus and Niklas to test on EMMA mobile platform to check the
> > > port type detected On that platform?
> > 
> > I don't know what you want me to check, I don't know much about serial. I
> > wired up the platform during the weekend, here is a boot log running on
> > v6.1. If you want to to check / test something I'm happy to, but will need
> > instructions.
> 
> As per Geert the register layout is same as RZ/V2M,
> So The UART is register compatible with standard 16750 chip.
> 
> But below log shows that it is 16550A and using only 16-bytes fifo,
> Eventhough it has 64-bytes fifo.
> 
> [    1.020000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37, base_baud = 796444) is a 16550A
> [    1.020000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38, base_baud = 7168000) is a 16550A
> [    1.690000] printk: console [ttyS1] enabled
> [    1.700000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39, base_baud = 14336000) is a 16550A
> [    1.710000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40, base_baud = 2389333) is a 16550A
> 
> So if you apply, this patch series, and add below changes it should detect as 16750
> 
> https://lore.kernel.org/linux-renesas-soc/8585f736-cf3b-b63c-753f-892d4051ada3@linux.intel.com/T/#mce8d222e3670321e8a8e39faacc4d6dd061fdbd6
> 
> and for quick testing please do below change for emma mobile.
> 
> + { .compatible = "renesas,em-uart", .data = &rzv2m_uart_hw_info },


Could you provide a branch with the setup you like me to test?

> 
> Cheers,
> Biju
> 
> 
> 
> > 
> > [    0.000000] Booting Linux on physical CPU 0x0
> > [    0.000000] Linux version 6.1.0 (neg@sleipner) (arm-linux-gnueabihf-gcc
> > (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #1 SMP Sun Feb 12 18:44:55 CET
> > 2023
> > [    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7),
> > cr=10c5387d
> > [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
> > instruction cache
> > [    0.000000] OF: fdt: Machine model: EMEV2 KZM9D Board
> > [    0.000000] printk: debug: ignoring loglevel setting.
> > [    0.000000] Memory policy: Data cache writealloc
> > [    0.000000] cma: Failed to reserve 128 MiB
> > [    0.000000] Zone ranges:
> > [    0.000000]   Normal   [mem 0x0000000040000000-0x0000000047ffffff]
> > [    0.000000]   HighMem  empty
> > [    0.000000] Movable zone start for each node
> > [    0.000000] Early memory node ranges
> > [    0.000000]   node   0: [mem 0x0000000040000000-0x0000000047ffffff]
> > [    0.000000] Initmem setup node 0 [mem 0x0000000040000000-
> > 0x0000000047ffffff]
> > [    0.000000] percpu: Embedded 13 pages/cpu s32468 r0 d20780 u53248
> > [    0.000000] pcpu-alloc: s32468 r0 d20780 u53248 alloc=13*4096
> > [    0.000000] pcpu-alloc: [0] 0 [0] 1
> > [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
> > [    0.000000] Kernel command line: ignore_loglevel rw root=/dev/nfs ip=on
> > [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536
> > bytes, linear)
> > [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes,
> > linear)
> > [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> > [    0.000000] Memory: 116072K/131072K available (8192K kernel code, 1152K
> > rwdata, 2436K rodata, 1024K init, 259K bss, 15000K reserved, 0K cma-
> > reserved, 0K highmem)
> > [    0.000000] trace event string verifier disabled
> > [    0.000000] rcu: Hierarchical RCU implementation.
> > [    0.000000] rcu: 	RCU event tracing is enabled.
> > [    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to
> > nr_cpu_ids=2.
> > [    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10
> > jiffies.
> > [    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
> > [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
> > [    0.000000] GIC: enabling workaround for broken byte access
> > [    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on
> > contention.
> > [    0.000000] timer_probe: no matching timers found
> > [    0.000000] Console: colour dummy device 80x30
> > [    0.000000] printk: console [tty0] enabled
> > [    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps
> > every 21474836475000000ns
> > [    0.000000] Calibrating delay loop (skipped) preset value.. 1066.00
> > BogoMIPS (lpj=5330000)
> > [    0.000000] pid_max: default: 32768 minimum: 301
> > [    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes,
> > linear)
> > [    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
> > bytes, linear)
> > [    0.000000] CPU: Testing write buffer coherency: ok
> > [    0.000000] CPU0: Spectre v2: using BPIALL workaround
> > [    0.000000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
> > [    0.000000] Setting up static identity map for 0x40100000 - 0x40100060
> > [    0.000000] rcu: Hierarchical SRCU implementation.
> > [    0.000000] rcu: 	Max phase no-delay instances is 1000.
> > [    0.000000] smp: Bringing up secondary CPUs ...
> > [    0.000000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
> > [    0.000000] CPU1: Spectre v2: using BPIALL workaround
> > [    0.000000] smp: Brought up 1 node, 2 CPUs
> > [    0.000000] SMP: Total of 2 processors activated (2132.00 BogoMIPS).
> > [    0.000000] CPU: All CPU(s) started in SVC mode.
> > [    0.000000] devtmpfs: initialized
> > [    0.000000] VFP support v0.3: implementor 41 architecture 3 part 30
> > variant 9 rev 1
> > [    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles:
> > 0xffffffff, max_idle_ns: 19112604462750000 ns
> > [    0.000000] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
> > [    0.000000] pinctrl core: initialized pinctrl subsystem
> > [    0.000000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
> > [    0.000000] DMA: preallocated 256 KiB pool for atomic coherent
> > allocations
> > [    0.000000] thermal_sys: Registered thermal governor 'step_wise'
> > [    0.000000] No ATAGs?
> > [    0.000000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1
> > watchpoint registers.
> > [    0.000000] hw-breakpoint: maximum watchpoint size is 4 bytes.
> > [    0.000000] sh-pfc e0140200.pinctrl: emev2_pfc support registered
> > [    0.000000] SCSI subsystem initialized
> > [    0.000000] libata version 3.00 loaded.
> > [    0.000000] usbcore: registered new interface driver usbfs
> > [    0.000000] usbcore: registered new interface driver hub
> > [    0.000000] usbcore: registered new device driver usb
> > [    0.000000] mc: Linux media interface: v0.10
> > [    0.000000] videodev: Linux video capture interface: v2.00
> > [    0.000000] pps_core: LinuxPPS API ver. 1 registered
> > [    0.000000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
> > Giometti <giometti@linux.it>
> > [    0.000000] PTP clock support registered
> > [    0.000000] em_sti e0180000.timer: used for clock events
> > [    0.000000] em_sti e0180000.timer: used for oneshot clock events
> > [    0.000000] em_sti e0180000.timer: used as clock source
> > [    0.000000] clocksource: e0180000.timer: mask: 0xffffffffffff max_cycles:
> > 0x1ef4687b1, max_idle_ns: 112843571739654 ns
> > [    0.000000] Advanced Linux Sound Architecture Driver Initialized.
> > [    0.000000] vgaarb: loaded
> > [    0.940000] clocksource: Switched to clocksource e0180000.timer
> > [    0.950000] Clockevents: could not switch to one-shot mode:
> > [    0.950000] Clockevents: could not switch to one-shot mode: dummy_timer
> > is not functional.
> > [    0.950000]  dummy_timer is not functional.
> > [    0.960000] NET: Registered PF_INET protocol family
> > [    0.960000] IP idents hash table entries: 2048 (order: 2, 16384 bytes,
> > linear)
> > [    0.960000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0,
> > 4096 bytes, linear)
> > [    0.960000] Table-perturb hash table entries: 65536 (order: 6, 262144
> > bytes, linear)
> > [    0.960000] TCP established hash table entries: 1024 (order: 0, 4096
> > bytes, linear)
> > [    0.960000] TCP bind hash table entries: 1024 (order: 2, 16384 bytes,
> > linear)
> > [    0.960000] TCP: Hash tables configured (established 1024 bind 1024)
> > [    0.960000] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
> > [    0.960000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes,
> > linear)
> > [    0.960000] NET: Registered PF_UNIX/PF_LOCAL protocol family
> > [    0.960000] RPC: Registered named UNIX socket transport module.
> > [    0.960000] RPC: Registered udp transport module.
> > [    0.960000] RPC: Registered tcp transport module.
> > [    0.960000] RPC: Registered tcp NFSv4.1 backchannel transport module.
> > [    0.960000] PCI: CLS 0 bytes, default 64
> > [    1.000000] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7
> > counters available
> > [    1.000000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
> > [    1.000000] NFS: Registering the id_resolver key type
> > [    1.000000] Key type id_resolver registered
> > [    1.000000] Key type id_legacy registered
> > [    1.000000] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
> > [    1.000000] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver
> > Registering...
> > [    1.000000] Block layer SCSI generic (bsg) driver version 0.4 loaded
> > (major 246)
> > [    1.000000] io scheduler mq-deadline registered
> > [    1.000000] io scheduler kyber registered
> > [    1.010000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> > [    1.020000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37,
> > base_baud = 796444) is a 16550A
> > [    1.020000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38,
> > base_baud = 7168000) is a 16550A
> > [    1.690000] printk: console [ttyS1] enabled
> > [    1.700000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39,
> > base_baud = 14336000) is a 16550A
> > [    1.710000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40,
> > base_baud = 2389333) is a 16550A
> > [    1.720000] SuperH (H)SCI(F) driver initialized
> > [    1.730000] CAN device driver interface
> > [    1.800000] smsc911x 20000000.ethernet eth0: MAC Address:
> > 00:0a:a3:02:12:92
> > [    1.810000] UDC core: g_ether: couldn't find an available UDC
> > [    1.810000] i2c_dev: i2c /dev entries driver
> > [    1.820000] em-i2c e0070000.i2c: Added i2c controller 0, irq 42
> > [    1.830000] em-i2c e10a0000.i2c: Added i2c controller 1, irq 43
> > [    1.830000] cpu cpu0: OPP table can't be empty
> > [    1.840000] usbcore: registered new interface driver usbhid
> > [    1.850000] usbhid: USB HID core driver
> > [    1.850000] NET: Registered PF_INET6 protocol family
> > [    1.860000] Segment Routing with IPv6
> > [    1.870000] In-situ OAM (IOAM) with IPv6
> > [    1.870000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
> > [    1.880000] NET: Registered PF_PACKET protocol family
> > [    1.880000] can: controller area network core
> > [    1.890000] NET: Registered PF_CAN protocol family
> > [    1.890000] can: raw protocol
> > [    1.900000] can: broadcast manager protocol
> > [    1.900000] can: netlink gateway - max_hops=1
> > [    1.900000] Key type dns_resolver registered
> > [    1.910000] Registering SWP/SWPB emulation handler
> > [    1.920000] input: gpio_keys as /devices/platform/gpio_keys/input/input0
> > [    1.980000] SMSC LAN8700 20000000.ethernet-ffffffff:01: attached PHY
> > driver (mii_bus:phy_addr=20000000.ethernet-ffffffff:01, irq=POLL)
> > [    2.020000] smsc911x 20000000.ethernet eth0: SMSC911x/921x identified at
> > 0xc8920000, IRQ: 41
> > [    4.160000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> > [    4.210000] Sending DHCP requests ., OK
> > [    4.250000] IP-Config: Got DHCP answer from 10.0.1.1, my address is
> > 10.0.1.2
> > [    4.260000] IP-Config: Complete:
> > [    4.260000]      device=eth0, hwaddr=00:0a:a3:02:12:92, ipaddr=10.0.1.2,
> > mask=255.255.255.0, gw=10.0.1.1
> > [    4.270000]      host=10.0.1.2, domain=dyn.berto.se, nis-domain=(none)
> > [    4.280000]      bootserver=10.0.1.1, rootserver=10.0.1.1,
> > rootpath=/srv/nfs4/arch,tcp,v3
> > [    4.280000]      nameserver0=192.168.20.1
> > [    4.290000] ALSA device list:
> > [    4.290000]   No soundcards found.
> > [    4.320000] VFS: Mounted root (nfs filesystem) on device 0:15.
> > [    4.320000] devtmpfs: mounted
> > [    4.330000] Freeing unused kernel image (initmem) memory: 1024K
> > [    4.390000] Run /sbin/init as init process
> > [    4.390000]   with arguments:
> > [    4.390000]     /sbin/init
> > [    4.400000]   with environment:
> > [    4.400000]     HOME=/
> > [    4.400000]     TERM=linux
> > [    6.040000] systemd[1]: System time before build time, advancing clock.
> > [    6.100000] systemd[1]: Failed to find module 'autofs4'
> > [    6.220000] systemd[1]: systemd 252.5-1-arch running in system mode (+PAM
> > +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL
> > +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP
> > +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB
> > +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
> > [    6.240000] systemd[1]: Detected architecture arm.
> > [    6.290000] systemd[1]: Hostname set to <arm>.
> > [    6.520000] systemd[1]: bpf-lsm: BPF LSM hook not enabled in the kernel,
> > BPF LSM not supported
> > [    8.710000] systemd[1]: Queued start job for default target Graphical
> > Interface.
> > [    8.730000] systemd[1]: Created slice Slice /system/getty.
> > [    8.770000] systemd[1]: Created slice Slice /system/modprobe.
> > [    8.810000] systemd[1]: Created slice Slice /system/serial-getty.
> > [    8.850000] systemd[1]: Created slice User and Session Slice.
> > [    8.890000] systemd[1]: Started Dispatch Password Requests to Console
> > Directory Watch.
> > [    8.930000] systemd[1]: Started Forward Password Requests to Wall
> > Directory Watch.
> > [    8.970000] systemd[1]: Arbitrary Executable File Formats File System
> > Automount Point was skipped because of an unmet condition check
> > (ConditionPathExists=/proc/sys/fs/binfmt_misc).
> > [    8.980000] systemd[1]: Reached target Local Encrypted Volumes.
> > [    9.020000] systemd[1]: Reached target Local Integrity Protected Volumes.
> > [    9.060000] systemd[1]: Reached target Network is Online.
> > [    9.100000] systemd[1]: Reached target Path Units.
> > [    9.130000] systemd[1]: Reached target Slice Units.
> > [    9.170000] systemd[1]: Reached target Swaps.
> > [    9.200000] systemd[1]: Reached target Local Verity Protected Volumes.
> > [    9.240000] systemd[1]: Listening on Device-mapper event daemon FIFOs.
> > [    9.300000] systemd[1]: Listening on Process Core Dump Socket.
> > [    9.340000] systemd[1]: Journal Audit Socket was skipped because of an
> > unmet condition check (ConditionSecurity=audit).
> > [    9.350000] systemd[1]: Listening on Journal Socket (/dev/log).
> > [    9.390000] systemd[1]: Listening on Journal Socket.
> > [    9.430000] systemd[1]: Listening on udev Control Socket.
> > [    9.470000] systemd[1]: Listening on udev Kernel Socket.
> > [    9.510000] systemd[1]: Huge Pages File System was skipped because of an
> > unmet condition check (ConditionPathExists=/sys/kernel/mm/hugepages).
> > [    9.520000] systemd[1]: POSIX Message Queue File System was skipped
> > because of an unmet condition check
> > (ConditionPathExists=/proc/sys/fs/mqueue).
> > [    9.590000] systemd[1]: Mounting /root/shared...
> > [    9.620000] systemd[1]: Mounting Kernel Debug File System...
> > [    9.680000] systemd[1]: Mounting Kernel Trace File System...
> > [    9.780000] systemd[1]: Mounting Temporary Directory /tmp...
> > [    9.820000] systemd[1]: Create List of Static Device Nodes was skipped
> > because of an unmet condition check
> > (ConditionFileNotEmpty=/lib/modules/6.1.0/modules.devname).
> > [    9.850000] systemd[1]: Starting Load Kernel Module configfs...
> > [    9.960000] systemd[1]: Starting Load Kernel Module drm...
> > [   10.010000] systemd[1]: Starting Load Kernel Module fuse...
> > [   10.070000] systemd[1]: Load Kernel Modules was skipped because no
> > trigger condition checks were met.
> > [   10.120000] systemd[1]: Starting Remount Root and Kernel File Systems...
> > [   10.190000] systemd[1]: Repartition Root Disk was skipped because no
> > trigger condition checks were met.
> > [   10.250000] systemd[1]: Starting Apply Kernel Variables...
> > [   10.310000] systemd[1]: Starting Coldplug All udev Devices...
> > [   10.390000] systemd[1]: Mounted Kernel Debug File System.
> > [   10.410000] systemd[1]: Mounted Kernel Trace File System.
> > [   10.450000] systemd[1]: Mounted Temporary Directory /tmp.
> > [   10.490000] systemd[1]: modprobe@configfs.service: Deactivated
> > successfully.
> > [   10.520000] systemd[1]: Finished Load Kernel Module configfs.
> > [   10.550000] systemd[1]: modprobe@drm.service: Deactivated successfully.
> > [   10.550000] systemd[1]: Finished Load Kernel Module drm.
> > [   10.600000] systemd[1]: modprobe@fuse.service: Deactivated successfully.
> > [   10.610000] systemd[1]: Finished Load Kernel Module fuse.
> > [   10.650000] systemd[1]: Finished Remount Root and Kernel File Systems.
> > [   10.670000] systemd[1]: Finished Apply Kernel Variables.
> > [   10.890000] systemd[1]: Reached target Host and Network Name Lookups.
> > [   10.940000] systemd[1]: Listening on RPCbind Server Activation Socket.
> > [   10.990000] systemd[1]: Reached target RPC Port Mapper.
> > [   11.030000] systemd[1]: FUSE Control File System was skipped because of
> > an unmet condition check (ConditionPathExists=/sys/fs/fuse/connections).
> > [   11.090000] systemd[1]: Mounting Kernel Configuration File System...
> > [   11.130000] systemd[1]: Starting NFS status monitor for NFSv2/3
> > locking....
> > [   11.180000] systemd[1]: First Boot Wizard was skipped because of an unmet
> > condition check (ConditionFirstBoot=yes).
> > [   11.210000] systemd[1]: Rebuild Hardware Database was skipped because of
> > an unmet condition check (ConditionNeedsUpdate=/etc).
> > [   11.290000] systemd[1]: Starting Load/Save Random Seed...
> > [   11.330000] systemd[1]: Create System Users was skipped because no
> > trigger condition checks were met.
> > [   11.380000] systemd[1]: Starting Create Static Device Nodes in /dev...
> > [   11.500000] systemd[1]: Finished Coldplug All udev Devices.
> > [   11.540000] systemd[1]: Mounted Kernel Configuration File System.
> > [   11.620000] systemd[1]: Starting RPC Bind...
> > [   12.160000] systemd[1]: Finished Create Static Device Nodes in /dev.
> > [   12.200000] systemd[1]: Started RPC Bind.
> > [   12.240000] systemd[1]: Reached target Preparation for Local File
> > Systems.
> > [   12.290000] systemd[1]: Virtual Machine and Container Storage
> > (Compatibility) was skipped because of an unmet condition check
> > (ConditionPathExists=/var/lib/machines.raw).
> > [   12.310000] systemd[1]: Reached target Local File Systems.
> > [   12.350000] systemd[1]: Entropy Daemon based on the HAVEGE algorithm was
> > skipped because of an unmet condition check (ConditionKernelVersion=<5.6).
> > [   12.360000] systemd[1]: Rebuild Dynamic Linker Cache was skipped because
> > no trigger condition checks were met.
> > [   12.420000] systemd[1]: Starting Notify NFS peers of a restart...
> > [   12.460000] systemd[1]: Set Up Additional Binary Formats was skipped
> > because no trigger condition checks were met.
> > [   12.480000] systemd[1]: systemd-journald.service: unit configures an IP
> > firewall, but the local system does not support BPF/cgroup firewalling.
> > [   12.490000] systemd[1]: (This warning is only shown for the first unit
> > using IP firewalling.)
> > [   12.570000] systemd[1]: Starting Journal Service...
> > [   12.620000] systemd[1]: Starting Rule-based Manager for Device Events and
> > Files...
> > [   12.700000] systemd[1]: Started NFS status monitor for NFSv2/3 locking..
> > [   12.740000] systemd[1]: Started Notify NFS peers of a restart.
> > [   12.990000] systemd[1]: Started Journal Service.
> > [   16.860000] systemd-journald[87]: Received client request to flush
> > runtime journal.
> > [   21.360000] random: dbus-daemon: uninitialized urandom read (12 bytes
> > read)
> > [   22.190000] random: dbus-daemon: uninitialized urandom read (12 bytes
> > read)
> > [   39.150000] random: crng init done
> > 
> > --
> > Kind Regards,
> > Niklas Söderlund

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13  9:32               ` Jiri Slaby
@ 2023-02-13 11:12                 ` Biju Das
  2023-02-13 11:31                   ` Ilpo Järvinen
  0 siblings, 1 reply; 35+ messages in thread
From: Biju Das @ 2023-02-13 11:12 UTC (permalink / raw)
  To: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Niklas Söderlund
  Cc: Greg Kroah-Hartman, linux-serial, Fabrizio Castro, linux-renesas-soc

Hi Jiri Slaby,

Thanks for the feedback.

> Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> On 13. 02. 23, 10:31, Biju Das wrote:
> > So looks like similar to other macros, UART_FCR_EM (0x3) is sensible one.
> >
> > UART_FCR_RO_OFFSET (9)
> > UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)
> >
> >
> > static unsigned int serial8250_em_serial_in(struct uart_port *p, int
> > offset) case UART_FCR_RO_EM:
> > 	return readl(p->membase + (offset - UART_FCR_RO_OFFSET << 2));
> 
> 
> Please send a complete patch as a reply. I am completely lost now.

Please find the complete patc.


From e597ae60eb170c1f1b650e1e533bf4e12c09f822 Mon Sep 17 00:00:00 2001
From: Biju Das <biju.das.jz@bp.renesas.com>
Date: Tue, 7 Feb 2023 15:07:13 +0000
Subject: [PATCH] serial: 8250_em: Add serial_out() to struct
 serial8250_em_hw_info

As per RZ/V2M hardware manual(Rev.1.30 Jun, 2022), UART IP has a
restriction as mentioned below.

40.6.1 Point for Caution when Changing the Register Settings:

When changing the settings of the following registers, a PRESETn master
reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7]) must be input to
re-initialize them.

Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.

This patch adds serial_out() to struct serial8250_em_hw_info to
handle this difference between emma mobile and rz/v2m.

DLL/DLM register can be updated only by setting LCR[7]. So the
updation of LCR[7] will perform reset for DLL/DLM register changes.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/tty/serial/8250/8250_em.c | 70 ++++++++++++++++++++++++++++++-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index 69cd3b611501..c1c64f48ee7e 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -17,12 +17,23 @@
 
 #include "8250.h"
 
+#define UART_FCR_EM 3
 #define UART_DLL_EM 9
 #define UART_DLM_EM 10
+#define UART_HCR0_EM 11
+
+/*
+ * Add UART_FCR_R_EM(14) to avoid overlapping with existing register defines
+ * for reading the FCR value.
+ */
+#define UART_FCR_R_EM	(UART_FCR_EM + UART_HCR0_EM)
+
+#define UART_HCR0_EM_SW_RESET	BIT(7) /* SW Reset */
 
 struct serial8250_em_hw_info {
 	unsigned int type;
 	upf_t flags;
+	void (*serial_out)(struct uart_port *p, int off, int value);
 };
 
 struct serial8250_em_priv {
@@ -46,6 +57,7 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
 		fallthrough;
 	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
 	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
+	case UART_HCR0_EM: /* HCR0 @ 0x2c */
 		writel(value, p->membase + (offset << 2));
 	}
 }
@@ -55,20 +67,74 @@ static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
 	switch (offset) {
 	case UART_RX: /* RX @ 0x00 */
 		return readb(p->membase);
+	case UART_LCR: /* LCR @ 0x10 (+1) */
 	case UART_MCR: /* MCR @ 0x14 (+1) */
 	case UART_LSR: /* LSR @ 0x18 (+1) */
 	case UART_MSR: /* MSR @ 0x1c (+1) */
 	case UART_SCR: /* SCR @ 0x20 (+1) */
 		return readl(p->membase + ((offset + 1) << 2));
+	case UART_FCR_R_EM:
+		return readl(p->membase + (UART_FCR_EM << 2));
 	case UART_IER: /* IER @ 0x04 */
 	case UART_IIR: /* IIR @ 0x08 */
 	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
 	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
+	case UART_HCR0_EM: /* HCR0 @ 0x2c */
 		return readl(p->membase + (offset << 2));
 	}
 	return 0;
 }
 
+static void serial8250_rzv2m_reg_update(struct uart_port *p, int off, int value)
+{
+	unsigned int ier, fcr, lcr, mcr, hcr0;
+
+	ier = serial8250_em_serial_in(p, UART_IER);
+	fcr = serial8250_em_serial_in(p, UART_FCR_R_EM);
+	lcr = serial8250_em_serial_in(p, UART_LCR);
+	mcr = serial8250_em_serial_in(p, UART_MCR);
+	hcr0 = serial8250_em_serial_in(p, UART_HCR0_EM);
+
+	serial8250_em_serial_out(p, UART_FCR, fcr | UART_FCR_CLEAR_RCVR |
+				 UART_FCR_CLEAR_XMIT);
+	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0 | UART_HCR0_EM_SW_RESET);
+	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0 & ~UART_HCR0_EM_SW_RESET);
+
+	switch (off) {
+	case UART_FCR:
+		fcr = value;
+		break;
+	case UART_LCR:
+		lcr = value;
+		break;
+	case UART_MCR:
+		mcr = value;
+	}
+
+	serial8250_em_serial_out(p, UART_IER, ier);
+	serial8250_em_serial_out(p, UART_FCR, fcr);
+	serial8250_em_serial_out(p, UART_MCR, mcr);
+	serial8250_em_serial_out(p, UART_LCR, lcr);
+	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0);
+}
+
+static void serial8250_em_rzv2m_serial_out(struct uart_port *p, int offset, int value)
+{
+	switch (offset) {
+	case UART_TX:
+	case UART_SCR:
+	case UART_IER:
+	case UART_DLL_EM:
+	case UART_DLM_EM:
+		serial8250_em_serial_out(p, offset, value);
+		break;
+	case UART_FCR:
+	case UART_LCR:
+	case UART_MCR:
+		serial8250_rzv2m_reg_update(p, offset, value);
+	}
+}
+
 static int serial8250_em_serial_dl_read(struct uart_8250_port *up)
 {
 	return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
@@ -120,7 +186,7 @@ static int serial8250_em_probe(struct platform_device *pdev)
 
 	up.port.iotype = UPIO_MEM32;
 	up.port.serial_in = serial8250_em_serial_in;
-	up.port.serial_out = serial8250_em_serial_out;
+	up.port.serial_out = info->serial_out;
 	up.dl_read = serial8250_em_serial_dl_read;
 	up.dl_write = serial8250_em_serial_dl_write;
 
@@ -144,11 +210,13 @@ static int serial8250_em_remove(struct platform_device *pdev)
 static const struct serial8250_em_hw_info emma_mobile_uart_hw_info = {
 	.type = PORT_UNKNOWN,
 	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
+	.serial_out = serial8250_em_serial_out,
 };
 
 static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
 	.type = PORT_16750,
 	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP | UPF_FIXED_TYPE,
+	.serial_out = serial8250_em_rzv2m_serial_out,
 };
 
 static const struct of_device_id serial8250_em_dt_ids[] = {
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 11:12                 ` Biju Das
@ 2023-02-13 11:31                   ` Ilpo Järvinen
  2023-02-13 11:40                     ` Biju Das
  0 siblings, 1 reply; 35+ messages in thread
From: Ilpo Järvinen @ 2023-02-13 11:31 UTC (permalink / raw)
  To: Biju Das
  Cc: Jiri Slaby, Geert Uytterhoeven, Magnus Damm,
	Niklas Söderlund, Greg Kroah-Hartman, linux-serial,
	Fabrizio Castro, linux-renesas-soc

On Mon, 13 Feb 2023, Biju Das wrote:

> Hi Jiri Slaby,
> 
> Thanks for the feedback.
> 
> > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> > serial8250_em_hw_info
> > 
> > On 13. 02. 23, 10:31, Biju Das wrote:
> > > So looks like similar to other macros, UART_FCR_EM (0x3) is sensible one.
> > >
> > > UART_FCR_RO_OFFSET (9)
> > > UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)
> > >
> > >
> > > static unsigned int serial8250_em_serial_in(struct uart_port *p, int
> > > offset) case UART_FCR_RO_EM:
> > > 	return readl(p->membase + (offset - UART_FCR_RO_OFFSET << 2));
> > 
> > 
> > Please send a complete patch as a reply. I am completely lost now.
> 
> Please find the complete patc.
> 
> 
> From e597ae60eb170c1f1b650e1e533bf4e12c09f822 Mon Sep 17 00:00:00 2001
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Date: Tue, 7 Feb 2023 15:07:13 +0000
> Subject: [PATCH] serial: 8250_em: Add serial_out() to struct
>  serial8250_em_hw_info
> 
> As per RZ/V2M hardware manual(Rev.1.30 Jun, 2022), UART IP has a
> restriction as mentioned below.
> 
> 40.6.1 Point for Caution when Changing the Register Settings:
> 
> When changing the settings of the following registers, a PRESETn master
> reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7]) must be input to
> re-initialize them.
> 
> Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.
> 
> This patch adds serial_out() to struct serial8250_em_hw_info to
> handle this difference between emma mobile and rz/v2m.
> 
> DLL/DLM register can be updated only by setting LCR[7]. So the
> updation of LCR[7] will perform reset for DLL/DLM register changes.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/tty/serial/8250/8250_em.c | 70 ++++++++++++++++++++++++++++++-
>  1 file changed, 69 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
> index 69cd3b611501..c1c64f48ee7e 100644
> --- a/drivers/tty/serial/8250/8250_em.c
> +++ b/drivers/tty/serial/8250/8250_em.c
> @@ -17,12 +17,23 @@
>  
>  #include "8250.h"
>  
> +#define UART_FCR_EM 3
>  #define UART_DLL_EM 9
>  #define UART_DLM_EM 10
> +#define UART_HCR0_EM 11
> +
> +#define UART_FCR_R_EM	(UART_FCR_EM + UART_HCR0_EM)

It's easy to lose track of all this, IMHO this would be simple:

/*
 * A high value for UART_FCR_EM avoids overlapping with existing UART_* 
 * register defines. UART_FCR_EM_HW is the real HW register offset.
 */
#define UART_FCR_EM 12
#define UART_FCR_EM_HW 3

Then use UART_FCR_EM consistently within the function you add for RZ so 
you'd need provide both _in/_out with UART_FCR_EM. (You'll have both 
UART_FCR and UART_FCR_EM cases in _out but that seems fine, IMHO).

To me that would look the cleanest workaround to the overlapping defines.

-- 
 i.


> +#define UART_HCR0_EM_SW_RESET	BIT(7) /* SW Reset */
>  
>  struct serial8250_em_hw_info {
>  	unsigned int type;
>  	upf_t flags;
> +	void (*serial_out)(struct uart_port *p, int off, int value);
>  };
>  
>  struct serial8250_em_priv {
> @@ -46,6 +57,7 @@ static void serial8250_em_serial_out(struct uart_port *p, int offset, int value)
>  		fallthrough;
>  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
>  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> +	case UART_HCR0_EM: /* HCR0 @ 0x2c */
>  		writel(value, p->membase + (offset << 2));
>  	}
>  }
> @@ -55,20 +67,74 @@ static unsigned int serial8250_em_serial_in(struct uart_port *p, int offset)
>  	switch (offset) {
>  	case UART_RX: /* RX @ 0x00 */
>  		return readb(p->membase);
> +	case UART_LCR: /* LCR @ 0x10 (+1) */
>  	case UART_MCR: /* MCR @ 0x14 (+1) */
>  	case UART_LSR: /* LSR @ 0x18 (+1) */
>  	case UART_MSR: /* MSR @ 0x1c (+1) */
>  	case UART_SCR: /* SCR @ 0x20 (+1) */
>  		return readl(p->membase + ((offset + 1) << 2));
> +	case UART_FCR_R_EM:
> +		return readl(p->membase + (UART_FCR_EM << 2));
>  	case UART_IER: /* IER @ 0x04 */
>  	case UART_IIR: /* IIR @ 0x08 */
>  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
>  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> +	case UART_HCR0_EM: /* HCR0 @ 0x2c */
>  		return readl(p->membase + (offset << 2));
>  	}
>  	return 0;
>  }
>  
> +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off, int value)
> +{
> +	unsigned int ier, fcr, lcr, mcr, hcr0;
> +
> +	ier = serial8250_em_serial_in(p, UART_IER);
> +	fcr = serial8250_em_serial_in(p, UART_FCR_R_EM);
> +	lcr = serial8250_em_serial_in(p, UART_LCR);
> +	mcr = serial8250_em_serial_in(p, UART_MCR);
> +	hcr0 = serial8250_em_serial_in(p, UART_HCR0_EM);
> +
> +	serial8250_em_serial_out(p, UART_FCR, fcr | UART_FCR_CLEAR_RCVR |
> +				 UART_FCR_CLEAR_XMIT);
> +	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0 | UART_HCR0_EM_SW_RESET);
> +	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0 & ~UART_HCR0_EM_SW_RESET);
> +
> +	switch (off) {
> +	case UART_FCR:
> +		fcr = value;
> +		break;
> +	case UART_LCR:
> +		lcr = value;
> +		break;
> +	case UART_MCR:
> +		mcr = value;
> +	}
> +
> +	serial8250_em_serial_out(p, UART_IER, ier);
> +	serial8250_em_serial_out(p, UART_FCR, fcr);
> +	serial8250_em_serial_out(p, UART_MCR, mcr);
> +	serial8250_em_serial_out(p, UART_LCR, lcr);
> +	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0);
> +}
> +
> +static void serial8250_em_rzv2m_serial_out(struct uart_port *p, int offset, int value)
> +{
> +	switch (offset) {
> +	case UART_TX:
> +	case UART_SCR:
> +	case UART_IER:
> +	case UART_DLL_EM:
> +	case UART_DLM_EM:
> +		serial8250_em_serial_out(p, offset, value);
> +		break;
> +	case UART_FCR:
> +	case UART_LCR:
> +	case UART_MCR:
> +		serial8250_rzv2m_reg_update(p, offset, value);
> +	}
> +}
> +
>  static int serial8250_em_serial_dl_read(struct uart_8250_port *up)
>  {
>  	return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
> @@ -120,7 +186,7 @@ static int serial8250_em_probe(struct platform_device *pdev)
>  
>  	up.port.iotype = UPIO_MEM32;
>  	up.port.serial_in = serial8250_em_serial_in;
> -	up.port.serial_out = serial8250_em_serial_out;
> +	up.port.serial_out = info->serial_out;
>  	up.dl_read = serial8250_em_serial_dl_read;
>  	up.dl_write = serial8250_em_serial_dl_write;
>  
> @@ -144,11 +210,13 @@ static int serial8250_em_remove(struct platform_device *pdev)
>  static const struct serial8250_em_hw_info emma_mobile_uart_hw_info = {
>  	.type = PORT_UNKNOWN,
>  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
> +	.serial_out = serial8250_em_serial_out,
>  };
>  
>  static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
>  	.type = PORT_16750,
>  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP | UPF_FIXED_TYPE,
> +	.serial_out = serial8250_em_rzv2m_serial_out,
>  };
>  
>  static const struct of_device_id serial8250_em_dt_ids[] = {
> 

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 11:31                   ` Ilpo Järvinen
@ 2023-02-13 11:40                     ` Biju Das
  2023-02-13 12:05                       ` Ilpo Järvinen
  0 siblings, 1 reply; 35+ messages in thread
From: Biju Das @ 2023-02-13 11:40 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Jiri Slaby, Geert Uytterhoeven, Magnus Damm,
	Niklas Söderlund, Greg Kroah-Hartman, linux-serial,
	Fabrizio Castro, linux-renesas-soc

Hi Ilpo,

Thanks for the feedback.

> Subject: RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> On Mon, 13 Feb 2023, Biju Das wrote:
> 
> > Hi Jiri Slaby,
> >
> > Thanks for the feedback.
> >
> > > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to
> > > struct serial8250_em_hw_info
> > >
> > > On 13. 02. 23, 10:31, Biju Das wrote:
> > > > So looks like similar to other macros, UART_FCR_EM (0x3) is sensible
> one.
> > > >
> > > > UART_FCR_RO_OFFSET (9)
> > > > UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)
> > > >
> > > >
> > > > static unsigned int serial8250_em_serial_in(struct uart_port *p,
> > > > int
> > > > offset) case UART_FCR_RO_EM:
> > > > 	return readl(p->membase + (offset - UART_FCR_RO_OFFSET << 2));
> > >
> > >
> > > Please send a complete patch as a reply. I am completely lost now.
> >
> > Please find the complete patc.
> >
> >
> > From e597ae60eb170c1f1b650e1e533bf4e12c09f822 Mon Sep 17 00:00:00 2001
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> > Date: Tue, 7 Feb 2023 15:07:13 +0000
> > Subject: [PATCH] serial: 8250_em: Add serial_out() to struct
> > serial8250_em_hw_info
> >
> > As per RZ/V2M hardware manual(Rev.1.30 Jun, 2022), UART IP has a
> > restriction as mentioned below.
> >
> > 40.6.1 Point for Caution when Changing the Register Settings:
> >
> > When changing the settings of the following registers, a PRESETn
> > master reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7]) must be
> > input to re-initialize them.
> >
> > Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.
> >
> > This patch adds serial_out() to struct serial8250_em_hw_info to handle
> > this difference between emma mobile and rz/v2m.
> >
> > DLL/DLM register can be updated only by setting LCR[7]. So the
> > updation of LCR[7] will perform reset for DLL/DLM register changes.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/tty/serial/8250/8250_em.c | 70
> > ++++++++++++++++++++++++++++++-
> >  1 file changed, 69 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/tty/serial/8250/8250_em.c
> > b/drivers/tty/serial/8250/8250_em.c
> > index 69cd3b611501..c1c64f48ee7e 100644
> > --- a/drivers/tty/serial/8250/8250_em.c
> > +++ b/drivers/tty/serial/8250/8250_em.c
> > @@ -17,12 +17,23 @@
> >
> >  #include "8250.h"
> >
> > +#define UART_FCR_EM 3
> >  #define UART_DLL_EM 9
> >  #define UART_DLM_EM 10
> > +#define UART_HCR0_EM 11
> > +
> > +#define UART_FCR_R_EM	(UART_FCR_EM + UART_HCR0_EM)
> 
> It's easy to lose track of all this, IMHO this would be simple:
> 
> /*
>  * A high value for UART_FCR_EM avoids overlapping with existing UART_*
>  * register defines. UART_FCR_EM_HW is the real HW register offset.
>  */
> #define UART_FCR_EM 12

I will change it to #define UART_FCR_EM 14 

And will add the below unused HW status registers in the driver.

#define UART_HCR2_EM 12 (@30)
#define UART_HCR3_EM 13 (@34)

Is it ok?

Cheers,
Biju

> #define UART_FCR_EM_HW 3
> 
> Then use UART_FCR_EM consistently within the function you add for RZ so
> you'd need provide both _in/_out with UART_FCR_EM. (You'll have both
> UART_FCR and UART_FCR_EM cases in _out but that seems fine, IMHO).
> 
> To me that would look the cleanest workaround to the overlapping defines.
> 
> --
>  i.
> 
> 
> > +#define UART_HCR0_EM_SW_RESET	BIT(7) /* SW Reset */
> >
> >  struct serial8250_em_hw_info {
> >  	unsigned int type;
> >  	upf_t flags;
> > +	void (*serial_out)(struct uart_port *p, int off, int value);
> >  };
> >
> >  struct serial8250_em_priv {
> > @@ -46,6 +57,7 @@ static void serial8250_em_serial_out(struct uart_port
> *p, int offset, int value)
> >  		fallthrough;
> >  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
> >  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> > +	case UART_HCR0_EM: /* HCR0 @ 0x2c */
> >  		writel(value, p->membase + (offset << 2));
> >  	}
> >  }
> > @@ -55,20 +67,74 @@ static unsigned int serial8250_em_serial_in(struct
> uart_port *p, int offset)
> >  	switch (offset) {
> >  	case UART_RX: /* RX @ 0x00 */
> >  		return readb(p->membase);
> > +	case UART_LCR: /* LCR @ 0x10 (+1) */
> >  	case UART_MCR: /* MCR @ 0x14 (+1) */
> >  	case UART_LSR: /* LSR @ 0x18 (+1) */
> >  	case UART_MSR: /* MSR @ 0x1c (+1) */
> >  	case UART_SCR: /* SCR @ 0x20 (+1) */
> >  		return readl(p->membase + ((offset + 1) << 2));
> > +	case UART_FCR_R_EM:
> > +		return readl(p->membase + (UART_FCR_EM << 2));
> >  	case UART_IER: /* IER @ 0x04 */
> >  	case UART_IIR: /* IIR @ 0x08 */
> >  	case UART_DLL_EM: /* DLL @ 0x24 (+9) */
> >  	case UART_DLM_EM: /* DLM @ 0x28 (+9) */
> > +	case UART_HCR0_EM: /* HCR0 @ 0x2c */
> >  		return readl(p->membase + (offset << 2));
> >  	}
> >  	return 0;
> >  }
> >
> > +static void serial8250_rzv2m_reg_update(struct uart_port *p, int off, int
> value)
> > +{
> > +	unsigned int ier, fcr, lcr, mcr, hcr0;
> > +
> > +	ier = serial8250_em_serial_in(p, UART_IER);
> > +	fcr = serial8250_em_serial_in(p, UART_FCR_R_EM);
> > +	lcr = serial8250_em_serial_in(p, UART_LCR);
> > +	mcr = serial8250_em_serial_in(p, UART_MCR);
> > +	hcr0 = serial8250_em_serial_in(p, UART_HCR0_EM);
> > +
> > +	serial8250_em_serial_out(p, UART_FCR, fcr | UART_FCR_CLEAR_RCVR |
> > +				 UART_FCR_CLEAR_XMIT);
> > +	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0 |
> UART_HCR0_EM_SW_RESET);
> > +	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0 &
> ~UART_HCR0_EM_SW_RESET);
> > +
> > +	switch (off) {
> > +	case UART_FCR:
> > +		fcr = value;
> > +		break;
> > +	case UART_LCR:
> > +		lcr = value;
> > +		break;
> > +	case UART_MCR:
> > +		mcr = value;
> > +	}
> > +
> > +	serial8250_em_serial_out(p, UART_IER, ier);
> > +	serial8250_em_serial_out(p, UART_FCR, fcr);
> > +	serial8250_em_serial_out(p, UART_MCR, mcr);
> > +	serial8250_em_serial_out(p, UART_LCR, lcr);
> > +	serial8250_em_serial_out(p, UART_HCR0_EM, hcr0);
> > +}
> > +
> > +static void serial8250_em_rzv2m_serial_out(struct uart_port *p, int
> offset, int value)
> > +{
> > +	switch (offset) {
> > +	case UART_TX:
> > +	case UART_SCR:
> > +	case UART_IER:
> > +	case UART_DLL_EM:
> > +	case UART_DLM_EM:
> > +		serial8250_em_serial_out(p, offset, value);
> > +		break;
> > +	case UART_FCR:
> > +	case UART_LCR:
> > +	case UART_MCR:
> > +		serial8250_rzv2m_reg_update(p, offset, value);
> > +	}
> > +}
> > +
> >  static int serial8250_em_serial_dl_read(struct uart_8250_port *up)
> >  {
> >  	return serial_in(up, UART_DLL_EM) | serial_in(up, UART_DLM_EM) << 8;
> > @@ -120,7 +186,7 @@ static int serial8250_em_probe(struct platform_device
> *pdev)
> >
> >  	up.port.iotype = UPIO_MEM32;
> >  	up.port.serial_in = serial8250_em_serial_in;
> > -	up.port.serial_out = serial8250_em_serial_out;
> > +	up.port.serial_out = info->serial_out;
> >  	up.dl_read = serial8250_em_serial_dl_read;
> >  	up.dl_write = serial8250_em_serial_dl_write;
> >
> > @@ -144,11 +210,13 @@ static int serial8250_em_remove(struct
> platform_device *pdev)
> >  static const struct serial8250_em_hw_info emma_mobile_uart_hw_info = {
> >  	.type = PORT_UNKNOWN,
> >  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP,
> > +	.serial_out = serial8250_em_serial_out,
> >  };
> >
> >  static const struct serial8250_em_hw_info rzv2m_uart_hw_info = {
> >  	.type = PORT_16750,
> >  	.flags = UPF_BOOT_AUTOCONF | UPF_FIXED_PORT | UPF_IOREMAP |
> UPF_FIXED_TYPE,
> > +	.serial_out = serial8250_em_rzv2m_serial_out,
> >  };
> >
> >  static const struct of_device_id serial8250_em_dt_ids[] = {
> >

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 11:40                     ` Biju Das
@ 2023-02-13 12:05                       ` Ilpo Järvinen
  2023-02-13 12:18                         ` Biju Das
  0 siblings, 1 reply; 35+ messages in thread
From: Ilpo Järvinen @ 2023-02-13 12:05 UTC (permalink / raw)
  To: Biju Das
  Cc: Jiri Slaby, Geert Uytterhoeven, Magnus Damm,
	Niklas Söderlund, Greg Kroah-Hartman, linux-serial,
	Fabrizio Castro, linux-renesas-soc

On Mon, 13 Feb 2023, Biju Das wrote:

> Hi Ilpo,
> 
> Thanks for the feedback.
> 
> > Subject: RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> > serial8250_em_hw_info
> > 
> > On Mon, 13 Feb 2023, Biju Das wrote:
> > 
> > > Hi Jiri Slaby,
> > >
> > > Thanks for the feedback.
> > >
> > > > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to
> > > > struct serial8250_em_hw_info
> > > >
> > > > On 13. 02. 23, 10:31, Biju Das wrote:
> > > > > So looks like similar to other macros, UART_FCR_EM (0x3) is sensible
> > one.
> > > > >
> > > > > UART_FCR_RO_OFFSET (9)
> > > > > UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)
> > > > >
> > > > >
> > > > > static unsigned int serial8250_em_serial_in(struct uart_port *p,
> > > > > int
> > > > > offset) case UART_FCR_RO_EM:
> > > > > 	return readl(p->membase + (offset - UART_FCR_RO_OFFSET << 2));
> > > >
> > > >
> > > > Please send a complete patch as a reply. I am completely lost now.
> > >
> > > Please find the complete patc.
> > >
> > >
> > > From e597ae60eb170c1f1b650e1e533bf4e12c09f822 Mon Sep 17 00:00:00 2001
> > > From: Biju Das <biju.das.jz@bp.renesas.com>
> > > Date: Tue, 7 Feb 2023 15:07:13 +0000
> > > Subject: [PATCH] serial: 8250_em: Add serial_out() to struct
> > > serial8250_em_hw_info
> > >
> > > As per RZ/V2M hardware manual(Rev.1.30 Jun, 2022), UART IP has a
> > > restriction as mentioned below.
> > >
> > > 40.6.1 Point for Caution when Changing the Register Settings:
> > >
> > > When changing the settings of the following registers, a PRESETn
> > > master reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7]) must be
> > > input to re-initialize them.
> > >
> > > Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.
> > >
> > > This patch adds serial_out() to struct serial8250_em_hw_info to handle
> > > this difference between emma mobile and rz/v2m.
> > >
> > > DLL/DLM register can be updated only by setting LCR[7]. So the
> > > updation of LCR[7] will perform reset for DLL/DLM register changes.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > ---
> > >  drivers/tty/serial/8250/8250_em.c | 70
> > > ++++++++++++++++++++++++++++++-
> > >  1 file changed, 69 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/tty/serial/8250/8250_em.c
> > > b/drivers/tty/serial/8250/8250_em.c
> > > index 69cd3b611501..c1c64f48ee7e 100644
> > > --- a/drivers/tty/serial/8250/8250_em.c
> > > +++ b/drivers/tty/serial/8250/8250_em.c
> > > @@ -17,12 +17,23 @@
> > >
> > >  #include "8250.h"
> > >
> > > +#define UART_FCR_EM 3
> > >  #define UART_DLL_EM 9
> > >  #define UART_DLM_EM 10
> > > +#define UART_HCR0_EM 11
> > > +
> > > +#define UART_FCR_R_EM	(UART_FCR_EM + UART_HCR0_EM)
> > 
> > It's easy to lose track of all this, IMHO this would be simple:
> > 
> > /*
> >  * A high value for UART_FCR_EM avoids overlapping with existing UART_*
> >  * register defines. UART_FCR_EM_HW is the real HW register offset.
> >  */
> > #define UART_FCR_EM 12
> 
> I will change it to #define UART_FCR_EM 14 
> 
> And will add the below unused HW status registers in the driver.
> 
> #define UART_HCR2_EM 12 (@30)
> #define UART_HCR3_EM 13 (@34)
> 
> Is it ok?

It's okay, that number is pseudo one anyway so the actual number doesn't 
matter. One could just as well pick some large number such as 0x10003 or
so if the collision with real regs is a concern.

-- 
 i.


^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 12:05                       ` Ilpo Järvinen
@ 2023-02-13 12:18                         ` Biju Das
  2023-02-13 16:06                           ` Biju Das
  0 siblings, 1 reply; 35+ messages in thread
From: Biju Das @ 2023-02-13 12:18 UTC (permalink / raw)
  To: Ilpo Järvinen
  Cc: Jiri Slaby, Geert Uytterhoeven, Magnus Damm,
	Niklas Söderlund, Greg Kroah-Hartman, linux-serial,
	Fabrizio Castro, linux-renesas-soc

Hi Ilpo Järvinen,

Thanks for feedback.

> -----Original Message-----
> From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Sent: Monday, February 13, 2023 12:05 PM
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Jiri Slaby <jirislaby@kernel.org>; Geert Uytterhoeven
> <geert+renesas@glider.be>; Magnus Damm <magnus.damm@gmail.com>; Niklas
> Söderlund <niklas.soderlund@ragnatech.se>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; linux-serial <linux-serial@vger.kernel.org>;
> Fabrizio Castro <fabrizio.castro.jz@renesas.com>; linux-renesas-
> soc@vger.kernel.org
> Subject: RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> On Mon, 13 Feb 2023, Biju Das wrote:
> 
> > Hi Ilpo,
> >
> > Thanks for the feedback.
> >
> > > Subject: RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to
> > > struct serial8250_em_hw_info
> > >
> > > On Mon, 13 Feb 2023, Biju Das wrote:
> > >
> > > > Hi Jiri Slaby,
> > > >
> > > > Thanks for the feedback.
> > > >
> > > > > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to
> > > > > struct serial8250_em_hw_info
> > > > >
> > > > > On 13. 02. 23, 10:31, Biju Das wrote:
> > > > > > So looks like similar to other macros, UART_FCR_EM (0x3) is
> > > > > > sensible
> > > one.
> > > > > >
> > > > > > UART_FCR_RO_OFFSET (9)
> > > > > > UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)
> > > > > >
> > > > > >
> > > > > > static unsigned int serial8250_em_serial_in(struct uart_port
> > > > > > *p, int
> > > > > > offset) case UART_FCR_RO_EM:
> > > > > > 	return readl(p->membase + (offset - UART_FCR_RO_OFFSET <<
> > > > > > 2));
> > > > >
> > > > >
> > > > > Please send a complete patch as a reply. I am completely lost now.
> > > >
> > > > Please find the complete patc.
> > > >
> > > >
> > > > From e597ae60eb170c1f1b650e1e533bf4e12c09f822 Mon Sep 17 00:00:00
> > > > 2001
> > > > From: Biju Das <biju.das.jz@bp.renesas.com>
> > > > Date: Tue, 7 Feb 2023 15:07:13 +0000
> > > > Subject: [PATCH] serial: 8250_em: Add serial_out() to struct
> > > > serial8250_em_hw_info
> > > >
> > > > As per RZ/V2M hardware manual(Rev.1.30 Jun, 2022), UART IP has a
> > > > restriction as mentioned below.
> > > >
> > > > 40.6.1 Point for Caution when Changing the Register Settings:
> > > >
> > > > When changing the settings of the following registers, a PRESETn
> > > > master reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7])
> > > > must be input to re-initialize them.
> > > >
> > > > Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.
> > > >
> > > > This patch adds serial_out() to struct serial8250_em_hw_info to
> > > > handle this difference between emma mobile and rz/v2m.
> > > >
> > > > DLL/DLM register can be updated only by setting LCR[7]. So the
> > > > updation of LCR[7] will perform reset for DLL/DLM register changes.
> > > >
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > ---
> > > >  drivers/tty/serial/8250/8250_em.c | 70
> > > > ++++++++++++++++++++++++++++++-
> > > >  1 file changed, 69 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/tty/serial/8250/8250_em.c
> > > > b/drivers/tty/serial/8250/8250_em.c
> > > > index 69cd3b611501..c1c64f48ee7e 100644
> > > > --- a/drivers/tty/serial/8250/8250_em.c
> > > > +++ b/drivers/tty/serial/8250/8250_em.c
> > > > @@ -17,12 +17,23 @@
> > > >
> > > >  #include "8250.h"
> > > >
> > > > +#define UART_FCR_EM 3
> > > >  #define UART_DLL_EM 9
> > > >  #define UART_DLM_EM 10
> > > > +#define UART_HCR0_EM 11
> > > > +
> > > > +#define UART_FCR_R_EM	(UART_FCR_EM + UART_HCR0_EM)
> > >
> > > It's easy to lose track of all this, IMHO this would be simple:
> > >
> > > /*
> > >  * A high value for UART_FCR_EM avoids overlapping with existing
> > > UART_*
> > >  * register defines. UART_FCR_EM_HW is the real HW register offset.
> > >  */
> > > #define UART_FCR_EM 12
> >
> > I will change it to #define UART_FCR_EM 14
> >
> > And will add the below unused HW status registers in the driver.
> >
> > #define UART_HCR2_EM 12 (@30)
> > #define UART_HCR3_EM 13 (@34)
> >
> > Is it ok?
> 
> It's okay, that number is pseudo one anyway so the actual number doesn't
> matter. One could just as well pick some large number such as 0x10003 or so
> if the collision with real regs is a concern.

OK will use 0x10003, as pseudo offset.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 10:29                   ` Niklas Söderlund
@ 2023-02-13 13:01                     ` Biju Das
  2023-02-13 14:09                       ` Niklas Söderlund
  0 siblings, 1 reply; 35+ messages in thread
From: Biju Das @ 2023-02-13 13:01 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Greg Kroah-Hartman, linux-serial, Fabrizio Castro,
	linux-renesas-soc

Hi Niklas,

> -----Original Message-----
> From: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> Sent: Monday, February 13, 2023 10:30 AM
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Cc: Jiri Slaby <jirislaby@kernel.org>; Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com>; Geert Uytterhoeven
> <geert+renesas@glider.be>; Magnus Damm <magnus.damm@gmail.com>; Greg Kroah-
> Hartman <gregkh@linuxfoundation.org>; linux-serial <linux-
> serial@vger.kernel.org>; Fabrizio Castro <fabrizio.castro.jz@renesas.com>;
> linux-renesas-soc@vger.kernel.org
> Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> Hi Biju,
> 
> On 2023-02-13 10:06:04 +0000, Biju Das wrote:
> > Hi Niklas,
> >
> > Thanks for testing.
> >
> > > -----Original Message-----
> > > From: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > > Sent: Monday, February 13, 2023 9:58 AM
> > > To: Biju Das <biju.das.jz@bp.renesas.com>
> > > Cc: Jiri Slaby <jirislaby@kernel.org>; Ilpo Järvinen
> > > <ilpo.jarvinen@linux.intel.com>; Geert Uytterhoeven
> > > <geert+renesas@glider.be>; Magnus Damm <magnus.damm@gmail.com>; Greg
> > > Kroah- Hartman <gregkh@linuxfoundation.org>; linux-serial <linux-
> > > serial@vger.kernel.org>; Fabrizio Castro
> > > <fabrizio.castro.jz@renesas.com>; linux-renesas-soc@vger.kernel.org
> > > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to
> > > struct serial8250_em_hw_info
> > >
> > > Hi Biju,
> > >
> > > On 2023-02-13 09:31:27 +0000, Biju Das wrote:
> > > > Adding Magnus and Niklas to test on EMMA mobile platform to check
> > > > the port type detected On that platform?
> > >
> > > I don't know what you want me to check, I don't know much about
> > > serial. I wired up the platform during the weekend, here is a boot
> > > log running on v6.1. If you want to to check / test something I'm
> > > happy to, but will need instructions.
> >
> > As per Geert the register layout is same as RZ/V2M, So The UART is
> > register compatible with standard 16750 chip.
> >
> > But below log shows that it is 16550A and using only 16-bytes fifo,
> > Eventhough it has 64-bytes fifo.
> >
> > [    1.020000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37,
> base_baud = 796444) is a 16550A
> > [    1.020000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38,
> base_baud = 7168000) is a 16550A
> > [    1.690000] printk: console [ttyS1] enabled
> > [    1.700000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39,
> base_baud = 14336000) is a 16550A
> > [    1.710000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40,
> base_baud = 2389333) is a 16550A
> >
> > So if you apply, this patch series, and add below changes it should
> > detect as 16750
> >
> > https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore
> > .kernel.org%2Flinux-renesas-soc%2F8585f736-cf3b-b63c-753f-892d4051ada3
> > %40linux.intel.com%2FT%2F%23mce8d222e3670321e8a8e39faacc4d6dd061fdbd6&
> > data=05%7C01%7Cbiju.das.jz%40bp.renesas.com%7Cc1ababd7ffba4fa1f28608db
> > 0dad34ad%7C53d82571da1947e49cb4625a166a4a2a%7C0%7C0%7C6381188097859699
> > 13%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI
> > 6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2NYFF9vLvkFSifCl4WYUfT1i
> > ad8oyUFegJgFclRdDOw%3D&reserved=0
> >
> > and for quick testing please do below change for emma mobile.
> >
> > + { .compatible = "renesas,em-uart", .data = &rzv2m_uart_hw_info },
> 
> 
> Could you provide a branch with the setup you like me to test?

Please get files from here

https://gitlab.com/bijud/uart-fifo/-/commits/uart-fifo-testing

Cheers,
Biju


> 
> >
> > Cheers,
> > Biju
> >
> >
> >
> > >
> > > [    0.000000] Booting Linux on physical CPU 0x0
> > > [    0.000000] Linux version 6.1.0 (neg@sleipner) (arm-linux-gnueabihf-
> gcc
> > > (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #1 SMP Sun Feb 12
> > > 18:44:55 CET
> > > 2023
> > > [    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7),
> > > cr=10c5387d
> > > [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
> > > instruction cache
> > > [    0.000000] OF: fdt: Machine model: EMEV2 KZM9D Board
> > > [    0.000000] printk: debug: ignoring loglevel setting.
> > > [    0.000000] Memory policy: Data cache writealloc
> > > [    0.000000] cma: Failed to reserve 128 MiB
> > > [    0.000000] Zone ranges:
> > > [    0.000000]   Normal   [mem 0x0000000040000000-0x0000000047ffffff]
> > > [    0.000000]   HighMem  empty
> > > [    0.000000] Movable zone start for each node
> > > [    0.000000] Early memory node ranges
> > > [    0.000000]   node   0: [mem 0x0000000040000000-0x0000000047ffffff]
> > > [    0.000000] Initmem setup node 0 [mem 0x0000000040000000-
> > > 0x0000000047ffffff]
> > > [    0.000000] percpu: Embedded 13 pages/cpu s32468 r0 d20780 u53248
> > > [    0.000000] pcpu-alloc: s32468 r0 d20780 u53248 alloc=13*4096
> > > [    0.000000] pcpu-alloc: [0] 0 [0] 1
> > > [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages:
> 32512
> > > [    0.000000] Kernel command line: ignore_loglevel rw root=/dev/nfs
> ip=on
> > > [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536
> > > bytes, linear)
> > > [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768
> bytes,
> > > linear)
> > > [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> > > [    0.000000] Memory: 116072K/131072K available (8192K kernel code,
> 1152K
> > > rwdata, 2436K rodata, 1024K init, 259K bss, 15000K reserved, 0K cma-
> > > reserved, 0K highmem)
> > > [    0.000000] trace event string verifier disabled
> > > [    0.000000] rcu: Hierarchical RCU implementation.
> > > [    0.000000] rcu: 	RCU event tracing is enabled.
> > > [    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to
> > > nr_cpu_ids=2.
> > > [    0.000000] rcu: RCU calculated value of scheduler-enlistment delay
> is 10
> > > jiffies.
> > > [    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16,
> nr_cpu_ids=2
> > > [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
> > > [    0.000000] GIC: enabling workaround for broken byte access
> > > [    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on
> > > contention.
> > > [    0.000000] timer_probe: no matching timers found
> > > [    0.000000] Console: colour dummy device 80x30
> > > [    0.000000] printk: console [tty0] enabled
> > > [    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns,
> wraps
> > > every 21474836475000000ns
> > > [    0.000000] Calibrating delay loop (skipped) preset value.. 1066.00
> > > BogoMIPS (lpj=5330000)
> > > [    0.000000] pid_max: default: 32768 minimum: 301
> > > [    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096
> bytes,
> > > linear)
> > > [    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
> > > bytes, linear)
> > > [    0.000000] CPU: Testing write buffer coherency: ok
> > > [    0.000000] CPU0: Spectre v2: using BPIALL workaround
> > > [    0.000000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
> > > [    0.000000] Setting up static identity map for 0x40100000 -
> 0x40100060
> > > [    0.000000] rcu: Hierarchical SRCU implementation.
> > > [    0.000000] rcu: 	Max phase no-delay instances is 1000.
> > > [    0.000000] smp: Bringing up secondary CPUs ...
> > > [    0.000000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
> > > [    0.000000] CPU1: Spectre v2: using BPIALL workaround
> > > [    0.000000] smp: Brought up 1 node, 2 CPUs
> > > [    0.000000] SMP: Total of 2 processors activated (2132.00 BogoMIPS).
> > > [    0.000000] CPU: All CPU(s) started in SVC mode.
> > > [    0.000000] devtmpfs: initialized
> > > [    0.000000] VFP support v0.3: implementor 41 architecture 3 part 30
> > > variant 9 rev 1
> > > [    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles:
> > > 0xffffffff, max_idle_ns: 19112604462750000 ns
> > > [    0.000000] futex hash table entries: 512 (order: 3, 32768 bytes,
> linear)
> > > [    0.000000] pinctrl core: initialized pinctrl subsystem
> > > [    0.000000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
> > > [    0.000000] DMA: preallocated 256 KiB pool for atomic coherent
> > > allocations
> > > [    0.000000] thermal_sys: Registered thermal governor 'step_wise'
> > > [    0.000000] No ATAGs?
> > > [    0.000000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1
> > > watchpoint registers.
> > > [    0.000000] hw-breakpoint: maximum watchpoint size is 4 bytes.
> > > [    0.000000] sh-pfc e0140200.pinctrl: emev2_pfc support registered
> > > [    0.000000] SCSI subsystem initialized
> > > [    0.000000] libata version 3.00 loaded.
> > > [    0.000000] usbcore: registered new interface driver usbfs
> > > [    0.000000] usbcore: registered new interface driver hub
> > > [    0.000000] usbcore: registered new device driver usb
> > > [    0.000000] mc: Linux media interface: v0.10
> > > [    0.000000] videodev: Linux video capture interface: v2.00
> > > [    0.000000] pps_core: LinuxPPS API ver. 1 registered
> > > [    0.000000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007
> Rodolfo
> > > Giometti <giometti@linux.it>
> > > [    0.000000] PTP clock support registered
> > > [    0.000000] em_sti e0180000.timer: used for clock events
> > > [    0.000000] em_sti e0180000.timer: used for oneshot clock events
> > > [    0.000000] em_sti e0180000.timer: used as clock source
> > > [    0.000000] clocksource: e0180000.timer: mask: 0xffffffffffff
> max_cycles:
> > > 0x1ef4687b1, max_idle_ns: 112843571739654 ns
> > > [    0.000000] Advanced Linux Sound Architecture Driver Initialized.
> > > [    0.000000] vgaarb: loaded
> > > [    0.940000] clocksource: Switched to clocksource e0180000.timer
> > > [    0.950000] Clockevents: could not switch to one-shot mode:
> > > [    0.950000] Clockevents: could not switch to one-shot mode:
> dummy_timer
> > > is not functional.
> > > [    0.950000]  dummy_timer is not functional.
> > > [    0.960000] NET: Registered PF_INET protocol family
> > > [    0.960000] IP idents hash table entries: 2048 (order: 2, 16384
> bytes,
> > > linear)
> > > [    0.960000] tcp_listen_portaddr_hash hash table entries: 512 (order:
> 0,
> > > 4096 bytes, linear)
> > > [    0.960000] Table-perturb hash table entries: 65536 (order: 6, 262144
> > > bytes, linear)
> > > [    0.960000] TCP established hash table entries: 1024 (order: 0, 4096
> > > bytes, linear)
> > > [    0.960000] TCP bind hash table entries: 1024 (order: 2, 16384 bytes,
> > > linear)
> > > [    0.960000] TCP: Hash tables configured (established 1024 bind 1024)
> > > [    0.960000] UDP hash table entries: 256 (order: 1, 8192 bytes,
> linear)
> > > [    0.960000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes,
> > > linear)
> > > [    0.960000] NET: Registered PF_UNIX/PF_LOCAL protocol family
> > > [    0.960000] RPC: Registered named UNIX socket transport module.
> > > [    0.960000] RPC: Registered udp transport module.
> > > [    0.960000] RPC: Registered tcp transport module.
> > > [    0.960000] RPC: Registered tcp NFSv4.1 backchannel transport module.
> > > [    0.960000] PCI: CLS 0 bytes, default 64
> > > [    1.000000] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7
> > > counters available
> > > [    1.000000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
> > > [    1.000000] NFS: Registering the id_resolver key type
> > > [    1.000000] Key type id_resolver registered
> > > [    1.000000] Key type id_legacy registered
> > > [    1.000000] nfs4filelayout_init: NFSv4 File Layout Driver
> Registering...
> > > [    1.000000] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver
> > > Registering...
> > > [    1.000000] Block layer SCSI generic (bsg) driver version 0.4 loaded
> > > (major 246)
> > > [    1.000000] io scheduler mq-deadline registered
> > > [    1.000000] io scheduler kyber registered
> > > [    1.010000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> > > [    1.020000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37,
> > > base_baud = 796444) is a 16550A
> > > [    1.020000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38,
> > > base_baud = 7168000) is a 16550A
> > > [    1.690000] printk: console [ttyS1] enabled
> > > [    1.700000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39,
> > > base_baud = 14336000) is a 16550A
> > > [    1.710000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40,
> > > base_baud = 2389333) is a 16550A
> > > [    1.720000] SuperH (H)SCI(F) driver initialized
> > > [    1.730000] CAN device driver interface
> > > [    1.800000] smsc911x 20000000.ethernet eth0: MAC Address:
> > > 00:0a:a3:02:12:92
> > > [    1.810000] UDC core: g_ether: couldn't find an available UDC
> > > [    1.810000] i2c_dev: i2c /dev entries driver
> > > [    1.820000] em-i2c e0070000.i2c: Added i2c controller 0, irq 42
> > > [    1.830000] em-i2c e10a0000.i2c: Added i2c controller 1, irq 43
> > > [    1.830000] cpu cpu0: OPP table can't be empty
> > > [    1.840000] usbcore: registered new interface driver usbhid
> > > [    1.850000] usbhid: USB HID core driver
> > > [    1.850000] NET: Registered PF_INET6 protocol family
> > > [    1.860000] Segment Routing with IPv6
> > > [    1.870000] In-situ OAM (IOAM) with IPv6
> > > [    1.870000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
> > > [    1.880000] NET: Registered PF_PACKET protocol family
> > > [    1.880000] can: controller area network core
> > > [    1.890000] NET: Registered PF_CAN protocol family
> > > [    1.890000] can: raw protocol
> > > [    1.900000] can: broadcast manager protocol
> > > [    1.900000] can: netlink gateway - max_hops=1
> > > [    1.900000] Key type dns_resolver registered
> > > [    1.910000] Registering SWP/SWPB emulation handler
> > > [    1.920000] input: gpio_keys as
> /devices/platform/gpio_keys/input/input0
> > > [    1.980000] SMSC LAN8700 20000000.ethernet-ffffffff:01: attached PHY
> > > driver (mii_bus:phy_addr=20000000.ethernet-ffffffff:01, irq=POLL)
> > > [    2.020000] smsc911x 20000000.ethernet eth0: SMSC911x/921x identified
> at
> > > 0xc8920000, IRQ: 41
> > > [    4.160000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> > > [    4.210000] Sending DHCP requests ., OK
> > > [    4.250000] IP-Config: Got DHCP answer from 10.0.1.1, my address is
> > > 10.0.1.2
> > > [    4.260000] IP-Config: Complete:
> > > [    4.260000]      device=eth0, hwaddr=00:0a:a3:02:12:92,
> ipaddr=10.0.1.2,
> > > mask=255.255.255.0, gw=10.0.1.1
> > > [    4.270000]      host=10.0.1.2, domain=dyn.berto.se, nis-
> domain=(none)
> > > [    4.280000]      bootserver=10.0.1.1, rootserver=10.0.1.1,
> > > rootpath=/srv/nfs4/arch,tcp,v3
> > > [    4.280000]      nameserver0=192.168.20.1
> > > [    4.290000] ALSA device list:
> > > [    4.290000]   No soundcards found.
> > > [    4.320000] VFS: Mounted root (nfs filesystem) on device 0:15.
> > > [    4.320000] devtmpfs: mounted
> > > [    4.330000] Freeing unused kernel image (initmem) memory: 1024K
> > > [    4.390000] Run /sbin/init as init process
> > > [    4.390000]   with arguments:
> > > [    4.390000]     /sbin/init
> > > [    4.400000]   with environment:
> > > [    4.400000]     HOME=/
> > > [    4.400000]     TERM=linux
> > > [    6.040000] systemd[1]: System time before build time, advancing
> clock.
> > > [    6.100000] systemd[1]: Failed to find module 'autofs4'
> > > [    6.220000] systemd[1]: systemd 252.5-1-arch running in system mode
> (+PAM
> > > +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS
> > > ++OPENSSL +ACL BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD
> > > ++LIBCRYPTSETUP LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2
> > > ++BZIP2 +LZ4 +XZ +ZLIB ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP
> > > +-SYSVINIT default-hierarchy=unified)
> > > [    6.240000] systemd[1]: Detected architecture arm.
> > > [    6.290000] systemd[1]: Hostname set to <arm>.
> > > [    6.520000] systemd[1]: bpf-lsm: BPF LSM hook not enabled in the
> kernel,
> > > BPF LSM not supported
> > > [    8.710000] systemd[1]: Queued start job for default target Graphical
> > > Interface.
> > > [    8.730000] systemd[1]: Created slice Slice /system/getty.
> > > [    8.770000] systemd[1]: Created slice Slice /system/modprobe.
> > > [    8.810000] systemd[1]: Created slice Slice /system/serial-getty.
> > > [    8.850000] systemd[1]: Created slice User and Session Slice.
> > > [    8.890000] systemd[1]: Started Dispatch Password Requests to Console
> > > Directory Watch.
> > > [    8.930000] systemd[1]: Started Forward Password Requests to Wall
> > > Directory Watch.
> > > [    8.970000] systemd[1]: Arbitrary Executable File Formats File System
> > > Automount Point was skipped because of an unmet condition check
> > > (ConditionPathExists=/proc/sys/fs/binfmt_misc).
> > > [    8.980000] systemd[1]: Reached target Local Encrypted Volumes.
> > > [    9.020000] systemd[1]: Reached target Local Integrity Protected
> Volumes.
> > > [    9.060000] systemd[1]: Reached target Network is Online.
> > > [    9.100000] systemd[1]: Reached target Path Units.
> > > [    9.130000] systemd[1]: Reached target Slice Units.
> > > [    9.170000] systemd[1]: Reached target Swaps.
> > > [    9.200000] systemd[1]: Reached target Local Verity Protected
> Volumes.
> > > [    9.240000] systemd[1]: Listening on Device-mapper event daemon
> FIFOs.
> > > [    9.300000] systemd[1]: Listening on Process Core Dump Socket.
> > > [    9.340000] systemd[1]: Journal Audit Socket was skipped because of
> an
> > > unmet condition check (ConditionSecurity=audit).
> > > [    9.350000] systemd[1]: Listening on Journal Socket (/dev/log).
> > > [    9.390000] systemd[1]: Listening on Journal Socket.
> > > [    9.430000] systemd[1]: Listening on udev Control Socket.
> > > [    9.470000] systemd[1]: Listening on udev Kernel Socket.
> > > [    9.510000] systemd[1]: Huge Pages File System was skipped because of
> an
> > > unmet condition check (ConditionPathExists=/sys/kernel/mm/hugepages).
> > > [    9.520000] systemd[1]: POSIX Message Queue File System was skipped
> > > because of an unmet condition check
> > > (ConditionPathExists=/proc/sys/fs/mqueue).
> > > [    9.590000] systemd[1]: Mounting /root/shared...
> > > [    9.620000] systemd[1]: Mounting Kernel Debug File System...
> > > [    9.680000] systemd[1]: Mounting Kernel Trace File System...
> > > [    9.780000] systemd[1]: Mounting Temporary Directory /tmp...
> > > [    9.820000] systemd[1]: Create List of Static Device Nodes was
> skipped
> > > because of an unmet condition check
> > > (ConditionFileNotEmpty=/lib/modules/6.1.0/modules.devname).
> > > [    9.850000] systemd[1]: Starting Load Kernel Module configfs...
> > > [    9.960000] systemd[1]: Starting Load Kernel Module drm...
> > > [   10.010000] systemd[1]: Starting Load Kernel Module fuse...
> > > [   10.070000] systemd[1]: Load Kernel Modules was skipped because no
> > > trigger condition checks were met.
> > > [   10.120000] systemd[1]: Starting Remount Root and Kernel File
> Systems...
> > > [   10.190000] systemd[1]: Repartition Root Disk was skipped because no
> > > trigger condition checks were met.
> > > [   10.250000] systemd[1]: Starting Apply Kernel Variables...
> > > [   10.310000] systemd[1]: Starting Coldplug All udev Devices...
> > > [   10.390000] systemd[1]: Mounted Kernel Debug File System.
> > > [   10.410000] systemd[1]: Mounted Kernel Trace File System.
> > > [   10.450000] systemd[1]: Mounted Temporary Directory /tmp.
> > > [   10.490000] systemd[1]: modprobe@configfs.service: Deactivated
> > > successfully.
> > > [   10.520000] systemd[1]: Finished Load Kernel Module configfs.
> > > [   10.550000] systemd[1]: modprobe@drm.service: Deactivated
> successfully.
> > > [   10.550000] systemd[1]: Finished Load Kernel Module drm.
> > > [   10.600000] systemd[1]: modprobe@fuse.service: Deactivated
> successfully.
> > > [   10.610000] systemd[1]: Finished Load Kernel Module fuse.
> > > [   10.650000] systemd[1]: Finished Remount Root and Kernel File
> Systems.
> > > [   10.670000] systemd[1]: Finished Apply Kernel Variables.
> > > [   10.890000] systemd[1]: Reached target Host and Network Name Lookups.
> > > [   10.940000] systemd[1]: Listening on RPCbind Server Activation
> Socket.
> > > [   10.990000] systemd[1]: Reached target RPC Port Mapper.
> > > [   11.030000] systemd[1]: FUSE Control File System was skipped because
> of
> > > an unmet condition check (ConditionPathExists=/sys/fs/fuse/connections).
> > > [   11.090000] systemd[1]: Mounting Kernel Configuration File System...
> > > [   11.130000] systemd[1]: Starting NFS status monitor for NFSv2/3
> > > locking....
> > > [   11.180000] systemd[1]: First Boot Wizard was skipped because of an
> unmet
> > > condition check (ConditionFirstBoot=yes).
> > > [   11.210000] systemd[1]: Rebuild Hardware Database was skipped because
> of
> > > an unmet condition check (ConditionNeedsUpdate=/etc).
> > > [   11.290000] systemd[1]: Starting Load/Save Random Seed...
> > > [   11.330000] systemd[1]: Create System Users was skipped because no
> > > trigger condition checks were met.
> > > [   11.380000] systemd[1]: Starting Create Static Device Nodes in
> /dev...
> > > [   11.500000] systemd[1]: Finished Coldplug All udev Devices.
> > > [   11.540000] systemd[1]: Mounted Kernel Configuration File System.
> > > [   11.620000] systemd[1]: Starting RPC Bind...
> > > [   12.160000] systemd[1]: Finished Create Static Device Nodes in /dev.
> > > [   12.200000] systemd[1]: Started RPC Bind.
> > > [   12.240000] systemd[1]: Reached target Preparation for Local File
> > > Systems.
> > > [   12.290000] systemd[1]: Virtual Machine and Container Storage
> > > (Compatibility) was skipped because of an unmet condition check
> > > (ConditionPathExists=/var/lib/machines.raw).
> > > [   12.310000] systemd[1]: Reached target Local File Systems.
> > > [   12.350000] systemd[1]: Entropy Daemon based on the HAVEGE algorithm
> was
> > > skipped because of an unmet condition check
> (ConditionKernelVersion=<5.6).
> > > [   12.360000] systemd[1]: Rebuild Dynamic Linker Cache was skipped
> because
> > > no trigger condition checks were met.
> > > [   12.420000] systemd[1]: Starting Notify NFS peers of a restart...
> > > [   12.460000] systemd[1]: Set Up Additional Binary Formats was skipped
> > > because no trigger condition checks were met.
> > > [   12.480000] systemd[1]: systemd-journald.service: unit configures an
> IP
> > > firewall, but the local system does not support BPF/cgroup firewalling.
> > > [   12.490000] systemd[1]: (This warning is only shown for the first
> unit
> > > using IP firewalling.)
> > > [   12.570000] systemd[1]: Starting Journal Service...
> > > [   12.620000] systemd[1]: Starting Rule-based Manager for Device Events
> and
> > > Files...
> > > [   12.700000] systemd[1]: Started NFS status monitor for NFSv2/3
> locking..
> > > [   12.740000] systemd[1]: Started Notify NFS peers of a restart.
> > > [   12.990000] systemd[1]: Started Journal Service.
> > > [   16.860000] systemd-journald[87]: Received client request to flush
> > > runtime journal.
> > > [   21.360000] random: dbus-daemon: uninitialized urandom read (12 bytes
> > > read)
> > > [   22.190000] random: dbus-daemon: uninitialized urandom read (12 bytes
> > > read)
> > > [   39.150000] random: crng init done
> > >
> > > --
> > > Kind Regards,
> > > Niklas Söderlund
> 
> --
> Kind Regards,
> Niklas Söderlund

^ permalink raw reply	[flat|nested] 35+ messages in thread

* Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 13:01                     ` Biju Das
@ 2023-02-13 14:09                       ` Niklas Söderlund
  2023-02-13 14:26                         ` Biju Das
  0 siblings, 1 reply; 35+ messages in thread
From: Niklas Söderlund @ 2023-02-13 14:09 UTC (permalink / raw)
  To: Biju Das
  Cc: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Greg Kroah-Hartman, linux-serial, Fabrizio Castro,
	linux-renesas-soc

Hi Biju,

On 2023-02-13 13:01:06 +0000, Biju Das wrote:
> Please get files from here
> 
> https://gitlab.com/bijud/uart-fifo/-/commits/uart-fifo-testing

Thanks for the branch.

It boots and the serial console appears to be functioning as expected.  
Is there anything in particular you like me to test? I attach the full 
boot log in case it's useful for you.

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 6.2.0-rc7-next-20230210-12179-g91bd68019b4b (neg@sleipner) (arm-linux-gnueabihf-gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #2 SMP Mon Feb 13 15:02:12 CET 2023
[    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: EMEV2 KZM9D Board
[    0.000000] printk: debug: ignoring loglevel setting.
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] cma: Failed to reserve 128 MiB
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000040000000-0x0000000047ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000047ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000047ffffff]
[    0.000000] percpu: Embedded 14 pages/cpu s33620 r0 d23724 u57344
[    0.000000] pcpu-alloc: s33620 r0 d23724 u57344 alloc=14*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: ignore_loglevel rw root=/dev/nfs ip=on
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes, linear)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 116068K/131072K available (8192K kernel code, 1150K rwdata, 2596K rodata, 1024K init, 251K bss, 15004K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] trace event string verifier disabled
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: enabling workaround for broken byte access
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] timer_probe: no matching timers found
[    0.000000] Console: colour dummy device 80x30
[    0.000000] printk: console [tty0] enabled
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
[    0.000000] Calibrating delay loop (skipped) preset value.. 1066.00 BogoMIPS (lpj=5330000)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.000000] CPU: Testing write buffer coherency: ok
[    0.000000] CPU0: Spectre v2: using BPIALL workaround
[    0.000000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.000000] Setting up static identity map for 0x40100000 - 0x40100060
[    0.000000] rcu: Hierarchical SRCU implementation.
[    0.000000] rcu: 	Max phase no-delay instances is 1000.
[    0.000000] smp: Bringing up secondary CPUs ...
[    0.000000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.000000] CPU1: Spectre v2: using BPIALL workaround
[    0.000000] smp: Brought up 1 node, 2 CPUs
[    0.000000] SMP: Total of 2 processors activated (2132.00 BogoMIPS).
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] devtmpfs: initialized
[    0.000000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 1
[    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.000000] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
[    0.000000] pinctrl core: initialized pinctrl subsystem
[    0.000000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.000000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.000000] thermal_sys: Registered thermal governor 'step_wise'
[    0.000000] No ATAGs?
[    0.000000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
[    0.000000] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.000000] sh-pfc e0140200.pinctrl: emev2_pfc support registered
[    0.000000] SCSI subsystem initialized
[    0.000000] libata version 3.00 loaded.
[    0.000000] usbcore: registered new interface driver usbfs
[    0.000000] usbcore: registered new interface driver hub
[    0.000000] usbcore: registered new device driver usb
[    0.000000] mc: Linux media interface: v0.10
[    0.000000] videodev: Linux video capture interface: v2.00
[    0.000000] pps_core: LinuxPPS API ver. 1 registered
[    0.000000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.000000] PTP clock support registered
[    0.000000] em_sti e0180000.timer: used for clock events
[    0.000000] em_sti e0180000.timer: used for oneshot clock events
[    0.000000] em_sti e0180000.timer: used as clock source
[    0.000000] clocksource: e0180000.timer: mask: 0xffffffffffff max_cycles: 0x1ef4687b1, max_idle_ns: 112843571739654 ns
[    0.000000] Advanced Linux Sound Architecture Driver Initialized.
[    0.000000] vgaarb: loaded
[    0.890000] clocksource: Switched to clocksource e0180000.timer
[    0.900000] Clockevents: could not switch to one-shot mode:
[    0.900000] Clockevents: could not switch to one-shot mode: dummy_timer is not functional.
[    0.900000]  dummy_timer is not functional.
[    0.910000] NET: Registered PF_INET protocol family
[    0.910000] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.910000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.910000] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.910000] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.910000] TCP bind hash table entries: 1024 (order: 2, 16384 bytes, linear)
[    0.910000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.910000] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.910000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.910000] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.910000] RPC: Registered named UNIX socket transport module.
[    0.910000] RPC: Registered udp transport module.
[    0.910000] RPC: Registered tcp transport module.
[    0.910000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.910000] PCI: CLS 0 bytes, default 64
[    0.950000] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
[    0.950000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.950000] NFS: Registering the id_resolver key type
[    0.950000] Key type id_resolver registered
[    0.950000] Key type id_legacy registered
[    0.950000] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.950000] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.960000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[    0.960000] io scheduler mq-deadline registered
[    0.960000] io scheduler kyber registered
[    0.960000] io scheduler bfq registered
[    0.970000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.970000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37, base_baud = 796444) is a TI16750
[    0.970000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38, base_baud = 7168000) is a TI16750
[    0.970000] printk: console [ttyS1] enabled
[    1.660000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39, base_baud = 14336000) is a TI16750
[    1.670000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40, base_baud = 2389333) is a TI16750
[    1.680000] SuperH (H)SCI(F) driver initialized
[    1.700000] CAN device driver interface
[    1.760000] smsc911x 20000000.ethernet eth0: MAC Address: 00:0a:a3:02:12:92
[    1.770000] UDC core: g_ether: couldn't find an available UDC
[    1.770000] i2c_dev: i2c /dev entries driver
[    1.780000] em-i2c e0070000.i2c: Added i2c controller 0, irq 42
[    1.790000] em-i2c e10a0000.i2c: Added i2c controller 1, irq 43
[    1.800000] cpu cpu0: OPP table can't be empty
[    1.800000] usbcore: registered new interface driver usbhid
[    1.810000] usbhid: USB HID core driver
[    1.820000] NET: Registered PF_INET6 protocol family
[    1.820000] Segment Routing with IPv6
[    1.830000] In-situ OAM (IOAM) with IPv6
[    1.830000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.840000] NET: Registered PF_PACKET protocol family
[    1.840000] can: controller area network core
[    1.850000] NET: Registered PF_CAN protocol family
[    1.850000] can: raw protocol
[    1.860000] can: broadcast manager protocol
[    1.860000] can: netlink gateway - max_hops=1
[    1.870000] Key type dns_resolver registered
[    1.870000] Registering SWP/SWPB emulation handler
[    1.900000] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    1.960000] SMSC LAN8700 20000000.ethernet-ffffffff:01: attached PHY driver (mii_bus:phy_addr=20000000.ethernet-ffffffff:01, irq=POLL)
[    2.000000] smsc911x 20000000.ethernet eth0: SMSC911x/921x identified at 0xc8920000, IRQ: 41
[    4.080000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    4.130000] Sending DHCP requests ., OK
[    4.170000] IP-Config: Got DHCP answer from 10.0.1.1, my address is 10.0.1.2
[    4.180000] IP-Config: Complete:
[    4.180000]      device=eth0, hwaddr=00:0a:a3:02:12:92, ipaddr=10.0.1.2, mask=255.255.255.0, gw=10.0.1.1
[    4.190000]      host=10.0.1.2, domain=dyn.berto.se, nis-domain=(none)
[    4.200000]      bootserver=10.0.1.1, rootserver=10.0.1.1, rootpath=/srv/nfs4/arch,tcp,v3
[    4.200000]      nameserver0=192.168.20.1
[    4.210000] ALSA device list:
[    4.210000]   No soundcards found.
[    4.240000] VFS: Mounted root (nfs filesystem) on device 0:15.
[    4.240000] devtmpfs: mounted
[    4.250000] Freeing unused kernel image (initmem) memory: 1024K
[    4.290000] Run /sbin/init as init process
[    4.290000]   with arguments:
[    4.290000]     /sbin/init
[    4.300000]   with environment:
[    4.300000]     HOME=/
[    4.300000]     TERM=linux
[    5.980000] systemd[1]: System time before build time, advancing clock.
[    6.030000] systemd[1]: Failed to find module 'autofs4'
[    6.160000] systemd[1]: systemd 252.5-1-arch running in system mode (+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
[    6.190000] systemd[1]: Detected architecture arm.
[    6.260000] systemd[1]: Hostname set to <arm>.
[    6.510000] systemd[1]: bpf-lsm: BPF LSM hook not enabled in the kernel, BPF LSM not supported
[    6.520000] memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=1 'systemd'
[    8.810000] systemd[1]: Queued start job for default target Graphical Interface.
[    8.830000] systemd[1]: Created slice Slice /system/getty.
[    8.870000] systemd[1]: Created slice Slice /system/modprobe.
[    8.910000] systemd[1]: Created slice Slice /system/serial-getty.
[    8.950000] systemd[1]: Created slice User and Session Slice.
[    8.990000] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[    9.030000] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    9.070000] systemd[1]: Arbitrary Executable File Formats File System Automount Point was skipped because of an unmet condition check (ConditionPathExists=/proc/sys/fs/binfmt_misc).
[    9.080000] systemd[1]: Reached target Local Encrypted Volumes.
[    9.120000] systemd[1]: Reached target Local Integrity Protected Volumes.
[    9.160000] systemd[1]: Reached target Network is Online.
[    9.200000] systemd[1]: Reached target Path Units.
[    9.240000] systemd[1]: Reached target Slice Units.
[    9.280000] systemd[1]: Reached target Swaps.
[    9.320000] systemd[1]: Reached target Local Verity Protected Volumes.
[    9.360000] systemd[1]: Listening on Device-mapper event daemon FIFOs.
[    9.420000] systemd[1]: Listening on Process Core Dump Socket.
[    9.460000] systemd[1]: Journal Audit Socket was skipped because of an unmet condition check (ConditionSecurity=audit).
[    9.470000] systemd[1]: Listening on Journal Socket (/dev/log).
[    9.510000] systemd[1]: Listening on Journal Socket.
[    9.550000] systemd[1]: Listening on udev Control Socket.
[    9.590000] systemd[1]: Listening on udev Kernel Socket.
[    9.630000] systemd[1]: Huge Pages File System was skipped because of an unmet condition check (ConditionPathExists=/sys/kernel/mm/hugepages).
[    9.640000] systemd[1]: POSIX Message Queue File System was skipped because of an unmet condition check (ConditionPathExists=/proc/sys/fs/mqueue).
[    9.710000] systemd[1]: Mounting /root/shared...
[    9.750000] systemd[1]: Mounting Kernel Debug File System...
[    9.790000] systemd[1]: Mounting Kernel Trace File System...
[    9.850000] systemd[1]: Mounting Temporary Directory /tmp...
[    9.900000] systemd[1]: Create List of Static Device Nodes was skipped because of an unmet condition check (ConditionFileNotEmpty=/lib/modules/6.2.0-rc7-next-20230210-12179-g91bd68019b4b/modules.devname).
[    9.960000] systemd[1]: Starting Load Kernel Module configfs...
[    9.990000] systemd[1]: Starting Load Kernel Module drm...
[   10.040000] systemd[1]: Starting Load Kernel Module fuse...
[   10.120000] systemd[1]: Load Kernel Modules was skipped because no trigger condition checks were met.
[   10.210000] systemd[1]: Starting Remount Root and Kernel File Systems...
[   10.250000] systemd[1]: Repartition Root Disk was skipped because no trigger condition checks were met.
[   10.270000] systemd[1]: Starting Apply Kernel Variables...
[   10.360000] systemd[1]: Starting Coldplug All udev Devices...
[   10.440000] systemd[1]: Mounted Kernel Debug File System.
[   10.480000] systemd[1]: Mounted Kernel Trace File System.
[   10.510000] systemd[1]: Mounted Temporary Directory /tmp.
[   10.560000] systemd[1]: modprobe@configfs.service: Deactivated successfully.
[   10.570000] systemd[1]: Finished Load Kernel Module configfs.
[   10.640000] systemd[1]: modprobe@drm.service: Deactivated successfully.
[   10.660000] systemd[1]: Finished Load Kernel Module drm.
[   10.680000] systemd[1]: modprobe@fuse.service: Deactivated successfully.
[   10.690000] systemd[1]: Finished Load Kernel Module fuse.
[   10.730000] systemd[1]: Finished Remount Root and Kernel File Systems.
[   10.770000] systemd[1]: Finished Apply Kernel Variables.
[   10.810000] systemd[1]: FUSE Control File System was skipped because of an unmet condition check (ConditionPathExists=/sys/fs/fuse/connections).
[   10.880000] systemd[1]: Mounting Kernel Configuration File System...
[   10.920000] systemd[1]: First Boot Wizard was skipped because of an unmet condition check (ConditionFirstBoot=yes).
[   10.930000] systemd[1]: Rebuild Hardware Database was skipped because of an unmet condition check (ConditionNeedsUpdate=/etc).
[   10.980000] systemd[1]: Starting Load/Save Random Seed...
[   11.010000] systemd[1]: Create System Users was skipped because no trigger condition checks were met.
[   11.030000] systemd[1]: Starting Create Static Device Nodes in /dev...
[   11.100000] systemd[1]: Mounted Kernel Configuration File System.
[   11.500000] systemd[1]: Reached target Host and Network Name Lookups.
[   11.540000] systemd[1]: Listening on RPCbind Server Activation Socket.
[   11.580000] systemd[1]: Reached target RPC Port Mapper.
[   11.650000] systemd[1]: Starting NFS status monitor for NFSv2/3 locking....
[   11.830000] systemd[1]: Finished Coldplug All udev Devices.
[   11.930000] systemd[1]: Starting RPC Bind...
[   12.270000] systemd[1]: Finished Create Static Device Nodes in /dev.
[   12.310000] systemd[1]: Reached target Preparation for Local File Systems.
[   12.350000] systemd[1]: Virtual Machine and Container Storage (Compatibility) was skipped because of an unmet condition check (ConditionPathExists=/var/lib/machines.raw).
[   12.370000] systemd[1]: Reached target Local File Systems.
[   12.410000] systemd[1]: Entropy Daemon based on the HAVEGE algorithm was skipped because of an unmet condition check (ConditionKernelVersion=<5.6).
[   12.430000] systemd[1]: Rebuild Dynamic Linker Cache was skipped because no trigger condition checks were met.
[   12.490000] systemd[1]: Starting Notify NFS peers of a restart...
[   12.540000] systemd[1]: Set Up Additional Binary Formats was skipped because no trigger condition checks were met.
[   12.550000] systemd[1]: systemd-journald.service: unit configures an IP firewall, but the local system does not support BPF/cgroup firewalling.
[   12.570000] systemd[1]: (This warning is only shown for the first unit using IP firewalling.)
[   12.620000] systemd[1]: Starting Journal Service...
[   12.690000] systemd[1]: Starting Rule-based Manager for Device Events and Files...
[   12.750000] systemd[1]: Started RPC Bind.
[   12.800000] systemd[1]: Started Notify NFS peers of a restart.
[   12.870000] systemd[1]: Started NFS status monitor for NFSv2/3 locking..
[   13.180000] systemd[1]: Started Journal Service.
[   17.010000] systemd-journald[86]: Received client request to flush runtime journal.
[   21.390000] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[   22.200000] random: dbus-daemon: uninitialized urandom read (12 bytes read)
[   51.370000] random: crng init done

-- 
Kind Regards,
Niklas Söderlund

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 14:09                       ` Niklas Söderlund
@ 2023-02-13 14:26                         ` Biju Das
  0 siblings, 0 replies; 35+ messages in thread
From: Biju Das @ 2023-02-13 14:26 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Jiri Slaby, Ilpo Järvinen, Geert Uytterhoeven, Magnus Damm,
	Greg Kroah-Hartman, linux-serial, Fabrizio Castro,
	linux-renesas-soc

Hi Niklas,

Thanks for the feedback.

> Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> Hi Biju,
> 
> On 2023-02-13 13:01:06 +0000, Biju Das wrote:
> > Please get files from here
> >
> 
> Thanks for the branch.
> 
> It boots and the serial console appears to be functioning as expected.
> Is there anything in particular you like me to test? I attach the full boot
> log in case it's useful for you.

Cool. It should be OK. Looks like RZ/V2M changes applies to EMMA mobile as well.

If you have cables, you could test {ttyS0, ttyS2, ttyS2} at {9600, 19200, 38400, 57600, 115200} bps
If it supports flow control, check that as well.

Eg:
stty -F /dev/ttyS0 115200
stty -F /dev/ttyS0 115200 crtscts

Open a teraterm and do below read/write testing

cat /dev/ttyS0 --> for reading
echo test > /dev/ttyS0 --> for writing

or Write a serial test program for read/write test on above baud rates.

If the cable is not available, you could also verify register settings
To check whether it matches with EMMA hardware manual.


dump() {

devmem2 0xA4040000  | grep Read
devmem2 0xA4040004  | grep Read
devmem2 0xA4040008  | grep Read
devmem2 0xA404000C  | grep Read

devmem2 0xA4040010  | grep Read
devmem2 0xA4040014  | grep Read
devmem2 0xA4040018  | grep Read
devmem2 0xA404001C  | grep Read

devmem2 0xA4040020  | grep Read
devmem2 0xA4040024  | grep Read  # DLAB(LCR[7]) 0x1B
devmem2 0xA4040028  | grep Read  # DLAB(LCR[7]) 0x1B
devmem2 0xA404002C  | grep Read

devmem2 0xA4040030  | grep Read
devmem2 0xA4040034  | grep Read
}

dump

Cheers,
Biju




> 
> [    0.000000] Booting Linux on physical CPU 0x0
> [    0.000000] Linux version 6.2.0-rc7-next-20230210-12179-g91bd68019b4b
> (neg@sleipner) (arm-linux-gnueabihf-gcc (GCC) 10.2.0, GNU ld (GNU Binutils)
> 2.35.1) #2 SMP Mon Feb 13 15:02:12 CET 2023
> [    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7),
> cr=10c5387d
> [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
> instruction cache
> [    0.000000] OF: fdt: Machine model: EMEV2 KZM9D Board
> [    0.000000] printk: debug: ignoring loglevel setting.
> [    0.000000] Memory policy: Data cache writealloc
> [    0.000000] cma: Failed to reserve 128 MiB
> [    0.000000] Zone ranges:
> [    0.000000]   Normal   [mem 0x0000000040000000-0x0000000047ffffff]
> [    0.000000]   HighMem  empty
> [    0.000000] Movable zone start for each node
> [    0.000000] Early memory node ranges
> [    0.000000]   node   0: [mem 0x0000000040000000-0x0000000047ffffff]
> [    0.000000] Initmem setup node 0 [mem 0x0000000040000000-
> 0x0000000047ffffff]
> [    0.000000] percpu: Embedded 14 pages/cpu s33620 r0 d23724 u57344
> [    0.000000] pcpu-alloc: s33620 r0 d23724 u57344 alloc=14*4096
> [    0.000000] pcpu-alloc: [0] 0 [0] 1
> [    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 32512
> [    0.000000] Kernel command line: ignore_loglevel rw root=/dev/nfs ip=on
> [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536
> bytes, linear)
> [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes,
> linear)
> [    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
> [    0.000000] Memory: 116068K/131072K available (8192K kernel code, 1150K
> rwdata, 2596K rodata, 1024K init, 251K bss, 15004K reserved, 0K cma-
> reserved, 0K highmem)
> [    0.000000] trace event string verifier disabled
> [    0.000000] rcu: Hierarchical RCU implementation.
> [    0.000000] rcu: 	RCU event tracing is enabled.
> [    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to
> nr_cpu_ids=2.
> [    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10
> jiffies.
> [    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
> [    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
> [    0.000000] GIC: enabling workaround for broken byte access
> [    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on
> contention.
> [    0.000000] timer_probe: no matching timers found
> [    0.000000] Console: colour dummy device 80x30
> [    0.000000] printk: console [tty0] enabled
> [    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps
> every 21474836475000000ns
> [    0.000000] Calibrating delay loop (skipped) preset value.. 1066.00
> BogoMIPS (lpj=5330000)
> [    0.000000] pid_max: default: 32768 minimum: 301
> [    0.000000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes,
> linear)
> [    0.000000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
> bytes, linear)
> [    0.000000] CPU: Testing write buffer coherency: ok
> [    0.000000] CPU0: Spectre v2: using BPIALL workaround
> [    0.000000] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
> [    0.000000] Setting up static identity map for 0x40100000 - 0x40100060
> [    0.000000] rcu: Hierarchical SRCU implementation.
> [    0.000000] rcu: 	Max phase no-delay instances is 1000.
> [    0.000000] smp: Bringing up secondary CPUs ...
> [    0.000000] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
> [    0.000000] CPU1: Spectre v2: using BPIALL workaround
> [    0.000000] smp: Brought up 1 node, 2 CPUs
> [    0.000000] SMP: Total of 2 processors activated (2132.00 BogoMIPS).
> [    0.000000] CPU: All CPU(s) started in SVC mode.
> [    0.000000] devtmpfs: initialized
> [    0.000000] VFP support v0.3: implementor 41 architecture 3 part 30
> variant 9 rev 1
> [    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles:
> 0xffffffff, max_idle_ns: 19112604462750000 ns
> [    0.000000] futex hash table entries: 512 (order: 3, 32768 bytes, linear)
> [    0.000000] pinctrl core: initialized pinctrl subsystem
> [    0.000000] NET: Registered PF_NETLINK/PF_ROUTE protocol family
> [    0.000000] DMA: preallocated 256 KiB pool for atomic coherent
> allocations
> [    0.000000] thermal_sys: Registered thermal governor 'step_wise'
> [    0.000000] No ATAGs?
> [    0.000000] hw-breakpoint: found 5 (+1 reserved) breakpoint and 1
> watchpoint registers.
> [    0.000000] hw-breakpoint: maximum watchpoint size is 4 bytes.
> [    0.000000] sh-pfc e0140200.pinctrl: emev2_pfc support registered
> [    0.000000] SCSI subsystem initialized
> [    0.000000] libata version 3.00 loaded.
> [    0.000000] usbcore: registered new interface driver usbfs
> [    0.000000] usbcore: registered new interface driver hub
> [    0.000000] usbcore: registered new device driver usb
> [    0.000000] mc: Linux media interface: v0.10
> [    0.000000] videodev: Linux video capture interface: v2.00
> [    0.000000] pps_core: LinuxPPS API ver. 1 registered
> [    0.000000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
> Giometti <giometti@linux.it>
> [    0.000000] PTP clock support registered
> [    0.000000] em_sti e0180000.timer: used for clock events
> [    0.000000] em_sti e0180000.timer: used for oneshot clock events
> [    0.000000] em_sti e0180000.timer: used as clock source
> [    0.000000] clocksource: e0180000.timer: mask: 0xffffffffffff max_cycles:
> 0x1ef4687b1, max_idle_ns: 112843571739654 ns
> [    0.000000] Advanced Linux Sound Architecture Driver Initialized.
> [    0.000000] vgaarb: loaded
> [    0.890000] clocksource: Switched to clocksource e0180000.timer
> [    0.900000] Clockevents: could not switch to one-shot mode:
> [    0.900000] Clockevents: could not switch to one-shot mode: dummy_timer
> is not functional.
> [    0.900000]  dummy_timer is not functional.
> [    0.910000] NET: Registered PF_INET protocol family
> [    0.910000] IP idents hash table entries: 2048 (order: 2, 16384 bytes,
> linear)
> [    0.910000] tcp_listen_portaddr_hash hash table entries: 512 (order: 0,
> 4096 bytes, linear)
> [    0.910000] Table-perturb hash table entries: 65536 (order: 6, 262144
> bytes, linear)
> [    0.910000] TCP established hash table entries: 1024 (order: 0, 4096
> bytes, linear)
> [    0.910000] TCP bind hash table entries: 1024 (order: 2, 16384 bytes,
> linear)
> [    0.910000] TCP: Hash tables configured (established 1024 bind 1024)
> [    0.910000] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
> [    0.910000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes,
> linear)
> [    0.910000] NET: Registered PF_UNIX/PF_LOCAL protocol family
> [    0.910000] RPC: Registered named UNIX socket transport module.
> [    0.910000] RPC: Registered udp transport module.
> [    0.910000] RPC: Registered tcp transport module.
> [    0.910000] RPC: Registered tcp NFSv4.1 backchannel transport module.
> [    0.910000] PCI: CLS 0 bytes, default 64
> [    0.950000] hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7
> counters available
> [    0.950000] workingset: timestamp_bits=30 max_order=15 bucket_order=0
> [    0.950000] NFS: Registering the id_resolver key type
> [    0.950000] Key type id_resolver registered
> [    0.950000] Key type id_legacy registered
> [    0.950000] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
> [    0.950000] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver
> Registering...
> [    0.960000] Block layer SCSI generic (bsg) driver version 0.4 loaded
> (major 246)
> [    0.960000] io scheduler mq-deadline registered
> [    0.960000] io scheduler kyber registered
> [    0.960000] io scheduler bfq registered
> [    0.970000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
> [    0.970000] e1020000.serial: ttyS0 at MMIO 0xe1020000 (irq = 37,
> base_baud = 796444) is a TI16750
> [    0.970000] e1030000.serial: ttyS1 at MMIO 0xe1030000 (irq = 38,
> base_baud = 7168000) is a TI16750
> [    0.970000] printk: console [ttyS1] enabled
> [    1.660000] e1040000.serial: ttyS2 at MMIO 0xe1040000 (irq = 39,
> base_baud = 14336000) is a TI16750
> [    1.670000] e1050000.serial: ttyS3 at MMIO 0xe1050000 (irq = 40,
> base_baud = 2389333) is a TI16750
> [    1.680000] SuperH (H)SCI(F) driver initialized
> [    1.700000] CAN device driver interface
> [    1.760000] smsc911x 20000000.ethernet eth0: MAC Address:
> 00:0a:a3:02:12:92
> [    1.770000] UDC core: g_ether: couldn't find an available UDC
> [    1.770000] i2c_dev: i2c /dev entries driver
> [    1.780000] em-i2c e0070000.i2c: Added i2c controller 0, irq 42
> [    1.790000] em-i2c e10a0000.i2c: Added i2c controller 1, irq 43
> [    1.800000] cpu cpu0: OPP table can't be empty
> [    1.800000] usbcore: registered new interface driver usbhid
> [    1.810000] usbhid: USB HID core driver
> [    1.820000] NET: Registered PF_INET6 protocol family
> [    1.820000] Segment Routing with IPv6
> [    1.830000] In-situ OAM (IOAM) with IPv6
> [    1.830000] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
> [    1.840000] NET: Registered PF_PACKET protocol family
> [    1.840000] can: controller area network core
> [    1.850000] NET: Registered PF_CAN protocol family
> [    1.850000] can: raw protocol
> [    1.860000] can: broadcast manager protocol
> [    1.860000] can: netlink gateway - max_hops=1
> [    1.870000] Key type dns_resolver registered
> [    1.870000] Registering SWP/SWPB emulation handler
> [    1.900000] input: gpio_keys as /devices/platform/gpio_keys/input/input0
> [    1.960000] SMSC LAN8700 20000000.ethernet-ffffffff:01: attached PHY
> driver (mii_bus:phy_addr=20000000.ethernet-ffffffff:01, irq=POLL)
> [    2.000000] smsc911x 20000000.ethernet eth0: SMSC911x/921x identified at
> 0xc8920000, IRQ: 41
> [    4.080000] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
> [    4.130000] Sending DHCP requests ., OK
> [    4.170000] IP-Config: Got DHCP answer from 10.0.1.1, my address is
> 10.0.1.2
> [    4.180000] IP-Config: Complete:
> [    4.180000]      device=eth0, hwaddr=00:0a:a3:02:12:92, ipaddr=10.0.1.2,
> mask=255.255.255.0, gw=10.0.1.1
> [    4.190000]      host=10.0.1.2, domain=dyn.berto.se, nis-domain=(none)
> [    4.200000]      bootserver=10.0.1.1, rootserver=10.0.1.1,
> rootpath=/srv/nfs4/arch,tcp,v3
> [    4.200000]      nameserver0=192.168.20.1
> [    4.210000] ALSA device list:
> [    4.210000]   No soundcards found.
> [    4.240000] VFS: Mounted root (nfs filesystem) on device 0:15.
> [    4.240000] devtmpfs: mounted
> [    4.250000] Freeing unused kernel image (initmem) memory: 1024K
> [    4.290000] Run /sbin/init as init process
> [    4.290000]   with arguments:
> [    4.290000]     /sbin/init
> [    4.300000]   with environment:
> [    4.300000]     HOME=/
> [    4.300000]     TERM=linux
> [    5.980000] systemd[1]: System time before build time, advancing clock.
> [    6.030000] systemd[1]: Failed to find module 'autofs4'
> [    6.160000] systemd[1]: systemd 252.5-1-arch running in system mode (+PAM
> +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL
> +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP
> +LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB
> +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified)
> [    6.190000] systemd[1]: Detected architecture arm.
> [    6.260000] systemd[1]: Hostname set to <arm>.
> [    6.510000] systemd[1]: bpf-lsm: BPF LSM hook not enabled in the kernel,
> BPF LSM not supported
> [    6.520000] memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=1
> 'systemd'
> [    8.810000] systemd[1]: Queued start job for default target Graphical
> Interface.
> [    8.830000] systemd[1]: Created slice Slice /system/getty.
> [    8.870000] systemd[1]: Created slice Slice /system/modprobe.
> [    8.910000] systemd[1]: Created slice Slice /system/serial-getty.
> [    8.950000] systemd[1]: Created slice User and Session Slice.
> [    8.990000] systemd[1]: Started Dispatch Password Requests to Console
> Directory Watch.
> [    9.030000] systemd[1]: Started Forward Password Requests to Wall
> Directory Watch.
> [    9.070000] systemd[1]: Arbitrary Executable File Formats File System
> Automount Point was skipped because of an unmet condition check
> (ConditionPathExists=/proc/sys/fs/binfmt_misc).
> [    9.080000] systemd[1]: Reached target Local Encrypted Volumes.
> [    9.120000] systemd[1]: Reached target Local Integrity Protected Volumes.
> [    9.160000] systemd[1]: Reached target Network is Online.
> [    9.200000] systemd[1]: Reached target Path Units.
> [    9.240000] systemd[1]: Reached target Slice Units.
> [    9.280000] systemd[1]: Reached target Swaps.
> [    9.320000] systemd[1]: Reached target Local Verity Protected Volumes.
> [    9.360000] systemd[1]: Listening on Device-mapper event daemon FIFOs.
> [    9.420000] systemd[1]: Listening on Process Core Dump Socket.
> [    9.460000] systemd[1]: Journal Audit Socket was skipped because of an
> unmet condition check (ConditionSecurity=audit).
> [    9.470000] systemd[1]: Listening on Journal Socket (/dev/log).
> [    9.510000] systemd[1]: Listening on Journal Socket.
> [    9.550000] systemd[1]: Listening on udev Control Socket.
> [    9.590000] systemd[1]: Listening on udev Kernel Socket.
> [    9.630000] systemd[1]: Huge Pages File System was skipped because of an
> unmet condition check (ConditionPathExists=/sys/kernel/mm/hugepages).
> [    9.640000] systemd[1]: POSIX Message Queue File System was skipped
> because of an unmet condition check
> (ConditionPathExists=/proc/sys/fs/mqueue).
> [    9.710000] systemd[1]: Mounting /root/shared...
> [    9.750000] systemd[1]: Mounting Kernel Debug File System...
> [    9.790000] systemd[1]: Mounting Kernel Trace File System...
> [    9.850000] systemd[1]: Mounting Temporary Directory /tmp...
> [    9.900000] systemd[1]: Create List of Static Device Nodes was skipped
> because of an unmet condition check
> (ConditionFileNotEmpty=/lib/modules/6.2.0-rc7-next-20230210-12179-
> g91bd68019b4b/modules.devname).
> [    9.960000] systemd[1]: Starting Load Kernel Module configfs...
> [    9.990000] systemd[1]: Starting Load Kernel Module drm...
> [   10.040000] systemd[1]: Starting Load Kernel Module fuse...
> [   10.120000] systemd[1]: Load Kernel Modules was skipped because no
> trigger condition checks were met.
> [   10.210000] systemd[1]: Starting Remount Root and Kernel File Systems...
> [   10.250000] systemd[1]: Repartition Root Disk was skipped because no
> trigger condition checks were met.
> [   10.270000] systemd[1]: Starting Apply Kernel Variables...
> [   10.360000] systemd[1]: Starting Coldplug All udev Devices...
> [   10.440000] systemd[1]: Mounted Kernel Debug File System.
> [   10.480000] systemd[1]: Mounted Kernel Trace File System.
> [   10.510000] systemd[1]: Mounted Temporary Directory /tmp.
> [   10.560000] systemd[1]: modprobe@configfs.service: Deactivated
> successfully.
> [   10.570000] systemd[1]: Finished Load Kernel Module configfs.
> [   10.640000] systemd[1]: modprobe@drm.service: Deactivated successfully.
> [   10.660000] systemd[1]: Finished Load Kernel Module drm.
> [   10.680000] systemd[1]: modprobe@fuse.service: Deactivated successfully.
> [   10.690000] systemd[1]: Finished Load Kernel Module fuse.
> [   10.730000] systemd[1]: Finished Remount Root and Kernel File Systems.
> [   10.770000] systemd[1]: Finished Apply Kernel Variables.
> [   10.810000] systemd[1]: FUSE Control File System was skipped because of
> an unmet condition check (ConditionPathExists=/sys/fs/fuse/connections).
> [   10.880000] systemd[1]: Mounting Kernel Configuration File System...
> [   10.920000] systemd[1]: First Boot Wizard was skipped because of an unmet
> condition check (ConditionFirstBoot=yes).
> [   10.930000] systemd[1]: Rebuild Hardware Database was skipped because of
> an unmet condition check (ConditionNeedsUpdate=/etc).
> [   10.980000] systemd[1]: Starting Load/Save Random Seed...
> [   11.010000] systemd[1]: Create System Users was skipped because no
> trigger condition checks were met.
> [   11.030000] systemd[1]: Starting Create Static Device Nodes in /dev...
> [   11.100000] systemd[1]: Mounted Kernel Configuration File System.
> [   11.500000] systemd[1]: Reached target Host and Network Name Lookups.
> [   11.540000] systemd[1]: Listening on RPCbind Server Activation Socket.
> [   11.580000] systemd[1]: Reached target RPC Port Mapper.
> [   11.650000] systemd[1]: Starting NFS status monitor for NFSv2/3
> locking....
> [   11.830000] systemd[1]: Finished Coldplug All udev Devices.
> [   11.930000] systemd[1]: Starting RPC Bind...
> [   12.270000] systemd[1]: Finished Create Static Device Nodes in /dev.
> [   12.310000] systemd[1]: Reached target Preparation for Local File
> Systems.
> [   12.350000] systemd[1]: Virtual Machine and Container Storage
> (Compatibility) was skipped because of an unmet condition check
> (ConditionPathExists=/var/lib/machines.raw).
> [   12.370000] systemd[1]: Reached target Local File Systems.
> [   12.410000] systemd[1]: Entropy Daemon based on the HAVEGE algorithm was
> skipped because of an unmet condition check (ConditionKernelVersion=<5.6).
> [   12.430000] systemd[1]: Rebuild Dynamic Linker Cache was skipped because
> no trigger condition checks were met.
> [   12.490000] systemd[1]: Starting Notify NFS peers of a restart...
> [   12.540000] systemd[1]: Set Up Additional Binary Formats was skipped
> because no trigger condition checks were met.
> [   12.550000] systemd[1]: systemd-journald.service: unit configures an IP
> firewall, but the local system does not support BPF/cgroup firewalling.
> [   12.570000] systemd[1]: (This warning is only shown for the first unit
> using IP firewalling.)
> [   12.620000] systemd[1]: Starting Journal Service...
> [   12.690000] systemd[1]: Starting Rule-based Manager for Device Events and
> Files...
> [   12.750000] systemd[1]: Started RPC Bind.
> [   12.800000] systemd[1]: Started Notify NFS peers of a restart.
> [   12.870000] systemd[1]: Started NFS status monitor for NFSv2/3 locking..
> [   13.180000] systemd[1]: Started Journal Service.
> [   17.010000] systemd-journald[86]: Received client request to flush
> runtime journal.
> [   21.390000] random: dbus-daemon: uninitialized urandom read (12 bytes
> read)
> [   22.200000] random: dbus-daemon: uninitialized urandom read (12 bytes
> read)
> [   51.370000] random: crng init done
> 
> --
> Kind Regards,
> Niklas Söderlund

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750
  2023-02-13  6:26   ` Jiri Slaby
@ 2023-02-13 16:02     ` Biju Das
  0 siblings, 0 replies; 35+ messages in thread
From: Biju Das @ 2023-02-13 16:02 UTC (permalink / raw)
  To: Jiri Slaby, Greg Kroah-Hartman, Andy Shevchenko, Ilpo Järvinen
  Cc: Geert Uytterhoeven, linux-serial, Fabrizio Castro,
	linux-renesas-soc, Niklas Söderlund

Hi All,

> -----Original Message-----
> From: Jiri Slaby <jirislaby@kernel.org>
> Sent: Monday, February 13, 2023 6:26 AM
> To: Biju Das <biju.das.jz@bp.renesas.com>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>
> Cc: Geert Uytterhoeven <geert+renesas@glider.be>; linux-
> serial@vger.kernel.org; Fabrizio Castro <fabrizio.castro.jz@renesas.com>;
> linux-renesas-soc@vger.kernel.org; Ilpo Järvinen
> <ilpo.jarvinen@linux.intel.com>
> Subject: Re: [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as
> PORT_16750
> 
> On 10. 02. 23, 21:34, Biju Das wrote:
> > The UART IP found on RZ/V2M SoC is Register-compatible with the
> > general-purpose 16750 UART chip. This patch updates RZ/V2M port type
> > from 16550A->16750 and also enables 64-bytes fifo support.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 
> Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
> 

Thanks Niklas, for testing on EMEV2.

EMMA-mobile has same register layout like RZ/V2M
and is Register-compatible with the general-purpose 16750 UART chip.

So, I would like to add same type and flags for both the SoCs,
for the next version of the patch series.

I guess it is ok for everyone.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info
  2023-02-13 12:18                         ` Biju Das
@ 2023-02-13 16:06                           ` Biju Das
  0 siblings, 0 replies; 35+ messages in thread
From: Biju Das @ 2023-02-13 16:06 UTC (permalink / raw)
  To: Ilpo Järvinen, Jiri Slaby, Andy Shevchenko
  Cc: Geert Uytterhoeven, Magnus Damm, Niklas Söderlund,
	Greg Kroah-Hartman, linux-serial, Fabrizio Castro,
	linux-renesas-soc

Hi All,

> Subject: RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct
> serial8250_em_hw_info
> 
> Hi Ilpo Järvinen,
> 
> Thanks for feedback.
> 
> > -----Original Message-----
> > From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > Sent: Monday, February 13, 2023 12:05 PM
> > To: Biju Das <biju.das.jz@bp.renesas.com>
> > Cc: Jiri Slaby <jirislaby@kernel.org>; Geert Uytterhoeven
> > <geert+renesas@glider.be>; Magnus Damm <magnus.damm@gmail.com>; Niklas
> > Söderlund <niklas.soderlund@ragnatech.se>; Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org>; linux-serial
> > <linux-serial@vger.kernel.org>; Fabrizio Castro
> > <fabrizio.castro.jz@renesas.com>; linux-renesas- soc@vger.kernel.org
> > Subject: RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to
> > struct serial8250_em_hw_info
> >
> > On Mon, 13 Feb 2023, Biju Das wrote:
> >
> > > Hi Ilpo,
> > >
> > > Thanks for the feedback.
> > >
> > > > Subject: RE: [PATCH v3 3/3] serial: 8250_em: Add serial_out() to
> > > > struct serial8250_em_hw_info
> > > >
> > > > On Mon, 13 Feb 2023, Biju Das wrote:
> > > >
> > > > > Hi Jiri Slaby,
> > > > >
> > > > > Thanks for the feedback.
> > > > >
> > > > > > Subject: Re: [PATCH v3 3/3] serial: 8250_em: Add serial_out()
> > > > > > to struct serial8250_em_hw_info
> > > > > >
> > > > > > On 13. 02. 23, 10:31, Biju Das wrote:
> > > > > > > So looks like similar to other macros, UART_FCR_EM (0x3) is
> > > > > > > sensible
> > > > one.
> > > > > > >
> > > > > > > UART_FCR_RO_OFFSET (9)
> > > > > > > UART_FCR_RO_EM (UART_FCR_EM + UART_FCR_RO_OFFSET)
> > > > > > >
> > > > > > >
> > > > > > > static unsigned int serial8250_em_serial_in(struct uart_port
> > > > > > > *p, int
> > > > > > > offset) case UART_FCR_RO_EM:
> > > > > > > 	return readl(p->membase + (offset - UART_FCR_RO_OFFSET <<
> > > > > > > 2));
> > > > > >
> > > > > >
> > > > > > Please send a complete patch as a reply. I am completely lost now.
> > > > >
> > > > > Please find the complete patc.
> > > > >
> > > > >
> > > > > From e597ae60eb170c1f1b650e1e533bf4e12c09f822 Mon Sep 17
> > > > > 00:00:00
> > > > > 2001
> > > > > From: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > Date: Tue, 7 Feb 2023 15:07:13 +0000
> > > > > Subject: [PATCH] serial: 8250_em: Add serial_out() to struct
> > > > > serial8250_em_hw_info
> > > > >
> > > > > As per RZ/V2M hardware manual(Rev.1.30 Jun, 2022), UART IP has a
> > > > > restriction as mentioned below.
> > > > >
> > > > > 40.6.1 Point for Caution when Changing the Register Settings:
> > > > >
> > > > > When changing the settings of the following registers, a PRESETn
> > > > > master reset or FIFO reset + SW reset (FCR[2],FCR[1], HCR0[7])
> > > > > must be input to re-initialize them.
> > > > >
> > > > > Target Registers: FCR, LCR, MCR, DLL, DLM, HCR0.
> > > > >
> > > > > This patch adds serial_out() to struct serial8250_em_hw_info to
> > > > > handle this difference between emma mobile and rz/v2m.
> > > > >
> > > > > DLL/DLM register can be updated only by setting LCR[7]. So the
> > > > > updation of LCR[7] will perform reset for DLL/DLM register changes.
> > > > >
> > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > > > > ---
> > > > >  drivers/tty/serial/8250/8250_em.c | 70
> > > > > ++++++++++++++++++++++++++++++-
> > > > >  1 file changed, 69 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/tty/serial/8250/8250_em.c
> > > > > b/drivers/tty/serial/8250/8250_em.c
> > > > > index 69cd3b611501..c1c64f48ee7e 100644
> > > > > --- a/drivers/tty/serial/8250/8250_em.c
> > > > > +++ b/drivers/tty/serial/8250/8250_em.c
> > > > > @@ -17,12 +17,23 @@
> > > > >
> > > > >  #include "8250.h"
> > > > >
> > > > > +#define UART_FCR_EM 3
> > > > >  #define UART_DLL_EM 9
> > > > >  #define UART_DLM_EM 10
> > > > > +#define UART_HCR0_EM 11
> > > > > +
> > > > > +#define UART_FCR_R_EM	(UART_FCR_EM + UART_HCR0_EM)
> > > >
> > > > It's easy to lose track of all this, IMHO this would be simple:
> > > >
> > > > /*
> > > >  * A high value for UART_FCR_EM avoids overlapping with existing
> > > > UART_*
> > > >  * register defines. UART_FCR_EM_HW is the real HW register offset.
> > > >  */
> > > > #define UART_FCR_EM 12
> > >
> > > I will change it to #define UART_FCR_EM 14
> > >
> > > And will add the below unused HW status registers in the driver.
> > >
> > > #define UART_HCR2_EM 12 (@30)
> > > #define UART_HCR3_EM 13 (@34)
> > >
> > > Is it ok?
> >
> > It's okay, that number is pseudo one anyway so the actual number
> > doesn't matter. One could just as well pick some large number such as
> > 0x10003 or so if the collision with real regs is a concern.
> 
> OK will use 0x10003, as pseudo offset.

I would like to use same Hardware restriction for both RZ/V2M and EMMA-Mobile
as both the SoC's have same register sets and it works ok on both these platforms,
after this restriction is applied.

I guess it is ok for everyone.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 35+ messages in thread

* RE: [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe()
  2023-02-13  6:23   ` Jiri Slaby
@ 2023-02-14 11:07     ` Biju Das
  0 siblings, 0 replies; 35+ messages in thread
From: Biju Das @ 2023-02-14 11:07 UTC (permalink / raw)
  To: Jiri Slaby, Greg Kroah-Hartman
  Cc: linux-serial, Geert Uytterhoeven, Fabrizio Castro,
	linux-renesas-soc, Andy Shevchenko

Hi Jiri Slaby,

Thanks for the feedback.


> Subject: Re: [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe()
> 
> On 10. 02. 23, 21:34, Biju Das wrote:
> > This patch simplifies probe() function by using dev_err_probe()
> > instead of dev_err in probe().
> >
> > While at it, remove the unused header file slab.h and added a local
> > variable 'dev' to replace '&pdev->dev' in probe().
> >
> > Also replace devm_clk_get->devm_clk_get_enabled and updated the clk
> > handling in probe() and remove().
> 
> Sorry, this "While at it" and "Also" is not allowed in a single patch.
> You do three completely distinct things in a single patch. Please separate
> (like prints+&dev, slab.h, and clk changes).

OK, will split into 3 patches as mentioned above.

> 
> And pretty please, don't send 3 (!) versions a day. Wait a week or so for
> reviews of a single version. No need to haste.

OK, next time will take care.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2023-02-14 11:10 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-10 20:34 [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Biju Das
2023-02-10 20:34 ` [PATCH v3 1/3] serial: 8250_em: Use dev_err_probe() Biju Das
2023-02-13  6:23   ` Jiri Slaby
2023-02-14 11:07     ` Biju Das
2023-02-10 20:34 ` [PATCH v3 2/3] serial: 8250_em: Update RZ/V2M port type as PORT_16750 Biju Das
2023-02-12 11:02   ` Andy Shevchenko
2023-02-13  6:26   ` Jiri Slaby
2023-02-13 16:02     ` Biju Das
2023-02-10 20:34 ` [PATCH v3 3/3] serial: 8250_em: Add serial_out() to struct serial8250_em_hw_info Biju Das
2023-02-12 11:09   ` Andy Shevchenko
2023-02-13  8:42   ` Ilpo Järvinen
2023-02-13  8:53     ` Biju Das
2023-02-13  9:10       ` Jiri Slaby
2023-02-13  9:12         ` Jiri Slaby
2023-02-13  9:14           ` Jiri Slaby
2023-02-13  9:31             ` Biju Das
2023-02-13  9:32               ` Jiri Slaby
2023-02-13 11:12                 ` Biju Das
2023-02-13 11:31                   ` Ilpo Järvinen
2023-02-13 11:40                     ` Biju Das
2023-02-13 12:05                       ` Ilpo Järvinen
2023-02-13 12:18                         ` Biju Das
2023-02-13 16:06                           ` Biju Das
2023-02-13  9:57               ` Niklas Söderlund
2023-02-13 10:06                 ` Biju Das
2023-02-13 10:29                   ` Niklas Söderlund
2023-02-13 13:01                     ` Biju Das
2023-02-13 14:09                       ` Niklas Söderlund
2023-02-13 14:26                         ` Biju Das
2023-02-13  9:22           ` Ilpo Järvinen
2023-02-13  9:28             ` Jiri Slaby
2023-02-13  9:40               ` Ilpo Järvinen
2023-02-13  9:53                 ` Jiri Slaby
2023-02-13  9:12       ` Ilpo Järvinen
2023-02-13  8:37 ` [PATCH v3 0/3] Update Renesas RZ/V2M UART Port type Ilpo Järvinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.