Hi
This patch enables the clock to the AT91 USART when
at91_serial_lookup() is called. Only enabling the clock when needed
saves power. The AT91SAM7S HAL only enables clocks to device the HAL
uses and leaves other clocks disabled.
Andrew
Index: devs/serial/arm/at91/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/devs/serial/arm/at91/current/ChangeLog,v
retrieving revision 1.12
diff -u -r1.12 ChangeLog
--- devs/serial/arm/at91/current/ChangeLog 11 Nov 2004 08:57:43 -0000
1.12
+++ devs/serial/arm/at91/current/ChangeLog 19 Feb 2006 19:44:19 -0000
@@ -1,3 +1,8 @@
+2006-02-19 Andrew Lunn <[EMAIL PROTECTED]>
+
+ * src/at91_serial.c (at91_serial_lookup): Enable the peripheral
+ clock at lookup time to keep the power usage low.
+
2004-11-10 Sebastian Block <[EMAIL PROTECTED]>
* src/at91_serial.c: Added third port
Index: devs/serial/arm/at91/current/src/at91_serial.c
===================================================================
RCS file:
/cvs/ecos/ecos/packages/devs/serial/arm/at91/current/src/at91_serial.c,v
retrieving revision 1.10
diff -u -r1.10 at91_serial.c
--- devs/serial/arm/at91/current/src/at91_serial.c 11 Nov 2004 08:57:43
-0000 1.10
+++ devs/serial/arm/at91/current/src/at91_serial.c 19 Feb 2006 19:44:20
-0000
@@ -369,7 +369,13 @@
const char *name)
{
serial_channel * const chan = (serial_channel *) (*tab)->priv;
-
+
+#ifdef AT91_PMC_PCER
+ // Enable the peripheral clock to the device
+ at91_serial_info * const at91_chan = (at91_serial_info *)chan->dev_priv;
+ HAL_WRITE_UINT32(AT91_PMC+AT91_PMC_PCER,
+ (1 << at91_chan->int_num));
+#endif
(chan->callbacks->serial_init)(chan); // Really only required for
interrupt driven devices
return ENOERR;
}