Compare commits

...

14 Commits

Author SHA1 Message Date
Tom Rini
35d11a515b Merge patch series "This series introduces initial U-Boot support for mach-axiado AX3005 SCM3005 board, a quad-core ARM Cortex-A53 (ARMv8/ARM64) platform."
Siu Ming Tong <smtong@axiado.com> says:

Patch 1 adds the device tree files: an SoC-level DTSI describing
GIC-v3, Cadence/Zynq UART, a fixed reference clock, and spin-table
secondary CPU boot, plus a board-level DTS setting the console to
uart3 at 115200 baud with 2 GB DRAM at 0x80000000.

Patch 2 adds mach-axiado to support Axiado SoC-based boards, Kconfig
plumbing (AXIADO_AX3005 and TARGET_SCM3005), defconfig, board source
with ft_board_setup() and a MAINTAINERS entry.

Tested on SCM3005 EVK hardware

Link: https://lore.kernel.org/r/20260527-review-v2-0-10daefddf47d@axiado.com
2026-06-10 14:52:36 -06:00
Siu Ming Tong
3f18211626 grm: axiado: Add AX3005 based SCM3005 board support
Introduce mach-axiado to support Axiado SoC-based boards. This adds
the platform Kconfig and build infrastructure, along with initial
SCM3005 board support using the AX3005 SoC.

Introduces AXIADO_AX3005, which selects ARM64, driver
model, GIC-v3, and Zynq UART. TARGET_SCM3005 selects ARCH_AXIADO,
allowing future SoC variants to share the platform configuration.
Secondary cores use spin-table boot. ft_board_setup() corrects
the cpu-release-addr in the FDT, which arch_fixup_fdt() overwrites
with the post-relocation address.
Add U-Boot board support for the Axiado AX3005 based targets, a quad-core
ARM Cortex-A53 (ARMv8) platform.

Tested-by: Siu Ming Tong <smtong@axiado.com>
Signed-off-by: Karthikeyan Mitran <kmitran@axiado.com>
Signed-off-by: Siu Ming Tong <smtong@axiado.com>
2026-06-10 14:52:25 -06:00
Siu Ming Tong
7a06f03e57 arm64: dts: axiado: Add AX3005 SCM3005 device tree
Add device tree source files for the Axiado AX3005 SCM3005 board.
The AX3005 is a quad-core 64-bit ARMv8 Cortex-A53 SoC.

The DTSI describes the SoC-level nodes: GIC-v3 interrupt controller,
Cadence/Zynq UART, fixed reference clock, and spin-table secondary
CPU boot.  A /memreserve/ directive protects the spin-table release
address at 0x80002fa0 from being overwritten during boot.

The SCM3005 DTS sets the console to uart3 at 115200 baud and declares
2 GB of DRAM starting at 0x80000000.

Tested-by: Siu Ming Tong <smtong@axiado.com>
Signed-off-by: Karthikeyan Mitran <kmitran@axiado.com>
Signed-off-by: Siu Ming Tong <smtong@axiado.com>
2026-06-10 14:52:25 -06:00
Marek Vasut
6064b4c152 MAINTAINERS: Replace ASpeed with N:
Use N: to match on all aspeed/ast2500 files, drop the large list of
entries which represent the same set of relevant files and miss a
few in the process.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2026-06-10 14:52:11 -06:00
Tom Rini
ca69cae993 Merge patch series "arm: aspeed: add initial AST2700 SoC support"
Ryan Chen <ryan_chen@aspeedtech.com> says:

AST2700 is the 8th generation of Integrated Remote Management
Processor introduced by ASPEED Technology Inc. It is a Board
Management Controller (BMC) SoC family with a dual-die architecture:
SoC0 ("CPU" die with four ARM Cortex-A35 application cores) and
SoC1 ("IO" die with peripherals) each SoC have its own SCU PLLs,
clock dividers and reset domains.

Link: https://lore.kernel.org/r/20260526-ast2700_clk-v3-0-a4cd24c214d6@aspeedtech.com
2026-06-10 14:50:30 -06:00
Ryan Chen
06285620f9 ram: aspeed: add SDRAM controller driver for AST2700
Add a SDRAM controller driver for the AST2700, derived from the
existing AST2700 controller code used by the Ibex SPL but adapted
to run from ARM U-Boot proper on the Cortex-A35 cores.

The DDR4/DDR5 controller and its DesignWare PHY are programmed by
the Ibex SPL before ARM U-Boot proper takes over. This driver
reads back the configuration left by the SPL, probes the
controller, and exposes ram_info (base and size, with the VGA
carve-out subtracted) via UCLASS_RAM so that dram_init() can
populate gd->ram_size.

The PHY firmware-load entry points (dwc_ddrphy_phyinit_userCustom_*)
are kept compiled but call a __weak fmc_hdr_get_prebuilt() stub
when ARM U-Boot proper is the caller; the real implementation is
provided by the Ibex SPL via the same fmc_hdr.h descriptor format
(here added for the ARM build).

Adds the supporting register-layout headers under
arch/arm/include/asm/arch-aspeed/:
  - sdram.h:   SDRAM controller and DWC PHY register definitions
  - scu.h:     SCU bits referenced by the SDRAM driver
  - fmc_hdr.h: prebuilt-blob descriptor (binary-compatible with
               arch/riscv/include/asm/arch-ast2700/fmc_hdr.h used
               by the Ibex SPL)

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
2026-06-10 14:50:19 -06:00
Ryan Chen
8e26f8fd83 reset: ast2700: add reset driver support
Add reset controller driver for the dual-die AST2700 SoC. The
controller manages module-level reset signals via the modrst
register block at offset 0x200 within each SCU.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
2026-06-10 14:50:19 -06:00
Ryan Chen
1c024f1d28 clk: ast2700: add clock driver support
Add clock controller driver for the dual-die AST2700 SoC. The chip
has two SCUs (SoC0/CPU at 0x12c02000, SoC1/IO at 0x14c02000), each
with its own PLLs (HPLL/APLL/DPLL/MPLL), clock dividers and clock
gate controls. This commit registers two UCLASS_CLK drivers
matching "aspeed,ast2700-scu0" and "aspeed,ast2700-scu1".

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
2026-06-10 14:50:19 -06:00
Ryan Chen
b75e49f89d arm: dts: aspeed: Add initial AST27xx SoC device tree
Add initial device tree support for the ASPEED AST27xx family, the
8th-generation Baseboard Management Controller (BMC) SoCs.

AST27xx SOC Family
 - https://www.aspeedtech.com/server_ast2700/
 - https://www.aspeedtech.com/server_ast2720/
 - https://www.aspeedtech.com/server_ast2750/

The AST27xx features a dual-SoC architecture consisting of two ties,
referred to as SoC0 and SoC1 - interconnected through an internal
property bus. Both SoCs share the same address decoding scheme,
while each maintains independent clock and reset domains.

- SoC0 (CPU die): contains a dual-core Cortex-A35 cluster and two
  Cortex-M4 cores, along with high-speed peripherals.
- SoC1 (I/O die): includes the BootMCU (responsible for system
  boot) and its own clock/reset domains low-speed peripherals.

The device tree describes the SoC0 and SoC1 domains and their peripheral
layouts.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
2026-06-10 14:50:19 -06:00
Ryan Chen
d999d38973 arm: aspeed: add ASPEED AST2700 SoC family support
Add initial support for the ASPEED AST2700, an arm64 (Cortex-A35)
Baseboard Management Controller (BMC) SoC. AST2700 is Aspeed's 8th
generation BMC and uses a dual-die architecture: SoC0 (the "CPU"
die) hosts the four Cortex-A35 cores and its own SCU at 0x12c02000,
while SoC1 (the "IO" die) hosts the peripherals and its own SCU at
0x14c02000.

This commit adds:
  - ASPEED_AST2700 Kconfig option and the ast2700 mach subdir
    (mach Makefile, ast2700/Kconfig, board/aspeed/evb_ast2700/*)
  - arm64 MMU map covering the SoC device window and the DRAM
    region at 0x4_0000_0000 (up to 8 GiB)
  - lowlevel_init.S for early CPU bring-up
  - cpu-info: print SoC ID (AST2700/2720/2750 A0/A1/A2 variants)
    and reset cause (cold reset, EXT reset, WDT reset)
  - board_common: dram_init via UCLASS_RAM, AHBC timeout init
  - platform: env_get_location() that selects SPI/eMMC based on
    the IO-die HW strap; arch_misc_init() that exposes
    ${boot_device} and ${verify} to the boot script
  - SCU0/SCU1 register layout header (scu_ast2700.h)
  - configs/evb-ast2700_defconfig and include/configs/evb_ast2700.h
    for the AST2700 EVB board

The defconfig depends on ast2700-evb.dts, which is introduced in
a subsequent patch; this commit must be applied with the
remaining series for evb-ast2700_defconfig to build.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
2026-06-10 14:50:19 -06:00
Torsten Duwe
4e249b94af clk: enhance clk-gpio to also handle gated-fixed-clock
Devicetree commit a198185b9b5 introduced a new type of clock,
"gated-fixed-clock", for which Das U-Boot does not have
a driver yet. The required code is similar to gpio-gate-clock,
and can be added using little extra text space.

Use this code e.g. to boot a Rock5 ITX from NVMe

Signed-off-by: Torsten Duwe <duwe@lst.de>
2026-06-10 14:50:00 -06:00
Emanuele Ghidoli
e65a87e959 serial: lpuart: Fix RX FIFO Enable bitmask
The Receive FIFO Enable (RXFE) field in the LPUART FIFO register is
bit 3 on all supported architectures. The define has been wrong since
it was introduced: for non-i.MX8/i.MXRT it set bit 6, which on LS102xA
is read-only-as-zero, so the bug went unnoticed.

NXP confirmed bit 3 is correct everywhere, so drop the ARCH-based
selection.

Link: 9498bcc514
Link: https://lore.kernel.org/u-boot/dc163ea7-9063-4dfb-a39a-e643c0bcccf1@oss.nxp.com/
Fixes: 6209e14cb0 ("serial: lpuart: add 32-bit registers lpuart support")
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
2026-06-10 14:49:55 -06:00
Aristo Chen
6c636eabbd treewide: prefer __func__ over __FUNCTION__ and __PRETTY_FUNCTION__
__FUNCTION__ and __PRETTY_FUNCTION__ are gcc extensions that predate
the C99 __func__ identifier. scripts/checkpatch.pl emits a warning
for any new use of __FUNCTION__ and recommends __func__ instead. In
C (unlike C++) __PRETTY_FUNCTION__ is identical to __func__ because
C function names do not carry signature information, so the
distinction has no behavioural effect here. The majority of the tree
already uses __func__, but a handful of older files in arch/, board/,
boot/, drivers/, examples/ and include/ still carry the gcc spellings
(55 occurrences of __FUNCTION__ across 19 files plus one
__PRETTY_FUNCTION__ in drivers/usb/musb-new/omap2430.c). Convert
them all to the C99 form so the tree is consistent and new patches
in these areas do not have to follow an outdated local style.

Ten "Unnecessary ftrace-like logging - prefer using ftrace" warnings
remain on the printf("%s\n", __func__) and dbg("%s\n", __func__)
function-entry traces in drivers/net/rtl8169.c (behind DEBUG_RTL8169*
preprocessor guards) and drivers/usb/host/ohci-hcd.c. checkpatch
matches the literal "%s\n", __func__ shape regardless of the wrapper,
so silencing those warnings would require changing the debug message
text or removing the traces entirely.

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2026-06-10 14:49:46 -06:00
Weijie Gao
1cc0442ede bootmenu: fix incorrect menu quitting logic
The last entry of bootmenu is always set for exiting the menu, and its
command is set to an empty string.

When user selects to quit the menu, bootmenu will try to run this empty
command. However run_command() with empty cmd string will return failure,
and the return value will be overridden to BOOTMENU_RET_FAIL, not the
expected BOOTMENU_RET_QUIT.

This patch adds a default success value to the cmd_ret variable, and makes
sure run_command() is called only when the menu command is not empty.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2026-06-10 14:49:43 -06:00
67 changed files with 3985 additions and 91 deletions

View File

@@ -208,22 +208,23 @@ M: Chia-Wei Wang <chiawei_wang@aspeedtech.com>
R: Aspeed BMC SW team <BMC-SW@aspeedtech.com>
R: Joel Stanley <joel@jms.id.au>
S: Maintained
F: arch/arm/mach-aspeed/
F: arch/arm/include/asm/arch-aspeed/
F: board/aspeed/
F: drivers/clk/aspeed/
F: drivers/crypto/aspeed/
F: drivers/gpio/gpio-aspeed.c
F: drivers/i2c/ast_i2c.[ch]
F: drivers/mmc/aspeed_sdhci.c
F: drivers/net/aspeed_mdio.c
F: drivers/net/ftgmac100.[ch]
F: drivers/pinctrl/aspeed/
F: drivers/pwm/pwm-aspeed.c
F: drivers/ram/aspeed/
F: drivers/reset/reset-ast2500.c
F: drivers/watchdog/ast_wdt.c
N: aspeed
N: ast2500
N: ast2700
ARM AXIADO AX3005 SCM3005
M: Siu Ming Tong <smtong@axiado.com>
M: Karthikeyan Mitran <kmitran@axiado.com>
M: Prasad Bolisetty <pbolisetty@axiado.com>
S: Maintained
F: arch/arm/dts/ax3005*
F: arch/arm/mach-axiado/
F: board/axiado/scm3005/
F: configs/ax3005_scm3005_defconfig
F: include/configs/ax3005-scm3005.h
ARM BROADCOM BCM283X / BCM27XX
M: Matthias Brugger <mbrugger@suse.com>

View File

@@ -2153,6 +2153,13 @@ config ARCH_ASPEED
select OF_CONTROL
imply CMD_DM
config ARCH_AXIADO
bool "Support Axiado SoCs"
select AXIADO_AX3005
help
Support for Axiado AX-series SoCs such as the AX3005.
These ARM64 SoCs are used in BMC and security applications.
config TARGET_DURIAN
bool "Support Phytium Durian Platform"
select ARM64
@@ -2294,6 +2301,8 @@ source "arch/arm/mach-aspeed/Kconfig"
source "arch/arm/mach-at91/Kconfig"
source "arch/arm/mach-axiado/Kconfig"
source "arch/arm/mach-bcm283x/Kconfig"
source "arch/arm/mach-bcmbca/Kconfig"

View File

@@ -4,6 +4,7 @@ dtb-$(CONFIG_TARGET_SMARTWEB) += at91sam9260-smartweb.dtb
dtb-$(CONFIG_TARGET_TAURUS) += at91sam9g20-taurus.dtb
dtb-$(CONFIG_TARGET_CORVUS) += at91sam9g45-corvus.dtb
dtb-$(CONFIG_TARGET_GURNARD) += at91sam9g45-gurnard.dtb
dtb-$(CONFIG_TARGET_SCM3005) += ax3005-scm3005.dtb
dtb-$(CONFIG_TARGET_SMDKC100) += s5pc1xx-smdkc100.dtb
dtb-$(CONFIG_TARGET_S5P_GONI) += s5pc1xx-goni.dtb
@@ -1043,6 +1044,8 @@ dtb-$(CONFIG_ASPEED_AST2600) += \
ast2600-evb.dtb \
ast2600-sbp1.dtb \
ast2600-x4tf.dtb
dtb-$(CONFIG_ASPEED_AST2700) += \
ast2700-evb.dtb
dtb-$(CONFIG_STM32MP15X) += \
stm32mp157c-odyssey.dtb

View File

@@ -0,0 +1,88 @@
// SPDX-License-Identifier: GPL-2.0+
/dts-v1/;
#include "ast2700.dtsi"
#include "ast2700-u-boot.dtsi"
/ {
model = "AST2700 EVB";
compatible = "aspeed,ast2700-evb", "aspeed,ast2700";
memory {
device_type = "memory";
reg = <0x4 0x00000000 0x0 0x20000000>;
};
chosen {
stdout-path = &uart12;
};
};
&uart12 {
status = "okay";
};
&mdio0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
ethphy0: ethernet-phy@0 {
reg = <0>;
};
};
&mdio1 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
ethphy1: ethernet-phy@0 {
reg = <0>;
};
};
&mac0 {
status = "okay";
phy-mode = "rgmii-id";
phy-handle = <&ethphy0>;
rx-internal-delay-ps = <0>;
tx-internal-delay-ps = <0>;
};
&mac1 {
status = "okay";
phy-mode = "rgmii-id";
phy-handle = <&ethphy1>;
rx-internal-delay-ps = <0>;
tx-internal-delay-ps = <0>;
};
&fmc {
status = "okay";
flash@0 {
status = "okay";
spi-max-frequency = <50000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
};
flash@1 {
status = "okay";
spi-max-frequency = <50000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
};
flash@2 {
status = "okay";
spi-max-frequency = <50000000>;
spi-tx-bus-width = <4>;
spi-rx-bus-width = <4>;
};
};
&wdt0 {
status = "okay";
};

View File

@@ -0,0 +1,25 @@
// SPDX-License-Identifier: GPL-2.0+
&soc0 {
bootph-all;
};
&sdrammc {
bootph-all;
};
&syscon0 {
bootph-all;
};
&uart12 {
bootph-all;
};
&soc1 {
bootph-all;
};
&syscon1 {
bootph-all;
};

693
arch/arm/dts/ast2700.dtsi Normal file
View File

@@ -0,0 +1,693 @@
// SPDX-License-Identifier: GPL-2.0+
#include <dt-bindings/clock/aspeed,ast2700-scu.h>
#include <dt-bindings/gpio/aspeed-gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/phy/phy.h>
#include <dt-bindings/reset/aspeed,ast2700-scu.h>
/ {
model = "Aspeed BMC";
compatible = "aspeed,ast2700";
interrupt-parent = <&gic>;
#address-cells = <2>;
#size-cells = <2>;
aliases {
serial0 = &uart0;
serial1 = &uart1;
serial2 = &uart2;
serial3 = &uart3;
serial4 = &uart4;
serial5 = &uart5;
serial6 = &uart6;
serial7 = &uart7;
serial8 = &uart8;
serial9 = &uart9;
serial10 = &uart10;
serial11 = &uart11;
serial12 = &uart12;
mmc0 = &emmc;
mmc1 = &sdhci;
ethernet0 = &mac0;
ethernet1 = &mac1;
ethernet2 = &mac2;
};
cpus {
#address-cells = <2>;
#size-cells = <0>;
cpu@0 {
device_type = "cpu";
compatible = "arm,cortex-a35";
reg = <0x0 0x0>;
enable-method = "psci";
next-level-cache = <&l2>;
};
cpu@1 {
device_type = "cpu";
compatible = "arm,cortex-a35";
reg = <0x0 0x1>;
enable-method = "psci";
next-level-cache = <&l2>;
};
cpu@2 {
device_type = "cpu";
compatible = "arm,cortex-a35";
reg = <0x0 0x2>;
enable-method = "psci";
next-level-cache = <&l2>;
};
cpu@3 {
device_type = "cpu";
compatible = "arm,cortex-a35";
reg = <0x0 0x3>;
enable-method = "psci";
next-level-cache = <&l2>;
};
l2: l2-cache0 {
compatible = "cache";
};
};
arm-pmu {
compatible = "arm,cortex-a35-pmu";
interrupts = <GIC_PPI 7 IRQ_TYPE_LEVEL_HIGH>;
};
timer {
compatible = "arm,armv8-timer";
interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
<GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
<GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
<GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
};
gic: interrupt-controller@12200000 {
compatible = "arm,gic-v3";
reg = <0 0x12200000 0 0x10000>, /* GICD */
<0 0x12280000 0 0x80000>, /* GICR */
<0 0x40440000 0 0x1000>; /* GICC */
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
#interrupt-cells = <3>;
interrupt-controller;
};
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
atf: trusted-firmware-a@430000000 {
reg = <0x4 0x30000000 0x0 0x80000>;
no-map;
};
optee_core: optee-core@430080000 {
reg = <0x4 0x30080000 0x0 0x1000000>;
no-map;
};
};
soc0: soc@10000000 {
compatible = "simple-bus";
#address-cells = <2>;
#size-cells = <2>;
ranges = <0x0 0x10000000 0x0 0x10000000 0x0 0x4000000>;
uhci0: usb@12040000 {
compatible = "aspeed,ast2700-uhci", "generic-uhci";
reg = <0x0 0x12040000 0x0 0x100>;
#ports = <2>;
clocks = <&syscon0 SCU0_CLK_GATE_UHCICLK>;
resets = <&syscon0 SCU0_RESET_UHCI>;
status = "disabled";
};
ehci0: usb@12061000 {
compatible = "aspeed,ast2700-ehci", "generic-ehci";
reg = <0x0 0x12061000 0x0 0x100>;
clocks = <&syscon0 SCU0_CLK_GATE_PORTAUSB2CLK>;
resets = <&syscon0 SCU0_RESET_PORTA_VHUB_EHCI>;
status = "disabled";
};
vhuba0: usb-vhub@12060000 {
compatible = "aspeed,ast2700-usb-vhuba0";
reg = <0 0x12060000 0 0x350>;
clocks = <&syscon0 SCU0_CLK_GATE_PORTAUSB2CLK>;
resets = <&syscon0 SCU0_RESET_PORTA_VHUB_EHCI>;
status = "disabled";
};
vhubb0: usb-vhub@12062000 {
compatible = "aspeed,ast2700-usb-vhubb0";
reg = <0x0 0x12062000 0x0 0x350>;
clocks = <&syscon0 SCU0_CLK_GATE_PORTBUSB2CLK>;
resets = <&syscon0 SCU0_RESET_PORTB_VHUB_EHCI>;
status = "disabled";
};
ehci1: usb@12063000 {
compatible = "aspeed,ast2700-ehci", "generic-ehci";
reg = <0x0 0x12063000 0x0 0x100>;
clocks = <&syscon0 SCU0_CLK_GATE_PORTBUSB2CLK>;
resets = <&syscon0 SCU0_RESET_PORTB_VHUB_EHCI>;
status = "disabled";
};
emmc_controller: sdc@12090000 {
compatible = "aspeed,ast2700-sd-controller";
reg = <0 0x12090000 0 0x100>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0x0 0x0 0x12090000 0x10000>;
clocks = <&syscon0 SCU0_CLK_GATE_EMMCCLK>;
resets = <&syscon0 SCU0_RESET_EMMC>;
status = "disable";
emmc: sdhci@100 {
compatible = "aspeed,ast2700-sdhci";
reg = <0x100 0x100>;
sdhci,auto-cmd12;
clocks = <&syscon0 SCU0_CLK_GATE_EMMCCLK>;
status = "disable";
};
};
intc0: interrupt-controller@12100000 {
compatible = "aspeed,ast2700-intc0";
reg = <0x0 0x12100000 0x0 0x3c00>;
interrupt-controller;
interrupt-parent = <&gic>;
#interrupt-cells = <1>;
};
sdrammc: sdrammc@12c00000 {
compatible = "aspeed,ast2700-sdrammc";
reg = <0 0x12c00000 0 0x3000 0 0x13000000 0 0x300 >;
clocks = <&syscon0 SCU0_CLK_MPLL>;
resets = <&syscon0 SCU0_RESET_SDRAM>;
aspeed,scu0 = <&syscon0>;
aspeed,scu1 = <&syscon1>;
};
syscon0: syscon@12c02000 {
compatible = "aspeed,ast2700-scu0", "syscon", "simple-mfd";
reg = <0x0 0x12c02000 0x0 0x1000>;
ranges = <0x0 0x0 0x12c02000 0x1000>;
#address-cells = <1>;
#size-cells = <1>;
#clock-cells = <1>;
#reset-cells = <1>;
pinctrl0: pinctrl@400 {
compatible = "aspeed,ast2700-soc0-pinctrl";
reg = <0x400 0x318>;
};
};
gpio0: gpio@12c11000 {
compatible = "aspeed,ast2700-gpio";
reg = <0x0 0x12c11000 0x0 0x1000>;
gpio-ranges = <&pinctrl0 0 0 12>;
ngpios = <12>;
clocks = <&syscon0 SCU0_CLK_APB>;
};
uart4: serial@12c1a000 {
compatible = "ns16550a";
reg = <0x0 0x12c1a000 0x0 0x1000>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon0 SCU0_CLK_GATE_UART4CLK>;
no-loopback-test;
status = "disabled";
};
mbox0: mbox@12c1c200 {
compatible = "aspeed,ast2700-mailbox";
reg = <0x0 0x12c1c200 0x0 0x100>, <0x0 0x12c1c300 0x0 0x100>;
reg-names = "tx", "rx";
#mbox-cells = <1>;
};
mbox1: mbox@12c1c600 {
compatible = "aspeed,ast2700-mailbox";
reg = <0x0 0x12c1c600 0x0 0x100>, <0x0 0x12c1c700 0x0 0x100>;
reg-names = "tx", "rx";
#mbox-cells = <1>;
};
};
soc1: soc@14000000 {
compatible = "simple-bus";
#address-cells = <2>;
#size-cells = <2>;
ranges = <0x0 0x14000000 0x0 0x14000000 0x2 0xec000000>;
fmc: spi@14000000 {
reg = <0x0 0x14000000 0x0 0xc4>, <0x1 0x00000000 0x0 0x80000000>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "aspeed,ast2700-fmc";
status = "disabled";
clocks = <&syscon1 SCU1_CLK_AHB>;
num-cs = <3>;
flash@0 {
reg = <0>;
compatible = "jedec,spi-nor";
status = "disabled";
};
flash@1 {
reg = <1>;
compatible = "jedec,spi-nor";
status = "disabled";
};
flash@2 {
reg = <2>;
compatible = "jedec,spi-nor";
status = "disabled";
};
};
spi0: spi@14010000 {
reg = <0x0 0x14010000 0x0 0xc4>, <0x1 0x80000000 0x0 0x80000000>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "aspeed,ast2700-spi";
status = "disabled";
clocks = <&syscon1 SCU1_CLK_AHB>;
num-cs = <2>;
flash@0 {
reg = <0>;
compatible = "jedec,spi-nor";
status = "disabled";
};
flash@1 {
reg = <1>;
compatible = "jedec,spi-nor";
status = "disabled";
};
};
spi1: spi@14020000 {
reg = <0x0 0x14020000 0x0 0xc4>, <0x2 0x00000000 0x0 0x80000000>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "aspeed,ast2700-spi";
status = "disabled";
clocks = <&syscon1 SCU1_CLK_AHB>;
num-cs = <2>;
flash@0 {
reg = <0>;
compatible = "jedec,spi-nor";
status = "disabled";
};
flash@1 {
reg = <1>;
compatible = "jedec,spi-nor";
status = "disabled";
};
};
spi2: spi@14030000 {
reg = <0x0 0x14030000 0x0 0xc4>, <0x2 0x80000000 0x0 0x80000000>;
#address-cells = <1>;
#size-cells = <0>;
compatible = "aspeed,ast2700-spi";
status = "disabled";
clocks = <&syscon1 SCU1_CLK_AHB>;
resets = <&syscon1 SCU1_RESET_SPI2>;
num-cs = <2>;
flash@0 {
reg = <0>;
compatible = "jedec,spi-nor";
status = "disabled";
};
flash@1 {
reg = <1>;
compatible = "jedec,spi-nor";
status = "disabled";
};
};
mdio0: mdio@14040000 {
compatible = "aspeed,ast2700-mdio";
reg = <0 0x14040000 0 0x8>;
resets = <&syscon1 SCU1_RESET_MII>;
status = "disabled";
};
mdio1: mdio@14040008 {
compatible = "aspeed,ast2700-mdio";
reg = <0 0x14040008 0 0x8>;
resets = <&syscon1 SCU1_RESET_MII>;
status = "disabled";
};
mdio2: mdio@14040010 {
compatible = "aspeed,ast2700-mdio";
reg = <0 0x14040010 0 0x8>;
resets = <&syscon1 SCU1_RESET_MII>;
status = "disabled";
};
mac0: ftgmac@14050000 {
compatible = "aspeed,ast2700-mac", "faraday,ftgmac100";
reg = <0x0 0x14050000 0x0 0x200>;
clocks = <&syscon1 SCU1_CLK_GATE_MAC0CLK>;
resets = <&syscon1 SCU1_RESET_MAC0>;
status = "disabled";
};
mac1: ftgmac@14060000 {
compatible = "aspeed,ast2700-mac", "faraday,ftgmac100";
reg = <0x0 0x14060000 0x0 0x200>;
clocks = <&syscon1 SCU1_CLK_GATE_MAC1CLK>;
resets = <&syscon1 SCU1_RESET_MAC1>;
status = "disabled";
};
mac2: ftgmac@14070000 {
compatible = "aspeed,ast2700-mac", "faraday,ftgmac100";
reg = <0x0 0x14070000 0x0 0x200>;
clocks = <&syscon1 SCU1_CLK_GATE_MAC2CLK>;
resets = <&syscon1 SCU1_RESET_MAC2>;
status = "disabled";
};
sdio_controller: sdc@14080000 {
compatible = "aspeed,ast2700-sd-controller";
reg = <0 0x14080000 0 0x100>;
#address-cells = <1>;
#size-cells = <1>;
clocks = <&syscon1 SCU1_CLK_GATE_SDCLK>;
resets = <&syscon1 SCU1_RESET_SD>;
ranges = <0 0 0x14080000 0x10000>;
status = "disable";
sdhci: sdhci@100 {
compatible = "aspeed,ast2700-sdhci";
reg = <0x100 0x100>;
sdhci,auto-cmd12;
clocks = <&syscon1 SCU1_CLK_GATE_SDCLK>;
};
};
uhci1: usb@14110000 {
compatible = "aspeed,ast2700-uhci", "generic-uhci";
reg = <0x0 0x14110000 0x0 0x100>;
#ports = <2>;
clocks = <&syscon1 SCU1_CLK_GATE_UHCICLK>;
resets = <&syscon1 SCU1_RESET_UHCI>;
status = "disabled";
};
vhubc: usb-vhub@14120000 {
compatible = "aspeed,ast2700-usb-vhub";
reg = <0x0 0x14120000 0x0 0x820>;
clocks = <&syscon1 SCU1_CLK_GATE_PORTCUSB2CLK>;
resets = <&syscon1 SCU1_RESET_PORTC_VHUB_EHCI>;
aspeed,vhub-downstream-ports = <7>;
aspeed,vhub-generic-endpoints = <21>;
status = "disabled";
};
ehci2: usb@14121000 {
compatible = "aspeed,ast2700-ehci", "generic-ehci";
reg = <0x0 0x14121000 0x0 0x100>;
clocks = <&syscon1 SCU1_CLK_GATE_PORTCUSB2CLK>;
resets = <&syscon1 SCU1_RESET_PORTC_VHUB_EHCI>;
status = "disabled";
};
vhubd: usb-vhub@14122000 {
compatible = "aspeed,ast2700-usb-vhub";
reg = <0x0 0x14122000 0x0 0x820>;
clocks = <&syscon1 SCU1_CLK_GATE_PORTDUSB2CLK>;
resets = <&syscon1 SCU1_RESET_PORTD_VHUB_EHCI>;
aspeed,vhub-downstream-ports = <7>;
aspeed,vhub-generic-endpoints = <21>;
status = "disabled";
};
ehci3: usb@14123000 {
compatible = "aspeed,ast2700-ehci", "generic-ehci";
reg = <0x0 0x14123000 0x0 0x100>;
clocks = <&syscon1 SCU1_CLK_GATE_PORTDUSB2CLK>;
resets = <&syscon1 SCU1_RESET_PORTD_VHUB_EHCI>;
status = "disabled";
};
syscon1: syscon@14c02000 {
compatible = "aspeed,ast2700-scu1", "syscon", "simple-mfd";
reg = <0x0 0x14c02000 0x0 0x1000>;
ranges = <0x0 0x0 0x14c02000 0x1000>;
#address-cells = <1>;
#size-cells = <1>;
#clock-cells = <1>;
#reset-cells = <1>;
pinctrl1: pinctrl@400 {
compatible = "aspeed,ast2700-soc1-pinctrl";
reg = <0x400 0x2a0>;
};
};
gpio1: gpio@14c0b000 {
compatible = "aspeed,ast2700-gpio";
reg = <0x0 0x14c0b000 0x0 0x1000>;
#gpio-cells = <2>;
gpio-controller;
gpio-ranges = <&pinctrl1 0 0 216>;
ngpios = <216>;
clocks = <&syscon1 SCU1_CLK_AHB>;
};
intc1: interrupt-controller@14c18000 {
compatible = "aspeed,ast2700-intc1";
reg = <0 0x14c18000 0 0x400>;
interrupt-controller;
interrupt-parent = <&intc0>;
#interrupt-cells = <1>;
};
uart0: serial@14c33000 {
compatible = "ns16550a";
reg = <0x0 0x14c33000 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART0CLK>;
no-loopback-test;
status = "disabled";
};
uart1: serial@14c33100 {
compatible = "ns16550a";
reg = <0x0 0x14c33100 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART1CLK>;
no-loopback-test;
status = "disabled";
};
uart2: serial@14c33200 {
compatible = "ns16550a";
reg = <0x0 0x14c33200 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART2CLK>;
no-loopback-test;
status = "disabled";
};
uart3: serial@14c33300 {
compatible = "ns16550a";
reg = <0x0 0x14c33300 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART3CLK>;
no-loopback-test;
status = "disabled";
};
uart5: serial@14c33400 {
compatible = "ns16550a";
reg = <0x0 0x14c33400 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART5CLK>;
no-loopback-test;
status = "disabled";
};
uart6: serial@14c33500 {
compatible = "ns16550a";
reg = <0x0 0x14c33500 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART6CLK>;
no-loopback-test;
status = "disabled";
};
uart7: serial@14c33600 {
compatible = "ns16550a";
reg = <0x0 0x14c33600 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART7CLK>;
no-loopback-test;
status = "disabled";
};
uart8: serial@14c33700 {
compatible = "ns16550a";
reg = <0x0 0x14c33700 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART8CLK>;
no-loopback-test;
status = "disabled";
};
uart9: serial@14c33800 {
compatible = "ns16550a";
reg = <0x0 0x14c33800 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART9CLK>;
no-loopback-test;
status = "disabled";
};
uart10: serial@14c33900 {
compatible = "ns16550a";
reg = <0x0 0x14c33900 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART10CLK>;
no-loopback-test;
status = "disabled";
};
uart11: serial@14c33a00 {
compatible = "ns16550a";
reg = <0x0 0x14c33a00 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART11CLK>;
no-loopback-test;
status = "disabled";
};
uart12: serial@14c33b00 {
compatible = "ns16550a";
reg = <0x0 0x14c33b00 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_GATE_UART12CLK>;
clock-frequency = <1846154>;
no-loopback-test;
status = "disabled";
};
uart13: serial@14c33c00 {
compatible = "ns16550a";
reg = <0x0 0x14c33c00 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_UART13>;
no-loopback-test;
status = "disabled";
};
uart14: serial@14c33d00 {
compatible = "ns16550a";
reg = <0x0 0x14c33d00 0x0 0x100>;
reg-shift = <2>;
reg-io-width = <4>;
clocks = <&syscon1 SCU1_CLK_UART14>;
no-loopback-test;
status = "disabled";
};
wdt0: watchdog@14c37000 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37000 0x0 0x80>;
status = "disabled";
};
wdt1: watchdog@14c37080 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37080 0x0 0x80>;
status = "disabled";
};
wdt2: watchdog@14c37100 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37100 0x0 0x80>;
status = "disabled";
};
wdt3: watchdog@14c37180 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37180 0x0 0x80>;
status = "disabled";
};
wdt4: watchdog@14c37200 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37200 0x0 0x80>;
status = "disabled";
};
wdt5: watchdog@14c37280 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37280 0x0 0x80>;
status = "disabled";
};
wdt6: watchdog@14c37300 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37300 0x0 0x80>;
status = "disabled";
};
wdt7: watchdog@14c37380 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37380 0x0 0x80>;
status = "disabled";
};
wdt_abr: watchdog@14c37400 {
compatible = "aspeed,ast2700-wdt";
reg = <0x0 0x14c37400 0x0 0x80>;
status = "disabled";
};
mbox2: mbox@14c39200 {
compatible = "aspeed,ast2700-mailbox";
reg = <0x0 0x14c39200 0x0 0x100>, <0x0 0x14c39300 0x0 0x100>;
reg-names = "tx", "rx";
#mbox-cells = <1>;
};
};
};

View File

@@ -0,0 +1,28 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2021-2026 Axiado Corporation (or its affiliates).
*/
/dts-v1/;
#include "ax3005.dtsi"
/ {
model = "Axiado AX3005 SCM3005";
compatible = "axiado,ax3005-scm3005", "axiado,ax3005";
#address-cells = <2>;
#size-cells = <2>;
chosen {
stdout-path = "serial3:115200";
};
memory@80000000 {
device_type = "memory";
reg = <0x00 0x80000000 0x00 0x80000000>;
};
};
&uart3 {
status = "okay";
};

100
arch/arm/dts/ax3005.dtsi Normal file
View File

@@ -0,0 +1,100 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2021-2026 Axiado Corporation (or its affiliates).
*/
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
/memreserve/ 0x80002fa0 0x00000008;
/ {
aliases {
serial3 = &uart3;
};
cpus {
#address-cells = <2>;
#size-cells = <0>;
cpu0: cpu@0 {
compatible = "arm,cortex-a53";
device_type = "cpu";
reg = <0x0 0x0>;
enable-method = "spin-table";
cpu-release-addr = <0x0 0x80002fa0>;
};
cpu1: cpu@1 {
compatible = "arm,cortex-a53";
device_type = "cpu";
reg = <0x0 0x1>;
enable-method = "spin-table";
cpu-release-addr = <0x0 0x80002fa0>;
};
cpu2: cpu@2 {
compatible = "arm,cortex-a53";
device_type = "cpu";
reg = <0x0 0x2>;
enable-method = "spin-table";
cpu-release-addr = <0x0 0x80002fa0>;
};
cpu3: cpu@3 {
compatible = "arm,cortex-a53";
device_type = "cpu";
reg = <0x0 0x3>;
enable-method = "spin-table";
cpu-release-addr = <0x0 0x80002fa0>;
};
};
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <&gic500>;
interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
<GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
<GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
<GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
clock-frequency = <1000000000>;
};
clocks {
refclk: refclk {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <125000000>;
bootph-pre-reloc;
};
};
soc: soc {
compatible = "simple-bus";
#address-cells = <2>;
#size-cells = <2>;
interrupt-parent = <&gic500>;
ranges;
gic500: interrupt-controller@40400000 {
compatible = "arm,gic-v3";
#address-cells = <2>;
#size-cells = <2>;
ranges;
#interrupt-cells = <3>;
interrupt-controller;
#redistributor-regions = <1>;
reg = <0x00 0x40400000 0x00 0x10000>,
<0x00 0x40500000 0x00 0xc0000>;
interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
};
uart3: serial@33020800 {
compatible = "cdns,uart-r1p12", "xlnx,xuartps";
interrupt-parent = <&gic500>;
interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>;
reg = <0x00 0x33020800 0x00 0x100>;
clock-names = "uart_clk", "pclk";
clocks = <&refclk &refclk>;
bootph-pre-reloc;
status = "disabled";
};
};
};

View File

@@ -0,0 +1,52 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) ASPEED Technology Inc.
*/
#ifndef __ASM_AST2700_FMC_HDR_H__
#define __ASM_AST2700_FMC_HDR_H__
#include <linux/types.h>
#define HDR_MAGIC 0x48545341 /* ASTH */
#define HDR_PB_MAX 30
enum prebuilt_type {
PBT_END_MARK = 0x0,
PBT_DDR4_PMU_TRAIN_IMEM,
PBT_DDR4_PMU_TRAIN_DMEM,
PBT_DDR4_2D_PMU_TRAIN_IMEM,
PBT_DDR4_2D_PMU_TRAIN_DMEM,
PBT_DDR5_PMU_TRAIN_IMEM,
PBT_DDR5_PMU_TRAIN_DMEM,
PBT_DP_FW,
PBT_UEFI_X64_AST2700,
PBT_NUM
};
struct fmc_hdr_preamble {
u32 magic;
u32 version;
};
struct fmc_hdr_body {
u32 fmc_size;
union {
struct {
u32 type;
u32 size;
} pbs[0];
u32 raz[29];
};
};
struct fmc_hdr {
struct fmc_hdr_preamble preamble;
struct fmc_hdr_body body;
} __packed;
int fmc_hdr_get_prebuilt(u32 type, u32 *ofst, u32 *size);
#endif

View File

@@ -18,8 +18,36 @@
#define ASPEED_DRAM_BASE 0x80000000
#define ASPEED_SRAM_BASE 0x10000000
#define ASPEED_SRAM_SIZE 0x16000
#elif defined(CONFIG_ASPEED_AST2700)
#define ASPEED_CPU_AHBC_BASE 0x12000000
#define ASPEED_CPU_REVISION_ID 0x12C02000
#define ASPEED_CPU_SCU_BASE 0x12C02000
#define ASPEED_CPU_HW_STRAP1 0x12C02010
#define ASPEED_CPU_RESET_LOG1 0x12C02050
#define ASPEED_CPU_RESET_LOG2 0x12C02060
#define ASPEED_CPU_RESET_LOG3 0x12C02070
#define ASPEED_MAC_COUNT 3
#define ASPEED_DRAM_BASE 0x400000000
#define ASPEED_SRAM_BASE 0x10000000
#define ASPEED_SRAM_SIZE 0x20000
#define ASPEED_FMC_REG_BASE 0x14000000
#define ASPEED_FMC_CS0_BASE 0x100000000
#define ASPEED_FMC_CS0_SIZE 0x80000000
#define ASPEED_IO_MAC0_BASE 0x14050000
#define ASPEED_IO_MAC1_BASE 0x14060000
#define ASPEED_IO_AHBC_BASE 0x140b0000
#define ASPEED_IO_REVISION_ID 0x14C02000
#define CHIP_AST2700A1_ID_MASK BIT(16)
#define ASPEED_IO_SCU_BASE 0x14C02000
#define ASPEED_IO_HW_STRAP1 0x14C02010
#define ASPEED_IO_RESET_LOG1 0x14C02050
#define ASPEED_IO_RESET_LOG2 0x14C02060
#define ASPEED_IO_RESET_LOG3 0x14C02070
#define ASPEED_IO_RESET_LOG4 0x14C02080
#define ASPEED_IO_GPIO_BASE 0x14C0B000
#define ASPEED_WDTA_BASE 0x14C37400
#else
#err "Unrecognized Aspeed platform."
#error "Unrecognized Aspeed platform."
#endif
#endif

View File

@@ -0,0 +1,145 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) Aspeed Technology Inc.
*/
#ifndef __ASM_AST2700_SCU_H__
#define __ASM_AST2700_SCU_H__
/* SCU0: CPU-die SCU */
#define SCU0_HWSTRAP 0x010
#define SCU0_HWSTRAP_DIS_RVAS BIT(30)
#define SCU0_HWSTRAP_DIS_WDTFULL BIT(25)
#define SCU0_HWSTRAP_DISARMICE_TZ BIT(22)
#define SCU0_HWSTRAP_DISABLE_XHCI BIT(21)
#define SCU0_HWSTRAP_BOOTEMMCSPEED BIT(20)
#define SCU0_HWSTRAP_VGA_CC BIT(18)
#define SCU0_HWSTRAP_EN_OPROM BIT(17)
#define SCU0_HWSTRAP_DISARMICE BIT(16)
#define SCU0_HWSTRAP_TSPRSNTSEL BIT(9)
#define SCU0_HWSTRAP_DISDEBUG BIT(8)
#define SCU0_HWSTRAP_HCLKHPLL BIT(7)
#define SCU0_HWSTRAP_HCLKSEL GENMASK(6, 5)
#define SCU0_HWSTRAP_CPUHPLL BIT(4)
#define SCU0_HWSTRAP_HPLLFREQ GENMASK(3, 2)
#define SCU0_HWSTRAP_BOOTSPI BIT(1)
#define SCU0_HWSTRAP_HWSTRAP_DISCPU BIT(0)
#define SCU0_DBGCTL 0x0c8
#define SCU0_DBGCTL_MASK GENMASK(14, 0)
#define SCU0_DBGCTL_UARTDBG BIT(1)
#define SCU0_RSTCTL1 0x200
#define SCU0_RSTCTL1_EMMC BIT(17)
#define SCU0_RSTCTL1_HACE BIT(4)
#define SCU0_RSTCTL1_CLR 0x204
#define SCU0_RSTCTL1_CLR_EMMC BIT(17)
#define SCU0_RSTCTL1_CLR_HACE BIT(4)
#define SCU0_CLKGATE1 0x240
#define SCU0_CLKGATE1_EMMC BIT(27)
#define SCU0_CLKGATE1_HACE BIT(13)
#define SCU0_CLKGATE1_DDRPHY BIT(11)
#define SCU0_CLKGATE1_CLR 0x244
#define SCU0_CLKGATE1_CLR_EMMC BIT(27)
#define SCU0_CLKGATE1_CLR_HACE BIT(13)
#define SCU0_CLKGATE1_CLR_DDRPHY BIT(11)
#define SCU0_VGA0_SCRATCH 0x900
#define SCU0_VGA0_SCRATCH_DRAM_INIT BIT(6)
#define SCU0_PCI_MISC70 0xa70
#define SCU0_PCI_MISC70_EN_PCIEXHCI0 BIT(3)
#define SCU0_PCI_MISC70_EN_PCIEEHCI0 BIT(2)
#define SCU0_PCI_MISC70_EN_PCIEVGA0 BIT(0)
#define SCU0_PCI_MISC80 0xa80
#define SCU0_PCI_MISC80_EN_PCIEXHCI1 BIT(3)
#define SCU0_PCI_MISC80_EN_PCIEEHCI1 BIT(2)
#define SCU0_PCI_MISC80_EN_PCIEVGA1 BIT(0)
#define SCU0_PCI_MISCF0 0xaf0
#define SCU0_PCI_MISCF0_EN_PCIEXHCI1 BIT(3)
#define SCU0_PCI_MISCF0_EN_PCIEEHCI1 BIT(2)
#define SCU0_PCI_MISCF0_EN_PCIEVGA1 BIT(0)
#define SCU0_WPROT1 0xe04
#define SCU0_WPROT1_0C8 BIT(18)
/* SCU1: IO-die SCU */
#define SCU1_REVISION 0x000
#define SCU1_REVISION_HWID GENMASK(23, 16)
#define SCU1_REVISION_CHIP_EFUSE GENMASK(15, 8)
#define SCU1_HWSTRAP1 0x010
#define SCU1_HWSTRAP1_DIS_CPTRA BIT(30)
#define SCU1_HWSTRAP1_RECOVERY_USB_PORT GENMASK(29, 28)
#define SCU1_HWSTRAP1_RECOVERY_INTERFACE GENMASK(27, 26)
#define SCU1_HWSTRAP1_RECOVERY_I3C (BIT(26) | BIT(27))
#define SCU1_HWSTRAP1_RECOVERY_I2C BIT(27)
#define SCU1_HWSTRAP1_RECOVERY_USB BIT(26)
#define SCU1_HWSTRAP1_SPI_FLASH_4_BYTE_MODE BIT(25)
#define SCU1_HWSTRAP1_SPI_FLASH_WAIT_READY BIT(24)
#define SCU1_HWSTRAP1_BOOT_UFS BIT(23)
#define SCU1_HWSTRAP1_DIS_ROM BIT(22)
#define SCU1_HWSTRAP1_DIS_CPTRAJTAG BIT(20)
#define SCU1_HWSTRAP1_UARTDBGSEL BIT(19)
#define SCU1_HWSTRAP1_DIS_UARTDBG BIT(18)
#define SCU1_HWSTRAP1_DIS_WDTFULL BIT(17)
#define SCU1_HWSTRAP1_DISDEBUG1 BIT(16)
#define SCU1_HWSTRAP1_LTPI0_IO_DRIVING GENMASK(15, 14)
#define SCU1_HWSTRAP1_ACPI_1 BIT(13)
#define SCU1_HWSTRAP1_ACPI_0 BIT(12)
#define SCU1_HWSTRAP1_BOOT_EMMC_UFS BIT(11)
#define SCU1_HWSTRAP1_DDR4 BIT(10)
#define SCU1_HWSTRAP1_LOW_SECURE BIT(8)
#define SCU1_HWSTRAP1_EN_EMCS BIT(7)
#define SCU1_HWSTRAP1_EN_GPIOPT BIT(6)
#define SCU1_HWSTRAP1_EN_SECBOOT BIT(5)
#define SCU1_HWSTRAP1_EN_RECOVERY_BOOT BIT(4)
#define SCU1_HWSTRAP1_LTPI0_EN BIT(3)
#define SCU1_HWSTRAP1_LTPI_IDX BIT(2)
#define SCU1_HWSTRAP1_LTPI1_EN BIT(1)
#define SCU1_HWSTRAP1_LTPI_MODE BIT(0)
#define SCU1_HWSTRAP2 0x030
#define SCU1_HWSTRAP2_FMC_ABR_SINGLE_FLASH BIT(29)
#define SCU1_HWSTRAP2_FMC_ABR_CS_SWAP_DIS BIT(28)
#define SCU1_HWSTRAP2_SPI_TPM_PCR_EXT_EN BIT(27)
#define SCU1_HWSTRAP2_SPI_TPM_HASH_ALGO GENMASK(26, 25)
#define SCU1_HWSTRAP2_BOOT_SPI_FREQ GENMASK(24, 23)
#define SCU1_HWSTRAP2_RESERVED GENMASK(22, 19)
#define SCU1_HWSTRAP2_FWSPI_CRTM GENMASK(18, 17)
#define SCU1_HWSTRAP2_EN_FWSPIAUX BIT(16)
#define SCU1_HWSTRAP2_FWSPISIZE GENMASK(15, 13)
#define SCU1_HWSTRAP2_DIS_REC BIT(12)
#define SCU1_HWSTRAP2_EN_CPTRA_DBG BIT(11)
#define SCU1_HWSTRAP2_TPM_PCR_INDEX GENMASK(6, 2)
#define SCU1_HWSTRAP2_ROM_CLEAR_SRAM BIT(1)
#define SCU1_HWSTRAP2_ABR BIT(0)
#define SCU1_RSTLOG0 0x050
#define SCU1_RSTLOG0_BMC_CPU BIT(12)
#define SCU1_RSTLOG0_ABR BIT(2)
#define SCU1_RSTLOG0_EXTRSTN BIT(1)
#define SCU1_RSTLOG0_SRST BIT(0)
#define SCU1_MISC1 0x0c0
#define SCU1_MISC1_UARTDBG_ROUTE GENMASK(23, 22)
#define SCU1_MISC1_UART12_ROUTE GENMASK(21, 20)
#define SCU1_DBGCTL 0x0c8
#define SCU1_DBGCTL_MASK GENMASK(7, 0)
#define SCU1_DBGCTL_UARTDBG BIT(6)
#define SCU1_RNG_DATA 0x0f4
#define SCU1_RSTCTL1 0x200
#define SCU1_RSTCTL1_I3C(x) (BIT(16) << (x))
#define SCU1_RSTCTL1_CLR 0x204
#define SCU1_RSTCTL1_CLR_I3C(x) (BIT(16) << (x))
#define SCU1_RSTCTL2 0x220
#define SCU1_RSTCTL2_LTPI1 BIT(22)
#define SCU1_RSTCTL2_LTPI0 BIT(20)
#define SCU1_RSTCTL2_I2C BIT(15)
#define SCU1_RSTCTL2_CPTRA BIT(9)
#define SCU1_RSTCTL2_CLR 0x224
#define SCU1_RSTCTL2_CLR_I2C BIT(15)
#define SCU1_RSTCTL2_CLR_CPTRA BIT(9)
#define SCU1_CLKGATE1 0x240
#define SCU1_CLKGATE1_I3C(x) (BIT(16) << (x))
#define SCU1_CLKGATE1_I2C BIT(15)
#define SCU1_CLKGATE1_CLR 0x244
#define SCU1_CLKGATE1_CLR_I3C(x) (BIT(16) << (x))
#define SCU1_CLKGATE1_CLR_I2C BIT(15)
#define SCU1_CLKGATE2 0x260
#define SCU1_CLKGATE2_LTPI1_TX BIT(19)
#define SCU1_CLKGATE2_LTPI_AHB BIT(10)
#define SCU1_CLKGATE2_LTPI0_TX BIT(9)
#define SCU1_CLKGATE2_CLR 0x264
#endif

View File

@@ -0,0 +1,514 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) Aspeed Technology Inc.
*/
#ifndef _ASM_ARCH_SCU_AST2700_H
#define _ASM_ARCH_SCU_AST2700_H
#include <linux/types.h>
/* SoC0 SCU Register */
#define SCU_CPU_REVISION_ID_HW GENMASK(23, 16)
#define SCU_CPU_REVISION_ID_EFUSE GENMASK(15, 8)
#define SCU_CPU_HWSTRAP_DIS_RVAS BIT(30)
#define SCU_CPU_HWSTRAP_DP_SRC BIT(29)
#define SCU_CPU_HWSTRAP_DAC_SRC BIT(28)
#define SCU_CPU_HWSTRAP_VRAM_SIZE GENMASK(11, 10)
#define SCU_CPU_HWSTRAP_DIS_CPU BIT(0)
#define SCU_CPU_MISC_DP_RESET_SRC BIT(11)
#define SCU_CPU_MISC_XDMA_CLIENT_EN BIT(4)
#define SCU_CPU_MISC_2D_CLIENT_EN BIT(3)
#define SCU_CPU_RST_SSP BIT(30)
#define SCU_CPU_RST_DPMCU BIT(29)
#define SCU_CPU_RST_DP BIT(28)
#define SCU_CPU_RST_XDMA1 BIT(26)
#define SCU_CPU_RST_XDMA0 BIT(25)
#define SCU_CPU_RST_EMMC BIT(17)
#define SCU_CPU_RST_EN_DP_PCI BIT(15)
#define SCU_CPU_RST_CRT BIT(13)
#define SCU_CPU_RST_RVAS1 BIT(10)
#define SCU_CPU_RST_RVAS0 BIT(9)
#define SCU_CPU_RST_2D BIT(7)
#define SCU_CPU_RST_VIDEO BIT(6)
#define SCU_CPU_RST_SOC BIT(5)
#define SCU_CPU_RST_DDRPHY BIT(1)
#define SCU_CPU_RST2_VGA BIT(12)
#define SCU_CPU_RST2_E2M1 BIT(11)
#define SCU_CPU_RST2_E2M0 BIT(10)
#define SCU_CPU_RST2_TSP BIT(9)
#define SCU_CPU_VGA_FUNC_DAC_OUTPUT GENMASK(11, 10)
#define SCU_CPU_VGA_FUNC_DP_OUTPUT GENMASK(9, 8)
#define SCU_CPU_VGA_FUNC_DAC_DISABLE BIT(7)
#define SCU_CPU_PCI_MISC0C_FB_SIZE GENMASK(4, 0)
#define SCU_CPU_PCI_MISC70_EN_XHCI BIT(3)
#define SCU_CPU_PCI_MISC70_EN_EHCI BIT(2)
#define SCU_CPU_PCI_MISC70_EN_IPMI BIT(1)
#define SCU_CPU_PCI_MISC70_EN_VGA BIT(0)
#define SCU_CPU_HPLL_P GENMASK(22, 19)
#define SCU_CPU_HPLL_N GENMASK(18, 13)
#define SCU_CPU_HPLL_M GENMASK(12, 0)
#define SCU_CPU_HPLL2_LOCK BIT(31)
#define SCU_CPU_HPLL2_BWADJ GENMASK(11, 0)
#define SCU_CPU_SSP_TSP_RESET_STS BIT(8)
#define SCU_CPU_SSP_TSP_SRAM_SD BIT(7)
#define SCU_CPU_SSP_TSP_SRAM_DSLP BIT(6)
#define SCU_CPU_SSP_TSP_SRAM_SLP BIT(5)
#define SCU_CPU_SSP_TSP_NIDEN BIT(4)
#define SCU_CPU_SSP_TSP_DBGEN BIT(3)
#define SCU_CPU_SSP_TSP_DBG_ENABLE BIT(2)
#define SCU_CPU_SSP_TSP_RESET BIT(1)
#define SCU_CPU_SSP_TSP_ENABLE BIT(0)
/* SoC1 SCU Register */
#define SCU_IO_HWSTRAP_UFS BIT(23)
#define SCU_IO_HWSTRAP_EMMC BIT(11)
#define SCU_IO_HWSTRAP_SECBOOT BIT(5)
#define SCU_IO_HWSTRAP_LTPI0_EN BIT(3)
#define SCU_IO_HWSTRAP_LTPI1_EN BIT(1)
/* CLK information */
#define CLKIN_25M 25000000UL
#define SCU_CPU_CLKGATE1_RVAS1 BIT(28)
#define SCU_CPU_CLKGATE1_RVAS0 BIT(25)
#define SCU_CPU_CLKGATE1_E2M1 BIT(19)
#define SCU_CPU_CLKGATE1_DP BIT(18)
#define SCU_CPU_CLKGATE1_DAC BIT(17)
#define SCU_CPU_CLKGATE1_E2M0 BIT(12)
#define SCU_CPU_CLKGATE1_VGA1 BIT(10)
#define SCU_CPU_CLKGATE1_VGA0 BIT(5)
/*
* Clock divider/multiplier configuration struct.
* For H-PLL and M-PLL the formula is
* (Output Frequency) = CLKIN * ((M + 1) / (N + 1)) / (P + 1)
* M - Numerator
* N - Denumerator
* P - Post Divider
* They have the same layout in their control register.
*
*/
union ast2700_pll_reg {
u32 w;
struct {
uint16_t m : 13; /* bit[12:0] */
uint8_t n : 6; /* bit[18:13] */
uint8_t p : 4; /* bit[22:19] */
uint8_t off : 1; /* bit[23] */
uint8_t bypass : 1; /* bit[24] */
uint8_t reset : 1; /* bit[25] */
uint8_t reserved : 6; /* bit[31:26] */
} b;
};
struct ast2700_pll_cfg {
union ast2700_pll_reg reg;
unsigned int ext_reg;
};
struct ast2700_pll_desc {
u32 in;
u32 out;
struct ast2700_pll_cfg cfg;
};
struct aspeed_clks {
ulong id;
const char *name;
};
#ifndef __ASSEMBLY__
struct ast2700_scu0 {
u32 chip_id1; /* 0x000 */
u32 rsv_0x04[3]; /* 0x004 ~ 0x00C */
u32 hwstrap1; /* 0x010 */
u32 hwstrap1_clr; /* 0x014 */
u32 rsv_0x18[2]; /* 0x018 ~ 0x01C */
u32 hwstrap1_lock; /* 0x020 */
u32 hwstrap1_sec1; /* 0x024 */
u32 hwstrap1_sec2; /* 0x028 */
u32 hwstrap1_sec3; /* 0x02C */
u32 rsv_0x30[8]; /* 0x030 ~ 0x4C */
u32 sysrest_log1; /* 0x050 */
u32 sysrest_log1_sec1; /* 0x054 */
u32 sysrest_log1_sec2; /* 0x058 */
u32 sysrest_log1_sec3; /* 0x05C */
u32 sysrest_log2; /* 0x060 */
u32 sysrest_log2_sec1; /* 0x064 */
u32 sysrest_log2_sec2; /* 0x068 */
u32 sysrest_log2_sec3; /* 0x06C */
u32 sysrest_log3; /* 0x070 */
u32 sysrest_log3_sec1; /* 0x074 */
u32 sysrest_log3_sec2; /* 0x078 */
u32 sysrest_log3_sec3; /* 0x07C */
u32 rsv_0x80[8]; /* 0x080 ~ 0x9C */
u32 probe_sig_select; /* 0x0A0 */
u32 probe_sig_enable1; /* 0x0A4 */
u32 probe_sig_enable2; /* 0x0A8 */
u32 uart_dbg_rate; /* 0x0AC */
u32 rsv_0xB0[4]; /* 0x0B0 ~ 0xBC*/
u32 misc; /* 0x0C0 */
u32 rsv_0xC4; /* 0x0C4 */
u32 debug_ctrl; /* 0x0C8 */
u32 rsv_0xCC[5]; /* 0x0CC ~ 0x0DC */
u32 free_counter_read_low; /* 0x0E0 */
u32 free_counter_read_high; /* 0x0E4 */
u32 rsv_0xE8[2]; /* 0x0E8 ~ 0x0EC */
u32 random_num_ctrl; /* 0x0F0 */
u32 random_num_data; /* 0x0F4 */
u32 rsv_0xF8[10]; /* 0x0F8 ~ 0x11C */
u32 ssp_ctrl_1; /* 0x120 */
u32 ssp_ctrl_2; /* 0x124 */
u32 ssp_ctrl_3; /* 0x128 */
u32 ssp_ctrl_4; /* 0x12C */
u32 ssp_ctrl_5; /* 0x130 */
u32 ssp_ctrl_6; /* 0x134 */
u32 ssp_ctrl_7; /* 0x138 */
u32 rsv_0x13c[1]; /* 0x13C */
u32 ssp_remap0_base; /* 0x140 */
u32 ssp_remap0_size; /* 0x144 */
u32 ssp_remap1_base; /* 0x148 */
u32 ssp_remap1_size; /* 0x14c */
u32 ssp_remap2_base; /* 0x150 */
u32 ssp_remap2_size; /* 0x154 */
u32 rsv_0x158[2]; /* 0x158 ~ 0x15C */
u32 tsp_ctrl_1; /* 0x160 */
u32 rsv_0x164[1]; /* 0x164 */
u32 tsp_ctrl_3; /* 0x168 */
u32 tsp_ctrl_4; /* 0x16C */
u32 tsp_ctrl_5; /* 0x170 */
u32 tsp_ctrl_6; /* 0x174 */
u32 tsp_ctrl_7; /* 0x178 */
u32 rsv_0x17c[6]; /* 0x17C ~ 0x190 */
u32 tsp_remap_size; /* 0x194 */
u32 rsv_0x198[26]; /* 0x198 ~ 0x1FC */
u32 modrst1_ctrl; /* 0x200 */
u32 modrst1_clr; /* 0x204 */
u32 rsv_0x208[2]; /* 0x208 ~ 0x20C */
u32 modrst1_lock; /* 0x210 */
u32 modrst1_prot1; /* 0x214 */
u32 modrst1_prot2; /* 0x218 */
u32 modrst1_prot3; /* 0x21C */
u32 modrst2_ctrl; /* 0x220 */
u32 modrst2_clr; /* 0x224 */
u32 rsv_0x228[2]; /* 0x228 ~ 0x22C */
u32 modrst2_lock; /* 0x230 */
u32 modrst2_prot1; /* 0x234 */
u32 modrst2_prot2; /* 0x238 */
u32 modrst2_prot3; /* 0x23C */
u32 clkgate_ctrl; /* 0x240 */
u32 clkgate_clr; /* 0x244 */
u32 rsv_0x248[2]; /* 0x248 */
u32 clkgate_lock; /* 0x250 */
u32 clkgate_secure1; /* 0x254 */
u32 clkgate_secure2; /* 0x258 */
u32 clkgate_secure3; /* 0x25c */
u32 rsv_0x260[8]; /* 0x260 */
u32 clk_sel1; /* 0x280 */
u32 clk_sel2; /* 0x284 */
u32 clk_sel3; /* 0x288 */
u32 rsv_0x28c; /* 0x28c */
u32 clk_sel1_lock; /* 0x290 */
u32 clk_sel2_lock; /* 0x294 */
u32 clk_sel3_lock; /* 0x298 */
u32 rsv_0x29c; /* 0x29c */
u32 clk_sel1_secure1; /* 0x2a0 */
u32 clk_sel1_secure2; /* 0x2a4 */
u32 clk_sel1_secure3; /* 0x2a8 */
u32 rsv_0x2ac; /* 0x2ac */
u32 clk_sel2_secure1; /* 0x2b0 */
u32 clk_sel2_secure2; /* 0x2b4 */
u32 clk_sel2_secure3; /* 0x2b8 */
u32 rsv_0x2bc; /* 0x2bc */
u32 clk_sel3_secure1; /* 0x2c0 */
u32 clk_sel3_secure2; /* 0x2c4 */
u32 clk_sel3_secure3; /* 0x2c8 */
u32 rsv_0x2cc[9]; /* 0x2cc */
u32 extrst_sel; /* 0x2f0 */
u32 rsv_0x2f4[3]; /* 0x2f4 */
u32 hpll; /* 0x300 */
u32 hpll_ext; /* 0x304 */
u32 dpll; /* 0x308 */
u32 dpll_ext; /* 0x30C */
u32 mpll; /* 0x310 */
u32 mpll_ext; /* 0x314 */
u32 rsv_0x318[2]; /* 0x318 ~ 0x31C */
u32 d1clk_para; /* 0x320 */
u32 rsv_0x324[3]; /* 0x324 ~ 0x32C */
u32 d2clk_para; /* 0x330 */
u32 rsv_0x334[3]; /* 0x334 ~ 0x33C */
u32 crt1clk_para; /* 0x340 */
u32 rsv_0x344[3]; /* 0x344 ~ 0x34C */
u32 crt2clk_para; /* 0x350 */
u32 rsv_0x354[3]; /* 0x354 ~ 0x35C */
u32 mphyclk_para; /* 0x360 */
u32 rsv_0x364[7]; /* 0x364 ~ 0x37C */
u32 clkduty_meas_ctrl; /* 0x380 */
u32 clkduty1; /* 0x384 */
u32 clkduty2; /* 0x368 */
u32 clkduty_meas_res; /* 0x38c */
u32 rsv_0x390[4]; /* 0x390 ~ 0x39C */
u32 freq_counter_ctrl; /* 0x3a0 */
u32 freq_counter_cmp; /* 0x3a4 */
u32 prog_delay_ring_ctrl0; /* 0x3a8 */
u32 prog_delay_ring_ctrl1; /* 0x3ac */
u32 freq_counter_readback; /* 0x3b0 */
u32 rsv_0x3b4[19]; /* 0x3b4 */
u32 pinmux1; /* 0x400 */
u32 pinmux2; /* 0x404 */
u32 pinmux3; /* 0x408 */
u32 rsv_0x40c; /* 0x40C */
u32 pinmux4; /* 0x410 */
u32 vga_func_ctrl; /* 0x414 */
u32 rsv_0x418[2]; /* 0x418 */
u32 pinmux_lock0; /* 0x420 */
u32 pinmux_lock1; /* 0x424 */
u32 pinmux_lock2; /* 0x428 */
u32 rsv_0x42c;
u32 pinmux_lock3; /* 0x430 */
u32 pinmux_lock4; /* 0x434 */
u32 rsv_0x438[18];
u32 gpio18d0_ioctrl; /* 0x480 */
u32 gpio18d1_ioctrl; /* 0x484 */
u32 gpio18d2_ioctrl; /* 0x488 */
u32 gpio18d3_ioctrl; /* 0x48c */
u32 gpio18d4_ioctrl; /* 0x490 */
u32 gpio18d5_ioctrl; /* 0x494 */
u32 gpio18d6_ioctrl; /* 0x498 */
u32 gpio18d7_ioctrl; /* 0x49c */
u32 gpio18e0_ioctrl; /* 0x4a0 */
u32 gpio18e1_ioctrl; /* 0x4a4 */
u32 gpio18e2_ioctrl; /* 0x4a8 */
u32 gpio18e3_ioctrl; /* 0x4ac */
u32 jtag_ioctrl; /* 0x4b0 */
u32 uart_ioctrl; /* 0x4b4 */
u32 misc_ioctrl; /* 0x4b8 */
u32 rsv_0x4bc[17]; /* 0x4bc ~ 0x4fc */
u32 pinmux_seucre0_0; /* 0x500 */
u32 pinmux_seucre0_1; /* 0x504 */
u32 pinmux_seucre0_2; /* 0x508 */
u32 rsv_0x50c;
u32 pinmux_seucre0_3; /* 0x510 */
u32 pinmux_seucre0_4; /* 0x514 */
u32 rsv_0x518[58];
u32 pinmux_seucre1_0; /* 0x600 */
u32 pinmux_seucre1_1; /* 0x604 */
u32 pinmux_seucre1_2; /* 0x608 */
u32 rsv_0x60c;
u32 pinmux_seucre1_3; /* 0x610 */
u32 pinmux_seucre1_4; /* 0x614 */
u32 rsv_0x618[58];
u32 pinmux_seucre2_0; /* 0x700 */
u32 pinmux_seucre2_1; /* 0x704 */
u32 pinmux_seucre2_2; /* 0x708 */
u32 rsv_0x70c;
u32 pinmux_seucre2_3; /* 0x710 */
u32 pinmux_seucre2s_4; /* 0x714 */
u32 rsv_0x718[26];
u32 cpu_scratch[96]; /* 0x780 ~ 0x8FC */
u32 vga0_scratch1[4]; /* 0x900 ~ 0x90C */
u32 vga1_scratch1[4]; /* 0x910 ~ 0x91C */
u32 vga0_scratch2[8]; /* 0x920 ~ 0x93C */
u32 vga1_scratch2[8]; /* 0x940 ~ 0x95C */
u32 pci_cfg1[3]; /* 0x960 ~ 0x968 */
u32 rsv_0x96c; /* 0x96C */
u32 pcie_cfg1; /* 0x970 */
u32 mmio_decode1; /* 0x974 */
u32 reloc_ctrl_decode1[2]; /* 0x978 ~ 0x97C */
u32 rsv_0x980[4]; /* 0x980 ~ 0x98C */
u32 mbox_decode1; /* 0x990 */
u32 shared_sram_decode1[2];/* 0x994 ~ 0x998 */
u32 rsv_0x99c; /* 0x99C */
u32 pci_cfg2[3]; /* 0x9A0 ~ 0x9A8 */
u32 rsv_0x9ac; /* 0x9AC */
u32 pcie_cfg2; /* 0x9B0 */
u32 mmio_decode2; /* 0x9B4 */
u32 reloc_ctrl_decode2[2]; /* 0x9B8 ~ 0x9BC */
u32 rsv_0x9c0[4]; /* 0x9C0 ~ 0x9CC */
u32 mbox_decode2; /* 0x9D0 */
u32 shared_sram_decode2[2];/* 0x9D4 ~ 0x9D8 */
u32 rsv_0x9dc[9]; /* 0x9DC ~ 0x9FC */
u32 pci0_misc[32]; /* 0xA00 ~ 0xA7C */
u32 pci1_misc[32]; /* 0xA80 ~ 0xAFC */
};
struct ast2700_scu1 {
u32 chip_id1; /* 0x000 */
u32 rsv_0x04[3]; /* 0x004 ~ 0x00C */
u32 hwstrap1; /* 0x010 */
u32 hwstrap1_clr; /* 0x014 */
u32 rsv_0x18[2]; /* 0x018 ~ 0x01C */
u32 hwstrap1_lock; /* 0x020 */
u32 hwstrap1_sec1; /* 0x024 */
u32 hwstrap1_sec2; /* 0x028 */
u32 hwstrap1_sec3; /* 0x02C */
u32 hwstrap2; /* 0x030 */
u32 hwstrap2_clr; /* 0x034 */
u32 rsv_0x38[2]; /* 0x038 ~ 0x03C */
u32 hwstrap2_lock; /* 0x040 */
u32 hwstrap2_sec1; /* 0x044 */
u32 hwstrap2_sec2; /* 0x048 */
u32 hwstrap2_sec3; /* 0x04C */
u32 sysrest_log1; /* 0x050 */
u32 sysrest_log1_sec1; /* 0x054 */
u32 sysrest_log1_sec2; /* 0x058 */
u32 sysrest_log1_sec3; /* 0x05C */
u32 sysrest_log2; /* 0x060 */
u32 sysrest_log2_sec1; /* 0x064 */
u32 sysrest_log2_sec2; /* 0x068 */
u32 sysrest_log2_sec3; /* 0x06C */
u32 sysrest_log3; /* 0x070 */
u32 sysrest_log3_sec1; /* 0x074 */
u32 sysrest_log3_sec2; /* 0x078 */
u32 sysrest_log3_sec3; /* 0x07C */
u32 sysrest_log4; /* 0x080 */
u32 sysrest_log4_sec1; /* 0x084 */
u32 sysrest_log4_sec2; /* 0x088 */
u32 sysrest_log4_sec3; /* 0x08C */
u32 rsv_0x90[7]; /* 0x090 ~ 0xA8 */
u32 uart_dbg_rate; /* 0x0AC */
u32 rsv_0xB0[4]; /* 0x0B0 ~ 0xBC*/
u32 misc; /* 0x0C0 */
u32 rsv_0xC4; /* 0x0C4 */
u32 debug_ctrl; /* 0x0C8 */
u32 rsv_0xCC; /* 0x0CC */
u32 dac_ctrl; /* 0x0D0 */
u32 dac_crc_ctrl; /* 0x0D4 */
u32 rsv_0xD8[2]; /* 0x0D8 ~ 0x0DC */
u32 video_input_ctrl; /* 0x0E0 */
u32 rsv_0xE4[3]; /* 0x0E4 ~ 0x0EC */
u32 random_num_ctrl; /* 0x0F0 */
u32 random_num_data; /* 0x0F4 */
u32 rsv_0xF0[2]; /* 0x0F8 ~ 0x0FC */
u32 rsv_0x100[32]; /* 0x100 ~ 0x17C */
u32 scratch[32]; /* 0x180 ~ 0x1FC */
u32 modrst1_ctrl; /* 0x200 */
u32 modrst1_clr; /* 0x204 */
u32 rsv_0x208[2]; /* 0x208 ~ 0x20C */
u32 modrst_lock1; /* 0x210 */
u32 modrst1_sec1; /* 0x214 */
u32 modrst1_sec2; /* 0x218 */
u32 modrst1_sec3; /* 0x21C */
u32 modrst2_ctrl; /* 0x220 */
u32 modrst2_clr; /* 0x224 */
u32 rsv_0x228[2]; /* 0x228 ~ 0x22C */
u32 modrst2_lock; /* 0x230 */
u32 modrst2_prot1; /* 0x234 */
u32 modrst2_prot2; /* 0x238 */
u32 modrst2_prot3; /* 0x23C */
u32 clkgate_ctrl1; /* 0x240 */
u32 clkgate_clr1; /* 0x244 */
u32 rsv_0x248[2]; /* 0x248 */
u32 clkgate_lock1; /* 0x250 */
u32 clkgate_secure11; /* 0x254 */
u32 clkgate_secure12; /* 0x258 */
u32 clkgate_secure13; /* 0x25c */
u32 clkgate_ctrl2; /* 0x260 */
u32 clkgate_clr2; /* 0x264 */
u32 rsv_0x268[2]; /* 0x268 */
u32 clkgate_lock2; /* 0x270 */
u32 clkgate_secure21; /* 0x274 */
u32 clkgate_secure22; /* 0x278 */
u32 clkgate_secure23; /* 0x27c */
u32 clk_sel1; /* 0x280 */
u32 clk_sel2; /* 0x284 */
u32 rsv_0x288[2]; /* 0x288 */
u32 clk_sel1_lock; /* 0x290 */
u32 clk_sel2_lock; /* 0x294 */
u32 rsv_0x298[2]; /* 0x298 */
u32 clk_sel1_secure1; /* 0x2a0 */
u32 clk_sel1_secure2; /* 0x2a4 */
u32 rsv_0x2a8[2]; /* 0x2a8 */
u32 clk_sel2_secure1; /* 0x2b0 */
u32 clk_sel2_secure2; /* 0x2b4 */
u32 rsv_0x2b8[2]; /* 0x2b8 */
u32 clk_sel3_secure1; /* 0x2c0 */
u32 clk_sel3_secure2; /* 0x2c4 */
u32 rsv_0x2c8[10]; /* 0x2c8 */
u32 extrst_sel1; /* 0x2f0 */
u32 extrst_sel2; /* 0x2f4 */
u32 rsv_0x2f8[2]; /* 0x2f8 */
u32 hpll; /* 0x300 */
u32 hpll_ext; /* 0x304 */
u32 rsv_0x308[2]; /* 0x308 ~ 0x30C */
u32 apll; /* 0x310 */
u32 apll_ext; /* 0x314 */
u32 rsv_0x318[2]; /* 0x318 ~ 0x31C */
u32 dpll; /* 0x320 */
u32 dpll_ext; /* 0x324 */
u32 rsv_0x328[2]; /* 0x328 ~ 0x32C */
u32 uxclk_ctrl; /* 0x330 */
u32 huxclk_ctrl; /* 0x334 */
u32 rsv_0x338[18]; /* 0x338 ~ 0x37C */
u32 clkduty_meas_ctrl; /* 0x380 */
u32 clkduty1; /* 0x384 */
u32 clkduty2; /* 0x388 */
u32 rsv_0x38c; /* 0x38c */
u32 mac_delay; /* 0x390 */
u32 mac_100m_delay; /* 0x394 */
u32 mac_10m_delay; /* 0x398 */
u32 rsv_0x39c; /* 0x39c */
u32 freq_counter_ctrl; /* 0x3a0 */
u32 freq_counter_cmp; /* 0x3a4 */
u32 rsv_0x3a8[2]; /* 0x3a8 ~ 0x3aC */
u32 usb_ctrl; /* 0x3b0 */
u32 usb_lock; /* 0x3b4 */
u32 usb_secure1; /* 0x3b8 */
u32 usb_secure2; /* 0x3bc */
u32 usb_secure3; /* 0x3c0 */
u32 rsv_0x3c4[15]; /* 0x3c4 ~ 0x3fc */
u32 pinumx1; /* 0x400 */
u32 pinumx2; /* 0x404 */
u32 pinumx3; /* 0x408 */
u32 pinumx4; /* 0x40c */
u32 pinumx5; /* 0x410 */
u32 pinumx6; /* 0x414 */
u32 pinumx7; /* 0x418 */
u32 pinumx8; /* 0x41c */
u32 pinumx9; /* 0x420 */
u32 pinumx10; /* 0x424 */
u32 pinumx11; /* 0x428 */
u32 pinumx12; /* 0x42c */
u32 pinumx13; /* 0x430 */
u32 pinumx14; /* 0x434 */
u32 pinumx15; /* 0x438 */
u32 pinumx16; /* 0x43c */
u32 pinumx17; /* 0x440 */
u32 pinumx18; /* 0x444 */
u32 pinumx19; /* 0x448 */
u32 pinumx20; /* 0x44c */
u32 pinumx21; /* 0x450 */
u32 pinumx22; /* 0x454 */
u32 pinumx23; /* 0x458 */
u32 pinumx24; /* 0x45c */
u32 pinumx25; /* 0x460 */
u32 pinumx26; /* 0x464 */
u32 pinumx27; /* 0x468 */
u32 rsv_0x46c[4]; /* 0x46c ~ 0x478 */
u32 pinumx31; /* 0x47c */
u32 pull_down_dis[8]; /* 0x480 ~ 0x49c */
u32 pin_conf; /* 0x4a0 */
u32 rsv_0x4a4[7]; /* 0x4a4 ~ 0x4bc */
u32 io_driving0; /* 0x4c0 */
u32 io_driving1; /* 0x4c4 */
u32 io_driving2; /* 0x4c8 */
u32 io_driving3; /* 0x4cc */
u32 io_driving4; /* 0x4d0 */
u32 io_driving5; /* 0x4d4 */
u32 io_driving6; /* 0x4d8 */
u32 io_driving7; /* 0x4dc */
u32 io_driving8; /* 0x4e0 */
};
#endif
#endif

View File

@@ -0,0 +1,137 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) Aspeed Technology Inc.
*/
#ifndef __ASM_AST2700_SDRAM_H__
#define __ASM_AST2700_SDRAM_H__
struct sdrammc_regs {
u32 prot_key;
u32 intr_status;
u32 intr_clear;
u32 intr_mask;
u32 mcfg;
u32 mctl;
u32 msts;
u32 error_status;
u32 actime1;
u32 actime2;
u32 actime3;
u32 actime4;
u32 actime5;
u32 actime6;
u32 actime7;
u32 dfi_timing;
u32 dcfg;
u32 dctl;
u32 mrctl;
u32 mrwr;
u32 mrrd;
u32 mr01;
u32 mr23;
u32 mr45;
u32 mr67;
u32 refctl;
u32 refmng_ctl;
u32 refsts;
u32 zqctl;
u32 ecc_addr_range;
u32 ecc_failure_status;
u32 ecc_failure_addr;
u32 ecc_test_control;
u32 ecc_test_status;
u32 arbctl;
u32 enccfg;
u32 protect_lock_set;
u32 protect_lock_status;
u32 protect_lock_reset;
u32 enc_min_addr;
u32 enc_max_addr;
u32 enc_key[4];
u32 enc_iv[3];
u32 bistcfg;
u32 bist_addr;
u32 bist_size;
u32 bist_patt;
u32 bist_res;
u32 bist_fail_addr;
u32 bist_fail_data[4];
u32 reserved2[2];
u32 debug_control;
u32 debug_status;
u32 phy_intf_status;
u32 testcfg;
u32 gfmcfg;
u32 gfm0ctl;
u32 gfm1ctl;
u32 reserved3[0xf8];
};
#define DRAMC_UNLK_KEY 0x1688a8a8
/* offset 0x04 */
#define DRAMC_IRQSTA_PWRCTL_ERR BIT(16)
#define DRAMC_IRQSTA_PHY_ERR BIT(15)
#define DRAMC_IRQSTA_LOWPOWER_DONE BIT(12)
#define DRAMC_IRQSTA_FREQ_CHG_DONE BIT(11)
#define DRAMC_IRQSTA_REF_DONE BIT(10)
#define DRAMC_IRQSTA_ZQ_DONE BIT(9)
#define DRAMC_IRQSTA_BIST_DONE BIT(8)
#define DRAMC_IRQSTA_ECC_RCVY_ERR BIT(5)
#define DRAMC_IRQSTA_ECC_ERR BIT(4)
#define DRAMC_IRQSTA_PROT_ERR BIT(3)
#define DRAMC_IRQSTA_OVERSZ_ERR BIT(2)
#define DRAMC_IRQSTA_MR_DONE BIT(1)
#define DRAMC_IRQSTA_PHY_INIT_DONE BIT(0)
/* offset 0x14 */
#define DRAMC_MCTL_WB_SOFT_RESET BIT(24)
#define DRAMC_MCTL_PHY_CLK_DIS BIT(18)
#define DRAMC_MCTL_PHY_RESET BIT(17)
#define DRAMC_MCTL_PHY_POWER_ON BIT(16)
#define DRAMC_MCTL_FREQ_CHG_START BIT(3)
#define DRAMC_MCTL_PHY_LOWPOWER_START BIT(2)
#define DRAMC_MCTL_SELF_REF_START BIT(1)
#define DRAMC_MCTL_PHY_INIT_START BIT(0)
/* offset 0x40 */
#define DRAMC_DFICFG_WD_POL BIT(18)
#define DRAMC_DFICFG_CKE_OUT BIT(17)
#define DRAMC_DFICFG_RESET BIT(16)
/* offset 0x48 */
#define DRAMC_MRCTL_ERR_STATUS BIT(31)
#define DRAMC_MRCTL_READY_STATUS BIT(30)
#define DRAMC_MRCTL_MR_ADDR BIT(8)
#define DRAMC_MRCTL_CMD_DLL_RST BIT(7)
#define DRAMC_MRCTL_CMD_DQ_SEL BIT(6)
#define DRAMC_MRCTL_CMD_TYPE BIT(2)
#define DRAMC_MRCTL_CMD_WR_CTL BIT(1)
#define DRAMC_MRCTL_CMD_START BIT(0)
/* offset 0xC0 */
#define DRAMC_BISTRES_RUNNING BIT(10)
#define DRAMC_BISTRES_FAIL BIT(9)
#define DRAMC_BISTRES_DONE BIT(8)
#define DRAMC_BISTCFG_INIT_MODE BIT(7)
#define DRAMC_BISTCFG_PMODE GENMASK(6, 4)
#define DRAMC_BISTCFG_BMODE GENMASK(3, 2)
#define DRAMC_BISTCFG_ENABLE BIT(1)
#define DRAMC_BISTCFG_START BIT(0)
#define BIST_PMODE_CRC (3)
#define BIST_BMODE_RW_SWITCH (3)
/* DRAMC048 MR Control Register */
#define MR_TYPE_SHIFT 2
#define MR_RW (0 << MR_TYPE_SHIFT)
#define MR_MPC BIT(2)
#define MR_VREFCS (2 << MR_TYPE_SHIFT)
#define MR_VREFCA (3 << MR_TYPE_SHIFT)
#define MR_ADDRESS_SHIFT 8
#define MR_ADDR(n) (((n) << MR_ADDRESS_SHIFT) | DRAMC_MRCTL_CMD_WR_CTL)
#define MR_NUM_SHIFT 4
#define MR_NUM(n) ((n) << MR_NUM_SHIFT)
#define MR_DLL_RESET BIT(7)
#define MR_1T_MODE BIT(16)
#endif

View File

@@ -36,9 +36,20 @@ config ASPEED_AST2600
It is used as Board Management Controller on many server boards,
which is enabled by support of LPC and eSPI peripherals.
config ASPEED_AST2700
bool "Support Aspeed AST2700 SoC"
select ARM64
select SYS_ARCH_TIMER
help
Support for the Aspeed AST2700, an arm64 (Cortex-A35) Baseboard
Management Controller (BMC) SoC. This is the 8th-generation BMC
SoC family from Aspeed and features a dual-die architecture
(CPU die + I/O die) connected via an internal coherent bus.
endchoice
source "arch/arm/mach-aspeed/ast2500/Kconfig"
source "arch/arm/mach-aspeed/ast2600/Kconfig"
source "arch/arm/mach-aspeed/ast2700/Kconfig"
endif

View File

@@ -5,3 +5,4 @@
obj-$(CONFIG_ARCH_ASPEED) += ast_wdt.o
obj-$(CONFIG_ASPEED_AST2500) += ast2500/
obj-$(CONFIG_ASPEED_AST2600) += ast2600/
obj-$(CONFIG_ASPEED_AST2700) += ast2700/

View File

@@ -0,0 +1,36 @@
if ASPEED_AST2700
config SYS_CPU
default "armv8"
config SPI_KERNEL_FIT_ADDR
hex "SPI address of kernel FIT image"
default 0x100420000
help
Address in the SPI flash where the kernel FIT image is stored.
Used by the bootspi command to load and boot the kernel image
from the SPI flash on AST2700 platforms.
choice
prompt "AST2700 board select"
depends on ASPEED_AST2700
default TARGET_EVB_AST2700
help
Select the AST2700 board model. Each board option configures
the board-specific Kconfig, defaults and devicetree.
config TARGET_EVB_AST2700
bool "EVB-AST2700"
depends on ASPEED_AST2700
select ARCH_MISC_INIT
help
EVB-AST2700 is Aspeed evaluation board for AST2700A0 chip.
It has 512M of RAM, 32M of SPI flash, two Ethernet ports,
4 Serial ports, 4 USB ports, VGA port, PCIe, SD card slot,
20 pin JTAG, pinouts for 14 I2Cs, 3 SPIs and eSPI, 8 PWMs.
endchoice
source "board/aspeed/evb_ast2700/Kconfig"
endif

View File

@@ -0,0 +1,2 @@
obj-y += lowlevel_init.o board_common.o arm64-mmu.o platform.o
obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o

View File

@@ -0,0 +1,43 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) ASPEED Technology Inc.
*/
#include <dm.h>
#include <asm/armv8/mmu.h>
static struct mm_region aspeed2700_mem_map[] = {
{
.virt = 0x0UL,
.phys = 0x0UL,
.size = 0x40000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
PTE_BLOCK_NON_SHARE |
PTE_BLOCK_PXN | PTE_BLOCK_UXN,
},
{
.virt = 0x40000000UL,
.phys = 0x40000000UL,
.size = 0x2C0000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
PTE_BLOCK_NON_SHARE,
},
{
.virt = 0x400000000UL,
.phys = 0x400000000UL,
.size = 0x200000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
PTE_BLOCK_INNER_SHARE,
},
{
/* List terminator */
0,
}
};
struct mm_region *mem_map = aspeed2700_mem_map;
u64 get_page_table_size(void)
{
return 0x80000;
}

View File

@@ -0,0 +1,90 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) ASPEED Technology Inc.
*/
#include <dm.h>
#include <ram.h>
#include <init.h>
#include <timer.h>
#include <asm/io.h>
#include <asm/arch/timer.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/err.h>
#include <dm/uclass.h>
#include <asm/arch-aspeed/scu_ast2700.h>
#define AHBC_GROUP(x) (0x40 * (x))
#define AHBC_HREADY_WAIT_CNT_REG 0x34
#define AHBC_HREADY_WAIT_CNT_MAX 0x3f
DECLARE_GLOBAL_DATA_PTR;
int dram_init(void)
{
int ret;
struct udevice *dev;
struct ram_info ram;
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
if (ret) {
printf("cannot get DRAM driver\n");
debug("cannot get DRAM driver\n");
return ret;
}
ret = ram_get_info(dev, &ram);
if (ret) {
debug("cannot get DRAM information\n");
return ret;
}
gd->ram_size = ram.size;
return 0;
}
static void ahbc_init(void)
{
u32 reg_val;
int i;
reg_val = readl(ASPEED_CPU_REVISION_ID);
if (FIELD_GET(SCU_CPU_REVISION_ID_HW, reg_val))
return;
/* CPU-die AHBC timeout counter */
for (i = 0; i < 4; i++)
writel(AHBC_HREADY_WAIT_CNT_MAX,
(void *)ASPEED_CPU_AHBC_BASE + AHBC_GROUP(i) + AHBC_HREADY_WAIT_CNT_REG);
/* IO-die AHBC timeout counter */
for (i = 0; i < 8; i++)
writel(AHBC_HREADY_WAIT_CNT_MAX,
(void *)ASPEED_IO_AHBC_BASE + AHBC_GROUP(i) + AHBC_HREADY_WAIT_CNT_REG);
}
int board_init(void)
{
struct udevice *dev;
int i = 0;
int ret;
ahbc_init();
/*
* Loop over all MISC uclass drivers to call the comphy code
* and init all CP110 devices enabled in the DT
*/
while (1) {
/* Call the comphy code via the MISC uclass driver */
ret = uclass_get_device(UCLASS_MISC, i++, &dev);
/* We're done, once no further CP110 device is found */
if (ret)
break;
}
return 0;
}

View File

@@ -0,0 +1,114 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) ASPEED Technology Inc.
* Ryan Chen <ryan_chen@aspeedtech.com>
*/
#include <command.h>
#include <asm/io.h>
#include <asm/arch/platform.h>
#include <asm/arch/scu_ast2700.h>
/* SoC mapping Table */
#define SOC_ID(str, rev) { .name = str, .rev_id = rev, }
struct soc_id {
const char *name;
u64 rev_id;
};
static struct soc_id soc_map_table[] = {
SOC_ID("AST2750-A0", 0x0600000306000003),
SOC_ID("AST2700-A0", 0x0600010306000103),
SOC_ID("AST2720-A0", 0x0600020306000203),
SOC_ID("AST2750-A1", 0x0601000306010003),
SOC_ID("AST2700-A1", 0x0601010306010103),
SOC_ID("AST2720-A1", 0x0601020306010203),
SOC_ID("AST2750-A2", 0x0602000306020003),
SOC_ID("AST2700-A2", 0x0602010306020103),
SOC_ID("AST2720-A2", 0x0602020306020203),
};
void ast2700_print_soc_id(void)
{
int i;
u64 rev_id;
rev_id = readl(ASPEED_CPU_REVISION_ID);
rev_id = ((u64)readl(ASPEED_IO_REVISION_ID) << 32) | rev_id;
for (i = 0; i < ARRAY_SIZE(soc_map_table); i++) {
if (rev_id == soc_map_table[i].rev_id)
break;
}
if (i == ARRAY_SIZE(soc_map_table))
printf("Unknown-SOC: %llx\n", rev_id);
else
printf("SOC: %4s\n", soc_map_table[i].name);
}
#define SYS_DRAM_ECCRST BIT(3)
#define SYS_ABRRST BIT(2)
#define SYS_EXTRST BIT(1)
#define SYS_SRST BIT(0)
#define WDT_RST_BIT_MASK(s) (GENMASK(3, 0) << (s))
#define BIT_WDT_FULL(s) (BIT(0) << (s))
#define BIT_WDT_ARM(s) (BIT(1) << (s))
#define BIT_WDT_SOC(s) (BIT(2) << (s))
#define BIT_WDT_SW(s) (BIT(3) << (s))
void ast2700_print_wdtrst_info(void)
{
u32 wdt_rst = readl(ASPEED_IO_RESET_LOG4);
int i;
for (i = 0; i < 8; i++) {
if (wdt_rst & WDT_RST_BIT_MASK(i * 4)) {
printf("RST: WDT%d ", i);
if (wdt_rst & BIT_WDT_SOC(i * 4)) {
printf("SOC ");
writel(BIT_WDT_SOC(i * 4), ASPEED_IO_RESET_LOG4);
}
if (wdt_rst & BIT_WDT_FULL(i * 4)) {
printf("FULL ");
writel(BIT_WDT_FULL(i * 4), ASPEED_IO_RESET_LOG4);
}
if (wdt_rst & BIT_WDT_ARM(i * 4)) {
printf("ARM ");
writel(BIT_WDT_ARM(i * 4), ASPEED_IO_RESET_LOG4);
}
if (wdt_rst & BIT_WDT_SW(i * 4)) {
printf("SW ");
writel(BIT_WDT_SW(i * 4), ASPEED_IO_RESET_LOG4);
}
printf("\n");
}
}
}
#define SYS_EXTRST BIT(1)
#define SYS_SRST BIT(0)
void ast2700_print_sysrst_info(void)
{
u32 sys_rst = readl(ASPEED_CPU_RESET_LOG1);
if (sys_rst & SYS_SRST) {
printf("RST: Power On\n");
writel(SYS_SRST, ASPEED_CPU_RESET_LOG1);
} else if (sys_rst & SYS_EXTRST) {
printf("RST: EXTRST\n");
writel(SYS_EXTRST, ASPEED_CPU_RESET_LOG1);
} else {
ast2700_print_wdtrst_info();
}
}
int print_cpuinfo(void)
{
ast2700_print_soc_id();
ast2700_print_sysrst_info();
return 0;
}

View File

@@ -0,0 +1,132 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) ASPEED Technology Inc.
*/
#include <config.h>
#include <linux/linkage.h>
/*
* SMP mailbox
* +-----------------------+ 0x40
* | |
* | mailbox insn. for |
* | cpuN GO sign polling |
* | |
* +-----------------------+ 0x20
* | cpu3 entrypoint |
* +-----------------------+ 0x18
* | cpu2 entrypoint |
* +-----------------------+ 0x10
* | cpu1 entrypoint |
* +-----------------------+ 0x8
* | reserved |
* +-----------------------+ 0x4
* | mailbox ready |
* +-----------------------+ SCU_CPU + 0x780
*/
#define SCU_CPU_BASE 0x12c02000
#define SCU_CPU_SMP_READY (SCU_CPU_BASE + 0x780)
#define SCU_CPU_SMP_EP1 (SCU_CPU_BASE + 0x788)
#define SCU_CPU_SMP_EP2 (SCU_CPU_BASE + 0x790)
#define SCU_CPU_SMP_EP3 (SCU_CPU_BASE + 0x798)
#define SCU_CPU_SMP_POLLINSN (SCU_CPU_BASE + 0x7a0)
ENTRY(lowlevel_init)
/* backup LR */
mov x29, lr
#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
/* reset SMP mailbox ASAP */
ldr x0, =SCU_CPU_SMP_READY
str wzr, [x0]
/*
* get cpu core id
*
* ast2700 has 1-cluster, 4-cores CPU topology.
* Affinity level 0 in MPIDR is sufficient.
*/
mrs x4, mpidr_el1
ands x4, x4, #0xff
/* cpu0 is the primary core to setup SMP mailbox */
beq do_primary_core_setup
/* hold cpuN until mailbox is ready */
ldr x0, =SCU_CPU_SMP_READY
movz w1, #0xcafe
movk w1, #0xbabe, lsl #16
poll_mailbox_ready:
wfe
ldr w2, [x0]
cmp w1, w2
bne poll_mailbox_ready
/*
* parameters for relocated SMP go polling insn.
* x4 = cpu id
* x5 = SCU_CPU_SMP_EPx
*/
add x5, x0, x4, lsl #3
/* jump to the polling loop in SMP mailbox, no return */
ldr x0, =SCU_CPU_SMP_POLLINSN
br x0
do_primary_core_setup:
/* relocate mailbox insn. for cpuN to poll for SMP go signal */
adr x0, smp_mbox_insn
adr x1, smp_mbox_insn_end
ldr x2, =SCU_CPU_SMP_POLLINSN
relocate_smp_mbox_insn:
ldr w3, [x0], #0x4
str w3, [x2], #0x4
cmp x0, x1
bne relocate_smp_mbox_insn
/* reset cpuN entrypoints */
ldr x0, =SCU_CPU_SMP_EP1
str xzr, [x0], #8
str xzr, [x0], #8
str xzr, [x0]
/* notify cpuN that SMP mailbox is ready */
movz w0, #0xcafe
movk w0, #0xbabe, lsl #16
ldr x1, =SCU_CPU_SMP_READY
str w0, [x1]
sev
#endif /* !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT) */
/* back to arch calling code */
mov lr, x29
ret
ENDPROC(lowlevel_init)
/*
* insn. inside mailbox to poll SMP go signal.
*
* Note that this code will be relocated, any absolute
* addressing should NOT be used.
*/
smp_mbox_insn:
/*
* x4 = cpu id
* x5 = SCU_CPU_SMP_EPx
*/
poll_smp_mbox_go:
wfe
ldr x0, [x5]
cmp x0, xzr
beq poll_smp_mbox_go
/* jump to secondary core entrypoint */
br x0
smp_mbox_insn_end:
/* should never reach */
b .

View File

@@ -0,0 +1,64 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) ASPEED Technology Inc.
*/
#include <dm.h>
#include <asm/arch-aspeed/scu_ast2700.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <env.h>
#include <env_internal.h>
DECLARE_GLOBAL_DATA_PTR;
enum env_location env_get_location(enum env_operation op, int prio)
{
enum env_location env_loc = ENVL_UNKNOWN;
u32 strap = readl(ASPEED_IO_HW_STRAP1);
if (prio)
return env_loc;
if (IS_ENABLED(CONFIG_ENV_IS_NOWHERE)) {
env_loc = ENVL_NOWHERE;
} else if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH) &&
!(strap & SCU_IO_HWSTRAP_EMMC)) {
env_loc = ENVL_SPI_FLASH;
} else if (IS_ENABLED(CONFIG_ENV_IS_IN_MMC) &&
(strap & SCU_IO_HWSTRAP_EMMC) &&
!(strap & SCU_IO_HWSTRAP_UFS)) {
env_loc = ENVL_MMC;
} else if (IS_ENABLED(CONFIG_ENV_IS_IN_SPI_FLASH)) {
/*
* This tree does not carry an ENV_IS_IN_UFS backend yet.
* Fall back to SPI flash when that backend exists.
*/
env_loc = ENVL_SPI_FLASH;
} else {
env_loc = ENVL_NOWHERE;
}
return env_loc;
}
int arch_misc_init(void)
{
if (IS_ENABLED(CONFIG_ARCH_MISC_INIT)) {
if ((readl(ASPEED_IO_HW_STRAP1) & SCU_IO_HWSTRAP_EMMC)) {
if ((readl(ASPEED_IO_HW_STRAP1) & SCU_IO_HWSTRAP_UFS))
env_set("boot_device", "ufs");
else
env_set("boot_device", "mmc");
} else {
env_set("boot_device", "spi");
}
if ((readl(ASPEED_IO_HW_STRAP1) & SCU_IO_HWSTRAP_SECBOOT))
env_set("verify", "yes");
else
env_set("verify", "no");
}
return 0;
}

View File

@@ -0,0 +1,22 @@
if ARCH_AXIADO
config SYS_ARCH
default "arm"
config SYS_SOC
default "axiado"
config AXIADO_AX3005
bool
select ARM64
select ARMV8_SWITCH_TO_EL1
select DM
select DM_SERIAL
select GICV3
select ZYNQ_SERIAL
select MMC_SDHCI_AXIADO
select PHY_AXIADO_EMMC
source "arch/arm/mach-axiado/scm3005/Kconfig"
endif

View File

@@ -0,0 +1,6 @@
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (c) 2021-2026 Axiado Corporation (or its affiliates).
#
obj-$(CONFIG_AXIADO_AX3005) += scm3005/

View File

@@ -0,0 +1,11 @@
if AXIADO_AX3005
config TARGET_SCM3005
bool "Support Axiado AX3005 SCM3005"
help
Support for the Axiado AX3005 SCM3005 board.
Based on the Axiado AX3005 quad-core ARMv8 Cortex-A53 SoC.
source "board/axiado/scm3005/Kconfig"
endif

View File

@@ -99,16 +99,16 @@ static void kw_sysrst_action(void)
if (!s) {
debug("Error.. %s failed, check sysrstcmd\n",
__FUNCTION__);
__func__);
return;
}
debug("Starting %s process...\n", __FUNCTION__);
debug("Starting %s process...\n", __func__);
ret = run_command(s, 0);
if (ret != 0)
debug("Error.. %s failed\n", __FUNCTION__);
debug("Error.. %s failed\n", __func__);
else
debug("%s process finished\n", __FUNCTION__);
debug("%s process finished\n", __func__);
}
static void kw_sysrst_check(void)
@@ -152,7 +152,7 @@ int print_cpuinfo(void)
u8 revid = readl(KW_REG_PCIE_REVID) & 0xff;
if ((readl(KW_REG_DEVICE_ID) & 0x03) > 2) {
printf("Error.. %s:Unsupported Kirkwood SoC 88F%04x\n", __FUNCTION__, devid);
printf("Error.. %s:Unsupported Kirkwood SoC 88F%04x\n", __func__, devid);
return -1;
}

View File

@@ -259,9 +259,9 @@ extern void __die_if_kernel(const char *, struct pt_regs *, const char *where,
unsigned long line);
#define die(msg, regs) \
__die(msg, regs, __FILE__ ":"__FUNCTION__, __LINE__)
__die(msg, regs, __FILE__ ":" __func__, __LINE__)
#define die_if_kernel(msg, regs) \
__die_if_kernel(msg, regs, __FILE__ ":"__FUNCTION__, __LINE__)
__die_if_kernel(msg, regs, __FILE__ ":" __func__, __LINE__)
static inline void execution_hazard_barrier(void)
{

View File

@@ -110,7 +110,7 @@ static void setup_fman_liodn_base(enum fsl_dpaa_dev dev,
break;
#endif
default:
printf("Error: Invalid device type to %s\n", __FUNCTION__);
printf("Error: Invalid device type to %s\n", __func__);
return;
}

View File

@@ -111,7 +111,7 @@ void mv_phy_88e1121_init(char *name)
/* command to read PHY dev address */
if (miiphy_read(name, 0xEE, 0xEE, (u16 *) &devadr)) {
printf("Err..%s could not read PHY dev address\n",
__FUNCTION__);
__func__);
return;
}

View File

@@ -0,0 +1,13 @@
if TARGET_EVB_AST2700
config SYS_BOARD
default "evb_ast2700"
config SYS_VENDOR
default "aspeed"
config SYS_CONFIG_NAME
string "board configuration name"
default "evb_ast2700"
endif

View File

@@ -0,0 +1 @@
obj-y += evb_ast2700.o

View File

@@ -0,0 +1,5 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) ASPEED Technology Inc.
*/

View File

@@ -0,0 +1,15 @@
if TARGET_SCM3005
config SYS_BOARD
string
default "scm3005"
config SYS_VENDOR
string
default "axiado"
config SYS_CONFIG_NAME
string
default "ax3005-scm3005"
endif

View File

@@ -0,0 +1,5 @@
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (c) 2021-2026 Axiado Corporation (or its affiliates).
obj-y := scm3005.o

View File

@@ -0,0 +1,128 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2021-2026 Axiado Corporation (or its affiliates).
*/
#include <config.h>
#include <dm.h>
#include <init.h>
#include <asm/global_data.h>
#include <asm/armv8/mmu.h>
#include <asm/io.h>
#include <asm/spin_table.h>
#include <asm/system.h>
#include <fdt_support.h>
DECLARE_GLOBAL_DATA_PTR;
static struct mm_region axiado_ax3005_mem_map[] = {
{ /* Peripherals including UART */
.virt = 0x00000000UL,
.phys = 0x00000000UL,
.size = 0x4A000000UL, /* 0 to 0x4A000000: peripherals */
.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | PTE_BLOCK_NON_SHARE |
PTE_BLOCK_PXN | PTE_BLOCK_UXN },
{ .virt = 0x80000000UL,
.phys = 0x80000000UL,
.size = 0x80000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_INNER_SHARE },
{
0,
}
};
struct mm_region *mem_map = axiado_ax3005_mem_map;
/*
* Accept any FIT configuration name - the board loads a single FIT image
* and the first matching config is used.
*/
int board_fit_config_name_match(const char *name)
{
return 0;
}
/*
* ft_board_setup - restore cpu-release-addr after relocation
*
* arch_fixup_fdt() / spin_table_update_dt() overwrites cpu-release-addr
* with U-Boot's relocated address. Restore the pre-relocation physical
* address so secondary cores spin on the correct location.
*/
int ft_board_setup(void *blob, struct bd_info *bd)
{
int cpus_offset, offset;
const char *prop;
int ret;
u64 cpu_release_addr = (u64)&spin_table_cpu_release_addr - gd->reloc_off;
cpus_offset = fdt_path_offset(blob, "/cpus");
if (cpus_offset < 0)
return 0;
for (offset = fdt_first_subnode(blob, cpus_offset); offset >= 0;
offset = fdt_next_subnode(blob, offset)) {
prop = fdt_getprop(blob, offset, "device_type", NULL);
if (!prop || strcmp(prop, "cpu"))
continue;
prop = fdt_getprop(blob, offset, "enable-method", NULL);
if (!prop || strcmp(prop, "spin-table"))
continue;
ret = fdt_setprop_u64(blob, offset, "cpu-release-addr",
cpu_release_addr);
if (ret) {
printf("WARNING: Failed to restore cpu-release-addr\n");
return ret;
}
}
return 0;
}
/*
* dram_init - DDR is initialized by firmware, just setting size
*/
int dram_init(void)
{
gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE,
CFG_SYS_SDRAM_SIZE);
return 0;
}
/*
* the SOC uses single bank, non-interleaving
*/
int dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = CFG_SYS_SDRAM_SIZE;
return 0;
}
/*
* timer_init - enable the AX3005 platform system timer
*
* CNTFRQ_EL0 is already set by arch/arm/cpu/armv8/start.S using
* CONFIG_COUNTER_FREQUENCY from the defconfig.
*
* SYS_TIMER_CTRL (0x48016000) is the AX3005 system timer control
* register — writing SYS_TIMER_ENABLE starts the counter that feeds
* the ARM generic timer.
*/
int timer_init(void)
{
writel(SYS_TIMER_ENABLE, SYS_TIMER_CTRL);
return 0;
}
int board_init(void)
{
return 0;
}
void reset_cpu(void)
{
/* For later ARM_PSCI_FW or watchdog reset */
}

View File

@@ -135,7 +135,7 @@ static void sc_nand_hwcontrol(struct mtd_info *mtdinfo, int cmd, unsigned int ct
break;
default:
printf("%s: unknown ctrl %#x\n", __FUNCTION__, ctrl);
printf("%s: unknown ctrl %#x\n", __func__, ctrl);
}
if (ctrl & NAND_NCE)

View File

@@ -545,13 +545,13 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
if (banks > MEMORY_BANKS_MAX) {
printf("%s: num banks %d exceeds hardcoded limit %d."
" Recompile with higher MEMORY_BANKS_MAX?\n",
__FUNCTION__, banks, MEMORY_BANKS_MAX);
__func__, banks, MEMORY_BANKS_MAX);
return -1;
}
err = fdt_check_header(blob);
if (err < 0) {
printf("%s: %s\n", __FUNCTION__, fdt_strerror(err));
printf("%s: %s\n", __func__, fdt_strerror(err));
return err;
}
@@ -1497,7 +1497,7 @@ static u64 __of_translate_address(const void *blob, int node_offset,
/* Cound address cells & copy address locally */
bus->count_cells(blob, parent, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, node_offset, NULL));
goto bail;
}
@@ -1524,8 +1524,8 @@ static u64 __of_translate_address(const void *blob, int node_offset,
pbus = of_match_bus(blob, parent);
pbus->count_cells(blob, parent, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
fdt_get_name(blob, node_offset, NULL));
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, node_offset, NULL));
break;
}
@@ -1612,7 +1612,7 @@ int fdt_get_dma_range(const void *blob, int node, phys_addr_t *cpu,
bus_node = of_match_bus(blob, node);
bus_node->count_cells(blob, node, &na, &ns);
if (!OF_CHECK_COUNTS(na, ns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, node, NULL));
return -EINVAL;
goto out;
@@ -1621,7 +1621,7 @@ int fdt_get_dma_range(const void *blob, int node, phys_addr_t *cpu,
bus_node = of_match_bus(blob, parent);
bus_node->count_cells(blob, parent, &pna, &pns);
if (!OF_CHECK_COUNTS(pna, pns)) {
printf("%s: Bad cell count for %s\n", __FUNCTION__,
printf("%s: Bad cell count for %s\n", __func__,
fdt_get_name(blob, parent, NULL));
return -EINVAL;
goto out;

View File

@@ -526,7 +526,7 @@ static void handle_uefi_bootnext(void)
*/
static enum bootmenu_ret bootmenu_show(int uefi, int delay)
{
int cmd_ret;
int cmd_ret = CMD_RET_SUCCESS;
int init = 0;
void *choice = NULL;
char *title = NULL;
@@ -628,7 +628,7 @@ cleanup:
printf(ANSI_CURSOR_POSITION, 1, 1);
}
if (title && command) {
if (title && command && *command) {
debug("Starting entry '%s'\n", title);
free(title);
if (efi_ret == EFI_SUCCESS)

View File

@@ -0,0 +1,74 @@
CONFIG_ARM=y
CONFIG_ARCH_AXIADO=y
CONFIG_POSITION_INDEPENDENT=y
CONFIG_TEXT_BASE=0x80000000
CONFIG_SYS_MONITOR_BASE=0x80000000
CONFIG_SYS_LOAD_ADDR=0x80100000
CONFIG_SYS_MALLOC_F_LEN=0x8000
CONFIG_SYS_MALLOC_LEN=0x20000
CONFIG_SYS_BOOTM_LEN=0x20000000
CONFIG_ENV_SIZE=0x10000
CONFIG_ENV_OFFSET=0x5000
CONFIG_NR_DRAM_BANKS=1
CONFIG_COUNTER_FREQUENCY=1000000000
CONFIG_ARMV8_MULTIENTRY=y
CONFIG_ARMV8_SET_SMPEN=y
CONFIG_ARMV8_SPIN_TABLE=y
CONFIG_SYS_CUSTOM_LDSCRIPT=y
CONFIG_SYS_LDSCRIPT="arch/arm/cpu/armv8/u-boot.lds"
CONFIG_BOOTDELAY=5
CONFIG_FIT=y
CONFIG_OF_BOARD_SETUP=y
CONFIG_USE_PREBOOT=y
CONFIG_DEFAULT_FDT_FILE="ax3005-scm3005.dtb"
# CONFIG_DISPLAY_CPUINFO is not set
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="Axiado> "
CONFIG_AUTOBOOT_KEYED=y
CONFIG_AUTOBOOT_PROMPT="Press \"<Esc><Esc>\" to stop autobooting in %d seconds\n"
CONFIG_AUTOBOOT_STOP_STR="\x1b\x1b"
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=ttyPS3,115200 maxcpus=4 nr_cpus=4 earlycon hugepages=16 root=/dev/ram rw phram.phram=ramrofs,0x80B00000,0x6400000"
CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="bootm ${loadaddr}"
CONFIG_SYS_VENDOR="axiado"
CONFIG_SYS_BOARD="scm3005"
CONFIG_SYS_CONFIG_NAME="ax3005-scm3005"
# CONFIG_CMD_BOOTEFI is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_GO is not set
CONFIG_CMD_NVEDIT_EFI=y
CONFIG_CMD_MEMTEST=y
CONFIG_SYS_ALT_MEMTEST=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DFU=y
CONFIG_CMD_DM=y
CONFIG_CMD_GPT=y
CONFIG_CMD_GPT_RENAME=y
CONFIG_CMD_MMC=y
CONFIG_CMD_PART=y
CONFIG_CMD_TFTPPUT=y
CONFIG_CMD_CACHE=y
CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_OF_CONTROL=y
CONFIG_OF_SEPARATE=y
CONFIG_DEFAULT_DEVICE_TREE="ax3005-scm3005"
CONFIG_MULTI_DTB_FIT=y
# CONFIG_ENV_IS_IN_MMC is not set
CONFIG_DM_MMC=y
# CONFIG_SUPPORT_EMMC_BOOT is not set
CONFIG_MMC_IO_VOLTAGE=y
CONFIG_MMC_UHS_SUPPORT=y
CONFIG_MMC_HS400_SUPPORT=y
CONFIG_TARGET_SCM3005=y
CONFIG_CLK=y
CONFIG_LZMA=y
CONFIG_XZ=y
CONFIG_ZYNQ_SERIAL=y
# CONFIG_AUTO_COMPLETE is not set
# CONFIG_SYS_LONGHELP is not set
# CONFIG_TOOLS_MKEFICAPSULE is not set

View File

@@ -0,0 +1,149 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_POSITION_INDEPENDENT=y
# CONFIG_INIT_SP_RELATIVE is not set
CONFIG_ARM_SMCCC=y
CONFIG_ARCH_ASPEED=y
CONFIG_TEXT_BASE=0x400000000
CONFIG_SYS_MALLOC_LEN=0x2000000
CONFIG_ASPEED_AST2700=y
CONFIG_NR_DRAM_BANKS=1
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x403000000
CONFIG_ENV_SIZE=0x20000
CONFIG_ENV_OFFSET=0x400000
CONFIG_ENV_SECT_SIZE=0x20000
CONFIG_DM_GPIO=y
CONFIG_DEFAULT_DEVICE_TREE="ast2700-evb"
CONFIG_DM_RESET=y
CONFIG_SYS_LOAD_ADDR=0x403000000
CONFIG_DEBUG_UART_BASE=0x14c33b00
CONFIG_DEBUG_UART_CLOCK=1846154
# CONFIG_PSCI_RESET is not set
CONFIG_ARMV8_CRYPTO=y
CONFIG_ENV_ADDR=0x400000
CONFIG_SYS_PCI_64BIT=y
CONFIG_PCI=y
CONFIG_DEBUG_UART=y
CONFIG_SYS_MEMTEST_START=0x403000000
CONFIG_SYS_MEMTEST_END=0x403001000
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
CONFIG_FIT=y
CONFIG_FIT_SIGNATURE=y
# CONFIG_BOOTMETH_EFILOADER is not set
CONFIG_LEGACY_IMAGE_FORMAT=y
CONFIG_USE_BOOTARGS=y
CONFIG_BOOTARGS="console=ttyS12,115200n8 root=/dev/ram rw earlycon"
CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="echo Boot from ${boot_device}; if test ${boot_device} = mmc; then run bootmmc; fi; if test ${boot_device} = spi; then run bootspi; fi; if test ${boot_device} = ufs; then run bootufs; fi;"
CONFIG_SYS_CBSIZE=256
CONFIG_SYS_PBSIZE=276
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_HUSH_PARSER=y
# CONFIG_AUTO_COMPLETE is not set
# CONFIG_CMD_CONSOLE is not set
# CONFIG_CMD_BOOTFLOW is not set
CONFIG_CMD_BOOTZ=y
# CONFIG_BOOTM_PLAN9 is not set
# CONFIG_BOOTM_RTEMS is not set
# CONFIG_BOOTM_VXWORKS is not set
# CONFIG_CMD_BOOTEFI is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_IMI is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_EEPROM=y
CONFIG_CMD_MEMTEST=y
CONFIG_SYS_ALT_MEMTEST=y
# CONFIG_CMD_LZMADEC is not set
# CONFIG_CMD_UNLZ4 is not set
CONFIG_CMD_DFU=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MISC=y
CONFIG_CMD_MMC=y
CONFIG_CMD_PCI=y
CONFIG_CMD_UFS=y
CONFIG_CMD_NCSI=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_MII=y
CONFIG_CMD_PING=y
CONFIG_CMD_CACHE=y
# CONFIG_CMD_EFICONFIG is not set
CONFIG_CMD_TPM=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_EXT4_WRITE=y
# CONFIG_CMD_CYCLIC is not set
CONFIG_DOS_PARTITION=y
CONFIG_EFI_PARTITION=y
CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_ENV_IS_IN_SPI_FLASH=y
CONFIG_ENV_MMC_USE_DT=y
CONFIG_USE_HOSTNAME=y
CONFIG_HOSTNAME="ast2700-evb"
CONFIG_BOOTP_SEND_HOSTNAME=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SYSCON=y
CONFIG_CLK=y
CONFIG_DM_HASH=y
CONFIG_DFU_RAM=y
CONFIG_GPIO_HOG=y
CONFIG_ASPEED_G7_GPIO=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_AST2600=y
# CONFIG_INPUT is not set
CONFIG_DM_MAILBOX=y
CONFIG_I2C_EEPROM=y
CONFIG_SUPPORT_EMMC_BOOT=y
CONFIG_MMC_IO_VOLTAGE=y
CONFIG_MMC_UHS_SUPPORT=y
CONFIG_MMC_HS200_SUPPORT=y
CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_ASPEED=y
CONFIG_MTD=y
CONFIG_SPI_FLASH=y
CONFIG_DM_MDIO=y
CONFIG_FTGMAC100=y
CONFIG_ASPEED_MDIO=y
CONFIG_PHY_BROADCOM=y
CONFIG_PHY_AIROHA=y
CONFIG_PHY_REALTEK=y
CONFIG_PHY_TI_DP83867=y
CONFIG_PHY_NCSI=y
CONFIG_DM_PCI_COMPAT=y
CONFIG_PCI_CONFIG_HOST_BRIDGE=y
CONFIG_PHY=y
CONFIG_PINCTRL=y
CONFIG_DM_REGULATOR=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_GPIO=y
CONFIG_RAM=y
CONFIG_SCSI=y
CONFIG_DM_SERIAL=y
CONFIG_DEBUG_UART_SHIFT=2
CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
CONFIG_SPI_ASPEED_SMC=y
CONFIG_SYSRESET=y
# CONFIG_TPM_V1 is not set
CONFIG_TPM2_TIS_SPI=y
CONFIG_USB=y
CONFIG_DM_USB_GADGET=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MANUFACTURER="ASPEED"
CONFIG_USB_GADGET_VENDOR_NUM=0x2245
CONFIG_USB_GADGET_PRODUCT_NUM=0x2700
CONFIG_USB_GADGET_OS_DESCRIPTORS=y
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_UFS=y
# CONFIG_WATCHDOG_AUTOSTART is not set
CONFIG_WDT=y
# CONFIG_WDT_ASPEED is not set
CONFIG_ECDSA=y
CONFIG_ECDSA_VERIFY=y
CONFIG_TPM=y
CONFIG_LZ4=y
CONFIG_LZMA=y
# CONFIG_TOOLS_MKEFICAPSULE is not set

View File

@@ -52,6 +52,7 @@ CONFIG_AHCI=y
CONFIG_AHCI_PCI=y
CONFIG_DWC_AHCI=y
CONFIG_SPL_CLK=y
CONFIG_CLK_GPIO=y
# CONFIG_USB_FUNCTION_FASTBOOT is not set
CONFIG_ROCKCHIP_GPIO=y
CONFIG_SYS_I2C_ROCKCHIP=y

View File

@@ -5,3 +5,4 @@
obj-$(CONFIG_ASPEED_AST2500) += clk_ast2500.o
obj-$(CONFIG_ASPEED_AST2600) += clk_ast2600.o
obj-$(CONFIG_ASPEED_AST2700) += clk_ast2700.o

View File

@@ -0,0 +1,952 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) ASPEED Technology Inc.
*/
#include <asm/io.h>
#include <asm/arch/scu_ast2700.h>
#include <clk-uclass.h>
#include <dm.h>
#include <dm/lists.h>
#include <syscon.h>
#include <linux/bitfield.h>
#include <dt-bindings/clock/aspeed,ast2700-scu.h>
DECLARE_GLOBAL_DATA_PTR;
/**
* RGMII clock source tree
* HPLL -->|\
* | |---->| divider |---->RGMII 125M for MAC#0 & MAC#1
* APLL -->|/
*/
#define RGMII_DEFAULT_CLK_SRC SCU1_CLK_HPLL
struct mac_delay_config {
u32 tx_delay_1000;
u32 rx_delay_1000;
u32 tx_delay_100;
u32 rx_delay_100;
u32 tx_delay_10;
u32 rx_delay_10;
};
typedef int (*ast2700_clk_init_fn)(struct udevice *dev);
struct ast2700_clk_priv {
void __iomem *reg;
ast2700_clk_init_fn init;
};
static u32 ast2700_soc1_get_pll_rate(struct ast2700_scu1 *scu, int pll_idx)
{
union ast2700_pll_reg pll_reg;
u32 mul = 1, div = 1;
switch (pll_idx) {
case SCU1_CLK_HPLL:
pll_reg.w = readl(&scu->hpll);
break;
case SCU1_CLK_APLL:
pll_reg.w = readl(&scu->apll);
break;
case SCU1_CLK_DPLL:
pll_reg.w = readl(&scu->dpll);
break;
}
if (!pll_reg.b.bypass) {
mul = (pll_reg.b.m + 1) / (pll_reg.b.n + 1);
div = (pll_reg.b.p + 1);
}
return ((CLKIN_25M * mul) / div);
}
#define SCU_CLKSEL2_HCLK_DIV_MASK GENMASK(22, 20)
#define SCU_CLKSEL2_HCLK_DIV_SHIFT 20
static u32 ast2700_soc1_get_hclk_rate(struct ast2700_scu1 *scu)
{
u32 rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
u32 clk_sel2 = readl(&scu->clk_sel2);
u32 hclk_div = (clk_sel2 & SCU_CLKSEL2_HCLK_DIV_MASK) >>
SCU_CLKSEL2_HCLK_DIV_SHIFT;
if (!hclk_div)
hclk_div = 2;
else
hclk_div++;
return (rate / hclk_div);
}
#define SCU1_CLKSEL1_PCLK_DIV_MASK GENMASK(20, 18)
#define SCU1_CLKSEL1_PCLK_DIV_SHIFT 18
static u32 ast2700_soc1_get_pclk_rate(struct ast2700_scu1 *scu)
{
u32 rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
u32 clk_sel1 = readl(&scu->clk_sel1);
u32 pclk_div = (clk_sel1 & SCU1_CLKSEL1_PCLK_DIV_MASK) >>
SCU1_CLKSEL1_PCLK_DIV_SHIFT;
return (rate / ((pclk_div + 1) * 2));
}
#define SCU_UART_CLKGEN_N_MASK GENMASK(17, 8)
#define SCU_UART_CLKGEN_N_SHIFT 8
#define SCU_UART_CLKGEN_R_MASK GENMASK(7, 0)
#define SCU_UART_CLKGEN_R_SHIFT 0
static u32 ast2700_soc1_get_uart_uxclk_rate(struct ast2700_scu1 *scu)
{
u32 uxclk_sel = readl(&scu->clk_sel2) & GENMASK(1, 0);
u32 uxclk_ctrl = readl(&scu->uxclk_ctrl);
u32 rate;
switch (uxclk_sel) {
case 0:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_APLL) / 4;
break;
case 1:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_APLL) / 2;
break;
case 2:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_APLL);
break;
case 3:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
break;
}
u32 n = (uxclk_ctrl & SCU_UART_CLKGEN_N_MASK) >>
SCU_UART_CLKGEN_N_SHIFT;
u32 r = (uxclk_ctrl & SCU_UART_CLKGEN_R_MASK) >>
SCU_UART_CLKGEN_R_SHIFT;
return ((rate * r) / (n * 2));
}
#define SCU_HUART_CLKGEN_N_MASK GENMASK(17, 8)
#define SCU_HUART_CLKGEN_N_SHIFT 8
#define SCU_HUART_CLKGEN_R_MASK GENMASK(7, 0)
#define SCU_HUART_CLKGEN_R_SHIFT 0
static u32 ast2700_soc1_get_uart_huxclk_rate(struct ast2700_scu1 *scu)
{
u32 huxclk_sel = (readl(&scu->clk_sel2) & GENMASK(4, 3)) >> 3;
u32 huxclk_ctrl = readl(&scu->huxclk_ctrl);
u32 n = (huxclk_ctrl & SCU_HUART_CLKGEN_N_MASK) >>
SCU_HUART_CLKGEN_N_SHIFT;
u32 r = (huxclk_ctrl & SCU_HUART_CLKGEN_R_MASK) >>
SCU_HUART_CLKGEN_R_SHIFT;
u32 rate;
switch (huxclk_sel) {
case 0:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_APLL) / 4;
break;
case 1:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_APLL) / 2;
break;
case 2:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_APLL);
break;
case 3:
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
break;
}
return ((rate * r) / (n * 2));
}
#define SCU_CLKSRC1_SDIO_DIV_MASK GENMASK(16, 14)
#define SCU_CLKSRC1_SDIO_DIV_SHIFT 14
#define SCU_CLKSRC1_SDIO_SEL BIT(13)
const int ast2700_sd_div_tbl[] = {
2, 2, 3, 4, 5, 6, 7, 8
};
static u32 ast2700_soc1_get_sdio_clk_rate(struct ast2700_scu1 *scu)
{
u32 rate = 0;
u32 clk_sel1 = readl(&scu->clk_sel1);
u32 div = (clk_sel1 & SCU_CLKSRC1_SDIO_DIV_MASK) >>
SCU_CLKSRC1_SDIO_DIV_SHIFT;
if (clk_sel1 & SCU_CLKSRC1_SDIO_SEL)
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_APLL);
else
rate = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
if (!div)
div = 1;
div++;
return (rate / div);
}
static void ast2700_init_sdclk(struct ast2700_scu1 *scu)
{
u32 src_clk = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
u32 reg_280;
int i;
for (i = 0; i < 8; i++) {
if (src_clk / ast2700_sd_div_tbl[i] <= 125000000)
break;
}
reg_280 = readl(&scu->clk_sel1);
reg_280 &= ~(SCU_CLKSRC1_SDIO_DIV_MASK | SCU_CLKSRC1_SDIO_SEL);
reg_280 |= i << SCU_CLKSRC1_SDIO_DIV_SHIFT;
writel(reg_280, &scu->clk_sel1);
}
static u32
ast2700_soc1_get_uart_clk_rate(struct ast2700_scu1 *scu, int uart_idx)
{
u32 rate = 0;
if (readl(&scu->clk_sel1) & BIT(uart_idx))
rate = ast2700_soc1_get_uart_huxclk_rate(scu);
else
rate = ast2700_soc1_get_uart_uxclk_rate(scu);
return rate;
}
static ulong ast2700_soc1_clk_get_rate(struct clk *clk)
{
struct ast2700_clk_priv *priv = dev_get_priv(clk->dev);
struct ast2700_scu1 *scu = (struct ast2700_scu1 *)priv->reg;
ulong rate = 0;
switch (clk->id) {
case SCU1_CLK_HPLL:
case SCU1_CLK_APLL:
case SCU1_CLK_DPLL:
rate = ast2700_soc1_get_pll_rate(scu, clk->id);
break;
case SCU1_CLK_AHB:
rate = ast2700_soc1_get_hclk_rate(scu);
break;
case SCU1_CLK_APB:
rate = ast2700_soc1_get_pclk_rate(scu);
break;
case SCU1_CLK_GATE_UART0CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 0);
break;
case SCU1_CLK_GATE_UART1CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 1);
break;
case SCU1_CLK_GATE_UART2CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 2);
break;
case SCU1_CLK_GATE_UART3CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 3);
break;
case SCU1_CLK_GATE_UART5CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 5);
break;
case SCU1_CLK_GATE_UART6CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 6);
break;
case SCU1_CLK_GATE_UART7CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 7);
break;
case SCU1_CLK_GATE_UART8CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 8);
break;
case SCU1_CLK_GATE_UART9CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 9);
break;
case SCU1_CLK_GATE_UART10CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 10);
break;
case SCU1_CLK_GATE_UART11CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 11);
break;
case SCU1_CLK_GATE_UART12CLK:
rate = ast2700_soc1_get_uart_clk_rate(scu, 12);
break;
case SCU1_CLK_GATE_SDCLK:
rate = ast2700_soc1_get_sdio_clk_rate(scu);
break;
case SCU1_CLK_UXCLK:
rate = ast2700_soc1_get_uart_uxclk_rate(scu);
break;
case SCU1_CLK_HUXCLK:
rate = ast2700_soc1_get_uart_huxclk_rate(scu);
break;
default:
debug("%s: unknown clk %ld\n", __func__, clk->id);
return -ENOENT;
}
return rate;
}
static int ast2700_soc1_clk_enable(struct clk *clk)
{
struct ast2700_clk_priv *priv = dev_get_priv(clk->dev);
struct ast2700_scu1 *scu = (struct ast2700_scu1 *)priv->reg;
u32 clkgate_bit;
if (clk->id >= 32)
clkgate_bit = BIT(clk->id - 32);
else
clkgate_bit = BIT(clk->id);
writel(clkgate_bit, &scu->clkgate_clr1);
return 0;
}
static const struct clk_ops ast2700_soc1_clk_ops = {
.get_rate = ast2700_soc1_clk_get_rate,
.enable = ast2700_soc1_clk_enable,
};
#define SCU_HW_REVISION_ID GENMASK(23, 16)
#define SCU_CPUCLK_MASK GENMASK(4, 2)
#define SCU_CPUCLK_SHIFT 2
static u32 ast2700_soc0_get_hpll_rate(struct ast2700_scu0 *scu)
{
u32 chip_id1 = readl(&scu->chip_id1);
u32 hwstrap1 = readl(&scu->hwstrap1);
union ast2700_pll_reg pll_reg;
u32 mul = 1, div = 1;
u32 rate;
pll_reg.w = readl(&scu->hpll);
if ((chip_id1 & SCU_HW_REVISION_ID) && (hwstrap1 & BIT(3))) {
switch ((hwstrap1 & GENMASK(4, 2)) >> 2) {
case 2:
rate = 1800000000;
break;
case 3:
rate = 1700000000;
break;
case 6:
rate = 1200000000;
break;
case 7:
rate = 800000000;
break;
default:
rate = 1600000000;
}
} else if (hwstrap1 & GENMASK(3, 2)) {
switch ((hwstrap1 & GENMASK(3, 2)) >> 2) {
case 1U:
rate = 1900000000;
break;
case 2U:
rate = 1800000000;
break;
case 3U:
rate = 1700000000;
break;
default:
rate = 1600000000;
break;
}
} else {
if (pll_reg.b.bypass == 0U) {
/* F = 25Mhz * [(M + 2) / 2 * (n + 1)] / (p + 1) */
mul = (pll_reg.b.m + 1) / ((pll_reg.b.n + 1) * 2);
div = (pll_reg.b.p + 1);
}
rate = ((CLKIN_25M * mul) / div);
}
return rate;
}
static u32 ast2700_soc0_get_pll_rate(struct ast2700_scu0 *scu, int pll_idx)
{
union ast2700_pll_reg pll_reg;
u32 mul = 1, div = 1;
u32 rate;
switch (pll_idx) {
case SCU0_CLK_DPLL:
pll_reg.w = readl(&scu->dpll);
break;
case SCU0_CLK_MPLL:
pll_reg.w = readl(&scu->mpll);
break;
default:
pr_err("%s: invalid PSP clock source (%d)\n", __func__, pll_idx);
return 0;
}
if (pll_reg.b.bypass == 0U) {
if (pll_idx == SCU0_CLK_MPLL) {
/* F = 25Mhz * [M / (n + 1)] / (p + 1) */
mul = (pll_reg.b.m) / ((pll_reg.b.n + 1));
div = (pll_reg.b.p + 1);
} else {
/* F = 25Mhz * [(M + 2) / 2 * (n + 1)] / (p + 1) */
mul = (pll_reg.b.m + 1) / ((pll_reg.b.n + 1) * 2);
div = (pll_reg.b.p + 1);
}
}
rate = ((CLKIN_25M * mul) / div);
return rate;
}
/*
* AST2700A1
* SCU010[4:2]:
* 000: CPUCLK=MPLL=1.6GHz (MPLL default setting with SCU310, SCU314)
* 001: CPUCLK=HPLL=2.0GHz (HPLL default setting with SCU300, SCU304)
* 010: CPUCLK=HPLL=1.8GHz (HPLL frequency is constance and is not controlled by SCU300, SCU304)
* 011: CPUCLK=HPLL=1.7GHz (HPLL frequency is constance and is not controlled by SCU300, SCU304)
* 100: CPUCLK=MPLL/2=800MHz (MPLL default setting with SCU310, SCU314)
* 101: CPUCLK=HPLL/2=1.0GHz (HPLL default setting with SCU300, SCU304)
* 110: CPUCLK=HPLL=1.2GHz (HPLL frequency is constance and is not controlled by SCU300, SCU304)
* 111: CPUCLK=HPLL=800MHz (HPLL frequency is constance and is not controlled by SCU300, SCU304)
*/
static u32 ast2700_soc0_get_pspclk_rate(struct ast2700_scu0 *scu)
{
u32 chip_id1 = readl(&scu->chip_id1);
u32 hwstrap1 = readl(&scu->hwstrap1);
u32 rate;
int cpuclk_set;
if (chip_id1 & SCU_HW_REVISION_ID) {
cpuclk_set = (hwstrap1 & SCU_CPUCLK_MASK) >> SCU_CPUCLK_SHIFT;
switch (cpuclk_set) {
case 0:
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL);
break;
case 1:
case 2:
case 3:
case 6:
case 7:
rate = ast2700_soc0_get_hpll_rate(scu);
break;
case 4:
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL) / 2;
break;
case 5:
rate = ast2700_soc0_get_hpll_rate(scu) / 2;
break;
default:
rate = ast2700_soc0_get_hpll_rate(scu);
break;
}
} else {
if (hwstrap1 & BIT(4))
rate = ast2700_soc0_get_hpll_rate(scu);
else
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL);
}
return rate;
}
static u32 ast2700_soc0_get_axi0clk_rate(struct ast2700_scu0 *scu)
{
return ast2700_soc0_get_pspclk_rate(scu) / 2;
}
#define SCU_AHB_DIV_MASK GENMASK(6, 5)
#define SCU_AHB_DIV_SHIFT 5
static u32 hclk_ast2700a1_div_table[] = {
6, 5, 4, 7,
};
static u32 ast2700_soc0_get_hclk_rate(struct ast2700_scu0 *scu)
{
u32 hwstrap1 = readl(&scu->hwstrap1);
u32 chip_id1 = readl(&scu->chip_id1);
u32 src_clk;
int div;
if (chip_id1 & SCU_HW_REVISION_ID) {
if (hwstrap1 & BIT(7))
src_clk = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL);
else
src_clk = ast2700_soc0_get_hpll_rate(scu);
div = (hwstrap1 & SCU_AHB_DIV_MASK) >> SCU_AHB_DIV_SHIFT;
div = hclk_ast2700a1_div_table[div];
} else {
if (hwstrap1 & BIT(7))
src_clk = ast2700_soc0_get_hpll_rate(scu);
else
src_clk = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL);
div = (hwstrap1 & SCU_AHB_DIV_MASK) >> SCU_AHB_DIV_SHIFT;
if (!div)
div = 4;
else
div = (div + 1) * 2;
}
return (src_clk / div);
}
static u32 ast2700_soc0_get_axi1clk_rate(struct ast2700_scu0 *scu)
{
if (readl(&scu->chip_id1) & SCU_HW_REVISION_ID)
return ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL) / 4;
else
return ast2700_soc0_get_hclk_rate(scu);
}
#define SCU0_CLKSEL1_PCLK_DIV_MASK GENMASK(25, 23)
#define SCU0_CLKSEL1_PCLK_DIV_SHIFT 23
static u32 ast2700_soc0_get_pclk_rate(struct ast2700_scu0 *scu)
{
u32 rate = ast2700_soc0_get_axi0clk_rate(scu);
u32 clksel1 = readl(&scu->clk_sel1);
int div;
div = (clksel1 & SCU0_CLKSEL1_PCLK_DIV_MASK) >>
SCU0_CLKSEL1_PCLK_DIV_SHIFT;
return (rate / ((div + 1) * 2));
}
#define SCU_CLKSEL1_MPHYCLK_SEL_MASK GENMASK(19, 18)
#define SCU_CLKSEL1_MPHYCLK_SEL_SHIFT 18
#define SCU_CLKSEL1_MPHYCLK_DIV_MASK GENMASK(7, 0)
static u32 ast2700_soc0_get_mphyclk_rate(struct ast2700_scu0 *scu)
{
int div = readl(&scu->mphyclk_para) & SCU_CLKSEL1_MPHYCLK_DIV_MASK;
u32 chip_id1 = readl(&scu->chip_id1);
u32 clk_sel2;
int clk_sel;
u32 rate = 0;
if (chip_id1 & SCU_HW_REVISION_ID) {
clk_sel2 = readl(&scu->clk_sel2);
clk_sel = (clk_sel2 & SCU_CLKSEL1_MPHYCLK_SEL_MASK)
>> SCU_CLKSEL1_MPHYCLK_SEL_SHIFT;
switch (clk_sel) {
case 0:
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL);
break;
case 1:
rate = ast2700_soc0_get_hpll_rate(scu);
break;
case 2:
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_DPLL);
break;
case 3:
rate = 26000000;
break;
}
} else {
rate = ast2700_soc0_get_hpll_rate(scu);
}
return (rate / (div + 1));
}
static void ast2700_mphy_clk_init(struct ast2700_scu0 *scu)
{
u32 clksrc1, rate = 0;
int i;
/* set mphy clk */
if (readl(&scu->chip_id1) & SCU_HW_REVISION_ID) {
clksrc1 = (readl(&scu->clk_sel2) & SCU_CLKSEL1_MPHYCLK_SEL_MASK)
>> SCU_CLKSEL1_MPHYCLK_SEL_SHIFT;
switch (clksrc1) {
case 0:
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL);
break;
case 1:
rate = ast2700_soc0_get_hpll_rate(scu);
break;
case 2:
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_DPLL);
break;
case 3:
rate = 26000000;
break;
}
} else {
rate = ast2700_soc0_get_hpll_rate(scu);
}
for (i = 1; i < 256; i++) {
if ((rate / i) <= 26000000)
break;
}
/* register defined the value plus 1 is divider*/
i--;
writel(i, &scu->mphyclk_para);
}
#define SCU_CLKSRC1_EMMC_DIV_MASK GENMASK(14, 12)
#define SCU_CLKSRC1_EMMC_DIV_SHIFT 12
#define SCU_CLKSRC1_EMMC_SEL BIT(11)
static u32 ast2700_soc0_get_emmcclk_rate(struct ast2700_scu0 *scu)
{
u32 clksel1 = readl(&scu->clk_sel1);
u32 rate;
int div;
div = (clksel1 & SCU_CLKSRC1_EMMC_DIV_MASK) >> SCU_CLKSRC1_EMMC_DIV_SHIFT;
if (clksel1 & SCU_CLKSRC1_EMMC_SEL)
rate = ast2700_soc0_get_hpll_rate(scu) / 4;
else
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL) / 4;
return (rate / ((div + 1) * 2));
}
static void ast2700_emmc_init(struct ast2700_scu0 *scu)
{
u32 clksrc1, rate, div;
int i;
/* set clk/cmd driving */
writel(2, &scu->gpio18d0_ioctrl); /* clk driving */
writel(1, &scu->gpio18d1_ioctrl); /* cmd driving */
writel(1, &scu->gpio18d2_ioctrl); /* data0 driving */
writel(1, &scu->gpio18d3_ioctrl); /* data1 driving */
writel(1, &scu->gpio18d4_ioctrl); /* data2 driving */
writel(1, &scu->gpio18d5_ioctrl); /* data2 driving */
/* emmc clk: set clk src mpll/4:400Mhz */
clksrc1 = readl(&scu->clk_sel1);
rate = ast2700_soc0_get_pll_rate(scu, SCU0_CLK_MPLL) / 4;
for (i = 0; i < 8; i++) {
div = (i + 1) * 2;
if ((rate / div) <= 200000000)
break;
}
clksrc1 &= ~(SCU_CLKSRC1_EMMC_DIV_MASK | SCU_CLKSRC1_EMMC_SEL);
clksrc1 |= (i << SCU_CLKSRC1_EMMC_DIV_SHIFT);
writel(clksrc1, &scu->clk_sel1);
}
static void ast2700_vga_clk_init(struct ast2700_scu0 *scu)
{
if ((readl(&scu->chip_id1) & SCU_HW_REVISION_ID) == 0)
return;
// Use d0clk/d1clk which generated from hpll for vga0/1 after A0
// Use CRT1clk as soc display source
setbits_le32(&scu->clk_sel3, BIT(14) | BIT(13) | BIT(12));
}
static u32 ast2700_soc0_get_uartclk_rate(struct ast2700_scu0 *scu)
{
u32 clksel2 = readl(&scu->clk_sel2);
u32 div = 1;
u32 rate;
if (clksel2 & BIT(15))
rate = 192000000;
else
rate = 24000000;
if (clksel2 & BIT(30))
div = 13;
return (rate / div);
}
static ulong ast2700_soc0_clk_get_rate(struct clk *clk)
{
struct ast2700_clk_priv *priv = dev_get_priv(clk->dev);
ulong rate = 0;
switch (clk->id) {
case SCU0_CLK_PSP:
rate = ast2700_soc0_get_pspclk_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_HPLL:
rate = ast2700_soc0_get_hpll_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_DPLL:
case SCU0_CLK_MPLL:
rate = ast2700_soc0_get_pll_rate((struct ast2700_scu0 *)priv->reg, clk->id);
break;
case SCU0_CLK_AXI0:
rate = ast2700_soc0_get_axi0clk_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_AXI1:
rate = ast2700_soc0_get_axi1clk_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_AHB:
rate = ast2700_soc0_get_hclk_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_APB:
rate = ast2700_soc0_get_pclk_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_GATE_EMMCCLK:
rate = ast2700_soc0_get_emmcclk_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_GATE_UART4CLK:
rate = ast2700_soc0_get_uartclk_rate((struct ast2700_scu0 *)priv->reg);
break;
case SCU0_CLK_MPHY:
rate = ast2700_soc0_get_mphyclk_rate((struct ast2700_scu0 *)priv->reg);
break;
default:
debug("%s: unknown clk %ld\n", __func__, clk->id);
return -ENOENT;
}
return rate;
}
static int ast2700_soc0_clk_enable(struct clk *clk)
{
struct ast2700_clk_priv *priv = dev_get_priv(clk->dev);
struct ast2700_scu0 *scu = (struct ast2700_scu0 *)priv->reg;
u32 clkgate_bit = BIT(clk->id);
writel(clkgate_bit, &scu->clkgate_clr);
return 0;
}
static const struct clk_ops ast2700_soc0_clk_ops = {
.get_rate = ast2700_soc0_clk_get_rate,
.enable = ast2700_soc0_clk_enable,
};
static void ast2700_init_mac_clk(struct ast2700_scu1 *scu)
{
u32 src_clk = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
u32 reg_280;
u8 div_idx;
/* The MAC source clock selects HPLL only, and the default clock
* setting is 200 Mhz.
* Calculate the corresponding divider:
* 1: div 2
* 2: div 3
* ...
* 7: div 8
*/
for (div_idx = 1; div_idx <= 7; div_idx++)
if (DIV_ROUND_UP(src_clk, div_idx + 1) == 200000000)
break;
if (div_idx == 8) {
pr_err("MAC clock cannot divide to 200 MHz\n");
return;
}
/* set HPLL clock divider */
reg_280 = readl(&scu->clk_sel1);
reg_280 &= ~GENMASK(31, 29);
reg_280 |= div_idx << 29;
writel(reg_280, &scu->clk_sel1);
}
static void ast2700_init_rgmii_clk(struct ast2700_scu1 *scu)
{
u32 reg_284 = readl(&scu->clk_sel2);
u32 src_clk = ast2700_soc1_get_pll_rate(scu, RGMII_DEFAULT_CLK_SRC);
if (RGMII_DEFAULT_CLK_SRC == SCU1_CLK_HPLL) {
u32 reg_280;
u8 div_idx;
/* Calculate the corresponding divider:
* 1: div 4
* 2: div 6
* ...
* 7: div 16
*/
for (div_idx = 1; div_idx <= 7; div_idx++) {
u8 div = 4 + 2 * (div_idx - 1);
if (DIV_ROUND_UP(src_clk, div) == 125000000)
break;
}
if (div_idx == 8) {
pr_err("RGMII using HPLL cannot divide to 125 MHz\n");
return;
}
/* set HPLL clock divider */
reg_280 = readl(&scu->clk_sel1);
reg_280 &= ~GENMASK(27, 25);
reg_280 |= div_idx << 25;
writel(reg_280, &scu->clk_sel1);
/* select HPLL clock source */
reg_284 &= ~BIT(18);
} else {
/* APLL clock divider is fixed to 8 */
if (DIV_ROUND_UP(src_clk, 8) != 125000000) {
pr_err("RGMII using APLL cannot divide to 125 MHz\n");
return;
}
/* select APLL clock source */
reg_284 |= BIT(18);
}
writel(reg_284, &scu->clk_sel2);
}
static void ast2700_init_rmii_clk(struct ast2700_scu1 *scu)
{
u32 src_clk = ast2700_soc1_get_pll_rate(scu, SCU1_CLK_HPLL);
u32 reg_280;
u8 div_idx;
/* The RMII source clock selects HPLL only.
* Calculate the corresponding divider:
* 1: div 8
* 2: div 12
* ...
* 7: div 32
*/
for (div_idx = 1; div_idx <= 7; div_idx++) {
u8 div = 8 + 4 * (div_idx - 1);
if (DIV_ROUND_UP(src_clk, div) == 50000000)
break;
}
if (div_idx == 8) {
pr_err("RMII using HPLL cannot divide to 50 MHz\n");
return;
}
/* set RMII clock divider */
reg_280 = readl(&scu->clk_sel1);
reg_280 &= ~GENMASK(23, 21);
reg_280 |= div_idx << 21;
writel(reg_280, &scu->clk_sel1);
}
static void ast2700_init_spi(struct ast2700_scu1 *scu)
{
writel(readl(&scu->io_driving8) | 0x0000aaaa, &scu->io_driving8); /* fwspi driving */
writel(readl(&scu->io_driving3) | 0x00000aaa, &scu->io_driving3); /* spi0 driving */
writel(readl(&scu->io_driving3) | 0x0aaa0000, &scu->io_driving3); /* spi1 driving */
writel(readl(&scu->io_driving4) | 0x00002aaa, &scu->io_driving4); /* spi2 driving */
}
#define SCU1_CLK_I3C_DIV_MASK GENMASK(25, 23)
#define SCU1_CLK_I3C_DIV(n) ((n) - 1)
static void ast2700_init_i3c_clk(struct ast2700_scu1 *scu)
{
u32 reg_284;
/* I3C 250MHz = HPLL/4 */
reg_284 = readl(&scu->clk_sel2);
reg_284 &= ~SCU1_CLK_I3C_DIV_MASK;
reg_284 |= FIELD_PREP(SCU1_CLK_I3C_DIV_MASK, SCU1_CLK_I3C_DIV(4));
writel(reg_284, &scu->clk_sel2);
}
static int ast2700_clk1_init(struct udevice *dev)
{
struct ast2700_clk_priv *priv = dev_get_priv(dev);
struct ast2700_scu1 *scu = (struct ast2700_scu1 *)priv->reg;
ast2700_init_spi(scu);
ast2700_init_mac_clk(scu);
ast2700_init_rgmii_clk(scu);
ast2700_init_rmii_clk(scu);
ast2700_init_sdclk(scu);
ast2700_init_i3c_clk(scu);
return 0;
}
static int ast2700_clk0_init(struct udevice *dev)
{
struct ast2700_clk_priv *priv = dev_get_priv(dev);
struct ast2700_scu0 *scu = (struct ast2700_scu0 *)priv->reg;
ast2700_emmc_init(scu);
ast2700_mphy_clk_init(scu);
ast2700_vga_clk_init(scu);
return 0;
}
static int ast2700_clk_probe(struct udevice *dev)
{
struct ast2700_clk_priv *priv = dev_get_priv(dev);
priv->init = (ast2700_clk_init_fn)dev_get_driver_data(dev);
priv->reg = (void __iomem *)dev_read_addr_ptr(dev);
if (priv->init)
return priv->init(dev);
return 0;
}
static int ast2700_clk_bind(struct udevice *dev)
{
struct udevice *sysreset_dev, *rst_dev;
int ret;
/* The system reset driver does not have a device node, so bind it here */
ret = device_bind_driver(gd->dm_root, "ast_sysreset", "reset", &sysreset_dev);
if (ret)
debug("Warning: No sysreset driver: ret = %d\n", ret);
/* Bind the per-SCU reset controller to the same ofnode so that
* <&syscon0/1 RESET_X> phandle references resolve to a UCLASS_RESET
* device. This pairs with the airoha-style binding pattern.
*/
if (CONFIG_IS_ENABLED(RESET_AST2700)) {
ret = device_bind_driver_to_node(dev, "ast2700_reset", "reset",
dev_ofnode(dev), &rst_dev);
if (ret)
debug("Warning: failed to bind reset controller: ret = %d\n", ret);
}
return 0;
}
static const struct udevice_id ast2700_soc1_clk_ids[] = {
{ .compatible = "aspeed,ast2700-scu1", .data = (ulong)&ast2700_clk1_init },
{ },
};
U_BOOT_DRIVER(aspeed_ast2700_soc1_clk) = {
.name = "aspeed_ast2700_scu1",
.id = UCLASS_CLK,
.of_match = ast2700_soc1_clk_ids,
.priv_auto = sizeof(struct ast2700_clk_priv),
.ops = &ast2700_soc1_clk_ops,
.probe = ast2700_clk_probe,
.bind = ast2700_clk_bind,
};
static const struct udevice_id ast2700_soc0_clk_ids[] = {
{ .compatible = "aspeed,ast2700-scu0", .data = (ulong)&ast2700_clk0_init },
{ },
};
U_BOOT_DRIVER(aspeed_ast2700_soc0_clk) = {
.name = "aspeed_ast2700_scu0",
.id = UCLASS_CLK,
.of_match = ast2700_soc0_clk_ids,
.priv_auto = sizeof(struct ast2700_clk_priv),
.ops = &ast2700_soc0_clk_ops,
.probe = ast2700_clk_probe,
.bind = ast2700_clk_bind,
};

View File

@@ -6,6 +6,7 @@
#include <clk.h>
#include <clk-uclass.h>
#include <dm.h>
#include <power/regulator.h>
#include <linux/clk-provider.h>
#include <asm/gpio.h>
@@ -13,14 +14,18 @@
struct clk_gpio_priv {
struct gpio_desc enable; /* GPIO, controlling the gate */
struct clk *clk; /* Gated clock */
struct udevice *vdd_supply;
};
static int clk_gpio_enable(struct clk *clk)
{
struct clk_gpio_priv *priv = dev_get_priv(clk->dev);
clk_enable(priv->clk);
dm_gpio_set_value(&priv->enable, 1);
if (priv->clk)
clk_enable(priv->clk);
if (priv->enable.dev)
dm_gpio_set_value(&priv->enable, 1);
return 0;
}
@@ -29,8 +34,11 @@ static int clk_gpio_disable(struct clk *clk)
{
struct clk_gpio_priv *priv = dev_get_priv(clk->dev);
dm_gpio_set_value(&priv->enable, 0);
clk_disable(priv->clk);
if (priv->enable.dev)
dm_gpio_set_value(&priv->enable, 0);
if (priv->clk)
clk_disable(priv->clk);
return 0;
}
@@ -39,7 +47,7 @@ static ulong clk_gpio_get_rate(struct clk *clk)
{
struct clk_gpio_priv *priv = dev_get_priv(clk->dev);
return clk_get_rate(priv->clk);
return (priv->clk) ? clk_get_rate(priv->clk) : -1;
}
const struct clk_ops clk_gpio_ops = {
@@ -57,7 +65,7 @@ static int clk_gpio_probe(struct udevice *dev)
if (IS_ERR(priv->clk)) {
log_debug("%s: Could not get gated clock: %ld\n",
__func__, PTR_ERR(priv->clk));
return PTR_ERR(priv->clk);
priv->clk = 0;
}
ret = gpio_request_by_name(dev, "enable-gpios", 0,
@@ -65,9 +73,15 @@ static int clk_gpio_probe(struct udevice *dev)
if (ret) {
log_debug("%s: Could not decode enable-gpios (%d)\n",
__func__, ret);
return ret;
}
ret = device_get_supply_regulator(dev, "vdd-supply",
&priv->vdd_supply);
if (ret == 0)
ret = regulator_set_enable(priv->vdd_supply, true);
log_debug("%s: %s regulator = %d\n", __func__, dev->name, ret);
return 0;
}
@@ -80,6 +94,7 @@ static int clk_gpio_probe(struct udevice *dev)
*/
static const struct udevice_id clk_gpio_match[] = {
{ .compatible = "gpio-gate-clock" },
{ .compatible = "gated-fixed-clock" },
{ /* sentinel */ }
};

View File

@@ -221,7 +221,7 @@ void fsl_ddr_get_spd(generic_spd_eeprom_t *ctrl_dimms_spd,
unsigned int i2c_address = 0;
if (ctrl_num >= CONFIG_SYS_NUM_DDR_CTLRS) {
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}

View File

@@ -21,7 +21,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
(struct ccsr_ddr __iomem *)CFG_SYS_FSL_DDR_ADDR;
if (ctrl_num != 0) {
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}

View File

@@ -26,7 +26,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
#endif
if (ctrl_num) {
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}

View File

@@ -71,7 +71,7 @@ void fsl_ddr_set_memctl_regs(const fsl_ddr_cfg_regs_t *regs,
break;
#endif
default:
printf("%s unexpected ctrl_num = %u\n", __FUNCTION__, ctrl_num);
printf("%s unexpected ctrl_num = %u\n", __func__, ctrl_num);
return;
}

View File

@@ -52,7 +52,7 @@ static int spartan2_load(xilinx_desc *desc, const void *buf, size_t bsize,
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -75,7 +75,7 @@ static int spartan2_dump(xilinx_desc *desc, const void *buf, size_t bsize)
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -234,7 +234,7 @@ static int spartan2_sp_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -279,7 +279,7 @@ static int spartan2_sp_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* XXX - checksum the data? */
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -423,7 +423,7 @@ static int spartan2_ss_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -434,7 +434,7 @@ static int spartan2_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* Readback is only available through the Slave Parallel and */
/* boundary-scan interfaces. */
printf ("%s: Slave Serial Dumping is unavailable\n",
__FUNCTION__);
__func__);
return FPGA_FAIL;
}

View File

@@ -57,7 +57,7 @@ static int spartan3_load(xilinx_desc *desc, const void *buf, size_t bsize,
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -80,7 +80,7 @@ static int spartan3_dump(xilinx_desc *desc, const void *buf, size_t bsize)
default:
printf ("%s: Unsupported interface type, %d\n",
__FUNCTION__, desc->iface);
__func__, desc->iface);
}
return ret_val;
@@ -241,7 +241,7 @@ static int spartan3_sp_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -286,7 +286,7 @@ static int spartan3_sp_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* XXX - checksum the data? */
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -442,7 +442,7 @@ static int spartan3_ss_load(xilinx_desc *desc, const void *buf, size_t bsize)
#endif
} else {
printf ("%s: NULL Interface function table!\n", __FUNCTION__);
printf("%s: NULL Interface function table!\n", __func__);
}
return ret_val;
@@ -453,7 +453,7 @@ static int spartan3_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize)
/* Readback is only available through the Slave Parallel and */
/* boundary-scan interfaces. */
printf ("%s: Slave Serial Dumping is unavailable\n",
__FUNCTION__);
__func__);
return FPGA_FAIL;
}

View File

@@ -149,8 +149,8 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t size,
int xilinx_load(xilinx_desc *desc, const void *buf, size_t bsize,
bitstream_type bstype, int flags)
{
if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
if (!xilinx_validate(desc, (char *)__func__)) {
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
@@ -200,8 +200,8 @@ int xilinx_loads(xilinx_desc *desc, const void *buf, size_t bsize,
int xilinx_dump(xilinx_desc *desc, const void *buf, size_t bsize)
{
if (!xilinx_validate (desc, (char *)__FUNCTION__)) {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
if (!xilinx_validate(desc, (char *)__func__)) {
printf("%s: Invalid device descriptor\n", __func__);
return FPGA_FAIL;
}
@@ -217,7 +217,7 @@ int xilinx_info(xilinx_desc *desc)
{
int ret_val = FPGA_FAIL;
if (xilinx_validate (desc, (char *)__FUNCTION__)) {
if (xilinx_validate(desc, (char *)__func__)) {
printf ("Family: \t");
switch (desc->family) {
case xilinx_spartan2:
@@ -293,7 +293,7 @@ int xilinx_info(xilinx_desc *desc)
ret_val = FPGA_SUCCESS;
} else {
printf ("%s: Invalid device descriptor\n", __FUNCTION__);
printf("%s: Invalid device descriptor\n", __func__);
}
return ret_val;

View File

@@ -112,7 +112,7 @@ uint mii_send(uint mii_cmd)
ep->eir = FEC_EIR_MII; /* clear MII complete */
#ifdef ET_DEBUG
printf("%s[%d] %s: sent=0x%8.8x, reply=0x%8.8x\n",
__FILE__, __LINE__, __FUNCTION__, mii_cmd, mii_reply);
__FILE__, __LINE__, __func__, mii_cmd, mii_reply);
#endif
return (mii_reply & 0xffff); /* data read from phy */

View File

@@ -404,7 +404,7 @@ static int rtl8169_init_board(unsigned long dev_iobase, const char *name)
u32 tmp;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_iobase;
@@ -534,7 +534,7 @@ static int rtl_recv_common(struct udevice *dev, unsigned long dev_iobase,
int length = 0;
#ifdef DEBUG_RTL8169_RX
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_iobase;
@@ -608,7 +608,7 @@ static int rtl_send_common(struct udevice *dev, unsigned long dev_iobase,
#ifdef DEBUG_RTL8169_TX
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
printf("sending %d bytes\n", len);
#endif
@@ -679,7 +679,7 @@ static void rtl8169_set_rx_mode(void)
u32 tmp = 0;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
/* IFF_ALLMULTI */
@@ -701,7 +701,7 @@ static void rtl8169_hw_start(struct udevice *dev)
#ifdef DEBUG_RTL8169
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
#if 0
@@ -771,7 +771,7 @@ static void rtl8169_init_ring(struct udevice *dev)
#ifdef DEBUG_RTL8169
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
tpc->cur_rx = 0;
@@ -810,7 +810,7 @@ static void rtl8169_common_start(struct udevice *dev, unsigned char *enetaddr,
#ifdef DEBUG_RTL8169
int stime = currticks();
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_iobase;
@@ -851,7 +851,7 @@ static void rtl_halt_common(struct udevice *dev)
int i;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = priv->iobase;
@@ -906,7 +906,7 @@ static int rtl_init(unsigned long dev_ioaddr, const char *name,
int option = -1, Cap10_100 = 0, Cap1000 = 0;
#ifdef DEBUG_RTL8169
printf ("%s\n", __FUNCTION__);
printf("%s\n", __func__);
#endif
ioaddr = dev_ioaddr;

View File

@@ -1,7 +1,7 @@
menuconfig ASPEED_RAM
bool "ASPEED SDRAM configuration"
depends on RAM
depends on ARCH_ASPEED || TARGET_ASPEED_AST2700_IBEX
depends on ARCH_ASPEED || ASPEED_AST2700
default ARCH_ASPEED
help
Configuration options for DDR SDRAM on ASPEED systems.
@@ -77,7 +77,7 @@ choice
prompt "AST2700 DDR target date rate"
default ASPEED_DDR_3200
depends on ASPEED_RAM
depends on TARGET_ASPEED_AST2700_IBEX
depends on ASPEED_AST2700
config ASPEED_DDR_1600
bool "1600 Mbps"

View File

@@ -2,4 +2,4 @@
#
obj-$(CONFIG_ASPEED_AST2500) += sdram_ast2500.o
obj-$(CONFIG_ASPEED_AST2600) += sdram_ast2600.o
obj-$(CONFIG_TARGET_ASPEED_AST2700_IBEX) += sdram_ast2700.o
obj-$(CONFIG_ASPEED_AST2700) += sdram_ast2700.o

View File

@@ -14,6 +14,11 @@
#include <linux/sizes.h>
#include <ram.h>
__weak int fmc_hdr_get_prebuilt(u32 type, u32 *ofst, u32 *size)
{
return -ENOSYS;
}
enum ddr_type {
DDR4_1600 = 0x0,
DDR4_2400,
@@ -128,13 +133,13 @@ static size_t ast2700_sdrammc_get_vga_mem_size(struct sdrammc *sdrammc)
reg = readl(scu0 + SCU0_PCI_MISC70);
if (reg & SCU0_PCI_MISC70_EN_PCIEVGA0) {
debug("VGA0:%dMB\n", vga_memsz[sel] / SZ_1M);
debug("VGA0:%zuMB\n", vga_memsz[sel] / SZ_1M);
dual++;
}
reg = readl(scu0 + SCU0_PCI_MISC80);
if (reg & SCU0_PCI_MISC80_EN_PCIEVGA1) {
debug("VGA1:%dMB\n", vga_memsz[sel] / SZ_1M);
debug("VGA1:%zuMB\n", vga_memsz[sel] / SZ_1M);
dual++;
}
@@ -560,7 +565,7 @@ void dwc_get_mailbox(struct sdrammc *sdrammc, const int mode, u32 *mbox)
dwc_ddrphy_apb_wr(0xd0031, 1);
}
uint32_t dwc_readMsgBlock(struct sdrammc *sdrammc, const u32 addr_half)
u32 dwc_readMsgBlock(struct sdrammc *sdrammc, const u32 addr_half)
{
u32 data_word;
@@ -727,7 +732,7 @@ int dwc_ddrphy_phyinit_userCustom_D_loadIMEM(struct sdrammc *sdrammc, const int
fmc_hdr_get_prebuilt(pb_type, &imem_ofst, &imem_size);
memcpy(sdrammc->phy + (DWC_PHY_IMEM_OFST << 1),
(void *)(0x20000000 + imem_ofst), imem_size);
(void *)(uintptr_t)(0x20000000 + imem_ofst), imem_size);
return 0;
}
@@ -746,7 +751,7 @@ int dwc_ddrphy_phyinit_userCustom_F_loadDMEM(struct sdrammc *sdrammc,
fmc_hdr_get_prebuilt(pb_type, &dmem_ofst, &dmem_size);
memcpy(sdrammc->phy + (DWC_PHY_DMEM_OFST << 1),
(void *)(0x20000000 + dmem_ofst), dmem_size);
(void *)(uintptr_t)(0x20000000 + dmem_ofst), dmem_size);
return 0;
}

View File

@@ -107,6 +107,15 @@ config RESET_AST2600
Say Y if you want to control reset signals of different peripherals
through System Control Unit (SCU).
config RESET_AST2700
bool "Reset controller driver for AST2700 SoCs"
depends on DM_RESET && ASPEED_AST2700
default y if ASPEED_AST2700
help
Support for reset controller on AST2700 SoC.
Say Y if you want to control reset signals of different peripherals
through System Control Unit (SCU).
config RESET_ROCKCHIP
bool "Reset controller driver for Rockchip SoCs"
depends on DM_RESET && ARCH_ROCKCHIP && CLK

View File

@@ -18,6 +18,7 @@ obj-$(CONFIG_RESET_BRCMSTB_RESCAL) += reset-brcmstb-rescal.o
obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
obj-$(CONFIG_RESET_AST2500) += reset-ast2500.o
obj-$(CONFIG_RESET_AST2600) += reset-ast2600.o
obj-$(CONFIG_RESET_AST2700) += reset-ast2700.o
obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o rst-rk3506.o rst-rk3528.o rst-rk3576.o rst-rk3588.o
obj-$(CONFIG_RESET_MESON) += reset-meson.o
obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o

View File

@@ -0,0 +1,82 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) ASPEED Technology Inc.
*/
#include <asm/io.h>
#include <dm.h>
#include <linux/err.h>
#include <reset.h>
#include <reset-uclass.h>
/* Offset of the modrst register block within the SCU. */
#define AST2700_RESET_OFFSET 0x200
struct ast2700_reset_priv {
void __iomem *base;
};
static int ast2700_reset_assert(struct reset_ctl *reset_ctl)
{
struct ast2700_reset_priv *priv = dev_get_priv(reset_ctl->dev);
if (reset_ctl->id < 32)
writel(BIT(reset_ctl->id), priv->base);
else
writel(BIT(reset_ctl->id - 32), priv->base + 0x20);
return 0;
}
static int ast2700_reset_deassert(struct reset_ctl *reset_ctl)
{
struct ast2700_reset_priv *priv = dev_get_priv(reset_ctl->dev);
if (reset_ctl->id < 32)
writel(BIT(reset_ctl->id), priv->base + 0x04);
else
writel(BIT(reset_ctl->id - 32), priv->base + 0x24);
return 0;
}
static int ast2700_reset_status(struct reset_ctl *reset_ctl)
{
struct ast2700_reset_priv *priv = dev_get_priv(reset_ctl->dev);
int status;
if (reset_ctl->id < 32)
status = BIT(reset_ctl->id) & readl(priv->base);
else
status = BIT(reset_ctl->id - 32) & readl(priv->base + 0x20);
return !!status;
}
static int ast2700_reset_probe(struct udevice *dev)
{
struct ast2700_reset_priv *priv = dev_get_priv(dev);
void __iomem *scu_base;
scu_base = dev_read_addr_ptr(dev);
if (!scu_base)
return -EINVAL;
priv->base = scu_base + AST2700_RESET_OFFSET;
return 0;
}
static const struct reset_ops ast2700_reset_ops = {
.rst_assert = ast2700_reset_assert,
.rst_deassert = ast2700_reset_deassert,
.rst_status = ast2700_reset_status,
};
U_BOOT_DRIVER(ast2700_reset) = {
.name = "ast2700_reset",
.id = UCLASS_RESET,
.probe = ast2700_reset_probe,
.ops = &ast2700_reset_ops,
.priv_auto = sizeof(struct ast2700_reset_priv),
};

View File

@@ -66,7 +66,7 @@ static void m41t62_update_rtc_time(struct rtc_time *tm, u8 *buf)
{
debug("%s: raw read data - sec=%02x, min=%02x, hr=%02x, "
"mday=%02x, mon=%02x, year=%02x, wday=%02x, y2k=%02x\n",
__FUNCTION__,
__func__,
buf[0], buf[1], buf[2], buf[3],
buf[4], buf[5], buf[6], buf[7]);
@@ -83,7 +83,7 @@ static void m41t62_update_rtc_time(struct rtc_time *tm, u8 *buf)
debug("%s: tm is secs=%d, mins=%d, hours=%d, "
"mday=%d, mon=%d, year=%d, wday=%d\n",
__FUNCTION__,
__func__,
tm->tm_sec, tm->tm_min, tm->tm_hour,
tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
}

View File

@@ -53,11 +53,7 @@
#define FIFO_RXSIZE_MASK 0x7
#define FIFO_RXSIZE_OFF 0
#define FIFO_TXFE 0x80
#if defined(CONFIG_ARCH_IMX8) || defined(CONFIG_ARCH_IMXRT)
#define FIFO_RXFE 0x08
#else
#define FIFO_RXFE 0x40
#endif
#define WATER_TXWATER_OFF 0
#define WATER_RXWATER_OFF 16

View File

@@ -1750,7 +1750,7 @@ static int hc_reset(ohci_t *ohci)
int timeout = 30;
int smm_timeout = 50; /* 0,5 sec */
dbg("%s\n", __FUNCTION__);
dbg("%s\n", __func__);
#ifdef CONFIG_PCI_EHCI_DEVNO
/*

View File

@@ -100,7 +100,7 @@ static int omap2430_musb_enable(struct musb *musb)
#ifdef CONFIG_TWL4030_USB
if (twl4030_usb_ulpi_init()) {
serial_printf("ERROR: %s Could not initialize PHY\n",
__PRETTY_FUNCTION__);
__func__);
}
#endif
return 0;

View File

@@ -58,7 +58,7 @@ static uchar dbg = 0;
#define PDEBUG(fmt, args...) { \
if(dbg != 0) { \
printf("[%s %d %s]: ",__FILE__,__LINE__,__FUNCTION__);\
printf("[%s %d %s]: ", __FILE__, __LINE__, __func__);\
printf(fmt, ##args); \
printf("\n"); \
} \

View File

@@ -0,0 +1,29 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2021-2026 Axiado Corporation (or its affiliates).
*/
#ifndef __AX3005_SCM3005_H
#define __AX3005_SCM3005_H
#include <linux/sizes.h>
#define GICD_BASE 0x40400000
#define GICR_BASE 0x40500000
#define SYS_TIMER_CTRL 0x48016000
#define SYS_TIMER_ENABLE 0x1
#define SYS_TIMER_DISABLE 0x0
/* DRAM: 2 GB at 0x80000000 */
#define CFG_SYS_SDRAM_BASE 0x80000000
#define CFG_SYS_SDRAM_SIZE SZ_2G
#define CFG_SYS_INIT_SP_ADDR (CFG_SYS_SDRAM_BASE + SZ_1M)
#define CFG_SYS_MAXARGS 64
#define CFG_SYS_BARGSIZE CFG_SYS_CBSIZE
#define CFG_SYS_BAUDRATE_TABLE \
{ 4800, 9600, 19200, 38400, 57600, 115200 }
#endif /* __AX3005_SCM3005_H */

View File

@@ -0,0 +1,58 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) ASPEED Technology Inc.
*/
#ifndef __CONFIG_H
#define __CONFIG_H
#include <configs/aspeed-common.h>
/* Extra ENV for Boot Command */
#define STR_HELPER(n) #n
#define STR(n) STR_HELPER(n)
#define CFG_SYS_UBOOT_BASE CONFIG_TEXT_BASE
#define CFG_EXTRA_ENV_SETTINGS \
"bootspi=fdt addr ${fdtspiaddr} && " \
"fdt header get fitsize totalsize && " \
"cp.b ${fdtspiaddr} ${loadaddr} ${fitsize} && " \
"bootm ${loadaddr}; " \
"echo Error loading kernel FIT image\0" \
"loadaddr=" STR(CONFIG_SYS_LOAD_ADDR) "\0" \
"bootside=a\0" \
"rootfs=rofs-a\0" \
"setmmcargs=setenv bootargs ${bootargs} " \
"rootwait root=PARTLABEL=${rootfs}\0" \
"boota=setenv bootpart 2; setenv rootfs rofs-a; " \
"run setmmcargs; " \
"ext4load mmc 0:${bootpart} ${loadaddr} fitImage && " \
"bootm ${loadaddr}; " \
"echo Error loading kernel FIT image\0" \
"bootb=setenv bootpart 3; setenv rootfs rofs-b; " \
"run setmmcargs; " \
"ext4load mmc 0:${bootpart} ${loadaddr} fitImage && " \
"bootm ${loadaddr}; " \
"echo Error loading kernel FIT image\0" \
"bootmmc=if test \"${bootside}\" = \"b\"; " \
"then run bootb; run boota; " \
"else run boota; run bootb; fi\0" \
"setufsargs=setenv bootargs ${bootargs} " \
"rootwait root=PARTLABEL=${rootfs}\0" \
"ufsboota=setenv bootpart 2; setenv rootfs rofs-a; " \
"run setufsargs; " \
"ext4load scsi 0:${bootpart} ${loadaddr} fitImage && " \
"bootm ${loadaddr}; " \
"echo Error loading kernel FIT image\0" \
"ufsbootb=setenv bootpart 3; setenv rootfs rofs-b; " \
"run setufsargs; " \
"ext4load scsi 0:${bootpart} ${loadaddr} fitImage && " \
"bootm ${loadaddr}; " \
"echo Error loading kernel FIT image\0" \
"bootufs=if test \"${bootside}\" = \"b\"; " \
"then run ufsbootb; run ufsboota; " \
"else run ufsboota; run ufsbootb; fi\0" \
"verify=no\0" \
""
#endif /* __CONFIG_H */

View File

@@ -22,19 +22,19 @@
#define MAX_URBS_QUEUED 5
#if 1
#define usberr(fmt,args...) serial_printf("ERROR: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
#define usberr(fmt, args...) serial_printf("ERROR: %s(), %d: " fmt "\n", __func__, __LINE__, ##args)
#else
#define usberr(fmt,args...) do{}while(0)
#endif
#if 0
#define usbdbg(fmt,args...) serial_printf("debug: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
#define usbdbg(fmt, args...) serial_printf("debug: %s(), %d: " fmt "\n", __func__, __LINE__, ##args)
#else
#define usbdbg(fmt,args...) do{}while(0)
#endif
#if 0
#define usbinfo(fmt,args...) serial_printf("info: %s(), %d: "fmt"\n",__FUNCTION__,__LINE__,##args)
#define usbinfo(fmt, args...) serial_printf("info: %s(), %d: " fmt "\n", __func__, __LINE__, ##args)
#else
#define usbinfo(fmt,args...) do{}while(0)
#endif