mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] mem: multiple resource support allow exclude a resource
Date: Fri, 19 Nov 2010 09:24:35 +0100	[thread overview]
Message-ID: <20101119082435.GB6017@pengutronix.de> (raw)
In-Reply-To: <1290002365-22712-1-git-send-email-plagnioj@jcrosoft.com>

On Wed, Nov 17, 2010 at 02:59:24PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> introduce DEVFS_MEM_BAREBOX_ONLY for this purpose
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  arch/arm/lib/armlinux.c |    4 ++++
>  include/driver.h        |    1 +
>  2 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
> index b74c5e8..55d1401 100644
> --- a/arch/arm/lib/armlinux.c
> +++ b/arch/arm/lib/armlinux.c
> @@ -79,6 +79,10 @@ static void setup_memory_tags(void)
>  	list_for_each_entry(mem, &memory_list, list) {
>  		for (i = 0; i < mem->dev->num_resources; i++) {
>  			res = &mem->dev->resource[i];
> +
> +			if (res->flags & DEVFS_MEM_BAREBOX_ONLY)
> +				break;

Shouldn't this be a 'continue'?

> +
>  			params->hdr.tag = ATAG_MEM;
>  			params->hdr.size = tag_size(tag_mem32);
>  
> diff --git a/include/driver.h b/include/driver.h
> index c7dce1e..e98455c 100644
> --- a/include/driver.h
> +++ b/include/driver.h
> @@ -354,6 +354,7 @@ ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, ulong offse
>  #define DEVFS_PARTITION_READONLY	(1 << 1)
>  #define DEVFS_IS_PARTITION		(1 << 2)
>  #define DEVFS_RDWR			(1 << 3)
> +#define DEVFS_MEM_BAREBOX_ONLY		(1 << 4)

I realize this when looking at this patch: You should abuse the flags
field in a resource pass custom bits. The only flags in a resource should
be the ones defined in include/linux/ioport.h.
With DEVFS_RDWR you are lucky, there is a IORESOURCE_MEM_WRITEABLE flag
which can be used for this purpose. There is no correspondent flag for
DEVFS_MEM_BAREBOX_ONLY though.

Overall I'm not very happy with the multiple-resources-to-mem-driver
approach. If you are concerned with the overhead of multiple statically
allocated devices we could introduce a add_memory_device(char *name, void *start,
size_t size, unsigned long flags) function which dynamically allocates a
device.

I'm also not convinced that these few multiple statically allocated
devices introduce an overhead at all, I mean most boards only have
SDRAM (one device) and maybe an SRAM (second device).

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2010-11-19  8:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-12 18:02 [To test] [PATCH 0/5] device: introduce resource structure Jean-Christophe PLAGNIOL-VILLARD
2010-11-12 18:18 ` [PATCH 1/5] device: introduce resource structure to simplify resource delaration Jean-Christophe PLAGNIOL-VILLARD
2010-11-19  8:00   ` Sascha Hauer
2010-11-19 11:30     ` Jean-Christophe PLAGNIOL-VILLARD
2010-11-20 13:40       ` Sascha Hauer
2010-11-20 13:58         ` Jean-Christophe PLAGNIOL-VILLARD
2010-11-21  4:28           ` Jean-Christophe PLAGNIOL-VILLARD
2010-11-21  6:46             ` Jean-Christophe PLAGNIOL-VILLARD
2010-11-23  7:36             ` Sascha Hauer
2010-11-23  8:25               ` Jean-Christophe PLAGNIOL-VILLARD
2010-11-23 11:34                 ` Sascha Hauer
2011-01-27  8:20   ` Sascha Hauer
2010-11-12 18:18 ` [PATCH 2/5] mem: add multiple resource support Jean-Christophe PLAGNIOL-VILLARD
2010-11-12 18:18 ` [PATCH 3/5] arm/setup_memory_tags: " Jean-Christophe PLAGNIOL-VILLARD
2010-11-12 18:18 ` [PATCH 4/5] edb93xx: convert to multiple mem resources Jean-Christophe PLAGNIOL-VILLARD
2010-11-12 18:18 ` [PATCH 5/5] pcm037: " Jean-Christophe PLAGNIOL-VILLARD
2010-11-17 13:59 ` [PATCH 1/2] mem: multiple resource support allow exclude a resource Jean-Christophe PLAGNIOL-VILLARD
2010-11-19  8:24   ` Sascha Hauer [this message]
2010-11-19 11:31     ` Jean-Christophe PLAGNIOL-VILLARD
2010-11-17 13:59 ` [PATCH 2/2] mem: convert to DEVFS_MEM_BAREBOX_ONLY for freescale-mx25-3-stack/pcm037/pvm038 Jean-Christophe PLAGNIOL-VILLARD
2010-11-17 14:09   ` Baruch Siach
2010-11-17 14:02 ` [To test] [PATCH 0/5] device: introduce resource structure Jean-Christophe PLAGNIOL-VILLARD

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=20101119082435.GB6017@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.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