2003-07-28 23:55:59

by Yasushi SHOJI

[permalink] [raw]
Subject: request_region for no dynamic bus sizing

hello all,

I've been working on a cpu board (which is arm based, but not relevant
in this issue, IMO) which does _not_ have dynamic bus sizing
capability.

the way the board is setup is that there is memory region for both
8bit access and 16bit access for same bus address, so that one can use
either region for appropriate bus width access.

the problem is, however, that because there is two memory region for
one bus address, I have to call two request_region()s to avoid misuse.

what i'd like to ask is that "is anyone using such kind of board to
run linux? if so, how do you do?"

I just got sick fixing device driver everytime using on the board. ;p

tia,
--
yashi


2003-07-29 00:58:09

by Alan

[permalink] [raw]
Subject: Re: request_region for no dynamic bus sizing

On Maw, 2003-07-29 at 00:55, Yasushi SHOJI wrote:
> the problem is, however, that because there is two memory region for
> one bus address, I have to call two request_region()s to avoid misuse.
>
> what i'd like to ask is that "is anyone using such kind of board to
> run linux? if so, how do you do?"

Is there any reason you cannot fix request_region for your platform to
request both itself ?

2003-07-29 01:53:11

by Yasushi SHOJI

[permalink] [raw]
Subject: Re: request_region for no dynamic bus sizing

At 29 Jul 2003 01:52:29 +0100,
Alan Cox wrote:
>
> On Maw, 2003-07-29 at 00:55, Yasushi SHOJI wrote:
> > the problem is, however, that because there is two memory region for
> > one bus address, I have to call two request_region()s to avoid misuse.
> >
> > what i'd like to ask is that "is anyone using such kind of board to
> > run linux? if so, how do you do?"
>
> Is there any reason you cannot fix request_region for your platform to
> request both itself ?

no, there is not.

Actualy, I was looking at __request_region after I sent the previous
message.

What'd be the proper way to fix request_region for no dynamic bus
sizing platform? use #ifdef in linux/ioport.h and call
__request_region twice or fix __request_region?

how about something like this? (haven't even compile)

#define ADDR_OFFSET(x) WHATEVER(x)

#define request_region(start,n,name) \
({ struct resource * __r, __s; \
__r = __request_region(&ioport_resource, (start), (n), (name)); \
if (__r) { \
__s = __request_region(&ioport_resource, (ADDR_OFFSET(start)), (n), (name)); \
if (!__s) { \
__release_region(&ioport_resource, (start), (n), (name)); \
__r = NULL; \
} \
} \
__r; })

best regards,
--
yashi