From: Pieter <phenning@vastech.co.za>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] flash/cfi_flash: Use virtual sector start address, not phys
Date: Tue, 03 Feb 2009 10:53:12 +0200 [thread overview]
Message-ID: <498805F8.4000803@vastech.co.za> (raw)
In-Reply-To: <1233614092-5480-1-git-send-email-beckyb@kernel.crashing.org>
Becky Bruce wrote:
> include/flash.h was commented to say that the address in
> flash_info->start was a physical address. However, from u-boot's
> point of view, and looking at most flash code, it makes more
> sense for this to be a virtual address. So I corrected the
> comment to indicate that this was a virtual address.
>
> The only flash driver that was actually treating the address
> as physical was the mtd/cfi_flash driver. However, this code
> was using it inconsistently as it actually directly dereferenced
> the "start" element, while it used map_physmem to get a
> virtual address in other places. I changed this driver so
> that the code which initializes the info->start field calls
> map_physmem to get a virtual address, eliminating the need for
> further map_physmem calls. The code is now consistent.
>
> The *only* place a physical address should be used is when defining the
> flash banks list that is used to initialize the flash_info struct,
> usually found in the board config file.
>
> Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
> ---
> drivers/mtd/cfi_flash.c | 53 +++++++++++++++++++++-------------------------
> include/flash.h | 2 +-
> 2 files changed, 25 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index 84ff7e8..4cb5fb5 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -305,17 +305,12 @@ flash_map (flash_info_t * info, flash_sect_t sect, uint offset)
> {
> unsigned int byte_offset = offset * info->portwidth;
>
> - return map_physmem(info->start[sect] + byte_offset,
> - flash_sector_size(info, sect) - byte_offset,
> - MAP_NOCACHE);
> + return (void *)(info->start[sect] + byte_offset);
> }
>
> static inline void flash_unmap(flash_info_t *info, flash_sect_t sect,
> unsigned int offset, void *addr)
> {
> - unsigned int byte_offset = offset * info->portwidth;
> -
> - unmap_physmem(addr, flash_sector_size(info, sect) - byte_offset);
> }
<snip>
Since "flash_unmap(flash_info_t *info, flash_sect_t sect,unsigned int offset, void *addr)" function is empty after applying the patch, should all function calls in the /drivers/mtd/cfi_flash.c file not also be removed?
cheers pieter
next prev parent reply other threads:[~2009-02-03 8:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-02 22:34 [U-Boot] [PATCH 1/2] flash/cfi_flash: Use virtual sector start address, not phys Becky Bruce
2009-02-02 22:34 ` [U-Boot] [PATCH 2/2] mpc8641hpcn: Use physical address in flash banks defintion Becky Bruce
2009-02-09 23:32 ` Wolfgang Denk
2009-02-03 8:53 ` Pieter [this message]
2009-02-03 14:48 ` [U-Boot] [PATCH 1/2] flash/cfi_flash: Use virtual sector start address, not phys Kumar Gala
2009-02-03 19:35 ` Becky Bruce
2009-02-05 10:42 ` Stefan Roese
2009-02-05 10:25 ` Stefan Roese
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=498805F8.4000803@vastech.co.za \
--to=phenning@vastech.co.za \
--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