]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
at91: Add CAN init function
authorDaniel Gorsulowski <Daniel.Gorsulowski@esd.eu>
Tue, 30 Jun 2009 21:03:33 +0000 (23:03 +0200)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Mon, 6 Jul 2009 19:52:43 +0000 (21:52 +0200)
To enable CAN init, CONFIG_CAN has to be defined in the board config file
and at91_can_hw_init() has to be called in the board specific code.

CAN is available on AT91SAM9263 and AT91CAP9 SoC.

Signed-off-by: Daniel Gorsulowski <Daniel.Gorsulowski@esd.eu>
cpu/arm926ejs/at91/at91cap9_devices.c
cpu/arm926ejs/at91/at91sam9263_devices.c
include/asm-arm/arch-at91/at91_common.h

index c0024acf04e8275e1c7ac9868bf7f2d16ed11a65..39e405fee13533de6d81e1aa260851094511a8b9 100644 (file)
@@ -3,6 +3,10 @@
  * Stelian Pop <stelian.pop@leadtechdesign.com>
  * Lead Tech Design <www.leadtechdesign.com>
  *
+ * (C) Copyright 2009
+ * Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
+ * esd electronic system design gmbh <www.esd.eu>
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -174,3 +178,14 @@ void at91_macb_hw_init(void)
 #endif
 }
 #endif
+
+#ifdef CONFIG_AT91_CAN
+void at91_can_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PA12, 0);    /* CAN_TX */
+       at91_set_A_periph(AT91_PIN_PA13, 1);    /* CAN_RX */
+
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_CAN);
+}
+#endif
index 0f2613e7b8cf00b3ecb540c0ff9c299547bb10c0..f72efdfe80703e95410e537257716ebd2e7c4161 100644 (file)
@@ -3,6 +3,10 @@
  * Stelian Pop <stelian.pop@leadtechdesign.com>
  * Lead Tech Design <www.leadtechdesign.com>
  *
+ * (C) Copyright 2009
+ * Daniel Gorsulowski <daniel.gorsulowski@esd.eu>
+ * esd electronic system design gmbh <www.esd.eu>
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -182,3 +186,14 @@ void at91_uhp_hw_init(void)
        at91_set_gpio_output(AT91_PIN_PA24, 0);
 }
 #endif
+
+#ifdef CONFIG_AT91_CAN
+void at91_can_hw_init(void)
+{
+       at91_set_A_periph(AT91_PIN_PA13, 0);    /* CAN_TX */
+       at91_set_A_periph(AT91_PIN_PA14, 1);    /* CAN_RX */
+
+       /* Enable clock */
+       at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_CAN);
+}
+#endif
index 9c4e0197155232285e24aaac3c47fd133a41f4d0..01840eede41f94ed58d104301249a7b2a6ce02e1 100644 (file)
@@ -25,6 +25,7 @@
 #ifndef AT91_COMMON_H
 #define AT91_COMMON_H
 
+void at91_can_hw_init(void);
 void at91_macb_hw_init(void);
 void at91_serial_hw_init(void);
 void at91_serial0_hw_init(void);