public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] cfi-flash: Add	CFG_FLASH_AUTOPROTECT_LIST
Date: Sat, 19 Apr 2008 16:50:32 +0200	[thread overview]
Message-ID: <200804191650.32303.matthias.fuchs@esd-electronics.com> (raw)
In-Reply-To: <200804191402.23386.sr@denx.de>

Hi Stefan,

I could also life with your approach, but it will add code
even to platforms that do not use the new option.

In this case I would prefer it against the weak implementation.

Matthias

On Saturday 19 April 2008 14:02:23 Stefan Roese wrote:
> Hi Matthias,
>
> On Saturday 19 April 2008, Matthias Fuchs wrote:
> > is it possible to use weak structures? Or do you mean
> > a weak function that initializes my autoprotect list?
> >
> > Please give me an idea and I will implement it.
>
> I don't know if it's possible to implement a weak structure, but I
> would prefer something like this instead of your original
> implementation (no #ifdef's in the code):
>
> struct apl_s {
> 	u32 start;
> 	u32 size;
> };
>
> #if !defined(CFG_FLASH_AUTOPROTECT_LIST)
> struct apl_s apl[] = { };
> #else
> struct apl_s apl[] = CFG_FLASH_AUTOPROTECT_LIST;
> #endif
>
> And then later in the code:
>
> +       for (i = 0; i < ARRAY_SIZE(apl); i++) {
> +               debug("autoprotecting from %08x to %08x\n",
> +                     apl[i].start, apl[i].start + apl[i].size - 1);
> +               flash_protect (FLAG_PROTECT_SET,
> +                              apl[i].start,
> +                              apl[i].start + apl[i].size - 1,
> +                              flash_get_info(apl[i].start));
> +       }
>
> What do you think?
>
> > Matthias
> >
> > On Friday 18 April 2008 18:01:57 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> > > > index e3cfb8a..68ab55f 100644
> > > > --- a/drivers/mtd/cfi_flash.c
> > > > +++ b/drivers/mtd/cfi_flash.c
> > > > @@ -1873,6 +1873,12 @@ unsigned long flash_init (void)
> > > >  {
> > > >  	unsigned long size = 0;
> > > >  	int i;
> > > > +#if defined(CFG_FLASH_AUTOPROTECT_LIST)
> > > > +	struct apl_s {
> > > > +		ulong start;
> > > > +		ulong size;
> > > > +	} apl[] = CFG_FLASH_AUTOPROTECT_LIST;
> > > > +#endif
> > >
> > > I think it will be better to create a weak structure.
> > >
> > > Best Regards,
> > > J.
> >
> > !DSPAM:4809d80874783629025813!



-- 
-------------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs
Head of System Design

esd electronic system design gmbh
Vahrenwalder Str. 207 - 30165 Hannover - GERMANY
Phone: +49-511-37298-0 - Fax: +49-511-37298-68
Please visit our homepage http://www.esd.eu
Quality Products - Made in Germany
-------------------------------------------------------------------------
Gesch?ftsf?hrer: Klaus Detering, Dr. Werner Schulze
Amtsgericht Hannover HRB 51373 - VAT-ID DE 115672832
-------------------------------------------------------------------------

  reply	other threads:[~2008-04-19 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-18 14:29 [U-Boot-Users] [PATCH] cfi-flash: Add CFG_FLASH_AUTOPROTECT_LIST Matthias Fuchs
2008-04-18 16:01 ` Jean-Christophe PLAGNIOL-VILLARD
2008-04-19 11:30   ` Matthias Fuchs
2008-04-19 12:02     ` Stefan Roese
2008-04-19 14:50       ` Matthias Fuchs [this message]
2008-04-19 15:33         ` [U-Boot-Users] [PATCH] cfi-flash: Add?CFG_FLASH_AUTOPROTECT_LIST Jean-Christophe PLAGNIOL-VILLARD
2008-04-19 17:22           ` Matthias Fuchs
2008-04-20  3:54             ` [U-Boot-Users] [PATCH] cfi-flash:?Add?CFG_FLASH_AUTOPROTECT_LIST Jean-Christophe PLAGNIOL-VILLARD
2008-04-20 23:44               ` Wolfgang Denk
2008-04-20  1:14   ` [U-Boot-Users] [PATCH] cfi-flash: Add CFG_FLASH_AUTOPROTECT_LIST Wolfgang Denk
2008-04-20 13:22     ` Matthias Fuchs
2008-04-20 21:52       ` Wolfgang Denk

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=200804191650.32303.matthias.fuchs@esd-electronics.com \
    --to=matthias.fuchs@esd-electronics.com \
    --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