Skip to contentSkip to conversation

at91: get rid of long standing work around CONFIG_AT91_LEGACY

PATCH New Andreas Bießmann 5 participants 17 messages Oct 30, 2013 – Nov 13, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover at91: get rid of long standing work around CONFIG_AT91_LEGACY

This series cleans up the CONFIG_AT91_LEGACY mess. It was introduced for transition to C struct SoC peripheral access. The transision is almost done but introduced another CONFIG_ATMEL_LEGACY define for some GPIO cleanup which was never finished.
There are currently just two users of the CONFIG_AT91_LEGACY left, while they doesn't need to define it cause in fact they just need the CONFIG_ATMEL_LEGACY define.
Therefore remove first the not longer needed CONFIG_AT91_LEGACY define now and in a second step also the CONFIG_ATMEL_LEGACY.

The CONFIG_ATMEL_LEGACY is mostly GPIO related. There is currently a dicussion about new API for the at91 (g)pio accessors at in [1]. Please comment there.

[1] http://article.gmane.org/gmane.comp.boot-loaders.u-boot/172727

Andreas Bie?mann (6):
video: remove AT91 legacy API from bus_vcxk
i2c: switch from AT91 legacy to ATMEL legacy
at91sam9m10g45ek: remove unused CONFIG_AT91_LEGACY
snapper9260: remove unused AT91_LEGACY
net: remove unused CONFIG_AT91_LEGACY
at91: remove all occourances of CONFIG_AT91_LEGACY

 arch/arm/include/asm/arch-at91/at91_pio.h     |   33 ------------
 arch/arm/include/asm/arch-at91/at91_pit.h     |   16 ------
 arch/arm/include/asm/arch-at91/at91_pmc.h     |   51 ++----------------
 arch/arm/include/asm/arch-at91/at91_spi.h     |    2 +-
 arch/arm/include/asm/arch-at91/at91_wdt.h     |   21 --------
 arch/arm/include/asm/arch-at91/at91cap9.h     |   69 -------------------------
 arch/arm/include/asm/arch-at91/at91sam9_smc.h |   60 ---------------------
 doc/README.at91-soc                           |    7 +++
 drivers/i2c/soft_i2c.c                        |    2 +-
 drivers/net/at91_emac.c                       |    9 ----
 drivers/video/bus_vcxk.c                      |   15 ------
 include/configs/at91sam9m10g45ek.h            |    1 -
 include/configs/snapper9260.h                 |    1 -
 include/i2c.h                                 |    2 +-
 14 files changed, 15 insertions(+), 274 deletions(-)
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/6 video: remove AT91 legacy API from bus_vcxk

---
 drivers/video/bus_vcxk.c |   15 ---------------
 1 file changed, 15 deletions(-)
drivers/video/bus_vcxk.c +0 -15
index 0138bca..60a5cc5 100644
@@ -20,7 +20,6 @@ vu_long  *vcxk_bws_long = ((vu_long *) (CONFIG_SYS_VCXK_BASE));
 	#ifndef VCBITMASK
 		#define VCBITMASK(bitno)	(0x0001 << (bitno % 16))
 	#endif
-#ifndef CONFIG_AT91_LEGACY
 at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
 #define VCXK_INIT_PIN(PORT, PIN, DDR, I0O1) \
 	do { \
@@ -37,20 +36,6 @@ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
 #define VCXK_ACKNOWLEDGE	\
 	(!(readl(&pio->CONFIG_SYS_VCXK_ACKNOWLEDGE_PORT.pdsr) & \
 			CONFIG_SYS_VCXK_ACKNOWLEDGE_PIN))
-#else
-	#define VCXK_INIT_PIN(PORT, PIN, DDR, I0O1) \
-		((AT91PS_PIO) PORT)->PIO_PER = PIN; \
-		((AT91PS_PIO) PORT)->DDR = PIN; \
-		((AT91PS_PIO) PORT)->PIO_MDDR = PIN; \
-		if (!I0O1) ((AT91PS_PIO) PORT)->PIO_PPUER = PIN;
-
-	#define VCXK_SET_PIN(PORT, PIN)	((AT91PS_PIO) PORT)->PIO_SODR  = PIN;
-	#define VCXK_CLR_PIN(PORT, PIN)	((AT91PS_PIO) PORT)->PIO_CODR  = PIN;
-
-	#define VCXK_ACKNOWLEDGE	\
-		(!(((AT91PS_PIO) CONFIG_SYS_VCXK_ACKNOWLEDGE_PORT)->\
-			PIO_PDSR & CONFIG_SYS_VCXK_ACKNOWLEDGE_PIN))
-#endif
 #elif defined(CONFIG_MCF52x2)
 	#include <asm/m5282.h>
 	#ifndef VCBITMASK
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/6 video: remove AT91 legacy API from bus_vcxk

Am 2013-10-30 15:18, schrieb Andreas Bie?mann:

Quoted 29 lines
---
 drivers/video/bus_vcxk.c |   15 ---------------
 1 file changed, 15 deletions(-)
drivers/video/bus_vcxk.c +0 -8
index 0138bca..60a5cc5 100644
@@ -20,7 +20,6 @@ vu_long  *vcxk_bws_long = ((vu_long *) (CONFIG_SYS_VCXK_BASE));
 	#ifndef VCBITMASK
 		#define VCBITMASK(bitno)	(0x0001 << (bitno % 16))
 	#endif
-#ifndef CONFIG_AT91_LEGACY
 at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
 #define VCXK_INIT_PIN(PORT, PIN, DDR, I0O1) \
 	do { \
@@ -37,20 +36,6 @@ at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE;
 #define VCXK_ACKNOWLEDGE	\
 	(!(readl(&pio->CONFIG_SYS_VCXK_ACKNOWLEDGE_PORT.pdsr) & \
 			CONFIG_SYS_VCXK_ACKNOWLEDGE_PIN))
-#else
-	#define VCXK_INIT_PIN(PORT, PIN, DDR, I0O1) \
-		((AT91PS_PIO) PORT)->PIO_PER = PIN; \
-		((AT91PS_PIO) PORT)->DDR = PIN; \
-		((AT91PS_PIO) PORT)->PIO_MDDR = PIN; \
-		if (!I0O1) ((AT91PS_PIO) PORT)->PIO_PPUER = PIN;
-

drivers/video/bus_vcxk.c at91_pio_t *pio = (at91_pio_t *) AT91_PIO_BASE; · line 41

Quoted 10 lines
drivers/video/bus_vcxk.c +0 -7
-	#define VCXK_SET_PIN(PORT, PIN)	((AT91PS_PIO) PORT)->PIO_SODR  = PIN;
-	#define VCXK_CLR_PIN(PORT, PIN)	((AT91PS_PIO) PORT)->PIO_CODR  = PIN;
-
-	#define VCXK_ACKNOWLEDGE	\
-		(!(((AT91PS_PIO) CONFIG_SYS_VCXK_ACKNOWLEDGE_PORT)->\
-			PIO_PDSR & CONFIG_SYS_VCXK_ACKNOWLEDGE_PIN))
-#endif
 #elif defined(CONFIG_MCF52x2)
 	#include <asm/m5282.h>
 	#ifndef VCBITMASK
#5 lore raw

PATCH 2/6 i2c: switch from AT91 legacy to ATMEL legacy

In reply to Andreas Bießmann

Since the required API is gpio which is enclosed with CONFIG_ATMEL_LEGACY use that switch here.

---
 drivers/i2c/soft_i2c.c |    2 +-
 include/i2c.h          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/soft_i2c.c +1 -1
index 396fea8..dfea54a 100644
@@ -25,7 +25,7 @@
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pio.h>
-#ifdef CONFIG_AT91_LEGACY
+#ifdef CONFIG_ATMEL_LEGACY
 #include <asm/arch/gpio.h>
 #endif
 #endif
include/i2c.h +1 -1
index c1be533..f93a183 100644
@@ -147,7 +147,7 @@ extern struct i2c_bus_hose	i2c_bus[];
 
 # elif (defined(CONFIG_AT91RM9200) || \
 	defined(CONFIG_AT91SAM9260) ||  defined(CONFIG_AT91SAM9261) || \
-	defined(CONFIG_AT91SAM9263)) && !defined(CONFIG_AT91_LEGACY)
+	defined(CONFIG_AT91SAM9263))
 #  define I2C_SOFT_DECLARATIONS	at91_pio_t *pio	= (at91_pio_t *) ATMEL_BASE_PIOA;
 # else
 #  define I2C_SOFT_DECLARATIONS
Signature · 1 line
1.7.10.4
#6 lore raw

PATCH 2/6 i2c: switch from AT91 legacy to ATMEL legacy

Hello Andreas,

Am 30.10.2013 15:18, schrieb Andreas Bie?mann:

Quoted 8 lines

Since the required API is gpio which is enclosed with CONFIG_ATMEL_LEGACY use that switch here.

---
  drivers/i2c/soft_i2c.c |    2 +-
  include/i2c.h          |    2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#7 lore raw

PATCH 2/6 i2c: switch from AT91 legacy to ATMEL legacy

In reply to Andreas Bießmann

Dear Andreas Devel,

Quoted 10 lines · Andreas Devel

Since the required API is gpio which is enclosed with CONFIG_ATMEL_LEGACY use that switch here.

---

drivers/i2c/soft_i2c.c |    2 +-
include/i2c.h          |    2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

#8 lore raw

PATCH 3/6 at91sam9m10g45ek: remove unused CONFIG_AT91_LEGACY

In reply to Andreas Bießmann
---
 include/configs/at91sam9m10g45ek.h |    1 -
 1 file changed, 1 deletion(-)
include/configs/at91sam9m10g45ek.h +0 -1
index fc4ecec..be9df74 100644
@@ -15,7 +15,6 @@
 
 #define CONFIG_SYS_TEXT_BASE		0x73f00000
 
-#define CONFIG_AT91_LEGACY
 #define CONFIG_ATMEL_LEGACY		/* required until (g)pio is fixed */
 
 /* ARM asynchronous clock */
Signature · 1 line
1.7.10.4
#9 lore raw

PATCH 3/6 at91sam9m10g45ek: remove unused CONFIG_AT91_LEGACY

Hi Andreas,

Quoted 1 line · Andreas Bie?mann
Quoted 10 lines
---
  include/configs/at91sam9m10g45ek.h |    1 -
  1 file changed, 1 deletion(-)
include/configs/at91sam9m10g45ek.h +0 -0
index fc4ecec..be9df74 100644

include/configs/at91sam9m10g45ek.h line 20

Quoted 7 lines
include/configs/at91sam9m10g45ek.h +0 -1
@@ -15,7 +15,6 @@
 
  #define CONFIG_SYS_TEXT_BASE		0x73f00000
 
-#define CONFIG_AT91_LEGACY
  #define CONFIG_ATMEL_LEGACY		/* required until (g)pio is fixed */
 
  /* ARM asynchronous clock */

Best Regards,
Bo Shen

#11 lore raw

PATCH 4/6 snapper9260: remove unused AT91_LEGACY

In reply to Andreas Bießmann
---
 include/configs/snapper9260.h |    1 -
 1 file changed, 1 deletion(-)
include/configs/snapper9260.h +0 -1
index 17eb5f2..005931c 100644
@@ -74,7 +74,6 @@
 #define CONFIG_USB_STORAGE
 
 /* GPIOs and IO expander */
-#define CONFIG_AT91_LEGACY
 #define CONFIG_ATMEL_LEGACY
 #define CONFIG_AT91_GPIO
 #define CONFIG_AT91_GPIO_PULLUP		1
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH 4/6 snapper9260: remove unused AT91_LEGACY

Dear Andreas Devel,

Quoted 5 lines · Andreas Devel

---
include/configs/snapper9260.h | 1 -

1 file changed, 1 deletion(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

#13 lore raw

PATCH 5/6 net: remove unused CONFIG_AT91_LEGACY

In reply to Andreas Bießmann
---
 drivers/net/at91_emac.c |    9 ---------
 1 file changed, 9 deletions(-)
drivers/net/at91_emac.c +0 -9
index 73612ea..64d4c56 100644
@@ -10,19 +10,10 @@
 
 #include <common.h>
 #include <asm/io.h>
-#ifndef CONFIG_AT91_LEGACY
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_emac.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_pio.h>
-#else
-/* remove next 5 lines, if all RM9200 boards convert to at91 arch */
-#include <asm/arch-at91/at91rm9200.h>
-#include <asm/arch-at91/hardware.h>
-#include <asm/arch-at91/at91_emac.h>
-#include <asm/arch-at91/at91_pmc.h>
-#include <asm/arch-at91/at91_pio.h>
-#endif
 #include <net.h>
 #include <netdev.h>
 #include <malloc.h>
Signature · 1 line
1.7.10.4
#14 lore raw

PATCH 5/6 net: remove unused CONFIG_AT91_LEGACY

Dear Andreas Devel,

Quoted 5 lines · Andreas Devel

---
drivers/net/at91_emac.c | 9 ---------

1 file changed, 9 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

#15 lore raw

PATCH 6/6 at91: remove all occourances of CONFIG_AT91_LEGACY

In reply to Andreas Bießmann
---
 arch/arm/include/asm/arch-at91/at91_pio.h     |   33 ------------
 arch/arm/include/asm/arch-at91/at91_pit.h     |   16 ------
 arch/arm/include/asm/arch-at91/at91_pmc.h     |   51 ++----------------
 arch/arm/include/asm/arch-at91/at91_spi.h     |    2 +-
 arch/arm/include/asm/arch-at91/at91_wdt.h     |   21 --------
 arch/arm/include/asm/arch-at91/at91cap9.h     |   69 -------------------------
 arch/arm/include/asm/arch-at91/at91sam9_smc.h |   60 ---------------------
 doc/README.at91-soc                           |    7 +++
 8 files changed, 13 insertions(+), 246 deletions(-)
arch/arm/include/asm/arch-at91/at91_pio.h +0 -33
index 676f024..50464ff 100644
@@ -151,37 +151,4 @@ int at91_get_pio_value(unsigned port, unsigned pin);
 #define	AT91_PIO_PORTD		0x3
 #define	AT91_PIO_PORTE		0x4
 
-#ifdef CONFIG_AT91_LEGACY
-
-#define PIO_PER		0x00	/* Enable Register */
-#define PIO_PDR		0x04	/* Disable Register */
-#define PIO_PSR		0x08	/* Status Register */
-#define PIO_OER		0x10	/* Output Enable Register */
-#define PIO_ODR		0x14	/* Output Disable Register */
-#define PIO_OSR		0x18	/* Output Status Register */
-#define PIO_IFER	0x20	/* Glitch Input Filter Enable */
-#define PIO_IFDR	0x24	/* Glitch Input Filter Disable */
-#define PIO_IFSR	0x28	/* Glitch Input Filter Status */
-#define PIO_SODR	0x30	/* Set Output Data Register */
-#define PIO_CODR	0x34	/* Clear Output Data Register */
-#define PIO_ODSR	0x38	/* Output Data Status Register */
-#define PIO_PDSR	0x3c	/* Pin Data Status Register */
-#define PIO_IER		0x40	/* Interrupt Enable Register */
-#define PIO_IDR		0x44	/* Interrupt Disable Register */
-#define PIO_IMR		0x48	/* Interrupt Mask Register */
-#define PIO_ISR		0x4c	/* Interrupt Status Register */
-#define PIO_MDER	0x50	/* Multi-driver Enable Register */
-#define PIO_MDDR	0x54	/* Multi-driver Disable Register */
-#define PIO_MDSR	0x58	/* Multi-driver Status Register */
-#define PIO_PUDR	0x60	/* Pull-up Disable Register */
-#define PIO_PUER	0x64	/* Pull-up Enable Register */
-#define PIO_PUSR	0x68	/* Pull-up Status Register */
-#define PIO_ASR		0x70	/* Peripheral A Select Register */
-#define PIO_BSR		0x74	/* Peripheral B Select Register */
-#define PIO_ABSR	0x78	/* AB Status Register */
-#define PIO_OWER	0xa0	/* Output Write Enable Register */
-#define PIO_OWDR	0xa4	/* Output Write Disable Register */
-#define PIO_OWSR	0xa8	/* Output Write Status Register */
-#endif
-
 #endif
arch/arm/include/asm/arch-at91/at91_pit.h +0 -16
index d314b06..56724f1 100644
@@ -25,20 +25,4 @@ typedef struct at91_pit {
 #define		AT91_PIT_MR_PIV_MASK(x)	(x & 0x000fffff)
 #define		AT91_PIT_MR_PIV(x)	(x & AT91_PIT_MR_PIV_MASK)
 
-#ifdef CONFIG_AT91_LEGACY
-
-#define AT91_PIT_MR		(AT91_PIT + 0x00)	/* Mode Register */
-#define		AT91_PIT_PITIEN		(1 << 25)		/* Timer Interrupt Enable */
-#define		AT91_PIT_PITEN		(1 << 24)		/* Timer Enabled */
-#define		AT91_PIT_PIV		(0xfffff)		/* Periodic Interval Value */
-
-#define AT91_PIT_SR		(AT91_PIT + 0x04)	/* Status Register */
-#define		AT91_PIT_PITS		(1 << 0)		/* Timer Status */
-
-#define AT91_PIT_PIVR		(AT91_PIT + 0x08)	/* Periodic Interval Value Register */
-#define AT91_PIT_PIIR		(AT91_PIT + 0x0c)	/* Periodic Interval Image Register */
-#define		AT91_PIT_PICNT		(0xfff << 20)		/* Interval Counter */
-#define		AT91_PIT_CPIV		(0xfffff)		/* Inverval Value */
-
-#endif /* CONFIG_AT91_LEGACY */
 #endif
arch/arm/include/asm/arch-at91/at91_pmc.h +5 -46

108 lines not on this page · raw message

arch/arm/include/asm/arch-at91/at91_spi.h +1 -1
index f44cf67..b18665b 100644
@@ -118,6 +118,6 @@ typedef struct at91_spi {
 
 #define AT91_SPI_PTSR		0x0124			/* PDC Transfer Status Register */
 
-#endif /* CONFIG_AT91_LEGACY */
+#endif /* CONFIG_ATMEL_LEGACY */
 
 #endif
arch/arm/include/asm/arch-at91/at91_wdt.h +0 -21
index f0f4ed1..0644bbf 100644
@@ -40,25 +40,4 @@ typedef struct at91_wdt {
 #define AT91_WDT_MR_WDDBGHLT		0x10000000
 #define AT91_WDT_MR_WDIDLEHLT		0x20000000
 
-#ifdef CONFIG_AT91_LEGACY
-
-#define AT91_WDT_CR		(AT91_WDT + 0x00)	/* Watchdog Control Register */
-#define		AT91_WDT_WDRSTT		(1    << 0)		/* Restart */
-#define		AT91_WDT_KEY		(0xa5 << 24)		/* KEY Password */
-
-#define AT91_WDT_MR		(AT91_WDT + 0x04)	/* Watchdog Mode Register */
-#define		AT91_WDT_WDV		(0xfff << 0)		/* Counter Value */
-#define		AT91_WDT_WDFIEN		(1     << 12)		/* Fault Interrupt Enable */
-#define		AT91_WDT_WDRSTEN	(1     << 13)		/* Reset Processor */
-#define		AT91_WDT_WDRPROC	(1     << 14)		/* Timer Restart */
-#define		AT91_WDT_WDDIS		(1     << 15)		/* Watchdog Disable */
-#define		AT91_WDT_WDD		(0xfff << 16)		/* Delta Value */
-#define		AT91_WDT_WDDBGHLT	(1     << 28)		/* Debug Halt */
-#define		AT91_WDT_WDIDLEHLT	(1     << 29)		/* Idle Halt */
-
-#define AT91_WDT_SR		(AT91_WDT + 0x08)	/* Watchdog Status Register */
-#define		AT91_WDT_WDUNF		(1 << 0)		/* Watchdog Underflow */
-#define		AT91_WDT_WDERR		(1 << 1)		/* Watchdog Error */
-
-#endif /* CONFIG_AT91_LEGACY */
 #endif
arch/arm/include/asm/arch-at91/at91cap9.h +0 -69

75 lines not on this page · raw message

arch/arm/include/asm/arch-at91/at91sam9_smc.h +0 -60

64 lines not on this page · raw message

doc/README.at91-soc +7 -0
index bed035c..ab3f713 100644
@@ -39,3 +39,10 @@ The method for updating
 3. add new structures for SoC access
 4. Convert arch, driver and boards file to new SoC
 5. remove legacy code, if all boards and drives are ready
+
+2013-10-30 Andreas Bie?mann <[email protected]>:
+
+The goal is almost reached, we could remove the CONFIG_AT91_LEGACY switch but
+remain the CONFIG_ATMEL_LEGACY switch until the GPIO disaster is fixed. The
+AT91 spi driver has also some CONFIG_ATMEL_LEGACY stuff left, so another point
+to fix until this README can be removed.
Signature · 1 line
1.7.10.4
#16 lore raw

PATCH 6/6 at91: remove all occourances of CONFIG_AT91_LEGACY

Dear Andreas Devel,

Quoted 12 lines · Andreas Devel

---

arch/arm/include/asm/arch-at91/at91_pio.h     |   33 ------------
arch/arm/include/asm/arch-at91/at91_pit.h     |   16 ------
arch/arm/include/asm/arch-at91/at91_pmc.h     |   51 ++----------------
arch/arm/include/asm/arch-at91/at91_spi.h     |    2 +-
arch/arm/include/asm/arch-at91/at91_wdt.h     |   21 --------
arch/arm/include/asm/arch-at91/at91cap9.h     |   69 -------------------------
arch/arm/include/asm/arch-at91/at91sam9_smc.h |   60 ---------------------
doc/README.at91-soc                           |    7 +++
8 files changed, 13 insertions(+), 246 deletions(-)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann