aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-06-06 13:00:23 -0400
committerTom Rini <trini@konsulko.com>2021-06-06 13:00:23 -0400
commit281e95c40f2c12e0265b978d735a6b4990183bcd (patch)
treebde4f4a865d303e8affe24ad4b5e544e097574d8
parent0c4e63a48771e2dad3ca13400092f066cab61de1 (diff)
parent269fa8468df40952d538ac945db3d98a8d44f79e (diff)
downloadu-boot-WIP/06Jun2021.zip
u-boot-WIP/06Jun2021.tar.gz
u-boot-WIP/06Jun2021.tar.bz2
Merge tag 'dm-pull-6jun21' of https://source.denx.de/u-boot/custodians/u-boot-dmWIP/06Jun2021
Minor fixes for sandbox and handling of dm-ranges
-rw-r--r--arch/sandbox/cpu/start.c5
-rw-r--r--drivers/core/of_addr.c12
-rw-r--r--drivers/net/mscc_eswitch/luton_switch.c5
-rw-r--r--drivers/pwm/cros_ec_pwm.c2
-rw-r--r--test/dm/test-fdt.c33
5 files changed, 44 insertions, 13 deletions
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 63ca514..6bb9447 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -436,10 +436,13 @@ void sandbox_reset(void)
int main(int argc, char *argv[])
{
struct sandbox_state *state;
+ void * text_base;
gd_t data;
int size;
int ret;
+ text_base = os_find_text_base();
+
/*
* Copy argv[] so that we can pass the arguments in the original
* sequence when resetting the sandbox.
@@ -452,7 +455,7 @@ int main(int argc, char *argv[])
memset(&data, '\0', sizeof(data));
gd = &data;
- gd->arch.text_base = os_find_text_base();
+ gd->arch.text_base = text_base;
ret = state_init();
if (ret)
diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c
index 9b77308..3fbc0a7 100644
--- a/drivers/core/of_addr.c
+++ b/drivers/core/of_addr.c
@@ -118,11 +118,6 @@ static struct of_bus *of_match_bus(struct device_node *np)
return NULL;
}
-static void dev_count_cells(const struct device_node *np, int *nap, int *nsp)
-{
- of_bus_default_count_cells(np, nap, nsp);
-}
-
const __be32 *of_get_address(const struct device_node *dev, int index,
u64 *size, unsigned int *flags)
{
@@ -136,7 +131,6 @@ const __be32 *of_get_address(const struct device_node *dev, int index,
parent = of_get_parent(dev);
if (parent == NULL)
return NULL;
- dev_count_cells(dev, &na, &ns);
bus = of_match_bus(parent);
bus->count_cells(dev, &na, &ns);
of_node_put(parent);
@@ -192,9 +186,13 @@ static int of_translate_one(const struct device_node *parent,
*
* As far as we know, this damage only exists on Apple machines, so
* This code is only enabled on powerpc. --gcl
+ *
+ * This quirk also applies for 'dma-ranges' which frequently exist in
+ * child nodes without 'dma-ranges' in the parent nodes. --RobH
*/
ranges = of_get_property(parent, rprop, &rlen);
- if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
+ if (ranges == NULL && !of_empty_ranges_quirk(parent) &&
+ strcmp(rprop, "dma-ranges")) {
debug("no ranges; cannot translate\n");
return 1;
}
diff --git a/drivers/net/mscc_eswitch/luton_switch.c b/drivers/net/mscc_eswitch/luton_switch.c
index 54afa14..73c950d 100644
--- a/drivers/net/mscc_eswitch/luton_switch.c
+++ b/drivers/net/mscc_eswitch/luton_switch.c
@@ -588,7 +588,6 @@ static int luton_probe(struct udevice *dev)
struct luton_private *priv = dev_get_priv(dev);
int i, ret;
struct resource res;
- fdt32_t faddr;
phys_addr_t addr_base;
unsigned long addr_size;
ofnode eth_node, node, mdio_node;
@@ -658,9 +657,7 @@ static int luton_probe(struct udevice *dev)
if (ofnode_read_resource(mdio_node, 0, &res))
return -ENOMEM;
- faddr = cpu_to_fdt32(res.start);
-
- addr_base = ofnode_translate_address(mdio_node, &faddr);
+ addr_base = res.start;
addr_size = res.end - res.start;
/* If the bus is new then create a new bus */
diff --git a/drivers/pwm/cros_ec_pwm.c b/drivers/pwm/cros_ec_pwm.c
index 44f4105..4a39c31 100644
--- a/drivers/pwm/cros_ec_pwm.c
+++ b/drivers/pwm/cros_ec_pwm.c
@@ -80,5 +80,5 @@ U_BOOT_DRIVER(cros_ec_pwm) = {
.id = UCLASS_PWM,
.of_match = cros_ec_pwm_ids,
.ops = &cros_ec_pwm_ops,
- .priv_auto_alloc_size = sizeof(struct cros_ec_pwm_priv),
+ .priv_auto = sizeof(struct cros_ec_pwm_priv),
};
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 9b771fd..d273e21 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -19,6 +19,7 @@
#include <dm/util.h>
#include <dm/lists.h>
#include <dm/of_access.h>
+#include <linux/ioport.h>
#include <test/test.h>
#include <test/ut.h>
@@ -1165,3 +1166,35 @@ static int dm_test_decode_display_timing(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_decode_display_timing, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
+
+/* Test read_resourcee() */
+static int dm_test_read_resource(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ struct resource res;
+
+ /* test resource without translation */
+ ut_assertok(uclass_find_device_by_name(UCLASS_SIMPLE_BUS, "syscon@2", &dev));
+ ut_assertok(dev_read_resource(dev, 0, &res));
+ ut_asserteq(0x40, res.start);
+ ut_asserteq(0x44, res.end);
+ ut_assertok(dev_read_resource(dev, 1, &res));
+ ut_asserteq(0x48, res.start);
+ ut_asserteq(0x4d, res.end);
+
+ /* test resource with translation */
+ ut_assertok(uclass_find_device_by_name(UCLASS_TEST_DUMMY, "dev@1,100", &dev));
+ ut_assertok(dev_read_resource(dev, 0, &res));
+ ut_asserteq(0x9000, res.start);
+ ut_asserteq(0x9fff, res.end);
+
+ /* test named resource */
+ ut_assertok(uclass_find_device_by_name(UCLASS_TEST_DUMMY, "dev@0,0", &dev));
+ ut_assertok(dev_read_resource_byname(dev, "sandbox-dummy-0", &res));
+ ut_asserteq(0x8000, res.start);
+ ut_asserteq(0x8fff, res.end);
+
+ return 0;
+}
+
+DM_TEST(dm_test_read_resource, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);