[3/7] tty: 8250: omap: introduce function to update mdr1
diff mbox

Message ID 597e0f4bf4455cb7755851f5c34a02fbdd0d4aeb.1436174801.git.nsekhar@ti.com
State New
Headers show

Commit Message

Sekhar Nori July 6, 2015, 9:47 a.m. UTC
updating mdr1 register on OMAP needs to take care of
errata i202. Introduce a function to update mdr1.

This will be useful later on when mdr1 needs to be
written to from other places. No functional change.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 drivers/tty/serial/8250/8250_omap.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Peter Hurley July 9, 2015, 12:29 a.m. UTC | #1
Hi Sekhar,

On 07/06/2015 05:47 AM, Sekhar Nori wrote:
> updating mdr1 register on OMAP needs to take care of
> errata i202. Introduce a function to update mdr1.
> 
> This will be useful later on when mdr1 needs to be
> written to from other places. No functional change.

This changelog is not clear. May I suggest:

serial: 8250_omap: Refactor MDR1 update

The errata [1] workaround implemented in follow-on patch,
"serial: 8250_omap: workaround errata on disabling UART after using DMA",
requires MDR1 register programming.

Extract MDR1 register update into helper function, omap8250_update_mdr1().

[1] Advisory 21 in http://www.ti.com/lit/er/sprz408b/sprz408b.pdf


Regards,
Peter Hurley

> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
>  drivers/tty/serial/8250/8250_omap.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 20c5b9c4c288..d9c96b993a84 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -232,6 +232,15 @@ static void omap8250_update_scr(struct uart_8250_port *up,
>  	serial_out(up, UART_OMAP_SCR, priv->scr);
>  }
>  
> +static void omap8250_update_mdr1(struct uart_8250_port *up,
> +				 struct omap8250_priv *priv)
> +{
> +	if (priv->habit & UART_ERRATA_i202_MDR1_ACCESS)
> +		omap_8250_mdr1_errataset(up, priv);
> +	else
> +		serial_out(up, UART_OMAP_MDR1, priv->mdr1);
> +}
> +
>  static void omap8250_restore_regs(struct uart_8250_port *up)
>  {
>  	struct omap8250_priv *priv = up->port.private_data;
> @@ -282,11 +291,9 @@ static void omap8250_restore_regs(struct uart_8250_port *up)
>  	serial_out(up, UART_XOFF1, priv->xoff);
>  
>  	serial_out(up, UART_LCR, up->lcr);
> -	/* need mode A for FCR */
> -	if (priv->habit & UART_ERRATA_i202_MDR1_ACCESS)
> -		omap_8250_mdr1_errataset(up, priv);
> -	else
> -		serial_out(up, UART_OMAP_MDR1, priv->mdr1);
> +
> +	omap8250_update_mdr1(up, priv);
> +
>  	up->port.ops->set_mctrl(&up->port, up->port.mctrl);
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sekhar Nori July 9, 2015, 11:20 a.m. UTC | #2
On Thursday 09 July 2015 05:59 AM, Peter Hurley wrote:
> Hi Sekhar,
> 
> On 07/06/2015 05:47 AM, Sekhar Nori wrote:
>> updating mdr1 register on OMAP needs to take care of
>> errata i202. Introduce a function to update mdr1.
>>
>> This will be useful later on when mdr1 needs to be
>> written to from other places. No functional change.
> 
> This changelog is not clear. May I suggest:
> 
> serial: 8250_omap: Refactor MDR1 update
> 
> The errata [1] workaround implemented in follow-on patch,
> "serial: 8250_omap: workaround errata on disabling UART after using DMA",
> requires MDR1 register programming.
> 
> Extract MDR1 register update into helper function, omap8250_update_mdr1().
> 
> [1] Advisory 21 in http://www.ti.com/lit/er/sprz408b/sprz408b.pdf

Alright, will use this description instead.

Thanks,
Sekhar

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 20c5b9c4c288..d9c96b993a84 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -232,6 +232,15 @@  static void omap8250_update_scr(struct uart_8250_port *up,
 	serial_out(up, UART_OMAP_SCR, priv->scr);
 }
 
+static void omap8250_update_mdr1(struct uart_8250_port *up,
+				 struct omap8250_priv *priv)
+{
+	if (priv->habit & UART_ERRATA_i202_MDR1_ACCESS)
+		omap_8250_mdr1_errataset(up, priv);
+	else
+		serial_out(up, UART_OMAP_MDR1, priv->mdr1);
+}
+
 static void omap8250_restore_regs(struct uart_8250_port *up)
 {
 	struct omap8250_priv *priv = up->port.private_data;
@@ -282,11 +291,9 @@  static void omap8250_restore_regs(struct uart_8250_port *up)
 	serial_out(up, UART_XOFF1, priv->xoff);
 
 	serial_out(up, UART_LCR, up->lcr);
-	/* need mode A for FCR */
-	if (priv->habit & UART_ERRATA_i202_MDR1_ACCESS)
-		omap_8250_mdr1_errataset(up, priv);
-	else
-		serial_out(up, UART_OMAP_MDR1, priv->mdr1);
+
+	omap8250_update_mdr1(up, priv);
+
 	up->port.ops->set_mctrl(&up->port, up->port.mctrl);
 }