Skip to content
Snippets Groups Projects
Commit 5ec741fd authored by Simon Glass's avatar Simon Glass
Browse files

dtoc: Handle 'reg' properties with unusual sizes


At present dtoc assumes that all 'reg' properties have both an address and
a size. For I2C devices we do not have this. Adjust dtoc to cope.

Reported-by: default avatarPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Tested-by: default avatarKever Yang <kever.yang@rock-chips.com>
parent c20ee0ed
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
/dts-v1/; /dts-v1/;
/ { / {
#address-cells = <1>;
#size-cells = <1>;
spl-test { spl-test {
u-boot,dm-pre-reloc; u-boot,dm-pre-reloc;
compatible = "sandbox,spl-test"; compatible = "sandbox,spl-test";
...@@ -45,4 +47,16 @@ ...@@ -45,4 +47,16 @@
compatible = "sandbox,spl-test.2"; compatible = "sandbox,spl-test.2";
}; };
i2c@0 {
compatible = "sandbox,i2c-test";
u-boot,dm-pre-reloc;
#address-cells = <1>;
#size-cells = <0>;
pmic@9 {
compatible = "sandbox,pmic-test";
u-boot,dm-pre-reloc;
reg = <9>;
low-power;
};
};
}; };
...@@ -121,6 +121,12 @@ class TestDtoc(unittest.TestCase): ...@@ -121,6 +121,12 @@ class TestDtoc(unittest.TestCase):
data = infile.read() data = infile.read()
self.assertEqual('''#include <stdbool.h> self.assertEqual('''#include <stdbool.h>
#include <libfdt.h> #include <libfdt.h>
struct dtd_sandbox_i2c_test {
};
struct dtd_sandbox_pmic_test {
\tbool\t\tlow_power;
\tfdt64_t\t\treg[2];
};
struct dtd_sandbox_spl_test { struct dtd_sandbox_spl_test {
\tbool\t\tboolval; \tbool\t\tboolval;
\tunsigned char\tbytearray[3]; \tunsigned char\tbytearray[3];
...@@ -192,6 +198,24 @@ U_BOOT_DEVICE(spl_test4) = { ...@@ -192,6 +198,24 @@ U_BOOT_DEVICE(spl_test4) = {
\t.platdata_size\t= sizeof(dtv_spl_test4), \t.platdata_size\t= sizeof(dtv_spl_test4),
}; };
static struct dtd_sandbox_i2c_test dtv_i2c_at_0 = {
};
U_BOOT_DEVICE(i2c_at_0) = {
\t.name\t\t= "sandbox_i2c_test",
\t.platdata\t= &dtv_i2c_at_0,
\t.platdata_size\t= sizeof(dtv_i2c_at_0),
};
static struct dtd_sandbox_pmic_test dtv_pmic_at_9 = {
\t.low_power\t\t= true,
\t.reg\t\t\t= {0x9, 0x0},
};
U_BOOT_DEVICE(pmic_at_9) = {
\t.name\t\t= "sandbox_pmic_test",
\t.platdata\t= &dtv_pmic_at_9,
\t.platdata_size\t= sizeof(dtv_pmic_at_9),
};
''', data) ''', data)
def test_phandle(self): def test_phandle(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment