at91rm9200 serial frequency fix
Fix CD calcutation on serial device.
---
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +6 -2
@@ -50,14 +50,18 @@ AT91PS_USART us = (AT91PS_USART) AT91C_BAT91PS_USART us = (AT91PS_USART )AT91C_BASE_US1 ;#endif +#define BAUDRATE (mck, baud) \ + ((((mck) * 10) % ((baud) * 16)) >= 5) ? \ + (mck / (baud * 16) + 1) : ((mck) / (baud * 16)) +void serial_setbrg (void ) {int baudrate;if ((baudrate = gd->baudrate) <=0 ) baudrate =CONFIG_BAUDRATE ; -/* MASTER_CLOCK/(16 * baudrate) */ - us->US_BRGR = (AT91C_MASTER_CLOCK >>4 ) / (unsigned )baudrate; + + us->US_BRGR =BOUDRATE (AT91C_MASTER_CLOCK , (unsigned )baudrate); }int serial_init (void )
Quoted 14 lines · Ulf Samuelsson
s?n 2007-08-19 klockan 18:35 +0200 skrev michael trimarchi:
arm920t/at91rm9200/serial.c AT91PS_USART us = (AT91PS_USART) AT91C_B · line 52
Quoted 11 lines
Fix CD calcutation on serial device.
Signed-off-by Trimarchi Michael <[email protected]>---
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +0
-0@@ -50,14 +50,18 @@ AT91PS_USART us = (AT91PS_USART) AT91C_BAT91PS_USART us = (AT91PS_USART )AT91C_BASE_US1 ;#endif you should test any patch before sending it to the list.
Quoted 10 lines
You have obviously not tested your patch before use, since there is a spelling error.
BAUDRATE != BOUDRATEPls reject this patch.
BR
Ulf Samuelsson
I'm so sorry! I test this code on my at91 but when I prepare the patch from the last git, I does't notice the error in the integration. The next time I test again my code.
Regards Michael
Quoted 11 lines
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +4
-0+#define BAUDRATE (mck, baud) \ + ((((mck) * 10) % ((baud) * 16)) >= 5) ? \ + (mck / (baud * 16) + 1) : ((mck) / (baud * 16)) +void serial_setbrg (void ) {int baudrate;
arm920t/at91rm9200/serial.c AT91PS_USART us = (AT91PS_USART) AT91C_B · line 67
Quoted 10 lines
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +2
-2if ((baudrate = gd->baudrate) <=0 ) baudrate =CONFIG_BAUDRATE ; -/* MASTER_CLOCK/(16 * baudrate) */ - us->US_BRGR = (AT91C_MASTER_CLOCK >>4 ) / (unsigned )baudrate; + + us->US_BRGR =BOUDRATE (AT91C_MASTER_CLOCK , (unsigned )baudrate); }int serial_init (void )
Excuse me I take the wrong diff file, containg and error on macro name. I will send the right one soon.
Regards Michael
s?n 2007-08-19 klockan 18:35 +0200 skrev michael trimarchi:
Quoted 16 lines
Fix CD calcutation on serial device.
Signed-off-by Trimarchi Michael <[email protected]>---
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +4
-0@@ -50,14 +50,18 @@ AT91PS_USART us = (AT91PS_USART) AT91C_BAT91PS_USART us = (AT91PS_USART )AT91C_BASE_US1 ;#endif +#define BAUDRATE (mck, baud) \ + ((((mck) * 10) % ((baud) * 16)) >= 5) ? \ + (mck / (baud * 16) + 1) : ((mck) / (baud * 16)) +void serial_setbrg (void )
arm920t/at91rm9200/serial.c AT91PS_USART us = (AT91PS_USART) AT91C_B · line 65
Quoted 10 lines
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +2
-2{int baudrate;if ((baudrate = gd->baudrate) <=0 ) baudrate =CONFIG_BAUDRATE ; -/* MASTER_CLOCK/(16 * baudrate) */ - us->US_BRGR = (AT91C_MASTER_CLOCK >>4 ) / (unsigned )baudrate; + + us->US_BRGR =BOUDRATE (AT91C_MASTER_CLOCK , (unsigned )baudrate); }
You should read the part of the documentation where is says that you should test any patch before sending it to the list.
You have obviously not tested your patch before use, since there is a spelling error.
BAUDRATE != BOUDRATE
Pls reject this patch.
BR
Ulf Samuelsson
arm920t/at91rm9200/serial.c AT91PS_USART us = (AT91PS_USART) AT91C_B · line 53
Quoted 12 lines · In message <[email protected]> you wrote:
Fix CD calcutation on serial device.
Signed-off-by Trimarchi Michael <[email protected]>---
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +1
-0@@ -50,14 +50,18 @@ AT91PS_USART us = (AT91PS_USART) AT91C_BAT91PS_USART us = (AT91PS_USART )AT91C_BASE_US1 ;#endif +#define BAUDRATE (mck, baud) \
^^^^^^^^
arm920t/at91rm9200/serial.c AT91PS_USART us = (AT91PS_USART) AT91C_B · line 64
Quoted 1 line
arm920t/at91rm9200/serial.c renamed from arm920t/at91rm9200/serial.c.orig +1
-0+ us->US_BRGR =BOUDRATE (AT91C_MASTER_CLOCK , (unsigned )baudrate);
^^^^^^^^
Spelling...
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Hi there! This is just a note from me, to you, to tell you, the per- son reading this note, that I can't think up any more famous quotes, jokes, nor bizarre stories, so you may as well go home.