public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <monstr@monstr.eu>
To: u-boot@lists.denx.de
Subject: [U-Boot] CONFIG_OF_EMBED/CONFIG_OF_SEPARATE and fdtcontroladdr
Date: Wed, 04 Jul 2012 08:43:26 +0200	[thread overview]
Message-ID: <4FF3E60E.90702@monstr.eu> (raw)

Hi Simon,

I have create another thread because this can be discuss separately.

In board file there is this code (We discussed fdtcontroladdr separately).

#ifdef CONFIG_OF_EMBED
	/* Get a pointer to the FDT */
	gd->fdt_blob = _binary_dt_dtb_start;
#elif defined CONFIG_OF_SEPARATE
	/* FDT is at end of image */
	gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE);
#endif
	/* Allow the early environment to override the fdt address */
	gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
						(uintptr_t)gd->fdt_blob);


Is there any reason to use CONFIG_ options here?
Because what I think will be the best is to remove CONFIG_ options and create
priorities and checking in at run time.

Priority should be:
1. variable
2. appended blob
3. compiled in blob

Because compiled in blob can be also used as safe blob for cases where fdtcontroladdr
points to nor flash which is broken. For this case current u-boot will fail because
fdt_prepare won't find out valid DTB.

Here is just skeleton to show you what design I would prefer.

int fdtdec_prepare_fdt(void *dtb)
{
         if (((uintptr_t)gd->fdt_blob & 3) || fdt_check_header(dtb)) {
                 return -1;
         }
         return 0;
}

void * fdt_addr = (void *)getenv_ulong("fdtcontroladdr", 16, (uintptr_t)gd->fdt_blob);
if(!fdt_prepare(fdt_addr)) {
	gd->fdt_blob = fdt_addr;
} else {
	fdt_addr = (void *)(_end_ofs + _TEXT_BASE);
	if(!fdt_prepare(fdt_addr)) {
		gd->fdt_blob = fdt_addr;
	} else {
		fdt_addr = _binary_dt_dtb_start; // FIXME special section for it
		if(!fdt_prepare(fdt_addr)) {
			gd->fdt_blob = fdt_addr;
		}
	}
}

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

             reply	other threads:[~2012-07-04  6:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04  6:43 Michal Simek [this message]
2012-07-19 20:19 ` [U-Boot] CONFIG_OF_EMBED/CONFIG_OF_SEPARATE and fdtcontroladdr Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF3E60E.90702@monstr.eu \
    --to=monstr@monstr.eu \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox