* [PATCH 0/4] Add support for sam9x60_curiosity
@ 2022-03-21 10:34 Durai Manickam KR
2022-03-21 10:34 ` [PATCH 1/4] board: Add sam9x60_curiosity support Durai Manickam KR
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Durai Manickam KR @ 2022-03-21 10:34 UTC (permalink / raw)
To: u-boot; +Cc: durai.manickamkr, MPUSWLinux, Eugen.Hristev
This patch series adds support for sam9x60_curiosity.
Durai Manickam KR (4):
board: Add sam9x60_curiosity support
ARM: dts: Add device tree files for sam9x60_curiosity
configs: Add sam9x60_curiosity_mmc_defconfig
configs: Add sam9x60_curiosity_nandflash_defconfig
arch/arm/dts/Makefile | 2 +
.../dts/at91-sam9x60_curiosity-u-boot.dtsi | 79 ++++++++++
arch/arm/dts/at91-sam9x60_curiosity.dts | 74 ++++++++++
arch/arm/mach-at91/Kconfig | 10 ++
board/atmel/sam9x60_curiosity/Kconfig | 15 ++
board/atmel/sam9x60_curiosity/MAINTAINERS | 8 +
board/atmel/sam9x60_curiosity/Makefile | 7 +
.../sam9x60_curiosity/sam9x60_curiosity.c | 139 ++++++++++++++++++
configs/sam9x60_curiosity_mmc_defconfig | 82 +++++++++++
configs/sam9x60_curiosity_nandflash_defconfig | 82 +++++++++++
include/configs/sam9x60_curiosity.h | 67 +++++++++
11 files changed, 565 insertions(+)
create mode 100644 arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
create mode 100644 arch/arm/dts/at91-sam9x60_curiosity.dts
create mode 100644 board/atmel/sam9x60_curiosity/Kconfig
create mode 100644 board/atmel/sam9x60_curiosity/MAINTAINERS
create mode 100644 board/atmel/sam9x60_curiosity/Makefile
create mode 100644 board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
create mode 100644 configs/sam9x60_curiosity_mmc_defconfig
create mode 100644 configs/sam9x60_curiosity_nandflash_defconfig
create mode 100644 include/configs/sam9x60_curiosity.h
--
2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] board: Add sam9x60_curiosity support
2022-03-21 10:34 [PATCH 0/4] Add support for sam9x60_curiosity Durai Manickam KR
@ 2022-03-21 10:34 ` Durai Manickam KR
2022-03-21 16:32 ` Eugen.Hristev
2022-03-21 10:34 ` [PATCH 2/4] ARM: dts: Add device tree files for sam9x60_curiosity Durai Manickam KR
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Durai Manickam KR @ 2022-03-21 10:34 UTC (permalink / raw)
To: u-boot; +Cc: durai.manickamkr, MPUSWLinux, Eugen.Hristev
Add board files, Kconfig, Makefile and MAINTAINERS.
Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
---
arch/arm/mach-at91/Kconfig | 10 ++
board/atmel/sam9x60_curiosity/Kconfig | 15 ++
board/atmel/sam9x60_curiosity/MAINTAINERS | 6 +
board/atmel/sam9x60_curiosity/Makefile | 7 +
.../sam9x60_curiosity/sam9x60_curiosity.c | 139 ++++++++++++++++++
include/configs/sam9x60_curiosity.h | 67 +++++++++
6 files changed, 244 insertions(+)
create mode 100644 board/atmel/sam9x60_curiosity/Kconfig
create mode 100644 board/atmel/sam9x60_curiosity/MAINTAINERS
create mode 100644 board/atmel/sam9x60_curiosity/Makefile
create mode 100644 board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
create mode 100644 include/configs/sam9x60_curiosity.h
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 00f31045d6..7a1dbff069 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -161,6 +161,12 @@ config TARGET_SAM9X60EK
select BOARD_EARLY_INIT_F
select BOARD_LATE_INIT
+config TARGET_SAM9X60_CURIOSITY
+ bool "SAM9X60 CURIOSITY board"
+ select SAM9X60
+ select BOARD_EARLY_INIT_F
+ select BOARD_LATE_INIT
+
config TARGET_SAMA5D2_PTC_EK
bool "SAMA5D2 PTC EK board"
select BOARD_EARLY_INIT_F
@@ -310,6 +316,9 @@ config AT91_EFLASH
Enable the driver for the embedded flash used in the Atmel
AT91SAM9XE devices.
+config ATMEL_LEGACY
+ bool "Legacy GPIO support"
+
source "board/atmel/at91sam9260ek/Kconfig"
source "board/atmel/at91sam9261ek/Kconfig"
source "board/atmel/at91sam9263ek/Kconfig"
@@ -318,6 +327,7 @@ source "board/atmel/at91sam9n12ek/Kconfig"
source "board/atmel/at91sam9rlek/Kconfig"
source "board/atmel/at91sam9x5ek/Kconfig"
source "board/atmel/sam9x60ek/Kconfig"
+source "board/atmel/sam9x60_curiosity/Kconfig"
source "board/atmel/sama7g5ek/Kconfig"
source "board/atmel/sama5d2_ptc_ek/Kconfig"
source "board/atmel/sama5d2_xplained/Kconfig"
diff --git a/board/atmel/sam9x60_curiosity/Kconfig b/board/atmel/sam9x60_curiosity/Kconfig
new file mode 100644
index 0000000000..ae84e0f32c
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_SAM9X60_CURIOSITY
+
+config SYS_BOARD
+ default "sam9x60_curiosity"
+
+config SYS_VENDOR
+ default "atmel"
+
+config SYS_SOC
+ default "at91"
+
+config SYS_CONFIG_NAME
+ default "sam9x60_curiosity"
+
+endif
diff --git a/board/atmel/sam9x60_curiosity/MAINTAINERS b/board/atmel/sam9x60_curiosity/MAINTAINERS
new file mode 100644
index 0000000000..84a3a9f186
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/MAINTAINERS
@@ -0,0 +1,6 @@
+SAM9X60 CURIOSITY BOARD
+M: Durai Manickam KR <durai.manickamkr@microchip.com>
+M: Eugen Hristev <eugen.hristev@microchip.com>
+S: Maintained
+F: board/atmel/sam9x60_curiosity/
+F: include/configs/sam9x60_curiosity.h
diff --git a/board/atmel/sam9x60_curiosity/Makefile b/board/atmel/sam9x60_curiosity/Makefile
new file mode 100644
index 0000000000..c4d17e66d4
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+#
+# Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+
+obj-y += sam9x60_curiosity.o
diff --git a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
new file mode 100644
index 0000000000..3c5470b03c
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+ */
+
+#include <common.h>
+#include <debug_uart.h>
+#include <fdtdec.h>
+#include <init.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/at91_sfr.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/gpio.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void at91_prepare_cpu_var(void);
+
+#ifdef CONFIG_CMD_NAND
+static void sam9x60_curiosity_nand_hw_init(void)
+{
+ struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+ struct atmel_sfr *sfr = (struct atmel_sfr *)ATMEL_BASE_SFR;
+ unsigned int csa;
+
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 0, 1); /* NAND OE */
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 1, 1); /* NAND WE */
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 2, 0); /* NAND ALE */
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 3, 0); /* NAND CLE */
+ /* Enable NandFlash */
+ at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+ /* Configure RDY/BSY */
+ at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 6, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 7, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 8, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 9, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 10, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 11, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 12, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 13, 1);
+
+ at91_periph_clk_enable(ATMEL_ID_PIOD);
+
+ /* Enable CS3 */
+ csa = readl(&sfr->ebicsa);
+ csa |= AT91_SFR_CCFG_EBI_CSA(3, 1) | AT91_SFR_CCFG_NFD0_ON_D16;
+
+ /* Configure IO drive */
+ csa &= ~AT91_SFR_CCFG_EBI_DRIVE_SAM9X60;
+
+ writel(csa, &sfr->ebicsa);
+
+ /* Configure SMC CS3 for NAND/SmartMedia */
+ writel(AT91_SMC_SETUP_NWE(4), &smc->cs[3].setup);
+
+ writel(AT91_SMC_PULSE_NWE(10) | AT91_SMC_PULSE_NCS_WR(20) |
+ AT91_SMC_PULSE_NRD(10) | AT91_SMC_PULSE_NCS_RD(20),
+ &smc->cs[3].pulse);
+
+ writel(AT91_SMC_CYCLE_NWE(20) | AT91_SMC_CYCLE_NRD(20),
+ &smc->cs[3].cycle);
+
+ writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
+#ifdef CONFIG_SYS_NAND_DBW_16
+ AT91_SMC_MODE_DBW_16 |
+#else /* CONFIG_SYS_NAND_DBW_8 */
+ AT91_SMC_MODE_DBW_8 |
+#endif
+ AT91_SMC_MODE_TDF | AT91_SMC_MODE_TDF_CYCLE(15),
+ &smc->cs[3].mode);
+}
+#endif
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+ at91_prepare_cpu_var();
+
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+ at91_seriald_hw_init();
+}
+#endif
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+#ifdef CONFIG_DEBUG_UART
+ debug_uart_init();
+#endif
+ return 0;
+}
+#endif
+
+#define MAC24AA_MAC_OFFSET 0xfa
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_I2C_EEPROM
+ at91_set_ethaddr(MAC24AA_MAC_OFFSET);
+#endif
+ return 0;
+}
+#endif
+
+int board_init(void)
+{
+ /* address of boot parameters */
+ gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
+
+#ifdef CONFIG_CMD_NAND
+ sam9x60_curiosity_nand_hw_init();
+#endif
+ return 0;
+}
+
+int dram_init_banksize(void)
+{
+ return fdtdec_setup_memory_banksize();
+}
+
+int dram_init(void)
+{
+ return fdtdec_setup_mem_size_base();
+}
diff --git a/include/configs/sam9x60_curiosity.h b/include/configs/sam9x60_curiosity.h
new file mode 100644
index 0000000000..4ec380ee54
--- /dev/null
+++ b/include/configs/sam9x60_curiosity.h
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration settings for the SAM9X60 CURIOSITY board.
+ *
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+ */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define CONFIG_SYS_AT91_SLOW_CLOCK 32768
+#define CONFIG_SYS_AT91_MAIN_CLOCK 24000000 /* 24 MHz crystal */
+
+#define CONFIG_USART_BASE ATMEL_BASE_DBGU
+#define CONFIG_USART_ID 0 /* ignored in arm */
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+
+/* SDRAM */
+#define CONFIG_SYS_SDRAM_BASE 0x20000000
+#define CONFIG_SYS_SDRAM_SIZE 0x8000000 /* 128 MB */
+
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_INIT_SP_ADDR 0x218000
+#else
+#define CONFIG_SYS_INIT_SP_ADDR \
+ (CONFIG_SYS_SDRAM_BASE + 16 * 1024 + CONFIG_SYS_MALLOC_F_LEN - \
+ GENERATED_GBL_DATA_SIZE)
+#endif
+
+/* NAND flash */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_SYS_NAND_MASK_ALE BIT(21)
+#define CONFIG_SYS_NAND_MASK_CLE BIT(22)
+#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4
+#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+#endif
+
+#ifndef CONFIG_BOOTCOMMAND
+#ifdef CONFIG_SD_BOOT
+/* bootstrap + u-boot + env + linux in sd card */
+#define CONFIG_BOOTCOMMAND "fatload mmc " CONFIG_ENV_FAT_DEVICE_AND_PART \
+ " 0x21000000 at91-sam9x60_curiosity.dtb;" \
+ "fatload mmc " \
+ CONFIG_ENV_FAT_DEVICE_AND_PART \
+ " 0x22000000 zImage;" \
+ "bootz 0x22000000 - 0x21000000"
+#elif defined(CONFIG_NAND_BOOT)
+/* bootstrap + u-boot + env + linux in nandflash */
+#define CONFIG_BOOTCOMMAND "nand read " \
+ "0x22000000 0x200000 0x600000; " \
+ "nand read 0x21000000 0x180000 0x20000; " \
+ "bootz 0x22000000 - 0x21000000"
+#else
+#define CONFIG_BOOTCOMMAND "Place your bootcommand here"
+#endif
+#endif
+
+#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] ARM: dts: Add device tree files for sam9x60_curiosity
2022-03-21 10:34 [PATCH 0/4] Add support for sam9x60_curiosity Durai Manickam KR
2022-03-21 10:34 ` [PATCH 1/4] board: Add sam9x60_curiosity support Durai Manickam KR
@ 2022-03-21 10:34 ` Durai Manickam KR
2022-03-21 10:34 ` [PATCH 3/4] configs: Add sam9x60_curiosity_mmc_defconfig Durai Manickam KR
2022-03-21 10:34 ` [PATCH 4/4] configs: Add sam9x60_curiosity_nandflash_defconfig Durai Manickam KR
3 siblings, 0 replies; 8+ messages in thread
From: Durai Manickam KR @ 2022-03-21 10:34 UTC (permalink / raw)
To: u-boot; +Cc: durai.manickamkr, MPUSWLinux, Eugen.Hristev
Add dts and dtsi files.
Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
---
arch/arm/dts/Makefile | 2 +
.../dts/at91-sam9x60_curiosity-u-boot.dtsi | 79 +++++++++++++++++++
arch/arm/dts/at91-sam9x60_curiosity.dts | 74 +++++++++++++++++
3 files changed, 155 insertions(+)
create mode 100644 arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
create mode 100644 arch/arm/dts/at91-sam9x60_curiosity.dts
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 644ba961a2..fefa612d49 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1006,6 +1006,8 @@ dtb-$(CONFIG_TARGET_AT91SAM9X5EK) += \
dtb-$(CONFIG_TARGET_SAM9X60EK) += sam9x60ek.dtb
+dtb-$(CONFIG_TARGET_SAM9X60_CURIOSITY) += at91-sam9x60_curiosity.dtb
+
dtb-$(CONFIG_TARGET_AT91SAM9N12EK) += at91sam9n12ek.dtb
dtb-$(CONFIG_TARGET_GARDENA_SMART_GATEWAY_AT91SAM) += \
diff --git a/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi b/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
new file mode 100644
index 0000000000..d176e20f28
--- /dev/null
+++ b/arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * at91-sam9x60_curiosity-u-boot.dtsi - Device Tree Include file for SAM9X60
+ * CURIOSITY.
+ *
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+ */
+
+/ {
+ ahb {
+ u-boot,dm-pre-reloc;
+
+ apb {
+ u-boot,dm-pre-reloc;
+
+ pinctrl {
+ u-boot,dm-pre-reloc;
+ };
+ };
+ };
+
+ chosen {
+ u-boot,dm-pre-reloc;
+ };
+};
+
+&clk32 {
+ u-boot,dm-pre-reloc;
+};
+
+&dbgu {
+ u-boot,dm-pre-reloc;
+};
+
+&main_rc {
+ u-boot,dm-pre-reloc;
+};
+
+&main_xtal {
+ u-boot,dm-pre-reloc;
+};
+
+&pinctrl_dbgu {
+ u-boot,dm-pre-reloc;
+};
+
+&pinctrl_sdhci0 {
+ u-boot,dm-pre-reloc;
+};
+
+&pioA {
+ u-boot,dm-pre-reloc;
+};
+
+&pioB {
+ u-boot,dm-pre-reloc;
+};
+
+&pit64b0 {
+ u-boot,dm-pre-reloc;
+};
+
+&pmc {
+ u-boot,dm-pre-reloc;
+};
+
+&sdhci0 {
+ u-boot,dm-pre-reloc;
+};
+
+&slow_rc_osc {
+ u-boot,dm-pre-reloc;
+};
+
+&slow_xtal {
+ u-boot,dm-pre-reloc;
+};
diff --git a/arch/arm/dts/at91-sam9x60_curiosity.dts b/arch/arm/dts/at91-sam9x60_curiosity.dts
new file mode 100644
index 0000000000..2e7ccb0ffb
--- /dev/null
+++ b/arch/arm/dts/at91-sam9x60_curiosity.dts
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * at91-sam9x60_curiosity.dts - Device Tree file for SAM9X60 CURIOSITY board
+ *
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+ */
+/dts-v1/;
+#include <dt-bindings/mfd/atmel-flexcom.h>
+#include "sam9x60.dtsi"
+
+/ {
+ model = "Microchip SAM9X60 CURIOSITY";
+ compatible = "microchip,sam9x60-curiosity", "microchip,sam9x60", "atmel,at91sam9";
+
+ ahb {
+ apb {
+ flx0: flexcom@f801c600 {
+ atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
+ status = "okay";
+
+ i2c@600 {
+ compatible = "atmel,sama5d2-i2c";
+ reg = <0x600 0x200>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_flx0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ clocks = <&pmc PMC_TYPE_PERIPHERAL 5>;
+ status = "okay";
+
+ eeprom@53 {
+ compatible = "atmel,24c32";
+ reg = <0x53>;
+ pagesize = <16>;
+ };
+ };
+ };
+
+ pinctrl {
+ pinctrl_flx0: flx0_default {
+ atmel,pins =
+ <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE
+ AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE>;
+ };
+ };
+ };
+ };
+
+ chosen {
+ stdout-path = &dbgu;
+ i2c0 = &flx0;
+ };
+
+ clocks {
+ slow_xtal: slow_xtal {
+ clock-frequency = <32768>;
+ };
+
+ main_xtal: main_xtal {
+ clock-frequency = <24000000>;
+ };
+ };
+
+ memory {
+ reg = <0x20000000 0x8000000>;
+ };
+};
+
+&macb0 {
+ phy-mode = "rmii";
+ status = "okay";
+};
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] configs: Add sam9x60_curiosity_mmc_defconfig
2022-03-21 10:34 [PATCH 0/4] Add support for sam9x60_curiosity Durai Manickam KR
2022-03-21 10:34 ` [PATCH 1/4] board: Add sam9x60_curiosity support Durai Manickam KR
2022-03-21 10:34 ` [PATCH 2/4] ARM: dts: Add device tree files for sam9x60_curiosity Durai Manickam KR
@ 2022-03-21 10:34 ` Durai Manickam KR
2022-03-21 10:34 ` [PATCH 4/4] configs: Add sam9x60_curiosity_nandflash_defconfig Durai Manickam KR
3 siblings, 0 replies; 8+ messages in thread
From: Durai Manickam KR @ 2022-03-21 10:34 UTC (permalink / raw)
To: u-boot; +Cc: durai.manickamkr, MPUSWLinux, Eugen.Hristev
Add boot from SDMMC (sdcard) support for sam9x60_curiosity.
Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
---
board/atmel/sam9x60_curiosity/MAINTAINERS | 1 +
configs/sam9x60_curiosity_mmc_defconfig | 82 +++++++++++++++++++++++
2 files changed, 83 insertions(+)
create mode 100644 configs/sam9x60_curiosity_mmc_defconfig
diff --git a/board/atmel/sam9x60_curiosity/MAINTAINERS b/board/atmel/sam9x60_curiosity/MAINTAINERS
index 84a3a9f186..3e1dce2980 100644
--- a/board/atmel/sam9x60_curiosity/MAINTAINERS
+++ b/board/atmel/sam9x60_curiosity/MAINTAINERS
@@ -4,3 +4,4 @@ M: Eugen Hristev <eugen.hristev@microchip.com>
S: Maintained
F: board/atmel/sam9x60_curiosity/
F: include/configs/sam9x60_curiosity.h
+F: configs/sam9x60_curiosity_mmc_defconfig
diff --git a/configs/sam9x60_curiosity_mmc_defconfig b/configs/sam9x60_curiosity_mmc_defconfig
new file mode 100644
index 0000000000..475f06a0c3
--- /dev/null
+++ b/configs/sam9x60_curiosity_mmc_defconfig
@@ -0,0 +1,82 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_ARCH_AT91=y
+CONFIG_SYS_TEXT_BASE=0x23f00000
+CONFIG_SYS_MALLOC_LEN=0x81000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_TARGET_SAM9X60_CURIOSITY=y
+CONFIG_ATMEL_LEGACY=y
+CONFIG_NR_DRAM_BANKS=8
+CONFIG_ENV_SIZE=0x4000
+CONFIG_DM_GPIO=y
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_DEBUG_UART_BASE=0xfffff200
+CONFIG_DEBUG_UART_CLOCK=200000000
+CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity"
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x22000000
+CONFIG_FIT=y
+CONFIG_SD_BOOT=y
+CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sam9x60_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000"
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="U-Boot> "
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DM=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_NAND=y
+CONFIG_CMD_NAND_TRIMFFS=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_HASH=y
+CONFIG_HASH_VERIFY=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_DM=y
+CONFIG_CLK=y
+CONFIG_CLK_CCF=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_GENERIC_CLK=y
+CONFIG_AT91_SAM9X60_PLL=y
+CONFIG_CPU=y
+CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
+CONFIG_MICROCHIP_FLEXCOM=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ATMEL=y
+CONFIG_MTD=y
+# CONFIG_SYS_NAND_USE_FLASH_BBT is not set
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_ATMEL=y
+CONFIG_ATMEL_NAND_HW_PMECC=y
+CONFIG_PMECC_CAP=8
+CONFIG_PHY_MICREL=y
+CONFIG_DM_ETH=y
+CONFIG_MACB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_ATMEL_USART=y
+CONFIG_TIMER=y
+CONFIG_MCHP_PIT64B_TIMER=y
+CONFIG_OF_LIBFDT_OVERLAY=y
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] configs: Add sam9x60_curiosity_nandflash_defconfig
2022-03-21 10:34 [PATCH 0/4] Add support for sam9x60_curiosity Durai Manickam KR
` (2 preceding siblings ...)
2022-03-21 10:34 ` [PATCH 3/4] configs: Add sam9x60_curiosity_mmc_defconfig Durai Manickam KR
@ 2022-03-21 10:34 ` Durai Manickam KR
3 siblings, 0 replies; 8+ messages in thread
From: Durai Manickam KR @ 2022-03-21 10:34 UTC (permalink / raw)
To: u-boot; +Cc: durai.manickamkr, MPUSWLinux, Eugen.Hristev
Add boot from NAND flash support for sam9x60_curiosity.
Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
---
board/atmel/sam9x60_curiosity/MAINTAINERS | 1 +
configs/sam9x60_curiosity_nandflash_defconfig | 82 +++++++++++++++++++
2 files changed, 83 insertions(+)
create mode 100644 configs/sam9x60_curiosity_nandflash_defconfig
diff --git a/board/atmel/sam9x60_curiosity/MAINTAINERS b/board/atmel/sam9x60_curiosity/MAINTAINERS
index 3e1dce2980..63e34cee07 100644
--- a/board/atmel/sam9x60_curiosity/MAINTAINERS
+++ b/board/atmel/sam9x60_curiosity/MAINTAINERS
@@ -5,3 +5,4 @@ S: Maintained
F: board/atmel/sam9x60_curiosity/
F: include/configs/sam9x60_curiosity.h
F: configs/sam9x60_curiosity_mmc_defconfig
+F: configs/sam9x60_curiosity_nandflash_defconfig
diff --git a/configs/sam9x60_curiosity_nandflash_defconfig b/configs/sam9x60_curiosity_nandflash_defconfig
new file mode 100644
index 0000000000..aa88ff5336
--- /dev/null
+++ b/configs/sam9x60_curiosity_nandflash_defconfig
@@ -0,0 +1,82 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_ARCH_AT91=y
+CONFIG_SYS_TEXT_BASE=0x23f00000
+CONFIG_SYS_MALLOC_LEN=0x81000
+CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_TARGET_SAM9X60_CURIOSITY=y
+CONFIG_ATMEL_LEGACY=y
+CONFIG_NR_DRAM_BANKS=8
+CONFIG_DM_GPIO=y
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_DEBUG_UART_BASE=0xfffff200
+CONFIG_DEBUG_UART_CLOCK=200000000
+CONFIG_ENV_OFFSET_REDUND=0x100000
+CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity"
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_LOAD_ADDR=0x22000000
+CONFIG_FIT=y
+CONFIG_NAND_BOOT=y
+CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 earlyprintk mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env_redundant),256k(env),512k(dtb),6M(kernel)ro,-(rootfs) rootfstype=ubifs ubi.mtd=12 root=ubi0:rootfs rw"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="nand read 0x22000000 0x200000 0x600000; nand read 0x21000000 0x180000 0x20000; bootz 0x22000000 - 0x21000000"
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_HUSH_PARSER=y
+CONFIG_SYS_PROMPT="U-Boot> "
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_DM=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_NAND=y
+CONFIG_CMD_NAND_TRIMFFS=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_MII=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_HASH=y
+CONFIG_HASH_VERIFY=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_ENV_IS_IN_NAND=y
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_DM=y
+CONFIG_CLK=y
+CONFIG_CLK_CCF=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_GENERIC_CLK=y
+CONFIG_AT91_SAM9X60_PLL=y
+CONFIG_CPU=y
+CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
+CONFIG_MICROCHIP_FLEXCOM=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ATMEL=y
+CONFIG_MTD=y
+# CONFIG_SYS_NAND_USE_FLASH_BBT is not set
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_ATMEL=y
+CONFIG_ATMEL_NAND_HW_PMECC=y
+CONFIG_PMECC_CAP=8
+CONFIG_PHY_MICREL=y
+CONFIG_DM_ETH=y
+CONFIG_MACB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_ATMEL_USART=y
+CONFIG_TIMER=y
+CONFIG_MCHP_PIT64B_TIMER=y
+CONFIG_OF_LIBFDT_OVERLAY=y
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] board: Add sam9x60_curiosity support
2022-03-21 10:34 ` [PATCH 1/4] board: Add sam9x60_curiosity support Durai Manickam KR
@ 2022-03-21 16:32 ` Eugen.Hristev
2022-03-22 8:58 ` Durai.ManickamKR
0 siblings, 1 reply; 8+ messages in thread
From: Eugen.Hristev @ 2022-03-21 16:32 UTC (permalink / raw)
To: Durai.ManickamKR, u-boot; +Cc: MPUSWLinux
On 3/21/22 12:34 PM, Durai Manickam KR wrote:
> Add board files, Kconfig, Makefile and MAINTAINERS.
>
> Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
> ---
> arch/arm/mach-at91/Kconfig | 10 ++
> board/atmel/sam9x60_curiosity/Kconfig | 15 ++
> board/atmel/sam9x60_curiosity/MAINTAINERS | 6 +
> board/atmel/sam9x60_curiosity/Makefile | 7 +
> .../sam9x60_curiosity/sam9x60_curiosity.c | 139 ++++++++++++++++++
> include/configs/sam9x60_curiosity.h | 67 +++++++++
> 6 files changed, 244 insertions(+)
> create mode 100644 board/atmel/sam9x60_curiosity/Kconfig
> create mode 100644 board/atmel/sam9x60_curiosity/MAINTAINERS
> create mode 100644 board/atmel/sam9x60_curiosity/Makefile
> create mode 100644 board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
> create mode 100644 include/configs/sam9x60_curiosity.h
>
> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
> index 00f31045d6..7a1dbff069 100644
> --- a/arch/arm/mach-at91/Kconfig
> +++ b/arch/arm/mach-at91/Kconfig
> @@ -161,6 +161,12 @@ config TARGET_SAM9X60EK
> select BOARD_EARLY_INIT_F
> select BOARD_LATE_INIT
>
> +config TARGET_SAM9X60_CURIOSITY
> + bool "SAM9X60 CURIOSITY board"
> + select SAM9X60
> + select BOARD_EARLY_INIT_F
> + select BOARD_LATE_INIT
> +
> config TARGET_SAMA5D2_PTC_EK
> bool "SAMA5D2 PTC EK board"
> select BOARD_EARLY_INIT_F
> @@ -310,6 +316,9 @@ config AT91_EFLASH
> Enable the driver for the embedded flash used in the Atmel
> AT91SAM9XE devices.
>
> +config ATMEL_LEGACY
> + bool "Legacy GPIO support"
> +
Hello Durai,
ATMEL_LEGACY has been previously converted to Kconfig with this commit :
https://source.denx.de/u-boot/custodians/u-boot-at91/-/commit/cb81640011270dae6346979ef36264a72cf3b565
So please rebase your series on top of u-boot/next or u-boot-at91/next
which is created on top of next and includes patches for the next u-boot
merge window.
Thank you !
> source "board/atmel/at91sam9260ek/Kconfig"
> source "board/atmel/at91sam9261ek/Kconfig"
> source "board/atmel/at91sam9263ek/Kconfig"
> @@ -318,6 +327,7 @@ source "board/atmel/at91sam9n12ek/Kconfig"
> source "board/atmel/at91sam9rlek/Kconfig"
> source "board/atmel/at91sam9x5ek/Kconfig"
> source "board/atmel/sam9x60ek/Kconfig"
> +source "board/atmel/sam9x60_curiosity/Kconfig"
> source "board/atmel/sama7g5ek/Kconfig"
> source "board/atmel/sama5d2_ptc_ek/Kconfig"
> source "board/atmel/sama5d2_xplained/Kconfig"
> diff --git a/board/atmel/sam9x60_curiosity/Kconfig b/board/atmel/sam9x60_curiosity/Kconfig
> new file mode 100644
> index 0000000000..ae84e0f32c
> --- /dev/null
> +++ b/board/atmel/sam9x60_curiosity/Kconfig
> @@ -0,0 +1,15 @@
> +if TARGET_SAM9X60_CURIOSITY
> +
> +config SYS_BOARD
> + default "sam9x60_curiosity"
> +
> +config SYS_VENDOR
> + default "atmel"
> +
> +config SYS_SOC
> + default "at91"
> +
> +config SYS_CONFIG_NAME
> + default "sam9x60_curiosity"
> +
> +endif
> diff --git a/board/atmel/sam9x60_curiosity/MAINTAINERS b/board/atmel/sam9x60_curiosity/MAINTAINERS
> new file mode 100644
> index 0000000000..84a3a9f186
> --- /dev/null
> +++ b/board/atmel/sam9x60_curiosity/MAINTAINERS
> @@ -0,0 +1,6 @@
> +SAM9X60 CURIOSITY BOARD
> +M: Durai Manickam KR <durai.manickamkr@microchip.com>
> +M: Eugen Hristev <eugen.hristev@microchip.com>
> +S: Maintained
> +F: board/atmel/sam9x60_curiosity/
> +F: include/configs/sam9x60_curiosity.h
> diff --git a/board/atmel/sam9x60_curiosity/Makefile b/board/atmel/sam9x60_curiosity/Makefile
> new file mode 100644
> index 0000000000..c4d17e66d4
> --- /dev/null
> +++ b/board/atmel/sam9x60_curiosity/Makefile
> @@ -0,0 +1,7 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
> +#
> +# Author: Durai Manickam KR <durai.manickamkr@microchip.com>
> +
> +obj-y += sam9x60_curiosity.o
> diff --git a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
> new file mode 100644
> index 0000000000..3c5470b03c
> --- /dev/null
> +++ b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
> @@ -0,0 +1,139 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
> + *
> + * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
> + */
> +
> +#include <common.h>
> +#include <debug_uart.h>
> +#include <fdtdec.h>
> +#include <init.h>
> +#include <asm/arch/at91_common.h>
> +#include <asm/arch/at91_rstc.h>
> +#include <asm/arch/at91_sfr.h>
> +#include <asm/arch/at91sam9_smc.h>
> +#include <asm/arch/clk.h>
> +#include <asm/arch/gpio.h>
> +#include <asm/global_data.h>
> +#include <asm/io.h>
> +#include <asm/mach-types.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +void at91_prepare_cpu_var(void);
> +
> +#ifdef CONFIG_CMD_NAND
> +static void sam9x60_curiosity_nand_hw_init(void)
> +{
> + struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
> + struct atmel_sfr *sfr = (struct atmel_sfr *)ATMEL_BASE_SFR;
> + unsigned int csa;
> +
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 0, 1); /* NAND OE */
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 1, 1); /* NAND WE */
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 2, 0); /* NAND ALE */
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 3, 0); /* NAND CLE */
> + /* Enable NandFlash */
> + at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
> + /* Configure RDY/BSY */
> + at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 6, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 7, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 8, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 9, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 10, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 11, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 12, 1);
> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 13, 1);
> +
> + at91_periph_clk_enable(ATMEL_ID_PIOD);
> +
> + /* Enable CS3 */
> + csa = readl(&sfr->ebicsa);
> + csa |= AT91_SFR_CCFG_EBI_CSA(3, 1) | AT91_SFR_CCFG_NFD0_ON_D16;
> +
> + /* Configure IO drive */
> + csa &= ~AT91_SFR_CCFG_EBI_DRIVE_SAM9X60;
> +
> + writel(csa, &sfr->ebicsa);
> +
> + /* Configure SMC CS3 for NAND/SmartMedia */
> + writel(AT91_SMC_SETUP_NWE(4), &smc->cs[3].setup);
> +
> + writel(AT91_SMC_PULSE_NWE(10) | AT91_SMC_PULSE_NCS_WR(20) |
> + AT91_SMC_PULSE_NRD(10) | AT91_SMC_PULSE_NCS_RD(20),
> + &smc->cs[3].pulse);
> +
> + writel(AT91_SMC_CYCLE_NWE(20) | AT91_SMC_CYCLE_NRD(20),
> + &smc->cs[3].cycle);
> +
> + writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
> +#ifdef CONFIG_SYS_NAND_DBW_16
> + AT91_SMC_MODE_DBW_16 |
> +#else /* CONFIG_SYS_NAND_DBW_8 */
> + AT91_SMC_MODE_DBW_8 |
> +#endif
> + AT91_SMC_MODE_TDF | AT91_SMC_MODE_TDF_CYCLE(15),
> + &smc->cs[3].mode);
> +}
> +#endif
> +
> +#ifdef CONFIG_BOARD_LATE_INIT
> +int board_late_init(void)
> +{
> + at91_prepare_cpu_var();
> +
> + return 0;
> +}
> +#endif
> +
> +#ifdef CONFIG_DEBUG_UART_BOARD_INIT
> +void board_debug_uart_init(void)
> +{
> + at91_seriald_hw_init();
> +}
> +#endif
> +
> +#ifdef CONFIG_BOARD_EARLY_INIT_F
> +int board_early_init_f(void)
> +{
> +#ifdef CONFIG_DEBUG_UART
> + debug_uart_init();
> +#endif
> + return 0;
> +}
> +#endif
> +
> +#define MAC24AA_MAC_OFFSET 0xfa
> +
> +#ifdef CONFIG_MISC_INIT_R
> +int misc_init_r(void)
> +{
> +#ifdef CONFIG_I2C_EEPROM
> + at91_set_ethaddr(MAC24AA_MAC_OFFSET);
> +#endif
> + return 0;
> +}
> +#endif
> +
> +int board_init(void)
> +{
> + /* address of boot parameters */
> + gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
> +
> +#ifdef CONFIG_CMD_NAND
> + sam9x60_curiosity_nand_hw_init();
> +#endif
> + return 0;
> +}
> +
> +int dram_init_banksize(void)
> +{
> + return fdtdec_setup_memory_banksize();
> +}
> +
> +int dram_init(void)
> +{
> + return fdtdec_setup_mem_size_base();
> +}
> diff --git a/include/configs/sam9x60_curiosity.h b/include/configs/sam9x60_curiosity.h
> new file mode 100644
> index 0000000000..4ec380ee54
> --- /dev/null
> +++ b/include/configs/sam9x60_curiosity.h
> @@ -0,0 +1,67 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Configuration settings for the SAM9X60 CURIOSITY board.
> + *
> + * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
> + *
> + * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
> + */
> +
> +#ifndef __CONFIG_H__
> +#define __CONFIG_H__
> +
> +#define CONFIG_SYS_AT91_SLOW_CLOCK 32768
> +#define CONFIG_SYS_AT91_MAIN_CLOCK 24000000 /* 24 MHz crystal */
> +
> +#define CONFIG_USART_BASE ATMEL_BASE_DBGU
> +#define CONFIG_USART_ID 0 /* ignored in arm */
> +
> +/*
> + * BOOTP options
> + */
> +#define CONFIG_BOOTP_BOOTFILESIZE
> +
> +/* SDRAM */
> +#define CONFIG_SYS_SDRAM_BASE 0x20000000
> +#define CONFIG_SYS_SDRAM_SIZE 0x8000000 /* 128 MB */
> +
> +#ifdef CONFIG_SPL_BUILD
> +#define CONFIG_SYS_INIT_SP_ADDR 0x218000
> +#else
> +#define CONFIG_SYS_INIT_SP_ADDR \
> + (CONFIG_SYS_SDRAM_BASE + 16 * 1024 + CONFIG_SYS_MALLOC_F_LEN - \
> + GENERATED_GBL_DATA_SIZE)
> +#endif
> +
> +/* NAND flash */
> +#ifdef CONFIG_CMD_NAND
> +#define CONFIG_SYS_MAX_NAND_DEVICE 1
> +#define CONFIG_SYS_NAND_BASE 0x40000000
> +#define CONFIG_SYS_NAND_MASK_ALE BIT(21)
> +#define CONFIG_SYS_NAND_MASK_CLE BIT(22)
> +#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4
> +#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5
> +#define CONFIG_SYS_NAND_ONFI_DETECTION
> +#endif
> +
> +#ifndef CONFIG_BOOTCOMMAND
> +#ifdef CONFIG_SD_BOOT
> +/* bootstrap + u-boot + env + linux in sd card */
> +#define CONFIG_BOOTCOMMAND "fatload mmc " CONFIG_ENV_FAT_DEVICE_AND_PART \
> + " 0x21000000 at91-sam9x60_curiosity.dtb;" \
> + "fatload mmc " \
> + CONFIG_ENV_FAT_DEVICE_AND_PART \
> + " 0x22000000 zImage;" \
> + "bootz 0x22000000 - 0x21000000"
> +#elif defined(CONFIG_NAND_BOOT)
> +/* bootstrap + u-boot + env + linux in nandflash */
> +#define CONFIG_BOOTCOMMAND "nand read " \
> + "0x22000000 0x200000 0x600000; " \
> + "nand read 0x21000000 0x180000 0x20000; " \
> + "bootz 0x22000000 - 0x21000000"
> +#else
> +#define CONFIG_BOOTCOMMAND "Place your bootcommand here"
> +#endif
> +#endif
> +
> +#endif
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] board: Add sam9x60_curiosity support
2022-03-22 8:51 [PATCH 0/4] Add support for sam9x60_curiosity Durai Manickam KR
@ 2022-03-22 8:51 ` Durai Manickam KR
0 siblings, 0 replies; 8+ messages in thread
From: Durai Manickam KR @ 2022-03-22 8:51 UTC (permalink / raw)
To: u-boot; +Cc: durai.manickamkr, MPUSWLinux, Eugen.Hristev
Add board files, Kconfig, Makefile and MAINTAINERS.
Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
---
arch/arm/mach-at91/Kconfig | 7 +
board/atmel/sam9x60_curiosity/Kconfig | 15 ++
board/atmel/sam9x60_curiosity/MAINTAINERS | 6 +
board/atmel/sam9x60_curiosity/Makefile | 7 +
.../sam9x60_curiosity/sam9x60_curiosity.c | 139 ++++++++++++++++++
include/configs/sam9x60_curiosity.h | 67 +++++++++
6 files changed, 241 insertions(+)
create mode 100644 board/atmel/sam9x60_curiosity/Kconfig
create mode 100644 board/atmel/sam9x60_curiosity/MAINTAINERS
create mode 100644 board/atmel/sam9x60_curiosity/Makefile
create mode 100644 board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
create mode 100644 include/configs/sam9x60_curiosity.h
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index fc193b935e..8b3356edcb 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -161,6 +161,12 @@ config TARGET_SAM9X60EK
select BOARD_EARLY_INIT_F
select BOARD_LATE_INIT
+config TARGET_SAM9X60_CURIOSITY
+ bool "SAM9X60 CURIOSITY board"
+ select SAM9X60
+ select BOARD_EARLY_INIT_F
+ select BOARD_LATE_INIT
+
config TARGET_SAMA5D2_PTC_EK
bool "SAMA5D2 PTC EK board"
select BOARD_EARLY_INIT_F
@@ -326,6 +332,7 @@ source "board/atmel/at91sam9n12ek/Kconfig"
source "board/atmel/at91sam9rlek/Kconfig"
source "board/atmel/at91sam9x5ek/Kconfig"
source "board/atmel/sam9x60ek/Kconfig"
+source "board/atmel/sam9x60_curiosity/Kconfig"
source "board/atmel/sama7g5ek/Kconfig"
source "board/atmel/sama5d2_ptc_ek/Kconfig"
source "board/atmel/sama5d2_xplained/Kconfig"
diff --git a/board/atmel/sam9x60_curiosity/Kconfig b/board/atmel/sam9x60_curiosity/Kconfig
new file mode 100644
index 0000000000..ae84e0f32c
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_SAM9X60_CURIOSITY
+
+config SYS_BOARD
+ default "sam9x60_curiosity"
+
+config SYS_VENDOR
+ default "atmel"
+
+config SYS_SOC
+ default "at91"
+
+config SYS_CONFIG_NAME
+ default "sam9x60_curiosity"
+
+endif
diff --git a/board/atmel/sam9x60_curiosity/MAINTAINERS b/board/atmel/sam9x60_curiosity/MAINTAINERS
new file mode 100644
index 0000000000..84a3a9f186
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/MAINTAINERS
@@ -0,0 +1,6 @@
+SAM9X60 CURIOSITY BOARD
+M: Durai Manickam KR <durai.manickamkr@microchip.com>
+M: Eugen Hristev <eugen.hristev@microchip.com>
+S: Maintained
+F: board/atmel/sam9x60_curiosity/
+F: include/configs/sam9x60_curiosity.h
diff --git a/board/atmel/sam9x60_curiosity/Makefile b/board/atmel/sam9x60_curiosity/Makefile
new file mode 100644
index 0000000000..c4d17e66d4
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+#
+# Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+
+obj-y += sam9x60_curiosity.o
diff --git a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
new file mode 100644
index 0000000000..3c5470b03c
--- /dev/null
+++ b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+ */
+
+#include <common.h>
+#include <debug_uart.h>
+#include <fdtdec.h>
+#include <init.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/at91_rstc.h>
+#include <asm/arch/at91_sfr.h>
+#include <asm/arch/at91sam9_smc.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/gpio.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void at91_prepare_cpu_var(void);
+
+#ifdef CONFIG_CMD_NAND
+static void sam9x60_curiosity_nand_hw_init(void)
+{
+ struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+ struct atmel_sfr *sfr = (struct atmel_sfr *)ATMEL_BASE_SFR;
+ unsigned int csa;
+
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 0, 1); /* NAND OE */
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 1, 1); /* NAND WE */
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 2, 0); /* NAND ALE */
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 3, 0); /* NAND CLE */
+ /* Enable NandFlash */
+ at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
+ /* Configure RDY/BSY */
+ at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 6, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 7, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 8, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 9, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 10, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 11, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 12, 1);
+ at91_pio3_set_a_periph(AT91_PIO_PORTD, 13, 1);
+
+ at91_periph_clk_enable(ATMEL_ID_PIOD);
+
+ /* Enable CS3 */
+ csa = readl(&sfr->ebicsa);
+ csa |= AT91_SFR_CCFG_EBI_CSA(3, 1) | AT91_SFR_CCFG_NFD0_ON_D16;
+
+ /* Configure IO drive */
+ csa &= ~AT91_SFR_CCFG_EBI_DRIVE_SAM9X60;
+
+ writel(csa, &sfr->ebicsa);
+
+ /* Configure SMC CS3 for NAND/SmartMedia */
+ writel(AT91_SMC_SETUP_NWE(4), &smc->cs[3].setup);
+
+ writel(AT91_SMC_PULSE_NWE(10) | AT91_SMC_PULSE_NCS_WR(20) |
+ AT91_SMC_PULSE_NRD(10) | AT91_SMC_PULSE_NCS_RD(20),
+ &smc->cs[3].pulse);
+
+ writel(AT91_SMC_CYCLE_NWE(20) | AT91_SMC_CYCLE_NRD(20),
+ &smc->cs[3].cycle);
+
+ writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
+#ifdef CONFIG_SYS_NAND_DBW_16
+ AT91_SMC_MODE_DBW_16 |
+#else /* CONFIG_SYS_NAND_DBW_8 */
+ AT91_SMC_MODE_DBW_8 |
+#endif
+ AT91_SMC_MODE_TDF | AT91_SMC_MODE_TDF_CYCLE(15),
+ &smc->cs[3].mode);
+}
+#endif
+
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+ at91_prepare_cpu_var();
+
+ return 0;
+}
+#endif
+
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+ at91_seriald_hw_init();
+}
+#endif
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+#ifdef CONFIG_DEBUG_UART
+ debug_uart_init();
+#endif
+ return 0;
+}
+#endif
+
+#define MAC24AA_MAC_OFFSET 0xfa
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_I2C_EEPROM
+ at91_set_ethaddr(MAC24AA_MAC_OFFSET);
+#endif
+ return 0;
+}
+#endif
+
+int board_init(void)
+{
+ /* address of boot parameters */
+ gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
+
+#ifdef CONFIG_CMD_NAND
+ sam9x60_curiosity_nand_hw_init();
+#endif
+ return 0;
+}
+
+int dram_init_banksize(void)
+{
+ return fdtdec_setup_memory_banksize();
+}
+
+int dram_init(void)
+{
+ return fdtdec_setup_mem_size_base();
+}
diff --git a/include/configs/sam9x60_curiosity.h b/include/configs/sam9x60_curiosity.h
new file mode 100644
index 0000000000..4ec380ee54
--- /dev/null
+++ b/include/configs/sam9x60_curiosity.h
@@ -0,0 +1,67 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration settings for the SAM9X60 CURIOSITY board.
+ *
+ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
+ */
+
+#ifndef __CONFIG_H__
+#define __CONFIG_H__
+
+#define CONFIG_SYS_AT91_SLOW_CLOCK 32768
+#define CONFIG_SYS_AT91_MAIN_CLOCK 24000000 /* 24 MHz crystal */
+
+#define CONFIG_USART_BASE ATMEL_BASE_DBGU
+#define CONFIG_USART_ID 0 /* ignored in arm */
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+
+/* SDRAM */
+#define CONFIG_SYS_SDRAM_BASE 0x20000000
+#define CONFIG_SYS_SDRAM_SIZE 0x8000000 /* 128 MB */
+
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_INIT_SP_ADDR 0x218000
+#else
+#define CONFIG_SYS_INIT_SP_ADDR \
+ (CONFIG_SYS_SDRAM_BASE + 16 * 1024 + CONFIG_SYS_MALLOC_F_LEN - \
+ GENERATED_GBL_DATA_SIZE)
+#endif
+
+/* NAND flash */
+#ifdef CONFIG_CMD_NAND
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_SYS_NAND_MASK_ALE BIT(21)
+#define CONFIG_SYS_NAND_MASK_CLE BIT(22)
+#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4
+#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5
+#define CONFIG_SYS_NAND_ONFI_DETECTION
+#endif
+
+#ifndef CONFIG_BOOTCOMMAND
+#ifdef CONFIG_SD_BOOT
+/* bootstrap + u-boot + env + linux in sd card */
+#define CONFIG_BOOTCOMMAND "fatload mmc " CONFIG_ENV_FAT_DEVICE_AND_PART \
+ " 0x21000000 at91-sam9x60_curiosity.dtb;" \
+ "fatload mmc " \
+ CONFIG_ENV_FAT_DEVICE_AND_PART \
+ " 0x22000000 zImage;" \
+ "bootz 0x22000000 - 0x21000000"
+#elif defined(CONFIG_NAND_BOOT)
+/* bootstrap + u-boot + env + linux in nandflash */
+#define CONFIG_BOOTCOMMAND "nand read " \
+ "0x22000000 0x200000 0x600000; " \
+ "nand read 0x21000000 0x180000 0x20000; " \
+ "bootz 0x22000000 - 0x21000000"
+#else
+#define CONFIG_BOOTCOMMAND "Place your bootcommand here"
+#endif
+#endif
+
+#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] board: Add sam9x60_curiosity support
2022-03-21 16:32 ` Eugen.Hristev
@ 2022-03-22 8:58 ` Durai.ManickamKR
0 siblings, 0 replies; 8+ messages in thread
From: Durai.ManickamKR @ 2022-03-22 8:58 UTC (permalink / raw)
To: Eugen.Hristev, u-boot; +Cc: MPUSWLinux
On 21/03/22 22:02, Eugen Hristev - M18282 wrote:
> On 3/21/22 12:34 PM, Durai Manickam KR wrote:
>> Add board files, Kconfig, Makefile and MAINTAINERS.
>>
>> Signed-off-by: Durai Manickam KR <durai.manickamkr@microchip.com>
>> ---
>> arch/arm/mach-at91/Kconfig | 10 ++
>> board/atmel/sam9x60_curiosity/Kconfig | 15 ++
>> board/atmel/sam9x60_curiosity/MAINTAINERS | 6 +
>> board/atmel/sam9x60_curiosity/Makefile | 7 +
>> .../sam9x60_curiosity/sam9x60_curiosity.c | 139 ++++++++++++++++++
>> include/configs/sam9x60_curiosity.h | 67 +++++++++
>> 6 files changed, 244 insertions(+)
>> create mode 100644 board/atmel/sam9x60_curiosity/Kconfig
>> create mode 100644 board/atmel/sam9x60_curiosity/MAINTAINERS
>> create mode 100644 board/atmel/sam9x60_curiosity/Makefile
>> create mode 100644 board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
>> create mode 100644 include/configs/sam9x60_curiosity.h
>>
>> diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
>> index 00f31045d6..7a1dbff069 100644
>> --- a/arch/arm/mach-at91/Kconfig
>> +++ b/arch/arm/mach-at91/Kconfig
>> @@ -161,6 +161,12 @@ config TARGET_SAM9X60EK
>> select BOARD_EARLY_INIT_F
>> select BOARD_LATE_INIT
>>
>> +config TARGET_SAM9X60_CURIOSITY
>> + bool "SAM9X60 CURIOSITY board"
>> + select SAM9X60
>> + select BOARD_EARLY_INIT_F
>> + select BOARD_LATE_INIT
>> +
>> config TARGET_SAMA5D2_PTC_EK
>> bool "SAMA5D2 PTC EK board"
>> select BOARD_EARLY_INIT_F
>> @@ -310,6 +316,9 @@ config AT91_EFLASH
>> Enable the driver for the embedded flash used in the Atmel
>> AT91SAM9XE devices.
>>
>> +config ATMEL_LEGACY
>> + bool "Legacy GPIO support"
>> +
>
> Hello Durai,
>
> ATMEL_LEGACY has been previously converted to Kconfig with this commit :
>
> https://source.denx.de/u-boot/custodians/u-boot-at91/-/commit/cb81640011270dae6346979ef36264a72cf3b565
>
> So please rebase your series on top of u-boot/next or u-boot-at91/next
> which is created on top of next and includes patches for the next u-boot
> merge window.
>
> Thank you !
>
Hello Eugen,
Thanks, I have sent patches on top of u-boot/next branch.
>> source "board/atmel/at91sam9260ek/Kconfig"
>> source "board/atmel/at91sam9261ek/Kconfig"
>> source "board/atmel/at91sam9263ek/Kconfig"
>> @@ -318,6 +327,7 @@ source "board/atmel/at91sam9n12ek/Kconfig"
>> source "board/atmel/at91sam9rlek/Kconfig"
>> source "board/atmel/at91sam9x5ek/Kconfig"
>> source "board/atmel/sam9x60ek/Kconfig"
>> +source "board/atmel/sam9x60_curiosity/Kconfig"
>> source "board/atmel/sama7g5ek/Kconfig"
>> source "board/atmel/sama5d2_ptc_ek/Kconfig"
>> source "board/atmel/sama5d2_xplained/Kconfig"
>> diff --git a/board/atmel/sam9x60_curiosity/Kconfig b/board/atmel/sam9x60_curiosity/Kconfig
>> new file mode 100644
>> index 0000000000..ae84e0f32c
>> --- /dev/null
>> +++ b/board/atmel/sam9x60_curiosity/Kconfig
>> @@ -0,0 +1,15 @@
>> +if TARGET_SAM9X60_CURIOSITY
>> +
>> +config SYS_BOARD
>> + default "sam9x60_curiosity"
>> +
>> +config SYS_VENDOR
>> + default "atmel"
>> +
>> +config SYS_SOC
>> + default "at91"
>> +
>> +config SYS_CONFIG_NAME
>> + default "sam9x60_curiosity"
>> +
>> +endif
>> diff --git a/board/atmel/sam9x60_curiosity/MAINTAINERS b/board/atmel/sam9x60_curiosity/MAINTAINERS
>> new file mode 100644
>> index 0000000000..84a3a9f186
>> --- /dev/null
>> +++ b/board/atmel/sam9x60_curiosity/MAINTAINERS
>> @@ -0,0 +1,6 @@
>> +SAM9X60 CURIOSITY BOARD
>> +M: Durai Manickam KR <durai.manickamkr@microchip.com>
>> +M: Eugen Hristev <eugen.hristev@microchip.com>
>> +S: Maintained
>> +F: board/atmel/sam9x60_curiosity/
>> +F: include/configs/sam9x60_curiosity.h
>> diff --git a/board/atmel/sam9x60_curiosity/Makefile b/board/atmel/sam9x60_curiosity/Makefile
>> new file mode 100644
>> index 0000000000..c4d17e66d4
>> --- /dev/null
>> +++ b/board/atmel/sam9x60_curiosity/Makefile
>> @@ -0,0 +1,7 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +#
>> +# Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
>> +#
>> +# Author: Durai Manickam KR <durai.manickamkr@microchip.com>
>> +
>> +obj-y += sam9x60_curiosity.o
>> diff --git a/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
>> new file mode 100644
>> index 0000000000..3c5470b03c
>> --- /dev/null
>> +++ b/board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
>> @@ -0,0 +1,139 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
>> + *
>> + * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
>> + */
>> +
>> +#include <common.h>
>> +#include <debug_uart.h>
>> +#include <fdtdec.h>
>> +#include <init.h>
>> +#include <asm/arch/at91_common.h>
>> +#include <asm/arch/at91_rstc.h>
>> +#include <asm/arch/at91_sfr.h>
>> +#include <asm/arch/at91sam9_smc.h>
>> +#include <asm/arch/clk.h>
>> +#include <asm/arch/gpio.h>
>> +#include <asm/global_data.h>
>> +#include <asm/io.h>
>> +#include <asm/mach-types.h>
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +void at91_prepare_cpu_var(void);
>> +
>> +#ifdef CONFIG_CMD_NAND
>> +static void sam9x60_curiosity_nand_hw_init(void)
>> +{
>> + struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
>> + struct atmel_sfr *sfr = (struct atmel_sfr *)ATMEL_BASE_SFR;
>> + unsigned int csa;
>> +
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 0, 1); /* NAND OE */
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 1, 1); /* NAND WE */
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 2, 0); /* NAND ALE */
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 3, 0); /* NAND CLE */
>> + /* Enable NandFlash */
>> + at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
>> + /* Configure RDY/BSY */
>> + at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 6, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 7, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 8, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 9, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 10, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 11, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 12, 1);
>> + at91_pio3_set_a_periph(AT91_PIO_PORTD, 13, 1);
>> +
>> + at91_periph_clk_enable(ATMEL_ID_PIOD);
>> +
>> + /* Enable CS3 */
>> + csa = readl(&sfr->ebicsa);
>> + csa |= AT91_SFR_CCFG_EBI_CSA(3, 1) | AT91_SFR_CCFG_NFD0_ON_D16;
>> +
>> + /* Configure IO drive */
>> + csa &= ~AT91_SFR_CCFG_EBI_DRIVE_SAM9X60;
>> +
>> + writel(csa, &sfr->ebicsa);
>> +
>> + /* Configure SMC CS3 for NAND/SmartMedia */
>> + writel(AT91_SMC_SETUP_NWE(4), &smc->cs[3].setup);
>> +
>> + writel(AT91_SMC_PULSE_NWE(10) | AT91_SMC_PULSE_NCS_WR(20) |
>> + AT91_SMC_PULSE_NRD(10) | AT91_SMC_PULSE_NCS_RD(20),
>> + &smc->cs[3].pulse);
>> +
>> + writel(AT91_SMC_CYCLE_NWE(20) | AT91_SMC_CYCLE_NRD(20),
>> + &smc->cs[3].cycle);
>> +
>> + writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
>> +#ifdef CONFIG_SYS_NAND_DBW_16
>> + AT91_SMC_MODE_DBW_16 |
>> +#else /* CONFIG_SYS_NAND_DBW_8 */
>> + AT91_SMC_MODE_DBW_8 |
>> +#endif
>> + AT91_SMC_MODE_TDF | AT91_SMC_MODE_TDF_CYCLE(15),
>> + &smc->cs[3].mode);
>> +}
>> +#endif
>> +
>> +#ifdef CONFIG_BOARD_LATE_INIT
>> +int board_late_init(void)
>> +{
>> + at91_prepare_cpu_var();
>> +
>> + return 0;
>> +}
>> +#endif
>> +
>> +#ifdef CONFIG_DEBUG_UART_BOARD_INIT
>> +void board_debug_uart_init(void)
>> +{
>> + at91_seriald_hw_init();
>> +}
>> +#endif
>> +
>> +#ifdef CONFIG_BOARD_EARLY_INIT_F
>> +int board_early_init_f(void)
>> +{
>> +#ifdef CONFIG_DEBUG_UART
>> + debug_uart_init();
>> +#endif
>> + return 0;
>> +}
>> +#endif
>> +
>> +#define MAC24AA_MAC_OFFSET 0xfa
>> +
>> +#ifdef CONFIG_MISC_INIT_R
>> +int misc_init_r(void)
>> +{
>> +#ifdef CONFIG_I2C_EEPROM
>> + at91_set_ethaddr(MAC24AA_MAC_OFFSET);
>> +#endif
>> + return 0;
>> +}
>> +#endif
>> +
>> +int board_init(void)
>> +{
>> + /* address of boot parameters */
>> + gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
>> +
>> +#ifdef CONFIG_CMD_NAND
>> + sam9x60_curiosity_nand_hw_init();
>> +#endif
>> + return 0;
>> +}
>> +
>> +int dram_init_banksize(void)
>> +{
>> + return fdtdec_setup_memory_banksize();
>> +}
>> +
>> +int dram_init(void)
>> +{
>> + return fdtdec_setup_mem_size_base();
>> +}
>> diff --git a/include/configs/sam9x60_curiosity.h b/include/configs/sam9x60_curiosity.h
>> new file mode 100644
>> index 0000000000..4ec380ee54
>> --- /dev/null
>> +++ b/include/configs/sam9x60_curiosity.h
>> @@ -0,0 +1,67 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Configuration settings for the SAM9X60 CURIOSITY board.
>> + *
>> + * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
>> + *
>> + * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
>> + */
>> +
>> +#ifndef __CONFIG_H__
>> +#define __CONFIG_H__
>> +
>> +#define CONFIG_SYS_AT91_SLOW_CLOCK 32768
>> +#define CONFIG_SYS_AT91_MAIN_CLOCK 24000000 /* 24 MHz crystal */
>> +
>> +#define CONFIG_USART_BASE ATMEL_BASE_DBGU
>> +#define CONFIG_USART_ID 0 /* ignored in arm */
>> +
>> +/*
>> + * BOOTP options
>> + */
>> +#define CONFIG_BOOTP_BOOTFILESIZE
>> +
>> +/* SDRAM */
>> +#define CONFIG_SYS_SDRAM_BASE 0x20000000
>> +#define CONFIG_SYS_SDRAM_SIZE 0x8000000 /* 128 MB */
>> +
>> +#ifdef CONFIG_SPL_BUILD
>> +#define CONFIG_SYS_INIT_SP_ADDR 0x218000
>> +#else
>> +#define CONFIG_SYS_INIT_SP_ADDR \
>> + (CONFIG_SYS_SDRAM_BASE + 16 * 1024 + CONFIG_SYS_MALLOC_F_LEN - \
>> + GENERATED_GBL_DATA_SIZE)
>> +#endif
>> +
>> +/* NAND flash */
>> +#ifdef CONFIG_CMD_NAND
>> +#define CONFIG_SYS_MAX_NAND_DEVICE 1
>> +#define CONFIG_SYS_NAND_BASE 0x40000000
>> +#define CONFIG_SYS_NAND_MASK_ALE BIT(21)
>> +#define CONFIG_SYS_NAND_MASK_CLE BIT(22)
>> +#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4
>> +#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5
>> +#define CONFIG_SYS_NAND_ONFI_DETECTION
>> +#endif
>> +
>> +#ifndef CONFIG_BOOTCOMMAND
>> +#ifdef CONFIG_SD_BOOT
>> +/* bootstrap + u-boot + env + linux in sd card */
>> +#define CONFIG_BOOTCOMMAND "fatload mmc " CONFIG_ENV_FAT_DEVICE_AND_PART \
>> + " 0x21000000 at91-sam9x60_curiosity.dtb;" \
>> + "fatload mmc " \
>> + CONFIG_ENV_FAT_DEVICE_AND_PART \
>> + " 0x22000000 zImage;" \
>> + "bootz 0x22000000 - 0x21000000"
>> +#elif defined(CONFIG_NAND_BOOT)
>> +/* bootstrap + u-boot + env + linux in nandflash */
>> +#define CONFIG_BOOTCOMMAND "nand read " \
>> + "0x22000000 0x200000 0x600000; " \
>> + "nand read 0x21000000 0x180000 0x20000; " \
>> + "bootz 0x22000000 - 0x21000000"
>> +#else
>> +#define CONFIG_BOOTCOMMAND "Place your bootcommand here"
>> +#endif
>> +#endif
>> +
>> +#endif
>>
>
--
Regards,
Durai Manickam KR
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-03-22 11:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-21 10:34 [PATCH 0/4] Add support for sam9x60_curiosity Durai Manickam KR
2022-03-21 10:34 ` [PATCH 1/4] board: Add sam9x60_curiosity support Durai Manickam KR
2022-03-21 16:32 ` Eugen.Hristev
2022-03-22 8:58 ` Durai.ManickamKR
2022-03-21 10:34 ` [PATCH 2/4] ARM: dts: Add device tree files for sam9x60_curiosity Durai Manickam KR
2022-03-21 10:34 ` [PATCH 3/4] configs: Add sam9x60_curiosity_mmc_defconfig Durai Manickam KR
2022-03-21 10:34 ` [PATCH 4/4] configs: Add sam9x60_curiosity_nandflash_defconfig Durai Manickam KR
-- strict thread matches above, loose matches on Subject: below --
2022-03-22 8:51 [PATCH 0/4] Add support for sam9x60_curiosity Durai Manickam KR
2022-03-22 8:51 ` [PATCH 1/4] board: Add sam9x60_curiosity support Durai Manickam KR
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox