Skip to contentSkip to conversation

A dummy() implementation _just_ to build drivers/mtd/cfi_flash.c and drivers/block/mg_disk.c drivers.

PATCH New Asen Chavdarov Dimov 2 participants 12 messages Jun 9, 2011 – Jul 26, 2011

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

cover A dummy() implementation _just_ to build drivers/mtd/cfi_flash.c and drivers/block/mg_disk.c drivers.

In AT91 the get_timer(base) returns the elapsed time between the time_start and later after some work. While the "others" are using reset_timer to make epoches and get current time after some work in that epoch.

time_start = get_timer(0)
Some work here
time_elapsed = get_timer(time_start)

---
 arch/arm/cpu/arm926ejs/at91/timer.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/at91/timer.c +18 -0
index a087687..d8d09b9 100644
@@ -134,3 +134,21 @@ ulong get_tbclk(void)
 {
 	return gd->timer_rate_hz;
 }
+
+void reset_timer(void)
+{
+	/*
+	 * A dummy() implementation _just_ to build drivers/mtd/cfi_flash.c
+	 * and drivers/block/mg_disk.c drivers.
+	 *
+	 * In AT91 the get_timer(base) returns the elapsed time
+	 * between the time_start and later after some work.
+	 * While the "others" are using reset_timer to make
+	 * epoches and get current time after some work in that
+	 * epoch.
+	 *
+	 * time_start = get_timer(0)
+	 *  Some work here
+	 * time_elapsed = get_timer(time_start)
+	 */
+}
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 1/2 change common at91sam9261 files after AT91 rework

---
 arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c |   26 ++++++++++----------
 arch/arm/include/asm/arch-at91/at91sam9261.h      |    1 +
 2 files changed, 14 insertions(+), 13 deletions(-)
arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c +13 -13
index b4353ef..8acc407 100644
@@ -23,45 +23,45 @@
  */
 
 #include <common.h>
+#include <asm/io.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/io.h>
 
 void at91_serial0_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTC, 8, 1);		/* TXD0 */
 	at91_set_a_periph(AT91_PIO_PORTC, 9, 0);		/* RXD0 */
-	writel(1 << AT91SAM9261_ID_US0, &pmc->pcer);
+	writel(1 << ATMEL_ID_USART0, &pmc->pcer);
 }
 
 void at91_serial1_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTC, 12, 1);		/* TXD1 */
 	at91_set_a_periph(AT91_PIO_PORTC, 13, 0);		/* RXD1 */
-	writel(1 << AT91SAM9261_ID_US1, &pmc->pcer);
+	writel(1 << ATMEL_ID_USART1, &pmc->pcer);
 }
 
 void at91_serial2_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTC, 14, 1);		/* TXD2 */
 	at91_set_a_periph(AT91_PIO_PORTC, 15, 0);		/* RXD2 */
-	writel(1 << AT91SAM9261_ID_US2, &pmc->pcer);
+	writel(1 << ATMEL_ID_USART2, &pmc->pcer);
 }
 
 void at91_serial3_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTA, 9, 0);		/* DRXD */
 	at91_set_a_periph(AT91_PIO_PORTA, 10, 1);		/* DTXD */
-	writel(1 << AT91_ID_SYS, &pmc->pcer);
+	writel(1 << ATMEL_ID_SYS, &pmc->pcer);
 }
 
 void at91_serial_hw_init(void)
@@ -86,14 +86,14 @@ void at91_serial_hw_init(void)
 #ifdef CONFIG_HAS_DATAFLASH
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTA, 0, 0);	/* SPI0_MISO */
 	at91_set_a_periph(AT91_PIO_PORTA, 1, 0);	/* SPI0_MOSI */
 	at91_set_a_periph(AT91_PIO_PORTA, 2, 0);	/* SPI0_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_SPI0, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI0, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
 		at91_set_a_periph(AT91_PIO_PORTA, 3, 1);
@@ -123,14 +123,14 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTB, 30, 0);	/* SPI1_MISO */
 	at91_set_a_periph(AT91_PIO_PORTB, 31, 0);	/* SPI1_MOSI */
 	at91_set_a_periph(AT91_PIO_PORTB, 29, 0);	/* SPI1_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_SPI1, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI1, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
 		at91_set_a_periph(AT91_PIO_PORTB, 28, 1);
arch/arm/include/asm/arch-at91/at91sam9261.h +1 -0
index c85fd29..a07f273 100644
@@ -125,6 +125,7 @@
  * Other misc defines
  */
 #define ATMEL_PIO_PORTS		3		/* theese SoCs have 3 PIO */
+#define ATMEL_PMC_UHP		AT91SAM926x_PMC_UHP
 #define ATMEL_BASE_PIO		ATMEL_BASE_PIOA
 
 /*
Signature · 1 line
1.7.4.4
author
#2 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

---
Note:
This patch was a part of patches, but it is better to be done step by step and so this patch is a split from the patch series with message id:
<[email protected]>
and Patchwork:
http://patchwork.ozlabs.org/patch/99665/

Changes for v2:
- add CONFIG_AT91_GPIO_PIULLUP
- reneme at91_serial3_hw_init() to at91_seriald_hw_init()
- remove at91_serial_hw_init()

 arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c |   62 ++++++++++-----------
 arch/arm/include/asm/arch-at91/at91sam9261.h      |    1 +
 2 files changed, 30 insertions(+), 33 deletions(-)
arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c +29 -33
index b4353ef..68401f6 100644
@@ -23,77 +23,73 @@
  */
 
 #include <common.h>
+#include <asm/io.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/gpio.h>
-#include <asm/arch/io.h>
+
+/*
+ * if CONFIG_AT91_GPIO_PULLUP ist set, keep pullups on on all
+ * peripheral pins. Good to have if hardware is soldered optionally
+ * or in case of SPI no slave is selected. Avoid lines to float
+ * needlessly. Use a short local PUP define.
+ *
+ * Due to errata "TXD floats when CTS is inactive" pullups are always
+ * on for TXD pins.
+ */
+#ifdef CONFIG_AT91_GPIO_PULLUP
+# define PUP CONFIG_AT91_GPIO_PULLUP
+#else
+# define PUP 0
+#endif
 
 void at91_serial0_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTC, 8, 1);		/* TXD0 */
 	at91_set_a_periph(AT91_PIO_PORTC, 9, 0);		/* RXD0 */
-	writel(1 << AT91SAM9261_ID_US0, &pmc->pcer);
+	writel(1 << ATMEL_ID_USART0, &pmc->pcer);
 }
 
 void at91_serial1_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTC, 12, 1);		/* TXD1 */
 	at91_set_a_periph(AT91_PIO_PORTC, 13, 0);		/* RXD1 */
-	writel(1 << AT91SAM9261_ID_US1, &pmc->pcer);
+	writel(1 << ATMEL_ID_USART1, &pmc->pcer);
 }
 
 void at91_serial2_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTC, 14, 1);		/* TXD2 */
 	at91_set_a_periph(AT91_PIO_PORTC, 15, 0);		/* RXD2 */
-	writel(1 << AT91SAM9261_ID_US2, &pmc->pcer);
+	writel(1 << ATMEL_ID_USART2, &pmc->pcer);
 }
 
-void at91_serial3_hw_init(void)
+void at91_seriald_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTA, 9, 0);		/* DRXD */
 	at91_set_a_periph(AT91_PIO_PORTA, 10, 1);		/* DTXD */
-	writel(1 << AT91_ID_SYS, &pmc->pcer);
-}
-
-void at91_serial_hw_init(void)
-{
-#ifdef CONFIG_USART0
-	at91_serial0_hw_init();
-#endif
-
-#ifdef CONFIG_USART1
-	at91_serial1_hw_init();
-#endif
-
-#ifdef CONFIG_USART2
-	at91_serial2_hw_init();
-#endif
-
-#ifdef CONFIG_USART3	/* DBGU */
-	at91_serial3_hw_init();
-#endif
+	writel(1 << ATMEL_ID_SYS, &pmc->pcer);
 }
 
 #ifdef CONFIG_HAS_DATAFLASH
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTA, 0, 0);	/* SPI0_MISO */
 	at91_set_a_periph(AT91_PIO_PORTA, 1, 0);	/* SPI0_MOSI */
 	at91_set_a_periph(AT91_PIO_PORTA, 2, 0);	/* SPI0_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_SPI0, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI0, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
 		at91_set_a_periph(AT91_PIO_PORTA, 3, 1);
@@ -123,14 +119,14 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTB, 30, 0);	/* SPI1_MISO */
 	at91_set_a_periph(AT91_PIO_PORTB, 31, 0);	/* SPI1_MOSI */
 	at91_set_a_periph(AT91_PIO_PORTB, 29, 0);	/* SPI1_SPCK */
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_SPI1, &pmc->pcer);
+	writel(1 << ATMEL_ID_SPI1, &pmc->pcer);
 
 	if (cs_mask & (1 << 0)) {
 		at91_set_a_periph(AT91_PIO_PORTB, 28, 1);
arch/arm/include/asm/arch-at91/at91sam9261.h +1 -0
index c85fd29..a07f273 100644
@@ -125,6 +125,7 @@
  * Other misc defines
  */
 #define ATMEL_PIO_PORTS		3		/* theese SoCs have 3 PIO */
+#define ATMEL_PMC_UHP		AT91SAM926x_PMC_UHP
 #define ATMEL_BASE_PIO		ATMEL_BASE_PIOA
 
 /*
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

Dear Asen Dimov,

Quoted 9 lines

---
Note:
This patch was a part of patches, but it is better to be done step by step and so this patch is a split from the patch series with message id:
<[email protected]>
and Patchwork:
http://patchwork.ozlabs.org/patch/99665/

Quoted 4 lines

Changes for v2:
- add CONFIG_AT91_GPIO_PIULLUP
- reneme at91_serial3_hw_init() to at91_seriald_hw_init()
- remove at91_serial_hw_init()

What I miss in at91sam9261_devices.c (as compared to the 9260) is support for MACB and MCI. Don't 9261 systems use Ethernet? Or is that part still in the board specific files?

Then, I would like to add the following changes:

-------------- arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c @@ -79,14 +79,14 @@ void at91_seriald_hw_init(void)
writel(1 << ATMEL_ID_SYS, &pmc->pcer);
}

-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
void at91_spi0_hw_init(unsigned long cs_mask)
{
at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;

- at91_set_a_periph(AT91_PIO_PORTA, 0, 0); /* SPI0_MISO */
- at91_set_a_periph(AT91_PIO_PORTA, 1, 0); /* SPI0_MOSI */
- at91_set_a_periph(AT91_PIO_PORTA, 2, 0); /* SPI0_SPCK */
+ at91_set_a_periph(AT91_PIO_PORTA, 0, PUP); /* SPI0_MISO */
+ at91_set_a_periph(AT91_PIO_PORTA, 1, PUP); /* SPI0_MOSI */
+ at91_set_a_periph(AT91_PIO_PORTA, 2, PUP); /* SPI0_SPCK */

/* Enable clock */
writel(1 << ATMEL_ID_SPI0, &pmc->pcer);
@@ -121,9 +121,9 @@ void at91_spi1_hw_init(unsigned long cs_mask)
{
at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;

- at91_set_a_periph(AT91_PIO_PORTB, 30, 0); /* SPI1_MISO */
- at91_set_a_periph(AT91_PIO_PORTB, 31, 0); /* SPI1_MOSI */
- at91_set_a_periph(AT91_PIO_PORTB, 29, 0); /* SPI1_SPCK */
+ at91_set_a_periph(AT91_PIO_PORTB, 30, PUP); /* SPI1_MISO */
+ at91_set_a_periph(AT91_PIO_PORTB, 31, PUP); /* SPI1_MOSI */
+ at91_set_a_periph(AT91_PIO_PORTB, 29, PUP); /* SPI1_SPCK */

/* Enable clock */
writel(1 << ATMEL_ID_SPI1, &pmc->pcer);

----------------- arch/arm/include/asm/arch-at91/at91sam9261.h @@ -104,7 +104,7 @@
#define ATMEL_SIZE_SRAM 0x00028000 /* Internal SRAM size (160Kb) */

#define ATMEL_BASE_ROM 0x00400000 /* Internal ROM base address */
-#define ATMEL_SIZE_ROM SZ_32K /* Internal ROM size (32Kb) */
+#define ATMEL_SIZE_ROM 0x00008000 /* Internal ROM size (32Kb) */

#define ATMEL_BASE_UHP 0x00500000 /* USB Host controller */
#define ATMEL_BASE_LCDC 0x00600000 /* LDC controller */

I have this as a local patch and could squash this onto yours, or you may provide an updated patch.

Thanks,
Reinhard

#4 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

Hello Reinhard,

Quoted 65 lines · Reinhard Meyer

Dear Asen Dimov,

Quoted 9 lines

---
Note:
This patch was a part of patches, but it is better to be done step by step and so this patch is a split from the patch series with message id:
<[email protected]>
and Patchwork:
http://patchwork.ozlabs.org/patch/99665/

Quoted 4 lines

Changes for v2:
- add CONFIG_AT91_GPIO_PIULLUP
- reneme at91_serial3_hw_init() to at91_seriald_hw_init()
- remove at91_serial_hw_init()

What I miss in at91sam9261_devices.c (as compared to the 9260) is support for MACB and MCI. Don't 9261 systems use Ethernet? Or is that part still in the board specific files?

Then, I would like to add the following changes:

-------------- arch/arm/cpu/arm926ejs/at91/at91sam9261_devices.c

(quoted diff) +8 -9
@@ -79,14 +79,14 @@ void at91_seriald_hw_init(void)
  	writel(1<<  ATMEL_ID_SYS,&pmc->pcer);
  }
 
-#ifdef CONFIG_HAS_DATAFLASH
+#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
  void at91_spi0_hw_init(unsigned long cs_mask)
  {
  	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
-	at91_set_a_periph(AT91_PIO_PORTA, 0, 0);	/* SPI0_MISO */
-	at91_set_a_periph(AT91_PIO_PORTA, 1, 0);	/* SPI0_MOSI */
-	at91_set_a_periph(AT91_PIO_PORTA, 2, 0);	/* SPI0_SPCK */
+	at91_set_a_periph(AT91_PIO_PORTA, 0, PUP);	/* SPI0_MISO */
+	at91_set_a_periph(AT91_PIO_PORTA, 1, PUP);	/* SPI0_MOSI */
+	at91_set_a_periph(AT91_PIO_PORTA, 2, PUP);	/* SPI0_SPCK */
 
  	/* Enable clock */
  	writel(1<<  ATMEL_ID_SPI0,&pmc->pcer);
@@ -121,9 +121,9 @@ void at91_spi1_hw_init(unsigned long cs_mask)
  {
  	at91_pmc_t	*pmc	= (at91_pmc_t *) ATMEL_BASE_PMC;
 
-	at91_set_a_periph(AT91_PIO_PORTB, 30, 0);	/* SPI1_MISO */
-	at91_set_a_periph(AT91_PIO_PORTB, 31, 0);	/* SPI1_MOSI */
-	at91_set_a_periph(AT91_PIO_PORTB, 29, 0);	/* SPI1_SPCK */
+	at91_set_a_periph(AT91_PIO_PORTB, 30, PUP);	/* SPI1_MISO */
+	at91_set_a_periph(AT91_PIO_PORTB, 31, PUP);	/* SPI1_MOSI */
+	at91_set_a_periph(AT91_PIO_PORTB, 29, PUP);	/* SPI1_SPCK */
 
  	/* Enable clock */
  	writel(1<<  ATMEL_ID_SPI1,&pmc->pcer);
 
----------------- arch/arm/include/asm/arch-at91/at91sam9261.h
@@ -104,7 +104,7 @@
  #define ATMEL_SIZE_SRAM		0x00028000	/* Internal SRAM size (160Kb) */
 
  #define ATMEL_BASE_ROM		0x00400000	/* Internal ROM base address */
-#define ATMEL_SIZE_ROM		SZ_32K		/* Internal ROM size (32Kb) */
+#define ATMEL_SIZE_ROM		0x00008000	/* Internal ROM size (32Kb) */
 
  #define ATMEL_BASE_UHP		0x00500000	/* USB Host controller */
  #define ATMEL_BASE_LCDC		0x00600000	/* LDC controller */
Quoted 2 lines

I have this as a local patch and could squash this onto yours, or you may provide an updated patch.

I will try once more to make it as it should be.

Quoted 2 lines

Thanks,
Reinhard

Regards,
Asen

#5 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

and one forgotten answer ...

Quoted 22 lines · RONETIX - Asen Dimov

Hello Reinhard,

Quoted 19 lines · Reinhard Meyer

Dear Asen Dimov,

Quoted 10 lines

---
Note:
This patch was a part of patches, but it is better to be done step by step and
so this patch is a split from the patch series with message id:
<[email protected]> and Patchwork:
http://patchwork.ozlabs.org/patch/99665/

Quoted 4 lines

Changes for v2:
- add CONFIG_AT91_GPIO_PIULLUP
- reneme at91_serial3_hw_init() to at91_seriald_hw_init()
- remove at91_serial_hw_init()

What I miss in at91sam9261_devices.c (as compared to the 9260) is support for MACB and MCI. Don't 9261 systems use Ethernet? Or is that part still in the board specific files?

that part is in the board file.

[snip]

Quoted 2 lines

Regards,
Asen

#6 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

Dear Asen Dimov,

Quoted 6 lines

and one forgotten answer ...

Quoted 4 lines
Quoted 4 lines

What I miss in at91sam9261_devices.c (as compared to the 9260) is support for MACB and MCI. Don't 9261 systems use Ethernet? Or is that part still in the board specific files?

that part is in the board file.

That is unfortunate. I'd like to move that into the SoC specific file. Otherwise that code would be duplicated in each board.

Best Regards,
Reinhard

#7 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

In reply to RONETIX - Asen Dimov

Dear Asen Dimov,

Quoted 6 lines

and one forgotten answer ...

Quoted 4 lines
Quoted 4 lines

What I miss in at91sam9261_devices.c (as compared to the 9260) is support for MACB and MCI. Don't 9261 systems use Ethernet? Or is that part still in the board specific files?

that part is in the board file.

Sorry for that confusion. I just checked the 9261 data sheet and to my surprise the 9261 does not have a MACB or any other LAN interface on the SoC!

It seems that the 9261-ek and derivatives use an external LAN chip, DM9000.

That chip's initialisation, of course, does not belong into the 9261 SoC code.

So it must stay in the board code.

Best Regards,
Reinhard

#8 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

In reply to RONETIX - Asen Dimov

Dear Asen Dimov,

Quoted 3 lines
Quoted 2 lines

I have this as a local patch and could squash this onto yours, or you may provide an updated patch.

I will try once more to make it as it should be.

The squashed version is at top of u-boot-atmel/rework-at91sam9261. If you are OK with that, I'll post the patch and apply it to master. (I also changed the subject a bit)

Best Regards,
Reinhard

#9 lore raw

PATCH v2 1/1 change common at91sam9261 files after AT91 rework

Hello Reinhard,

Quoted 7 lines · Reinhard Meyer

Dear Asen Dimov,

Quoted 3 lines
Quoted 2 lines

I have this as a local patch and could squash this onto yours, or you may provide an updated patch.

I will try once more to make it as it should be.

The squashed version is at top of u-boot-atmel/rework-at91sam9261. If you are OK with that, I'll post the patch and apply it to master. (I also changed the subject a bit)

Good, I am OK with that. The pm9261 now boots and the patch will come soon.

Quoted 2 lines

Best Regards,
Reinhard

Regards,
Asen

#10 lore raw

PATCH 2/2 make pm9261 buildable for v2011.06 release

In reply to Asen Chavdarov Dimov
---
 board/ronetix/pm9261/led.c    |    9 ++++-----
 board/ronetix/pm9261/pm9261.c |   36 +++++++++++++++++-------------------
 boards.cfg                    |    2 +-
 include/configs/pm9261.h      |   18 ++++++++++--------
 4 files changed, 32 insertions(+), 33 deletions(-)
board/ronetix/pm9261/led.c +4 -5
index ff21ce6..f659870 100644
@@ -24,17 +24,16 @@
  */
 
 #include <common.h>
-#include <asm/arch/at91sam9261.h>
 #include <asm/arch/at91_pmc.h>
-#include <asm/arch/at91_pio.h>
-#include <asm/arch/io.h>
+#include <asm/arch/gpio.h>
+#include <asm/io.h>
 
 void coloured_LED_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_PIOC, &pmc->pcer);
+	writel(1 << ATMEL_ID_PIOC, &pmc->pcer);
 
 	at91_set_pio_output(CONFIG_RED_LED, 1);
 	at91_set_pio_output(CONFIG_GREEN_LED, 1);
board/ronetix/pm9261/pm9261.c +17 -19
index e0f44dd..ed952fe 100644
@@ -26,17 +26,15 @@
 
 #include <common.h>
 #include <asm/sizes.h>
-#include <asm/arch/at91sam9261.h>
+#include <asm/io.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/at91_matrix.h>
-#include <asm/arch/at91_pio.h>
 #include <asm/arch/clk.h>
-#include <asm/arch/at91_pio.h>
-#include <asm/arch/io.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch/gpio.h>
+
 #include <lcd.h>
 #include <atmel_lcdc.h>
 #include <dataflash.h>
@@ -56,9 +54,9 @@ DECLARE_GLOBAL_DATA_PTR;
 static void pm9261_nand_hw_init(void)
 {
 	unsigned long csa;
-	at91_smc_t 	*smc 	= (at91_smc_t *) AT91_SMC_BASE;
-	at91_matrix_t 	*matrix = (at91_matrix_t *) AT91_MATRIX_BASE;
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+	struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Enable CS3 */
 	csa = readl(&matrix->csa) | AT91_MATRIX_CSA_EBI_CS3A;
@@ -86,8 +84,8 @@ static void pm9261_nand_hw_init(void)
 		AT91_SMC_MODE_TDF_CYCLE(2),
 		&smc->cs[3].mode);
 
-	writel(1 << AT91SAM9261_ID_PIOA |
-		1 << AT91SAM9261_ID_PIOC,
+	writel(1 << ATMEL_ID_PIOA |
+		1 << ATMEL_ID_PIOC,
 		&pmc->pcer);
 
 	/* Configure RDY/BSY */
@@ -105,8 +103,8 @@ static void pm9261_nand_hw_init(void)
 #ifdef CONFIG_DRIVER_DM9000
 static void pm9261_dm9000_hw_init(void)
 {
-	at91_smc_t 	*smc 	= (at91_smc_t *) AT91_SMC_BASE;
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Configure SMC CS2 for DM9000 */
 	writel(AT91_SMC_SETUP_NWE(2) | AT91_SMC_SETUP_NCS_WR(0) |
@@ -127,7 +125,7 @@ static void pm9261_dm9000_hw_init(void)
 		&smc->cs[2].mode);
 
 	/* Configure Interrupt pin as input, no pull-up */
-	writel(1 << AT91SAM9261_ID_PIOA, &pmc->pcer);
+	writel(1 << ATMEL_ID_PIOA, &pmc->pcer);
 	at91_set_pio_input(AT91_PIO_PORTA, 24, 0);
 }
 #endif
@@ -147,7 +145,7 @@ vidinfo_t panel_info = {
 	vl_vsync_len:	1,
 	vl_upper_margin:1,
 	vl_lower_margin:0,
-	mmio:		AT91SAM9261_LCDC_BASE,
+	mmio:		ATMEL_BASE_LCDC,
 };
 
 void lcd_enable(void)
@@ -162,7 +160,7 @@ void lcd_disable(void)
 
 static void pm9261_lcd_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTB, 1, 0);	/* LCDHSYNC */
 	at91_set_a_periph(AT91_PIO_PORTB, 2, 0);	/* LCDDOTCK */
@@ -189,7 +187,7 @@ static void pm9261_lcd_hw_init(void)
 
 	writel(1 << 17, &pmc->scer); /* LCD controller Clock, AT91SAM9261 only */
 
-	gd->fb_base = AT91SAM9261_SRAM_BASE;
+	gd->fb_base = ATMEL_BASE_SRAM;
 }
 
 #ifdef CONFIG_LCD_INFO
@@ -241,13 +239,13 @@ void lcd_show_board_info(void)
 
 int board_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Enable Ctrlc */
 	console_init_f();
 
-	writel(1 << AT91SAM9261_ID_PIOA |
-		1 << AT91SAM9261_ID_PIOC,
+	writel(1 << ATMEL_ID_PIOA |
+		1 << ATMEL_ID_PIOC,
 		&pmc->pcer);
 
 	/* arch number of PM9261-Board */
boards.cfg +1 -1
index ac20c81..3c45a8f 100644
@@ -99,7 +99,7 @@ meesc                        arm         arm926ejs   meesc               esd
 meesc_dataflash              arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_DATAFLASH
 otc570                       arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_NANDFLASH
 otc570_dataflash             arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_DATAFLASH
-pm9261                       arm         arm926ejs   -                   ronetix        at91
+pm9261                       arm         arm926ejs   pm9261              ronetix        at91        pm9261:AT91SAM9261
 pm9263                       arm         arm926ejs   -                   ronetix        at91
 da830evm                     arm         arm926ejs   da8xxevm            davinci        davinci
 da850evm                     arm         arm926ejs   da8xxevm            davinci        davinci
include/configs/pm9261.h +10 -8
index 26e5049..3a8b095 100644
@@ -28,25 +28,29 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+/*
+ * SoC must be defined first, before hardware.h is included.
+ * In this case SoC is defined in boards.cfg.
+ */
+
+#include <asm/hardware.h>
 /* ARM asynchronous clock */
-#define CONFIG_SYS_AT91_CPU_NAME	"AT91SAM9261"
 
 #define CONFIG_DISPLAY_BOARDINFO
 
 #define MASTER_PLL_DIV		15
 #define MASTER_PLL_MUL		162
 #define MAIN_PLL_DIV		2
+#define CONFIG_SYS_AT91_SLOW_CLOCK	32768		/* slow clock xtal */
 #define CONFIG_SYS_AT91_MAIN_CLOCK	18432000
 
 #define CONFIG_SYS_HZ		1000
 
-#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core	*/
-#define CONFIG_AT91SAM9261	1	/* It's an Atmel AT91SAM9261 SoC*/
+#define CONFIG_SYS_AT91_CPU_NAME	"AT91SAM9261"
 #define CONFIG_PM9261		1	/* on a Ronetix PM9261 Board	*/
 #define CONFIG_ARCH_CPU_INIT
 #undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
 #define CONFIG_SYS_TEXT_BASE	0
-#define CONFIG_AT91FAMILY
 
 /* clocks */
 /* CKGR_MOR - enable main osc. */
@@ -160,10 +164,8 @@
  */
 #define CONFIG_AT91_GPIO	1
 #define CONFIG_ATMEL_USART	1
-#undef CONFIG_USART0
-#undef CONFIG_USART1
-#undef CONFIG_USART2
-#define CONFIG_USART3		1	/* USART 3 is DBGU */
+#define CONFIG_USART_BASE		ATMEL_BASE_DBGU
+#define	CONFIG_USART_ID			ATMEL_ID_SYS
 
 /* LCD */
 #define CONFIG_LCD			1
Signature · 1 line
1.7.4.4
#11 lore raw

PATCH 1/1 pm9261: compiles with the AT91 reworked scheme

---
Note:
This patch was a part of patches, but it is better to be done step by step and so this patch is a split from the patch series with message id:
<[email protected]>
and Patchwork:
http://patchwork.ozlabs.org/patch/99666/

Changes for v2:
- rename at91_serial_hw_init() to at91_seriald_hw_init()

checkpatch complains at "board/ronetix/pm9261/pm9261.c:148", but checkpatch could be mistaken.

 board/ronetix/pm9261/led.c    |    9 ++++-----
 board/ronetix/pm9261/pm9261.c |   38 ++++++++++++++++++--------------------
 boards.cfg                    |    2 +-
 include/configs/pm9261.h      |   18 ++++++++++--------
 4 files changed, 33 insertions(+), 34 deletions(-)
board/ronetix/pm9261/led.c +4 -5
index ff21ce6..f659870 100644
@@ -24,17 +24,16 @@
  */
 
 #include <common.h>
-#include <asm/arch/at91sam9261.h>
 #include <asm/arch/at91_pmc.h>
-#include <asm/arch/at91_pio.h>
-#include <asm/arch/io.h>
+#include <asm/arch/gpio.h>
+#include <asm/io.h>
 
 void coloured_LED_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Enable clock */
-	writel(1 << AT91SAM9261_ID_PIOC, &pmc->pcer);
+	writel(1 << ATMEL_ID_PIOC, &pmc->pcer);
 
 	at91_set_pio_output(CONFIG_RED_LED, 1);
 	at91_set_pio_output(CONFIG_GREEN_LED, 1);
board/ronetix/pm9261/pm9261.c +18 -20
index 2c50fe8..871b94a 100644
@@ -26,17 +26,15 @@
 
 #include <common.h>
 #include <asm/sizes.h>
-#include <asm/arch/at91sam9261.h>
+#include <asm/io.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/at91_matrix.h>
-#include <asm/arch/at91_pio.h>
 #include <asm/arch/clk.h>
-#include <asm/arch/at91_pio.h>
-#include <asm/arch/io.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch/gpio.h>
+
 #include <lcd.h>
 #include <atmel_lcdc.h>
 #include <dataflash.h>
@@ -56,9 +54,9 @@ DECLARE_GLOBAL_DATA_PTR;
 static void pm9261_nand_hw_init(void)
 {
 	unsigned long csa;
-	at91_smc_t 	*smc 	= (at91_smc_t *) AT91_SMC_BASE;
-	at91_matrix_t 	*matrix = (at91_matrix_t *) AT91_MATRIX_BASE;
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+	struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Enable CS3 */
 	csa = readl(&matrix->csa) | AT91_MATRIX_CSA_EBI_CS3A;
@@ -86,8 +84,8 @@ static void pm9261_nand_hw_init(void)
 		AT91_SMC_MODE_TDF_CYCLE(2),
 		&smc->cs[3].mode);
 
-	writel(1 << AT91SAM9261_ID_PIOA |
-		1 << AT91SAM9261_ID_PIOC,
+	writel(1 << ATMEL_ID_PIOA |
+		1 << ATMEL_ID_PIOC,
 		&pmc->pcer);
 
 	/* Configure RDY/BSY */
@@ -105,8 +103,8 @@ static void pm9261_nand_hw_init(void)
 #ifdef CONFIG_DRIVER_DM9000
 static void pm9261_dm9000_hw_init(void)
 {
-	at91_smc_t 	*smc 	= (at91_smc_t *) AT91_SMC_BASE;
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Configure SMC CS2 for DM9000 */
 	writel(AT91_SMC_SETUP_NWE(2) | AT91_SMC_SETUP_NCS_WR(0) |
@@ -127,7 +125,7 @@ static void pm9261_dm9000_hw_init(void)
 		&smc->cs[2].mode);
 
 	/* Configure Interrupt pin as input, no pull-up */
-	writel(1 << AT91SAM9261_ID_PIOA, &pmc->pcer);
+	writel(1 << ATMEL_ID_PIOA, &pmc->pcer);
 	at91_set_pio_input(AT91_PIO_PORTA, 24, 0);
 }
 #endif
@@ -147,7 +145,7 @@ vidinfo_t panel_info = {
 	vl_vsync_len:	1,
 	vl_upper_margin:1,
 	vl_lower_margin:0,
-	mmio:		AT91SAM9261_LCDC_BASE,
+	mmio:		ATMEL_BASE_LCDC,
 };
 
 void lcd_enable(void)
@@ -162,7 +160,7 @@ void lcd_disable(void)
 
 static void pm9261_lcd_hw_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	at91_set_a_periph(AT91_PIO_PORTB, 1, 0);	/* LCDHSYNC */
 	at91_set_a_periph(AT91_PIO_PORTB, 2, 0);	/* LCDDOTCK */
@@ -189,7 +187,7 @@ static void pm9261_lcd_hw_init(void)
 
 	writel(1 << 17, &pmc->scer); /* LCD controller Clock, AT91SAM9261 only */
 
-	gd->fb_base = AT91SAM9261_SRAM_BASE;
+	gd->fb_base = ATMEL_BASE_SRAM;
 }
 
 #ifdef CONFIG_LCD_INFO
@@ -241,13 +239,13 @@ void lcd_show_board_info(void)
 
 int board_init(void)
 {
-	at91_pmc_t	*pmc	= (at91_pmc_t *) AT91_PMC_BASE;
+	struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
 
 	/* Enable Ctrlc */
 	console_init_f();
 
-	writel(1 << AT91SAM9261_ID_PIOA |
-		1 << AT91SAM9261_ID_PIOC,
+	writel(1 << ATMEL_ID_PIOA |
+		1 << ATMEL_ID_PIOC,
 		&pmc->pcer);
 
 	/* arch number of PM9261-Board */
@@ -256,7 +254,7 @@ int board_init(void)
 	/* adress of boot parameters */
 	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
-	at91_serial_hw_init();
+	at91_seriald_hw_init();
 #ifdef CONFIG_CMD_NAND
 	pm9261_nand_hw_init();
 #endif
boards.cfg +1 -1
index 5cfaa78..cf8d0c7 100644
@@ -99,7 +99,7 @@ meesc                        arm         arm926ejs   meesc               esd
 meesc_dataflash              arm         arm926ejs   meesc               esd            at91        meesc:AT91SAM9263,SYS_USE_DATAFLASH
 otc570                       arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_NANDFLASH
 otc570_dataflash             arm         arm926ejs   otc570              esd            at91        otc570:AT91SAM9263,SYS_USE_DATAFLASH
-pm9261                       arm         arm926ejs   -                   ronetix        at91
+pm9261                       arm         arm926ejs   pm9261              ronetix        at91        pm9261:AT91SAM9261
 pm9263                       arm         arm926ejs   -                   ronetix        at91
 da830evm                     arm         arm926ejs   da8xxevm            davinci        davinci
 da850evm                     arm         arm926ejs   da8xxevm            davinci        davinci
include/configs/pm9261.h +10 -8
index 26e5049..3a8b095 100644
@@ -28,25 +28,29 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+/*
+ * SoC must be defined first, before hardware.h is included.
+ * In this case SoC is defined in boards.cfg.
+ */
+
+#include <asm/hardware.h>
 /* ARM asynchronous clock */
-#define CONFIG_SYS_AT91_CPU_NAME	"AT91SAM9261"
 
 #define CONFIG_DISPLAY_BOARDINFO
 
 #define MASTER_PLL_DIV		15
 #define MASTER_PLL_MUL		162
 #define MAIN_PLL_DIV		2
+#define CONFIG_SYS_AT91_SLOW_CLOCK	32768		/* slow clock xtal */
 #define CONFIG_SYS_AT91_MAIN_CLOCK	18432000
 
 #define CONFIG_SYS_HZ		1000
 
-#define CONFIG_ARM926EJS	1	/* This is an ARM926EJS Core	*/
-#define CONFIG_AT91SAM9261	1	/* It's an Atmel AT91SAM9261 SoC*/
+#define CONFIG_SYS_AT91_CPU_NAME	"AT91SAM9261"
 #define CONFIG_PM9261		1	/* on a Ronetix PM9261 Board	*/
 #define CONFIG_ARCH_CPU_INIT
 #undef CONFIG_USE_IRQ			/* we don't need IRQ/FIQ stuff	*/
 #define CONFIG_SYS_TEXT_BASE	0
-#define CONFIG_AT91FAMILY
 
 /* clocks */
 /* CKGR_MOR - enable main osc. */
@@ -160,10 +164,8 @@
  */
 #define CONFIG_AT91_GPIO	1
 #define CONFIG_ATMEL_USART	1
-#undef CONFIG_USART0
-#undef CONFIG_USART1
-#undef CONFIG_USART2
-#define CONFIG_USART3		1	/* USART 3 is DBGU */
+#define CONFIG_USART_BASE		ATMEL_BASE_DBGU
+#define	CONFIG_USART_ID			ATMEL_ID_SYS
 
 /* LCD */
 #define CONFIG_LCD			1
Signature · 1 line
1.7.4.4