[U-Boot] [RFC PATCH v2 2/6] fdt: Add support for embedded device tree (CONFIG_OF_EMBED)
Jason
u-boot at lakedaemon.net
Wed Sep 14 21:50:39 CEST 2011
Simon,
On Wed, Sep 14, 2011 at 10:45:59AM -0700, Simon Glass wrote:
> On Wed, Sep 14, 2011 at 9:11 AM, Jason <u-boot at lakedaemon.net> wrote:
> > On Wed, Sep 14, 2011 at 08:47:25AM -0700, Simon Glass wrote:
> >> On Wed, Sep 14, 2011 at 6:47 AM, Jason <u-boot at lakedaemon.net> wrote:
> >> > On Tue, Sep 13, 2011 at 02:06:56PM -0700, Simon Glass wrote:
> >> >> On Tue, Sep 13, 2011 at 7:37 AM, Jason <u-boot at lakedaemon.net> wrote:
> >> >> > Added the remote, thanks. Once we figure out the mach-types thing, I'll
> >> >> > try using the Marvell integrated RTC driver as a real-world example of a
> >> >> > conversion to fdt. I'll probably have questions ;-)
> >> >>
> >> >> That sounds great. I've tried to make it fair straightforward - with
> >> >> an option for building an fdt into U-Boot itself (i.e. don't define
> >> >> CONFIG_OF_SEPARATE). This should allow you to use your current dev
> >> >> flow.
> >> >
> >> > Okay, I have an initial version that compiles, but doesn't work. Which,
> >> > surprisingly, is progress. ;-) I'll post the patch a little bit later
> >> > after I make sure I'm not missing something dumb.
> >>
> >> A few hints:
> >>
> >> - define CONFIG_OF_EMBED to start with, since it will embed the fdt
> >> inside U-Boot which is a good check that all is well. You can move to
> >> the more useful CONFIG_OF_SEPARATE when you get that working
> >> - there is a check in board.c that the fdt is accessible - if it is
> >> dying early then it might be that (early board panic patch is still in
> >> flight)
> >
> > Frustrating morning. Mainly due to the fact that I've been working with
> > device trees all of two days.
> >
> > Here's what I did:
> > 1.) applied your patches against v2011.09-rc1 (to get mvrtc.c)
> > 2.) applied my dreamplug support patch
> > 3.) modified drivers/rtc/mvrtc.c for OF support
> > 4.) compile
> > 5.) run, then 'date' fails like so:
> >
> > find_alias_node: rtc0
> > fdt_decode_next_alias failed.
> > Error decoding fdt for mvrtc.
> > ## Get date failed
>
> I don't actually see an alias in your fdt. And actually I left it out
> of mine, so that is understandable. For i2c I have:
>
> ...
> aliases {
> i2c0 = "/i2c at 0x7000d000";
> i2c1 = "/i2c at 0x7000c000";
> i2c2 = "/i2c at 0x7000c400";
> i2c3 = "/i2c at 0x7000c500";
> };
That worked!
Marvell>> date
find_alias_node: rtc0
Date: 2011-09-14 (Wednesday) Time: 14:04:54
Marvell>>
> So I think you need to add a /alias node and try again. I can submit a
> new patch set with this and a couple of other things I want to change,
> but it would be good if you can get to the end first, in case you find
> other problems.
I'll clean up what I have and post it RFC.
> >
> > Obviously, I've hacked it up abit to get more error reporting out.
> > Here's my kirkwood-dreamplug.dts:
> >
> > ##### kirkwood-dreamplug.dts ####
> > /dts-v1/;
> >
> > /include/ "kirkwood.dtsi"
> >
> > / {
> > model = "Marvell Dreamplug";
> > compatible = "marvell,dreamplug", "marvell,kirkwood";
> >
> > rtc at 0xf1010300 {
> > status = "ok";
> > };
> > };
> > #################################
> >
> > And the kirkwood.dtsi
> >
> > #### kirkwood.dtsi ####
> > / {
> > model = "Marvell Kirkwood";
> > compatible = "marvell,kirkwood";
> > #address-cells = <1>;
> > #size-cells = <1>;
> >
> > cpus {
> > #address-cells = <1>;
> > #size-cells = <0>;
> > cpu at 0 {
> > compatible = "arm,arm926ejs";
> > reg = <0>;
> > };
> > };
> >
> > rtc at 0xf1010300 {
> > compatible = "marvell,kirkwood-rtc";
> > reg = <0xf1010300 0x02>;
> > status = "disabled";
> > };
> > };
> > #######################
> >
> > I'd like to make sure my dts files are correct before I get to debugging
> > code. ;-)
> >
> > A few notes:
> >
> > If I compile with '#define DEBUG' in my board config, it builds, but
> > doesn't run, or at least, there's no output on the serial port.
>
> That's because you are getting output prior to relocation. Graeme has
> a patch for that, and I also sent a patch for pre-console panic (which
> I will update once his patch goes in).
Okay, since I now have some success, I can build off of that. I'll just
work without debug for now.
> > I had the remove your fdt_decode_i2c() and clock.h include. The clock.h
> > include seems to be specific to the tegra2 and doesn't exist for
> > kirkwood.
>
> Yes that's right, it is just an example at this stage, and the idea of
> a periph_id is specific to Tegra at present. Patches 5 and 6 are just
> an example to show how to use it in code.
Ok, I'll drop those from my branch to make a cleaner example.
thx,
Jason.
More information about the U-Boot
mailing list