diff options
author | Wenyou Yang <wenyou.yang@atmel.com> | 2016-02-03 10:16:49 +0800 |
---|---|---|
committer | Andreas Bießmann <andreas.devel@googlemail.com> | 2016-02-18 21:34:40 +0100 |
commit | eced5a7eb4750e16dd571a9bd4980c68d2276f11 (patch) | |
tree | fd1a74475bf9f233a8e28d46910d9019df53241a /arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c | |
parent | 41bf25c2e1c134455257f91bbfa9dc582b687bc4 (diff) | |
download | u-boot-imx-eced5a7eb4750e16dd571a9bd4980c68d2276f11.zip u-boot-imx-eced5a7eb4750e16dd571a9bd4980c68d2276f11.tar.gz u-boot-imx-eced5a7eb4750e16dd571a9bd4980c68d2276f11.tar.bz2 |
ARM: cpu: at91: clean up peripheral clock code
Due to introducing the new peripheral clock handle functions,
use these functions to clean up the duplicated code.
Meanwhile, remove unneeded header file include, at91_pmc.h.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Tested-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
[fixup for arm920t code]
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
Diffstat (limited to 'arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c')
-rw-r--r-- | arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c b/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c index 6b51d5f..f3f4800 100644 --- a/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c +++ b/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c @@ -13,7 +13,7 @@ #include <common.h> #include <asm/io.h> #include <asm/arch/at91_common.h> -#include <asm/arch/at91_pmc.h> +#include <asm/arch/clk.h> #include <asm/arch/gpio.h> /* @@ -33,51 +33,40 @@ void at91_serial0_hw_init(void) { - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; - at91_set_a_periph(AT91_PIO_PORTA, 26, 1); /* TXD0 */ at91_set_a_periph(AT91_PIO_PORTA, 27, PUP); /* RXD0 */ - writel(1 << ATMEL_ID_USART0, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_USART0); } void at91_serial1_hw_init(void) { - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; - at91_set_a_periph(AT91_PIO_PORTD, 0, 1); /* TXD1 */ at91_set_a_periph(AT91_PIO_PORTD, 1, PUP); /* RXD1 */ - writel(1 << ATMEL_ID_USART1, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_USART1); } void at91_serial2_hw_init(void) { - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; - at91_set_a_periph(AT91_PIO_PORTD, 2, 1); /* TXD2 */ at91_set_a_periph(AT91_PIO_PORTD, 3, PUP); /* RXD2 */ - writel(1 << ATMEL_ID_USART2, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_USART2); } void at91_seriald_hw_init(void) { - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; - at91_set_a_periph(AT91_PIO_PORTC, 30, PUP); /* DRXD */ at91_set_a_periph(AT91_PIO_PORTC, 31, 1); /* DTXD */ - writel(1 << ATMEL_ID_SYS, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_SYS); } #if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI) void at91_spi0_hw_init(unsigned long cs_mask) { - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; - at91_set_b_periph(AT91_PIO_PORTA, 0, PUP); /* SPI0_MISO */ at91_set_b_periph(AT91_PIO_PORTA, 1, PUP); /* SPI0_MOSI */ at91_set_b_periph(AT91_PIO_PORTA, 2, PUP); /* SPI0_SPCK */ - /* Enable clock */ - writel(1 << ATMEL_ID_SPI0, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_SPI0); if (cs_mask & (1 << 0)) { at91_set_b_periph(AT91_PIO_PORTA, 5, 1); @@ -107,14 +96,11 @@ void at91_spi0_hw_init(unsigned long cs_mask) void at91_spi1_hw_init(unsigned long cs_mask) { - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; - at91_set_a_periph(AT91_PIO_PORTB, 12, PUP); /* SPI1_MISO */ at91_set_a_periph(AT91_PIO_PORTB, 13, PUP); /* SPI1_MOSI */ at91_set_a_periph(AT91_PIO_PORTB, 14, PUP); /* SPI1_SPCK */ - /* Enable clock */ - writel(1 << ATMEL_ID_SPI1, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_SPI1); if (cs_mask & (1 << 0)) { at91_set_a_periph(AT91_PIO_PORTB, 15, 1); @@ -146,9 +132,7 @@ void at91_spi1_hw_init(unsigned long cs_mask) #if defined(CONFIG_GENERIC_ATMEL_MCI) void at91_mci_hw_init(void) { - /* Enable mci clock */ - struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; - writel(1 << ATMEL_ID_MCI1, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_MCI1); at91_set_a_periph(AT91_PIO_PORTA, 6, PUP); /* MCI1_CK */ @@ -207,12 +191,9 @@ void at91_uhp_hw_init(void) #ifdef CONFIG_AT91_CAN void at91_can_hw_init(void) { - at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC; - at91_set_a_periph(AT91_PIO_PORTA, 13, 0); /* CAN_TX */ at91_set_a_periph(AT91_PIO_PORTA, 14, 1); /* CAN_RX */ - /* Enable clock */ - writel(1 << ATMEL_ID_CAN, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_CAN); } #endif |