select DM_VIDEO
select IOMMU
select LINUX_KERNEL_IMAGE_HEADER
+ select OF_BOARD_SETUP
select OF_CONTROL
select PINCTRL
select POSITION_INDEPENDENT
#include <common.h>
#include <dm.h>
+#include <dm/uclass-internal.h>
#include <efi_loader.h>
#include <lmb.h>
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;
+}
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) {
}
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;
}
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,
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++;
}
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;
/* 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));
}
/********************************************************************/
#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
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
#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;" \
"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};" \
"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};" \
#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;
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);