From ab0df36fc7db9dda0b786b909f653e279dfeb9cf Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Fri, 29 Aug 2008 21:09:49 +0200 Subject: avr32: refactor the portmux/gpio code - Separate the portmux configuration functionality from the GPIO pin control API. - Separate the controller-specific code from the chip-specific code. - Allow "ganged" port configuration (multiple pins at once). - Add more flexibility to the "canned" peripheral select functions: - Allow using more than 23 address bits, more chip selects, as well as NAND- and CF-specific pins. - Make the MACB SPEED pin optional, and choose between MII/RMII using a parameter instead of an #ifdef. - Make it possible to use other MMC slots than slot 0, and support different MMC/SDCard data bus widths. - Use more reasonable pull-up defaults; floating pins may consume a lot of power. - Get rid of some custom portmux code from the mimc200 board code. The old gpio/portmux API couldn't really handle its requirements, but the new one can. - Add documentation. The end result is slightly smaller code for all boards. Which isn't really the point, but at least it isn't any larger. This has been verified on ATSTK1002 and ATNGW100. I'd appreciate if the board maintainers could help me test this on their boards. In particular, the mimc200 port has lost a lot of code, so I'm hoping Mark can help me out. Signed-off-by: Haavard Skinnemoen Cc: Hans-Christian Egtvedt Cc: Mark Jackson Cc: Alex Raimondi Cc: Julien May Changes since v1: * Enable pullup on NWAIT * Add missing include to portmux-pio.h * Rename CONFIG_PIO2 -> CONFIG_PORTMUX_PIO to match docs --- board/atmel/atngw100/atngw100.c | 15 ++++++++------- board/atmel/atstk1000/atstk1000.c | 12 ++++++------ 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'board/atmel') diff --git a/board/atmel/atngw100/atngw100.c b/board/atmel/atngw100/atngw100.c index 7f3e48541d..03544aa211 100644 --- a/board/atmel/atngw100/atngw100.c +++ b/board/atmel/atngw100/atngw100.c @@ -26,6 +26,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -50,18 +51,18 @@ int board_early_init_f(void) /* Enable SDRAM in the EBI mux */ hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE)); - gpio_enable_ebi(); - gpio_enable_usart1(); + portmux_enable_ebi(16, 23, 0, PORTMUX_DRIVE_HIGH); + portmux_enable_usart1(PORTMUX_DRIVE_MIN); #if defined(CONFIG_MACB) - gpio_enable_macb0(); - gpio_enable_macb1(); + portmux_enable_macb0(PORTMUX_MACB_MII, PORTMUX_DRIVE_HIGH); + portmux_enable_macb1(PORTMUX_MACB_MII, PORTMUX_DRIVE_HIGH); #endif #if defined(CONFIG_MMC) - gpio_enable_mmci(); + portmux_enable_mmci(0, PORTMUX_MMCI_4BIT, PORTMUX_DRIVE_LOW); #endif #if defined(CONFIG_ATMEL_SPI) - gpio_enable_spi0(1 << 0); + portmux_enable_spi0(1 << 0, PORTMUX_DRIVE_LOW); #endif return 0; @@ -108,7 +109,7 @@ int board_eth_init(bd_t *bi) #ifdef CONFIG_ATMEL_SPI #include -#define ATNGW100_DATAFLASH_CS_PIN GPIO_PIN_PA3 +#define ATNGW100_DATAFLASH_CS_PIN GPIO_PIN_PA(3) int spi_cs_is_valid(unsigned int bus, unsigned int cs) { diff --git a/board/atmel/atstk1000/atstk1000.c b/board/atmel/atstk1000/atstk1000.c index 915b1c3539..cc400a92f8 100644 --- a/board/atmel/atstk1000/atstk1000.c +++ b/board/atmel/atstk1000/atstk1000.c @@ -24,8 +24,8 @@ #include #include #include -#include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -77,14 +77,14 @@ int board_early_init_f(void) /* Enable SDRAM in the EBI mux */ hmatrix_slave_write(EBI, SFR, HMATRIX_BIT(EBI_SDRAM_ENABLE)); - gpio_enable_ebi(); - gpio_enable_usart1(); + portmux_enable_ebi(sdram_config.data_bits, 23, 0, PORTMUX_DRIVE_HIGH); + portmux_enable_usart1(PORTMUX_DRIVE_MIN); #if defined(CONFIG_MACB) - gpio_enable_macb0(); - gpio_enable_macb1(); + portmux_enable_macb0(PORTMUX_MACB_MII, PORTMUX_DRIVE_LOW); + portmux_enable_macb1(PORTMUX_MACB_MII, PORTMUX_DRIVE_LOW); #endif #if defined(CONFIG_MMC) - gpio_enable_mmci(); + portmux_enable_mmci(0, PORTMUX_MMCI_4BIT, PORTMUX_DRIVE_LOW); #endif return 0; -- cgit v1.2.3 From 25e6854d42c11046a468576179b5494f850311b2 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Sun, 31 Aug 2008 18:46:35 +0200 Subject: avr32: use board_early_init_r instead of board_init_info Replace the avr32-specific board_init_info hook by the standard board_early_init_r hook and make it optional. board_early_init_r() runs somewhat earlier than board_init_info used to do, but this isn't a problem for any of the in-tree boards. Signed-off-by: Haavard Skinnemoen --- board/atmel/atngw100/atngw100.c | 3 ++- board/atmel/atstk1000/atstk1000.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'board/atmel') diff --git a/board/atmel/atngw100/atngw100.c b/board/atmel/atngw100/atngw100.c index 03544aa211..480d5255fd 100644 --- a/board/atmel/atngw100/atngw100.c +++ b/board/atmel/atngw100/atngw100.c @@ -88,10 +88,11 @@ phys_size_t initdram(int board_type) return actual_size; } -void board_init_info(void) +int board_early_init_r(void) { gd->bd->bi_phy_id[0] = 0x01; gd->bd->bi_phy_id[1] = 0x03; + return 0; } extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); diff --git a/board/atmel/atstk1000/atstk1000.c b/board/atmel/atstk1000/atstk1000.c index cc400a92f8..7be39931e5 100644 --- a/board/atmel/atstk1000/atstk1000.c +++ b/board/atmel/atstk1000/atstk1000.c @@ -110,10 +110,11 @@ phys_size_t initdram(int board_type) return actual_size; } -void board_init_info(void) +int board_early_init_r(void) { gd->bd->bi_phy_id[0] = 0x10; gd->bd->bi_phy_id[1] = 0x11; + return 0; } extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr); -- cgit v1.2.3 From d92852579546c46bdaac978e0b6767a6645b69e0 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Fri, 15 Aug 2008 15:02:29 +0200 Subject: atstk1000: Convert to new-style makefile Signed-off-by: Haavard Skinnemoen --- board/atmel/atstk1000/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'board/atmel') diff --git a/board/atmel/atstk1000/Makefile b/board/atmel/atstk1000/Makefile index 155d46ac97..f9b26e5d3b 100644 --- a/board/atmel/atstk1000/Makefile +++ b/board/atmel/atstk1000/Makefile @@ -24,12 +24,13 @@ include $(TOPDIR)/config.mk -LIB := $(obj)lib$(BOARD).a +LIB := $(obj)lib$(BOARD).a -COBJS := $(BOARD).o flash.o +COBJS-y += $(BOARD).o +COBJS-y += flash.o -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y)) $(LIB): $(obj).depend $(OBJS) $(AR) $(ARFLAGS) $@ $(OBJS) -- cgit v1.2.3 From d8f2aa3298610b44127dbc4796d8038aa5847e0b Mon Sep 17 00:00:00 2001 From: Olav Morken Date: Fri, 23 Jan 2009 12:56:27 +0100 Subject: AVR32: Make cacheflush cpu-dependent The AT32UC3A series of processors doesn't contain any cache, and issuing cache control instructions on those will cause an exception. This commit makes cacheflush.h arch-dependent in preparation for the AT32UC3A-support. Signed-off-by: Gunnar Rangoy Signed-off-by: Paul Driveklepp Signed-off-by: Olav Morken Signed-off-by: Haavard Skinnemoen --- board/atmel/atstk1000/flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board/atmel') diff --git a/board/atmel/atstk1000/flash.c b/board/atmel/atstk1000/flash.c index 4d380f3fac..0ba06ddc5d 100644 --- a/board/atmel/atstk1000/flash.c +++ b/board/atmel/atstk1000/flash.c @@ -22,7 +22,7 @@ #include #ifdef CONFIG_ATSTK1000_EXT_FLASH -#include +#include #include #include -- cgit v1.2.3