All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/1] Fix hang trying to protect flash sectors
Date: Wed, 19 May 2010 11:44:16 +0200	[thread overview]
Message-ID: <201005191144.16691.sr@denx.de> (raw)
In-Reply-To: <4BF39D0B020000B800011FD3@gwia.alliedtelesyn.co.nz>

Mark,

On Tuesday 18 May 2010 22:10:51 mark tomlinson wrote:
> Yes we do have 2 flash chips. Here's the mapping:
> 
> #define CONFIG_SYS_FLASH_BASE   0xf8000000  /* 2 chips*16M */

Hmmm. 2 * 16MByte, thats 32MByte == 0x2000000. So you should have one chip 
at base address 0xff000000 and one at 0xfe000000. Why 0xf8000000?

> #define CONFIG_SYS_MONITOR_BASE  TEXT_BASE  /* start of monitor */
> 
> and in our config.mk file:
> 
> TEXT_BASE = 0xfff40000
> 
> This is the same flash chip as that at 0xf8000000, but remapped at reset 
by
> a CPLD to the high memory area too.

This seems wrong. See my comments above.
 
> The conditional code in cfi_flash.c:
> #if (CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE) && \
> (!defined(CONFIG_MONITOR_IS_IN_RAM))
> is therefore included since 0xfff40000 is greater than 0xf8000000, but
> flash_get_info(0xfff40000) returns NULL (as expected).

I don't see why flash_get_info(0xfff40000) should return NULL. It should 
return the pointer to the 16MB FLASH chip starting at 0xff000000.
 
> I understand that not passing NULL to flash_protect() would be a better
> idea, and there's nothing wrong with doing both.

Agreed in general. But we have to keep the code compact. And unnecessary 
checks do increase the code size (at least a small bit).

> I was going to fix it in
> cfi_flash.c, but noticed that many other areas of code (in different
> flash.c files) do the same thing. In our own build, I have just removed
> the code that tries to protect the monitor area, and will use an
> auto-protect area instead to do the same job.

"auto-protect area"? Please explain what you mean with this? Perhaps this 
is an interesting "feature" for mainline as well.

Cheers,
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

  reply	other threads:[~2010-05-19  9:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18  5:26 [U-Boot] [PATCH 0/1] Fix hang trying to protect flash sectors Mark Tomlinson
2010-05-18  5:26 ` [U-Boot] [PATCH 1/1] flash: Check info pointer in flash_protect() Mark Tomlinson
2010-05-19 22:22   ` Mike Frysinger
2010-05-20  8:38   ` Wolfgang Denk
2010-05-18  8:20 ` [U-Boot] [PATCH 0/1] Fix hang trying to protect flash sectors Stefan Roese
2010-05-18 20:10   ` mark tomlinson
2010-05-19  9:44     ` Stefan Roese [this message]
2010-05-19 21:09       ` mark tomlinson
2010-05-19 21:59         ` Wolfgang Denk
2010-05-19 23:08           ` Chris Packham
2010-05-20  8:35             ` Wolfgang Denk
2010-05-20 18:59               ` Chris Packham

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=201005191144.16691.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.