From 5d73bc7af75b004d4eb343572e3ff5bc5727a048 Mon Sep 17 00:00:00 2001 From: Andreas Bießmann Date: Thu, 4 Nov 2010 23:15:30 +0000 Subject: avr32: rename memory-map.h -> hardware.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Bießmann --- drivers/mmc/atmel_mci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/mmc/atmel_mci.c b/drivers/mmc/atmel_mci.c index 3946ffeebea..0af8d42611c 100644 --- a/drivers/mmc/atmel_mci.c +++ b/drivers/mmc/atmel_mci.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include "atmel_mci.h" -- cgit v1.3.1 From f4278b716c2925b4dcf18b94f0ff932d4736cd5d Mon Sep 17 00:00:00 2001 From: Andreas Bießmann Date: Thu, 4 Nov 2010 23:15:31 +0000 Subject: avr32: fixup definitions to ATMEL_BASE_xxx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andreas Bießmann --- arch/avr32/cpu/at32ap700x/sm.h | 4 +- arch/avr32/cpu/hsdramc1.h | 4 +- arch/avr32/cpu/hsmc3.h | 4 +- arch/avr32/cpu/interrupts.c | 2 +- arch/avr32/include/asm/arch-at32ap700x/gpio.h | 10 +-- arch/avr32/include/asm/arch-at32ap700x/hardware.h | 76 +++++++++++------------ arch/avr32/include/asm/arch-at32ap700x/portmux.h | 10 +-- arch/avr32/include/asm/hmatrix-common.h | 2 +- board/atmel/atngw100/atngw100.c | 4 +- board/atmel/atstk1000/atstk1000.c | 4 +- board/earthlcd/favr-32-ezkit/favr-32-ezkit.c | 3 +- board/mimc/mimc200/mimc200.c | 4 +- board/miromico/hammerhead/hammerhead.c | 3 +- drivers/mmc/atmel_mci.h | 4 +- include/configs/atngw100.h | 4 +- include/configs/atstk1002.h | 6 +- include/configs/atstk1003.h | 6 +- include/configs/atstk1004.h | 6 +- include/configs/atstk1006.h | 6 +- include/configs/favr-32-ezkit.h | 6 +- include/configs/hammerhead.h | 3 +- include/configs/mimc200.h | 4 +- 22 files changed, 85 insertions(+), 90 deletions(-) (limited to 'drivers') diff --git a/arch/avr32/cpu/at32ap700x/sm.h b/arch/avr32/cpu/at32ap700x/sm.h index b6e4409b220..9a3804efe4f 100644 --- a/arch/avr32/cpu/at32ap700x/sm.h +++ b/arch/avr32/cpu/at32ap700x/sm.h @@ -197,8 +197,8 @@ /* Register access macros */ #define sm_readl(reg) \ - readl((void *)SM_BASE + SM_##reg) + readl((void *)ATMEL_BASE_SM + SM_##reg) #define sm_writel(reg,value) \ - writel((value), (void *)SM_BASE + SM_##reg) + writel((value), (void *)ATMEL_BASE_SM + SM_##reg) #endif /* __CPU_AT32AP_SM_H__ */ diff --git a/arch/avr32/cpu/hsdramc1.h b/arch/avr32/cpu/hsdramc1.h index 305d2cb5d39..e18e074a7ab 100644 --- a/arch/avr32/cpu/hsdramc1.h +++ b/arch/avr32/cpu/hsdramc1.h @@ -136,8 +136,8 @@ /* Register access macros */ #define hsdramc1_readl(reg) \ - readl((void *)HSDRAMC_BASE + HSDRAMC1_##reg) + readl((void *)ATMEL_BASE_HSDRAMC + HSDRAMC1_##reg) #define hsdramc1_writel(reg,value) \ - writel((value), (void *)HSDRAMC_BASE + HSDRAMC1_##reg) + writel((value), (void *)ATMEL_BASE_HSDRAMC + HSDRAMC1_##reg) #endif /* __ASM_AVR32_HSDRAMC1_H__ */ diff --git a/arch/avr32/cpu/hsmc3.h b/arch/avr32/cpu/hsmc3.h index ca533b922ed..ac472952a29 100644 --- a/arch/avr32/cpu/hsmc3.h +++ b/arch/avr32/cpu/hsmc3.h @@ -119,8 +119,8 @@ /* Register access macros */ #define hsmc3_readl(reg) \ - readl((void *)HSMC_BASE + HSMC3_##reg) + readl((void *)ATMEL_BASE_HSMC + HSMC3_##reg) #define hsmc3_writel(reg,value) \ - writel((value), (void *)HSMC_BASE + HSMC3_##reg) + writel((value), (void *)ATMEL_BASE_HSMC + HSMC3_##reg) #endif /* __CPU_AT32AP_HSMC3_H__ */ diff --git a/arch/avr32/cpu/interrupts.c b/arch/avr32/cpu/interrupts.c index c751981b34e..c6ea435c1d7 100644 --- a/arch/avr32/cpu/interrupts.c +++ b/arch/avr32/cpu/interrupts.c @@ -125,7 +125,7 @@ static int set_interrupt_handler(unsigned int nr, void (*handler)(void), intpr = (handler_addr & HANDLER_MASK); intpr |= (priority & INTLEV_MASK) << INTLEV_SHIFT; - writel(intpr, (void *)INTC_BASE + 4 * nr); + writel(intpr, (void *)ATMEL_BASE_INTC + 4 * nr); return 0; } diff --git a/arch/avr32/include/asm/arch-at32ap700x/gpio.h b/arch/avr32/include/asm/arch-at32ap700x/gpio.h index b0254f2d7f7..4322eac1c74 100644 --- a/arch/avr32/include/asm/arch-at32ap700x/gpio.h +++ b/arch/avr32/include/asm/arch-at32ap700x/gpio.h @@ -45,15 +45,15 @@ static inline void *pio_pin_to_port(unsigned int pin) { switch (pin >> 5) { case 0: - return (void *)PIOA_BASE; + return (void *)ATMEL_BASE_PIOA; case 1: - return (void *)PIOB_BASE; + return (void *)ATMEL_BASE_PIOB; case 2: - return (void *)PIOC_BASE; + return (void *)ATMEL_BASE_PIOC; case 3: - return (void *)PIOD_BASE; + return (void *)ATMEL_BASE_PIOD; case 4: - return (void *)PIOE_BASE; + return (void *)ATMEL_BASE_PIOE; default: return NULL; } diff --git a/arch/avr32/include/asm/arch-at32ap700x/hardware.h b/arch/avr32/include/asm/arch-at32ap700x/hardware.h index 6592c039fae..9172eef60f5 100644 --- a/arch/avr32/include/asm/arch-at32ap700x/hardware.h +++ b/arch/avr32/include/asm/arch-at32ap700x/hardware.h @@ -19,8 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ -#ifndef __AT32AP7000_MEMORY_MAP_H__ -#define __AT32AP7000_MEMORY_MAP_H__ +#ifndef __AT32AP7000_HARDWARE_H__ +#define __AT32AP7000_HARDWARE_H__ /* Internal and external memories */ #define EBI_SRAM_CS0_BASE 0x00000000 @@ -43,44 +43,44 @@ #define INTERNAL_SRAM_SIZE 0x00008000 /* Devices on the High Speed Bus (HSB) */ -#define LCDC_BASE 0xFF000000 -#define DMAC_BASE 0xFF200000 -#define USB_FIFO 0xFF300000 +#define LCDC_BASE 0xFF000000 +#define DMAC_BASE 0xFF200000 +#define USB_FIFO 0xFF300000 /* Devices on Peripheral Bus A (PBA) */ -#define SPI0_BASE 0xFFE00000 -#define SPI1_BASE 0xFFE00400 -#define TWI_BASE 0xFFE00800 -#define USART0_BASE 0xFFE00C00 -#define USART1_BASE 0xFFE01000 -#define USART2_BASE 0xFFE01400 -#define USART3_BASE 0xFFE01800 -#define SSC0_BASE 0xFFE01C00 -#define SSC1_BASE 0xFFE02000 -#define SSC2_BASE 0xFFE02400 -#define PIOA_BASE 0xFFE02800 -#define PIOB_BASE 0xFFE02C00 -#define PIOC_BASE 0xFFE03000 -#define PIOD_BASE 0xFFE03400 -#define PIOE_BASE 0xFFE03800 -#define PSIF_BASE 0xFFE03C00 +#define ATMEL_BASE_SPI0 0xFFE00000 +#define ATMEL_BASE_SPI1 0xFFE00400 +#define ATMEL_BASE_TWI0 0xFFE00800 +#define ATMEL_BASE_USART0 0xFFE00C00 +#define ATMEL_BASE_USART1 0xFFE01000 +#define ATMEL_BASE_USART2 0xFFE01400 +#define ATMEL_BASE_USART3 0xFFE01800 +#define ATMEL_BASE_SSC0 0xFFE01C00 +#define ATMEL_BASE_SSC1 0xFFE02000 +#define ATMEL_BASE_SSC2 0xFFE02400 +#define ATMEL_BASE_PIOA 0xFFE02800 +#define ATMEL_BASE_PIOB 0xFFE02C00 +#define ATMEL_BASE_PIOC 0xFFE03000 +#define ATMEL_BASE_PIOD 0xFFE03400 +#define ATMEL_BASE_PIOE 0xFFE03800 +#define ATMEL_BASE_PSIF 0xFFE03C00 /* Devices on Peripheral Bus B (PBB) */ -#define SM_BASE 0xFFF00000 -#define INTC_BASE 0xFFF00400 -#define HMATRIX_BASE 0xFFF00800 -#define TIMER0_BASE 0xFFF00C00 -#define TIMER1_BASE 0xFFF01000 -#define PWM_BASE 0xFFF01400 -#define MACB0_BASE 0xFFF01800 -#define MACB1_BASE 0xFFF01C00 -#define DAC_BASE 0xFFF02000 -#define MMCI_BASE 0xFFF02400 -#define AUDIOC_BASE 0xFFF02800 -#define HISI_BASE 0xFFF02C00 -#define USB_BASE 0xFFF03000 -#define HSMC_BASE 0xFFF03400 -#define HSDRAMC_BASE 0xFFF03800 -#define ECC_BASE 0xFFF03C00 +#define ATMEL_BASE_SM 0xFFF00000 +#define ATMEL_BASE_INTC 0xFFF00400 +#define ATMEL_BASE_HMATRIX 0xFFF00800 +#define ATMEL_BASE_TIMER0 0xFFF00C00 +#define ATMEL_BASE_TIMER1 0xFFF01000 +#define ATMEL_BASE_PWM 0xFFF01400 +#define ATMEL_BASE_MACB0 0xFFF01800 +#define ATMEL_BASE_MACB1 0xFFF01C00 +#define ATMEL_BASE_DAC 0xFFF02000 +#define ATMEL_BASE_MMCI 0xFFF02400 +#define ATMEL_BASE_AUDIOC 0xFFF02800 +#define ATMEL_BASE_HISI 0xFFF02C00 +#define ATMEL_BASE_USB 0xFFF03000 +#define ATMEL_BASE_HSMC 0xFFF03400 +#define ATMEL_BASE_HSDRAMC 0xFFF03800 +#define ATMEL_BASE_ECC 0xFFF03C00 -#endif /* __AT32AP7000_MEMORY_MAP_H__ */ +#endif /* __AT32AP7000_HARDWARE_H__ */ diff --git a/arch/avr32/include/asm/arch-at32ap700x/portmux.h b/arch/avr32/include/asm/arch-at32ap700x/portmux.h index 1ba52e5ddbc..859c121aa07 100644 --- a/arch/avr32/include/asm/arch-at32ap700x/portmux.h +++ b/arch/avr32/include/asm/arch-at32ap700x/portmux.h @@ -24,11 +24,11 @@ #include -#define PORTMUX_PORT_A ((void *)PIOA_BASE) -#define PORTMUX_PORT_B ((void *)PIOB_BASE) -#define PORTMUX_PORT_C ((void *)PIOC_BASE) -#define PORTMUX_PORT_D ((void *)PIOD_BASE) -#define PORTMUX_PORT_E ((void *)PIOE_BASE) +#define PORTMUX_PORT_A ((void *)ATMEL_BASE_PIOA) +#define PORTMUX_PORT_B ((void *)ATMEL_BASE_PIOB) +#define PORTMUX_PORT_C ((void *)ATMEL_BASE_PIOC) +#define PORTMUX_PORT_D ((void *)ATMEL_BASE_PIOD) +#define PORTMUX_PORT_E ((void *)ATMEL_BASE_PIOE) void portmux_enable_ebi(unsigned int bus_width, unsigned int addr_width, unsigned long flags, unsigned long drive_strength); diff --git a/arch/avr32/include/asm/hmatrix-common.h b/arch/avr32/include/asm/hmatrix-common.h index 4b7e6105ddd..9a86fe4baa0 100644 --- a/arch/avr32/include/asm/hmatrix-common.h +++ b/arch/avr32/include/asm/hmatrix-common.h @@ -117,7 +117,7 @@ struct hmatrix_regs { /* Register access macros */ #define __hmatrix_reg(reg) \ - (((volatile struct hmatrix_regs *)HMATRIX_BASE)->reg) + (((volatile struct hmatrix_regs *)ATMEL_BASE_HMATRIX)->reg) #define hmatrix_read(reg) \ (__hmatrix_reg(reg)) #define hmatrix_write(reg, value) \ diff --git a/board/atmel/atngw100/atngw100.c b/board/atmel/atngw100/atngw100.c index 49bc03e3ec1..59577b8445d 100644 --- a/board/atmel/atngw100/atngw100.c +++ b/board/atmel/atngw100/atngw100.c @@ -112,8 +112,8 @@ int board_early_init_r(void) #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bi) { - macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]); - macb_eth_initialize(1, (void *)MACB1_BASE, bi->bi_phy_id[1]); + macb_eth_initialize(0, (void *)ATMEL_BASE_MACB0, bi->bi_phy_id[0]); + macb_eth_initialize(1, (void *)ATMEL_BASE_MACB1, bi->bi_phy_id[1]); return 0; } #endif diff --git a/board/atmel/atstk1000/atstk1000.c b/board/atmel/atstk1000/atstk1000.c index 8b1e1b57d78..58048a4c3bd 100644 --- a/board/atmel/atstk1000/atstk1000.c +++ b/board/atmel/atstk1000/atstk1000.c @@ -134,8 +134,8 @@ int board_early_init_r(void) #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bi) { - macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]); - macb_eth_initialize(1, (void *)MACB1_BASE, bi->bi_phy_id[1]); + macb_eth_initialize(0, (void *)ATMEL_BASE_MACB0, bi->bi_phy_id[0]); + macb_eth_initialize(1, (void *)ATMEL_BASE_MACB1, bi->bi_phy_id[1]); return 0; } #endif diff --git a/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c b/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c index b0eca939b7f..0eedee4112a 100644 --- a/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c +++ b/board/earthlcd/favr-32-ezkit/favr-32-ezkit.c @@ -104,6 +104,7 @@ int board_early_init_r(void) #if defined(CONFIG_MACB) && defined(CONFIG_CMD_NET) int board_eth_init(bd_t *bi) { - return macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]); + return macb_eth_initialize(0, (void *)ATMEL_BASE_MACB0, + bi->bi_phy_id[0]); } #endif diff --git a/board/mimc/mimc200/mimc200.c b/board/mimc/mimc200/mimc200.c index 470adba7948..38fd35d8952 100644 --- a/board/mimc/mimc200/mimc200.c +++ b/board/mimc/mimc200/mimc200.c @@ -221,8 +221,8 @@ void spi_cs_deactivate(struct spi_slave *slave) #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bi) { - macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]); - macb_eth_initialize(1, (void *)MACB1_BASE, bi->bi_phy_id[1]); + macb_eth_initialize(0, (void *)ATMEL_BASE_MACB0, bi->bi_phy_id[0]); + macb_eth_initialize(1, (void *)ATMEL_BASE_MACB1, bi->bi_phy_id[1]); return 0; } diff --git a/board/miromico/hammerhead/hammerhead.c b/board/miromico/hammerhead/hammerhead.c index a0794ba966a..911a0b3bdd0 100644 --- a/board/miromico/hammerhead/hammerhead.c +++ b/board/miromico/hammerhead/hammerhead.c @@ -68,7 +68,8 @@ static const struct sdram_config sdram_config = { #ifdef CONFIG_CMD_NET int board_eth_init(bd_t *bis) { - return macb_eth_initialize(0, (void *)MACB0_BASE, bis->bi_phy_id[0]); + return macb_eth_initialize(0, (void *)ATMEL_BASE_MACB0, + bis->bi_phy_id[0]); } #endif diff --git a/drivers/mmc/atmel_mci.h b/drivers/mmc/atmel_mci.h index 823a77d91b3..90ab6a8a6d0 100644 --- a/drivers/mmc/atmel_mci.h +++ b/drivers/mmc/atmel_mci.h @@ -238,8 +238,8 @@ typedef struct atmel_mci { * Register access macros */ #define mmci_readl(reg) \ - readl((void *)MMCI_BASE + MMCI_##reg) + readl((void *)ATMEL_BASE_MMCI + MMCI_##reg) #define mmci_writel(reg,value) \ - writel((value), (void *)MMCI_BASE + MMCI_##reg) + writel((value), (void *)ATMEL_BASE_MMCI + MMCI_##reg) #endif /* __CPU_AT32AP_ATMEL_MCI_H__ */ diff --git a/include/configs/atngw100.h b/include/configs/atngw100.h index a3e92e8162c..a93ba8b4e7a 100644 --- a/include/configs/atngw100.h +++ b/include/configs/atngw100.h @@ -61,8 +61,8 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#define CONFIG_USART1 1 - +#define CONFIG_USART_BASE ATMEL_BASE_USART1 +#define CONFIG_USART_ID 1 /* User serviceable stuff */ #define CONFIG_DOS_PARTITION 1 diff --git a/include/configs/atstk1002.h b/include/configs/atstk1002.h index 252c5ae6991..ba1b56c6687 100644 --- a/include/configs/atstk1002.h +++ b/include/configs/atstk1002.h @@ -85,10 +85,8 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#undef CONFIG_USART0 -#define CONFIG_USART1 1 -#undef CONFIG_USART2 -#undef CONFIG_USART3 +#define CONFIG_USART_BASE ATMEL_BASE_USART1 +#define CONFIG_USART_ID 1 /* User serviceable stuff */ #define CONFIG_DOS_PARTITION 1 diff --git a/include/configs/atstk1003.h b/include/configs/atstk1003.h index 8f060817fd5..85337bfa2bf 100644 --- a/include/configs/atstk1003.h +++ b/include/configs/atstk1003.h @@ -85,10 +85,8 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#undef CONFIG_USART0 -#define CONFIG_USART1 1 -#undef CONFIG_USART2 -#undef CONFIG_USART3 +#define CONFIG_USART_BASE ATMEL_BASE_USART1 +#define CONFIG_USART_ID 1 /* User serviceable stuff */ #define CONFIG_DOS_PARTITION 1 diff --git a/include/configs/atstk1004.h b/include/configs/atstk1004.h index 12c9414a677..344ba8ff859 100644 --- a/include/configs/atstk1004.h +++ b/include/configs/atstk1004.h @@ -85,10 +85,8 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#undef CONFIG_USART0 -#define CONFIG_USART1 1 -#undef CONFIG_USART2 -#undef CONFIG_USART3 +#define CONFIG_USART_BASE ATMEL_BASE_USART1 +#define CONFIG_USART_ID 1 /* User serviceable stuff */ #define CONFIG_DOS_PARTITION 1 diff --git a/include/configs/atstk1006.h b/include/configs/atstk1006.h index 8cbaf75a642..e8553fcb209 100644 --- a/include/configs/atstk1006.h +++ b/include/configs/atstk1006.h @@ -85,10 +85,8 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#undef CONFIG_USART0 -#define CONFIG_USART1 1 -#undef CONFIG_USART2 -#undef CONFIG_USART3 +#define CONFIG_USART_BASE ATMEL_BASE_USART1 +#define CONFIG_USART_ID 1 /* User serviceable stuff */ #define CONFIG_DOS_PARTITION 1 diff --git a/include/configs/favr-32-ezkit.h b/include/configs/favr-32-ezkit.h index a65fbd409fb..e723ad10699 100644 --- a/include/configs/favr-32-ezkit.h +++ b/include/configs/favr-32-ezkit.h @@ -82,10 +82,8 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#undef CONFIG_USART0 -#undef CONFIG_USART1 -#undef CONFIG_USART2 -#define CONFIG_USART3 1 +#define CONFIG_USART_BASE ATMEL_BASE_USART3 +#define CONFIG_USART_ID 3 /* User serviceable stuff */ #define CONFIG_DOS_PARTITION 1 diff --git a/include/configs/hammerhead.h b/include/configs/hammerhead.h index 8ca04ea4809..1f20fff88c0 100644 --- a/include/configs/hammerhead.h +++ b/include/configs/hammerhead.h @@ -59,7 +59,8 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#define CONFIG_USART1 1 +#define CONFIG_USART_BASE ATMEL_BASE_USART1 +#define CONFIG_USART_ID 1 #define CONFIG_HOSTNAME hammerhead diff --git a/include/configs/mimc200.h b/include/configs/mimc200.h index a5c52e5cfe5..f004ec8a310 100644 --- a/include/configs/mimc200.h +++ b/include/configs/mimc200.h @@ -63,7 +63,9 @@ */ #define CONFIG_SYS_PLL0_OPT 0x04 -#define CONFIG_USART1 1 +#define CONFIG_USART_BASE ATMEL_BASE_USART1 +#define CONFIG_USART_ID 1 + #define CONFIG_MIMC200_DBGLINK 1 /* User serviceable stuff */ -- cgit v1.3.1 From 372f2783a7b111f567ca541194bc7a75a3d5d64a Mon Sep 17 00:00:00 2001 From: Reinhard Meyer Date: Wed, 3 Nov 2010 15:47:20 +0100 Subject: AT91: fix related at91 driver files Signed-off-by: Reinhard Meyer --- drivers/gpio/at91_gpio.c | 52 ++++++++++++++++++++++++----------------- drivers/rtc/at91sam9_rtt.c | 12 +++++----- drivers/usb/host/ohci-at91.c | 16 ++++++------- drivers/watchdog/at91sam9_wdt.c | 4 ++-- 4 files changed, 47 insertions(+), 37 deletions(-) (limited to 'drivers') diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index c0a97bc5dad..1631687186b 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -24,6 +24,16 @@ * MA 02111-1307 USA */ +/* + * WARNING: + * + * As the code is right now, it expects all PIO ports A,B,C,... + * to be evenly spaced in the memory map: + * ATMEL_BASE_PIOA + port * sizeof at91pio_t + * This might not necessaryly be true in future Atmel SoCs. + * This code should be fixed to use a pointer array to the ports. + */ + #include #include #include @@ -33,10 +43,10 @@ int at91_set_pio_pullup(unsigned port, unsigned pin, int use_pullup) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; if (use_pullup) writel(1 << pin, &pio->port[port].puer); @@ -52,10 +62,10 @@ int at91_set_pio_pullup(unsigned port, unsigned pin, int use_pullup) */ int at91_set_pio_periph(unsigned port, unsigned pin, int use_pullup) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; writel(mask, &pio->port[port].idr); at91_set_pio_pullup(port, pin, use_pullup); @@ -69,10 +79,10 @@ int at91_set_pio_periph(unsigned port, unsigned pin, int use_pullup) */ int at91_set_a_periph(unsigned port, unsigned pin, int use_pullup) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; writel(mask, &pio->port[port].idr); at91_set_pio_pullup(port, pin, use_pullup); @@ -87,10 +97,10 @@ int at91_set_a_periph(unsigned port, unsigned pin, int use_pullup) */ int at91_set_b_periph(unsigned port, unsigned pin, int use_pullup) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; writel(mask, &pio->port[port].idr); at91_set_pio_pullup(port, pin, use_pullup); @@ -106,10 +116,10 @@ int at91_set_b_periph(unsigned port, unsigned pin, int use_pullup) */ int at91_set_pio_input(unsigned port, u32 pin, int use_pullup) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; writel(mask, &pio->port[port].idr); at91_set_pio_pullup(port, pin, use_pullup); @@ -125,10 +135,10 @@ int at91_set_pio_input(unsigned port, u32 pin, int use_pullup) */ int at91_set_pio_output(unsigned port, u32 pin, int value) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; writel(mask, &pio->port[port].idr); writel(mask, &pio->port[port].pudr); @@ -147,10 +157,10 @@ int at91_set_pio_output(unsigned port, u32 pin, int value) */ int at91_set_pio_deglitch(unsigned port, unsigned pin, int is_on) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; if (is_on) writel(mask, &pio->port[port].ifer); @@ -166,10 +176,10 @@ int at91_set_pio_deglitch(unsigned port, unsigned pin, int is_on) */ int at91_set_pio_multi_drive(unsigned port, unsigned pin, int is_on) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; if (is_on) writel(mask, &pio->port[port].mder); @@ -184,10 +194,10 @@ int at91_set_pio_multi_drive(unsigned port, unsigned pin, int is_on) */ int at91_set_pio_value(unsigned port, unsigned pin, int value) { - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; if (value) writel(mask, &pio->port[port].sodr); @@ -202,11 +212,11 @@ int at91_set_pio_value(unsigned port, unsigned pin, int value) */ int at91_get_pio_value(unsigned port, unsigned pin) { - u32 pdsr = 0; - at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; + u32 pdsr = 0; + at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA; u32 mask; - if ((port < AT91_PIO_PORTS) && (pin < 32)) { + if ((port < ATMEL_PIO_PORTS) && (pin < 32)) { mask = 1 << pin; pdsr = readl(&pio->port[port].pdsr) & mask; } diff --git a/drivers/rtc/at91sam9_rtt.c b/drivers/rtc/at91sam9_rtt.c index de8e30d0d7c..ed44016078f 100644 --- a/drivers/rtc/at91sam9_rtt.c +++ b/drivers/rtc/at91sam9_rtt.c @@ -48,8 +48,8 @@ int rtc_get (struct rtc_time *tmp) { - at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE; - at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE; + at91_rtt_t *rtt = (at91_rtt_t *) ATMEL_BASE_RTT; + at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR; ulong tim; ulong tim2; ulong off; @@ -66,8 +66,8 @@ int rtc_get (struct rtc_time *tmp) int rtc_set (struct rtc_time *tmp) { - at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE; - at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE; + at91_rtt_t *rtt = (at91_rtt_t *) ATMEL_BASE_RTT; + at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR; ulong tim; tim = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, @@ -85,8 +85,8 @@ int rtc_set (struct rtc_time *tmp) void rtc_reset (void) { - at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE; - at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE; + at91_rtt_t *rtt = (at91_rtt_t *) ATMEL_BASE_RTT; + at91_gpbr_t *gpbr = (at91_gpbr_t *) ATMEL_BASE_GPBR; /* clear alarm, set prescaler to 32768, clear counter */ writel(32768+AT91_RTT_RTTRST, &rtt->mr); diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 64fde68ff59..6166899432b 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -32,7 +32,7 @@ int usb_cpu_init(void) { - at91_pmc_t *pmc = (at91_pmc_t *)AT91_PMC_BASE; + at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC; #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \ @@ -53,11 +53,11 @@ int usb_cpu_init(void) #endif /* Enable USB host clock. */ - writel(1 << AT91_ID_UHP, &pmc->pcer); + writel(1 << ATMEL_ID_UHP, &pmc->pcer); #ifdef CONFIG_AT91SAM9261 - writel(AT91_PMC_UHP | AT91_PMC_HCK0, &pmc->scer); + writel(ATMEL_PMC_UHP | AT91_PMC_HCK0, &pmc->scer); #else - writel(AT91_PMC_UHP, &pmc->scer); + writel(ATMEL_PMC_UHP, &pmc->scer); #endif return 0; @@ -65,14 +65,14 @@ int usb_cpu_init(void) int usb_cpu_stop(void) { - at91_pmc_t *pmc = (at91_pmc_t *)AT91_PMC_BASE; + at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC; /* Disable USB host clock. */ - writel(1 << AT91_ID_UHP, &pmc->pcdr); + writel(1 << ATMEL_ID_UHP, &pmc->pcdr); #ifdef CONFIG_AT91SAM9261 - writel(AT91_PMC_UHP | AT91_PMC_HCK0, &pmc->scdr); + writel(ATMEL_PMC_UHP | AT91_PMC_HCK0, &pmc->scdr); #else - writel(AT91_PMC_UHP, &pmc->scdr); + writel(ATMEL_PMC_UHP, &pmc->scdr); #endif #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 25afae748d6..62547651a5f 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c @@ -42,7 +42,7 @@ static int at91_wdt_settimeout(unsigned int timeout) { unsigned int reg; - at91_wdt_t *wd = (at91_wdt_t *) AT91_WDT_BASE; + at91_wdt_t *wd = (at91_wdt_t *) ATMEL_BASE_WDT; /* Check if disabled */ if (readl(&wd->mr) & AT91_WDT_MR_WDDIS) { @@ -69,7 +69,7 @@ static int at91_wdt_settimeout(unsigned int timeout) void hw_watchdog_reset(void) { - at91_wdt_t *wd = (at91_wdt_t *) AT91_WDT_BASE; + at91_wdt_t *wd = (at91_wdt_t *) ATMEL_BASE_WDT; writel(AT91_WDT_CR_WDRSTT | AT91_WDT_CR_KEY, &wd->cr); } -- cgit v1.3.1 From 329f0f52fa9fa572b0edbc8dfc34698dbe8efb6a Mon Sep 17 00:00:00 2001 From: Reinhard Meyer Date: Wed, 3 Nov 2010 16:32:56 +0100 Subject: ATMEL: fix related common atmel driver files Signed-off-by: Reinhard Meyer --- drivers/mmc/gen_atmel_mci.c | 2 +- drivers/net/macb.c | 14 ++++++++------ drivers/serial/atmel_usart.c | 28 +++++++--------------------- drivers/spi/atmel_spi.c | 16 ++++++++-------- 4 files changed, 24 insertions(+), 36 deletions(-) (limited to 'drivers') diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index 6577925b8ec..f346b244be1 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "atmel_mci.h" #ifndef CONFIG_SYS_MMC_CLK_OD diff --git a/drivers/net/macb.c b/drivers/net/macb.c index acb8d20b136..72ea1fc11d6 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -469,17 +469,19 @@ static int macb_init(struct eth_device *netdev, bd_t *bd) /* choose RMII or MII mode. This depends on the board */ #ifdef CONFIG_RMII -#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ - defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \ - defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) +#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ + defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \ + defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \ + defined(CONFIG_AT91SAM9XE) macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN)); #else macb_writel(macb, USRIO, 0); #endif #else -#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ - defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \ - defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) +#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \ + defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \ + defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \ + defined(CONFIG_AT91SAM9XE) macb_writel(macb, USRIO, MACB_BIT(CLKEN)); #else macb_writel(macb, USRIO, MACB_BIT(MII)); diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index bfa1f3a8d52..e326b2bcff9 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -23,21 +23,7 @@ #include #include -#include - -#if defined(CONFIG_USART0) -# define USART_ID 0 -# define USART_BASE USART0_BASE -#elif defined(CONFIG_USART1) -# define USART_ID 1 -# define USART_BASE USART1_BASE -#elif defined(CONFIG_USART2) -# define USART_ID 2 -# define USART_BASE USART2_BASE -#elif defined(CONFIG_USART3) -# define USART_ID 3 -# define USART_BASE USART3_BASE -#endif +#include #include "atmel_usart.h" @@ -45,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR; void serial_setbrg(void) { - atmel_usart3_t *usart = (atmel_usart3_t*)USART_BASE; + atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; unsigned long divisor; unsigned long usart_hz; @@ -54,14 +40,14 @@ void serial_setbrg(void) * Baud Rate = -------------- * 16 * CD */ - usart_hz = get_usart_clk_rate(USART_ID); + usart_hz = get_usart_clk_rate(CONFIG_USART_ID); divisor = (usart_hz / 16 + gd->baudrate / 2) / gd->baudrate; writel(USART3_BF(CD, divisor), &usart->brgr); } int serial_init(void) { - atmel_usart3_t *usart = (atmel_usart3_t*)USART_BASE; + atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; writel(USART3_BIT(RSTRX) | USART3_BIT(RSTTX), &usart->cr); @@ -80,7 +66,7 @@ int serial_init(void) void serial_putc(char c) { - atmel_usart3_t *usart = (atmel_usart3_t*)USART_BASE; + atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; if (c == '\n') serial_putc('\r'); @@ -97,7 +83,7 @@ void serial_puts(const char *s) int serial_getc(void) { - atmel_usart3_t *usart = (atmel_usart3_t*)USART_BASE; + atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; while (!(readl(&usart->csr) & USART3_BIT(RXRDY))) WATCHDOG_RESET(); @@ -106,6 +92,6 @@ int serial_getc(void) int serial_tstc(void) { - atmel_usart3_t *usart = (atmel_usart3_t*)USART_BASE; + atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE; return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0; } diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index d0de9319684..33e38b61b72 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include "atmel_spi.h" @@ -48,21 +48,21 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, switch (bus) { case 0: - regs = (void *)SPI0_BASE; + regs = (void *)ATMEL_BASE_SPI0; break; -#ifdef SPI1_BASE +#ifdef ATMEL_BASE_SPI1 case 1: - regs = (void *)SPI1_BASE; + regs = (void *)ATMEL_BASE_SPI1; break; #endif -#ifdef SPI2_BASE +#ifdef ATMEL_BASE_SPI2 case 2: - regs = (void *)SPI2_BASE; + regs = (void *)ATMEL_BASE_SPI2; break; #endif -#ifdef SPI3_BASE +#ifdef ATMEL_BASE_SPI3 case 3: - regs = (void *)SPI3_BASE; + regs = (void *)ATMEL_BASE_SPI3; break; #endif default: -- cgit v1.3.1 From 86592f60595f5dcebde01c9a4135485fbf2a61d6 Mon Sep 17 00:00:00 2001 From: Reinhard Meyer Date: Sun, 7 Nov 2010 13:26:14 +0100 Subject: AT91: change includes from asm/arch/io.h to asm/io.h and remove the now unused asm/arch-at91/io.h Signed-off-by: Reinhard Meyer --- arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c | 2 +- arch/arm/cpu/arm926ejs/at91/clock.c | 2 +- arch/arm/cpu/arm926ejs/at91/cpu.c | 3 +- arch/arm/cpu/arm926ejs/at91/eflash.c | 2 +- arch/arm/cpu/arm926ejs/at91/led.c | 2 +- arch/arm/cpu/arm926ejs/at91/reset.c | 2 +- arch/arm/cpu/arm926ejs/at91/timer.c | 2 +- arch/arm/include/asm/arch-at91/io.h | 43 ----------------------- drivers/gpio/at91_gpio.c | 2 +- drivers/rtc/at91sam9_rtt.c | 2 +- drivers/usb/host/ohci-at91.c | 2 +- 11 files changed, 10 insertions(+), 54 deletions(-) delete mode 100644 arch/arm/include/asm/arch-at91/io.h (limited to 'drivers') diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c index 54e8ee90fe9..6bdc75c702b 100644 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c @@ -23,10 +23,10 @@ */ #include +#include #include #include #include -#include /* * if CONFIG_AT91_GPIO_PULLUP ist set, keep pullups on on all diff --git a/arch/arm/cpu/arm926ejs/at91/clock.c b/arch/arm/cpu/arm926ejs/at91/clock.c index 06c63e545bd..608af2cf72f 100644 --- a/arch/arm/cpu/arm926ejs/at91/clock.c +++ b/arch/arm/cpu/arm926ejs/at91/clock.c @@ -12,8 +12,8 @@ */ #include +#include #include -#include #include #include diff --git a/arch/arm/cpu/arm926ejs/at91/cpu.c b/arch/arm/cpu/arm926ejs/at91/cpu.c index 4c8664d659f..c47fb31e999 100644 --- a/arch/arm/cpu/arm926ejs/at91/cpu.c +++ b/arch/arm/cpu/arm926ejs/at91/cpu.c @@ -24,13 +24,12 @@ */ #include - +#include #include #include #include #include #include -#include #ifndef CONFIG_SYS_AT91_MAIN_CLOCK #define CONFIG_SYS_AT91_MAIN_CLOCK 0 diff --git a/arch/arm/cpu/arm926ejs/at91/eflash.c b/arch/arm/cpu/arm926ejs/at91/eflash.c index a6e0501bb98..b0c1e1e8141 100644 --- a/arch/arm/cpu/arm926ejs/at91/eflash.c +++ b/arch/arm/cpu/arm926ejs/at91/eflash.c @@ -60,8 +60,8 @@ * do a read-modify-write for partially programmed pages */ #include +#include #include -#include #include #include #include diff --git a/arch/arm/cpu/arm926ejs/at91/led.c b/arch/arm/cpu/arm926ejs/at91/led.c index 0a315c49710..6bcfa7f2fd5 100644 --- a/arch/arm/cpu/arm926ejs/at91/led.c +++ b/arch/arm/cpu/arm926ejs/at91/led.c @@ -23,10 +23,10 @@ */ #include +#include #include #include #include -#include #ifdef CONFIG_RED_LED void red_LED_on(void) diff --git a/arch/arm/cpu/arm926ejs/at91/reset.c b/arch/arm/cpu/arm926ejs/at91/reset.c index 1f918b0e941..023719a6834 100644 --- a/arch/arm/cpu/arm926ejs/at91/reset.c +++ b/arch/arm/cpu/arm926ejs/at91/reset.c @@ -23,9 +23,9 @@ */ #include +#include #include #include -#include /* Reset the cpu by telling the reset controller to do so */ void reset_cpu(ulong ignored) diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c index 263441810b0..87a5b633a42 100644 --- a/arch/arm/cpu/arm926ejs/at91/timer.c +++ b/arch/arm/cpu/arm926ejs/at91/timer.c @@ -23,11 +23,11 @@ */ #include +#include #include #include #include #include -#include #include #if !defined(CONFIG_AT91FAMILY) diff --git a/arch/arm/include/asm/arch-at91/io.h b/arch/arm/include/asm/arch-at91/io.h deleted file mode 100644 index d0daa4ece52..00000000000 --- a/arch/arm/include/asm/arch-at91/io.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * [origin: Linux kernel include/asm-arm/arch-at91/io.h] - * - * Copyright (C) 2003 SAN People - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ASM_ARCH_IO_H -#define __ASM_ARCH_IO_H - -#include - -#ifdef CONFIG_AT91_LEGACY - -static inline unsigned int at91_sys_read(unsigned int reg_offset) -{ - void *addr = (void *)ATMEL_BASE_SYS; - - return __raw_readl(addr + reg_offset); -} - -static inline void at91_sys_write(unsigned int reg_offset, unsigned long value) -{ - void *addr = (void *)ATMEL_BASE_SYS; - - __raw_writel(value, addr + reg_offset); -} -#endif - -#endif diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 1631687186b..be2a0268e84 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -36,9 +36,9 @@ #include #include +#include #include #include -#include #include int at91_set_pio_pullup(unsigned port, unsigned pin, int use_pullup) diff --git a/drivers/rtc/at91sam9_rtt.c b/drivers/rtc/at91sam9_rtt.c index ed44016078f..ff4acb57e4e 100644 --- a/drivers/rtc/at91sam9_rtt.c +++ b/drivers/rtc/at91sam9_rtt.c @@ -38,9 +38,9 @@ #include #include #include +#include #include #include -#include #include #include diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 6166899432b..9532dd9ef6d 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c @@ -25,8 +25,8 @@ #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) +#include #include -#include #include #include -- cgit v1.3.1 From a0cfd188762d8f399f4670dfde54e9c6662b16a8 Mon Sep 17 00:00:00 2001 From: Reinhard Meyer Date: Tue, 9 Nov 2010 17:06:20 +0100 Subject: ATMEL: fix dataflash (dirty) this file should be converted to struct SoC access Signed-off-by: Reinhard Meyer --- drivers/spi/atmel_dataflash_spi.c | 94 ++++++++++++++++++++++++--------------- include/dataflash.h | 1 - 2 files changed, 57 insertions(+), 38 deletions(-) (limited to 'drivers') diff --git a/drivers/spi/atmel_dataflash_spi.c b/drivers/spi/atmel_dataflash_spi.c index 4a5c4aac701..9c991e8cbca 100644 --- a/drivers/spi/atmel_dataflash_spi.c +++ b/drivers/spi/atmel_dataflash_spi.c @@ -21,13 +21,21 @@ #include #ifndef CONFIG_AT91_LEGACY -#define CONFIG_AT91_LEGACY -#warning Please update to use C structur SoC access ! +# define CONFIG_ATMEL_LEGACY +# warning Please update to use C structure SoC access ! #endif -#include +#include +#include +#include + +#include + #include +#include + +#include "atmel_spi.h" + #include -#include #include #include @@ -41,18 +49,18 @@ void AT91F_SpiInit(void) { /* Reset the SPI */ - writel(AT91_SPI_SWRST, AT91_BASE_SPI + AT91_SPI_CR); + writel(AT91_SPI_SWRST, ATMEL_BASE_SPI0 + AT91_SPI_CR); /* Configure SPI in Master Mode with No CS selected !!! */ writel(AT91_SPI_MSTR | AT91_SPI_MODFDIS | AT91_SPI_PCS, - AT91_BASE_SPI + AT91_SPI_MR); + ATMEL_BASE_SPI0 + AT91_SPI_MR); /* Configure CS0 */ writel(AT91_SPI_NCPHA | (AT91_SPI_DLYBS & DATAFLASH_TCSS) | (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | ((get_mck_clk_rate() / AT91_SPI_CLK) << 8), - AT91_BASE_SPI + AT91_SPI_CSR(0)); + ATMEL_BASE_SPI0 + AT91_SPI_CSR(0)); #ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 /* Configure CS1 */ @@ -60,7 +68,7 @@ void AT91F_SpiInit(void) (AT91_SPI_DLYBS & DATAFLASH_TCSS) | (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | ((get_mck_clk_rate() / AT91_SPI_CLK) << 8), - AT91_BASE_SPI + AT91_SPI_CSR(1)); + ATMEL_BASE_SPI0 + AT91_SPI_CSR(1)); #endif #ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS2 /* Configure CS2 */ @@ -68,7 +76,7 @@ void AT91F_SpiInit(void) (AT91_SPI_DLYBS & DATAFLASH_TCSS) | (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | ((get_mck_clk_rate() / AT91_SPI_CLK) << 8), - AT91_BASE_SPI + AT91_SPI_CSR(2)); + ATMEL_BASE_SPI0 + AT91_SPI_CSR(2)); #endif #ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 /* Configure CS3 */ @@ -76,21 +84,22 @@ void AT91F_SpiInit(void) (AT91_SPI_DLYBS & DATAFLASH_TCSS) | (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | ((get_mck_clk_rate() / AT91_SPI_CLK) << 8), - AT91_BASE_SPI + AT91_SPI_CSR(3)); + ATMEL_BASE_SPI0 + AT91_SPI_CSR(3)); #endif /* SPI_Enable */ - writel(AT91_SPI_SPIEN, AT91_BASE_SPI + AT91_SPI_CR); + writel(AT91_SPI_SPIEN, ATMEL_BASE_SPI0 + AT91_SPI_CR); - while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_SPIENS)); + while (!(readl(ATMEL_BASE_SPI0 + AT91_SPI_SR) & AT91_SPI_SPIENS)) + ; /* * Add tempo to get SPI in a safe state. * Should not be needed for new silicon (Rev B) */ udelay(500000); - readl(AT91_BASE_SPI + AT91_SPI_SR); - readl(AT91_BASE_SPI + AT91_SPI_RDR); + readl(ATMEL_BASE_SPI0 + AT91_SPI_SR); + readl(ATMEL_BASE_SPI0 + AT91_SPI_RDR); } @@ -100,33 +109,33 @@ void AT91F_SpiEnable(int cs) switch (cs) { case 0: /* Configure SPI CS0 for Serial DataFlash AT45DBxx */ - mode = readl(AT91_BASE_SPI + AT91_SPI_MR); + mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR); mode &= 0xFFF0FFFF; writel(mode | ((AT91_SPI_PCS0_DATAFLASH_CARD<<16) & AT91_SPI_PCS), - AT91_BASE_SPI + AT91_SPI_MR); + ATMEL_BASE_SPI0 + AT91_SPI_MR); break; case 1: /* Configure SPI CS1 for Serial DataFlash AT45DBxx */ - mode = readl(AT91_BASE_SPI + AT91_SPI_MR); + mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR); mode &= 0xFFF0FFFF; writel(mode | ((AT91_SPI_PCS1_DATAFLASH_CARD<<16) & AT91_SPI_PCS), - AT91_BASE_SPI + AT91_SPI_MR); + ATMEL_BASE_SPI0 + AT91_SPI_MR); break; case 2: /* Configure SPI CS2 for Serial DataFlash AT45DBxx */ - mode = readl(AT91_BASE_SPI + AT91_SPI_MR); + mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR); mode &= 0xFFF0FFFF; writel(mode | ((AT91_SPI_PCS2_DATAFLASH_CARD<<16) & AT91_SPI_PCS), - AT91_BASE_SPI + AT91_SPI_MR); + ATMEL_BASE_SPI0 + AT91_SPI_MR); break; case 3: - mode = readl(AT91_BASE_SPI + AT91_SPI_MR); + mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR); mode &= 0xFFF0FFFF; writel(mode | ((AT91_SPI_PCS3_DATAFLASH_CARD<<16) & AT91_SPI_PCS), - AT91_BASE_SPI + AT91_SPI_MR); + ATMEL_BASE_SPI0 + AT91_SPI_MR); break; } /* SPI_Enable */ - writel(AT91_SPI_SPIEN, AT91_BASE_SPI + AT91_SPI_CR); + writel(AT91_SPI_SPIEN, ATMEL_BASE_SPI0 + AT91_SPI_CR); } unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc); @@ -134,37 +143,48 @@ unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc); unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) { unsigned int timeout; + unsigned int timebase; pDesc->state = BUSY; - writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR); + writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, + ATMEL_BASE_SPI0 + AT91_SPI_PTCR); /* Initialize the Transmit and Receive Pointer */ - writel((unsigned int)pDesc->rx_cmd_pt, AT91_BASE_SPI + AT91_SPI_RPR); - writel((unsigned int)pDesc->tx_cmd_pt, AT91_BASE_SPI + AT91_SPI_TPR); + writel((unsigned int)pDesc->rx_cmd_pt, + ATMEL_BASE_SPI0 + AT91_SPI_RPR); + writel((unsigned int)pDesc->tx_cmd_pt, + ATMEL_BASE_SPI0 + AT91_SPI_TPR); /* Intialize the Transmit and Receive Counters */ - writel(pDesc->rx_cmd_size, AT91_BASE_SPI + AT91_SPI_RCR); - writel(pDesc->tx_cmd_size, AT91_BASE_SPI + AT91_SPI_TCR); + writel(pDesc->rx_cmd_size, ATMEL_BASE_SPI0 + AT91_SPI_RCR); + writel(pDesc->tx_cmd_size, ATMEL_BASE_SPI0 + AT91_SPI_TCR); if (pDesc->tx_data_size != 0) { /* Initialize the Next Transmit and Next Receive Pointer */ - writel((unsigned int)pDesc->rx_data_pt, AT91_BASE_SPI + AT91_SPI_RNPR); - writel((unsigned int)pDesc->tx_data_pt, AT91_BASE_SPI + AT91_SPI_TNPR); + writel((unsigned int)pDesc->rx_data_pt, + ATMEL_BASE_SPI0 + AT91_SPI_RNPR); + writel((unsigned int)pDesc->tx_data_pt, + ATMEL_BASE_SPI0 + AT91_SPI_TNPR); /* Intialize the Next Transmit and Next Receive Counters */ - writel(pDesc->rx_data_size, AT91_BASE_SPI + AT91_SPI_RNCR); - writel(pDesc->tx_data_size, AT91_BASE_SPI + AT91_SPI_TNCR); + writel(pDesc->rx_data_size, + ATMEL_BASE_SPI0 + AT91_SPI_RNCR); + writel(pDesc->tx_data_size, + ATMEL_BASE_SPI0 + AT91_SPI_TNCR); } /* arm simple, non interrupt dependent timer */ - reset_timer_masked(); + timebase = get_timer(0); timeout = 0; - writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, AT91_BASE_SPI + AT91_SPI_PTCR); - while (!(readl(AT91_BASE_SPI + AT91_SPI_SR) & AT91_SPI_RXBUFF) && - ((timeout = get_timer_masked()) < CONFIG_SYS_SPI_WRITE_TOUT)); - writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR); + writel(AT91_SPI_TXTEN + AT91_SPI_RXTEN, + ATMEL_BASE_SPI0 + AT91_SPI_PTCR); + while (!(readl(ATMEL_BASE_SPI0 + AT91_SPI_SR) & AT91_SPI_RXBUFF) && + ((timeout = get_timer(timebase)) < CONFIG_SYS_SPI_WRITE_TOUT)) + ; + writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, + ATMEL_BASE_SPI0 + AT91_SPI_PTCR); pDesc->state = IDLE; if (timeout >= CONFIG_SYS_SPI_WRITE_TOUT) { diff --git a/include/dataflash.h b/include/dataflash.h index 63b3bf96343..96ac0975a63 100644 --- a/include/dataflash.h +++ b/include/dataflash.h @@ -34,7 +34,6 @@ #define _DataFlash_h -#include #include "config.h" /*number of protected area*/ -- cgit v1.3.1 From 7f6ed7ff7c3cd4cc7c30ea9d51b1013318f57467 Mon Sep 17 00:00:00 2001 From: Reinhard Meyer Date: Fri, 4 Feb 2011 20:17:33 +0100 Subject: AT91: fix at91sam_wdt.c to reworked header files Signed-off-by: Reinhard Meyer --- drivers/watchdog/at91sam9_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 62547651a5f..80dad07d84e 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include /* -- cgit v1.3.1