From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Reg. CFI flash_init and hardware write protected devices
Date: Tue, 31 May 2011 16:37:13 +0200 [thread overview]
Message-ID: <201105311637.13721.sr@denx.de> (raw)
In-Reply-To: <BANLkTik-zkczuQbm23aPXephB_tyfB=doA@mail.gmail.com>
Hi Frank,
On Tuesday 31 May 2011 15:55:56 Frank Svendsb?e wrote:
> > Understood. But why don't you disable write-protection when you first
> > call flash_init()? And enable the write-protection after the chip is
> > correctly detected?
>
> Simply because disabling write-protection is not impossible after
> installation. Our device will be located 3000m below sea level.
I see.
> As I explained Mike Frysinger, the write-protection settings is not
> controlled by the PPC device running U-Boot. We can enable
> write-protection in the lab (by setting a jumper), but not write software.
>
> The whole purpose of this is to keep it "impossible" to destroy a factory
> default version. For "mutable" software, we utilize another flash.
>
> >> Our current solution based on controlling nWE is to hardcode flash
> >> geometry in board code when flash protection is enabled. In order to
> >> use CFI as intended when write protection is disabled, we call the
> >> generic flash_init function as defined in
> >> drivers/mtd/cfi_flash.c.
> >
> > How is write-protection enabled/disabled on your board?
>
> Two ways/levels: 1) A hardware jumper on the factory default flash. 2)
> On the non-factory default flash, write protection is enabled/disabled
> by an FPGA and implicitly and AVR. To make it short, we cannot
> change protection scheme from U-Boot (but we can via an SPI driver I
> wrote for Linux).
Theoretically also possible with U-Boot. But I understand that you don't want
to do this.
<snip>
> > Why don't you think that you can't access the original function if it's
> > defined as a weak default? This should work just fine, see for example
> > ft_board_setup() in arch/powerpc/cpu/ppc4xx/fdt.c:
> >
> > void __ft_board_setup(void *blob, bd_t *bd)
> > {
> > ...
> > }
> > void ft_board_setup(void *blob, bd_t *bd) __attribute__((weak,
> > alias("__ft_board_setup")));
> >
> >
> > And then this weak default is overridden and still referenced in
> > board/amcc/canyonlands/canyonlands.c:
> >
> > void ft_board_setup(void *blob, bd_t *bd)
> > {
> > __ft_board_setup(blob, bd);
> > ...
> >
> >
> > So no need for this ifdef in the common CFI driver. Or am I missing
> > something here?
>
> Oh. I didn't knew I could access the function that was overridden by the
> weak attribute. I guess that's the alias is for right?
Yep.
> If both can be
> called, I'm happy to remove the ifdef.
>
> I'll test that tomorrow and provide a patch if it works.
Good luck...
Best regards,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
next prev parent reply other threads:[~2011-05-31 14:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 8:35 [U-Boot] Reg. CFI flash_init and hardware write protected devices Frank Svendsbøe
2011-05-31 12:49 ` Mike Frysinger
2011-05-31 13:25 ` Frank Svendsbøe
2011-05-31 14:01 ` Mike Frysinger
2011-05-31 13:10 ` Stefan Roese
2011-05-31 13:55 ` Frank Svendsbøe
2011-05-31 14:37 ` Stefan Roese [this message]
2011-06-01 14:33 ` Frank Svendsbøe
2011-06-01 15:34 ` Stefan Roese
2011-06-01 16:59 ` Frank Svendsbøe
2011-06-23 13:50 ` Frank Svendsbøe
2011-06-23 15:21 ` Wolfgang Denk
2011-06-23 16:15 ` Frank Svendsbøe
2011-06-23 17:55 ` Wolfgang Denk
2011-06-23 19:05 ` Frank Svendsbøe
2011-06-24 13:59 ` Frank Svendsbøe
2011-06-24 14:26 ` Wolfgang Denk
2011-06-24 19:58 ` Frank Svendsbøe
2011-06-24 20:26 ` Wolfgang Denk
2011-06-24 21:12 ` Frank Svendsbøe
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=201105311637.13721.sr@denx.de \
--to=sr@denx.de \
--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