Skip to contentSkip to conversation

ppc4xx: Enable auto RS485 mode on PLU405 boards

PATCH New Matthias Fuchs 3 participants 3 messages Dec 28, 2008 – Jan 14, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc4xx: Enable auto RS485 mode on PLU405 boards

This patch turns on the auto RS485 mode in the 2nd external uart on PLU405 boards. This is a special mode of the used Exar XR16C2850 uart. Because these boards only have a 485 physical layer connected it's a good idea to turn it on by default.

---
 board/esd/plu405/plu405.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
board/esd/plu405/plu405.c +10 -0
index 61186a8..4a152c3 100644
@@ -104,6 +104,7 @@ int misc_init_r (void)
 	unsigned char *duart0_mcr = (unsigned char *)((ulong)DUART0_BA + 4);
 	unsigned char *duart1_mcr = (unsigned char *)((ulong)DUART1_BA + 4);
 	unsigned char *dst;
+	unsigned char fctr;
 	ulong len = sizeof(fpgadata);
 	int status;
 	int index;
@@ -203,6 +204,15 @@ int misc_init_r (void)
 	out_8(duart0_mcr, 0x08);
 	out_8(duart1_mcr, 0x08);
 
+	/* 
+	 * Enable auto RS485 mode in 2nd external uart 
+	 */
+	out_8((void *)DUART1_BA + 3, 0xbf); /* write LCR */
+	fctr = in_8((void *)DUART1_BA + 1); /* read FCTR */
+	fctr |= 0x08;                       /* enable RS485 mode */
+	out_8((void *)DUART1_BA + 1, fctr); /* write FCTR */
+	out_8((void *)DUART1_BA + 3, 0);    /* write LCR */
+
 	return (0);
 }
 
Signature · 1 line
1.5.6.3
#1 lore raw

PATCH v2 1/1 ppc4xx: Enable auto RS485 mode on PLU405 boards

2nd version of this patch eliminates a whitespace issue :-(

This patch turns on the auto RS485 mode in the 2nd external uart on PLU405 boards. This is a special mode of the used Exar XR16C2850 uart. Because these boards only have a 485 physical layer connected it's a good idea to turn it on by default.

---
 board/esd/plu405/plu405.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
board/esd/plu405/plu405.c +10 -0
index 61186a8..85057a2 100644
@@ -104,6 +104,7 @@ int misc_init_r (void)
 	unsigned char *duart0_mcr = (unsigned char *)((ulong)DUART0_BA + 4);
 	unsigned char *duart1_mcr = (unsigned char *)((ulong)DUART1_BA + 4);
 	unsigned char *dst;
+	unsigned char fctr;
 	ulong len = sizeof(fpgadata);
 	int status;
 	int index;
@@ -203,6 +204,15 @@ int misc_init_r (void)
 	out_8(duart0_mcr, 0x08);
 	out_8(duart1_mcr, 0x08);
 
+	/*
+	 * Enable auto RS485 mode in 2nd external uart
+	 */
+	out_8((void *)DUART1_BA + 3, 0xbf); /* write LCR */
+	fctr = in_8((void *)DUART1_BA + 1); /* read FCTR */
+	fctr |= 0x08;                       /* enable RS485 mode */
+	out_8((void *)DUART1_BA + 1, fctr); /* write FCTR */
+	out_8((void *)DUART1_BA + 3, 0);    /* write LCR */
+
 	return (0);
 }
 
Signature · 1 line
1.5.6.3
#2 lore raw

PATCH v2 1/1 ppc4xx: Enable auto RS485 mode on PLU405 boards

Quoted 1 line · Matthias Fuchs

2nd version of this patch eliminates a whitespace issue :-(

Please put such statements below the "---" next time. They don't really should be included in the commit text. And it's always helpful to have a patch revision description (changes in ver1: ... changes in ver2: ... etc) below the "---".

I removed this line for now so no need to resend now.

Quoted 6 lines

This patch turns on the auto RS485 mode in the 2nd external uart on PLU405 boards. This is a special mode of the used Exar XR16C2850 uart. Because these boards only have a 485 physical layer connected it's a good idea to turn it on by default.

Added to u-boot/master.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================