From 784c705b79b08b3c2c599766ea97ce7de3b32423 Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Thu, 14 Jul 2016 00:02:38 +0930 Subject: board/aspeed: Add ast-g4 board This adds a Aspeed fourth generation board with defconfigs for a system with NCSI and with a directly attached PHY configuration. Signed-off-by: Joel Stanley --- board/aspeed/Kconfig | 16 +++++++ board/aspeed/ast-g4/Kconfig | 22 +++++++++ board/aspeed/ast-g4/Makefile | 1 + board/aspeed/ast-g4/ast-g4.c | 79 +++++++++++++++++++++++++++++++ configs/ast_g4_ncsi_defconfig | 7 +++ configs/ast_g4_phy_defconfig | 8 ++++ include/configs/ast-common.h | 107 ++++++++++++++++++++++++++++++++++++++++++ include/configs/ast-g4-ncsi.h | 29 ++++++++++++ include/configs/ast-g4-phy.h | 31 ++++++++++++ 9 files changed, 300 insertions(+) create mode 100644 board/aspeed/Kconfig create mode 100644 board/aspeed/ast-g4/Kconfig create mode 100644 board/aspeed/ast-g4/Makefile create mode 100644 board/aspeed/ast-g4/ast-g4.c create mode 100644 configs/ast_g4_ncsi_defconfig create mode 100644 configs/ast_g4_phy_defconfig create mode 100644 include/configs/ast-common.h create mode 100644 include/configs/ast-g4-ncsi.h create mode 100644 include/configs/ast-g4-phy.h diff --git a/board/aspeed/Kconfig b/board/aspeed/Kconfig new file mode 100644 index 0000000000..5d356e297a --- /dev/null +++ b/board/aspeed/Kconfig @@ -0,0 +1,16 @@ +source "board/aspeed/ast-g5/Kconfig" +source "board/aspeed/ast-g4/Kconfig" + +choice + prompt "Network configuration" + default ASPEED_NET_NCSI + help + Select Aspeed network configuration + +config ASPEED_NET_PHY + bool "Use a direct attached PHY" + +config ASPEED_NET_NCSI + bool "Use a network controller attached via NSCI" + +endchoice diff --git a/board/aspeed/ast-g4/Kconfig b/board/aspeed/ast-g4/Kconfig new file mode 100644 index 0000000000..2bec9a733a --- /dev/null +++ b/board/aspeed/ast-g4/Kconfig @@ -0,0 +1,22 @@ +if TARGET_AST_G4 + +config SYS_ARCH + default "arm" + +config SYS_CPU + default "arm926ejs" + +config SYS_BOARD + default "ast-g4" + +config SYS_VENDOR + default "aspeed" + +config SYS_SOC + default "aspeed" + +config SYS_CONFIG_NAME + default "ast-g4-phy" if ASPEED_NET_PHY + default "ast-g4-ncsi" if ASPEED_NET_NCSI + +endif diff --git a/board/aspeed/ast-g4/Makefile b/board/aspeed/ast-g4/Makefile new file mode 100644 index 0000000000..8ff2692fcc --- /dev/null +++ b/board/aspeed/ast-g4/Makefile @@ -0,0 +1 @@ +obj-y = ast-g4.o diff --git a/board/aspeed/ast-g4/ast-g4.c b/board/aspeed/ast-g4/ast-g4.c new file mode 100644 index 0000000000..cc26a78529 --- /dev/null +++ b/board/aspeed/ast-g4/ast-g4.c @@ -0,0 +1,79 @@ +/* + * (C) Copyright 2002 Ryan Chen + * Copyright 2016 IBM Corporation + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +int board_init(void) +{ + /* adress of boot parameters */ + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + gd->flags = 0; + return 0; +} + +int misc_init_r(void) +{ + u32 reg; + + /* Unlock AHB controller */ + writel(AHBC_PROTECT_UNLOCK, AST_AHBC_BASE); + + /* Map DRAM to 0x00000000 */ + reg = readl(AST_AHBC_BASE + AST_AHBC_ADDR_REMAP); + writel(reg | BIT(0), AST_AHBC_BASE + AST_AHBC_ADDR_REMAP); + + /* Unlock SCU */ + writel(SCU_PROTECT_UNLOCK, AST_SCU_BASE); + + /* + * The original file contained these comments. + * TODO: verify the register write does what it claims + * + * LHCLK = HPLL/8 + * PCLK = HPLL/8 + * BHCLK = HPLL/8 + */ + reg = readl(AST_SCU_BASE + AST_SCU_CLK_SEL); + reg &= 0x1c0fffff; + reg |= 0x61800000; + writel(reg, AST_SCU_BASE + AST_SCU_CLK_SEL); + + return 0; +} + +int dram_init(void) +{ + u32 vga = ast_scu_get_vga_memsize(); + u32 dram = ast_sdmc_get_mem_size(); + gd->ram_size = dram - vga; + + return 0; +} + +#ifdef CONFIG_FTGMAC100 +int board_eth_init(bd_t *bd) +{ + return ftgmac100_initialize(bd); +} +#endif + +#ifdef CONFIG_ASPEEDNIC +int board_eth_init(bd_t *bd) +{ + return aspeednic_initialize(bd); +} +#endif diff --git a/configs/ast_g4_ncsi_defconfig b/configs/ast_g4_ncsi_defconfig new file mode 100644 index 0000000000..4ee71c5d9a --- /dev/null +++ b/configs/ast_g4_ncsi_defconfig @@ -0,0 +1,7 @@ +CONFIG_ARM=y +CONFIG_TARGET_AST_G4=y +CONFIG_SYS_PROMPT="ast# " +CONFIG_CMD_DHCP=y +CONFIG_CMD_PING=y +CONFIG_SPI_FLASH=y +CONFIG_SYS_NS16550=y diff --git a/configs/ast_g4_phy_defconfig b/configs/ast_g4_phy_defconfig new file mode 100644 index 0000000000..61fd69b468 --- /dev/null +++ b/configs/ast_g4_phy_defconfig @@ -0,0 +1,8 @@ +CONFIG_ARM=y +CONFIG_TARGET_AST_G4=y +CONFIG_ASPEED_NET_PHY=y +CONFIG_SYS_PROMPT="ast# " +CONFIG_CMD_DHCP=y +CONFIG_CMD_PING=y +CONFIG_SPI_FLASH=y +CONFIG_SYS_NS16550=y diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h new file mode 100644 index 0000000000..b39ea33ce7 --- /dev/null +++ b/include/configs/ast-common.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2012-2020 ASPEED Technology Inc. + * Ryan Chen + * + * Copyright 2016 IBM Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + */ + +#ifndef __AST_COMMON_CONFIG_H +#define __AST_COMMON_CONFIG_H + +#define CONFIG_ARCH_ASPEED +#define CONFIG_EXTRA_ENV_SETTINGS ASPEED_ENV_SETTINGS + +#define CONFIG_ARCH_CPU_INIT +#define CONFIG_MACH_TYPE MACH_TYPE_ASPEED + +#include + +/* Misc CPU related */ +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ +#define CONFIG_SETUP_MEMORY_TAGS +#define CONFIG_INITRD_TAG + +#define CONFIG_CMDLINE_EDITING 1 + +/* Enable cache controller */ +#define CONFIG_SYS_DCACHE_OFF 1 + +#define CONFIG_SYS_SDRAM_BASE AST_DRAM_BASE +#define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_SDRAM_BASE +#define CONFIG_SYS_INIT_RAM_SIZE (32*1024) +#define CONFIG_SYS_INIT_RAM_END (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_END - GENERATED_GBL_DATA_SIZE) + +#define CONFIG_NR_DRAM_BANKS 1 + +#define CONFIG_SYS_TEXT_BASE 0x00000000 + +#define CONFIG_SYS_MALLOC_LEN (0x1000 + 4*1024*1024) /* malloc() len */ + +#define CONFIG_ASPEED_TIMER_CLK (1*1000*1000) /* use external clk (1M) */ + +/* + * NS16550 Configuration + */ +#define CONFIG_SYS_NS16550_SERIAL +#define CONFIG_SYS_NS16550_REG_SIZE (-4) +#define CONFIG_SYS_NS16550_CLK 24000000 +#define CONFIG_SYS_NS16550_COM1 AST_UART0_BASE +#define CONFIG_SYS_LOADS_BAUD_CHANGE +#define CONFIG_SERIAL1 1 +#define CONFIG_CONS_INDEX 1 +#define CONFIG_BAUDRATE 115200 + +/* + * BOOTP options + */ +#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_BOOTPATH +#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_HOSTNAME +#define CONFIG_BOOTP_SUBNETMASK + +/* + * Environment Config + */ +#define CONFIG_BOOTDELAY 2 + +/* + * Miscellaneous configurable options + */ +#define CONFIG_SYS_LONGHELP +#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */ +#define CONFIG_SYS_PROMPT "ast# " + +/* Print Buffer Size */ +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + +#define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/ram rw" + +#define CONFIG_AST_SPI_NOR /* AST SPI NOR Flash */ +#define CONFIG_FMC_CS 1 +#define CONFIG_SYS_MAX_FLASH_BANKS (CONFIG_FMC_CS) +#define CONFIG_SYS_MAX_FLASH_SECT (8192) /* max number of sectors on one chip */ +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_ENV_ADDR (AST_FMC_CS0_BASE + 0x60000) + +#define CONFIG_ENV_OFFSET 0x60000 /* environment starts here */ +#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ + +#define CONFIG_BOOTCOMMAND "bootm 20080000 20300000" +#define CONFIG_ENV_OVERWRITE + +#define ASPEED_ENV_SETTINGS \ + "verify=yes\0" \ + "spi_dma=yes\0" \ + "" + +#endif /* __AST_COMMON_CONFIG_H */ diff --git a/include/configs/ast-g4-ncsi.h b/include/configs/ast-g4-ncsi.h new file mode 100644 index 0000000000..8191dfcd39 --- /dev/null +++ b/include/configs/ast-g4-ncsi.h @@ -0,0 +1,29 @@ +/* + * Copyright 2016 IBM Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + */ + +#ifndef __AST_G4_NCSI_CONFIG_H +#define __AST_G4_NCSI_CONFIG_H + +#define CONFIG_ARCH_AST2400 +#define CONFIG_SYS_LOAD_ADDR 0x43000000 + +#define CONFIG_MISC_INIT_R + +#include + +/* Ethernet */ +#define CONFIG_LIB_RAND +#define CONFIG_ASPEEDNIC + +/* platform.S settings */ +#define CONFIG_CPU_420 1 +#define CONFIG_DRAM_528 1 + +#endif /* __AST_G4_NCSI_CONFIG_H */ diff --git a/include/configs/ast-g4-phy.h b/include/configs/ast-g4-phy.h new file mode 100644 index 0000000000..baa522ff55 --- /dev/null +++ b/include/configs/ast-g4-phy.h @@ -0,0 +1,31 @@ +/* + * Copyright 2016 IBM Corporation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + */ + +#ifndef __AST_G4_NCSI_CONFIG_H +#define __AST_G4_NCSI_CONFIG_H + +#define CONFIG_ARCH_AST2400 +#define CONFIG_SYS_LOAD_ADDR 0x43000000 + +#define CONFIG_MISC_INIT_R + +#include + +/* Ethernet */ +#define CONFIG_MAC_NUM 2 +#define CONFIG_FTGMAC100 +#define CONFIG_PHY_MAX_ADDR 32 +#define CONFIG_FTGMAC100_EGIGA + +/* platform.S settings */ +#define CONFIG_CPU_420 1 +#define CONFIG_DRAM_528 1 + +#endif /* __AST_G4_NCSI_CONFIG_H */ -- cgit v1.2.1