Various of-platdata improvements, including CONFIG_OF_REAL
-----BEGIN PGP SIGNATURE----- iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmFR2fMRHHNqZ0BjaHJv bWl1bS5vcmcACgkQfxc6PpAIreaAnAf/ZKPy3CRphbgAmbLhNQhQGpLosLcFp343 cv53gfsv1DakLRrhqMSnOQSVoTg9P22uHbooDDR9WHfZyEL6tvGZ+dgN2/wlDhDj wbvvsM7FB+uvLVfMF3MURQBvy4dPO+FyCm/uHmry2V2uqWPw4ss+aVhxeQ5s4/oI LpS6yaiM8UAj2GTUZSqJ1+/W7YG9N6tL73n0PDyCvSrdCkyPWqpww1rtST88SfFI bBEWc6ksna/29haOwHQ2xopEbVxtHv2byULfqUtnsbtE4Ozw8o0fx66tdwPHTQlM 7eSuRiEbqjlJuUZFIbMat7nb7inZkaWupZ/Sr1HUUiDdKMygrRsQhg== =x8Uf -----END PGP SIGNATURE----- Merge tag 'dm-pull-next-27sep21' of https://source.denx.de/u-boot/custodians/u-boot-dm into next Various of-platdata improvements, including CONFIG_OF_REAL
This commit is contained in:
commit
1d1f98c8ee
7
Makefile
7
Makefile
@ -1292,10 +1292,6 @@ u-boot.ldr: u-boot
|
||||
# Use 'make BINMAN_VERBOSE=3' to set vebosity level
|
||||
default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE))
|
||||
|
||||
# Tell binman whether we have a devicetree for SPL and TPL
|
||||
have_spl_dt := $(if $(CONFIG_SPL_OF_PLATDATA),,$(CONFIG_SPL_OF_CONTROL))
|
||||
have_tpl_dt := $(if $(CONFIG_TPL_OF_PLATDATA),,$(CONFIG_TPL_OF_CONTROL))
|
||||
|
||||
quiet_cmd_binman = BINMAN $@
|
||||
cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
|
||||
--toolpath $(objtree)/tools \
|
||||
@ -1309,7 +1305,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
|
||||
-a scp-path=$(SCP) \
|
||||
-a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \
|
||||
-a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \
|
||||
-a spl-dtb=$(have_spl_dt) -a tpl-dtb=$(have_tpl_dt) \
|
||||
-a spl-dtb=$(CONFIG_SPL_OF_REAL) \
|
||||
-a tpl-dtb=$(CONFIG_SPL_OF_REAL) \
|
||||
$(BINMAN_$(@F))
|
||||
|
||||
OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <asm/arch-rockchip/clock.h>
|
||||
#include <asm/arch-rockchip/grf_rk3188.h>
|
||||
#include <asm/arch-rockchip/hardware.h>
|
||||
#include <dm/ofnode.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#define GRF_BASE 0x20008000
|
||||
@ -107,7 +108,6 @@ int rk_board_late_init(void)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_BUILD
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
static int setup_led(void)
|
||||
{
|
||||
#ifdef CONFIG_SPL_LED
|
||||
@ -115,7 +115,7 @@ static int setup_led(void)
|
||||
char *led_name;
|
||||
int ret;
|
||||
|
||||
led_name = fdtdec_get_config_string(gd->fdt_blob, "u-boot,boot-led");
|
||||
led_name = ofnode_conf_read_str("u-boot,boot-led");
|
||||
if (!led_name)
|
||||
return 0;
|
||||
ret = led_get_by_label(led_name, &dev);
|
||||
|
@ -21,7 +21,7 @@ static const struct udevice_id rk3399_syscon_ids[] = {
|
||||
U_BOOT_DRIVER(syscon_rk3399) = {
|
||||
.name = "rk3399_syscon",
|
||||
.id = UCLASS_SYSCON,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.of_match = rk3399_syscon_ids,
|
||||
|
@ -18,7 +18,7 @@ U_BOOT_DRIVER(syscon_rk3568) = {
|
||||
.name = "rk3568_syscon",
|
||||
.id = UCLASS_SYSCON,
|
||||
.of_match = rk3568_syscon_ids,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
};
|
||||
|
@ -66,7 +66,7 @@
|
||||
};
|
||||
|
||||
gpio_b: gpios@1 {
|
||||
u-boot,dm-pre-proper;
|
||||
u-boot,dm-spl;
|
||||
gpio-controller;
|
||||
compatible = "sandbox,gpio";
|
||||
#gpio-cells = <2>;
|
||||
@ -74,6 +74,12 @@
|
||||
sandbox,gpio-count = <10>;
|
||||
};
|
||||
|
||||
gpio-test {
|
||||
u-boot,dm-spl;
|
||||
compatible = "sandbox,gpio-test";
|
||||
test-gpios = <&gpio_b 3 0>;
|
||||
};
|
||||
|
||||
hexagon {
|
||||
compatible = "demo-simple";
|
||||
colour = "white";
|
||||
@ -124,6 +130,19 @@
|
||||
#sound-dai-cells = <1>;
|
||||
};
|
||||
|
||||
irq_sandbox: irq-sbox {
|
||||
u-boot,dm-spl;
|
||||
compatible = "sandbox,irq";
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
};
|
||||
|
||||
irq-test {
|
||||
u-boot,dm-spl;
|
||||
compatible = "sandbox,irq-test";
|
||||
interrupts-extended = <&irq_sandbox 3 0>;
|
||||
};
|
||||
|
||||
lcd {
|
||||
u-boot,dm-pre-proper;
|
||||
compatible = "sandbox,lcd-sdl";
|
||||
|
@ -62,6 +62,9 @@
|
||||
};
|
||||
|
||||
config {
|
||||
testing-bool;
|
||||
testing-int = <123>;
|
||||
testing-str = "testing";
|
||||
environment {
|
||||
from_fdt = "yes";
|
||||
fdt_env_path = "";
|
||||
@ -821,19 +824,27 @@
|
||||
};
|
||||
|
||||
cpus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
timebase-frequency = <2000000>;
|
||||
cpu-test1 {
|
||||
cpu1: cpu@1 {
|
||||
device_type = "cpu";
|
||||
reg = <0x1>;
|
||||
timebase-frequency = <3000000>;
|
||||
compatible = "sandbox,cpu_sandbox";
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
cpu-test2 {
|
||||
cpu2: cpu@2 {
|
||||
device_type = "cpu";
|
||||
reg = <0x2>;
|
||||
compatible = "sandbox,cpu_sandbox";
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
||||
cpu-test3 {
|
||||
cpu3: cpu@3 {
|
||||
device_type = "cpu";
|
||||
reg = <0x3>;
|
||||
compatible = "sandbox,cpu_sandbox";
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
|
20
arch/sandbox/include/asm/irq.h
Normal file
20
arch/sandbox/include/asm/irq.h
Normal file
@ -0,0 +1,20 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright 2021 Google LLC
|
||||
*/
|
||||
|
||||
#ifndef __SANDBOX_IRQ_H
|
||||
#define __SANDBOX_IRQ_H
|
||||
|
||||
/**
|
||||
* struct sandbox_irq_priv - private data for this driver
|
||||
*
|
||||
* @count: Counts the number calls to the read_and_clear() method
|
||||
* @pending: true if an interrupt is pending, else false
|
||||
*/
|
||||
struct sandbox_irq_priv {
|
||||
int count;
|
||||
bool pending;
|
||||
};
|
||||
|
||||
#endif /* __SANDBOX_IRQ_H */
|
@ -220,7 +220,7 @@ static int apl_hostbridge_of_to_plat(struct udevice *dev)
|
||||
ret = uclass_first_device_err(UCLASS_PINCTRL, &pinctrl);
|
||||
if (ret)
|
||||
return log_msg_ret("no hostbridge PINCTRL", ret);
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
int root;
|
||||
|
||||
/* Get length of PCI Express Region */
|
||||
@ -375,7 +375,7 @@ struct acpi_ops apl_hostbridge_acpi_ops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id apl_hostbridge_ids[] = {
|
||||
{ .compatible = "intel,apl-hostbridge" },
|
||||
{ }
|
||||
|
@ -128,7 +128,7 @@ struct acpi_ops apl_lpc_acpi_ops = {
|
||||
.inject_dsdt = southbridge_inject_dsdt,
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id apl_lpc_ids[] = {
|
||||
{ .compatible = "intel,apl-lpc" },
|
||||
{ }
|
||||
|
@ -23,7 +23,7 @@ static const struct pch_ops apl_pch_ops = {
|
||||
.set_spi_protect = apl_set_spi_protect,
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id apl_pch_ids[] = {
|
||||
{ .compatible = "intel,apl-pch" },
|
||||
{ }
|
||||
|
@ -107,7 +107,7 @@ int apl_pmc_ofdata_to_uc_plat(struct udevice *dev)
|
||||
struct acpi_pmc_upriv *upriv = dev_get_uclass_priv(dev);
|
||||
struct apl_pmc_plat *plat = dev_get_plat(dev);
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
u32 base[6];
|
||||
int size;
|
||||
int ret;
|
||||
@ -206,7 +206,7 @@ static const struct acpi_pmc_ops apl_pmc_ops = {
|
||||
.global_reset_set_enable = apl_global_reset_set_enable,
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id apl_pmc_ids[] = {
|
||||
{ .compatible = "intel,apl-pmc" },
|
||||
{ }
|
||||
|
@ -123,7 +123,7 @@ static int apl_ns16550_of_to_plat(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id apl_ns16550_serial_ids[] = {
|
||||
{ .compatible = "intel,apl-ns16550" },
|
||||
{ },
|
||||
|
@ -16,8 +16,7 @@
|
||||
#include <asm/mtrr.h>
|
||||
#include <asm/cb_sysinfo.h>
|
||||
#include <asm/arch/timestamp.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
#include <dm/ofnode.h>
|
||||
|
||||
int arch_cpu_init(void)
|
||||
{
|
||||
@ -65,7 +64,7 @@ static void board_final_init(void)
|
||||
mtrr_close(&state, true);
|
||||
}
|
||||
|
||||
if (!fdtdec_get_config_bool(gd->fdt_blob, "u-boot,no-apm-finalize")) {
|
||||
if (!ofnode_conf_read_bool("u-boot,no-apm-finalize")) {
|
||||
/*
|
||||
* Issue SMI to coreboot to lock down ME and registers
|
||||
* when allowed via device tree
|
||||
|
@ -213,7 +213,7 @@ static const struct irq_ops itss_ops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id itss_ids[] = {
|
||||
{ .compatible = "intel,itss", .data = X86_IRQT_ITSS },
|
||||
{ }
|
||||
|
@ -88,7 +88,7 @@ int p2sb_of_to_plat(struct udevice *dev)
|
||||
struct p2sb_uc_priv *upriv = dev_get_uclass_priv(dev);
|
||||
struct p2sb_plat *plat = dev_get_plat(dev);
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
int ret;
|
||||
u32 base[2];
|
||||
|
||||
@ -159,16 +159,16 @@ static int p2sb_remove(struct udevice *dev)
|
||||
|
||||
static int p2sb_child_post_bind(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
|
||||
int ret;
|
||||
u32 pid;
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
|
||||
int ret;
|
||||
u32 pid;
|
||||
|
||||
ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid);
|
||||
if (ret)
|
||||
return ret;
|
||||
pplat->pid = pid;
|
||||
#endif
|
||||
ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid);
|
||||
if (ret)
|
||||
return ret;
|
||||
pplat->pid = pid;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -177,7 +177,7 @@ static const struct p2sb_ops p2sb_ops = {
|
||||
.set_hide = intel_p2sb_set_hide,
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id p2sb_ids[] = {
|
||||
{ .compatible = "intel,p2sb" },
|
||||
{ }
|
||||
|
@ -10,7 +10,7 @@
|
||||
UCLASS_DRIVER(lpc) = {
|
||||
.id = UCLASS_LPC,
|
||||
.name = "lpc",
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
};
|
||||
|
@ -139,7 +139,7 @@ void spl_board_init(void)
|
||||
* for devices, so the TPL BARs continue to be used. Once U-Boot starts it does
|
||||
* the auto allocation (after relocation).
|
||||
*/
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id tpl_fake_pci_ids[] = {
|
||||
{ .compatible = "pci-x86" },
|
||||
{ }
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <usb.h>
|
||||
#include <usb/dwc2_udc.h>
|
||||
#include <watchdog.h>
|
||||
#include <dm/ofnode.h>
|
||||
#include "../../st/common/stpmic1.h"
|
||||
|
||||
/* SYSCFG registers */
|
||||
@ -382,10 +383,10 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
|
||||
#ifdef CONFIG_LED
|
||||
static int get_led(struct udevice **dev, char *led_string)
|
||||
{
|
||||
char *led_name;
|
||||
const char *led_name;
|
||||
int ret;
|
||||
|
||||
led_name = fdtdec_get_config_string(gd->fdt_blob, led_string);
|
||||
led_name = ofnode_conf_read_str(led_string);
|
||||
if (!led_name) {
|
||||
pr_debug("%s: could not find %s config string\n",
|
||||
__func__, led_string);
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include <led.h>
|
||||
#include <log.h>
|
||||
#include <asm/global_data.h>
|
||||
#include <dm/ofnode.h>
|
||||
|
||||
#ifdef CONFIG_SPL_BUILD
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
static int setup_led(void)
|
||||
{
|
||||
#ifdef CONFIG_SPL_LED
|
||||
@ -18,7 +18,7 @@ static int setup_led(void)
|
||||
char *led_name;
|
||||
int ret;
|
||||
|
||||
led_name = fdtdec_get_config_string(gd->fdt_blob, "u-boot,boot-led");
|
||||
led_name = ofnode_conf_read_str("u-boot,boot-led");
|
||||
if (!led_name)
|
||||
return 0;
|
||||
ret = led_get_by_label(led_name, &dev);
|
||||
|
@ -300,7 +300,7 @@ struct sysinfo_ops coral_sysinfo_ops = {
|
||||
.get_str = coral_get_str,
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id coral_ids[] = {
|
||||
{ .compatible = "google,coral" },
|
||||
{ }
|
||||
|
@ -26,7 +26,10 @@
|
||||
gd_t *gd;
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
/* Add a simple GPIO device */
|
||||
/*
|
||||
* Add a simple GPIO device (don't use with of-platdata as it interferes with
|
||||
* the auto-generated devices)
|
||||
*/
|
||||
U_BOOT_DRVINFO(gpio_sandbox) = {
|
||||
.name = "sandbox_gpio",
|
||||
};
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <asm/gpio.h>
|
||||
#include <asm/arch/stm32.h>
|
||||
#include <asm/arch/sys_proto.h>
|
||||
#include <dm/ofnode.h>
|
||||
#include <jffs2/load_kernel.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/delay.h>
|
||||
@ -235,10 +236,10 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
|
||||
|
||||
static int get_led(struct udevice **dev, char *led_string)
|
||||
{
|
||||
char *led_name;
|
||||
const char *led_name;
|
||||
int ret;
|
||||
|
||||
led_name = fdtdec_get_config_string(gd->fdt_blob, led_string);
|
||||
led_name = ofnode_conf_read_str(led_string);
|
||||
if (!led_name) {
|
||||
log_debug("could not find %s config string\n", led_string);
|
||||
return -ENOENT;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <u-boot/sha256.h>
|
||||
#include <bootcount.h>
|
||||
#include <crypt.h>
|
||||
#include <dm/ofnode.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
@ -424,12 +425,12 @@ static void process_fdt_options(const void *blob)
|
||||
ulong addr;
|
||||
|
||||
/* Add an env variable to point to a kernel payload, if available */
|
||||
addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
|
||||
addr = ofnode_conf_read_int("kernel-offset", 0);
|
||||
if (addr)
|
||||
env_set_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
|
||||
|
||||
/* Add an env variable to point to a root disk, if available */
|
||||
addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
|
||||
addr = ofnode_conf_read_int("rootdisk-offset", 0);
|
||||
if (addr)
|
||||
env_set_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
|
||||
#endif /* CONFIG_SYS_TEXT_BASE */
|
||||
@ -446,8 +447,7 @@ const char *bootdelay_process(void)
|
||||
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
|
||||
|
||||
if (IS_ENABLED(CONFIG_OF_CONTROL))
|
||||
bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
|
||||
bootdelay);
|
||||
bootdelay = ofnode_conf_read_int("bootdelay", bootdelay);
|
||||
|
||||
debug("### main_loop entered: bootdelay=%d\n\n", bootdelay);
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
#endif
|
||||
#include <asm/sections.h>
|
||||
#include <dm/root.h>
|
||||
#include <dm/ofnode.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/err.h>
|
||||
#include <efi_loader.h>
|
||||
@ -448,8 +449,7 @@ static int initr_pvblock(void)
|
||||
static int should_load_env(void)
|
||||
{
|
||||
if (IS_ENABLED(CONFIG_OF_CONTROL))
|
||||
return fdtdec_get_config_int(gd->fdt_blob,
|
||||
"load-environment", 1);
|
||||
return ofnode_conf_read_int("load-environment", 1);
|
||||
|
||||
if (IS_ENABLED(CONFIG_DELAY_ENVIRONMENT))
|
||||
return 0;
|
||||
|
@ -19,8 +19,7 @@
|
||||
#include <hang.h>
|
||||
#include <malloc.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
#include <dm/ofnode.h>
|
||||
|
||||
#ifdef CONFIG_CMDLINE
|
||||
/*
|
||||
@ -157,7 +156,7 @@ int do_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||
bool cli_process_fdt(const char **cmdp)
|
||||
{
|
||||
/* Allow the fdt to override the boot command */
|
||||
char *env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
|
||||
const char *env = ofnode_conf_read_str("bootcmd");
|
||||
if (env)
|
||||
*cmdp = env;
|
||||
/*
|
||||
@ -165,7 +164,7 @@ bool cli_process_fdt(const char **cmdp)
|
||||
* Always use 'env' in this case, since bootsecure requres that the
|
||||
* bootcmd was specified in the FDT too.
|
||||
*/
|
||||
return fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0) != 0;
|
||||
return ofnode_conf_read_int("bootsecure", 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -489,7 +489,7 @@ static int spl_common_init(bool setup_malloc)
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
ret = fdtdec_setup();
|
||||
if (ret) {
|
||||
debug("fdtdec_setup() returned error %d\n", ret);
|
||||
|
@ -16,8 +16,7 @@
|
||||
#include <errno.h>
|
||||
#include <spl.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
#include <dm/ofnode.h>
|
||||
|
||||
#ifdef CONFIG_SPL_OS_BOOT
|
||||
/*
|
||||
@ -103,11 +102,10 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
|
||||
|
||||
header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
payload_offs = fdtdec_get_config_int(gd->fdt_blob,
|
||||
"u-boot,spl-payload-offset",
|
||||
payload_offs);
|
||||
#endif
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
payload_offs = ofnode_conf_read_int("u-boot,spl-payload-offset",
|
||||
payload_offs);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPL_OS_BOOT
|
||||
if (spl_start_uboot() || spi_load_image_os(spl_image, flash, header))
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_SYS_TEXT_BASE=0x200000
|
||||
CONFIG_SPL_GPIO=y
|
||||
CONFIG_SPL_LIBCOMMON_SUPPORT=y
|
||||
CONFIG_SPL_LIBGENERIC_SUPPORT=y
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
@ -122,6 +123,7 @@ CONFIG_SANDBOX_GPIO=y
|
||||
CONFIG_I2C_CROS_EC_TUNNEL=y
|
||||
CONFIG_I2C_CROS_EC_LDO=y
|
||||
CONFIG_DM_I2C_GPIO=y
|
||||
# CONFIG_SPL_DM_I2C_GPIO is not set
|
||||
CONFIG_SYS_I2C_SANDBOX=y
|
||||
CONFIG_I2C_MUX=y
|
||||
CONFIG_I2C_ARB_GPIO_CHALLENGE=y
|
||||
|
@ -1,4 +1,5 @@
|
||||
CONFIG_SYS_TEXT_BASE=0x200000
|
||||
CONFIG_SPL_GPIO=y
|
||||
CONFIG_SPL_LIBCOMMON_SUPPORT=y
|
||||
CONFIG_SPL_LIBGENERIC_SUPPORT=y
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
@ -124,6 +125,7 @@ CONFIG_SANDBOX_GPIO=y
|
||||
CONFIG_I2C_CROS_EC_TUNNEL=y
|
||||
CONFIG_I2C_CROS_EC_LDO=y
|
||||
CONFIG_DM_I2C_GPIO=y
|
||||
# CONFIG_SPL_DM_I2C_GPIO is not set
|
||||
CONFIG_SYS_I2C_SANDBOX=y
|
||||
CONFIG_I2C_MUX=y
|
||||
CONFIG_I2C_ARB_GPIO_CHALLENGE=y
|
||||
|
@ -23,12 +23,11 @@
|
||||
#include <malloc.h>
|
||||
#include <memalign.h>
|
||||
#include <part_efi.h>
|
||||
#include <dm/ofnode.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <u-boot/crc.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#ifdef CONFIG_HAVE_BLOCK_DEVICE
|
||||
|
||||
/* GUID for basic data partitons */
|
||||
@ -563,9 +562,8 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
|
||||
* from the start of the device) to be specified as a property
|
||||
* of the device tree '/config' node.
|
||||
*/
|
||||
config_offset = fdtdec_get_config_int(gd->fdt_blob,
|
||||
"u-boot,efi-partition-entries-offset",
|
||||
-EINVAL);
|
||||
config_offset = ofnode_conf_read_int(
|
||||
"u-boot,efi-partition-entries-offset", -EINVAL);
|
||||
if (config_offset != -EINVAL) {
|
||||
offset_bytes = PAD_TO_BLOCKSIZE(config_offset, dev_desc);
|
||||
offset_blks = offset_bytes / dev_desc->blksz;
|
||||
|
@ -215,16 +215,16 @@ For example:
|
||||
|
||||
static int mmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
/* Decode the devicetree data */
|
||||
struct mmc_plat *plat = dev_get_plat(dev);
|
||||
const void *blob = gd->fdt_blob;
|
||||
int node = dev_of_offset(dev);
|
||||
|
||||
plat->fifo_depth = fdtdec_get_int(blob, node, "fifo-depth", 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mmc_probe(struct udevice *dev)
|
||||
@ -642,7 +642,7 @@ Missing .compatible or Missing .id
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Various things can cause dtoc to fail to find the driver and it tries to
|
||||
warn about these. For example:
|
||||
warn about these. For example::
|
||||
|
||||
rockchip_rk3188_uart: Missing .compatible in drivers/serial/serial_rockchip.c
|
||||
: WARNING: the driver rockchip_rk3188_uart was not found in the driver list
|
||||
@ -733,6 +733,54 @@ The fix above would fix this error too. But if you do want this uclass in the
|
||||
build, check your Kconfig settings to make sure the uclass is being built
|
||||
(CONFIG_MISC in this case).
|
||||
|
||||
Another error that can crop up is something like::
|
||||
|
||||
spl/dts/dt-device.c:257:38: error: invalid application of ‘sizeof’ to
|
||||
incomplete type ‘struct sandbox_irq_priv’
|
||||
257 | u8 _sandbox_irq_priv_irq_sbox[sizeof(struct sandbox_irq_priv)]
|
||||
| ^~~~~~
|
||||
|
||||
This indicates that `struct sandbox_irq_priv` is not defined anywhere. The
|
||||
solution is to add a DM_HEADER() line, as below, so this is included in the
|
||||
dt-device.c file::
|
||||
|
||||
U_BOOT_DRIVER(sandbox_irq) = {
|
||||
.name = "sandbox_irq",
|
||||
.id = UCLASS_IRQ,
|
||||
.of_match = sandbox_irq_ids,
|
||||
.ops = &sandbox_irq_ops,
|
||||
.priv_auto = sizeof(struct sandbox_irq_priv),
|
||||
DM_HEADER(<asm/irq.h>)
|
||||
};
|
||||
|
||||
Note that there is no dependency checking on the above, so U-Boot will not
|
||||
regenerate the dt-device.c file when you update the source file (here,
|
||||
`irq_sandbox.c`). You need to run `make mrproper` first to get a fresh build.
|
||||
|
||||
Another error that can crop up is something like::
|
||||
|
||||
spl/dts/dt-device.c:257:38: error: invalid application of ‘sizeof’ to
|
||||
incomplete type ‘struct sandbox_irq_priv’
|
||||
257 | u8 _sandbox_irq_priv_irq_sbox[sizeof(struct sandbox_irq_priv)]
|
||||
| ^~~~~~
|
||||
|
||||
This indicates that `struct sandbox_irq_priv` is not defined anywhere. The
|
||||
solution is to add a DM_HEADER() line, as below, so this is included in the
|
||||
dt-device.c file::
|
||||
|
||||
U_BOOT_DRIVER(sandbox_irq) = {
|
||||
.name = "sandbox_irq",
|
||||
.id = UCLASS_IRQ,
|
||||
.of_match = sandbox_irq_ids,
|
||||
.ops = &sandbox_irq_ops,
|
||||
.priv_auto = sizeof(struct sandbox_irq_priv),
|
||||
DM_HEADER(<asm/irq.h>)
|
||||
};
|
||||
|
||||
Note that there is no dependency checking on the above, so U-Boot will not
|
||||
regenerate the dt-device.c file when you update the source file (here,
|
||||
`irq_sandbox.c`). You need to run `make mrproper` first to get a fresh build.
|
||||
|
||||
|
||||
Caveats
|
||||
-------
|
||||
|
@ -2,8 +2,8 @@ The /config node (Configuration Options)
|
||||
----------------------------------------
|
||||
|
||||
A number of run-time configuration options are provided in the /config node
|
||||
of the control device tree. You can access these using fdtdec_get_config_int(),
|
||||
fdtdec_get_config_bool() and fdtdec_get_config_string().
|
||||
of the control device tree. You can access these using ofnode_conf_read_int(),
|
||||
ofnode_conf_read_bool() and ofnode_conf_read_str().
|
||||
|
||||
These options are designed to affect the operation of U-Boot at runtime.
|
||||
Runtime-configuration items can help avoid proliferation of different builds
|
||||
|
@ -35,10 +35,9 @@ struct clk *dev_get_clk_ptr(struct udevice *dev)
|
||||
return (struct clk *)dev_get_uclass_priv(dev);
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
# if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells,
|
||||
struct clk *clk)
|
||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
int clk_get_by_phandle(struct udevice *dev, const struct phandle_1_arg *cells,
|
||||
struct clk *clk)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -49,7 +48,9 @@ int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells,
|
||||
|
||||
return 0;
|
||||
}
|
||||
# else
|
||||
#endif
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int clk_of_xlate_default(struct clk *clk,
|
||||
struct ofnode_phandle_args *args)
|
||||
{
|
||||
@ -412,7 +413,7 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
|
||||
|
||||
return clk_get_by_index(dev, index, clk);
|
||||
}
|
||||
# endif /* OF_PLATDATA */
|
||||
#endif /* OF_REAL */
|
||||
|
||||
int clk_get_by_name_nodev(ofnode node, const char *name, struct clk *clk)
|
||||
{
|
||||
@ -465,8 +466,6 @@ int clk_release_all(struct clk *clk, int count)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* OF_CONTROL */
|
||||
|
||||
int clk_request(struct udevice *dev, struct clk *clk)
|
||||
{
|
||||
const struct clk_ops *ops;
|
||||
|
@ -40,17 +40,17 @@ const struct clk_ops clk_fixed_factor_ops = {
|
||||
|
||||
static int clk_fixed_factor_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
int err;
|
||||
struct clk_fixed_factor *ff = to_clk_fixed_factor(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
int err;
|
||||
struct clk_fixed_factor *ff = to_clk_fixed_factor(dev);
|
||||
|
||||
err = clk_get_by_index(dev, 0, &ff->parent);
|
||||
if (err)
|
||||
return err;
|
||||
err = clk_get_by_index(dev, 0, &ff->parent);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
ff->div = dev_read_u32_default(dev, "clock-div", 1);
|
||||
ff->mult = dev_read_u32_default(dev, "clock-mult", 1);
|
||||
#endif
|
||||
ff->div = dev_read_u32_default(dev, "clock-div", 1);
|
||||
ff->mult = dev_read_u32_default(dev, "clock-mult", 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,9 +32,10 @@ void clk_fixed_rate_ofdata_to_plat_(struct udevice *dev,
|
||||
struct clk_fixed_rate *plat)
|
||||
{
|
||||
struct clk *clk = &plat->clk;
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
plat->fixed_rate = dev_read_u32_default(dev, "clock-frequency", 0);
|
||||
#endif
|
||||
if (CONFIG_IS_ENABLED(OF_REAL))
|
||||
plat->fixed_rate = dev_read_u32_default(dev, "clock-frequency",
|
||||
0);
|
||||
|
||||
/* Make fixed rate clock accessible from higher level struct clk */
|
||||
/* FIXME: This is not allowed */
|
||||
dev_set_uclass_priv(dev, clk);
|
||||
|
@ -1367,7 +1367,7 @@ static ulong px30_clk_set_rate(struct clk *clk, ulong rate)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int px30_gmac_set_parent(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
struct px30_clk_priv *priv = dev_get_priv(clk->dev);
|
||||
@ -1418,7 +1418,7 @@ static int px30_clk_enable(struct clk *clk)
|
||||
static struct clk_ops px30_clk_ops = {
|
||||
.get_rate = px30_clk_get_rate,
|
||||
.set_rate = px30_clk_set_rate,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.set_parent = px30_clk_set_parent,
|
||||
#endif
|
||||
.enable = px30_clk_enable,
|
||||
|
@ -540,11 +540,11 @@ static struct clk_ops rk3188_clk_ops = {
|
||||
|
||||
static int rk3188_clk_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3188_clk_priv *priv = dev_get_priv(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct rk3188_clk_priv *priv = dev_get_priv(dev);
|
||||
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
#endif
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -950,18 +950,18 @@ static int __maybe_unused rk3288_clk_set_parent(struct clk *clk, struct clk *par
|
||||
static struct clk_ops rk3288_clk_ops = {
|
||||
.get_rate = rk3288_clk_get_rate,
|
||||
.set_rate = rk3288_clk_set_rate,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.set_parent = rk3288_clk_set_parent,
|
||||
#endif
|
||||
};
|
||||
|
||||
static int rk3288_clk_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3288_clk_priv *priv = dev_get_priv(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct rk3288_clk_priv *priv = dev_get_priv(dev);
|
||||
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
#endif
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -939,7 +939,7 @@ static ulong rk3308_clk_set_rate(struct clk *clk, ulong rate)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int __maybe_unused rk3308_mac_set_parent(struct clk *clk, struct clk *parent)
|
||||
{
|
||||
struct rk3308_clk_priv *priv = dev_get_priv(clk->dev);
|
||||
@ -976,7 +976,7 @@ static int __maybe_unused rk3308_clk_set_parent(struct clk *clk, struct clk *par
|
||||
static struct clk_ops rk3308_clk_ops = {
|
||||
.get_rate = rk3308_clk_get_rate,
|
||||
.set_rate = rk3308_clk_set_rate,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.set_parent = rk3308_clk_set_parent,
|
||||
#endif
|
||||
};
|
||||
|
@ -574,7 +574,7 @@ static int __maybe_unused rk3368_clk_set_parent(struct clk *clk, struct clk *par
|
||||
static struct clk_ops rk3368_clk_ops = {
|
||||
.get_rate = rk3368_clk_get_rate,
|
||||
.set_rate = rk3368_clk_set_rate,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.set_parent = rk3368_clk_set_parent,
|
||||
#endif
|
||||
};
|
||||
@ -596,11 +596,11 @@ static int rk3368_clk_probe(struct udevice *dev)
|
||||
|
||||
static int rk3368_clk_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3368_clk_priv *priv = dev_get_priv(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct rk3368_clk_priv *priv = dev_get_priv(dev);
|
||||
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
#endif
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1289,7 +1289,7 @@ static int rk3399_clk_disable(struct clk *clk)
|
||||
static struct clk_ops rk3399_clk_ops = {
|
||||
.get_rate = rk3399_clk_get_rate,
|
||||
.set_rate = rk3399_clk_set_rate,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.set_parent = rk3399_clk_set_parent,
|
||||
#endif
|
||||
.enable = rk3399_clk_enable,
|
||||
@ -1402,11 +1402,12 @@ static int rk3399_clk_probe(struct udevice *dev)
|
||||
|
||||
static int rk3399_clk_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3399_clk_priv *priv = dev_get_priv(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct rk3399_clk_priv *priv = dev_get_priv(dev);
|
||||
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
}
|
||||
|
||||
priv->cru = dev_read_addr_ptr(dev);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1614,11 +1615,12 @@ static int rk3399_pmuclk_probe(struct udevice *dev)
|
||||
|
||||
static int rk3399_pmuclk_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3399_pmuclk_priv *priv = dev_get_priv(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct rk3399_pmuclk_priv *priv = dev_get_priv(dev);
|
||||
|
||||
priv->pmucru = dev_read_addr_ptr(dev);
|
||||
}
|
||||
|
||||
priv->pmucru = dev_read_addr_ptr(dev);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -670,7 +670,7 @@ static int device_get_device_tail(struct udevice *dev, int ret,
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
/**
|
||||
* device_find_by_ofnode() - Return device associated with given ofnode
|
||||
*
|
||||
@ -1074,7 +1074,7 @@ void dev_set_uclass_plat(struct udevice *dev, void *uclass_plat)
|
||||
dev->uclass_plat_ = uclass_plat;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
bool device_is_compatible(const struct udevice *dev, const char *compat)
|
||||
{
|
||||
return ofnode_device_is_compatible(dev_ofnode(dev), compat);
|
||||
|
@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index)
|
||||
{
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
fdt_addr_t addr;
|
||||
|
||||
if (CONFIG_IS_ENABLED(OF_TRANSLATE)) {
|
||||
|
@ -154,7 +154,7 @@ int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
/**
|
||||
* driver_check_compatible() - Check if a driver matches a compatible string
|
||||
*
|
||||
|
@ -1103,3 +1103,36 @@ int ofnode_set_enabled(ofnode node, bool value)
|
||||
else
|
||||
return ofnode_write_string(node, "status", "disabled");
|
||||
}
|
||||
|
||||
bool ofnode_conf_read_bool(const char *prop_name)
|
||||
{
|
||||
ofnode node;
|
||||
|
||||
node = ofnode_path("/config");
|
||||
if (!ofnode_valid(node))
|
||||
return false;
|
||||
|
||||
return ofnode_read_bool(node, prop_name);
|
||||
}
|
||||
|
||||
int ofnode_conf_read_int(const char *prop_name, int default_val)
|
||||
{
|
||||
ofnode node;
|
||||
|
||||
node = ofnode_path("/config");
|
||||
if (!ofnode_valid(node))
|
||||
return default_val;
|
||||
|
||||
return ofnode_read_u32_default(node, prop_name, default_val);
|
||||
}
|
||||
|
||||
const char *ofnode_conf_read_str(const char *prop_name)
|
||||
{
|
||||
ofnode node;
|
||||
|
||||
node = ofnode_path("/config");
|
||||
if (!ofnode_valid(node))
|
||||
return NULL;
|
||||
|
||||
return ofnode_read_string(node, prop_name);
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ int dm_scan_plat(bool pre_reloc_only)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
/**
|
||||
* dm_scan_fdt_node() - Scan the device tree and bind drivers for a node
|
||||
*
|
||||
@ -372,7 +372,7 @@ static int dm_scan(bool pre_reloc_only)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
ret = dm_extended_scan(pre_reloc_only);
|
||||
if (ret) {
|
||||
debug("dm_extended_scan() failed: %d\n", ret);
|
||||
|
@ -65,7 +65,7 @@ UCLASS_DRIVER(simple_bus) = {
|
||||
.per_device_plat_auto = sizeof(struct simple_bus_plat),
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id generic_simple_bus_ids[] = {
|
||||
{ .compatible = "simple-bus" },
|
||||
{ .compatible = "simple-mfd" },
|
||||
|
@ -186,7 +186,7 @@ static const struct udevice_id generic_syscon_ids[] = {
|
||||
U_BOOT_DRIVER(generic_syscon) = {
|
||||
.name = "syscon",
|
||||
.id = UCLASS_SYSCON,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.of_match = generic_syscon_ids,
|
||||
|
@ -397,7 +397,7 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent,
|
||||
const char *name, struct udevice **devp)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ int list_count_items(struct list_head *head)
|
||||
return count;
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
int pci_get_devfn(struct udevice *dev)
|
||||
{
|
||||
struct fdt_pci_addr addr;
|
||||
|
@ -38,7 +38,7 @@ static int cpu_sandbox_get_vendor(const struct udevice *dev, char *buf,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *cpu_current = "cpu-test1";
|
||||
static const char *cpu_current = "cpu@1";
|
||||
|
||||
void cpu_sandbox_set_current(const char *name)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@
|
||||
UCLASS_DRIVER(firmware) = {
|
||||
.id = UCLASS_FIRMWARE,
|
||||
.name = "firmware",
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ obj-$(CONFIG_ROCKCHIP_GPIO) += rk_gpio.o
|
||||
obj-$(CONFIG_RCAR_GPIO) += gpio-rcar.o
|
||||
obj-$(CONFIG_RZA1_GPIO) += gpio-rza1.o
|
||||
obj-$(CONFIG_S5P) += s5p_gpio.o
|
||||
obj-$(CONFIG_SANDBOX_GPIO) += sandbox.o
|
||||
obj-$(CONFIG_SANDBOX_GPIO) += sandbox.o sandbox_test.o
|
||||
obj-$(CONFIG_TEGRA_GPIO) += tegra_gpio.o
|
||||
obj-$(CONFIG_TEGRA186_GPIO) += tegra186_gpio.o
|
||||
obj-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o
|
||||
@ -62,7 +62,7 @@ obj-$(CONFIG_OCTEON_GPIO) += octeon_gpio.o
|
||||
obj-$(CONFIG_MVEBU_GPIO) += mvebu_gpio.o
|
||||
obj-$(CONFIG_MSM_GPIO) += msm_gpio.o
|
||||
obj-$(CONFIG_$(SPL_)PCF8575_GPIO) += pcf8575_gpio.o
|
||||
obj-$(CONFIG_PM8916_GPIO) += pm8916_gpio.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)PM8916_GPIO) += pm8916_gpio.o
|
||||
obj-$(CONFIG_MT7620_GPIO) += mt7620_gpio.o
|
||||
obj-$(CONFIG_MT7621_GPIO) += mt7621_gpio.o
|
||||
obj-$(CONFIG_MSCC_SGPIO) += mscc_sgpio.o
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <dt-structs.h>
|
||||
#include <log.h>
|
||||
#include <dm/devres.h>
|
||||
#include <dm/device_compat.h>
|
||||
@ -231,7 +232,7 @@ static int gpio_find_and_xlate(struct gpio_desc *desc,
|
||||
return gpio_xlate_offs_flags(desc->dev, desc, args);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_GPIO_HOG)
|
||||
#if CONFIG_IS_ENABLED(GPIO_HOG)
|
||||
|
||||
struct gpio_hog_priv {
|
||||
struct gpio_desc gpiod;
|
||||
@ -1137,7 +1138,7 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int _gpio_request_by_name_nodev(ofnode node, const char *list_name,
|
||||
int index, struct gpio_desc *desc,
|
||||
int flags, bool add_index)
|
||||
@ -1226,6 +1227,27 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
|
||||
}
|
||||
#endif /* OF_PLATDATA */
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
int gpio_request_by_phandle(struct udevice *dev,
|
||||
const struct phandle_2_arg *cells,
|
||||
struct gpio_desc *desc, int flags)
|
||||
{
|
||||
struct ofnode_phandle_args args;
|
||||
struct udevice *gpio_dev;
|
||||
const int index = 0;
|
||||
int ret;
|
||||
|
||||
ret = device_get_by_ofplat_idx(cells->idx, &gpio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
args.args[0] = cells->arg[0];
|
||||
args.args[1] = cells->arg[1];
|
||||
|
||||
return gpio_request_tail(ret, NULL, &args, NULL, index, desc, flags,
|
||||
index > 0, gpio_dev);
|
||||
}
|
||||
#endif
|
||||
|
||||
int dm_gpio_free(struct udevice *dev, struct gpio_desc *desc)
|
||||
{
|
||||
/* For now, we don't do any checking of dev */
|
||||
@ -1430,7 +1452,7 @@ static int gpio_post_bind(struct udevice *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (IS_ENABLED(CONFIG_GPIO_HOG)) {
|
||||
if (CONFIG_IS_ENABLED(OF_REAL) && IS_ENABLED(CONFIG_GPIO_HOG)) {
|
||||
dev_for_each_subnode(node, dev) {
|
||||
if (ofnode_read_bool(node, "gpio-hog")) {
|
||||
const char *name = ofnode_get_name(node);
|
||||
|
@ -204,7 +204,7 @@ static const struct dm_gpio_ops gpio_intel_ops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id intel_intel_gpio_ids[] = {
|
||||
{ .compatible = "intel,gpio" },
|
||||
{ }
|
||||
|
@ -262,7 +262,7 @@ static int mxs_gpio_probe(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int mxs_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct mxs_gpio_plat *plat = dev_get_plat(dev);
|
||||
@ -301,7 +301,7 @@ U_BOOT_DRIVER(fsl_imx23_gpio) = {
|
||||
.probe = mxs_gpio_probe,
|
||||
.priv_auto = sizeof(struct mxs_gpio_priv),
|
||||
.plat_auto = sizeof(struct mxs_gpio_plat),
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.of_match = mxs_gpio_ids,
|
||||
.of_to_plat = mxs_of_to_plat,
|
||||
#endif
|
||||
|
@ -336,7 +336,7 @@ static int omap_gpio_bind(struct udevice *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id omap_gpio_ids[] = {
|
||||
{ .compatible = "ti,omap3-gpio" },
|
||||
{ .compatible = "ti,omap4-gpio" },
|
||||
@ -362,7 +362,7 @@ U_BOOT_DRIVER(gpio_omap) = {
|
||||
.name = "gpio_omap",
|
||||
.id = UCLASS_GPIO,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.of_match = omap_gpio_ids,
|
||||
.of_to_plat = of_match_ptr(omap_gpio_of_to_plat),
|
||||
.plat_auto = sizeof(struct omap_gpio_plat),
|
||||
|
@ -323,11 +323,13 @@ static const struct dm_gpio_ops gpio_sandbox_ops = {
|
||||
|
||||
static int sandbox_gpio_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
|
||||
|
||||
uc_priv->gpio_count = dev_read_u32_default(dev, "sandbox,gpio-count",
|
||||
0);
|
||||
uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
|
||||
uc_priv->gpio_count =
|
||||
dev_read_u32_default(dev, "sandbox,gpio-count", 0);
|
||||
uc_priv->bank_name = dev_read_string(dev, "gpio-bank-name");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -371,6 +373,8 @@ U_BOOT_DRIVER(sandbox_gpio) = {
|
||||
|
||||
DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias)
|
||||
|
||||
#if CONFIG_IS_ENABLED(PINCTRL)
|
||||
|
||||
/* pincontrol: used only to check GPIO pin configuration (pinmux command) */
|
||||
|
||||
struct sb_pinctrl_priv {
|
||||
@ -579,3 +583,5 @@ U_BOOT_DRIVER(sandbox_pinctrl_gpio) = {
|
||||
.priv_auto = sizeof(struct sb_pinctrl_priv),
|
||||
ACPI_OPS_PTR(&pinctrl_sandbox_acpi_ops)
|
||||
};
|
||||
|
||||
#endif /* PINCTRL */
|
||||
|
21
drivers/gpio/sandbox_test.c
Normal file
21
drivers/gpio/sandbox_test.c
Normal file
@ -0,0 +1,21 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Sandbox driver for testing GPIOs with of-platdata
|
||||
*
|
||||
* Copyright 2021 Google LLC
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <asm-generic/gpio.h>
|
||||
|
||||
static const struct udevice_id sandbox_gpio_test_ids[] = {
|
||||
{ .compatible = "sandbox,gpio-test" },
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(sandbox_gpio_test) = {
|
||||
.name = "sandbox_gpio_test",
|
||||
.id = UCLASS_MISC,
|
||||
.of_match = sandbox_gpio_test_ids,
|
||||
};
|
@ -79,7 +79,7 @@ UCLASS_DRIVER(i2c_emul) = {
|
||||
UCLASS_DRIVER(i2c_emul_parent) = {
|
||||
.id = UCLASS_I2C_EMUL_PARENT,
|
||||
.name = "i2c_emul_parent",
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
};
|
||||
|
@ -633,7 +633,7 @@ int i2c_deblock(struct udevice *bus)
|
||||
return ops->deblock(bus);
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip)
|
||||
{
|
||||
int addr;
|
||||
@ -655,7 +655,7 @@ int i2c_chip_of_to_plat(struct udevice *dev, struct dm_i2c_chip *chip)
|
||||
|
||||
static int i2c_pre_probe(struct udevice *dev)
|
||||
{
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
struct dm_i2c_bus *i2c = dev_get_uclass_priv(dev);
|
||||
unsigned int max = 0;
|
||||
ofnode node;
|
||||
@ -678,7 +678,7 @@ static int i2c_pre_probe(struct udevice *dev)
|
||||
|
||||
static int i2c_post_probe(struct udevice *dev)
|
||||
{
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
struct dm_i2c_bus *i2c = dev_get_uclass_priv(dev);
|
||||
|
||||
i2c->speed_hz = dev_read_u32_default(dev, "clock-frequency",
|
||||
@ -692,7 +692,7 @@ static int i2c_post_probe(struct udevice *dev)
|
||||
|
||||
static int i2c_child_post_bind(struct udevice *dev)
|
||||
{
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
struct dm_i2c_chip *plat = dev_get_parent_plat(dev);
|
||||
|
||||
if (!dev_has_ofnode(dev))
|
||||
@ -709,7 +709,7 @@ static int i2c_post_bind(struct udevice *dev)
|
||||
|
||||
debug("%s: %s, seq=%d\n", __func__, dev->name, dev_seq(dev));
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
ret = dm_scan_fdt_dev(dev);
|
||||
#endif
|
||||
return ret;
|
||||
|
@ -1034,7 +1034,7 @@ static int omap_i2c_probe(struct udevice *bus)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int omap_i2c_of_to_plat(struct udevice *bus)
|
||||
{
|
||||
struct omap_i2c_plat *plat = dev_get_plat(bus);
|
||||
@ -1063,7 +1063,7 @@ static const struct dm_i2c_ops omap_i2c_ops = {
|
||||
U_BOOT_DRIVER(i2c_omap) = {
|
||||
.name = "i2c_omap",
|
||||
.id = UCLASS_I2C,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.of_match = omap_i2c_ids,
|
||||
.of_to_plat = omap_i2c_of_to_plat,
|
||||
.plat_auto = sizeof(struct omap_i2c_plat),
|
||||
|
@ -42,7 +42,7 @@ obj-$(CONFIG_GDSYS_IOEP) += gdsys_ioep.o
|
||||
obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
|
||||
obj-$(CONFIG_GDSYS_SOC) += gdsys_soc.o
|
||||
obj-$(CONFIG_IRQ) += irq-uclass.o
|
||||
obj-$(CONFIG_SANDBOX) += irq_sandbox.o
|
||||
obj-$(CONFIG_SANDBOX) += irq_sandbox.o irq_sandbox_test.o
|
||||
obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o
|
||||
obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o
|
||||
obj-$(CONFIG_IMX8) += imx8/
|
||||
|
@ -1671,7 +1671,7 @@ UCLASS_DRIVER(cros_ec) = {
|
||||
.id = UCLASS_CROS_EC,
|
||||
.name = "cros-ec",
|
||||
.per_device_auto = sizeof(struct cros_ec_dev),
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.flags = DM_UC_FLAG_ALLOC_PRIV_DMA,
|
||||
|
@ -64,8 +64,8 @@ int irq_read_and_clear(struct irq *irq)
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
int irq_get_by_driver_info(struct udevice *dev,
|
||||
struct phandle_1_arg *cells, struct irq *irq)
|
||||
int irq_get_by_phandle(struct udevice *dev, const struct phandle_2_arg *cells,
|
||||
struct irq *irq)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -74,6 +74,12 @@ int irq_get_by_driver_info(struct udevice *dev,
|
||||
return ret;
|
||||
irq->id = cells->arg[0];
|
||||
|
||||
/*
|
||||
* Note: we could call irq_of_xlate_default() here to do this properly.
|
||||
* For now, this is good enough for existing cases.
|
||||
*/
|
||||
irq->flags = cells->arg[1];
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
@ -9,19 +9,9 @@
|
||||
#include <dm.h>
|
||||
#include <irq.h>
|
||||
#include <acpi/acpi_device.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/test.h>
|
||||
|
||||
/**
|
||||
* struct sandbox_irq_priv - private data for this driver
|
||||
*
|
||||
* @count: Counts the number calls to the read_and_clear() method
|
||||
* @pending: true if an interrupt is pending, else false
|
||||
*/
|
||||
struct sandbox_irq_priv {
|
||||
int count;
|
||||
bool pending;
|
||||
};
|
||||
|
||||
static int sandbox_set_polarity(struct udevice *dev, uint irq, bool active_low)
|
||||
{
|
||||
if (irq > 10)
|
||||
@ -103,10 +93,11 @@ static const struct udevice_id sandbox_irq_ids[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(sandbox_irq_drv) = {
|
||||
U_BOOT_DRIVER(sandbox_irq) = {
|
||||
.name = "sandbox_irq",
|
||||
.id = UCLASS_IRQ,
|
||||
.of_match = sandbox_irq_ids,
|
||||
.ops = &sandbox_irq_ops,
|
||||
.priv_auto = sizeof(struct sandbox_irq_priv),
|
||||
DM_HEADER(<asm/irq.h>)
|
||||
};
|
||||
|
22
drivers/misc/irq_sandbox_test.c
Normal file
22
drivers/misc/irq_sandbox_test.c
Normal file
@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Sandbox driver for testing interrupts with of-platdata
|
||||
*
|
||||
* Copyright 2021 Google LLC
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <dm.h>
|
||||
#include <irq.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
static const struct udevice_id sandbox_irq_test_ids[] = {
|
||||
{ .compatible = "sandbox,irq-test" },
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(sandbox_irq_test) = {
|
||||
.name = "sandbox_irq_test",
|
||||
.id = UCLASS_MISC,
|
||||
.of_match = sandbox_irq_test_ids,
|
||||
};
|
@ -70,7 +70,7 @@ int misc_set_enabled(struct udevice *dev, bool val)
|
||||
UCLASS_DRIVER(misc) = {
|
||||
.id = UCLASS_MISC,
|
||||
.name = "misc",
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
};
|
||||
|
@ -183,16 +183,16 @@ int p2sb_set_port_id(struct udevice *dev, int portid)
|
||||
|
||||
static int p2sb_child_post_bind(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
|
||||
int ret;
|
||||
u32 pid;
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct p2sb_child_plat *pplat = dev_get_parent_plat(dev);
|
||||
int ret;
|
||||
u32 pid;
|
||||
|
||||
ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid);
|
||||
if (ret)
|
||||
return ret;
|
||||
pplat->pid = pid;
|
||||
#endif
|
||||
ret = dev_read_u32(dev, "intel,p2sb-port-id", &pid);
|
||||
if (ret)
|
||||
return ret;
|
||||
pplat->pid = pid;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1411,7 +1411,6 @@ __weak void init_clk_usdhc(u32 index)
|
||||
|
||||
static int fsl_esdhc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct fsl_esdhc_priv *priv = dev_get_priv(dev);
|
||||
#if CONFIG_IS_ENABLED(DM_REGULATOR)
|
||||
struct udevice *vqmmc_dev;
|
||||
@ -1419,10 +1418,12 @@ static int fsl_esdhc_of_to_plat(struct udevice *dev)
|
||||
#endif
|
||||
const void *fdt = gd->fdt_blob;
|
||||
int node = dev_of_offset(dev);
|
||||
|
||||
fdt_addr_t addr;
|
||||
unsigned int val;
|
||||
|
||||
if (!CONFIG_IS_ENABLED(OF_REAL))
|
||||
return 0;
|
||||
|
||||
addr = dev_read_addr(dev);
|
||||
if (addr == FDT_ADDR_T_NONE)
|
||||
return -EINVAL;
|
||||
@ -1494,7 +1495,7 @@ static int fsl_esdhc_of_to_plat(struct udevice *dev)
|
||||
priv->vs18_enable = 1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1598,11 +1599,11 @@ static int fsl_esdhc_probe(struct udevice *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
ret = mmc_of_parse(dev, &plat->cfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
ret = mmc_of_parse(dev, &plat->cfg);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
mmc = &plat->mmc;
|
||||
mmc->cfg = &plat->cfg;
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include <syscon.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define CFG_CMD_TIMEOUT (CONFIG_SYS_HZ >> 4) /* 250 ms */
|
||||
#define CFG_RST_TIMEOUT CONFIG_SYS_HZ /* 1 sec reset timeout */
|
||||
|
||||
@ -392,34 +390,29 @@ static void ftsdc_setup_cfg(struct mmc_config *cfg, const char *name, int buswid
|
||||
|
||||
static int ftsdc010_mmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct ftsdc_priv *priv = dev_get_priv(dev);
|
||||
struct ftsdc010_chip *chip = &priv->chip;
|
||||
chip->name = dev->name;
|
||||
chip->ioaddr = dev_read_addr_ptr(dev);
|
||||
chip->buswidth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
|
||||
"bus-width", 4);
|
||||
chip->priv = dev;
|
||||
priv->fifo_depth = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
|
||||
"fifo-depth", 0);
|
||||
priv->fifo_mode = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
|
||||
"fifo-mode");
|
||||
if (fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
|
||||
"clock-freq-min-max", priv->minmax, 2)) {
|
||||
int val = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
|
||||
"max-frequency", -EINVAL);
|
||||
if (val < 0)
|
||||
return val;
|
||||
|
||||
priv->minmax[0] = 400000; /* 400 kHz */
|
||||
priv->minmax[1] = val;
|
||||
} else {
|
||||
debug("%s: 'clock-freq-min-max' property was deprecated.\n",
|
||||
__func__);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
chip->name = dev->name;
|
||||
chip->ioaddr = dev_read_addr_ptr(dev);
|
||||
chip->buswidth = dev_read_u32_default(dev, "bus-width", 4);
|
||||
chip->priv = dev;
|
||||
priv->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0);
|
||||
priv->fifo_mode = dev_read_bool(dev, "fifo-mode");
|
||||
if (dev_read_u32_array(dev, "clock-freq-min-max", priv->minmax, 2)) {
|
||||
if (dev_read_u32(dev, "max-frequency", &priv->minmax[1]))
|
||||
return -EINVAL;
|
||||
|
||||
priv->minmax[0] = 400000; /* 400 kHz */
|
||||
} else {
|
||||
debug("%s: 'clock-freq-min-max' property was deprecated.\n",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
chip->sclk = priv->minmax[1];
|
||||
chip->regs = chip->ioaddr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -440,7 +433,7 @@ static int ftsdc010_mmc_probe(struct udevice *dev)
|
||||
chip->priv = dev;
|
||||
chip->dev_index = 1;
|
||||
memcpy(priv->minmax, dtplat->clock_freq_min_max, sizeof(priv->minmax));
|
||||
ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk);
|
||||
ret = clk_get_by_phandle(dev, dtplat->clocks, &priv->clk);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#endif
|
||||
|
@ -665,7 +665,7 @@ static const struct dm_mmc_ops mxsmmc_ops = {
|
||||
.set_ios = mxsmmc_set_ios,
|
||||
};
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int mxsmmc_of_to_plat(struct udevice *bus)
|
||||
{
|
||||
struct mxsmmc_plat *plat = dev_get_plat(bus);
|
||||
@ -709,7 +709,7 @@ static const struct udevice_id mxsmmc_ids[] = {
|
||||
U_BOOT_DRIVER(fsl_imx23_mmc) = {
|
||||
.name = "fsl_imx23_mmc",
|
||||
.id = UCLASS_MMC,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.of_match = mxsmmc_ids,
|
||||
.of_to_plat = mxsmmc_of_to_plat,
|
||||
#endif
|
||||
|
@ -1891,7 +1891,7 @@ static int omap_hsmmc_get_pinctrl_state(struct mmc *mmc)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
#ifdef CONFIG_OMAP54XX
|
||||
__weak const struct mmc_platform_fixups *platform_fixups_mmc(uint32_t addr)
|
||||
{
|
||||
@ -2009,7 +2009,7 @@ static int omap_hsmmc_probe(struct udevice *dev)
|
||||
return omap_hsmmc_init_setup(mmc);
|
||||
}
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
|
||||
static const struct omap_mmc_of_data dra7_mmc_of_data = {
|
||||
.controller_flags = OMAP_HSMMC_REQUIRE_IODELAY,
|
||||
@ -2027,7 +2027,7 @@ static const struct udevice_id omap_hsmmc_ids[] = {
|
||||
U_BOOT_DRIVER(omap_hsmmc) = {
|
||||
.name = "omap_hsmmc",
|
||||
.id = UCLASS_MMC,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.of_match = omap_hsmmc_ids,
|
||||
.of_to_plat = omap_hsmmc_of_to_plat,
|
||||
.plat_auto = sizeof(struct omap_hsmmc_plat),
|
||||
|
@ -52,10 +52,12 @@ static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq)
|
||||
|
||||
static int rockchip_dwmmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rockchip_dwmmc_priv *priv = dev_get_priv(dev);
|
||||
struct dwmci_host *host = &priv->host;
|
||||
|
||||
if (!CONFIG_IS_ENABLED(OF_REAL))
|
||||
return 0;
|
||||
|
||||
host->name = dev->name;
|
||||
host->ioaddr = dev_read_addr_ptr(dev);
|
||||
host->buswidth = dev_read_u32_default(dev, "bus-width", 4);
|
||||
@ -95,7 +97,7 @@ static int rockchip_dwmmc_of_to_plat(struct udevice *dev)
|
||||
debug("%s: 'clock-freq-min-max' property was deprecated.\n",
|
||||
__func__);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -121,7 +123,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
|
||||
priv->minmax[0] = 400000; /* 400 kHz */
|
||||
priv->minmax[1] = dtplat->max_frequency;
|
||||
|
||||
ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->clk);
|
||||
ret = clk_get_by_phandle(dev, dtplat->clocks, &priv->clk);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#else
|
||||
|
@ -66,7 +66,7 @@ int pch_ioctl(struct udevice *dev, ulong req, void *data, int size)
|
||||
UCLASS_DRIVER(pch) = {
|
||||
.id = UCLASS_PCH,
|
||||
.name = "pch",
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
};
|
||||
|
@ -856,10 +856,7 @@ int pci_bind_bus_devices(struct udevice *bus)
|
||||
/* Check only the first access, we don't expect problems */
|
||||
ret = pci_bus_read_config(bus, bdf, PCI_VENDOR_ID, &vendor,
|
||||
PCI_SIZE_16);
|
||||
if (ret)
|
||||
goto error;
|
||||
|
||||
if (vendor == 0xffff || vendor == 0x0000)
|
||||
if (ret || vendor == 0xffff || vendor == 0x0000)
|
||||
continue;
|
||||
|
||||
pci_bus_read_config(bus, bdf, PCI_HEADER_TYPE,
|
||||
@ -940,10 +937,6 @@ int pci_bind_bus_devices(struct udevice *bus)
|
||||
}
|
||||
|
||||
return 0;
|
||||
error:
|
||||
printf("Cannot read bus configuration: %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void decode_regions(struct pci_controller *hose, ofnode parent_node,
|
||||
|
@ -155,7 +155,7 @@ static int apl_pinctrl_of_to_plat(struct udevice *dev)
|
||||
return intel_pinctrl_of_to_plat(dev, comm, 2);
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static const struct udevice_id apl_gpio_ids[] = {
|
||||
{ .compatible = "intel,apl-pinctrl"},
|
||||
{ }
|
||||
@ -168,7 +168,7 @@ U_BOOT_DRIVER(intel_apl_pinctrl) = {
|
||||
.of_match = of_match_ptr(apl_gpio_ids),
|
||||
.probe = intel_pinctrl_probe,
|
||||
.ops = &intel_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.of_to_plat = apl_pinctrl_of_to_plat,
|
||||
|
@ -186,7 +186,7 @@ U_BOOT_DRIVER(fsl_imx23_pinctrl) = {
|
||||
.id = UCLASS_PINCTRL,
|
||||
.of_match = of_match_ptr(mxs_pinctrl_match),
|
||||
.probe = mxs_pinctrl_probe,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.priv_auto = sizeof(struct mxs_pinctrl_priv),
|
||||
|
@ -248,7 +248,7 @@ U_BOOT_DRIVER(par_io_pinctrl) = {
|
||||
.of_to_plat = qe_io_of_to_plat,
|
||||
.plat_auto = sizeof(struct qe_io_plat),
|
||||
.ops = &par_io_pinctrl_ops,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.flags = DM_FLAG_PRE_RELOC,
|
||||
#endif
|
||||
};
|
||||
|
@ -421,7 +421,7 @@ static int __maybe_unused pinctrl_post_bind(struct udevice *dev)
|
||||
|
||||
UCLASS_DRIVER(pinctrl) = {
|
||||
.id = UCLASS_PINCTRL,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = pinctrl_post_bind,
|
||||
#endif
|
||||
.flags = DM_UC_FLAG_SEQ_ALIAS,
|
||||
|
@ -363,7 +363,7 @@ U_BOOT_DRIVER(pinctrl_px30) = {
|
||||
.of_match = px30_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -103,7 +103,7 @@ U_BOOT_DRIVER(pinctrl_rockchip) = {
|
||||
.of_match = rk3036_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -205,7 +205,7 @@ U_BOOT_DRIVER(pinctrl_rk3128) = {
|
||||
.of_match = rk3128_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -126,7 +126,7 @@ U_BOOT_DRIVER(rockchip_rk3188_pinctrl) = {
|
||||
.of_match = rk3188_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -292,7 +292,7 @@ U_BOOT_DRIVER(pinctrl_rk3228) = {
|
||||
.of_match = rk3228_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -248,7 +248,7 @@ U_BOOT_DRIVER(rockchip_rk3288_pinctrl) = {
|
||||
.of_match = rk3288_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -459,7 +459,7 @@ U_BOOT_DRIVER(pinctrl_rk3308) = {
|
||||
.of_match = rk3308_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -323,7 +323,7 @@ U_BOOT_DRIVER(rockchip_rk3328_pinctrl) = {
|
||||
.of_match = rk3328_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -177,7 +177,7 @@ U_BOOT_DRIVER(rockchip_rk3368_pinctrl) = {
|
||||
.of_match = rk3368_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -317,7 +317,7 @@ U_BOOT_DRIVER(pinctrl_rk3399) = {
|
||||
.of_match = rk3399_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -291,7 +291,7 @@ U_BOOT_DRIVER(pinctrl_rv1108) = {
|
||||
.of_match = rv1108_pinctrl_ids,
|
||||
.priv_auto = sizeof(struct rockchip_pinctrl_priv),
|
||||
.ops = &rockchip_pinctrl_ops,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
.probe = rockchip_pinctrl_probe,
|
||||
|
@ -112,7 +112,7 @@ int power_domain_off(struct power_domain *power_domain)
|
||||
return ops->off(power_domain);
|
||||
}
|
||||
|
||||
#if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA))
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
static int dev_power_domain_ctrl(struct udevice *dev, bool on)
|
||||
{
|
||||
struct power_domain pd;
|
||||
@ -162,7 +162,7 @@ int dev_power_domain_off(struct udevice *dev)
|
||||
{
|
||||
return dev_power_domain_ctrl(dev, false);
|
||||
}
|
||||
#endif
|
||||
#endif /* OF_REAL */
|
||||
|
||||
UCLASS_DRIVER(power_domain) = {
|
||||
.id = UCLASS_POWER_DOMAIN,
|
||||
|
@ -883,13 +883,13 @@ static int rk3368_dmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3368_sdram_params *plat = dev_get_plat(dev);
|
||||
if (CONFIG_IS_ENABLED(OF_REAL)) {
|
||||
struct rk3368_sdram_params *plat = dev_get_plat(dev);
|
||||
|
||||
ret = regmap_init_mem(dev_ofnode(dev), &plat->map);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
ret = regmap_init_mem(dev_ofnode(dev), &plat->map);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -816,10 +816,12 @@ static int setup_sdram(struct udevice *dev)
|
||||
|
||||
static int rk3188_dmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3188_sdram_params *params = dev_get_plat(dev);
|
||||
int ret;
|
||||
|
||||
if (!CONFIG_IS_ENABLED(OF_REAL))
|
||||
return 0;
|
||||
|
||||
/* rk3188 supports only one-channel */
|
||||
params->num_channels = 1;
|
||||
ret = dev_read_u32_array(dev, "rockchip,pctl-timing",
|
||||
@ -846,7 +848,6 @@ static int rk3188_dmc_of_to_plat(struct udevice *dev)
|
||||
ret = regmap_init_mem(dev_ofnode(dev), ¶ms->map);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -716,12 +716,14 @@ out:
|
||||
|
||||
static int rk322x_dmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk322x_sdram_params *params = dev_get_plat(dev);
|
||||
const void *blob = gd->fdt_blob;
|
||||
int node = dev_of_offset(dev);
|
||||
int ret;
|
||||
|
||||
if (!CONFIG_IS_ENABLED(OF_REAL))
|
||||
return 0;
|
||||
|
||||
params->num_channels = 1;
|
||||
|
||||
ret = fdtdec_get_int_array(blob, node, "rockchip,pctl-timing",
|
||||
@ -748,7 +750,6 @@ static int rk322x_dmc_of_to_plat(struct udevice *dev)
|
||||
ret = regmap_init_mem(dev_ofnode(dev), ¶ms->map);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -973,10 +973,12 @@ static int setup_sdram(struct udevice *dev)
|
||||
|
||||
static int rk3288_dmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rk3288_sdram_params *params = dev_get_plat(dev);
|
||||
int ret;
|
||||
|
||||
if (!CONFIG_IS_ENABLED(OF_REAL))
|
||||
return 0;
|
||||
|
||||
/* Rk3288 supports dual-channel, set default channel num to 2 */
|
||||
params->num_channels = 2;
|
||||
ret = dev_read_u32_array(dev, "rockchip,pctl-timing",
|
||||
@ -1008,7 +1010,6 @@ static int rk3288_dmc_of_to_plat(struct udevice *dev)
|
||||
ret = regmap_init_mem(dev_ofnode(dev), ¶ms->map);
|
||||
if (ret)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ static int rk3328_dmc_init(struct udevice *dev)
|
||||
struct rockchip_dmc_plat *plat = dev_get_plat(dev);
|
||||
int ret;
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
struct rk3328_sdram_params *params = &plat->sdram_params;
|
||||
#else
|
||||
struct dtd_rockchip_rk3328_dmc *dtplat = &plat->dtplat;
|
||||
@ -549,7 +549,7 @@ static int rk3328_dmc_init(struct udevice *dev)
|
||||
|
||||
static int rk3328_dmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
struct rockchip_dmc_plat *plat = dev_get_plat(dev);
|
||||
int ret;
|
||||
|
||||
|
@ -3013,10 +3013,12 @@ static int sdram_init(struct dram_info *dram,
|
||||
|
||||
static int rk3399_dmc_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct rockchip_dmc_plat *plat = dev_get_plat(dev);
|
||||
int ret;
|
||||
|
||||
if (!CONFIG_IS_ENABLED(OF_REAL))
|
||||
return 0;
|
||||
|
||||
ret = dev_read_u32_array(dev, "rockchip,sdram-params",
|
||||
(u32 *)&plat->sdram_params,
|
||||
sizeof(plat->sdram_params) / sizeof(u32));
|
||||
@ -3029,7 +3031,6 @@ static int rk3399_dmc_of_to_plat(struct udevice *dev)
|
||||
if (ret)
|
||||
printf("%s: regmap failed %d\n", __func__, ret);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3068,7 +3069,7 @@ static int rk3399_dmc_init(struct udevice *dev)
|
||||
struct dram_info *priv = dev_get_priv(dev);
|
||||
struct rockchip_dmc_plat *plat = dev_get_plat(dev);
|
||||
int ret;
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
struct rk3399_sdram_params *params = &plat->sdram_params;
|
||||
#else
|
||||
struct dtd_rockchip_rk3399_dmc *dtplat = &plat->dtplat;
|
||||
@ -3106,7 +3107,7 @@ static int rk3399_dmc_init(struct udevice *dev)
|
||||
priv->cic, priv->pmugrf, priv->pmusgrf, priv->pmucru, priv->pmu);
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
ret = clk_get_by_driver_info(dev, dtplat->clocks, &priv->ddr_clk);
|
||||
ret = clk_get_by_phandle(dev, dtplat->clocks, &priv->ddr_clk);
|
||||
#else
|
||||
ret = clk_get_by_index(dev, 0, &priv->ddr_clk);
|
||||
#endif
|
||||
|
@ -177,7 +177,7 @@ UCLASS_DRIVER(rtc) = {
|
||||
.name = "rtc",
|
||||
.id = UCLASS_RTC,
|
||||
.flags = DM_UC_FLAG_SEQ_ALIAS,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
#endif
|
||||
};
|
||||
|
@ -533,7 +533,7 @@ enum {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
int ns16550_serial_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct ns16550_plat *plat = dev_get_plat(dev);
|
||||
@ -588,7 +588,7 @@ const struct dm_serial_ops ns16550_serial_ops = {
|
||||
.getinfo = ns16550_serial_getinfo,
|
||||
};
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
/*
|
||||
* Please consider existing compatible strings before adding a new
|
||||
* one to keep this table compact. Or you may add a generic "ns16550"
|
||||
@ -602,7 +602,7 @@ static const struct udevice_id ns16550_serial_ids[] = {
|
||||
{ .compatible = "snps,dw-apb-uart", .data = PORT_NS16550 },
|
||||
{}
|
||||
};
|
||||
#endif /* OF_CONTROL && !OF_PLATDATA */
|
||||
#endif /* OF_REAL */
|
||||
|
||||
#if CONFIG_IS_ENABLED(SERIAL_PRESENT)
|
||||
|
||||
@ -611,7 +611,7 @@ static const struct udevice_id ns16550_serial_ids[] = {
|
||||
U_BOOT_DRIVER(ns16550_serial) = {
|
||||
.name = "ns16550_serial",
|
||||
.id = UCLASS_SERIAL,
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
#if CONFIG_IS_ENABLED(OF_REAL)
|
||||
.of_match = ns16550_serial_ids,
|
||||
.of_to_plat = ns16550_serial_of_to_plat,
|
||||
.plat_auto = sizeof(struct ns16550_plat),
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user