aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-apple/board.c40
-rw-r--r--cmd/adc.c18
-rw-r--r--cmd/fdt.c30
-rw-r--r--configs/apple_m1_defconfig2
-rw-r--r--include/config_distro_bootcmd.h6
-rw-r--r--lib/fdtdec.c2
-rw-r--r--net/net.c9
8 files changed, 91 insertions, 17 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3243bd0..57946f6 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1021,6 +1021,7 @@ config ARCH_APPLE
select DM_VIDEO
select IOMMU
select LINUX_KERNEL_IMAGE_HEADER
+ select OF_BOARD_SETUP
select OF_CONTROL
select PINCTRL
select POSITION_INDEPENDENT
diff --git a/arch/arm/mach-apple/board.c b/arch/arm/mach-apple/board.c
index ffc1301..1525a9e 100644
--- a/arch/arm/mach-apple/board.c
+++ b/arch/arm/mach-apple/board.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <dm.h>
+#include <dm/uclass-internal.h>
#include <efi_loader.h>
#include <lmb.h>
@@ -461,3 +462,42 @@ int board_late_init(void)
return 0;
}
+
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+ struct udevice *dev;
+ const char *stdoutname;
+ int node, ret;
+
+ /*
+ * Modify the "stdout-path" property under "/chosen" to point
+ * at "/chosen/framebuffer if a keyboard is available and
+ * we're not running under the m1n1 hypervisor.
+ * Developers can override this behaviour by dropping
+ * "vidconsole" from the "stdout" environment variable.
+ */
+
+ /* EL1 means we're running under the m1n1 hypervisor. */
+ if (current_el() == 1)
+ return 0;
+
+ ret = uclass_find_device(UCLASS_KEYBOARD, 0, &dev);
+ if (ret < 0)
+ return 0;
+
+ stdoutname = env_get("stdout");
+ if (!stdoutname || !strstr(stdoutname, "vidconsole"))
+ return 0;
+
+ /* Make sure we actually have a framebuffer. */
+ node = fdt_path_offset(blob, "/chosen/framebuffer");
+ if (node < 0 || !fdtdec_get_is_enabled(blob, node))
+ return 0;
+
+ node = fdt_path_offset(blob, "/chosen");
+ if (node < 0)
+ return 0;
+ fdt_setprop_string(blob, node, "stdout-path", "/chosen/framebuffer");
+
+ return 0;
+}
diff --git a/cmd/adc.c b/cmd/adc.c
index 75739bc..8de9121 100644
--- a/cmd/adc.c
+++ b/cmd/adc.c
@@ -71,13 +71,17 @@ static int do_adc_info(struct cmd_tbl *cmdtp, int flag, int argc,
static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
+ char *varname = NULL;
struct udevice *dev;
unsigned int data;
- int ret, uV;
+ int ret, uV, val;
if (argc < 3)
return CMD_RET_USAGE;
+ if (argc >= 3)
+ varname = argv[2];
+
ret = adc_channel_single_shot(argv[1], simple_strtol(argv[2], NULL, 0),
&data);
if (ret) {
@@ -87,10 +91,16 @@ static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
}
ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev);
- if (!ret && !adc_raw_to_uV(dev, data, &uV))
+ if (!ret && !adc_raw_to_uV(dev, data, &uV)) {
+ val = uV;
printf("%u, %d uV\n", data, uV);
- else
+ } else {
+ val = data;
printf("%u\n", data);
+ }
+
+ if (varname)
+ env_set_ulong(varname, val);
return CMD_RET_SUCCESS;
}
@@ -149,7 +159,7 @@ static int do_adc_scan(struct cmd_tbl *cmdtp, int flag, int argc,
static char adc_help_text[] =
"list - list ADC devices\n"
"adc info <name> - Get ADC device info\n"
- "adc single <name> <channel> - Get Single data of ADC device channel\n"
+ "adc single <name> <channel> [varname] - Get Single data of ADC device channel\n"
"adc scan <name> [channel mask] - Scan all [or masked] ADC channels";
U_BOOT_CMD_WITH_SUBCMDS(adc, "ADC sub-system", adc_help_text,
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 7d7cae8..c07342c 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -119,13 +119,27 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (strncmp(argv[1], "ad", 2) == 0) {
unsigned long addr;
int control = 0;
+ int quiet = 0;
struct fdt_header *blob;
/* Set the address [and length] of the fdt */
argc -= 2;
argv += 2;
- if (argc && !strcmp(*argv, "-c")) {
- control = 1;
+ while (argc > 0 && **argv == '-') {
+ char *arg = *argv;
+
+ while (*++arg) {
+ switch (*arg) {
+ case 'c':
+ control = 1;
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ default:
+ return CMD_RET_USAGE;
+ }
+ }
argc--;
argv++;
}
@@ -145,7 +159,8 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
addr = hextoul(argv[0], NULL);
blob = map_sysmem(addr, 0);
- if (!fdt_valid(&blob))
+ if ((quiet && fdt_check_header(blob)) ||
+ (!quiet && !fdt_valid(&blob)))
return 1;
if (control)
gd->fdt_blob = blob;
@@ -159,12 +174,13 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
/* Optional new length */
len = hextoul(argv[1], NULL);
if (len < fdt_totalsize(blob)) {
- printf("New length %d < existing length %d, ignoring\n",
- len, fdt_totalsize(blob));
+ if (!quiet)
+ printf("New length %d < existing length %d, ignoring\n",
+ len, fdt_totalsize(blob));
} else {
/* Open in place with a new length */
err = fdt_open_into(blob, blob, len);
- if (err != 0) {
+ if (!quiet && err != 0) {
printf("libfdt fdt_open_into(): %s\n",
fdt_strerror(err));
}
@@ -1055,7 +1071,7 @@ static int fdt_print(const char *pathp, char *prop, int depth)
/********************************************************************/
#ifdef CONFIG_SYS_LONGHELP
static char fdt_help_text[] =
- "addr [-c] <addr> [<length>] - Set the [control] fdt location to <addr>\n"
+ "addr [-cq] <addr> [<length>] - Set the [control] fdt location to <addr>\n"
#ifdef CONFIG_OF_LIBFDT_OVERLAY
"fdt apply <addr> - Apply overlay to the DT\n"
#endif
diff --git a/configs/apple_m1_defconfig b/configs/apple_m1_defconfig
index b73e541..886fc4a 100644
--- a/configs/apple_m1_defconfig
+++ b/configs/apple_m1_defconfig
@@ -13,5 +13,7 @@ CONFIG_NVME_APPLE=y
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_KEYBOARD=y
+CONFIG_SYS_WHITE_ON_BLACK=y
+CONFIG_NO_FB_CLEAR=y
CONFIG_VIDEO_SIMPLE=y
# CONFIG_GENERATE_SMBIOS_TABLE is not set
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 2f90929..c5502388 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -126,7 +126,7 @@
#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
#define BOOTENV_EFI_BOOTMGR \
"boot_efi_bootmgr=" \
- "if fdt addr ${fdt_addr_r}; then " \
+ "if fdt addr -q ${fdt_addr_r}; then " \
"bootefi bootmgr ${fdt_addr_r};" \
"else " \
"bootefi bootmgr;" \
@@ -141,7 +141,7 @@
"boot_efi_binary=" \
"load ${devtype} ${devnum}:${distro_bootpart} " \
"${kernel_addr_r} efi/boot/"BOOTEFI_NAME"; " \
- "if fdt addr ${fdt_addr_r}; then " \
+ "if fdt addr -q ${fdt_addr_r}; then " \
"bootefi ${kernel_addr_r} ${fdt_addr_r};" \
"else " \
"bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
@@ -360,7 +360,7 @@
"setenv bootp_arch " BOOTENV_EFI_PXE_ARCH ";" \
"if dhcp ${kernel_addr_r}; then " \
"tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};" \
- "if fdt addr ${fdt_addr_r}; then " \
+ "if fdt addr -q ${fdt_addr_r}; then " \
"bootefi ${kernel_addr_r} ${fdt_addr_r}; " \
"else " \
"bootefi ${kernel_addr_r} ${fdtcontroladdr};" \
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 0c0ec03..e2208cb 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1230,7 +1230,7 @@ static void *fdt_find_separate(void)
#ifdef CONFIG_SPL_BUILD
/* FDT is at end of BSS unless it is in a different memory region */
- if (CONFIG_IS_ENABLED(SEPARATE_BSS))
+ if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
fdt_blob = (ulong *)&_image_binary_end;
else
fdt_blob = (ulong *)&__bss_end;
diff --git a/net/net.c b/net/net.c
index 072a82d..034a5d6 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1538,14 +1538,19 @@ int is_serverip_in_cmd(void)
int net_parse_bootfile(struct in_addr *ipaddr, char *filename, int max_len)
{
char *colon;
+ struct in_addr ip;
+ ip.s_addr = 0;
if (net_boot_file_name[0] == '\0')
return 0;
colon = strchr(net_boot_file_name, ':');
if (colon) {
- if (ipaddr)
- *ipaddr = string_to_ip(net_boot_file_name);
+ ip = string_to_ip(net_boot_file_name);
+ if (ipaddr && ip.s_addr)
+ *ipaddr = ip;
+ }
+ if (ip.s_addr) {
strncpy(filename, colon + 1, max_len);
} else {
strncpy(filename, net_boot_file_name, max_len);