From 438ff3f3cc33833206a48492e9d6674e4e82bed8 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Mon, 29 Oct 2007 15:28:07 +0100 Subject: [PATCH] [AVR32] Add support for AT32AP7001 and AT32AP7002 These are derivatives of the AT32AP7000 chip, which means that most of the code stays the same. Rename a few files, functions, definitions and config symbols to reflect that they apply to all AP700x chips, and exclude some platform devices from chips where they aren't present. Signed-off-by: Haavard Skinnemoen --- arch/avr32/Kconfig | 21 +++++++++++++++---- arch/avr32/Makefile | 2 +- arch/avr32/boards/atngw100/setup.c | 2 +- arch/avr32/configs/atngw100_defconfig | 9 +++++--- arch/avr32/configs/atstk1002_defconfig | 8 ++++--- arch/avr32/mach-at32ap/Kconfig | 12 +++++------ arch/avr32/mach-at32ap/Makefile | 4 ++-- .../{at32ap7000.c => at32ap700x.c} | 14 ++++++++++++- drivers/watchdog/Kconfig | 2 +- .../{at32ap7000.h => at32ap700x.h} | 6 +++--- include/asm-avr32/arch-at32ap/cpu.h | 2 +- include/asm-avr32/arch-at32ap/io.h | 4 ++-- 12 files changed, 58 insertions(+), 28 deletions(-) rename arch/avr32/mach-at32ap/{at32ap7000.c => at32ap700x.c} (99%) rename include/asm-avr32/arch-at32ap/{at32ap7000.h => at32ap700x.h} (89%) diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index 767a19cfa423..e37e6b92658d 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig @@ -84,13 +84,26 @@ config PLATFORM_AT32AP select MMU select PERFORMANCE_COUNTERS +config CPU_AT32AP700X + bool + select PLATFORM_AT32AP + choice prompt "AVR32 CPU type" default CPU_AT32AP7000 config CPU_AT32AP7000 bool "AT32AP7000" - select PLATFORM_AT32AP + select CPU_AT32AP700X + +config CPU_AT32AP7001 + bool "AT32AP7001" + select CPU_AT32AP700X + +config CPU_AT32AP7002 + bool "AT32AP7002" + select CPU_AT32AP700X + endchoice # @@ -126,15 +139,15 @@ source "arch/avr32/mach-at32ap/Kconfig" config LOAD_ADDRESS hex - default 0x10000000 if LOADER_U_BOOT=y && CPU_AT32AP7000=y + default 0x10000000 if LOADER_U_BOOT=y && CPU_AT32AP700X=y config ENTRY_ADDRESS hex - default 0x90000000 if LOADER_U_BOOT=y && CPU_AT32AP7000=y + default 0x90000000 if LOADER_U_BOOT=y && CPU_AT32AP700X=y config PHYS_OFFSET hex - default 0x10000000 if CPU_AT32AP7000=y + default 0x10000000 if CPU_AT32AP700X=y source "kernel/Kconfig.preempt" diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile index f75d52cd2a4c..17a3529341dd 100644 --- a/arch/avr32/Makefile +++ b/arch/avr32/Makefile @@ -16,7 +16,7 @@ KBUILD_AFLAGS += -mrelax -mno-pic CFLAGS_MODULE += -mno-relax LDFLAGS_vmlinux += --relax -cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000 +cpuflags-$(CONFIG_PLATFORM_AT32AP) += -march=ap KBUILD_CFLAGS += $(cpuflags-y) KBUILD_AFLAGS += $(cpuflags-y) diff --git a/arch/avr32/boards/atngw100/setup.c b/arch/avr32/boards/atngw100/setup.c index 52987c81d668..a398be284966 100644 --- a/arch/avr32/boards/atngw100/setup.c +++ b/arch/avr32/boards/atngw100/setup.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include #include diff --git a/arch/avr32/configs/atngw100_defconfig b/arch/avr32/configs/atngw100_defconfig index b799a68ffd97..374c17bcc05e 100644 --- a/arch/avr32/configs/atngw100_defconfig +++ b/arch/avr32/configs/atngw100_defconfig @@ -111,7 +111,10 @@ CONFIG_SUBARCH_AVR32B=y CONFIG_MMU=y CONFIG_PERFORMANCE_COUNTERS=y CONFIG_PLATFORM_AT32AP=y +CONFIG_CPU_AT32AP700X=y CONFIG_CPU_AT32AP7000=y +# CONFIG_CPU_AT32AP7001 is not set +# CONFIG_CPU_AT32AP7002 is not set # CONFIG_BOARD_ATSTK1000 is not set CONFIG_BOARD_ATNGW100=y CONFIG_LOADER_U_BOOT=y @@ -119,9 +122,9 @@ CONFIG_LOADER_U_BOOT=y # # Atmel AVR32 AP options # -# CONFIG_AP7000_32_BIT_SMC is not set -CONFIG_AP7000_16_BIT_SMC=y -# CONFIG_AP7000_8_BIT_SMC is not set +# CONFIG_AP700X_32_BIT_SMC is not set +CONFIG_AP700X_16_BIT_SMC=y +# CONFIG_AP700X_8_BIT_SMC is not set CONFIG_LOAD_ADDRESS=0x10000000 CONFIG_ENTRY_ADDRESS=0x90000000 CONFIG_PHYS_OFFSET=0x10000000 diff --git a/arch/avr32/configs/atstk1002_defconfig b/arch/avr32/configs/atstk1002_defconfig index 3b977fdbaa78..7614c5465cd6 100644 --- a/arch/avr32/configs/atstk1002_defconfig +++ b/arch/avr32/configs/atstk1002_defconfig @@ -114,6 +114,8 @@ CONFIG_MMU=y CONFIG_PERFORMANCE_COUNTERS=y CONFIG_PLATFORM_AT32AP=y CONFIG_CPU_AT32AP7000=y +# CONFIG_CPU_AT32AP7001 is not set +# CONFIG_CPU_AT32AP7002 is not set CONFIG_BOARD_ATSTK1002=y CONFIG_BOARD_ATSTK1000=y # CONFIG_BOARD_ATNGW100 is not set @@ -122,9 +124,9 @@ CONFIG_LOADER_U_BOOT=y # # Atmel AVR32 AP options # -# CONFIG_AP7000_32_BIT_SMC is not set -CONFIG_AP7000_16_BIT_SMC=y -# CONFIG_AP7000_8_BIT_SMC is not set +# CONFIG_AP700X_32_BIT_SMC is not set +CONFIG_AP700X_16_BIT_SMC=y +# CONFIG_AP700X_8_BIT_SMC is not set CONFIG_LOAD_ADDRESS=0x10000000 CONFIG_ENTRY_ADDRESS=0x90000000 CONFIG_PHYS_OFFSET=0x10000000 diff --git a/arch/avr32/mach-at32ap/Kconfig b/arch/avr32/mach-at32ap/Kconfig index eb307838457b..a7bbcc82058e 100644 --- a/arch/avr32/mach-at32ap/Kconfig +++ b/arch/avr32/mach-at32ap/Kconfig @@ -3,9 +3,9 @@ if PLATFORM_AT32AP menu "Atmel AVR32 AP options" choice - prompt "AT32AP7000 static memory bus width" - depends on CPU_AT32AP7000 - default AP7000_16_BIT_SMC + prompt "AT32AP700x static memory bus width" + depends on CPU_AT32AP700X + default AP700X_16_BIT_SMC help Define the width of the AP7000 external static memory interface. This is used to determine how to mangle the address and/or data @@ -15,13 +15,13 @@ choice width for all chip selects, excluding the flash (which is using raw access and is thus not affected by any of this.) -config AP7000_32_BIT_SMC +config AP700X_32_BIT_SMC bool "32 bit" -config AP7000_16_BIT_SMC +config AP700X_16_BIT_SMC bool "16 bit" -config AP7000_8_BIT_SMC +config AP700X_8_BIT_SMC bool "8 bit" endchoice diff --git a/arch/avr32/mach-at32ap/Makefile b/arch/avr32/mach-at32ap/Makefile index a8b445046e3e..5e9f8217befc 100644 --- a/arch/avr32/mach-at32ap/Makefile +++ b/arch/avr32/mach-at32ap/Makefile @@ -1,4 +1,4 @@ obj-y += at32ap.o clock.o intc.o extint.o pio.o hsmc.o -obj-$(CONFIG_CPU_AT32AP7000) += at32ap7000.o -obj-$(CONFIG_CPU_AT32AP7000) += time-tc.o +obj-$(CONFIG_CPU_AT32AP700X) += at32ap700x.o +obj-$(CONFIG_CPU_AT32AP700X) += time-tc.o obj-$(CONFIG_CPU_FREQ_AT32AP) += cpufreq.o diff --git a/arch/avr32/mach-at32ap/at32ap7000.c b/arch/avr32/mach-at32ap/at32ap700x.c similarity index 99% rename from arch/avr32/mach-at32ap/at32ap7000.c rename to arch/avr32/mach-at32ap/at32ap700x.c index 7c4388f4f17f..9386e1f82fb8 100644 --- a/arch/avr32/mach-at32ap/at32ap7000.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c @@ -14,7 +14,7 @@ #include -#include +#include #include #include @@ -803,6 +803,7 @@ void __init at32_setup_serial_console(unsigned int usart_id) * Ethernet * -------------------------------------------------------------------- */ +#ifdef CONFIG_CPU_AT32AP7000 static struct eth_platform_data macb0_data; static struct resource macb0_resource[] = { PBMEM(0xfff01800), @@ -890,6 +891,7 @@ at32_add_device_eth(unsigned int id, struct eth_platform_data *data) return pdev; } +#endif /* -------------------------------------------------------------------- * SPI @@ -1064,6 +1066,7 @@ err_add_resources: /* -------------------------------------------------------------------- * LCDC * -------------------------------------------------------------------- */ +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) static struct atmel_lcdfb_info atmel_lcdfb0_data; static struct resource atmel_lcdfb0_resource[] = { { @@ -1179,6 +1182,7 @@ err_dup_modedb: kfree(monspecs); return NULL; } +#endif /* -------------------------------------------------------------------- * SSC @@ -1332,6 +1336,7 @@ out_free_pdev: /* -------------------------------------------------------------------- * IDE / CompactFlash * -------------------------------------------------------------------- */ +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7001) static struct resource at32_smc_cs4_resource[] __initdata = { { .start = 0x04000000, @@ -1464,6 +1469,7 @@ fail: platform_device_put(pdev); return NULL; } +#endif /* -------------------------------------------------------------------- * AC97C @@ -1639,16 +1645,20 @@ struct clk *at32_clock_list[] = { &atmel_usart1_usart, &atmel_usart2_usart, &atmel_usart3_usart, +#if defined(CONFIG_CPU_AT32AP7000) &macb0_hclk, &macb0_pclk, &macb1_hclk, &macb1_pclk, +#endif &atmel_spi0_spi_clk, &atmel_spi1_spi_clk, &atmel_twi0_pclk, &atmel_mci0_pclk, +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) &atmel_lcdfb0_hck1, &atmel_lcdfb0_pixclk, +#endif &ssc0_pclk, &ssc1_pclk, &ssc2_pclk, @@ -1697,7 +1707,9 @@ void __init at32_clock_init(void) genclk_init_parent(&gclk2); genclk_init_parent(&gclk3); genclk_init_parent(&gclk4); +#if defined(CONFIG_CPU_AT32AP7000) || defined(CONFIG_CPU_AT32AP7002) genclk_init_parent(&atmel_lcdfb0_pixclk); +#endif genclk_init_parent(&abdac0_sample_clk); /* diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 52dff40ec192..fbd61127b9d9 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -223,7 +223,7 @@ config DAVINCI_WATCHDOG config AT32AP700X_WDT tristate "AT32AP700x watchdog" - depends on CPU_AT32AP7000 + depends on CPU_AT32AP700X help Watchdog timer embedded into AT32AP700x devices. This will reboot your system when the timeout is reached. diff --git a/include/asm-avr32/arch-at32ap/at32ap7000.h b/include/asm-avr32/arch-at32ap/at32ap700x.h similarity index 89% rename from include/asm-avr32/arch-at32ap/at32ap7000.h rename to include/asm-avr32/arch-at32ap/at32ap700x.h index 3914d7b94ff4..99684d6f3967 100644 --- a/include/asm-avr32/arch-at32ap/at32ap7000.h +++ b/include/asm-avr32/arch-at32ap/at32ap700x.h @@ -7,8 +7,8 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#ifndef __ASM_ARCH_AT32AP7000_H__ -#define __ASM_ARCH_AT32AP7000_H__ +#ifndef __ASM_ARCH_AT32AP700X_H__ +#define __ASM_ARCH_AT32AP700X_H__ #define GPIO_PERIPH_A 0 #define GPIO_PERIPH_B 1 @@ -32,4 +32,4 @@ #define GPIO_PIN_PD(N) (GPIO_PIOD_BASE + (N)) #define GPIO_PIN_PE(N) (GPIO_PIOE_BASE + (N)) -#endif /* __ASM_ARCH_AT32AP7000_H__ */ +#endif /* __ASM_ARCH_AT32AP700X_H__ */ diff --git a/include/asm-avr32/arch-at32ap/cpu.h b/include/asm-avr32/arch-at32ap/cpu.h index a762f42cbb71..0dc20261c1ea 100644 --- a/include/asm-avr32/arch-at32ap/cpu.h +++ b/include/asm-avr32/arch-at32ap/cpu.h @@ -14,7 +14,7 @@ * Only AT32AP7000 is defined for now. We can identify the specific * chip at runtime, but I'm not sure if it's really worth it. */ -#ifdef CONFIG_CPU_AT32AP7000 +#ifdef CONFIG_CPU_AT32AP700X # define cpu_is_at32ap7000() (1) #else # define cpu_is_at32ap7000() (0) diff --git a/include/asm-avr32/arch-at32ap/io.h b/include/asm-avr32/arch-at32ap/io.h index ee59e401f041..4ec6abc68ea3 100644 --- a/include/asm-avr32/arch-at32ap/io.h +++ b/include/asm-avr32/arch-at32ap/io.h @@ -4,7 +4,7 @@ /* For "bizarre" halfword swapping */ #include -#if defined(CONFIG_AP7000_32_BIT_SMC) +#if defined(CONFIG_AP700X_32_BIT_SMC) # define __swizzle_addr_b(addr) (addr ^ 3UL) # define __swizzle_addr_w(addr) (addr ^ 2UL) # define __swizzle_addr_l(addr) (addr) @@ -14,7 +14,7 @@ # define __mem_ioswabb(a, x) (x) # define __mem_ioswabw(a, x) swab16(x) # define __mem_ioswabl(a, x) swab32(x) -#elif defined(CONFIG_AP7000_16_BIT_SMC) +#elif defined(CONFIG_AP700X_16_BIT_SMC) # define __swizzle_addr_b(addr) (addr ^ 1UL) # define __swizzle_addr_w(addr) (addr) # define __swizzle_addr_l(addr) (addr) -- 2.34.1