public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	Lennert Buytenhek <buytenh@wantstofly.org>
Subject: Re: physmap and pointless shutdown() function ?
Date: Sat, 06 Jun 2009 13:27:55 +0100	[thread overview]
Message-ID: <1244291275.3751.1749.camel@macbook.infradead.org> (raw)
In-Reply-To: <8bd0f97a0906051642i6a270831peddba0f49e22b75@mail.gmail.com>

On Fri, 2009-06-05 at 19:42 -0400, Mike Frysinger wrote:
> On Fri, Jun 5, 2009 at 13:51, David Woodhouse wrote:
> > On Wed, 2009-05-06 at 22:41 -0400, Mike Frysinger wrote:
> >> waaaay back when power management support was added to the physmap.c
> >> driver, it added the standard suspend/resume functions.  no problem
> >> there.  but it also added a shutdown function which causes the flash
> >> to suspend/resume when rebooting:
> >> static void physmap_flash_shutdown(struct platform_device *dev)
> >> {
> >>     struct physmap_flash_info *info = platform_get_drvdata(dev);
> >>     int i;
> >>     for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
> >>         if (info->mtd[i]->suspend && info->mtd[i]->resume)
> >>             if (info->mtd[i]->suspend(info->mtd[i]) == 0)
> >>                 info->mtd[i]->resume(info->mtd[i]);
> >> }
> >>
> >> i cant see any point in doing this.  it isnt like the flash has
> >> buffers that need flushing, and if they did, using suspend/resume as a
> >> hack for flushing sounds pretty broken to me.
> >>
> >> seems to me the function should just be dropped completely.
> >
> > Wasn't that just to put it into read mode in case the bootloader is
> > running from the same chip?
> 
> the flash isnt put into read mode though.  if i add printk's to the
> shutdown function like so:
> then during reboot i see:
> physmap_flash_shutdown: 0: before: aded5006
> physmap_flash_shutdown: 0: after: 800080
> the first value is the correct value

That's odd, and would seem to indicate that the attempt to ensure the
flash is in read mode isn't _working_. But I still think that was the
_intent_ of this code. It was just coincidence that it was in read mode
before the call; we needed to make 100% sure.

> the first value is the correct value
> 
> > Reboot doesn't work very well if all you
> > have is flash status bits at your reset vector,
> 
> your assumption is faulty in that the reset vector is the base of the
> flash.  i.e. the physmap base is 0x20000000 as is the reset vector.

The reset vector may or may not be in the physmap flash. If it's not, of
course, then the shutdown state doesn't matter. If it _is_, then the
shutdown state _might_ matter (depending on the hardware reset
arrangements).

It doesn't matter whether it's at the base of the flash, at the end of
the flash, or in the middle -- does it?

> physmap platform flash device: 02000000 at 20000000
> physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
>  Intel/Sharp Extended Query Table at 0x010A
>  Intel/Sharp Extended Query Table at 0x010A
>  Intel/Sharp Extended Query Table at 0x010A
>  Intel/Sharp Extended Query Table at 0x010A
>  Intel/Sharp Extended Query Table at 0x010A
> Using buffer write method
> Using auto-unlock on power-up/resume
> cfi_cmdset_0001: Erase suspend on write enabled
> RedBoot partition parsing not available
> Using physmap partition information
> Creating 3 MTD partitions on "physmap-flash.0":
> 0x00000000-0x00040000 : "bootloader(nor)"
> 0x00040000-0x00440000 : "linux kernel(nor)"
> 0x00440000-0x01000000 : "file system(nor)"
> 
> > because you didn't bother to wire up a hardware reset line to the flash.
> 
> i'm not disputing the hardware sucks, except your assertion that
> "didnt bother" is simply wrong.  there is no hardware reset line that
> could possibly be wired up in the first place (deficiency in the
> processor itself).

OK, so the CPU architectures didn't bother to give you an outward-facing
reset line that you _could_ hook up to your flash. We're still arguing
semantics :)

The point remains -- I don't think we can remove the shutdown() function
-- I think it needs to be fixed to leave the flash in read mode.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

  reply	other threads:[~2009-06-06 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07  2:41 physmap and pointless shutdown() function ? Mike Frysinger
2009-06-05 17:51 ` David Woodhouse
2009-06-05 23:42   ` Mike Frysinger
2009-06-06 12:27     ` David Woodhouse [this message]
2009-06-06 19:22       ` Mike Frysinger

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=1244291275.3751.1749.camel@macbook.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=buytenh@wantstofly.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vapier.adi@gmail.com \
    /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