From: Andrei Emeltchenko <[email protected]>
Add MDR1 Serial register definition to serial_reg and remove duplicated
code, remove magic MDR1 register numbers from serial drivers.
*v2 add OMAP keyword to MDR1 definition
*v3 remove magic from serial drivers
*v4 taking comments from Manjunath and Govindraj: typos, CC
Andrei Emeltchenko (4):
OMAP: Serial: Define OMAP uart MDR1 register definitions
OMAP1: Serial: remove magic numbers for MDR1 reg
OMAP2: Serial: remove magic numbers for MDR1 reg
OMAP: Serial: remove redefined MDR1 register definitions
arch/arm/mach-omap1/serial.c | 6 ++++--
arch/arm/mach-omap2/serial.c | 15 +++++++++------
arch/arm/plat-omap/include/plat/omap-serial.h | 3 ---
drivers/serial/omap-serial.c | 6 +++---
include/linux/serial_reg.h | 12 ++++++++++++
5 files changed, 28 insertions(+), 14 deletions(-)
From: Andrei Emeltchenko <[email protected]>
Change magic number to ones defined in serial_reg
for omap1 serial driver
Signed-off-by: Andrei Emeltchenko <[email protected]>
---
arch/arm/mach-omap1/serial.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index b78d074..c73d1b7 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -52,9 +52,11 @@ static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
*/
static void __init omap_serial_reset(struct plat_serial8250_port *p)
{
- omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */
+ omap_serial_outp(p, UART_OMAP_MDR1,
+ UART_OMAP_MDR1_DISABLE); /* disable UART */
omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */
- omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
+ omap_serial_outp(p, UART_OMAP_MDR1,
+ UART_OMAP_MDR1_16X_MODE); /* enable UART */
if (!cpu_is_omap15xx()) {
omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
--
1.7.0.4
From: Andrei Emeltchenko <[email protected]>
Define MDR1 register serial definitions used in serial and
bluetooth drivers. Remove magic numbers there.
Signed-off-by: Andrei Emeltchenko <[email protected]>
---
include/linux/serial_reg.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h
index c7a0ce1..6f38234 100644
--- a/include/linux/serial_reg.h
+++ b/include/linux/serial_reg.h
@@ -341,5 +341,17 @@
#define UART_OMAP_SYSS 0x16 /* System status register */
#define UART_OMAP_WER 0x17 /* Wake-up enable register */
+/*
+ * These are the definitions for the MDR1 register
+ */
+#define UART_OMAP_MDR1_16X_MODE 0x00 /* UART 16x mode */
+#define UART_OMAP_MDR1_SIR_MODE 0x01 /* SIR mode */
+#define UART_OMAP_MDR1_16X_ABAUD_MODE 0x02 /* UART 16x auto-baud */
+#define UART_OMAP_MDR1_13X_MODE 0x03 /* UART 13x mode */
+#define UART_OMAP_MDR1_MIR_MODE 0x04 /* MIR mode */
+#define UART_OMAP_MDR1_FIR_MODE 0x05 /* FIR mode */
+#define UART_OMAP_MDR1_CIR_MODE 0x06 /* CIR mode */
+#define UART_OMAP_MDR1_DISABLE 0x07 /* Disable (default state) */
+
#endif /* _LINUX_SERIAL_REG_H */
--
1.7.0.4
From: Andrei Emeltchenko <[email protected]>
Change magic number to ones defined in serial_reg
for omap2 serial driver
Signed-off-by: Andrei Emeltchenko <[email protected]>
---
arch/arm/mach-omap2/serial.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index becf0e3..edd7c99 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -168,9 +168,9 @@ static inline void serial_write_reg(struct omap_uart_state *uart, int offset,
static inline void __init omap_uart_reset(struct omap_uart_state *uart)
{
- serial_write_reg(uart, UART_OMAP_MDR1, 0x07);
+ serial_write_reg(uart, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE);
serial_write_reg(uart, UART_OMAP_SCR, 0x08);
- serial_write_reg(uart, UART_OMAP_MDR1, 0x00);
+ serial_write_reg(uart, UART_OMAP_MDR1, UART_OMAP_MDR1_16X_MODE);
}
#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
@@ -246,9 +246,10 @@ static void omap_uart_restore_context(struct omap_uart_state *uart)
uart->context_valid = 0;
if (uart->errata & UART_ERRATA_i202_MDR1_ACCESS)
- omap_uart_mdr1_errataset(uart, 0x07, 0xA0);
+ omap_uart_mdr1_errataset(uart, UART_OMAP_MDR1_DISABLE, 0xA0);
else
- serial_write_reg(uart, UART_OMAP_MDR1, 0x7);
+ serial_write_reg(uart, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE);
+
serial_write_reg(uart, UART_LCR, 0xBF); /* Config B mode */
efr = serial_read_reg(uart, UART_EFR);
serial_write_reg(uart, UART_EFR, UART_EFR_ECB);
@@ -267,11 +268,13 @@ static void omap_uart_restore_context(struct omap_uart_state *uart)
serial_write_reg(uart, UART_OMAP_SCR, uart->scr);
serial_write_reg(uart, UART_OMAP_WER, uart->wer);
serial_write_reg(uart, UART_OMAP_SYSC, uart->sysc);
+
if (uart->errata & UART_ERRATA_i202_MDR1_ACCESS)
- omap_uart_mdr1_errataset(uart, 0x00, 0xA1);
+ omap_uart_mdr1_errataset(uart, UART_OMAP_MDR1_16X_MODE, 0xA1);
else
/* UART 16x mode */
- serial_write_reg(uart, UART_OMAP_MDR1, 0x00);
+ serial_write_reg(uart, UART_OMAP_MDR1,
+ UART_OMAP_MDR1_16X_MODE);
}
#else
static inline void omap_uart_save_context(struct omap_uart_state *uart) {}
--
1.7.0.4
From: Andrei Emeltchenko <[email protected]>
Use definitions defined in serial_reg
Signed-off-by: Andrei Emeltchenko <[email protected]>
---
arch/arm/plat-omap/include/plat/omap-serial.h | 3 ---
drivers/serial/omap-serial.c | 6 +++---
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index c8dae02..6a17880 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -31,9 +31,6 @@
*/
#define OMAP_SERIAL_NAME "ttyO"
-#define OMAP_MDR1_DISABLE 0x07
-#define OMAP_MDR1_MODE13X 0x03
-#define OMAP_MDR1_MODE16X 0x00
#define OMAP_MODE13X_SPEED 230400
/*
diff --git a/drivers/serial/omap-serial.c b/drivers/serial/omap-serial.c
index 14365f7..03a96db 100644
--- a/drivers/serial/omap-serial.c
+++ b/drivers/serial/omap-serial.c
@@ -753,7 +753,7 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
/* Protocol, Baud Rate, and Interrupt Settings */
- serial_out(up, UART_OMAP_MDR1, OMAP_MDR1_DISABLE);
+ serial_out(up, UART_OMAP_MDR1, UART_OMAP_MDR1_DISABLE);
serial_out(up, UART_LCR, OMAP_UART_LCR_CONF_MDB);
up->efr = serial_in(up, UART_EFR);
@@ -774,9 +774,9 @@ serial_omap_set_termios(struct uart_port *port, struct ktermios *termios,
serial_out(up, UART_LCR, cval);
if (baud > 230400 && baud != 3000000)
- serial_out(up, UART_OMAP_MDR1, OMAP_MDR1_MODE13X);
+ serial_out(up, UART_OMAP_MDR1, UART_OMAP_MDR1_13X_MODE);
else
- serial_out(up, UART_OMAP_MDR1, OMAP_MDR1_MODE16X);
+ serial_out(up, UART_OMAP_MDR1, UART_OMAP_MDR1_16X_MODE);
/* Hardware Flow Control Configuration */
--
1.7.0.4
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Emeltchenko Andrei
> Sent: Friday, November 12, 2010 6:34 PM
> To: [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: [PATCHv4 0/4] OMAP: Serial: remove magic and diplicates
s/diplicates/duplicates
>
> From: Andrei Emeltchenko <[email protected]>
>
> Add MDR1 Serial register definition to serial_reg and remove
> duplicated
> code, remove magic MDR1 register numbers from serial drivers.
>
> *v2 add OMAP keyword to MDR1 definition
> *v3 remove magic from serial drivers
> *v4 taking comments from Manjunath and Govindraj: typos, CC
>
> Andrei Emeltchenko (4):
> OMAP: Serial: Define OMAP uart MDR1 register definitions
> OMAP1: Serial: remove magic numbers for MDR1 reg
> OMAP2: Serial: remove magic numbers for MDR1 reg
> OMAP: Serial: remove redefined MDR1 register definitions
>
> arch/arm/mach-omap1/serial.c | 6 ++++--
> arch/arm/mach-omap2/serial.c | 15 +++++++++------
> arch/arm/plat-omap/include/plat/omap-serial.h | 3 ---
> drivers/serial/omap-serial.c | 6 +++---
> include/linux/serial_reg.h | 12 ++++++++++++
> 5 files changed, 28 insertions(+), 14 deletions(-)
Do you think patch series is required for these changes? How about
merging with single patch?
-Manjunath
On Fri, Nov 12, 2010 at 3:17 PM, G, Manjunath Kondaiah <[email protected]> wrote:
>
>
>> -----Original Message-----
>> From: [email protected]
>> [mailto:[email protected]] On Behalf Of
>> Emeltchenko Andrei
>> Sent: Friday, November 12, 2010 6:34 PM
>> To: [email protected]; [email protected];
>> [email protected]; [email protected]
>> Subject: [PATCHv4 0/4] OMAP: Serial: remove magic and diplicates
>
> s/diplicates/duplicates
>
>>
>> From: Andrei Emeltchenko <[email protected]>
>>
>> Add MDR1 Serial register definition to serial_reg and remove
>> duplicated
>> code, remove magic MDR1 register numbers from serial drivers.
>>
>> *v2 add OMAP keyword to MDR1 definition
>> *v3 remove magic from serial drivers
>> *v4 taking comments from Manjunath and Govindraj: typos, CC
>>
>> Andrei Emeltchenko (4):
>> ? OMAP: Serial: Define OMAP uart MDR1 register definitions
>> ? OMAP1: Serial: remove magic numbers for MDR1 reg
>> ? OMAP2: Serial: remove magic numbers for MDR1 reg
>> ? OMAP: Serial: remove redefined MDR1 register definitions
>>
>> ?arch/arm/mach-omap1/serial.c ? ? ? ? ? ? ? ? ?| ? ?6 ++++--
>> ?arch/arm/mach-omap2/serial.c ? ? ? ? ? ? ? ? ?| ? 15 +++++++++------
>> ?arch/arm/plat-omap/include/plat/omap-serial.h | ? ?3 ---
>> ?drivers/serial/omap-serial.c ? ? ? ? ? ? ? ? ?| ? ?6 +++---
>> ?include/linux/serial_reg.h ? ? ? ? ? ? ? ? ? ?| ? 12 ++++++++++++
>> ?5 files changed, 28 insertions(+), 14 deletions(-)
>
> Do you think patch series is required for these changes? How about
> merging with single patch?
I can merge, sometimes somebody need patches to be split, merging is easy.
-- Andrei
> -----Original Message-----
> From: Andrei Emeltchenko [mailto:[email protected]]
> Sent: Friday, November 12, 2010 6:50 PM
> To: G, Manjunath Kondaiah
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCHv4 0/4] OMAP: Serial: remove magic and diplicates
>
> On Fri, Nov 12, 2010 at 3:17 PM, G, Manjunath Kondaiah
> <[email protected]> wrote:
> >
> >
> >> -----Original Message-----
> >> From: [email protected]
> >> [mailto:[email protected]] On Behalf Of
> >> Emeltchenko Andrei
> >> Sent: Friday, November 12, 2010 6:34 PM
> >> To: [email protected]; [email protected];
> >> [email protected]; [email protected]
> >> Subject: [PATCHv4 0/4] OMAP: Serial: remove magic and diplicates
> >
> > s/diplicates/duplicates
> >
> >>
> >> From: Andrei Emeltchenko <[email protected]>
> >>
> >> Add MDR1 Serial register definition to serial_reg and remove
> >> duplicated
> >> code, remove magic MDR1 register numbers from serial drivers.
> >>
> >> *v2 add OMAP keyword to MDR1 definition
> >> *v3 remove magic from serial drivers
> >> *v4 taking comments from Manjunath and Govindraj: typos, CC
> >>
> >> Andrei Emeltchenko (4):
> >> ? OMAP: Serial: Define OMAP uart MDR1 register definitions
> >> ? OMAP1: Serial: remove magic numbers for MDR1 reg
> >> ? OMAP2: Serial: remove magic numbers for MDR1 reg
> >> ? OMAP: Serial: remove redefined MDR1 register definitions
> >>
> >> ?arch/arm/mach-omap1/serial.c ? ? ? ? ? ? ? ? ?| ? ?6 ++++--
> >> ?arch/arm/mach-omap2/serial.c ? ? ? ? ? ? ? ? ?| ? 15
> +++++++++------
> >> ?arch/arm/plat-omap/include/plat/omap-serial.h | ? ?3 ---
> >> ?drivers/serial/omap-serial.c ? ? ? ? ? ? ? ? ?| ? ?6 +++---
> >> ?include/linux/serial_reg.h ? ? ? ? ? ? ? ? ? ?| ? 12 ++++++++++++
> >> ?5 files changed, 28 insertions(+), 14 deletions(-)
> >
> > Do you think patch series is required for these changes? How about
> > merging with single patch?
>
> I can merge, sometimes somebody need patches to be split,
why? can you give example?
Please read: http://lwn.net/Articles/139918/
"if you make a single change to numerous files, group those changes into
a single patch. Thus a single logical change is contained within a
single patch."
-Manjunath-
Hi,
>> -----Original Message-----
>> From: Andrei Emeltchenko [mailto:[email protected]]
>> Sent: Friday, November 12, 2010 6:50 PM
>> To: G, Manjunath Kondaiah
>> Cc: [email protected]; [email protected];
>> [email protected]; [email protected]
>> Subject: Re: [PATCHv4 0/4] OMAP: Serial: remove magic and diplicates
>>
>> On Fri, Nov 12, 2010 at 3:17 PM, G, Manjunath Kondaiah
>> <[email protected]> wrote:
>> >
>> >
>> >> -----Original Message-----
>> >> From: [email protected]
>> >> [mailto:[email protected]] On Behalf Of
>> >> Emeltchenko Andrei
>> >> Sent: Friday, November 12, 2010 6:34 PM
>> >> To: [email protected]; [email protected];
>> >> [email protected]; [email protected]
>> >> Subject: [PATCHv4 0/4] OMAP: Serial: remove magic and diplicates
>> >
>> > s/diplicates/duplicates
>> >
>> >>
>> >> From: Andrei Emeltchenko <[email protected]>
>> >>
>> >> Add MDR1 Serial register definition to serial_reg and remove
>> >> duplicated
>> >> code, remove magic MDR1 register numbers from serial drivers.
>> >>
>> >> *v2 add OMAP keyword to MDR1 definition
>> >> *v3 remove magic from serial drivers
>> >> *v4 taking comments from Manjunath and Govindraj: typos, CC
>> >>
>> >> Andrei Emeltchenko (4):
>> >> ? OMAP: Serial: Define OMAP uart MDR1 register definitions
>> >> ? OMAP1: Serial: remove magic numbers for MDR1 reg
>> >> ? OMAP2: Serial: remove magic numbers for MDR1 reg
>> >> ? OMAP: Serial: remove redefined MDR1 register definitions
>> >>
>> >> ?arch/arm/mach-omap1/serial.c ? ? ? ? ? ? ? ? ?| ? ?6 ++++--
>> >> ?arch/arm/mach-omap2/serial.c ? ? ? ? ? ? ? ? ?| ? 15
>> +++++++++------
>> >> ?arch/arm/plat-omap/include/plat/omap-serial.h | ? ?3 ---
>> >> ?drivers/serial/omap-serial.c ? ? ? ? ? ? ? ? ?| ? ?6 +++---
>> >> ?include/linux/serial_reg.h ? ? ? ? ? ? ? ? ? ?| ? 12 ++++++++++++
>> >> ?5 files changed, 28 insertions(+), 14 deletions(-)
>> >
>> > Do you think patch series is required for these changes? How about
>> > merging with single patch?
>>
>> I can merge, sometimes somebody need patches to be split,
>
> why? can you give example?
Maybe I got it wrong.
> Please read: http://lwn.net/Articles/139918/
> "if you make a single change to numerous files, group those changes into
> a single patch. ?Thus a single logical change is contained within a
> single patch."
I have squashed those patches to the single one.
Regards,
Andrei
On Fri, Nov 12, 2010 at 03:03:59PM +0200, Emeltchenko Andrei wrote:
> From: Andrei Emeltchenko <[email protected]>
>
> Add MDR1 Serial register definition to serial_reg and remove duplicated
> code, remove magic MDR1 register numbers from serial drivers.
>
> *v2 add OMAP keyword to MDR1 definition
> *v3 remove magic from serial drivers
> *v4 taking comments from Manjunath and Govindraj: typos, CC
>
> Andrei Emeltchenko (4):
> OMAP: Serial: Define OMAP uart MDR1 register definitions
> OMAP1: Serial: remove magic numbers for MDR1 reg
> OMAP2: Serial: remove magic numbers for MDR1 reg
> OMAP: Serial: remove redefined MDR1 register definitions
Looks good, do you want these to go through the omap tree, or the serial
tree?
If they go through the omap tree, feel free to add:
Acked-by: Greg Kroah-Hartman <[email protected]>
thanks,
greg k-h
* Greg KH <[email protected]> [101112 06:54]:
> On Fri, Nov 12, 2010 at 03:03:59PM +0200, Emeltchenko Andrei wrote:
> > From: Andrei Emeltchenko <[email protected]>
> >
> > Add MDR1 Serial register definition to serial_reg and remove duplicated
> > code, remove magic MDR1 register numbers from serial drivers.
> >
> > *v2 add OMAP keyword to MDR1 definition
> > *v3 remove magic from serial drivers
> > *v4 taking comments from Manjunath and Govindraj: typos, CC
> >
> > Andrei Emeltchenko (4):
> > OMAP: Serial: Define OMAP uart MDR1 register definitions
> > OMAP1: Serial: remove magic numbers for MDR1 reg
> > OMAP2: Serial: remove magic numbers for MDR1 reg
> > OMAP: Serial: remove redefined MDR1 register definitions
>
> Looks good, do you want these to go through the omap tree, or the serial
> tree?
>
> If they go through the omap tree, feel free to add:
> Acked-by: Greg Kroah-Hartman <[email protected]>
Thanks, I can queue these. There will be some other platform level
serial changes done for wake-up events, so it's best to keep
them all together.
Regards,
Tony