mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-06-09 23:36:03 +09:00
dm: New sequence number implementation
SPI handling of bus with different-speed devices patman supression of sign-offs -----BEGIN PGP SIGNATURE----- iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAl/jZwwRHHNqZ0BjaHJv bWl1bS5vcmcACgkQfxc6PpAIreaC0AgArETbfTBOS/i14jkpQid6bxw7blQDKbAc 0AdEOUmvp1gLwxnQnVKtWS6sElzbsYCbQDx+HgBoRzrkF23TwhVV6+mowaD4sBJl c554oYGFDWAVeBEp3jR1IcqbR8Lh+iFb603kcxvpqa8y8cZ66wP1TT/1MwvlpVt3 A08y+XXCtrR9qI3xdzWXIjuaPETNf3oLWIKbldBDkPl0fsDdr5fCcH067/TW2fo4 xXtmhmJ/CKF6U5wSCEUYcrI8JnToqcQ5Iu0YxVSaNNKnPTCse/e39FOBWvi8FzGa 0XaCQ7WlTEfmgiTXReeAS++jVRlPtTYsQKy0rs7fywz8qkRsD+3Rcg== =4ivx -----END PGP SIGNATURE----- Merge tag 'dm-next-23dec20' of git://git.denx.de/u-boot-dm into next dm: New sequence number implementation SPI handling of bus with different-speed devices patman supression of sign-offs
This commit is contained in:
commit
958b9e2482
11
arch/Kconfig
11
arch/Kconfig
|
@ -7,6 +7,17 @@ config HAVE_ARCH_IOREMAP
|
|||
config NEEDS_MANUAL_RELOC
|
||||
bool
|
||||
|
||||
config LINKER_LIST_ALIGN
|
||||
int
|
||||
default 32 if SANDBOX
|
||||
default 8 if ARM64 || X86
|
||||
default 4
|
||||
help
|
||||
Force the each linker list to be aligned to this boundary. This
|
||||
is required if ll_entry_get() is used, since otherwise the linker
|
||||
may add padding into the table, thus breaking it.
|
||||
See linker_lists.rst for full details.
|
||||
|
||||
choice
|
||||
prompt "Architecture select"
|
||||
default SANDBOX
|
||||
|
|
|
@ -42,7 +42,7 @@ struct mxc_i2c_bus {
|
|||
/*
|
||||
* board file can use this index to locate which i2c_pads_info is for
|
||||
* i2c_idle_bus. When pinmux is implement, this entry can be
|
||||
* discarded. Here we do not use dev->seq, because we do not want to
|
||||
* discarded. Here we do not use dev_seq(dev), because we do not want to
|
||||
* export device to board file.
|
||||
*/
|
||||
int index;
|
||||
|
|
|
@ -208,7 +208,7 @@ void board_init_f(ulong dummy)
|
|||
* firmware (SYSFW) image for various purposes and SYSFW depends on us
|
||||
* to initialize its pin settings.
|
||||
*/
|
||||
ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, true, &dev);
|
||||
ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, &dev);
|
||||
if (!ret)
|
||||
pinctrl_select_state(dev, "default");
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ void board_init_f(ulong dummy)
|
|||
* firmware (SYSFW) image for various purposes and SYSFW depends on us
|
||||
* to initialize its pin settings.
|
||||
*/
|
||||
ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, true, &dev);
|
||||
ret = uclass_find_device_by_seq(UCLASS_SERIAL, 0, &dev);
|
||||
if (!ret)
|
||||
pinctrl_select_state(dev, "default");
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ static void *k3_sysfw_get_spi_addr(void)
|
|||
int ret;
|
||||
|
||||
ret = uclass_find_device_by_seq(UCLASS_SPI, CONFIG_SF_DEFAULT_BUS,
|
||||
true, &dev);
|
||||
&dev);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# (C) Copyright 2000-2003
|
||||
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
||||
|
||||
obj-y := cpu.o state.o
|
||||
obj-y := cache.o cpu.o state.o
|
||||
extra-y := start.o os.o
|
||||
extra-$(CONFIG_SANDBOX_SDL) += sdl.o
|
||||
obj-$(CONFIG_SPL_BUILD) += spl.o
|
||||
|
|
23
arch/sandbox/cpu/cache.c
Normal file
23
arch/sandbox/cpu/cache.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <cpu_func.h>
|
||||
#include <asm/state.h>
|
||||
|
||||
void flush_cache(unsigned long addr, unsigned long size)
|
||||
{
|
||||
/* Clang uses (char *) parameters, GCC (void *) */
|
||||
__builtin___clear_cache((void *)addr, (void *)(addr + size));
|
||||
}
|
||||
|
||||
void invalidate_icache_all(void)
|
||||
{
|
||||
struct sandbox_state *state = state_get_current();
|
||||
|
||||
/* Clang uses (char *) parameters, GCC (void *) */
|
||||
__builtin___clear_cache((void *)state->ram_buf,
|
||||
(void *)(state->ram_buf + state->ram_size));
|
||||
}
|
|
@ -6,6 +6,7 @@
|
|||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <dm/root.h>
|
||||
#include <efi_loader.h>
|
||||
#include <errno.h>
|
||||
#include <init.h>
|
||||
#include <os.h>
|
||||
|
@ -406,6 +407,15 @@ void state_show(struct sandbox_state *state)
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
void __efi_runtime EFIAPI efi_reset_system(
|
||||
enum efi_reset_type reset_type,
|
||||
efi_status_t reset_status,
|
||||
unsigned long data_size, void *reset_data)
|
||||
{
|
||||
os_fd_restore();
|
||||
os_relaunch(os_argv);
|
||||
}
|
||||
|
||||
void sandbox_reset(void)
|
||||
{
|
||||
/* Do this here while it still has an effect */
|
||||
|
|
|
@ -33,10 +33,11 @@
|
|||
testfdt6 = "/e-test";
|
||||
testbus3 = "/some-bus";
|
||||
testfdt0 = "/some-bus/c-test@0";
|
||||
testfdt1 = "/some-bus/c-test@1";
|
||||
testfdt12 = "/some-bus/c-test@1";
|
||||
testfdt3 = "/b-test";
|
||||
testfdt5 = "/some-bus/c-test@5";
|
||||
testfdt8 = "/a-test";
|
||||
testfdtm1 = &testfdtm1;
|
||||
fdt-dummy0 = "/translation-test@8000/dev@0,0";
|
||||
fdt-dummy1 = "/translation-test@8000/dev@1,100";
|
||||
fdt-dummy2 = "/translation-test@8000/dev@2,200";
|
||||
|
@ -864,13 +865,21 @@
|
|||
#size-cells = <0>;
|
||||
reg = <0 1>;
|
||||
compatible = "sandbox,spi";
|
||||
cs-gpios = <0>, <&gpio_a 0>;
|
||||
cs-gpios = <0>, <0>, <&gpio_a 0>;
|
||||
spi.bin@0 {
|
||||
reg = <0>;
|
||||
compatible = "spansion,m25p16", "jedec,spi-nor";
|
||||
spi-max-frequency = <40000000>;
|
||||
sandbox,filename = "spi.bin";
|
||||
};
|
||||
spi.bin@1 {
|
||||
reg = <1>;
|
||||
compatible = "spansion,m25p16", "jedec,spi-nor";
|
||||
spi-max-frequency = <50000000>;
|
||||
sandbox,filename = "spi.bin";
|
||||
spi-cpol;
|
||||
spi-cpha;
|
||||
};
|
||||
};
|
||||
|
||||
syscon0: syscon@0 {
|
||||
|
@ -917,6 +926,18 @@
|
|||
idle-state = <0xabcd>;
|
||||
};
|
||||
|
||||
testfdtm0 {
|
||||
compatible = "denx,u-boot-fdtm-test";
|
||||
};
|
||||
|
||||
testfdtm1: testfdtm1 {
|
||||
compatible = "denx,u-boot-fdtm-test";
|
||||
};
|
||||
|
||||
testfdtm2 {
|
||||
compatible = "denx,u-boot-fdtm-test";
|
||||
};
|
||||
|
||||
timer@0 {
|
||||
compatible = "sandbox,timer";
|
||||
clock-frequency = <1000000>;
|
||||
|
|
|
@ -32,14 +32,4 @@ struct sandbox_spi_emu_ops {
|
|||
int (*xfer)(void *priv, const u8 *rx, u8 *tx, uint bytes);
|
||||
};
|
||||
|
||||
/*
|
||||
* Extract the bus/cs from the spi spec and return the start of the spi
|
||||
* client spec. If the bus/cs are invalid for the current config, then
|
||||
* it returns NULL.
|
||||
*
|
||||
* Example: arg="0:1:foo" will set bus to 0, cs to 1, and return "foo"
|
||||
*/
|
||||
const char *sandbox_spi_parse_spec(const char *arg, unsigned long *bus,
|
||||
unsigned long *cs);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -202,6 +202,22 @@ void sandbox_set_allow_beep(struct udevice *dev, bool allow);
|
|||
*/
|
||||
int sandbox_get_beep_frequency(struct udevice *dev);
|
||||
|
||||
/**
|
||||
* sandbox_spi_get_speed() - Get current speed setting of a sandbox spi bus
|
||||
*
|
||||
* @dev: Device to check
|
||||
* @return current bus speed
|
||||
*/
|
||||
uint sandbox_spi_get_speed(struct udevice *dev);
|
||||
|
||||
/**
|
||||
* sandbox_spi_get_mode() - Get current mode setting of a sandbox spi bus
|
||||
*
|
||||
* @dev: Device to check
|
||||
* @return current mode
|
||||
*/
|
||||
uint sandbox_spi_get_mode(struct udevice *dev);
|
||||
|
||||
/**
|
||||
* sandbox_get_pch_spi_protect() - Get the PCI SPI protection status
|
||||
*
|
||||
|
|
|
@ -63,7 +63,7 @@ static int apl_get_info(const struct udevice *dev, struct cpu_info *info)
|
|||
|
||||
static int acpi_cpu_fill_ssdt(const struct udevice *dev, struct acpi_ctx *ctx)
|
||||
{
|
||||
uint core_id = dev->req_seq;
|
||||
uint core_id = dev_seq(dev);
|
||||
int cores_per_package;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ static int broadwell_get_count(const struct udevice *dev)
|
|||
|
||||
static int cpu_x86_broadwell_probe(struct udevice *dev)
|
||||
{
|
||||
if (dev->seq == 0) {
|
||||
if (dev_seq(dev) == 0) {
|
||||
cpu_core_init(dev);
|
||||
return broadwell_init(dev);
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ static int model_206ax_get_count(const struct udevice *dev)
|
|||
|
||||
static int cpu_x86_model_206ax_probe(struct udevice *dev)
|
||||
{
|
||||
if (dev->seq == 0)
|
||||
if (dev_seq(dev) == 0)
|
||||
model_206ax_init(dev);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -87,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||
* intel,apic-id = <2>;
|
||||
* };
|
||||
*
|
||||
* Here the 'reg' property is the CPU number and then is placed in dev->req_seq
|
||||
* Here the 'reg' property is the CPU number and then is placed in dev_seq(cpu)
|
||||
* so that we can index into ap_callbacks[] using that. The APIC ID is different
|
||||
* and may not be sequential (it typically is if hyperthreading is supported).
|
||||
*
|
||||
|
@ -135,7 +135,7 @@ struct mp_flight_plan {
|
|||
*
|
||||
* @func: Function to run
|
||||
* @arg: Argument to pass to the function
|
||||
* @logical_cpu_number: Either a CPU number (i.e. dev->req_seq) or a special
|
||||
* @logical_cpu_number: Either a CPU number (i.e. dev_seq(cpu) or a special
|
||||
* value like MP_SELECT_BSP. It tells the AP whether it should process this
|
||||
* callback
|
||||
*/
|
||||
|
@ -152,7 +152,7 @@ static struct mp_flight_plan mp_info;
|
|||
* ap_callbacks - Callback mailbox array
|
||||
*
|
||||
* Array of callback, one entry for each available CPU, indexed by the CPU
|
||||
* number, which is dev->req_seq. The entry for the main CPU is never used.
|
||||
* number, which is dev_seq(cpu). The entry for the main CPU is never used.
|
||||
* When this is NULL, there is no pending work for the CPU to run. When
|
||||
* non-NULL it points to the mp_callback structure. This is shared between all
|
||||
* CPUs, so should only be written by the main CPU.
|
||||
|
@ -562,7 +562,7 @@ static int get_bsp(struct udevice **devp, int *cpu_countp)
|
|||
if (cpu_countp)
|
||||
*cpu_countp = ret;
|
||||
|
||||
return dev->req_seq >= 0 ? dev->req_seq : 0;
|
||||
return dev_seq(dev) >= 0 ? dev_seq(dev) : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -614,7 +614,7 @@ static void store_callback(struct mp_callback **slot, struct mp_callback *val)
|
|||
static int run_ap_work(struct mp_callback *callback, struct udevice *bsp,
|
||||
int num_cpus, uint expire_ms)
|
||||
{
|
||||
int cur_cpu = bsp->req_seq;
|
||||
int cur_cpu = dev_seq(bsp);
|
||||
int num_aps = num_cpus - 1; /* number of non-BSPs to get this message */
|
||||
int cpus_accepted;
|
||||
ulong start;
|
||||
|
@ -679,7 +679,7 @@ static int ap_wait_for_instruction(struct udevice *cpu, void *unused)
|
|||
if (!IS_ENABLED(CONFIG_SMP_AP_WORK))
|
||||
return 0;
|
||||
|
||||
per_cpu_slot = &ap_callbacks[cpu->req_seq];
|
||||
per_cpu_slot = &ap_callbacks[dev_seq(cpu)];
|
||||
|
||||
while (1) {
|
||||
struct mp_callback *cb = read_callback(per_cpu_slot);
|
||||
|
@ -694,7 +694,7 @@ static int ap_wait_for_instruction(struct udevice *cpu, void *unused)
|
|||
mfence();
|
||||
if (lcb.logical_cpu_number == MP_SELECT_ALL ||
|
||||
lcb.logical_cpu_number == MP_SELECT_APS ||
|
||||
cpu->req_seq == lcb.logical_cpu_number)
|
||||
dev_seq(cpu) == lcb.logical_cpu_number)
|
||||
lcb.func(lcb.arg);
|
||||
|
||||
/* Indicate we are finished */
|
||||
|
@ -839,7 +839,6 @@ int mp_init(void)
|
|||
int num_aps, num_cpus;
|
||||
atomic_t *ap_count;
|
||||
struct udevice *cpu;
|
||||
struct uclass *uc;
|
||||
int ret;
|
||||
|
||||
if (IS_ENABLED(CONFIG_QFW)) {
|
||||
|
@ -848,14 +847,6 @@ int mp_init(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Multiple APs are brought up simultaneously and they may get the same
|
||||
* seq num in the uclass_resolve_seq() during device_probe(). To avoid
|
||||
* this, set req_seq to the reg number in the device tree in advance.
|
||||
*/
|
||||
uclass_id_foreach_dev(UCLASS_CPU, cpu, uc)
|
||||
cpu->req_seq = dev_read_u32_default(cpu, "reg", -1);
|
||||
|
||||
ret = get_bsp(&cpu, &num_cpus);
|
||||
if (ret < 0) {
|
||||
debug("Cannot init boot CPU: err=%d\n", ret);
|
||||
|
|
|
@ -114,7 +114,7 @@ typedef void (*mp_run_func)(void *arg);
|
|||
* Running on anything other than the boot CPU is only supported if
|
||||
* CONFIG_SMP_AP_WORK is enabled
|
||||
*
|
||||
* @cpu_select: CPU to run on (its dev->req_seq value), or MP_SELECT_ALL for
|
||||
* @cpu_select: CPU to run on (its dev_seq() value), or MP_SELECT_ALL for
|
||||
* all, or MP_SELECT_BSP for BSP
|
||||
* @func: Function to run
|
||||
* @arg: Argument to pass to the function
|
||||
|
|
|
@ -28,10 +28,6 @@ U_BOOT_DEVICE(gpio_sandbox) = {
|
|||
};
|
||||
#endif
|
||||
|
||||
void flush_cache(unsigned long start, unsigned long size)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef CONFIG_TIMER
|
||||
/* system timer offset in ms */
|
||||
static unsigned long sandbox_timer_offset;
|
||||
|
|
|
@ -153,9 +153,9 @@ int board_late_init(void)
|
|||
puts("Boot from EMMC but without SD1 enabled!\n");
|
||||
return -1;
|
||||
}
|
||||
debug("mmc1 device found at %p, seq %d\n", dev, dev->seq);
|
||||
debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev));
|
||||
mode = "mmc";
|
||||
bootseq = dev->seq;
|
||||
bootseq = dev_seq(dev);
|
||||
break;
|
||||
case SD_MODE:
|
||||
puts("SD_MODE\n");
|
||||
|
@ -164,10 +164,10 @@ int board_late_init(void)
|
|||
puts("Boot from SD0 but without SD0 enabled!\n");
|
||||
return -1;
|
||||
}
|
||||
debug("mmc0 device found at %p, seq %d\n", dev, dev->seq);
|
||||
debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev));
|
||||
|
||||
mode = "mmc";
|
||||
bootseq = dev->seq;
|
||||
bootseq = dev_seq(dev);
|
||||
break;
|
||||
case SD1_LSHFT_MODE:
|
||||
puts("LVL_SHFT_");
|
||||
|
@ -179,10 +179,10 @@ int board_late_init(void)
|
|||
puts("Boot from SD1 but without SD1 enabled!\n");
|
||||
return -1;
|
||||
}
|
||||
debug("mmc1 device found at %p, seq %d\n", dev, dev->seq);
|
||||
debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev));
|
||||
|
||||
mode = "mmc";
|
||||
bootseq = dev->seq;
|
||||
bootseq = dev_seq(dev);
|
||||
break;
|
||||
default:
|
||||
mode = "";
|
||||
|
|
|
@ -596,10 +596,10 @@ int board_late_init(void)
|
|||
puts("Boot from EMMC but without SD0 enabled!\n");
|
||||
return -1;
|
||||
}
|
||||
debug("mmc0 device found at %p, seq %d\n", dev, dev->seq);
|
||||
debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev));
|
||||
|
||||
mode = "mmc";
|
||||
bootseq = dev->seq;
|
||||
bootseq = dev_seq(dev);
|
||||
break;
|
||||
case SD_MODE:
|
||||
puts("SD_MODE\n");
|
||||
|
@ -610,10 +610,10 @@ int board_late_init(void)
|
|||
puts("Boot from SD0 but without SD0 enabled!\n");
|
||||
return -1;
|
||||
}
|
||||
debug("mmc0 device found at %p, seq %d\n", dev, dev->seq);
|
||||
debug("mmc0 device found at %p, seq %d\n", dev, dev_seq(dev));
|
||||
|
||||
mode = "mmc";
|
||||
bootseq = dev->seq;
|
||||
bootseq = dev_seq(dev);
|
||||
env_set("modeboot", "sdboot");
|
||||
break;
|
||||
case SD1_LSHFT_MODE:
|
||||
|
@ -628,10 +628,10 @@ int board_late_init(void)
|
|||
puts("Boot from SD1 but without SD1 enabled!\n");
|
||||
return -1;
|
||||
}
|
||||
debug("mmc1 device found at %p, seq %d\n", dev, dev->seq);
|
||||
debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev));
|
||||
|
||||
mode = "mmc";
|
||||
bootseq = dev->seq;
|
||||
bootseq = dev_seq(dev);
|
||||
env_set("modeboot", "sdboot");
|
||||
break;
|
||||
case NAND_MODE:
|
||||
|
|
|
@ -33,9 +33,9 @@ static void show_bus(struct udevice *bus)
|
|||
{
|
||||
struct udevice *dev;
|
||||
|
||||
printf("Bus %d:\t%s", bus->req_seq, bus->name);
|
||||
printf("Bus %d:\t%s", dev_seq(bus), bus->name);
|
||||
if (device_active(bus))
|
||||
printf(" (active %d)", bus->seq);
|
||||
printf(" (active)");
|
||||
printf("\n");
|
||||
for (device_find_first_child(bus, &dev);
|
||||
dev;
|
||||
|
@ -147,7 +147,7 @@ static int do_axi_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
struct udevice *bus;
|
||||
|
||||
if (!axi_get_cur_bus(&bus))
|
||||
bus_no = bus->seq;
|
||||
bus_no = dev_seq(bus);
|
||||
else
|
||||
bus_no = -1;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ static int print_cpu_list(bool detail)
|
|||
int ret, i;
|
||||
|
||||
ret = cpu_get_desc(dev, buf, sizeof(buf));
|
||||
printf("%3d: %-10s %s\n", dev->seq, dev->name,
|
||||
printf("%3d: %-10s %s\n", dev_seq(dev), dev->name,
|
||||
ret ? "<no description>" : buf);
|
||||
if (!detail)
|
||||
continue;
|
||||
|
|
|
@ -1700,9 +1700,9 @@ static void show_bus(struct udevice *bus)
|
|||
{
|
||||
struct udevice *dev;
|
||||
|
||||
printf("Bus %d:\t%s", bus->req_seq, bus->name);
|
||||
printf("Bus %d:\t%s", dev_seq(bus), bus->name);
|
||||
if (device_active(bus))
|
||||
printf(" (active %d)", bus->seq);
|
||||
printf(" (active %d)", dev_seq(bus));
|
||||
printf("\n");
|
||||
for (device_find_first_child(bus, &dev);
|
||||
dev;
|
||||
|
@ -1825,7 +1825,7 @@ static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
struct udevice *bus;
|
||||
|
||||
if (!i2c_get_cur_bus(&bus))
|
||||
bus_no = bus->seq;
|
||||
bus_no = dev_seq(bus);
|
||||
else
|
||||
bus_no = -1;
|
||||
#else
|
||||
|
|
|
@ -34,7 +34,7 @@ static int do_misc_list(struct cmd_tbl *cmdtp, int flag,
|
|||
for (uclass_first_device(UCLASS_MISC, &dev);
|
||||
dev;
|
||||
uclass_next_device(&dev)) {
|
||||
printf("%-20s %5d %10s\n", dev->name, dev->seq,
|
||||
printf("%-20s %5d %10s\n", dev->name, dev_seq(dev),
|
||||
dev->driver->name);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,9 +75,9 @@ static int osd_get_osd_cur(struct udevice **osdp)
|
|||
*/
|
||||
static void show_osd(struct udevice *osd)
|
||||
{
|
||||
printf("OSD %d:\t%s", osd->req_seq, osd->name);
|
||||
printf("OSD %d:\t%s", dev_seq(osd), osd->name);
|
||||
if (device_active(osd))
|
||||
printf(" (active %d)", osd->seq);
|
||||
printf(" (active)");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ static int do_osd_num(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
struct udevice *osd;
|
||||
|
||||
if (!osd_get_osd_cur(&osd))
|
||||
osd_no = osd->seq;
|
||||
osd_no = dev_seq(osd);
|
||||
else
|
||||
osd_no = -1;
|
||||
printf("Current osd is %d\n", osd_no);
|
||||
|
|
|
@ -334,7 +334,7 @@ static void pciinfo(struct udevice *bus, bool short_listing)
|
|||
{
|
||||
struct udevice *dev;
|
||||
|
||||
pciinfo_header(bus->seq, short_listing);
|
||||
pciinfo_header(dev_seq(bus), short_listing);
|
||||
|
||||
for (device_find_first_child(bus, &dev);
|
||||
dev;
|
||||
|
@ -343,11 +343,12 @@ static void pciinfo(struct udevice *bus, bool short_listing)
|
|||
|
||||
pplat = dev_get_parent_plat(dev);
|
||||
if (short_listing) {
|
||||
printf("%02x.%02x.%02x ", bus->seq,
|
||||
printf("%02x.%02x.%02x ", dev_seq(bus),
|
||||
PCI_DEV(pplat->devfn), PCI_FUNC(pplat->devfn));
|
||||
pci_header_show_brief(dev);
|
||||
} else {
|
||||
printf("\nFound PCI device %02x.%02x.%02x:\n", bus->seq,
|
||||
printf("\nFound PCI device %02x.%02x.%02x:\n",
|
||||
dev_seq(bus),
|
||||
PCI_DEV(pplat->devfn), PCI_FUNC(pplat->devfn));
|
||||
pci_header_show(dev);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
|||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
printf("dev: %d @ %s\n", currdev->seq, currdev->name);
|
||||
printf("dev: %d @ %s\n", dev_seq(currdev), currdev->name);
|
||||
}
|
||||
|
||||
return CMD_RET_SUCCESS;
|
||||
|
@ -66,7 +66,7 @@ static int do_list(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
printf("| %-*.*s| %-*.*s| %s @ %d\n",
|
||||
LIMIT_DEV, LIMIT_DEV, dev->name,
|
||||
LIMIT_PARENT, LIMIT_PARENT, dev->parent->name,
|
||||
dev_get_uclass_name(dev->parent), dev->parent->seq);
|
||||
dev_get_uclass_name(dev->parent), dev_seq(dev->parent));
|
||||
}
|
||||
|
||||
if (ret)
|
||||
|
|
|
@ -47,7 +47,7 @@ static int print_remoteproc_list(void)
|
|||
break;
|
||||
}
|
||||
printf("%d - Name:'%s' type:'%s' supports: %s%s%s%s%s%s\n",
|
||||
dev->seq,
|
||||
dev_seq(dev),
|
||||
uc_pdata->name,
|
||||
type,
|
||||
ops->load ? "load " : "",
|
||||
|
|
4
cmd/w1.c
4
cmd/w1.c
|
@ -21,7 +21,7 @@ static int w1_bus(void)
|
|||
printf("one wire interface not found\n");
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
printf("Bus %d:\t%s", bus->seq, bus->name);
|
||||
printf("Bus %d:\t%s", dev_seq(bus), bus->name);
|
||||
if (device_active(bus))
|
||||
printf(" (active)");
|
||||
printf("\n");
|
||||
|
@ -31,7 +31,7 @@ static int w1_bus(void)
|
|||
device_find_next_child(&dev)) {
|
||||
ret = device_probe(dev);
|
||||
|
||||
printf("\t%s (%d) uclass %s : ", dev->name, dev->seq,
|
||||
printf("\t%s (%d) uclass %s : ", dev->name, dev_seq(dev),
|
||||
dev->uclass->uc_drv->name);
|
||||
|
||||
if (ret)
|
||||
|
|
|
@ -407,6 +407,9 @@ int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
|
|||
&fit_uname_config,
|
||||
arch, &load, &len);
|
||||
|
||||
if (fdt_noffset < 0)
|
||||
goto error;
|
||||
|
||||
images->fit_hdr_fdt = map_sysmem(fdt_addr, 0);
|
||||
images->fit_uname_fdt = fit_uname_fdt;
|
||||
images->fit_noffset_fdt = fdt_noffset;
|
||||
|
|
|
@ -7,6 +7,7 @@ CONFIG_PRE_CON_BUF_ADDR=0x100000
|
|||
CONFIG_BOOTSTAGE_STASH_ADDR=0x0
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sandbox64"
|
||||
CONFIG_SANDBOX64=y
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_SIGNATURE=y
|
||||
|
|
|
@ -5,6 +5,7 @@ CONFIG_SYS_MEMTEST_END=0x00101000
|
|||
CONFIG_ENV_SIZE=0x2000
|
||||
CONFIG_BOOTSTAGE_STASH_ADDR=0x0
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sandbox"
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_SIGNATURE=y
|
||||
|
|
|
@ -11,6 +11,7 @@ CONFIG_SPL=y
|
|||
CONFIG_BOOTSTAGE_STASH_ADDR=0x0
|
||||
CONFIG_DEFAULT_DEVICE_TREE="sandbox"
|
||||
CONFIG_SANDBOX_SPL=y
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_SIGNATURE=y
|
||||
|
|
|
@ -96,5 +96,64 @@ defined for the whole list and each sub-list:
|
|||
%u_boot_list_2_drivers_2_pci_3
|
||||
%u_boot_list_2_drivers_3
|
||||
|
||||
Alignment issues
|
||||
----------------
|
||||
|
||||
The linker script uses alphabetic sorting to group the different linker
|
||||
lists together. Each group has its own struct and potentially its own
|
||||
alignment. But when the linker packs the structs together it cannot ensure
|
||||
that a linker list starts on the expected alignment boundary.
|
||||
|
||||
For example, if the first list has a struct size of 8 and we place 3 of
|
||||
them in the image, that means that the next struct will start at offset
|
||||
0x18 from the start of the linker_list section. If the next struct has
|
||||
a size of 16 then it will start at an 8-byte aligned offset, but not a
|
||||
16-byte aligned offset.
|
||||
|
||||
With sandbox on x86_64, a reference to a linker list item using
|
||||
ll_entry_get() can force alignment of that particular linker_list item,
|
||||
if it is in the same file as the linker_list item is declared.
|
||||
|
||||
Consider this example, where struct driver is 0x80 bytes::
|
||||
|
||||
ll_entry_declare(struct driver, fred, driver)
|
||||
|
||||
...
|
||||
|
||||
void *p = ll_entry_get(struct driver, fred, driver)
|
||||
|
||||
If these two lines of code are in the same file, then the entry is forced
|
||||
to be aligned at the 'struct driver' alignment, which is 16 bytes. If the
|
||||
second line of code is in a different file, then no action is taken, since
|
||||
the compiler cannot update the alignment of the linker_list item.
|
||||
|
||||
In the first case, an 8-byte 'fill' region is added::
|
||||
|
||||
.u_boot_list_2_driver_2_testbus_drv
|
||||
0x0000000000270018 0x80 test/built-in.o
|
||||
0x0000000000270018 _u_boot_list_2_driver_2_testbus_drv
|
||||
.u_boot_list_2_driver_2_testfdt1_drv
|
||||
0x0000000000270098 0x80 test/built-in.o
|
||||
0x0000000000270098 _u_boot_list_2_driver_2_testfdt1_drv
|
||||
*fill* 0x0000000000270118 0x8
|
||||
.u_boot_list_2_driver_2_testfdt_drv
|
||||
0x0000000000270120 0x80 test/built-in.o
|
||||
0x0000000000270120 _u_boot_list_2_driver_2_testfdt_drv
|
||||
.u_boot_list_2_driver_2_testprobe_drv
|
||||
0x00000000002701a0 0x80 test/built-in.o
|
||||
0x00000000002701a0 _u_boot_list_2_driver_2_testprobe_drv
|
||||
|
||||
With this, the linker_list no-longer works since items after testfdt1_drv
|
||||
are not at the expected address.
|
||||
|
||||
Ideally we would have a way to tell gcc not to align structs in this way.
|
||||
It is not clear how we could do this, and in any case it would require us
|
||||
to adjust every struct used by the linker_list feature.
|
||||
|
||||
The simplest fix seems to be to force each separate linker_list to start
|
||||
on the largest possible boundary that can be required by the compiler. This
|
||||
is the purpose of CONFIG_LINKER_LIST_ALIGN
|
||||
|
||||
|
||||
.. kernel-doc:: include/linker_lists.h
|
||||
:internal:
|
||||
|
|
|
@ -515,11 +515,23 @@ cases. While it might be tempting to automatically renumber the devices
|
|||
where there are gaps in the sequence, this can lead to confusion and is
|
||||
not the way that U-Boot works.
|
||||
|
||||
Each device can request a sequence number. If none is required then the
|
||||
device will be automatically allocated the next available sequence number.
|
||||
Where a device gets its sequence number is controlled by the DM_SEQ_ALIAS
|
||||
Kconfig option, which can have a different value in U-Boot proper and SPL.
|
||||
If this option is not set, aliases are ignored.
|
||||
|
||||
To specify the sequence number in the device tree an alias is typically
|
||||
used. Make sure that the uclass has the DM_UC_FLAG_SEQ_ALIAS flag set.
|
||||
Even if CONFIG_DM_SEQ_ALIAS is enabled, the uclass must still have the
|
||||
DM_UC_FLAG_SEQ_ALIAS flag set, for its devices to be sequenced by aliases.
|
||||
|
||||
With those options set, devices with an alias (e.g. "serial2") will get that
|
||||
sequence number (e.g. 2). Other devices get the next available number after all
|
||||
aliases and all existing numbers. This means that if there is just a single
|
||||
alias "serial2", unaliased serial devices will be assigned 3 or more, with 0 and
|
||||
1 being unused.
|
||||
|
||||
If CONFIG_DM_SEQ_ALIAS or DM_UC_FLAG_SEQ_ALIAS are not set, all devices will get
|
||||
sequence numbers in a simple ordering starting from 0. To find the next number
|
||||
to allocate, driver model scans through to find the maximum existing number,
|
||||
then uses the next one. It does not attempt to fill in gaps.
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
|
@ -546,12 +558,18 @@ More commonly you can use node references, which expand to the full path:
|
|||
The alias resolves to the same string in this case, but this version is
|
||||
easier to read.
|
||||
|
||||
Device sequence numbers are resolved when a device is probed. Before then
|
||||
the sequence number is only a request which may or may not be honoured,
|
||||
depending on what other devices have been probed. However the numbering is
|
||||
entirely under the control of the board author so a conflict is generally
|
||||
an error.
|
||||
Device sequence numbers are resolved when a device is bound and the number does
|
||||
not change for the life of the device.
|
||||
|
||||
There are some situations where the uclass must allocate sequence numbers,
|
||||
since a strictly increase sequence (with devicetree nodes bound first) is not
|
||||
suitable. An example of this is the PCI bus. In this case, you can set the
|
||||
uclass DM_UC_FLAG_NO_AUTO_SEQ flag. With this flag set, only devices with an
|
||||
alias will be assigned a number by driver model. The rest is left to the uclass
|
||||
to sort out, e.g. when enumerating the bus.
|
||||
|
||||
Note that changing the sequence number for a device (e.g. in a driver) is not
|
||||
permitted. If it is felt to be necessary, ask on the mailing list.
|
||||
|
||||
Bus Drivers
|
||||
-----------
|
||||
|
@ -673,6 +691,10 @@ plat will be NULL, but of_offset will be the offset of the device tree
|
|||
node that caused the device to be created. The uclass is set correctly for
|
||||
the device.
|
||||
|
||||
The device's sequence number is assigned, either the requested one or the next
|
||||
available one (after all aliases are processed) if nothing particular is
|
||||
requested.
|
||||
|
||||
The device's bind() method is permitted to perform simple actions, but
|
||||
should not scan the device tree node, not initialise hardware, nor set up
|
||||
structures or allocate memory. All of these tasks should be left for
|
||||
|
@ -780,11 +802,7 @@ as above and then following these steps (see device_probe()):
|
|||
This means (for example) that an I2C driver will require that its bus
|
||||
be activated.
|
||||
|
||||
2. The device's sequence number is assigned, either the requested one
|
||||
(assuming no conflicts) or the next available one if there is a conflict
|
||||
or nothing particular is requested.
|
||||
|
||||
4. The device's probe() method is called. This should do anything that
|
||||
2. The device's probe() method is called. This should do anything that
|
||||
is required by the device to get it going. This could include checking
|
||||
that the hardware is actually present, setting up clocks for the
|
||||
hardware and setting up hardware registers to initial values. The code
|
||||
|
@ -799,9 +817,9 @@ as above and then following these steps (see device_probe()):
|
|||
allocate the priv space here yourself. The same applies also to
|
||||
plat_auto. Remember to free them in the remove() method.
|
||||
|
||||
5. The device is marked 'activated'
|
||||
3. The device is marked 'activated'
|
||||
|
||||
10. The uclass's post_probe() method is called, if one exists. This may
|
||||
4. The uclass's post_probe() method is called, if one exists. This may
|
||||
cause the uclass to do some housekeeping to record the device as
|
||||
activated and 'known' by the uclass.
|
||||
|
||||
|
@ -850,14 +868,7 @@ remove it. This performs the probe steps in reverse:
|
|||
or preferably of_to_plat()) and the deallocation in remove()
|
||||
are the responsibility of the driver author.
|
||||
|
||||
5. The device sequence number is set to -1, meaning that it no longer
|
||||
has an allocated sequence. If the device is later reactivated and that
|
||||
sequence number is still free, it may well receive the name sequence
|
||||
number again. But from this point, the sequence number previously used
|
||||
by this device will no longer exist (think of SPI bus 2 being removed
|
||||
and bus 2 is no longer available for use).
|
||||
|
||||
6. The device is marked inactive. Note that it is still bound, so the
|
||||
5. The device is marked inactive. Note that it is still bound, so the
|
||||
device structure itself is not freed at this point. Should the device be
|
||||
activated again, then the cycle starts again at step 2 above.
|
||||
|
||||
|
|
|
@ -113,6 +113,22 @@ config SPL_DM_SEQ_ALIAS
|
|||
numbered devices (e.g. serial0 = &serial0). This feature can be
|
||||
disabled if it is not required, to save code space in SPL.
|
||||
|
||||
config SPL_DM_INLINE_OFNODE
|
||||
bool "Inline some ofnode functions which are seldom used in SPL"
|
||||
depends on SPL_DM
|
||||
default y
|
||||
help
|
||||
This applies to several ofnode functions (see ofnode.h) which are
|
||||
seldom used. Inlining them can help reduce code size.
|
||||
|
||||
config TPL_DM_INLINE_OFNODE
|
||||
bool "Inline some ofnode functions which are seldom used in TPL"
|
||||
depends on TPL_DM
|
||||
default y
|
||||
help
|
||||
This applies to several ofnode functions (see ofnode.h) which are
|
||||
seldom used. Inlining them can help reduce code size.
|
||||
|
||||
config REGMAP
|
||||
bool "Support register maps"
|
||||
depends on DM
|
||||
|
|
|
@ -207,7 +207,6 @@ int device_remove(struct udevice *dev, uint flags)
|
|||
if (flags_remove(flags, drv->flags)) {
|
||||
device_free(dev);
|
||||
|
||||
dev->seq = -1;
|
||||
dev->flags &= ~DM_FLAG_ACTIVATED;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
|
|||
struct udevice *dev;
|
||||
struct uclass *uc;
|
||||
int size, ret = 0;
|
||||
bool auto_seq = true;
|
||||
|
||||
if (devp)
|
||||
*devp = NULL;
|
||||
|
@ -71,30 +72,23 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
|
|||
dev->driver = drv;
|
||||
dev->uclass = uc;
|
||||
|
||||
dev->seq = -1;
|
||||
dev->req_seq = -1;
|
||||
dev->sqq = -1;
|
||||
if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
|
||||
(uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
|
||||
/*
|
||||
* Some devices, such as a SPI bus, I2C bus and serial ports
|
||||
* are numbered using aliases.
|
||||
*
|
||||
* This is just a 'requested' sequence, and will be
|
||||
* resolved (and ->seq updated) when the device is probed.
|
||||
*/
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL) &&
|
||||
!CONFIG_IS_ENABLED(OF_PLATDATA)) {
|
||||
if (uc->uc_drv->name && ofnode_valid(node))
|
||||
dev_read_alias_seq(dev, &dev->req_seq);
|
||||
#if CONFIG_IS_ENABLED(OF_PRIOR_STAGE)
|
||||
if (dev->req_seq == -1)
|
||||
dev->req_seq =
|
||||
uclass_find_next_free_req_seq(drv->id);
|
||||
#endif
|
||||
} else {
|
||||
dev->req_seq = uclass_find_next_free_req_seq(drv->id);
|
||||
if (uc->uc_drv->name && ofnode_valid(node)) {
|
||||
if (!dev_read_alias_seq(dev, &dev->sqq))
|
||||
auto_seq = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (auto_seq && !(uc->uc_drv->flags & DM_UC_FLAG_NO_AUTO_SEQ))
|
||||
dev->sqq = uclass_find_next_free_seq(uc);
|
||||
|
||||
if (drv->plat_auto) {
|
||||
bool alloc = !plat;
|
||||
|
@ -411,7 +405,6 @@ int device_probe(struct udevice *dev)
|
|||
{
|
||||
const struct driver *drv;
|
||||
int ret;
|
||||
int seq;
|
||||
|
||||
if (!dev)
|
||||
return -EINVAL;
|
||||
|
@ -442,13 +435,6 @@ int device_probe(struct udevice *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
seq = uclass_resolve_seq(dev);
|
||||
if (seq < 0) {
|
||||
ret = seq;
|
||||
goto fail;
|
||||
}
|
||||
dev->seq = seq;
|
||||
|
||||
dev->flags |= DM_FLAG_ACTIVATED;
|
||||
|
||||
/*
|
||||
|
@ -511,7 +497,6 @@ fail_uclass:
|
|||
fail:
|
||||
dev->flags &= ~DM_FLAG_ACTIVATED;
|
||||
|
||||
dev->seq = -1;
|
||||
device_free(dev);
|
||||
|
||||
return ret;
|
||||
|
@ -645,18 +630,15 @@ int device_get_child_count(const struct udevice *parent)
|
|||
return count;
|
||||
}
|
||||
|
||||
int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq,
|
||||
bool find_req_seq, struct udevice **devp)
|
||||
int device_find_child_by_seq(const struct udevice *parent, int seq,
|
||||
struct udevice **devp)
|
||||
{
|
||||
struct udevice *dev;
|
||||
|
||||
*devp = NULL;
|
||||
if (seq_or_req_seq == -1)
|
||||
return -ENODEV;
|
||||
|
||||
list_for_each_entry(dev, &parent->child_head, sibling_node) {
|
||||
if ((find_req_seq ? dev->req_seq : dev->seq) ==
|
||||
seq_or_req_seq) {
|
||||
if (dev->sqq == seq) {
|
||||
*devp = dev;
|
||||
return 0;
|
||||
}
|
||||
|
@ -672,14 +654,8 @@ int device_get_child_by_seq(const struct udevice *parent, int seq,
|
|||
int ret;
|
||||
|
||||
*devp = NULL;
|
||||
ret = device_find_child_by_seq(parent, seq, false, &dev);
|
||||
if (ret == -ENODEV) {
|
||||
/*
|
||||
* We didn't find it in probed devices. See if there is one
|
||||
* that will request this seq if probed.
|
||||
*/
|
||||
ret = device_find_child_by_seq(parent, seq, true, &dev);
|
||||
}
|
||||
ret = device_find_child_by_seq(parent, seq, &dev);
|
||||
|
||||
return device_get_device_tail(dev, ret, devp);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ static void dm_display_line(struct udevice *dev, int index)
|
|||
printf("%-3i %c %s @ %08lx", index,
|
||||
dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
|
||||
dev->name, (ulong)map_to_sysmem(dev));
|
||||
if (dev->seq != -1 || dev->req_seq != -1)
|
||||
printf(", seq %d, (req %d)", dev->seq, dev->req_seq);
|
||||
if (dev->sqq != -1)
|
||||
printf(", seq %d", dev_seq(dev));
|
||||
puts("\n");
|
||||
}
|
||||
|
||||
|
|
|
@ -226,6 +226,7 @@ int ofnode_read_u32_array(ofnode node, const char *propname,
|
|||
}
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(DM_INLINE_OFNODE)
|
||||
bool ofnode_is_enabled(ofnode node)
|
||||
{
|
||||
if (ofnode_is_np(node)) {
|
||||
|
@ -255,6 +256,7 @@ ofnode ofnode_next_subnode(ofnode node)
|
|||
return offset_to_ofnode(
|
||||
fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
|
||||
}
|
||||
#endif /* !DM_INLINE_OFNODE */
|
||||
|
||||
ofnode ofnode_get_parent(ofnode node)
|
||||
{
|
||||
|
|
|
@ -281,8 +281,10 @@ int dev_read_alias_seq(const struct udevice *dev, int *devnump)
|
|||
|
||||
if (ofnode_is_np(node)) {
|
||||
ret = of_alias_get_id(ofnode_to_np(node), uc_name);
|
||||
if (ret >= 0)
|
||||
if (ret >= 0) {
|
||||
*devnump = ret;
|
||||
ret = 0;
|
||||
}
|
||||
} else {
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||
ret = fdtdec_get_alias_seq(gd->fdt_blob, uc_name,
|
||||
|
|
|
@ -311,22 +311,24 @@ int dm_init_and_scan(bool pre_reloc_only)
|
|||
ret = dm_scan_plat(pre_reloc_only);
|
||||
if (ret) {
|
||||
debug("dm_scan_plat() failed: %d\n", ret);
|
||||
return ret;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
|
||||
ret = dm_extended_scan(pre_reloc_only);
|
||||
if (ret) {
|
||||
debug("dm_extended_scan() failed: %d\n", ret);
|
||||
return ret;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
ret = dm_scan_other(pre_reloc_only);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto fail;
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ACPIGEN
|
||||
|
|
|
@ -272,48 +272,46 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
int uclass_find_next_free_req_seq(enum uclass_id id)
|
||||
int uclass_find_next_free_seq(struct uclass *uc)
|
||||
{
|
||||
struct uclass *uc;
|
||||
struct udevice *dev;
|
||||
int ret;
|
||||
int max = -1;
|
||||
|
||||
ret = uclass_get(id, &uc);
|
||||
if (ret)
|
||||
return ret;
|
||||
/* If using aliases, start with the highest alias value */
|
||||
if (CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
|
||||
(uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS))
|
||||
max = dev_read_alias_highest_id(uc->uc_drv->name);
|
||||
|
||||
/* Avoid conflict with existing devices */
|
||||
list_for_each_entry(dev, &uc->dev_head, uclass_node) {
|
||||
if ((dev->req_seq != -1) && (dev->req_seq > max))
|
||||
max = dev->req_seq;
|
||||
if (dev->sqq > max)
|
||||
max = dev->sqq;
|
||||
}
|
||||
|
||||
if (max == -1)
|
||||
return 0;
|
||||
/*
|
||||
* At this point, max will be -1 if there are no existing aliases or
|
||||
* devices
|
||||
*/
|
||||
|
||||
return max + 1;
|
||||
}
|
||||
|
||||
int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq,
|
||||
bool find_req_seq, struct udevice **devp)
|
||||
int uclass_find_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)
|
||||
{
|
||||
struct uclass *uc;
|
||||
struct udevice *dev;
|
||||
int ret;
|
||||
|
||||
*devp = NULL;
|
||||
log_debug("%d %d\n", find_req_seq, seq_or_req_seq);
|
||||
if (seq_or_req_seq == -1)
|
||||
log_debug("%d\n", seq);
|
||||
if (seq == -1)
|
||||
return -ENODEV;
|
||||
ret = uclass_get(id, &uc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
uclass_foreach_dev(dev, uc) {
|
||||
log_debug(" - %d %d '%s'\n",
|
||||
dev->req_seq, dev->seq, dev->name);
|
||||
if ((find_req_seq ? dev->req_seq : dev->seq) ==
|
||||
seq_or_req_seq) {
|
||||
log_debug(" - %d '%s'\n", dev->sqq, dev->name);
|
||||
if (dev->sqq == seq) {
|
||||
*devp = dev;
|
||||
log_debug(" - found\n");
|
||||
return 0;
|
||||
|
@ -473,14 +471,8 @@ int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice **devp)
|
|||
int ret;
|
||||
|
||||
*devp = NULL;
|
||||
ret = uclass_find_device_by_seq(id, seq, false, &dev);
|
||||
if (ret == -ENODEV) {
|
||||
/*
|
||||
* We didn't find it in probed devices. See if there is one
|
||||
* that will request this seq if probed.
|
||||
*/
|
||||
ret = uclass_find_device_by_seq(id, seq, true, &dev);
|
||||
}
|
||||
ret = uclass_find_device_by_seq(id, seq, &dev);
|
||||
|
||||
return uclass_get_device_tail(dev, ret, devp);
|
||||
}
|
||||
|
||||
|
@ -687,46 +679,6 @@ int uclass_unbind_device(struct udevice *dev)
|
|||
}
|
||||
#endif
|
||||
|
||||
int uclass_resolve_seq(struct udevice *dev)
|
||||
{
|
||||
struct uclass *uc = dev->uclass;
|
||||
struct uclass_driver *uc_drv = uc->uc_drv;
|
||||
struct udevice *dup;
|
||||
int seq = 0;
|
||||
int ret;
|
||||
|
||||
assert(dev->seq == -1);
|
||||
ret = uclass_find_device_by_seq(uc_drv->id, dev->req_seq, false, &dup);
|
||||
if (!ret) {
|
||||
dm_warn("Device '%s': seq %d is in use by '%s'\n",
|
||||
dev->name, dev->req_seq, dup->name);
|
||||
} else if (ret == -ENODEV) {
|
||||
/* Our requested sequence number is available */
|
||||
if (dev->req_seq != -1)
|
||||
return dev->req_seq;
|
||||
} else {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL) && CONFIG_IS_ENABLED(DM_SEQ_ALIAS) &&
|
||||
(uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS)) {
|
||||
/*
|
||||
* dev_read_alias_highest_id() will return -1 if there no
|
||||
* alias. Thus we can always add one.
|
||||
*/
|
||||
seq = dev_read_alias_highest_id(uc_drv->name) + 1;
|
||||
}
|
||||
|
||||
for (; seq < DM_MAX_SEQ; seq++) {
|
||||
ret = uclass_find_device_by_seq(uc_drv->id, seq, false, &dup);
|
||||
if (ret == -ENODEV)
|
||||
break;
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
return seq;
|
||||
}
|
||||
|
||||
int uclass_pre_probe_device(struct udevice *dev)
|
||||
{
|
||||
struct uclass_driver *uc_drv;
|
||||
|
|
|
@ -183,7 +183,7 @@ static int imx_rgpio2p_bind(struct udevice *dev)
|
|||
return -ENOMEM;
|
||||
|
||||
plat->regs = (struct gpio_regs *)addr;
|
||||
plat->bank_index = dev->req_seq;
|
||||
plat->bank_index = dev_seq(dev);
|
||||
dev->plat = plat;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -252,7 +252,7 @@ static int iproc_gpio_of_to_plat(struct udevice *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
snprintf(name, sizeof(name), "GPIO%d", dev->req_seq);
|
||||
snprintf(name, sizeof(name), "GPIO%d", dev_seq(dev));
|
||||
plat->name = strdup(name);
|
||||
if (!plat->name)
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -92,7 +92,7 @@ static int mvebu_gpio_probe(struct udevice *dev)
|
|||
|
||||
priv->regs = dev_read_addr_ptr(dev);
|
||||
uc_priv->gpio_count = MVEBU_GPIOS_PER_BANK;
|
||||
priv->name[0] = 'A' + dev->req_seq;
|
||||
priv->name[0] = 'A' + dev_seq(dev);
|
||||
uc_priv->bank_name = priv->name;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -318,7 +318,7 @@ static int mxc_gpio_of_to_plat(struct udevice *dev)
|
|||
|
||||
plat->regs = (struct gpio_regs *)addr;
|
||||
}
|
||||
plat->bank_index = dev->req_seq;
|
||||
plat->bank_index = dev_seq(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ static int octeon_gpio_probe(struct udevice *dev)
|
|||
|
||||
uc_priv->bank_name = strdup(dev->name);
|
||||
end = strchr(uc_priv->bank_name, '@');
|
||||
end[0] = 'A' + dev->seq;
|
||||
end[0] = 'A' + dev_seq(dev);
|
||||
end[1] = '\0';
|
||||
|
||||
debug("%s(%s): base address: %p, pin count: %d\n",
|
||||
|
|
|
@ -114,7 +114,7 @@ static int vybrid_gpio_odata_to_plat(struct udevice *dev)
|
|||
return -EINVAL;
|
||||
|
||||
plat->base = base_addr;
|
||||
plat->chip = dev->req_seq;
|
||||
plat->chip = dev_seq(dev);
|
||||
plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -110,7 +110,7 @@ static int ast_i2c_probe(struct udevice *dev)
|
|||
{
|
||||
struct ast2500_scu *scu;
|
||||
|
||||
debug("Enabling I2C%u\n", dev->seq);
|
||||
debug("Enabling I2C%u\n", dev_seq(dev));
|
||||
|
||||
/*
|
||||
* Get all I2C devices out of Reset.
|
||||
|
@ -307,7 +307,7 @@ static int ast_i2c_set_speed(struct udevice *dev, unsigned int speed)
|
|||
struct ast_i2c_regs *regs = priv->regs;
|
||||
ulong i2c_rate, divider;
|
||||
|
||||
debug("Setting speed for I2C%d to <%u>\n", dev->seq, speed);
|
||||
debug("Setting speed for I2C%d to <%u>\n", dev_seq(dev), speed);
|
||||
if (!speed) {
|
||||
debug("No valid speed specified\n");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -470,7 +470,7 @@ static int davinci_i2c_probe(struct udevice *dev)
|
|||
{
|
||||
struct i2c_bus *i2c_bus = dev_get_priv(dev);
|
||||
|
||||
i2c_bus->id = dev->seq;
|
||||
i2c_bus->id = dev_seq(dev);
|
||||
i2c_bus->regs = dev_read_addr_ptr(dev);
|
||||
|
||||
i2c_bus->speed = 100000;
|
||||
|
|
|
@ -95,21 +95,7 @@ static int designware_i2c_pci_bind(struct udevice *dev)
|
|||
if (dev_of_valid(dev))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Create a unique device name for PCI type devices
|
||||
* ToDo:
|
||||
* Setting req_seq in the driver is probably not recommended.
|
||||
* But without a DT alias the number is not configured. And
|
||||
* using this driver is impossible for PCIe I2C devices.
|
||||
* This can be removed, once a better (correct) way for this
|
||||
* is found and implemented.
|
||||
*
|
||||
* TODO(sjg@chromium.org): Perhaps if uclasses had platdata this would
|
||||
* be possible. We cannot use static data in drivers since they may be
|
||||
* used in SPL or before relocation.
|
||||
*/
|
||||
dev->req_seq = uclass_find_next_free_req_seq(UCLASS_I2C);
|
||||
sprintf(name, "i2c_designware#%u", dev->req_seq);
|
||||
sprintf(name, "i2c_designware#%u", dev_seq(dev));
|
||||
device_set_name(dev, name);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -533,7 +533,7 @@ static int s3c_i2c_of_to_plat(struct udevice *dev)
|
|||
dev_read_u32_default(dev, "clock-frequency",
|
||||
I2C_SPEED_STANDARD_RATE);
|
||||
i2c_bus->node = node;
|
||||
i2c_bus->bus_num = dev->seq;
|
||||
i2c_bus->bus_num = dev_seq(dev);
|
||||
|
||||
exynos_pinmux_config(i2c_bus->id, PINMUX_FLAG_HS_MODE);
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ static int i2c_gpio_probe(struct udevice *dev, uint chip, uint chip_flags)
|
|||
i2c_gpio_send_stop(bus, delay);
|
||||
|
||||
debug("%s: bus: %d (%s) chip: %x flags: %x ret: %d\n",
|
||||
__func__, dev->seq, dev->name, chip, chip_flags, ret);
|
||||
__func__, dev_seq(dev), dev->name, chip, chip_flags, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -686,27 +686,11 @@ static int i2c_child_post_bind(struct udevice *dev)
|
|||
#endif
|
||||
}
|
||||
|
||||
struct i2c_priv {
|
||||
int max_id;
|
||||
};
|
||||
|
||||
static int i2c_post_bind(struct udevice *dev)
|
||||
{
|
||||
struct uclass *class = dev->uclass;
|
||||
struct i2c_priv *priv = class->priv;
|
||||
int ret = 0;
|
||||
|
||||
/* Just for sure */
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
debug("%s: %s, req_seq=%d\n", __func__, dev->name, dev->req_seq);
|
||||
|
||||
/* if there is no alias ID, use the first free */
|
||||
if (dev->req_seq == -1)
|
||||
dev->req_seq = ++priv->max_id;
|
||||
|
||||
debug("%s: %s, new req_seq=%d\n", __func__, dev->name, dev->req_seq);
|
||||
debug("%s: %s, seq=%d\n", __func__, dev->name, dev_seq(dev));
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
ret = dm_scan_fdt_dev(dev);
|
||||
|
@ -714,32 +698,11 @@ static int i2c_post_bind(struct udevice *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
int i2c_uclass_init(struct uclass *class)
|
||||
{
|
||||
struct i2c_priv *priv = class->priv;
|
||||
|
||||
/* Just for sure */
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Get the last allocated alias. */
|
||||
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA))
|
||||
priv->max_id = dev_read_alias_highest_id("i2c");
|
||||
else
|
||||
priv->max_id = -1;
|
||||
|
||||
debug("%s: highest alias id is %d\n", __func__, priv->max_id);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
UCLASS_DRIVER(i2c) = {
|
||||
.id = UCLASS_I2C,
|
||||
.name = "i2c",
|
||||
.flags = DM_UC_FLAG_SEQ_ALIAS,
|
||||
.post_bind = i2c_post_bind,
|
||||
.init = i2c_uclass_init,
|
||||
.priv_auto = sizeof(struct i2c_priv),
|
||||
.pre_probe = i2c_pre_probe,
|
||||
.post_probe = i2c_post_probe,
|
||||
.per_device_auto = sizeof(struct dm_i2c_bus),
|
||||
|
|
|
@ -252,11 +252,6 @@ static int versatile_i2c_probe(struct udevice *dev)
|
|||
|
||||
priv->base = (phys_addr_t)dev_read_addr(dev);
|
||||
priv->delay = 25; /* 25us * 4 = 100kHz */
|
||||
/*
|
||||
* U-Boot still doesn't assign automatically
|
||||
* sequence numbers to devices
|
||||
*/
|
||||
dev->req_seq = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ static int bus_i2c_set_bus_speed(struct udevice *bus, int speed)
|
|||
return clock_rate;
|
||||
}
|
||||
} else {
|
||||
clock_rate = imx_get_i2cclk(bus->seq);
|
||||
clock_rate = imx_get_i2cclk(dev_seq(bus));
|
||||
if (!clock_rate)
|
||||
return -EPERM;
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ static int bus_i2c_init(struct udevice *bus, int speed)
|
|||
val = readl(®s->mcr) & ~LPI2C_MCR_MEN_MASK;
|
||||
writel(val | LPI2C_MCR_MEN(1), ®s->mcr);
|
||||
|
||||
debug("i2c : controller bus %d, speed %d:\n", bus->seq, speed);
|
||||
debug("i2c : controller bus %d, speed %d:\n", dev_seq(bus), speed);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -452,11 +452,11 @@ static int imx_lpi2c_probe(struct udevice *bus)
|
|||
return -EINVAL;
|
||||
|
||||
i2c_bus->base = addr;
|
||||
i2c_bus->index = bus->seq;
|
||||
i2c_bus->index = dev_seq(bus);
|
||||
i2c_bus->bus = bus;
|
||||
|
||||
/* power up i2c resource */
|
||||
ret = init_i2c_power(bus->seq);
|
||||
ret = init_i2c_power(dev_seq(bus));
|
||||
if (ret) {
|
||||
debug("init_i2c_power err = %d\n", ret);
|
||||
return ret;
|
||||
|
@ -486,7 +486,7 @@ static int imx_lpi2c_probe(struct udevice *bus)
|
|||
}
|
||||
} else {
|
||||
/* To i.MX7ULP, only i2c4-7 can be handled by A7 core */
|
||||
ret = enable_i2c_clk(1, bus->seq);
|
||||
ret = enable_i2c_clk(1, dev_seq(bus));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ static int imx_lpi2c_probe(struct udevice *bus)
|
|||
return ret;
|
||||
|
||||
debug("i2c : controller bus %d at 0x%lx , speed %d: ",
|
||||
bus->seq, i2c_bus->base,
|
||||
dev_seq(bus), i2c_bus->base,
|
||||
i2c_bus->speed);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -269,21 +269,11 @@ static int intel_i2c_probe(struct udevice *dev)
|
|||
|
||||
static int intel_i2c_bind(struct udevice *dev)
|
||||
{
|
||||
static int num_cards __attribute__ ((section(".data")));
|
||||
char name[20];
|
||||
|
||||
/* Create a unique device name for PCI type devices */
|
||||
if (device_is_on_pci_bus(dev)) {
|
||||
/*
|
||||
* ToDo:
|
||||
* Setting req_seq in the driver is probably not recommended.
|
||||
* But without a DT alias the number is not configured. And
|
||||
* using this driver is impossible for PCIe I2C devices.
|
||||
* This can be removed, once a better (correct) way for this
|
||||
* is found and implemented.
|
||||
*/
|
||||
dev->req_seq = num_cards;
|
||||
sprintf(name, "intel_i2c#%u", num_cards++);
|
||||
sprintf(name, "intel_i2c#%u", dev_seq(dev));
|
||||
device_set_name(dev, name);
|
||||
}
|
||||
|
||||
|
|
|
@ -282,7 +282,11 @@ U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_2, lpc32xx_i2c_init, NULL,
|
|||
static int lpc32xx_i2c_probe(struct udevice *bus)
|
||||
{
|
||||
struct lpc32xx_i2c_dev *dev = dev_get_plat(bus);
|
||||
bus->seq = dev->index;
|
||||
|
||||
/*
|
||||
* FIXME: This is not permitted
|
||||
* dev_seq(bus) = dev->index;
|
||||
*/
|
||||
|
||||
__i2c_init(dev->base, dev->speed, 0, dev->index);
|
||||
return 0;
|
||||
|
|
|
@ -87,8 +87,8 @@ static int i2c_mux_post_bind(struct udevice *mux)
|
|||
|
||||
ret = device_bind_driver_to_node(mux, "i2c_mux_bus_drv",
|
||||
full_name, node, &dev);
|
||||
debug(" - bind ret=%d, %s, req_seq %d\n", ret,
|
||||
dev ? dev->name : NULL, dev->req_seq);
|
||||
debug(" - bind ret=%d, %s, seq %d\n", ret,
|
||||
dev ? dev->name : NULL, dev_seq(dev));
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -823,9 +823,9 @@ static int mvtwsi_i2c_bind(struct udevice *bus)
|
|||
struct mvtwsi_registers *twsi = dev_read_addr_ptr(bus);
|
||||
|
||||
/* Disable the hidden slave in i2c0 of these platforms */
|
||||
if ((IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_ARCH_KIRKWOOD)
|
||||
|| IS_ENABLED(CONFIG_ARMADA_8K))
|
||||
&& bus->req_seq == 0)
|
||||
if ((IS_ENABLED(CONFIG_ARMADA_38X) ||
|
||||
IS_ENABLED(CONFIG_ARCH_KIRKWOOD) ||
|
||||
IS_ENABLED(CONFIG_ARMADA_8K)) && !dev_seq(bus))
|
||||
twsi_disable_i2c_slave(twsi);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -914,7 +914,7 @@ static int mxc_i2c_probe(struct udevice *bus)
|
|||
}
|
||||
|
||||
i2c_bus->base = addr;
|
||||
i2c_bus->index = bus->seq;
|
||||
i2c_bus->index = dev_seq(bus);
|
||||
i2c_bus->bus = bus;
|
||||
|
||||
/* Enable clk */
|
||||
|
@ -930,7 +930,7 @@ static int mxc_i2c_probe(struct udevice *bus)
|
|||
return ret;
|
||||
}
|
||||
#else
|
||||
ret = enable_i2c_clk(1, bus->seq);
|
||||
ret = enable_i2c_clk(1, dev_seq(bus));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
#endif
|
||||
|
@ -942,7 +942,7 @@ static int mxc_i2c_probe(struct udevice *bus)
|
|||
ret = fdt_stringlist_search(fdt, node, "pinctrl-names", "gpio");
|
||||
if (ret < 0) {
|
||||
debug("i2c bus %d at 0x%2lx, no gpio pinctrl state.\n",
|
||||
bus->seq, i2c_bus->base);
|
||||
dev_seq(bus), i2c_bus->base);
|
||||
} else {
|
||||
ret = gpio_request_by_name_nodev(offset_to_ofnode(node),
|
||||
"scl-gpios", 0, &i2c_bus->scl_gpio,
|
||||
|
@ -955,7 +955,7 @@ static int mxc_i2c_probe(struct udevice *bus)
|
|||
ret || ret2) {
|
||||
dev_err(bus,
|
||||
"i2c bus %d at %lu, fail to request scl/sda gpio\n",
|
||||
bus->seq, i2c_bus->base);
|
||||
dev_seq(bus), i2c_bus->base);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -966,7 +966,7 @@ static int mxc_i2c_probe(struct udevice *bus)
|
|||
*/
|
||||
|
||||
debug("i2c : controller bus %d at %lu , speed %d: ",
|
||||
bus->seq, i2c_bus->base,
|
||||
dev_seq(bus), i2c_bus->base,
|
||||
i2c_bus->speed);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -240,7 +240,7 @@ static int nx_i2c_probe(struct udevice *dev)
|
|||
return -EINVAL;
|
||||
bus->regs = (struct nx_i2c_regs *)addr;
|
||||
|
||||
bus->bus_num = dev->seq;
|
||||
bus->bus_num = dev_seq(dev);
|
||||
|
||||
/* i2c node parsing */
|
||||
i2c_process_node(dev);
|
||||
|
|
|
@ -791,7 +791,6 @@ static int octeon_i2c_probe(struct udevice *dev)
|
|||
pci_dev_t bdf = dm_pci_get_bdf(dev);
|
||||
|
||||
debug("TWSI PCI device: %x\n", bdf);
|
||||
dev->req_seq = PCI_FUNC(bdf);
|
||||
|
||||
twsi->base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0,
|
||||
PCI_REGION_MEM);
|
||||
|
@ -811,7 +810,7 @@ static int octeon_i2c_probe(struct udevice *dev)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
debug("TWSI bus %d at %p\n", dev->seq, twsi->base);
|
||||
debug("TWSI bus %d at %p\n", dev_seq(dev), twsi->base);
|
||||
|
||||
/* Start with standard speed, real speed set via DT or cmd */
|
||||
return twsi_init(twsi->base, i2c_slave_addr);
|
||||
|
|
|
@ -318,7 +318,7 @@ static int s3c_i2c_of_to_plat(struct udevice *dev)
|
|||
dev_read_u32_default(dev, "clock-frequency",
|
||||
I2C_SPEED_STANDARD_RATE);
|
||||
i2c_bus->node = node;
|
||||
i2c_bus->bus_num = dev->seq;
|
||||
i2c_bus->bus_num = dev_seq(dev);
|
||||
|
||||
exynos_pinmux_config(i2c_bus->id, 0);
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ static int tegra_i2c_probe(struct udevice *dev)
|
|||
int ret;
|
||||
bool is_dvc;
|
||||
|
||||
i2c_bus->id = dev->seq;
|
||||
i2c_bus->id = dev_seq(dev);
|
||||
i2c_bus->type = dev_get_driver_data(dev);
|
||||
i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr(dev);
|
||||
if ((ulong)i2c_bus->regs == FDT_ADDR_T_NONE) {
|
||||
|
@ -408,7 +408,8 @@ static int tegra_i2c_probe(struct udevice *dev)
|
|||
}
|
||||
i2c_init_controller(i2c_bus);
|
||||
debug("%s: controller bus %d at %p, speed %d: ",
|
||||
is_dvc ? "dvc" : "i2c", dev->seq, i2c_bus->regs, i2c_bus->speed);
|
||||
is_dvc ? "dvc" : "i2c", dev_seq(dev), i2c_bus->regs,
|
||||
i2c_bus->speed);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1542,7 +1542,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
|
|||
* work as expected.
|
||||
*/
|
||||
|
||||
init_clk_usdhc(dev->seq);
|
||||
init_clk_usdhc(dev_seq(dev));
|
||||
|
||||
#if CONFIG_IS_ENABLED(CLK)
|
||||
/* Assigned clock already set clock */
|
||||
|
@ -1559,7 +1559,7 @@ static int fsl_esdhc_probe(struct udevice *dev)
|
|||
|
||||
priv->sdhc_clk = clk_get_rate(&priv->per_clk);
|
||||
#else
|
||||
priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev->seq);
|
||||
priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev_seq(dev));
|
||||
if (priv->sdhc_clk <= 0) {
|
||||
dev_err(dev, "Unable to get clk for %s\n", dev->name);
|
||||
return -EINVAL;
|
||||
|
|
|
@ -418,7 +418,6 @@ static int mmc_spi_probe(struct udevice *dev)
|
|||
priv->spi = dev_get_parent_priv(dev);
|
||||
if (!priv->spi->max_hz)
|
||||
priv->spi->max_hz = MMC_SPI_MAX_CLOCK;
|
||||
priv->spi->speed = 0;
|
||||
priv->spi->mode = SPI_MODE_0;
|
||||
priv->spi->wordlen = 8;
|
||||
|
||||
|
|
|
@ -3731,7 +3731,6 @@ U_BOOT_DRIVER(octeontx_hsmmc_slot) = {
|
|||
*/
|
||||
static int octeontx_mmc_host_probe(struct udevice *dev)
|
||||
{
|
||||
pci_dev_t bdf = dm_pci_get_bdf(dev);
|
||||
struct octeontx_mmc_host *host = dev_get_priv(dev);
|
||||
union mio_emm_int emm_int;
|
||||
u8 rev;
|
||||
|
@ -3757,7 +3756,6 @@ static int octeontx_mmc_host_probe(struct udevice *dev)
|
|||
return -1;
|
||||
}
|
||||
host->node = dev->node;
|
||||
dev->req_seq = PCI_FUNC(bdf);
|
||||
host->last_slotid = -1;
|
||||
if (otx_is_platform(PLATFORM_ASIM))
|
||||
host->is_asim = true;
|
||||
|
|
|
@ -131,7 +131,7 @@ static int sandbox_sf_probe(struct udevice *dev)
|
|||
int ret = 0;
|
||||
int cs = -1;
|
||||
|
||||
debug("%s: bus %d, looking for emul=%p: ", __func__, bus->seq, dev);
|
||||
debug("%s: bus %d, looking for emul=%p: ", __func__, dev_seq(bus), dev);
|
||||
ret = sandbox_spi_get_emul(state, bus, dev, &emul);
|
||||
if (ret) {
|
||||
printf("Error: Unknown chip select for device '%s'\n",
|
||||
|
@ -565,7 +565,7 @@ int sandbox_spi_get_emul(struct sandbox_state *state,
|
|||
struct udevice **emulp)
|
||||
{
|
||||
struct sandbox_spi_info *info;
|
||||
int busnum = bus->seq;
|
||||
int busnum = dev_seq(bus);
|
||||
int cs = spi_chip_select(slave);
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -1155,7 +1155,7 @@ static int eqos_read_rom_hwaddr(struct udevice *dev)
|
|||
struct eth_pdata *pdata = dev_get_plat(dev);
|
||||
|
||||
#ifdef CONFIG_ARCH_IMX8M
|
||||
imx_get_mac_from_fuse(dev->req_seq, pdata->enetaddr);
|
||||
imx_get_mac_from_fuse(dev_seq(dev), pdata->enetaddr);
|
||||
#endif
|
||||
return !is_valid_ethaddr(pdata->enetaddr);
|
||||
}
|
||||
|
|
|
@ -1451,7 +1451,7 @@ static int fecmxc_probe(struct udevice *dev)
|
|||
|
||||
fec_reg_setup(priv);
|
||||
|
||||
priv->dev_id = dev->seq;
|
||||
priv->dev_id = dev_seq(dev);
|
||||
|
||||
#ifdef CONFIG_DM_ETH_PHY
|
||||
bus = eth_phy_get_mdio_bus(dev);
|
||||
|
@ -1459,9 +1459,10 @@ static int fecmxc_probe(struct udevice *dev)
|
|||
|
||||
if (!bus) {
|
||||
#ifdef CONFIG_FEC_MXC_MDIO_BASE
|
||||
bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE, dev->seq);
|
||||
bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE,
|
||||
dev_seq(dev));
|
||||
#else
|
||||
bus = fec_get_miibus((ulong)priv->eth, dev->seq);
|
||||
bus = fec_get_miibus((ulong)priv->eth, dev_seq(dev));
|
||||
#endif
|
||||
}
|
||||
if (!bus) {
|
||||
|
|
|
@ -187,7 +187,7 @@ static int mc_fixup_mac_addr(void *blob, int nodeoffset,
|
|||
#ifdef CONFIG_DM_ETH
|
||||
struct eth_pdata *plat = dev_get_plat(eth_dev);
|
||||
unsigned char *enetaddr = plat->enetaddr;
|
||||
int eth_index = eth_dev->seq;
|
||||
int eth_index = dev_seq(eth_dev);
|
||||
#else
|
||||
unsigned char *enetaddr = eth_dev->enetaddr;
|
||||
int eth_index = eth_dev->index;
|
||||
|
|
|
@ -502,7 +502,7 @@ static int mcdmafec_probe(struct udevice *dev)
|
|||
int retval;
|
||||
const u32 *val;
|
||||
|
||||
info->index = dev->seq;
|
||||
info->index = dev_seq(dev);
|
||||
info->iobase = pdata->iobase;
|
||||
info->miibase = pdata->iobase;
|
||||
info->phy_addr = -1;
|
||||
|
|
|
@ -171,7 +171,7 @@ static int ftgmac100_mdio_init(struct udevice *dev)
|
|||
bus->write = ftgmac100_mdio_write;
|
||||
bus->priv = priv;
|
||||
|
||||
ret = mdio_register_seq(bus, dev->seq);
|
||||
ret = mdio_register_seq(bus, dev_seq(dev));
|
||||
if (ret) {
|
||||
free(bus);
|
||||
return ret;
|
||||
|
|
|
@ -528,7 +528,7 @@ static int higmac_probe(struct udevice *dev)
|
|||
bus->priv = priv;
|
||||
priv->bus = bus;
|
||||
|
||||
ret = mdio_register_seq(bus, dev->seq);
|
||||
ret = mdio_register_seq(bus, dev_seq(dev));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ static int mcffec_probe(struct udevice *dev)
|
|||
int retval, fec_idx;
|
||||
const u32 *val;
|
||||
|
||||
info->index = dev->seq;
|
||||
info->index = dev_seq(dev);
|
||||
info->iobase = pdata->iobase;
|
||||
info->phy_addr = -1;
|
||||
|
||||
|
|
|
@ -452,11 +452,12 @@ int nicvf_write_hwaddr(struct udevice *dev)
|
|||
* u-boot framework updates MAC to random address.
|
||||
* Use this hook to update mac address in environment.
|
||||
*/
|
||||
if (!eth_env_get_enetaddr_by_index("eth", dev->seq, ethaddr)) {
|
||||
eth_env_set_enetaddr_by_index("eth", dev->seq, pdata->enetaddr);
|
||||
if (!eth_env_get_enetaddr_by_index("eth", dev_seq(dev), ethaddr)) {
|
||||
eth_env_set_enetaddr_by_index("eth", dev_seq(dev),
|
||||
pdata->enetaddr);
|
||||
debug("%s: pMAC %pM\n", __func__, pdata->enetaddr);
|
||||
}
|
||||
eth_env_get_enetaddr_by_index("eth", dev->seq, ethaddr);
|
||||
eth_env_get_enetaddr_by_index("eth", dev_seq(dev), ethaddr);
|
||||
if (memcmp(ethaddr, pdata->enetaddr, ARP_HLEN)) {
|
||||
debug("%s: pMAC %pM\n", __func__, pdata->enetaddr);
|
||||
nicvf_hw_set_mac_addr(nic, dev);
|
||||
|
@ -540,7 +541,7 @@ int nicvf_initialize(struct udevice *dev)
|
|||
|
||||
if (is_valid_ethaddr(ethaddr)) {
|
||||
memcpy(pdata->enetaddr, ethaddr, ARP_HLEN);
|
||||
eth_env_set_enetaddr_by_index("eth", dev->seq, ethaddr);
|
||||
eth_env_set_enetaddr_by_index("eth", dev_seq(dev), ethaddr);
|
||||
}
|
||||
debug("%s enetaddr %pM ethaddr %pM\n", __func__,
|
||||
pdata->enetaddr, ethaddr);
|
||||
|
|
|
@ -319,7 +319,6 @@ int octeontx_smi_probe(struct udevice *dev)
|
|||
pci_dev_t bdf = dm_pci_get_bdf(dev);
|
||||
|
||||
debug("SMI PCI device: %x\n", bdf);
|
||||
dev->req_seq = PCI_FUNC(bdf);
|
||||
if (!dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM)) {
|
||||
printf("Failed to map PCI region for bdf %x\n", bdf);
|
||||
return -1;
|
||||
|
@ -335,7 +334,7 @@ int octeontx_smi_probe(struct udevice *dev)
|
|||
priv = malloc(sizeof(*priv));
|
||||
if (!bus || !priv) {
|
||||
printf("Failed to allocate OcteonTX MDIO bus # %u\n",
|
||||
dev->seq);
|
||||
dev_seq(dev));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -736,7 +736,7 @@ int nix_lf_setup_mac(struct udevice *dev)
|
|||
*/
|
||||
if (memcmp(nix->lmac->mac_addr, pdata->enetaddr, ARP_HLEN)) {
|
||||
memcpy(nix->lmac->mac_addr, pdata->enetaddr, 6);
|
||||
eth_env_set_enetaddr_by_index("eth", rvu->dev->seq,
|
||||
eth_env_set_enetaddr_by_index("eth", dev_seq(rvu->dev),
|
||||
pdata->enetaddr);
|
||||
cgx_lmac_mac_filter_setup(nix->lmac);
|
||||
/* Update user given MAC address to ATF for update
|
||||
|
|
|
@ -34,7 +34,7 @@ int rvu_pf_init(struct rvu_pf *rvu)
|
|||
/* to make post_probe happy */
|
||||
if (is_valid_ethaddr(nix->lmac->mac_addr)) {
|
||||
memcpy(pdata->enetaddr, nix->lmac->mac_addr, 6);
|
||||
eth_env_set_enetaddr_by_index("eth", rvu->dev->seq,
|
||||
eth_env_set_enetaddr_by_index("eth", dev_seq(rvu->dev),
|
||||
pdata->enetaddr);
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ int rvu_pf_probe(struct udevice *dev)
|
|||
debug("%s: name: %s\n", __func__, dev->name);
|
||||
|
||||
rvu->pf_base = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_2, PCI_REGION_MEM);
|
||||
rvu->pfid = dev->seq + 1; // RVU PF's start from 1;
|
||||
rvu->pfid = dev_seq(dev) + 1; // RVU PF's start from 1;
|
||||
rvu->dev = dev;
|
||||
if (!rvu_af_dev) {
|
||||
printf("%s: Error: Could not find RVU AF device\n",
|
||||
|
@ -80,7 +80,7 @@ int rvu_pf_probe(struct udevice *dev)
|
|||
* modify device name to include index/sequence number,
|
||||
* for better readability, this is 1:1 mapping with eth0/1/2.. names.
|
||||
*/
|
||||
sprintf(name, "rvu_pf#%d", dev->seq);
|
||||
sprintf(name, "rvu_pf#%d", dev_seq(dev));
|
||||
device_set_name(dev, name);
|
||||
debug("%s: name: %s\n", __func__, dev->name);
|
||||
return err;
|
||||
|
|
|
@ -697,7 +697,7 @@ static int axi_emac_probe(struct udevice *dev)
|
|||
priv->bus->write = axiemac_miiphy_write;
|
||||
priv->bus->priv = priv;
|
||||
|
||||
ret = mdio_register_seq(priv->bus, dev->seq);
|
||||
ret = mdio_register_seq(priv->bus, dev_seq(dev));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -568,7 +568,7 @@ static int emaclite_probe(struct udevice *dev)
|
|||
emaclite->bus->write = emaclite_miiphy_write;
|
||||
emaclite->bus->priv = emaclite;
|
||||
|
||||
ret = mdio_register_seq(emaclite->bus, dev->seq);
|
||||
ret = mdio_register_seq(emaclite->bus, dev_seq(dev));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -705,7 +705,7 @@ static int zynq_gem_probe(struct udevice *dev)
|
|||
priv->bus->write = zynq_gem_miiphy_write;
|
||||
priv->bus->priv = priv;
|
||||
|
||||
ret = mdio_register_seq(priv->bus, dev->seq);
|
||||
ret = mdio_register_seq(priv->bus, dev_seq(dev));
|
||||
if (ret)
|
||||
goto err2;
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ static int pcie_advk_probe(struct udevice *dev)
|
|||
dev_warn(pcie->dev, "PCIE Reset on GPIO support is missing\n");
|
||||
}
|
||||
|
||||
pcie->first_busno = dev->seq;
|
||||
pcie->first_busno = dev_seq(dev);
|
||||
pcie->dev = pci_get_controller(dev);
|
||||
|
||||
return pcie_advk_setup_hw(pcie);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <asm/io.h>
|
||||
#include <dm/device-internal.h>
|
||||
#include <dm/lists.h>
|
||||
#include <dm/uclass-internal.h>
|
||||
#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
|
||||
#include <asm/fsp/fsp_support.h>
|
||||
#endif
|
||||
|
@ -65,7 +66,7 @@ pci_dev_t dm_pci_get_bdf(const struct udevice *dev)
|
|||
if (!device_active(bus))
|
||||
log_err("PCI: Device '%s' on unprobed bus '%s'\n", dev->name,
|
||||
bus->name);
|
||||
return PCI_ADD_BUS(bus->seq, pplat->devfn);
|
||||
return PCI_ADD_BUS(dev_seq(bus), pplat->devfn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,8 +82,8 @@ static int pci_get_bus_max(void)
|
|||
|
||||
ret = uclass_get(UCLASS_PCI, &uc);
|
||||
uclass_foreach_dev(bus, uc) {
|
||||
if (bus->seq > ret)
|
||||
ret = bus->seq;
|
||||
if (dev_seq(bus) > ret)
|
||||
ret = dev_seq(bus);
|
||||
}
|
||||
|
||||
debug("%s: ret=%d\n", __func__, ret);
|
||||
|
@ -513,7 +514,7 @@ static void set_vga_bridge_bits(struct udevice *dev)
|
|||
struct udevice *parent = dev->parent;
|
||||
u16 bc;
|
||||
|
||||
while (parent->seq != 0) {
|
||||
while (dev_seq(parent) != 0) {
|
||||
dm_pci_read_config16(parent, PCI_BRIDGE_CONTROL, &bc);
|
||||
bc |= PCI_BRIDGE_CTL_VGA;
|
||||
dm_pci_write_config16(parent, PCI_BRIDGE_CONTROL, bc);
|
||||
|
@ -529,7 +530,7 @@ int pci_auto_config_devices(struct udevice *bus)
|
|||
struct udevice *dev;
|
||||
int ret;
|
||||
|
||||
sub_bus = bus->seq;
|
||||
sub_bus = dev_seq(bus);
|
||||
debug("%s: start\n", __func__);
|
||||
pciauto_config_init(hose);
|
||||
for (ret = device_find_first_child(bus, &dev);
|
||||
|
@ -544,7 +545,7 @@ int pci_auto_config_devices(struct udevice *bus)
|
|||
continue;
|
||||
ret = dm_pciauto_config_device(dev);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return log_msg_ret("auto", ret);
|
||||
max_bus = ret;
|
||||
sub_bus = max(sub_bus, max_bus);
|
||||
|
||||
|
@ -554,7 +555,7 @@ int pci_auto_config_devices(struct udevice *bus)
|
|||
}
|
||||
debug("%s: done\n", __func__);
|
||||
|
||||
return sub_bus;
|
||||
return log_msg_ret("sub", sub_bus);
|
||||
}
|
||||
|
||||
int pci_generic_mmap_write_config(
|
||||
|
@ -641,17 +642,9 @@ int dm_pci_hose_probe_bus(struct udevice *bus)
|
|||
if (ret) {
|
||||
debug("%s: Cannot probe bus %s: %d\n", __func__, bus->name,
|
||||
ret);
|
||||
return ret;
|
||||
return log_msg_ret("probe", ret);
|
||||
}
|
||||
|
||||
if (!ea_pos) {
|
||||
if (sub_bus != bus->seq) {
|
||||
debug("%s: Internal error, bus '%s' got seq %d, expected %d\n",
|
||||
__func__, bus->name, bus->seq, sub_bus);
|
||||
return -EPIPE;
|
||||
}
|
||||
sub_bus = pci_get_bus_max();
|
||||
}
|
||||
dm_pciauto_postscan_setup_bridge(bus, sub_bus);
|
||||
|
||||
return sub_bus;
|
||||
|
@ -714,7 +707,7 @@ static int pci_find_and_bind_driver(struct udevice *parent,
|
|||
|
||||
if (ofnode_valid(node) && !ofnode_is_available(node)) {
|
||||
debug("%s: Ignoring disabled device\n", __func__);
|
||||
return -EPERM;
|
||||
return log_msg_ret("dis", -EPERM);
|
||||
}
|
||||
|
||||
start = ll_entry_start(struct pci_driver_entry, pci_driver_entry);
|
||||
|
@ -740,7 +733,7 @@ static int pci_find_and_bind_driver(struct udevice *parent,
|
|||
*/
|
||||
if (!(gd->flags & GD_FLG_RELOC) &&
|
||||
!(drv->flags & DM_FLAG_PRE_RELOC))
|
||||
return -EPERM;
|
||||
return log_msg_ret("pre", -EPERM);
|
||||
|
||||
/*
|
||||
* We could pass the descriptor to the driver as
|
||||
|
@ -768,10 +761,10 @@ static int pci_find_and_bind_driver(struct udevice *parent,
|
|||
* limited (ie: using Cache As RAM).
|
||||
*/
|
||||
if (!(gd->flags & GD_FLG_RELOC) && !bridge)
|
||||
return -EPERM;
|
||||
return log_msg_ret("notbr", -EPERM);
|
||||
|
||||
/* Bind a generic driver so that the device can be used */
|
||||
sprintf(name, "pci_%x:%x.%x", parent->seq, PCI_DEV(bdf),
|
||||
sprintf(name, "pci_%x:%x.%x", dev_seq(parent), PCI_DEV(bdf),
|
||||
PCI_FUNC(bdf));
|
||||
str = strdup(name);
|
||||
if (!str)
|
||||
|
@ -803,9 +796,9 @@ int pci_bind_bus_devices(struct udevice *bus)
|
|||
int ret;
|
||||
|
||||
found_multi = false;
|
||||
end = PCI_BDF(bus->seq, PCI_MAX_PCI_DEVICES - 1,
|
||||
end = PCI_BDF(dev_seq(bus), PCI_MAX_PCI_DEVICES - 1,
|
||||
PCI_MAX_PCI_FUNCTIONS - 1);
|
||||
for (bdf = PCI_BDF(bus->seq, 0, 0); bdf <= end;
|
||||
for (bdf = PCI_BDF(dev_seq(bus), 0, 0); bdf <= end;
|
||||
bdf += PCI_BDF(0, 0, 1)) {
|
||||
struct pci_child_plat *pplat;
|
||||
struct udevice *dev;
|
||||
|
@ -832,7 +825,7 @@ int pci_bind_bus_devices(struct udevice *bus)
|
|||
found_multi = header_type & 0x80;
|
||||
|
||||
debug("%s: bus %d/%s: found device %x, function %d", __func__,
|
||||
bus->seq, bus->name, PCI_DEV(bdf), PCI_FUNC(bdf));
|
||||
dev_seq(bus), bus->name, PCI_DEV(bdf), PCI_FUNC(bdf));
|
||||
pci_bus_read_config(bus, bdf, PCI_DEVICE_ID, &device,
|
||||
PCI_SIZE_16);
|
||||
pci_bus_read_config(bus, bdf, PCI_CLASS_REVISION, &class,
|
||||
|
@ -1009,11 +1002,26 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
|
|||
static int pci_uclass_pre_probe(struct udevice *bus)
|
||||
{
|
||||
struct pci_controller *hose;
|
||||
struct uclass *uc;
|
||||
int ret;
|
||||
|
||||
debug("%s, bus=%d/%s, parent=%s\n", __func__, bus->seq, bus->name,
|
||||
debug("%s, bus=%d/%s, parent=%s\n", __func__, dev_seq(bus), bus->name,
|
||||
bus->parent->name);
|
||||
hose = bus->uclass_priv;
|
||||
|
||||
/*
|
||||
* Set the sequence number, if device_bind() doesn't. We want control
|
||||
* of this so that numbers are allocated as devices are probed. That
|
||||
* ensures that sub-bus numbered is correct (sub-buses must get numbers
|
||||
* higher than their parents)
|
||||
*/
|
||||
if (dev_seq(bus) == -1) {
|
||||
ret = uclass_get(UCLASS_PCI, &uc);
|
||||
if (ret)
|
||||
return ret;
|
||||
bus->sqq = uclass_find_next_free_seq(uc);
|
||||
}
|
||||
|
||||
/* For bridges, use the top-level PCI controller */
|
||||
if (!device_is_on_pci_bus(bus)) {
|
||||
hose->ctlr = bus;
|
||||
|
@ -1024,9 +1032,10 @@ static int pci_uclass_pre_probe(struct udevice *bus)
|
|||
parent_hose = dev_get_uclass_priv(bus->parent);
|
||||
hose->ctlr = parent_hose->bus;
|
||||
}
|
||||
|
||||
hose->bus = bus;
|
||||
hose->first_busno = bus->seq;
|
||||
hose->last_busno = bus->seq;
|
||||
hose->first_busno = dev_seq(bus);
|
||||
hose->last_busno = dev_seq(bus);
|
||||
if (dev_of_valid(bus)) {
|
||||
hose->skip_auto_config_until_reloc =
|
||||
dev_read_bool(bus,
|
||||
|
@ -1041,17 +1050,17 @@ static int pci_uclass_post_probe(struct udevice *bus)
|
|||
struct pci_controller *hose = dev_get_uclass_priv(bus);
|
||||
int ret;
|
||||
|
||||
debug("%s: probing bus %d\n", __func__, bus->seq);
|
||||
debug("%s: probing bus %d\n", __func__, dev_seq(bus));
|
||||
ret = pci_bind_bus_devices(bus);
|
||||
if (ret)
|
||||
return ret;
|
||||
return log_msg_ret("bind", ret);
|
||||
|
||||
if (CONFIG_IS_ENABLED(PCI_PNP) && ll_boot_init() &&
|
||||
(!hose->skip_auto_config_until_reloc ||
|
||||
(gd->flags & GD_FLG_RELOC))) {
|
||||
ret = pci_auto_config_devices(bus);
|
||||
if (ret < 0)
|
||||
return log_msg_ret("pci auto-config", ret);
|
||||
return log_msg_ret("cfg", ret);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
|
||||
|
@ -1068,10 +1077,10 @@ static int pci_uclass_post_probe(struct udevice *bus)
|
|||
* Note we only call this 1) after U-Boot is relocated, and 2)
|
||||
* root bus has finished probing.
|
||||
*/
|
||||
if ((gd->flags & GD_FLG_RELOC) && bus->seq == 0 && ll_boot_init()) {
|
||||
if ((gd->flags & GD_FLG_RELOC) && dev_seq(bus) == 0 && ll_boot_init()) {
|
||||
ret = fsp_init_phase_pci();
|
||||
if (ret)
|
||||
return ret;
|
||||
return log_msg_ret("fsp", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1732,7 +1741,7 @@ int pci_sriov_init(struct udevice *pdev, int vf_en)
|
|||
&class, PCI_SIZE_16);
|
||||
|
||||
debug("%s: bus %d/%s: found VF %x:%x\n", __func__,
|
||||
bus->seq, bus->name, PCI_DEV(bdf), PCI_FUNC(bdf));
|
||||
dev_seq(bus), bus->name, PCI_DEV(bdf), PCI_FUNC(bdf));
|
||||
|
||||
/* Find this device in the device tree */
|
||||
ret = pci_bus_find_devfn(bus, PCI_MASK_BUS(bdf), &dev);
|
||||
|
@ -1763,7 +1772,7 @@ int pci_sriov_init(struct udevice *pdev, int vf_en)
|
|||
pplat->virtid = vf * vf_stride + vf_offset;
|
||||
|
||||
debug("%s: bus %d/%s: found VF %x:%x %x:%x class %lx id %x\n",
|
||||
__func__, dev->seq, dev->name, PCI_DEV(bdf),
|
||||
__func__, dev_seq(dev), dev->name, PCI_DEV(bdf),
|
||||
PCI_FUNC(bdf), vendor, device, class, pplat->virtid);
|
||||
bdf += PCI_BDF(0, 0, vf_stride);
|
||||
}
|
||||
|
@ -1791,7 +1800,7 @@ int pci_sriov_get_totalvfs(struct udevice *pdev)
|
|||
UCLASS_DRIVER(pci) = {
|
||||
.id = UCLASS_PCI,
|
||||
.name = "pci",
|
||||
.flags = DM_UC_FLAG_SEQ_ALIAS,
|
||||
.flags = DM_UC_FLAG_SEQ_ALIAS | DM_UC_FLAG_NO_AUTO_SEQ,
|
||||
.post_bind = dm_scan_fdt_dev,
|
||||
.pre_probe = pci_uclass_pre_probe,
|
||||
.post_probe = pci_uclass_post_probe,
|
||||
|
|
|
@ -189,8 +189,8 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus)
|
|||
|
||||
/* Configure bus number registers */
|
||||
dm_pci_write_config8(dev, PCI_PRIMARY_BUS,
|
||||
PCI_BUS(dm_pci_get_bdf(dev)) - ctlr->seq);
|
||||
dm_pci_write_config8(dev, PCI_SECONDARY_BUS, sub_bus - ctlr->seq);
|
||||
PCI_BUS(dm_pci_get_bdf(dev)) - dev_seq(ctlr));
|
||||
dm_pci_write_config8(dev, PCI_SECONDARY_BUS, sub_bus - dev_seq(ctlr));
|
||||
dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, 0xff);
|
||||
|
||||
if (pci_mem) {
|
||||
|
@ -265,7 +265,7 @@ void dm_pciauto_postscan_setup_bridge(struct udevice *dev, int sub_bus)
|
|||
pci_io = ctlr_hose->pci_io;
|
||||
|
||||
/* Configure bus number registers */
|
||||
dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, sub_bus - ctlr->seq);
|
||||
dm_pci_write_config8(dev, PCI_SUBORDINATE_BUS, sub_bus - dev_seq(ctlr));
|
||||
|
||||
if (pci_mem) {
|
||||
/* Round memory allocator to 1MB boundary */
|
||||
|
@ -321,7 +321,7 @@ int dm_pciauto_config_device(struct udevice *dev)
|
|||
bool enum_only = false;
|
||||
struct udevice *ctlr = pci_get_controller(dev);
|
||||
struct pci_controller *ctlr_hose = dev_get_uclass_priv(ctlr);
|
||||
int n;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_PCI_ENUM_ONLY
|
||||
enum_only = true;
|
||||
|
@ -341,10 +341,10 @@ int dm_pciauto_config_device(struct udevice *dev)
|
|||
dm_pciauto_setup_device(dev, 2, pci_mem, pci_prefetch, pci_io,
|
||||
enum_only);
|
||||
|
||||
n = dm_pci_hose_probe_bus(dev);
|
||||
if (n < 0)
|
||||
return n;
|
||||
sub_bus = (unsigned int)n;
|
||||
ret = dm_pci_hose_probe_bus(dev);
|
||||
if (ret < 0)
|
||||
return log_msg_ret("probe", ret);
|
||||
sub_bus = ret;
|
||||
break;
|
||||
|
||||
case PCI_CLASS_BRIDGE_CARDBUS:
|
||||
|
|
|
@ -500,13 +500,13 @@ static int pcie_dw_mvebu_probe(struct udevice *dev)
|
|||
debug("PCIE Reset on GPIO support is missing\n");
|
||||
#endif /* DM_GPIO */
|
||||
|
||||
pcie->first_busno = dev->seq;
|
||||
pcie->first_busno = dev_seq(dev);
|
||||
|
||||
/* Don't register host if link is down */
|
||||
if (!pcie_dw_mvebu_pcie_link_up(pcie->ctrl_base, LINK_SPEED_GEN_3)) {
|
||||
printf("PCIE-%d: Link down\n", dev->seq);
|
||||
printf("PCIE-%d: Link down\n", dev_seq(dev));
|
||||
} else {
|
||||
printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev->seq,
|
||||
printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev_seq(dev),
|
||||
pcie_dw_get_link_speed(pcie->ctrl_base),
|
||||
pcie_dw_get_link_width(pcie->ctrl_base),
|
||||
hose->first_busno);
|
||||
|
|
|
@ -634,7 +634,7 @@ static int pcie_dw_ti_probe(struct udevice *dev)
|
|||
generic_phy_init(&phy1);
|
||||
generic_phy_power_on(&phy1);
|
||||
|
||||
pci->first_busno = dev->seq;
|
||||
pci->first_busno = dev_seq(dev);
|
||||
pci->dev = dev;
|
||||
|
||||
pcie_dw_setup_host(pci);
|
||||
|
@ -644,11 +644,11 @@ static int pcie_dw_ti_probe(struct udevice *dev)
|
|||
pcie_am654_set_mode(pci, DW_PCIE_RC_TYPE);
|
||||
|
||||
if (!pcie_dw_ti_pcie_link_up(pci, LINK_SPEED_GEN_2)) {
|
||||
printf("PCIE-%d: Link down\n", dev->seq);
|
||||
printf("PCIE-%d: Link down\n", dev_seq(dev));
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev->seq,
|
||||
printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev_seq(dev),
|
||||
pcie_dw_get_link_speed(pci),
|
||||
pcie_dw_get_link_width(pci),
|
||||
hose->first_busno);
|
||||
|
|
|
@ -146,7 +146,7 @@ static int pci_generic_ecam_probe(struct udevice *dev)
|
|||
{
|
||||
struct generic_ecam_pcie *pcie = dev_get_priv(dev);
|
||||
|
||||
pcie->first_busno = dev->seq;
|
||||
pcie->first_busno = dev_seq(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,16 +29,16 @@ static int fsl_pcie_addr_valid(struct fsl_pcie *pcie, pci_dev_t bdf)
|
|||
if (!pcie->enabled)
|
||||
return -ENXIO;
|
||||
|
||||
if (PCI_BUS(bdf) < bus->seq)
|
||||
if (PCI_BUS(bdf) < dev_seq(bus))
|
||||
return -EINVAL;
|
||||
|
||||
if (PCI_BUS(bdf) > bus->seq && (!fsl_pcie_link_up(pcie) || pcie->mode))
|
||||
if (PCI_BUS(bdf) > dev_seq(bus) && (!fsl_pcie_link_up(pcie) || pcie->mode))
|
||||
return -EINVAL;
|
||||
|
||||
if (PCI_BUS(bdf) == bus->seq && (PCI_DEV(bdf) > 0 || PCI_FUNC(bdf) > 0))
|
||||
if (PCI_BUS(bdf) == dev_seq(bus) && (PCI_DEV(bdf) > 0 || PCI_FUNC(bdf) > 0))
|
||||
return -EINVAL;
|
||||
|
||||
if (PCI_BUS(bdf) == (bus->seq + 1) && (PCI_DEV(bdf) > 0))
|
||||
if (PCI_BUS(bdf) == (dev_seq(bus) + 1) && (PCI_DEV(bdf) > 0))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
@ -57,7 +57,7 @@ static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
|
|||
return 0;
|
||||
}
|
||||
|
||||
bdf = bdf - PCI_BDF(bus->seq, 0, 0);
|
||||
bdf = bdf - PCI_BDF(dev_seq(bus), 0, 0);
|
||||
val = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000;
|
||||
out_be32(®s->cfg_addr, val);
|
||||
|
||||
|
@ -93,7 +93,7 @@ static int fsl_pcie_write_config(struct udevice *bus, pci_dev_t bdf,
|
|||
if (fsl_pcie_addr_valid(pcie, bdf))
|
||||
return 0;
|
||||
|
||||
bdf = bdf - PCI_BDF(bus->seq, 0, 0);
|
||||
bdf = bdf - PCI_BDF(dev_seq(bus), 0, 0);
|
||||
val = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000;
|
||||
out_be32(®s->cfg_addr, val);
|
||||
|
||||
|
@ -123,7 +123,7 @@ static int fsl_pcie_hose_read_config(struct fsl_pcie *pcie, uint offset,
|
|||
int ret;
|
||||
struct udevice *bus = pcie->bus;
|
||||
|
||||
ret = fsl_pcie_read_config(bus, PCI_BDF(bus->seq, 0, 0),
|
||||
ret = fsl_pcie_read_config(bus, PCI_BDF(dev_seq(bus), 0, 0),
|
||||
offset, valuep, size);
|
||||
|
||||
return ret;
|
||||
|
@ -134,7 +134,7 @@ static int fsl_pcie_hose_write_config(struct fsl_pcie *pcie, uint offset,
|
|||
{
|
||||
struct udevice *bus = pcie->bus;
|
||||
|
||||
return fsl_pcie_write_config(bus, PCI_BDF(bus->seq, 0, 0),
|
||||
return fsl_pcie_write_config(bus, PCI_BDF(dev_seq(bus), 0, 0),
|
||||
offset, value, size);
|
||||
}
|
||||
|
||||
|
|
|
@ -369,7 +369,7 @@ static int pcie_intel_fpga_probe(struct udevice *dev)
|
|||
struct intel_fpga_pcie *pcie = dev_get_priv(dev);
|
||||
|
||||
pcie->bus = pci_get_controller(dev);
|
||||
pcie->first_busno = dev->seq;
|
||||
pcie->first_busno = dev_seq(dev);
|
||||
|
||||
/* clear all interrupts */
|
||||
cra_writel(pcie, P2A_INT_STS_ALL, P2A_INT_STATUS);
|
||||
|
|
|
@ -479,7 +479,7 @@ static int fdt_fixup_pci_vfs(void *blob, struct extra_iommu_entry *entry,
|
|||
for (bus = dev; device_is_on_pci_bus(bus);)
|
||||
bus = bus->parent;
|
||||
|
||||
bdf = entry->bdf - PCI_BDF(bus->seq, 0, 0) + (vf_offset << 8);
|
||||
bdf = entry->bdf - PCI_BDF(dev_seq(bus), 0, 0) + (vf_offset << 8);
|
||||
|
||||
for (i = 0; i < entry->num_vfs; i++) {
|
||||
if (fdt_fixup_pcie_device_ls(blob, bdf, pcie_rc) < 0)
|
||||
|
@ -518,7 +518,7 @@ static void fdt_fixup_pcie_ls(void *blob)
|
|||
pcie_rc = dev_get_priv(bus);
|
||||
|
||||
/* the DT fixup must be relative to the hose first_busno */
|
||||
bdf = dm_pci_get_bdf(dev) - PCI_BDF(bus->seq, 0, 0);
|
||||
bdf = dm_pci_get_bdf(dev) - PCI_BDF(dev_seq(bus), 0, 0);
|
||||
|
||||
if (fdt_fixup_pcie_device_ls(blob, bdf, pcie_rc) < 0)
|
||||
break;
|
||||
|
|
|
@ -191,13 +191,13 @@ static int ls_pcie_g4_addr_valid(struct ls_pcie_g4 *pcie, pci_dev_t bdf)
|
|||
if (!pcie->enabled)
|
||||
return -ENXIO;
|
||||
|
||||
if (PCI_BUS(bdf) < bus->seq)
|
||||
if (PCI_BUS(bdf) < dev_seq(bus))
|
||||
return -EINVAL;
|
||||
|
||||
if ((PCI_BUS(bdf) > bus->seq) && (!ls_pcie_g4_link_up(pcie)))
|
||||
if ((PCI_BUS(bdf) > dev_seq(bus)) && (!ls_pcie_g4_link_up(pcie)))
|
||||
return -EINVAL;
|
||||
|
||||
if (PCI_BUS(bdf) <= (bus->seq + 1) && (PCI_DEV(bdf) > 0))
|
||||
if (PCI_BUS(bdf) <= (dev_seq(bus) + 1) && (PCI_DEV(bdf) > 0))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
@ -209,7 +209,7 @@ void *ls_pcie_g4_conf_address(struct ls_pcie_g4 *pcie, pci_dev_t bdf,
|
|||
struct udevice *bus = pcie->bus;
|
||||
u32 target;
|
||||
|
||||
if (PCI_BUS(bdf) == bus->seq) {
|
||||
if (PCI_BUS(bdf) == dev_seq(bus)) {
|
||||
if (offset < INDIRECT_ADDR_BNDRY) {
|
||||
ccsr_set_page(pcie, 0);
|
||||
return pcie->ccsr + offset;
|
||||
|
@ -219,7 +219,7 @@ void *ls_pcie_g4_conf_address(struct ls_pcie_g4 *pcie, pci_dev_t bdf,
|
|||
return pcie->ccsr + OFFSET_TO_PAGE_ADDR(offset);
|
||||
}
|
||||
|
||||
target = PAB_TARGET_BUS(PCI_BUS(bdf) - bus->seq) |
|
||||
target = PAB_TARGET_BUS(PCI_BUS(bdf) - dev_seq(bus)) |
|
||||
PAB_TARGET_DEV(PCI_DEV(bdf)) |
|
||||
PAB_TARGET_FUNC(PCI_FUNC(bdf));
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ static void fdt_fixup_pcie_ls_gen4(void *blob)
|
|||
}
|
||||
|
||||
/* the DT fixup must be relative to the hose first_busno */
|
||||
bdf = dm_pci_get_bdf(dev) - PCI_BDF(bus->seq, 0, 0);
|
||||
bdf = dm_pci_get_bdf(dev) - PCI_BDF(dev_seq(bus), 0, 0);
|
||||
/* map PCI b.d.f to streamID in LUT */
|
||||
ls_pcie_g4_lut_set_mapping(pcie, index, bdf >> 8, streamid);
|
||||
/* update msi-map in device tree */
|
||||
|
|
|
@ -130,13 +130,13 @@ static int ls_pcie_addr_valid(struct ls_pcie_rc *pcie_rc, pci_dev_t bdf)
|
|||
if (!pcie_rc->enabled)
|
||||
return -ENXIO;
|
||||
|
||||
if (PCI_BUS(bdf) < bus->seq)
|
||||
if (PCI_BUS(bdf) < dev_seq(bus))
|
||||
return -EINVAL;
|
||||
|
||||
if ((PCI_BUS(bdf) > bus->seq) && (!ls_pcie_link_up(pcie)))
|
||||
if ((PCI_BUS(bdf) > dev_seq(bus)) && (!ls_pcie_link_up(pcie)))
|
||||
return -EINVAL;
|
||||
|
||||
if (PCI_BUS(bdf) <= (bus->seq + 1) && (PCI_DEV(bdf) > 0))
|
||||
if (PCI_BUS(bdf) <= (dev_seq(bus) + 1) && (PCI_DEV(bdf) > 0))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
|
@ -152,16 +152,16 @@ int ls_pcie_conf_address(const struct udevice *bus, pci_dev_t bdf,
|
|||
if (ls_pcie_addr_valid(pcie_rc, bdf))
|
||||
return -EINVAL;
|
||||
|
||||
if (PCI_BUS(bdf) == bus->seq) {
|
||||
if (PCI_BUS(bdf) == dev_seq(bus)) {
|
||||
*paddress = pcie->dbi + offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
busdev = PCIE_ATU_BUS(PCI_BUS(bdf) - bus->seq) |
|
||||
busdev = PCIE_ATU_BUS(PCI_BUS(bdf) - dev_seq(bus)) |
|
||||
PCIE_ATU_DEV(PCI_DEV(bdf)) |
|
||||
PCIE_ATU_FUNC(PCI_FUNC(bdf));
|
||||
|
||||
if (PCI_BUS(bdf) == bus->seq + 1) {
|
||||
if (PCI_BUS(bdf) == dev_seq(bus) + 1) {
|
||||
ls_pcie_cfg0_set_busdev(pcie_rc, busdev);
|
||||
*paddress = pcie_rc->cfg0 + offset;
|
||||
} else {
|
||||
|
|
|
@ -261,7 +261,7 @@ static struct mtk_pcie_port *mtk_pcie_find_port(const struct udevice *bus,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
while (dev->parent->seq != 0)
|
||||
while (dev_seq(dev->parent) != 0)
|
||||
dev = dev->parent;
|
||||
|
||||
pplat = dev_get_parent_plat(dev);
|
||||
|
|
|
@ -373,7 +373,7 @@ static int rockchip_pcie_init_port(struct udevice *dev)
|
|||
/* Configure Address Translation. */
|
||||
ret = rockchip_pcie_atr_init(priv);
|
||||
if (ret) {
|
||||
dev_err(dev, "PCIE-%d: ATR init failed\n", dev->seq);
|
||||
dev_err(dev, "PCIE-%d: ATR init failed\n", dev_seq(dev));
|
||||
goto err_power_off_phy;
|
||||
}
|
||||
|
||||
|
@ -528,7 +528,7 @@ static int rockchip_pcie_probe(struct udevice *dev)
|
|||
struct pci_controller *hose = dev_get_uclass_priv(ctlr);
|
||||
int ret;
|
||||
|
||||
priv->first_busno = dev->seq;
|
||||
priv->first_busno = dev_seq(dev);
|
||||
priv->dev = dev;
|
||||
|
||||
ret = rockchip_pcie_parse_dt(dev);
|
||||
|
@ -544,7 +544,7 @@ static int rockchip_pcie_probe(struct udevice *dev)
|
|||
return ret;
|
||||
|
||||
dev_info(dev, "PCIE-%d: Link up (Bus%d)\n",
|
||||
dev->seq, hose->first_busno);
|
||||
dev_seq(dev), hose->first_busno);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ int exynos_pinctrl_probe(struct udevice *dev)
|
|||
|
||||
priv->base = base;
|
||||
priv->pin_ctrl = (struct samsung_pin_ctrl *)dev_get_driver_data(dev) +
|
||||
dev->req_seq;
|
||||
dev_seq(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ static int coldfire_serial_probe(struct udevice *dev)
|
|||
{
|
||||
struct coldfire_serial_plat *plat = dev->plat;
|
||||
|
||||
plat->port = dev->seq;
|
||||
plat->port = dev_seq(dev);
|
||||
|
||||
return mcf_serial_init_common((uart_t *)plat->base,
|
||||
plat->port, plat->baudrate);
|
||||
|
|
|
@ -187,7 +187,7 @@ static int s5p_serial_of_to_plat(struct udevice *dev)
|
|||
|
||||
plat->reg = (struct s5p_uart *)addr;
|
||||
plat->port_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
|
||||
"id", dev->seq);
|
||||
"id", dev_seq(dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user