From: Daniel Gorsulowski Date: Mon, 29 Jun 2009 09:15:50 +0200 Subject: [U-Boot] [PATCH] at91: Add CAN init function Message-ID: <12462597504193-git-send-email-Daniel.Gorsulowski@esd.eu> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- cpu/arm926ejs/at91/at91cap9_devices.c | 11 +++++++++++ cpu/arm926ejs/at91/at91sam9263_devices.c | 11 +++++++++++ include/asm-arm/arch-at91/at91_common.h | 1 + 3 files changed, 23 insertions(+), 0 deletions(-) diff --git a/cpu/arm926ejs/at91/at91cap9_devices.c b/cpu/arm926ejs/at91/at91cap9_devices.c index c0024ac..ede55f4 100644 --- a/cpu/arm926ejs/at91/at91cap9_devices.c +++ b/cpu/arm926ejs/at91/at91cap9_devices.c @@ -174,3 +174,14 @@ void at91_macb_hw_init(void) #endif } #endif + +#ifdef CONFIG_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 diff --git a/cpu/arm926ejs/at91/at91sam9263_devices.c b/cpu/arm926ejs/at91/at91sam9263_devices.c index 0f2613e..3990dde 100644 --- a/cpu/arm926ejs/at91/at91sam9263_devices.c +++ b/cpu/arm926ejs/at91/at91sam9263_devices.c @@ -182,3 +182,14 @@ void at91_uhp_hw_init(void) at91_set_gpio_output(AT91_PIN_PA24, 0); } #endif + +#ifdef CONFIG_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 diff --git a/include/asm-arm/arch-at91/at91_common.h b/include/asm-arm/arch-at91/at91_common.h index 9c4e019..01840ee 100644 --- a/include/asm-arm/arch-at91/at91_common.h +++ b/include/asm-arm/arch-at91/at91_common.h @@ -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); -- 1.5.3