Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31DFAC433F5 for ; Tue, 22 Mar 2022 11:23:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F331B83AEB; Tue, 22 Mar 2022 12:23:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="lUQU0/ZG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E4D4583956; Tue, 22 Mar 2022 09:54:25 +0100 (CET) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 895FE8141D for ; Tue, 22 Mar 2022 09:54:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Durai.ManickamKR@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1647939261; x=1679475261; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nUv3lO5ht0tCVrGW+LIuAVZWYrY4gFW/cJOkn9yCt4g=; b=lUQU0/ZGgha+ISRRJir2lWDbniNyK50Y8Fvs2PKnZb3o2lCgbXJWhOv8 inPzer/YN+AKmnkyPjbLzz02bZiro80sii/hP8dtxTcGqRyhSAP+GqUd1 H/4faMgA1f8KL63l9Lvo13btuoaQfchD77ucJxFN0uKI8eKsKulVIPwIt 9su3Wd5Tml5tGDc1UPoCFebHAqr/7fsYExxKX64tetCMZlUU3CRgotLQc f3PksbSTcbwEZT1qzsf7UvmM3XNRrJ72+AeY+CNQcuj9Xg5HUPTzN0aL9 EYCoaq/Ferywj24D2A+NTDKp4bVmj7siq69Bx1X3NbU2LuXvMjZcTUzX7 g==; X-IronPort-AV: E=Sophos;i="5.90,201,1643698800"; d="scan'208";a="166651112" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Mar 2022 01:54:19 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Tue, 22 Mar 2022 01:54:18 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Tue, 22 Mar 2022 01:54:16 -0700 From: Durai Manickam KR To: CC: , , Subject: [PATCH 1/4] board: Add sam9x60_curiosity support Date: Tue, 22 Mar 2022 14:21:40 +0530 Message-ID: <20220322085143.124622-2-durai.manickamkr@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220322085143.124622-1-durai.manickamkr@microchip.com> References: <20220322085143.124622-1-durai.manickamkr@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Mailman-Approved-At: Tue, 22 Mar 2022 12:23:15 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean Add board files, Kconfig, Makefile and MAINTAINERS. Signed-off-by: Durai Manickam KR --- 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 +M: Eugen Hristev +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 + +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 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 + */ + +#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