Skip to contentSkip to conversation

AVR32: Add support for ATSTK1003 and ATSTK1004

PATCH New Haavard Skinnemoen 3 participants 10 messages Oct 30, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

cover AVR32: Add support for ATSTK1003 and ATSTK1004

ATSTK1003 and ATSTK1004 are CPU daughterboards for the ATSTK1000, featuring the AT32AP7001 and AT32AP7002 CPUs respectively. These CPUs are both derivatives of the AT32AP7000, so the actual code required to support them is minimal.

The following four patches will first refactor the AP7000 code so that it works for all the three CPUs. Then, support for the ATSTK1003 and ATSTK1004 board is trivially added.

I'm posting this for review so that it can be merged as soon as the next merge window opens. Combined diffstat, summary and shortlog below.

Haavard

 Makefile                                           |    8 +-
 cpu/at32ap/{at32ap7000 => at32ap700x}/Makefile     |    0 
 cpu/at32ap/{at32ap7000 => at32ap700x}/gpio.c       |    7 +
 include/asm-avr32/arch-at32ap700x/chip-features.h  |   34 ++++
 .../{arch-at32ap7000 => arch-at32ap700x}/clk.h     |    8 +
 .../{arch-at32ap7000 => arch-at32ap700x}/gpio.h    |    8 +
 .../hmatrix2.h                                     |    0 
 .../memory-map.h                                   |    0 
 .../{arch-at32ap7000 => arch-at32ap700x}/mmc.h     |    0 
 include/configs/atstk1003.h                        |  184 +++++++++++++++++++
 include/configs/atstk1004.h                        |  185 ++++++++++++++++++++
 11 files changed, 433 insertions(+), 1 deletions(-)
 rename cpu/at32ap/{at32ap7000 => at32ap700x}/Makefile (100%)
 rename cpu/at32ap/{at32ap7000 => at32ap700x}/gpio.c (96%)
 create mode 100644 include/asm-avr32/arch-at32ap700x/chip-features.h
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/clk.h (92%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/gpio.h (98%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/hmatrix2.h (100%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/memory-map.h (100%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/mmc.h (100%)
 create mode 100644 include/configs/atstk1003.h
 create mode 100644 include/configs/atstk1004.h

Haavard Skinnemoen (4):
AVR32: Rename at32ap7000 -> at32ap700x
AVR32: Make some AT32AP700x peripherals optional
AVR32: Add support for the ATSTK1003 board
AVR32: Add support for the ATSTK1004 board

#1 lore raw

PATCH 1/4 AVR32: Rename at32ap7000 -> at32ap700x

The SoC-specific code for all the AT32AP700x CPUs is practically identical; the only difference is that some chips have less features than others. By doing this rename, we can add support for the AP7000 derivatives simply by making some features conditional.

---
 Makefile                                           |    2 +-
 cpu/at32ap/{at32ap7000 => at32ap700x}/Makefile     |    0 
 cpu/at32ap/{at32ap7000 => at32ap700x}/gpio.c       |    0 
 .../{arch-at32ap7000 => arch-at32ap700x}/clk.h     |    0 
 .../{arch-at32ap7000 => arch-at32ap700x}/gpio.h    |    0 
 .../hmatrix2.h                                     |    0 
 .../memory-map.h                                   |    0 
 .../{arch-at32ap7000 => arch-at32ap700x}/mmc.h     |    0 
 8 files changed, 1 insertions(+), 1 deletions(-)
 rename cpu/at32ap/{at32ap7000 => at32ap700x}/Makefile (100%)
 rename cpu/at32ap/{at32ap7000 => at32ap700x}/gpio.c (100%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/clk.h (100%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/gpio.h (100%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/hmatrix2.h (100%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/memory-map.h (100%)
 rename include/asm-avr32/{arch-at32ap7000 => arch-at32ap700x}/mmc.h (100%)
Makefile +1 -1
index 5643aa9..f650b27 100644
@@ -2603,7 +2603,7 @@ bf561-ezkit_config:	unconfig
 #########################################################################
 
 atstk1002_config	:	unconfig
-	@$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap7000
+	@$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
 #########################################################################
 #########################################################################
cpu/at32ap/at32ap700x/Makefile renamed from cpu/at32ap/at32ap7000/Makefile +0 -0
similarity index 100%
rename from cpu/at32ap/at32ap7000/Makefile
rename to cpu/at32ap/at32ap700x/Makefile
cpu/at32ap/at32ap700x/gpio.c renamed from cpu/at32ap/at32ap7000/gpio.c +0 -0
similarity index 100%
rename from cpu/at32ap/at32ap7000/gpio.c
rename to cpu/at32ap/at32ap700x/gpio.c
include/asm-avr32/arch-at32ap700x/clk.h renamed from include/asm-avr32/arch-at32ap7000/clk.h +0 -0
similarity index 100%
rename from include/asm-avr32/arch-at32ap7000/clk.h
rename to include/asm-avr32/arch-at32ap700x/clk.h
include/asm-avr32/arch-at32ap700x/gpio.h renamed from include/asm-avr32/arch-at32ap7000/gpio.h +0 -0
similarity index 100%
rename from include/asm-avr32/arch-at32ap7000/gpio.h
rename to include/asm-avr32/arch-at32ap700x/gpio.h
include/asm-avr32/arch-at32ap700x/hmatrix2.h renamed from include/asm-avr32/arch-at32ap7000/hmatrix2.h +0 -0
similarity index 100%
rename from include/asm-avr32/arch-at32ap7000/hmatrix2.h
rename to include/asm-avr32/arch-at32ap700x/hmatrix2.h
include/asm-avr32/arch-at32ap700x/memory-map.h renamed from include/asm-avr32/arch-at32ap7000/memory-map.h +0 -0
similarity index 100%
rename from include/asm-avr32/arch-at32ap7000/memory-map.h
rename to include/asm-avr32/arch-at32ap700x/memory-map.h
include/asm-avr32/arch-at32ap700x/mmc.h renamed from include/asm-avr32/arch-at32ap7000/mmc.h +0 -0
similarity index 100%
rename from include/asm-avr32/arch-at32ap7000/mmc.h
rename to include/asm-avr32/arch-at32ap700x/mmc.h
Signature · 1 line
1.5.3.4
#2 lore raw

PATCH 2/4 AVR32: Make some AT32AP700x peripherals optional

Add a chip-features file providing definitions of the form

AT32AP700x_CHIP_HAS_<peripheral>

to indicate the availability of the given peripheral on the currently selected chip.

---
 cpu/at32ap/at32ap700x/gpio.c                      |    7 ++++
 include/asm-avr32/arch-at32ap700x/chip-features.h |   34 +++++++++++++++++++++
 include/asm-avr32/arch-at32ap700x/clk.h           |    8 +++++
 include/asm-avr32/arch-at32ap700x/gpio.h          |    8 +++++
 4 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-avr32/arch-at32ap700x/chip-features.h
cpu/at32ap/at32ap700x/gpio.c +7 -0
index 52f5372..2d53726 100644
@@ -21,6 +21,7 @@
  */
 #include <common.h>
 
+#include <asm/arch/chip-features.h>
 #include <asm/arch/gpio.h>
 
 /*
@@ -52,6 +53,7 @@ void gpio_enable_ebi(void)
 #endif
 }
 
+#ifdef AT32AP700x_CHIP_HAS_USART
 void gpio_enable_usart0(void)
 {
 	gpio_select_periph_B(GPIO_PIN_PA8, 0);
@@ -75,7 +77,9 @@ void gpio_enable_usart3(void)
 	gpio_select_periph_B(GPIO_PIN_PB18, 0);
 	gpio_select_periph_B(GPIO_PIN_PB19, 0);
 }
+#endif
 
+#ifdef AT32AP700x_CHIP_HAS_MACB
 void gpio_enable_macb0(void)
 {
 	gpio_select_periph_A(GPIO_PIN_PC3,  0);	/* TXD0	*/
@@ -125,7 +129,9 @@ void gpio_enable_macb1(void)
 	gpio_select_periph_B(GPIO_PIN_PD15, 0);	/* SPD	*/
 #endif
 }
+#endif
 
+#ifdef AT32AP700x_CHIP_HAS_MMCI
 void gpio_enable_mmci(void)
 {
 	gpio_select_periph_A(GPIO_PIN_PA10, 0);	/* CLK	 */
@@ -135,3 +141,4 @@ void gpio_enable_mmci(void)
 	gpio_select_periph_A(GPIO_PIN_PA14, 0);	/* DATA2 */
 	gpio_select_periph_A(GPIO_PIN_PA15, 0);	/* DATA3 */
 }
+#endif
include/asm-avr32/arch-at32ap700x/chip-features.h new file +34 -0
new file mode 100644
index 0000000..29b1fd6
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2007 Atmel Corporation
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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_AVR32_ARCH_CHIP_FEATURES_H__
+#define __ASM_AVR32_ARCH_CHIP_FEATURES_H__
+
+/* Currently, all the AP700x chips have these */
+#define AT32AP700x_CHIP_HAS_USART
+#define AT32AP700x_CHIP_HAS_MMCI
+
+/* Only AP7000 has ethernet interface */
+#ifdef CONFIG_AT32AP7000
+#define AT32AP700x_CHIP_HAS_MACB
+#endif
+
+#endif /* __ASM_AVR32_ARCH_CHIP_FEATURES_H__ */
include/asm-avr32/arch-at32ap700x/clk.h +8 -0
index 7e20d97..ea84c08 100644
@@ -22,6 +22,8 @@
 #ifndef __ASM_AVR32_ARCH_CLK_H__
 #define __ASM_AVR32_ARCH_CLK_H__
 
+#include <asm/arch/chip-features.h>
+
 #ifdef CONFIG_PLL
 #define MAIN_CLK_RATE ((CFG_OSC0_HZ / CFG_PLL0_DIV) * CFG_PLL0_MUL)
 #else
@@ -50,10 +52,13 @@ static inline unsigned long get_sdram_clk_rate(void)
 {
 	return get_hsb_clk_rate();
 }
+#ifdef AT32AP700x_CHIP_HAS_USART
 static inline unsigned long get_usart_clk_rate(unsigned int dev_id)
 {
 	return get_pba_clk_rate();
 }
+#endif
+#ifdef AT32AP700x_CHIP_HAS_USART
 static inline unsigned long get_macb_pclk_rate(unsigned int dev_id)
 {
 	return get_pbb_clk_rate();
@@ -62,9 +67,12 @@ static inline unsigned long get_macb_hclk_rate(unsigned int dev_id)
 {
 	return get_hsb_clk_rate();
 }
+#endif
+#ifdef AT32AP700x_CHIP_HAS_MMCI
 static inline unsigned long get_mci_clk_rate(void)
 {
 	return get_pbb_clk_rate();
 }
+#endif
 
 #endif /* __ASM_AVR32_ARCH_CLK_H__ */
include/asm-avr32/arch-at32ap700x/gpio.h +8 -0
index e4812d4..b10a3e4 100644
@@ -22,6 +22,7 @@
 #ifndef __ASM_AVR32_ARCH_GPIO_H__
 #define __ASM_AVR32_ARCH_GPIO_H__
 
+#include <asm/arch/chip-features.h>
 #include <asm/arch/memory-map.h>
 
 #define NR_GPIO_CONTROLLERS	5
@@ -201,12 +202,19 @@ void gpio_select_periph_A(unsigned int pin, int use_pullup);
 void gpio_select_periph_B(unsigned int pin, int use_pullup);
 
 void gpio_enable_ebi(void);
+
+#ifdef AT32AP700x_CHIP_HAS_USART
 void gpio_enable_usart0(void);
 void gpio_enable_usart1(void);
 void gpio_enable_usart2(void);
 void gpio_enable_usart3(void);
+#endif
+#ifdef AT32AP700x_CHIP_HAS_MACB
 void gpio_enable_macb0(void);
 void gpio_enable_macb1(void);
+#endif
+#ifdef AT32AP700x_CHIP_HAS_MMCI
 void gpio_enable_mmci(void);
+#endif
 
 #endif /* __ASM_AVR32_ARCH_GPIO_H__ */
Signature · 1 line
1.5.3.4
#3 lore raw

PATCH 3/4 AVR32: Add support for the ATSTK1003 board

ATSTK1003 is a daughterboard for ATSTK1000 with the AT32AP7001 CPU, which is a derivative of AT32AP7000.

---
 Makefile                    |    3 +
 include/configs/atstk1003.h |  184 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 187 insertions(+), 0 deletions(-)
 create mode 100644 include/configs/atstk1003.h
Makefile +3 -0
index f650b27..03de2f1 100644
@@ -2605,6 +2605,9 @@ bf561-ezkit_config:	unconfig
 atstk1002_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
+atstk1003_config	:	unconfig
+	@$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
+
 #########################################################################
 #########################################################################
 #########################################################################
include/configs/atstk1003.h new file +184 -0

184 lines not on this page · raw message

Signature · 1 line
1.5.3.4
#4 lore raw

PATCH 4/4 AVR32: Add support for the ATSTK1004 board

ATSTK1004 is a daughterboard for ATSTK1000 with the AT32AP7002 CPU, which is a derivative of AT32AP7000.

---
 Makefile                    |    3 +
 include/configs/atstk1004.h |  185 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 188 insertions(+), 0 deletions(-)
 create mode 100644 include/configs/atstk1004.h
Makefile +3 -0
index 03de2f1..c24ecfd 100644
@@ -2608,6 +2608,9 @@ atstk1002_config	:	unconfig
 atstk1003_config	:	unconfig
 	@$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
 
+atstk1004_config	:	unconfig
+	@$(MKCONFIG) $(@:_config=) avr32 at32ap atstk1000 atmel at32ap700x
+
 #########################################################################
 #########################################################################
 #########################################################################
include/configs/atstk1004.h new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
1.5.3.4
#5 lore raw

PATCH 3/4 AVR32: Add support for the ATSTK1003 board

In reply to Haavard Skinnemoen
Quoted 10 lines · Haavard Skinnemoen

ATSTK1003 is a daughterboard for ATSTK1000 with the AT32AP7001 CPU, which is a derivative of AT32AP7000.

---
 Makefile                    |    3 +
 include/configs/atstk1003.h |  184
+++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 187
insertions(+), 0 deletions(-)
 create mode 100644 include/configs/atstk1003.h

Please don't forget to add the new boards to MAKEALL and MAINTAINERS.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#6 lore raw

PATCH 3/4 AVR32: Add support for the ATSTK1003 board

Quoted 12 lines · On Tue, 30 Oct 2007 10:34:38 +0100 Stefan Roese <[email protected]> wrote:
Quoted 10 lines · Haavard Skinnemoen

ATSTK1003 is a daughterboard for ATSTK1000 with the AT32AP7001 CPU, which is a derivative of AT32AP7000.

---
 Makefile                    |    3 +
 include/configs/atstk1003.h |  184
+++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 187
insertions(+), 0 deletions(-)
 create mode 100644 include/configs/atstk1003.h
Quoted 1 line

Please don't forget to add the new boards to MAKEALL and MAINTAINERS.

Ah, right. Thanks for spotting that. I guess I should add them to README as well.

MAINTAINERS currently only mentions ATSTK1000, which is the motherboard for ATSTK100[234]. Should I add entries for all the daughterboards or should I simply update it to say AT32AP700x in the CPU column instead of AT32AP7000?

H?vard

#7 lore raw

PATCH 3/4 AVR32: Add support for the ATSTK1003 board

Quoted 4 lines · Haavard Skinnemoen
Quoted 1 line

Please don't forget to add the new boards to MAKEALL and MAINTAINERS.

Ah, right. Thanks for spotting that. I guess I should add them to README as well.

Not sure. Do we have a list of all official supported boards in the README too? The README is too big already from my point of view.

Quoted 4 lines

MAINTAINERS currently only mentions ATSTK1000, which is the motherboard for ATSTK100[234]. Should I add entries for all the daughterboards or should I simply update it to say AT32AP700x in the CPU column instead of AT32AP7000?

MAKEALL definitely has to have all boards listed. MAINTAINERS probably too, since it makes it easier to locate the board via a grep.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#8 lore raw

PATCH 3/4 AVR32: Add support for the ATSTK1003 board

Quoted 8 lines · On Tue, 30 Oct 2007 13:44:27 +0100 Stefan Roese <[email protected]> wrote:
Quoted 4 lines · Haavard Skinnemoen
Quoted 1 line

Please don't forget to add the new boards to MAKEALL and MAINTAINERS.

Ah, right. Thanks for spotting that. I guess I should add them to README as well.

Not sure. Do we have a list of all official supported boards in the README too? The README is too big already from my point of view.

I'm referring to this section:

- CPU Daughterboard Type: (if CONFIG_ATSTK1000 is defined) Define exactly one of CONFIG_ATSTK1002

I suppose we could remove it though. The new Kconfig stuff will make it obsolete anyway, right?

Quoted 7 lines
Quoted 4 lines

MAINTAINERS currently only mentions ATSTK1000, which is the motherboard for ATSTK100[234]. Should I add entries for all the daughterboards or should I simply update it to say AT32AP700x in the CPU column instead of AT32AP7000?

MAKEALL definitely has to have all boards listed. MAINTAINERS probably too, since it makes it easier to locate the board via a grep.

Sure, but MAKEALL needs to list all _configurations_ that are available (i.e. the stuff under include/configs.) If you're trying to locate the board, you'll find all three daughterboards living under boards/atmel/atstk1000, so grepping for ATSTK1000 is the natural thing to do, isn't it?

I guess the safest way is to include all of them, in addition to ATSTK1000. I'll do that as an additional patch since I need to add ATSTK1002 as well.

H?vard

#9 lore raw

PATCH 3/4 AVR32: Add support for the ATSTK1003 board

Quoted 12 lines · On Tue, 30 Oct 2007 14:40:08 +0100 Haavard Skinnemoen <[email protected]>…
Quoted 8 lines · On Tue, 30 Oct 2007 13:44:27 +0100 Stefan Roese <[email protected]> wrote:
Quoted 4 lines · Haavard Skinnemoen
Quoted 1 line

Please don't forget to add the new boards to MAKEALL and MAINTAINERS.

Ah, right. Thanks for spotting that. I guess I should add them to README as well.

Not sure. Do we have a list of all official supported boards in the README too? The README is too big already from my point of view.

Quoted 8 lines

I'm referring to this section:

- CPU Daughterboard Type: (if CONFIG_ATSTK1000 is defined) Define exactly one of CONFIG_ATSTK1002

I suppose we could remove it though. The new Kconfig stuff will make it obsolete anyway, right?

yes. For some reason, that one missed the axe (see commit 2628114ec564f969f34b5f7105fbd168cb8c9c3f). Perhaps it should be changed to an "e.g." instead, to leave the reader aware of Daughterboard types.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

MAINTAINERS currently only mentions ATSTK1000, which is the motherboard for ATSTK100[234]. Should I add entries for all the daughterboards or should I simply update it to say AT32AP700x in the CPU column instead of AT32AP7000?

Quoted 8 lines
Quoted 2 lines

MAKEALL definitely has to have all boards listed. MAINTAINERS probably too, since it makes it easier to locate the board via a grep.

Sure, but MAKEALL needs to list all _configurations_ that are available (i.e. the stuff under include/configs.) If you're trying to locate the board, you'll find all three daughterboards living under boards/atmel/atstk1000, so grepping for ATSTK1000 is the natural thing to do, isn't it?

technically MAKEALL uses the main Makefile targets.

Quoted 3 lines

I guess the safest way is to include all of them, in addition to ATSTK1000. I'll do that as an additional patch since I need to add ATSTK1002 as well.

yes, this'll give you the fullest testing coverage.

Quoted 1 line

H?vard

Kim