blob: f3275b37a516da6befd41324ddb2a3fe1f36fc83 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Carlo Caione72ad9032016-06-10 20:18:22 +02002/*
Jerome Brunet32bacc52018-10-25 16:41:37 +02003 * Configuration for Amlogic Meson 64bits SoCs
Carlo Caione72ad9032016-06-10 20:18:22 +02004 * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com>
Carlo Caione72ad9032016-06-10 20:18:22 +02005 */
6
Jerome Brunet32bacc52018-10-25 16:41:37 +02007#ifndef __MESON64_CONFIG_H
8#define __MESON64_CONFIG_H
9
10/* Generic Interrupt Controller Definitions */
Anand Moonc51afd92019-12-26 11:33:52 +000011#if (defined(CONFIG_MESON_AXG) || defined(CONFIG_MESON_G12A))
Neil Armstrong0fca9232018-09-05 15:56:12 +020012#define GICD_BASE 0xffc01000
13#define GICC_BASE 0xffc02000
Igor Prusov7da68fb2023-05-05 15:56:37 +030014#elif defined(CONFIG_MESON_A1)
15#define GICD_BASE 0xff901000
16#define GICC_BASE 0xff902000
Neil Armstrong0fca9232018-09-05 15:56:12 +020017#else /* MESON GXL and GXBB */
Jerome Brunet32bacc52018-10-25 16:41:37 +020018#define GICD_BASE 0xc4301000
19#define GICC_BASE 0xc4302000
Neil Armstrong0fca9232018-09-05 15:56:12 +020020#endif
Carlo Caione72ad9032016-06-10 20:18:22 +020021
Edoardo Tomelleri1a340492022-09-18 18:17:01 +020022/* Serial drivers */
23/* The following table includes the supported baudrates */
Tom Rini2dbf1e82022-12-02 16:42:25 -050024#define CFG_SYS_BAUDRATE_TABLE \
Edoardo Tomelleri1a340492022-09-18 18:17:01 +020025 {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, \
26 230400, 250000, 460800, 500000, 1000000, 2000000, 4000000, \
27 8000000 }
28
Neil Armstrong07fccdb2018-07-26 11:45:46 +020029/* For splashscreen */
Simon Glass52cb5042022-10-18 07:46:31 -060030#ifdef CONFIG_VIDEO
Neil Armstrong07fccdb2018-07-26 11:45:46 +020031#define STDOUT_CFG "vidconsole,serial"
32#else
33#define STDOUT_CFG "serial"
34#endif
35
36#ifdef CONFIG_USB_KEYBOARD
37#define STDIN_CFG "usbkbd,serial"
Neil Armstrong07fccdb2018-07-26 11:45:46 +020038#else
39#define STDIN_CFG "serial"
40#endif
41
Tom Rinibb4dd962022-11-16 13:10:37 -050042#define CFG_SYS_SDRAM_BASE 0
Carlo Caione72ad9032016-06-10 20:18:22 +020043
Neil Armstrong2fbfcbb2018-07-27 14:10:00 +020044/* ROM USB boot support, auto-execute boot.scr at scriptaddr */
45#define BOOTENV_DEV_ROMUSB(devtypeu, devtypel, instance) \
46 "bootcmd_romusb=" \
47 "if test \"${boot_source}\" = \"usb\" && " \
48 "test -n \"${scriptaddr}\"; then " \
49 "echo '(ROM USB boot)'; " \
50 "source ${scriptaddr}; " \
51 "fi\0"
52
53#define BOOTENV_DEV_NAME_ROMUSB(devtypeu, devtypel, instance) \
54 "romusb "
55
Neil Armstrong17158912023-10-23 14:41:36 +020056/*
57 * Fallback to "USB DFU" boot if script is not at scriptaddr
58 *
59 * DFU will expose the kernel_addr_r memory range as DFU entry,
60 * then with `dfu-util --detach`, booting the uploaded image
61 * will be attempted:
62 * $ dfu-util -a 0 -D fitImage
63 * $ dfu-util -a 0 -e
64 */
65#if CONFIG_IS_ENABLED(USB_GADGET) && CONFIG_IS_ENABLED(DFU_RAM)
66 #define BOOTENV_DEV_USB_DFU(devtypeu, devtypel, instance) \
67 "bootcmd_usbdfu=" \
68 "if test \"${boot_source}\" = \"usb\"; then " \
69 "dfu 0 ram 0 60;" \
70 "bootm ${kernel_addr_r};" \
71 "fi\0"
72
73 #define BOOTENV_DEV_NAME_USB_DFU(devtypeu, devtypel, instance) \
74 "usbdfu "
75#else
76 #define BOOTENV_DEV_USB_DFU(devtypeu, devtypel, instance)
77 #define BOOTENV_DEV_NAME_USB_DFU(devtypeu, devtypel, instance)
78#endif
79
Callum Parsey42f33cf2024-10-12 08:03:51 +000080#ifdef CONFIG_CMD_MMC
81 #define BOOT_TARGET_MMC(func) \
82 func(MMC, mmc, 0) \
83 func(MMC, mmc, 1) \
84 func(MMC, mmc, 2)
85#else
86 #define BOOT_TARGET_MMC(func)
87#endif
88
Neil Armstrong42fe74e2018-06-14 13:43:38 +020089#ifdef CONFIG_CMD_USB
90#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
91#else
92#define BOOT_TARGET_DEVICES_USB(func)
93#endif
94
Neil Armstrong311b2d62021-02-26 15:17:36 +010095#ifdef CONFIG_CMD_NVME
96 #define BOOT_TARGET_NVME(func) func(NVME, nvme, 0)
97#else
98 #define BOOT_TARGET_NVME(func)
99#endif
100
Neil Armstrong943bc232021-09-17 09:37:04 +0200101#ifdef CONFIG_CMD_SCSI
102 #define BOOT_TARGET_SCSI(func) func(SCSI, scsi, 0)
103#else
104 #define BOOT_TARGET_SCSI(func)
105#endif
106
Callum Parsey42f33cf2024-10-12 08:03:51 +0000107#if defined(CONFIG_CMD_DHCP) && defined(CONFIG_CMD_PXE)
108 #define BOOT_TARGET_PXE(func) func(PXE, pxe, na)
109 #define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na)
110#elif defined(CONFIG_CMD_DHCP)
111 #define BOOT_TARGET_PXE(func)
112 #define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na)
113#else
114 #define BOOT_TARGET_PXE(func)
115 #define BOOT_TARGET_DHCP(func)
116#endif
117
Jerome Brunet32bacc52018-10-25 16:41:37 +0200118#ifndef BOOT_TARGET_DEVICES
Andreas Färberd1296682017-01-15 20:22:30 +0100119#define BOOT_TARGET_DEVICES(func) \
Neil Armstrong2fbfcbb2018-07-27 14:10:00 +0200120 func(ROMUSB, romusb, na) \
Neil Armstrong17158912023-10-23 14:41:36 +0200121 func(USB_DFU, usbdfu, na) \
Callum Parsey42f33cf2024-10-12 08:03:51 +0000122 BOOT_TARGET_MMC(func) \
Neil Armstrong42fe74e2018-06-14 13:43:38 +0200123 BOOT_TARGET_DEVICES_USB(func) \
Neil Armstrong311b2d62021-02-26 15:17:36 +0100124 BOOT_TARGET_NVME(func) \
Neil Armstrong943bc232021-09-17 09:37:04 +0200125 BOOT_TARGET_SCSI(func) \
Callum Parsey42f33cf2024-10-12 08:03:51 +0000126 BOOT_TARGET_PXE(func) \
127 BOOT_TARGET_DHCP(func)
Jerome Brunet32bacc52018-10-25 16:41:37 +0200128#endif
Andreas Färberd1296682017-01-15 20:22:30 +0100129
Neil Armstrongcc9c1582023-10-23 14:41:35 +0200130#define BOOTM_SIZE __stringify(0x1700000)
131#define KERNEL_ADDR_R __stringify(0x08080000)
132#define KERNEL_COMP_ADDR_R __stringify(0x0d080000)
133#define FDT_ADDR_R __stringify(0x08008000)
134#define SCRIPT_ADDR_R __stringify(0x08000000)
135#define PXEFILE_ADDR_R __stringify(0x01080000)
136#define FDTOVERLAY_ADDR_R __stringify(0x01000000)
137#define RAMDISK_ADDR_R __stringify(0x13000000)
138
Jaehoon Chung0d5071e2020-11-02 12:07:06 +0900139#include <config_distro_bootcmd.h>
140
Neil Armstronga4c27f32024-03-29 18:51:48 +0100141#ifdef CONFIG_OF_UPSTREAM
142#define FDTFILE_NAME CONFIG_DEFAULT_DEVICE_TREE ".dtb"
143#else
144#define FDTFILE_NAME "amlogic/" CONFIG_DEFAULT_DEVICE_TREE ".dtb"
145#endif
146
Tom Rinic9edebe2022-12-04 10:03:50 -0500147#ifndef CFG_EXTRA_ENV_SETTINGS
148#define CFG_EXTRA_ENV_SETTINGS \
Neil Armstrong07fccdb2018-07-26 11:45:46 +0200149 "stdin=" STDIN_CFG "\0" \
150 "stdout=" STDOUT_CFG "\0" \
151 "stderr=" STDOUT_CFG "\0" \
Neil Armstrongcc9c1582023-10-23 14:41:35 +0200152 "kernel_comp_addr_r=" KERNEL_COMP_ADDR_R "\0" \
Artem Lapkin005fce22021-05-27 14:43:51 +0800153 "kernel_comp_size=0x2000000\0" \
Neil Armstrongcc9c1582023-10-23 14:41:35 +0200154 "fdt_addr_r=" FDT_ADDR_R "\0" \
155 "scriptaddr=" SCRIPT_ADDR_R "\0" \
156 "kernel_addr_r=" KERNEL_ADDR_R "\0" \
157 "pxefile_addr_r=" PXEFILE_ADDR_R "\0" \
158 "fdtoverlay_addr_r=" FDTOVERLAY_ADDR_R "\0" \
159 "ramdisk_addr_r=" RAMDISK_ADDR_R "\0" \
Neil Armstronga4c27f32024-03-29 18:51:48 +0100160 "fdtfile=" FDTFILE_NAME "\0" \
Neil Armstrong17158912023-10-23 14:41:36 +0200161 "dfu_alt_info=fitimage ram " KERNEL_ADDR_R " 0x4000000 \0" \
Andreas Färberd1296682017-01-15 20:22:30 +0100162 BOOTENV
Jerome Brunet32bacc52018-10-25 16:41:37 +0200163#endif
Andreas Färberd1296682017-01-15 20:22:30 +0100164
Jerome Brunet32bacc52018-10-25 16:41:37 +0200165#endif /* __MESON64_CONFIG_H */