diff mbox

[U-Boot,v2,7/9] dm: at91: Convert snapper9260 to use driver model

Message ID 1414609743-19092-8-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Oct. 29, 2014, 7:09 p.m. UTC
Convert this at91sam9260-based board to use driver model. This should serve
as an example for other similar boards. Serial and GPIO are supported so
far.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Andreas Bießmann <andreas.devel@googlemail.com>
---

Changes in v2:
- Update platform data and header #include for the new driver name

 board/bluewater/snapper9260/snapper9260.c | 18 ++++++++++++++++--
 include/configs/snapper9260.h             |  9 ++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)

Comments

Masahiro Yamada Nov. 1, 2014, 5:27 p.m. UTC | #1
Hi Simon,

2014-10-30 4:09 GMT+09:00 Simon Glass <sjg@chromium.org>:
> diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h
> index e2e623e..942af2e 100644
> --- a/include/configs/snapper9260.h
> +++ b/include/configs/snapper9260.h
> @@ -21,6 +21,11 @@
>  #define CONFIG_SYS_AT91_MAIN_CLOCK     18432000 /* External Crystal, in Hz */
>  #define CONFIG_SYS_AT91_SLOW_CLOCK     32768
>  #define CONFIG_SYS_GENERIC_BOARD
> +#define CONFIG_DM
> +#define CONFIG_CMD_DM
> +#define CONFIG_DM_GPIO
> +#define CONFIG_DM_SERIAL
> +#define CONFIG_SYS_MALLOC_F_LEN                (1 << 10)
>



CONFIG_DM, CONFIG_DM_GPIO, CONFIG_DM_SERIAL are available in Kconfig.
Could you add them into the defconfig, please?
Simon Glass Nov. 5, 2014, 2:54 a.m. UTC | #2
Hi Masahiro,

On 1 November 2014 10:27, Masahiro YAMADA <yamada.m@jp.panasonic.com> wrote:
> Hi Simon,
>
> 2014-10-30 4:09 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h
>> index e2e623e..942af2e 100644
>> --- a/include/configs/snapper9260.h
>> +++ b/include/configs/snapper9260.h
>> @@ -21,6 +21,11 @@
>>  #define CONFIG_SYS_AT91_MAIN_CLOCK     18432000 /* External Crystal, in Hz */
>>  #define CONFIG_SYS_AT91_SLOW_CLOCK     32768
>>  #define CONFIG_SYS_GENERIC_BOARD
>> +#define CONFIG_DM
>> +#define CONFIG_CMD_DM
>> +#define CONFIG_DM_GPIO
>> +#define CONFIG_DM_SERIAL
>> +#define CONFIG_SYS_MALLOC_F_LEN                (1 << 10)
>>
>
>
>
> CONFIG_DM, CONFIG_DM_GPIO, CONFIG_DM_SERIAL are available in Kconfig.
> Could you add them into the defconfig, please?

Yes I need to do a full pass through all the boards I've added.
Hopefully next week.

Regards,
Simon
Simon Glass Nov. 23, 2014, 12:55 p.m. UTC | #3
On 5 November 2014 at 03:54, Simon Glass <sjg@chromium.org> wrote:
> Hi Masahiro,
>
> On 1 November 2014 10:27, Masahiro YAMADA <yamada.m@jp.panasonic.com> wrote:
>> Hi Simon,
>>
>> 2014-10-30 4:09 GMT+09:00 Simon Glass <sjg@chromium.org>:
>>> diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h
>>> index e2e623e..942af2e 100644
>>> --- a/include/configs/snapper9260.h
>>> +++ b/include/configs/snapper9260.h
>>> @@ -21,6 +21,11 @@
>>>  #define CONFIG_SYS_AT91_MAIN_CLOCK     18432000 /* External Crystal, in Hz */
>>>  #define CONFIG_SYS_AT91_SLOW_CLOCK     32768
>>>  #define CONFIG_SYS_GENERIC_BOARD
>>> +#define CONFIG_DM
>>> +#define CONFIG_CMD_DM
>>> +#define CONFIG_DM_GPIO
>>> +#define CONFIG_DM_SERIAL
>>> +#define CONFIG_SYS_MALLOC_F_LEN                (1 << 10)
>>>
>>
>>
>>
>> CONFIG_DM, CONFIG_DM_GPIO, CONFIG_DM_SERIAL are available in Kconfig.
>> Could you add them into the defconfig, please?
>
> Yes I need to do a full pass through all the boards I've added.
> Hopefully next week.

Applied to u-boot-dm.
diff mbox

Patch

diff --git a/board/bluewater/snapper9260/snapper9260.c b/board/bluewater/snapper9260/snapper9260.c
index bfde129..95633b0 100644
--- a/board/bluewater/snapper9260/snapper9260.c
+++ b/board/bluewater/snapper9260/snapper9260.c
@@ -9,12 +9,15 @@ 
  */
 
 #include <common.h>
+#include <dm.h>
 #include <asm/io.h>
+#include <asm/gpio.h>
 #include <asm/arch/at91sam9260_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/gpio.h>
+#include <asm/arch/atmel_serial.h>
 #include <net.h>
 #include <netdev.h>
 #include <i2c.h>
@@ -95,10 +98,12 @@  static void nand_hw_init(void)
 	       &smc->cs[3].mode);
 
 	/* Configure RDY/BSY */
-	at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+	gpio_request(CONFIG_SYS_NAND_READY_PIN, "nand_rdy");
+	gpio_direction_input(CONFIG_SYS_NAND_READY_PIN);
 
 	/* Enable NandFlash */
-	at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+	gpio_request(CONFIG_SYS_NAND_ENABLE_PIN, "nand_ce");
+	gpio_direction_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
 }
 
 int board_init(void)
@@ -140,3 +145,12 @@  int dram_init(void)
 void reset_phy(void)
 {
 }
+
+static struct atmel_serial_platdata at91sam9260_serial_plat = {
+	.base_addr = ATMEL_BASE_DBGU,
+};
+
+U_BOOT_DEVICE(at91sam9260_serial) = {
+	.name	= "serial_atmel",
+	.platdata = &at91sam9260_serial_plat,
+};
diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h
index e2e623e..942af2e 100644
--- a/include/configs/snapper9260.h
+++ b/include/configs/snapper9260.h
@@ -21,6 +21,11 @@ 
 #define CONFIG_SYS_AT91_MAIN_CLOCK	18432000 /* External Crystal, in Hz */
 #define CONFIG_SYS_AT91_SLOW_CLOCK	32768
 #define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DM
+#define CONFIG_CMD_DM
+#define CONFIG_DM_GPIO
+#define CONFIG_DM_SERIAL
+#define CONFIG_SYS_MALLOC_F_LEN		(1 << 10)
 
 /* CPU */
 #define CONFIG_ARCH_CPU_INIT
@@ -85,8 +90,10 @@ 
 
 /* UARTs/Serial console */
 #define CONFIG_ATMEL_USART
+#ifndef CONFIG_DM_SERIAL
 #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
 #define CONFIG_USART_ID			ATMEL_ID_SYS
+#endif
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_PROMPT		"Snapper> "
 
@@ -160,7 +167,7 @@ 
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_I2C
-#undef CONFIG_CMD_GPIO
+#define CONFIG_CMD_GPIO
 #define CONFIG_CMD_USB
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NAND