public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/12] serial context save/restore
@ 2008-09-01 13:37 Rajendra Nayak
  2008-09-01 20:06 ` Russell King - ARM Linux
  2008-09-04  8:52 ` Kevin Hilman
  0 siblings, 2 replies; 6+ messages in thread
From: Rajendra Nayak @ 2008-09-01 13:37 UTC (permalink / raw)
  To: linux-omap

This patch adds the context save restore functions for UART

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
 arch/arm/mach-omap2/serial.c             |   55 +++++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/serial.h |   13 ++++++-
 include/linux/serial_reg.h               |    1
 3 files changed, 68 insertions(+), 1 deletion(-)

Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c	2008-09-01
18:11:33.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/serial.c	2008-09-01 18:11:50.000000000
+0530
@@ -290,6 +290,61 @@ void __init omap_serial_init(void)
 	omap_serial_kick();
 }

+#ifdef CONFIG_ARCH_OMAP3
+static struct omap3_uart_regs uart_ctx[OMAP_MAX_NR_PORTS];
+void omap3_save_uart_ctx(int unum)
+{
+	u16 lcr = 0;
+
+	struct plat_serial8250_port *p = serial_platform_data + unum;
+
+	if (uart_ick[unum] == NULL)
+		return;
+
+	lcr = serial_read_reg(p, UART_LCR);
+	serial_write_reg(p, UART_LCR, 0xBF);
+	uart_ctx[unum].dll = serial_read_reg(p, UART_DLL);
+	uart_ctx[unum].dlh = serial_read_reg(p, UART_DLM);
+	serial_write_reg(p, UART_LCR, lcr);
+	uart_ctx[unum].ier = serial_read_reg(p, UART_IER);
+	uart_ctx[unum].sysc = serial_read_reg(p, UART_OMAP_SYSC);
+	uart_ctx[unum].scr = serial_read_reg(p, UART_OMAP_SCR);
+	uart_ctx[unum].wer = serial_read_reg(p, UART_OMAP_WER);
+}
+EXPORT_SYMBOL(omap3_save_uart_ctx);
+
+void omap3_restore_uart_ctx(int unum)
+{
+	u16 efr = 0;
+
+	struct plat_serial8250_port *p = serial_platform_data + unum;
+
+	if (uart_ick[unum] == NULL)
+		return;
+
+	serial_write_reg(p, UART_OMAP_MDR1, 0x7);
+	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+	efr = serial_read_reg(p, UART_EFR);
+	serial_write_reg(p, UART_EFR, UART_EFR_ECB);
+	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
+	serial_write_reg(p, UART_IER, 0x0);
+	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+	serial_write_reg(p, UART_DLL, uart_ctx[unum].dll);
+	serial_write_reg(p, UART_DLM, uart_ctx[unum].dlh);
+	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
+	serial_write_reg(p, UART_IER, uart_ctx[unum].ier);
+	serial_write_reg(p, UART_FCR, 0xA1);
+	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+	serial_write_reg(p, UART_EFR, efr);
+	serial_write_reg(p, UART_LCR, UART_LCR_WLEN8);
+	serial_write_reg(p, UART_OMAP_SCR, uart_ctx[unum].scr);
+	serial_write_reg(p, UART_OMAP_WER, uart_ctx[unum].wer);
+	serial_write_reg(p, UART_OMAP_SYSC, uart_ctx[unum].sysc);
+	serial_write_reg(p, UART_OMAP_MDR1, 0x00); /* UART 16x mode */
+}
+EXPORT_SYMBOL(omap3_restore_uart_ctx);
+#endif /* CONFIG_ARCH_OMAP3 */
+
 static struct platform_device serial_device = {
 	.name			= "serial8250",
 	.id			= PLAT8250_DEV_PLATFORM,
Index: linux-omap-2.6/include/linux/serial_reg.h
===================================================================
--- linux-omap-2.6.orig/include/linux/serial_reg.h	2008-09-01
18:11:29.000000000 +0530
+++ linux-omap-2.6/include/linux/serial_reg.h	2008-09-01 18:11:50.000000000 +0530
@@ -323,6 +323,7 @@
 #define UART_OMAP_MVER		0x14	/* Module version register */
 #define UART_OMAP_SYSC		0x15	/* System configuration register */
 #define UART_OMAP_SYSS		0x16	/* System status register */
+#define UART_OMAP_WER           0x17    /* Wake-up enable register */

 #endif /* _LINUX_SERIAL_REG_H */

Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/serial.h	2008-09-01
18:11:29.000000000 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h	2008-09-01
18:11:50.000000000 +0530
@@ -39,5 +39,16 @@
 				__ret = 1;			\
 			__ret;					\
 			})
-
+#ifndef __ASSEMBLY__
+struct omap3_uart_regs {
+	u16 dll;
+	u16 dlh;
+	u16 ier;
+	u16 sysc;
+	u16 scr;
+	u16 wer;
+};
+extern void omap3_save_uart_ctx(int unum);
+extern void omap3_restore_uart_ctx(int unum);
+#endif /* __ASSEMBLY__ */
 #endif



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

* Re: [PATCH 02/12] serial context save/restore
  2008-09-01 13:37 Rajendra Nayak
@ 2008-09-01 20:06 ` Russell King - ARM Linux
  2008-09-02  3:50   ` Rajendra Nayak
  2008-09-04  8:52 ` Kevin Hilman
  1 sibling, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2008-09-01 20:06 UTC (permalink / raw)
  To: Rajendra Nayak; +Cc: linux-omap

On Mon, Sep 01, 2008 at 07:07:27PM +0530, Rajendra Nayak wrote:
> This patch adds the context save restore functions for UART
> --- linux-omap-2.6.orig/include/linux/serial_reg.h	2008-09-01
> 18:11:29.000000000 +0530
> +++ linux-omap-2.6/include/linux/serial_reg.h	2008-09-01 18:11:50.000000000 +0530
> @@ -323,6 +323,7 @@
>  #define UART_OMAP_MVER		0x14	/* Module version register */
>  #define UART_OMAP_SYSC		0x15	/* System configuration register */
>  #define UART_OMAP_SYSS		0x16	/* System status register */
> +#define UART_OMAP_WER           0x17    /* Wake-up enable register */

Please match the indentation style.
> 
>  #endif /* _LINUX_SERIAL_REG_H */
> 
> Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/serial.h	2008-09-01
> 18:11:29.000000000 +0530
> +++ linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h	2008-09-01
> 18:11:50.000000000 +0530
> @@ -39,5 +39,16 @@
>  				__ret = 1;			\
>  			__ret;					\
>  			})
> -
> +#ifndef __ASSEMBLY__

There should be a blank line between the previous macro and this
ifndef.

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

* RE: [PATCH 02/12] serial context save/restore
  2008-09-01 20:06 ` Russell King - ARM Linux
@ 2008-09-02  3:50   ` Rajendra Nayak
  0 siblings, 0 replies; 6+ messages in thread
From: Rajendra Nayak @ 2008-09-02  3:50 UTC (permalink / raw)
  To: 'Russell King - ARM Linux'; +Cc: linux-omap

> -----Original Message-----
> From: Russell King - ARM Linux [mailto:linux@arm.linux.org.uk] 
> Sent: Tuesday, September 02, 2008 1:37 AM
> To: Rajendra Nayak
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [PATCH 02/12] serial context save/restore
> 
> On Mon, Sep 01, 2008 at 07:07:27PM +0530, Rajendra Nayak wrote:
> > This patch adds the context save restore functions for UART
> > --- linux-omap-2.6.orig/include/linux/serial_reg.h	2008-09-01
> > 18:11:29.000000000 +0530
> > +++ linux-omap-2.6/include/linux/serial_reg.h	
> 2008-09-01 18:11:50.000000000 +0530
> > @@ -323,6 +323,7 @@
> >  #define UART_OMAP_MVER		0x14	/* Module 
> version register */
> >  #define UART_OMAP_SYSC		0x15	/* System 
> configuration register */
> >  #define UART_OMAP_SYSS		0x16	/* System 
> status register */
> > +#define UART_OMAP_WER           0x17    /* Wake-up enable 
> register */
> 
> Please match the indentation style.
> > 
> >  #endif /* _LINUX_SERIAL_REG_H */
> > 
> > Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h
> > ===================================================================
> > --- 
> linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/serial.h	
> 2008-09-01
> > 18:11:29.000000000 +0530
> > +++ linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h	
> 2008-09-01
> > 18:11:50.000000000 +0530
> > @@ -39,5 +39,16 @@
> >  				__ret = 1;			\
> >  			__ret;					\
> >  			})
> > -
> > +#ifndef __ASSEMBLY__
> 
> There should be a blank line between the previous macro and this
> ifndef.

Ok. I'll repost this patch with the fixes.

> 
> 


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

* [PATCH 02/12] serial context save/restore
       [not found] <59386.192.168.10.89.1220276248.squirrel@dbdmail.itg.ti.com>
@ 2008-09-02  7:52 ` Rajendra Nayak
  2008-09-02 11:30   ` Kevin Hilman
  0 siblings, 1 reply; 6+ messages in thread
From: Rajendra Nayak @ 2008-09-02  7:52 UTC (permalink / raw)
  To: linux-omap

Resending this patch after fixing Russell's comments.


This patch adds the context save restore functions for UART

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
 arch/arm/mach-omap2/serial.c             |   55 +++++++++++++++++++++++++++++++
 arch/arm/plat-omap/include/mach/serial.h |   12 ++++++
 include/linux/serial_reg.h               |    1
 3 files changed, 68 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c	2008-09-02
13:06:15.000000000 +0530
+++ linux-omap-2.6/arch/arm/mach-omap2/serial.c	2008-09-02 13:06:20.000000000
+0530
@@ -290,6 +290,61 @@ void __init omap_serial_init(void)
 	omap_serial_kick();
 }

+#ifdef CONFIG_ARCH_OMAP3
+static struct omap3_uart_regs uart_ctx[OMAP_MAX_NR_PORTS];
+void omap3_save_uart_ctx(int unum)
+{
+	u16 lcr = 0;
+
+	struct plat_serial8250_port *p = serial_platform_data + unum;
+
+	if (uart_ick[unum] == NULL)
+		return;
+
+	lcr = serial_read_reg(p, UART_LCR);
+	serial_write_reg(p, UART_LCR, 0xBF);
+	uart_ctx[unum].dll = serial_read_reg(p, UART_DLL);
+	uart_ctx[unum].dlh = serial_read_reg(p, UART_DLM);
+	serial_write_reg(p, UART_LCR, lcr);
+	uart_ctx[unum].ier = serial_read_reg(p, UART_IER);
+	uart_ctx[unum].sysc = serial_read_reg(p, UART_OMAP_SYSC);
+	uart_ctx[unum].scr = serial_read_reg(p, UART_OMAP_SCR);
+	uart_ctx[unum].wer = serial_read_reg(p, UART_OMAP_WER);
+}
+EXPORT_SYMBOL(omap3_save_uart_ctx);
+
+void omap3_restore_uart_ctx(int unum)
+{
+	u16 efr = 0;
+
+	struct plat_serial8250_port *p = serial_platform_data + unum;
+
+	if (uart_ick[unum] == NULL)
+		return;
+
+	serial_write_reg(p, UART_OMAP_MDR1, 0x7);
+	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+	efr = serial_read_reg(p, UART_EFR);
+	serial_write_reg(p, UART_EFR, UART_EFR_ECB);
+	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
+	serial_write_reg(p, UART_IER, 0x0);
+	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+	serial_write_reg(p, UART_DLL, uart_ctx[unum].dll);
+	serial_write_reg(p, UART_DLM, uart_ctx[unum].dlh);
+	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
+	serial_write_reg(p, UART_IER, uart_ctx[unum].ier);
+	serial_write_reg(p, UART_FCR, 0xA1);
+	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
+	serial_write_reg(p, UART_EFR, efr);
+	serial_write_reg(p, UART_LCR, UART_LCR_WLEN8);
+	serial_write_reg(p, UART_OMAP_SCR, uart_ctx[unum].scr);
+	serial_write_reg(p, UART_OMAP_WER, uart_ctx[unum].wer);
+	serial_write_reg(p, UART_OMAP_SYSC, uart_ctx[unum].sysc);
+	serial_write_reg(p, UART_OMAP_MDR1, 0x00); /* UART 16x mode */
+}
+EXPORT_SYMBOL(omap3_restore_uart_ctx);
+#endif /* CONFIG_ARCH_OMAP3 */
+
 static struct platform_device serial_device = {
 	.name			= "serial8250",
 	.id			= PLAT8250_DEV_PLATFORM,
Index: linux-omap-2.6/include/linux/serial_reg.h
===================================================================
--- linux-omap-2.6.orig/include/linux/serial_reg.h	2008-09-02
13:06:10.000000000 +0530
+++ linux-omap-2.6/include/linux/serial_reg.h	2008-09-02 13:16:00.000000000 +0530
@@ -323,6 +323,7 @@
 #define UART_OMAP_MVER		0x14	/* Module version register */
 #define UART_OMAP_SYSC		0x15	/* System configuration register */
 #define UART_OMAP_SYSS		0x16	/* System status register */
+#define UART_OMAP_WER		0x17	/* Wake-up enable register */

 #endif /* _LINUX_SERIAL_REG_H */

Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h
===================================================================
--- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/serial.h	2008-09-02
13:06:10.000000000 +0530
+++ linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h	2008-09-02
13:08:24.000000000 +0530
@@ -40,4 +40,16 @@
 			__ret;					\
 			})

+#ifndef __ASSEMBLY__
+struct omap3_uart_regs {
+	u16 dll;
+	u16 dlh;
+	u16 ier;
+	u16 sysc;
+	u16 scr;
+	u16 wer;
+};
+extern void omap3_save_uart_ctx(int unum);
+extern void omap3_restore_uart_ctx(int unum);
+#endif /* __ASSEMBLY__ */
 #endif



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

* Re: [PATCH 02/12] serial context save/restore
  2008-09-02  7:52 ` [PATCH 02/12] serial context save/restore Rajendra Nayak
@ 2008-09-02 11:30   ` Kevin Hilman
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2008-09-02 11:30 UTC (permalink / raw)
  To: Rajendra Nayak; +Cc: linux-omap

Hi Rajendra,

"Rajendra Nayak" <rnayak@ti.com> writes:

> Resending this patch after fixing Russell's comments.
>
>
> This patch adds the context save restore functions for UART
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> ---
>  arch/arm/mach-omap2/serial.c             |   55 +++++++++++++++++++++++++++++++
>  arch/arm/plat-omap/include/mach/serial.h |   12 ++++++
>  include/linux/serial_reg.h               |    1
>  3 files changed, 68 insertions(+)
>
> Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c	2008-09-02
> 13:06:15.000000000 +0530
> +++ linux-omap-2.6/arch/arm/mach-omap2/serial.c	2008-09-02 13:06:20.000000000
> +0530

This patch (and all the others) still have line-wrapping problems.  In
particualar see the diff hunk headers above.

The result is that while 'patch' seems to apply them, the git tools
(like git-apply, git-am) fail with "patch fragment without header."

Could you regenerate the patches without wrapping?  I recommend using
'git format-patch -n'.

Thanks,

Kevin


> @@ -290,6 +290,61 @@ void __init omap_serial_init(void)
>  	omap_serial_kick();
>  }
>
> +#ifdef CONFIG_ARCH_OMAP3
> +static struct omap3_uart_regs uart_ctx[OMAP_MAX_NR_PORTS];
> +void omap3_save_uart_ctx(int unum)
> +{
> +	u16 lcr = 0;
> +
> +	struct plat_serial8250_port *p = serial_platform_data + unum;
> +
> +	if (uart_ick[unum] == NULL)
> +		return;
> +
> +	lcr = serial_read_reg(p, UART_LCR);
> +	serial_write_reg(p, UART_LCR, 0xBF);
> +	uart_ctx[unum].dll = serial_read_reg(p, UART_DLL);
> +	uart_ctx[unum].dlh = serial_read_reg(p, UART_DLM);
> +	serial_write_reg(p, UART_LCR, lcr);
> +	uart_ctx[unum].ier = serial_read_reg(p, UART_IER);
> +	uart_ctx[unum].sysc = serial_read_reg(p, UART_OMAP_SYSC);
> +	uart_ctx[unum].scr = serial_read_reg(p, UART_OMAP_SCR);
> +	uart_ctx[unum].wer = serial_read_reg(p, UART_OMAP_WER);
> +}
> +EXPORT_SYMBOL(omap3_save_uart_ctx);
> +
> +void omap3_restore_uart_ctx(int unum)
> +{
> +	u16 efr = 0;
> +
> +	struct plat_serial8250_port *p = serial_platform_data + unum;
> +
> +	if (uart_ick[unum] == NULL)
> +		return;
> +
> +	serial_write_reg(p, UART_OMAP_MDR1, 0x7);
> +	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
> +	efr = serial_read_reg(p, UART_EFR);
> +	serial_write_reg(p, UART_EFR, UART_EFR_ECB);
> +	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
> +	serial_write_reg(p, UART_IER, 0x0);
> +	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
> +	serial_write_reg(p, UART_DLL, uart_ctx[unum].dll);
> +	serial_write_reg(p, UART_DLM, uart_ctx[unum].dlh);
> +	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
> +	serial_write_reg(p, UART_IER, uart_ctx[unum].ier);
> +	serial_write_reg(p, UART_FCR, 0xA1);
> +	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
> +	serial_write_reg(p, UART_EFR, efr);
> +	serial_write_reg(p, UART_LCR, UART_LCR_WLEN8);
> +	serial_write_reg(p, UART_OMAP_SCR, uart_ctx[unum].scr);
> +	serial_write_reg(p, UART_OMAP_WER, uart_ctx[unum].wer);
> +	serial_write_reg(p, UART_OMAP_SYSC, uart_ctx[unum].sysc);
> +	serial_write_reg(p, UART_OMAP_MDR1, 0x00); /* UART 16x mode */
> +}
> +EXPORT_SYMBOL(omap3_restore_uart_ctx);
> +#endif /* CONFIG_ARCH_OMAP3 */
> +
>  static struct platform_device serial_device = {
>  	.name			= "serial8250",
>  	.id			= PLAT8250_DEV_PLATFORM,
> Index: linux-omap-2.6/include/linux/serial_reg.h
> ===================================================================
> --- linux-omap-2.6.orig/include/linux/serial_reg.h	2008-09-02
> 13:06:10.000000000 +0530
> +++ linux-omap-2.6/include/linux/serial_reg.h	2008-09-02 13:16:00.000000000 +0530
> @@ -323,6 +323,7 @@
>  #define UART_OMAP_MVER		0x14	/* Module version register */
>  #define UART_OMAP_SYSC		0x15	/* System configuration register */
>  #define UART_OMAP_SYSS		0x16	/* System status register */
> +#define UART_OMAP_WER		0x17	/* Wake-up enable register */
>
>  #endif /* _LINUX_SERIAL_REG_H */
>
> Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/serial.h	2008-09-02
> 13:06:10.000000000 +0530
> +++ linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h	2008-09-02
> 13:08:24.000000000 +0530
> @@ -40,4 +40,16 @@
>  			__ret;					\
>  			})
>
> +#ifndef __ASSEMBLY__
> +struct omap3_uart_regs {
> +	u16 dll;
> +	u16 dlh;
> +	u16 ier;
> +	u16 sysc;
> +	u16 scr;
> +	u16 wer;
> +};
> +extern void omap3_save_uart_ctx(int unum);
> +extern void omap3_restore_uart_ctx(int unum);
> +#endif /* __ASSEMBLY__ */
>  #endif
>
>
> --
> 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

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

* Re: [PATCH 02/12] serial context save/restore
  2008-09-01 13:37 Rajendra Nayak
  2008-09-01 20:06 ` Russell King - ARM Linux
@ 2008-09-04  8:52 ` Kevin Hilman
  1 sibling, 0 replies; 6+ messages in thread
From: Kevin Hilman @ 2008-09-04  8:52 UTC (permalink / raw)
  To: Rajendra Nayak; +Cc: linux-omap

"Rajendra Nayak" <rnayak@ti.com> writes:

> This patch adds the context save restore functions for UART
>
> Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> ---
>  arch/arm/mach-omap2/serial.c             |   55 +++++++++++++++++++++++++++++++
>  arch/arm/plat-omap/include/mach/serial.h |   13 ++++++-
>  include/linux/serial_reg.h               |    1
>  3 files changed, 68 insertions(+), 1 deletion(-)
>
> Index: linux-omap-2.6/arch/arm/mach-omap2/serial.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap2/serial.c	2008-09-01
> 18:11:33.000000000 +0530
> +++ linux-omap-2.6/arch/arm/mach-omap2/serial.c	2008-09-01 18:11:50.000000000
> +0530
> @@ -290,6 +290,61 @@ void __init omap_serial_init(void)
>  	omap_serial_kick();
>  }
>
> +#ifdef CONFIG_ARCH_OMAP3
> +static struct omap3_uart_regs uart_ctx[OMAP_MAX_NR_PORTS];
> +void omap3_save_uart_ctx(int unum)
> +{
> +	u16 lcr = 0;
> +
> +	struct plat_serial8250_port *p = serial_platform_data + unum;
> +
> +	if (uart_ick[unum] == NULL)
> +		return;
> +
> +	lcr = serial_read_reg(p, UART_LCR);
> +	serial_write_reg(p, UART_LCR, 0xBF);
> +	uart_ctx[unum].dll = serial_read_reg(p, UART_DLL);
> +	uart_ctx[unum].dlh = serial_read_reg(p, UART_DLM);
> +	serial_write_reg(p, UART_LCR, lcr);
> +	uart_ctx[unum].ier = serial_read_reg(p, UART_IER);
> +	uart_ctx[unum].sysc = serial_read_reg(p, UART_OMAP_SYSC);
> +	uart_ctx[unum].scr = serial_read_reg(p, UART_OMAP_SCR);
> +	uart_ctx[unum].wer = serial_read_reg(p, UART_OMAP_WER);
> +}
> +EXPORT_SYMBOL(omap3_save_uart_ctx);
> +
> +void omap3_restore_uart_ctx(int unum)
> +{
> +	u16 efr = 0;
> +
> +	struct plat_serial8250_port *p = serial_platform_data + unum;
> +
> +	if (uart_ick[unum] == NULL)
> +		return;
> +
> +	serial_write_reg(p, UART_OMAP_MDR1, 0x7);
> +	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
> +	efr = serial_read_reg(p, UART_EFR);
> +	serial_write_reg(p, UART_EFR, UART_EFR_ECB);
> +	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
> +	serial_write_reg(p, UART_IER, 0x0);
> +	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
> +	serial_write_reg(p, UART_DLL, uart_ctx[unum].dll);
> +	serial_write_reg(p, UART_DLM, uart_ctx[unum].dlh);
> +	serial_write_reg(p, UART_LCR, 0x0); /* Operational mode */
> +	serial_write_reg(p, UART_IER, uart_ctx[unum].ier);
> +	serial_write_reg(p, UART_FCR, 0xA1);
> +	serial_write_reg(p, UART_LCR, 0xBF); /* Config B mode */
> +	serial_write_reg(p, UART_EFR, efr);
> +	serial_write_reg(p, UART_LCR, UART_LCR_WLEN8);
> +	serial_write_reg(p, UART_OMAP_SCR, uart_ctx[unum].scr);
> +	serial_write_reg(p, UART_OMAP_WER, uart_ctx[unum].wer);
> +	serial_write_reg(p, UART_OMAP_SYSC, uart_ctx[unum].sysc);
> +	serial_write_reg(p, UART_OMAP_MDR1, 0x00); /* UART 16x mode */
> +}
> +EXPORT_SYMBOL(omap3_restore_uart_ctx);
> +#endif /* CONFIG_ARCH_OMAP3 */
> +
>  static struct platform_device serial_device = {
>  	.name			= "serial8250",
>  	.id			= PLAT8250_DEV_PLATFORM,
> Index: linux-omap-2.6/include/linux/serial_reg.h
> ===================================================================
> --- linux-omap-2.6.orig/include/linux/serial_reg.h	2008-09-01
> 18:11:29.000000000 +0530
> +++ linux-omap-2.6/include/linux/serial_reg.h	2008-09-01 18:11:50.000000000 +0530
> @@ -323,6 +323,7 @@
>  #define UART_OMAP_MVER		0x14	/* Module version register */
>  #define UART_OMAP_SYSC		0x15	/* System configuration register */
>  #define UART_OMAP_SYSS		0x16	/* System status register */
> +#define UART_OMAP_WER           0x17    /* Wake-up enable register */

This was added with spaces instead of tabs.


>  #endif /* _LINUX_SERIAL_REG_H */
>
> Index: linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/plat-omap/include/mach/serial.h	2008-09-01
> 18:11:29.000000000 +0530
> +++ linux-omap-2.6/arch/arm/plat-omap/include/mach/serial.h	2008-09-01
> 18:11:50.000000000 +0530
> @@ -39,5 +39,16 @@
>  				__ret = 1;			\
>  			__ret;					\
>  			})
> -
> +#ifndef __ASSEMBLY__
> +struct omap3_uart_regs {
> +	u16 dll;
> +	u16 dlh;
> +	u16 ier;
> +	u16 sysc;
> +	u16 scr;
> +	u16 wer;
> +};
> +extern void omap3_save_uart_ctx(int unum);
> +extern void omap3_restore_uart_ctx(int unum);
> +#endif /* __ASSEMBLY__ */
>  #endif
>
>
> --
> 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

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

end of thread, other threads:[~2008-09-04  8:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <59386.192.168.10.89.1220276248.squirrel@dbdmail.itg.ti.com>
2008-09-02  7:52 ` [PATCH 02/12] serial context save/restore Rajendra Nayak
2008-09-02 11:30   ` Kevin Hilman
2008-09-01 13:37 Rajendra Nayak
2008-09-01 20:06 ` Russell King - ARM Linux
2008-09-02  3:50   ` Rajendra Nayak
2008-09-04  8:52 ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox