mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* RFC: change map_base type
@ 2010-11-24 12:39 Belisko Marek
  2010-11-24 14:48 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 5+ messages in thread
From: Belisko Marek @ 2010-11-24 12:39 UTC (permalink / raw)
  To: barebox

Hi,

fist sparse patches was accepted but doesn't fix all problems.

There is still a lot of sparse problems which complain about incorrect type
in functions read(bwl)/writ(bwl). Over whole codebase to this
functions are passed
u_long or u_int types which is not correct.

e.g. in serial drivers is used for access to registers:
writeb(0x07, dev->map_base + UFCON);

In my opinion it make no sense to use:
writeb(0x07, IOMEM(dev->map_base + UFCON));

Instead change map_base type in include/driver.h to void __iomem *map_base
which should fix a lot sparse problems.
Then only board code when device is initialized use: .map_base =
IOMEM(0x00000...)

Make it sense or there is not necessary to touch it or other way?

Thanks for comments,

marek


-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: change map_base type
  2010-11-24 12:39 RFC: change map_base type Belisko Marek
@ 2010-11-24 14:48 ` Jean-Christophe PLAGNIOL-VILLARD
  2010-11-24 20:09   ` Belisko Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-11-24 14:48 UTC (permalink / raw)
  To: Belisko Marek; +Cc: barebox

On 13:39 Wed 24 Nov     , Belisko Marek wrote:
> Hi,
> 
> fist sparse patches was accepted but doesn't fix all problems.
> 
> There is still a lot of sparse problems which complain about incorrect type
> in functions read(bwl)/writ(bwl). Over whole codebase to this
> functions are passed
> u_long or u_int types which is not correct.
> 
> e.g. in serial drivers is used for access to registers:
> writeb(0x07, dev->map_base + UFCON);
> 
> In my opinion it make no sense to use:
> writeb(0x07, IOMEM(dev->map_base + UFCON));
> 
> Instead change map_base type in include/driver.h to void __iomem *map_base
> which should fix a lot sparse problems.
> Then only board code when device is initialized use: .map_base =
> IOMEM(0x00000...)
> 
> Make it sense or there is not necessary to touch it or other way?
it's a ressources so it's the right type as in the kernel

the driver need to cast based on it's need

as done in linux

remember with the multi-ressource it's not anymore a base address you pass
but any data

Best Regards,
J.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: change map_base type
  2010-11-24 14:48 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2010-11-24 20:09   ` Belisko Marek
  2010-11-25  8:29     ` Sascha Hauer
  2010-11-25 11:23     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 5+ messages in thread
From: Belisko Marek @ 2010-11-24 20:09 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Wed, Nov 24, 2010 at 3:48 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> On 13:39 Wed 24 Nov     , Belisko Marek wrote:
>> Hi,
>>
>> fist sparse patches was accepted but doesn't fix all problems.
>>
>> There is still a lot of sparse problems which complain about incorrect type
>> in functions read(bwl)/writ(bwl). Over whole codebase to this
>> functions are passed
>> u_long or u_int types which is not correct.
>>
>> e.g. in serial drivers is used for access to registers:
>> writeb(0x07, dev->map_base + UFCON);
>>
>> In my opinion it make no sense to use:
>> writeb(0x07, IOMEM(dev->map_base + UFCON));
>>
>> Instead change map_base type in include/driver.h to void __iomem *map_base
>> which should fix a lot sparse problems.
>> Then only board code when device is initialized use: .map_base =
>> IOMEM(0x00000...)
>>
>> Make it sense or there is not necessary to touch it or other way?
> it's a ressources so it's the right type as in the kernel
>
> the driver need to cast based on it's need
>
> as done in linux
You are right. Linus type for map_base is same like in barebox.
Anyway if you pass some resource to driver it is always re-mapped and
used remapped value over all code for IO access.

Maybe best would be cast map_base in probe function of driver with IOMEM() macro
and this value store in driver structure and use. Good idea?
>
> remember with the multi-ressource it's not anymore a base address you pass
> but any data
>
> Best Regards,
> J.
>

thanks,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
icq: 290551086
web: http://open-nandra.com

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: change map_base type
  2010-11-24 20:09   ` Belisko Marek
@ 2010-11-25  8:29     ` Sascha Hauer
  2010-11-25 11:23     ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2010-11-25  8:29 UTC (permalink / raw)
  To: Belisko Marek; +Cc: barebox

On Wed, Nov 24, 2010 at 09:09:43PM +0100, Belisko Marek wrote:
> On Wed, Nov 24, 2010 at 3:48 PM, Jean-Christophe PLAGNIOL-VILLARD
> <plagnioj@jcrosoft.com> wrote:
> > On 13:39 Wed 24 Nov     , Belisko Marek wrote:
> >> Hi,
> >>
> >> fist sparse patches was accepted but doesn't fix all problems.
> >>
> >> There is still a lot of sparse problems which complain about incorrect type
> >> in functions read(bwl)/writ(bwl). Over whole codebase to this
> >> functions are passed
> >> u_long or u_int types which is not correct.
> >>
> >> e.g. in serial drivers is used for access to registers:
> >> writeb(0x07, dev->map_base + UFCON);
> >>
> >> In my opinion it make no sense to use:
> >> writeb(0x07, IOMEM(dev->map_base + UFCON));
> >>
> >> Instead change map_base type in include/driver.h to void __iomem *map_base
> >> which should fix a lot sparse problems.
> >> Then only board code when device is initialized use: .map_base =
> >> IOMEM(0x00000...)
> >>
> >> Make it sense or there is not necessary to touch it or other way?
> > it's a ressources so it's the right type as in the kernel
> >
> > the driver need to cast based on it's need
> >
> > as done in linux
> You are right. Linus type for map_base is same like in barebox.
> Anyway if you pass some resource to driver it is always re-mapped and
> used remapped value over all code for IO access.
> 
> Maybe best would be cast map_base in probe function of driver with IOMEM() macro
> and this value store in driver structure and use. Good idea?

Yes, I like it.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: RFC: change map_base type
  2010-11-24 20:09   ` Belisko Marek
  2010-11-25  8:29     ` Sascha Hauer
@ 2010-11-25 11:23     ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-11-25 11:23 UTC (permalink / raw)
  To: Belisko Marek; +Cc: barebox

On 21:09 Wed 24 Nov     , Belisko Marek wrote:
> On Wed, Nov 24, 2010 at 3:48 PM, Jean-Christophe PLAGNIOL-VILLARD
> <plagnioj@jcrosoft.com> wrote:
> > On 13:39 Wed 24 Nov     , Belisko Marek wrote:
> >> Hi,
> >>
> >> fist sparse patches was accepted but doesn't fix all problems.
> >>
> >> There is still a lot of sparse problems which complain about incorrect type
> >> in functions read(bwl)/writ(bwl). Over whole codebase to this
> >> functions are passed
> >> u_long or u_int types which is not correct.
> >>
> >> e.g. in serial drivers is used for access to registers:
> >> writeb(0x07, dev->map_base + UFCON);
> >>
> >> In my opinion it make no sense to use:
> >> writeb(0x07, IOMEM(dev->map_base + UFCON));
> >>
> >> Instead change map_base type in include/driver.h to void __iomem *map_base
> >> which should fix a lot sparse problems.
> >> Then only board code when device is initialized use: .map_base =
> >> IOMEM(0x00000...)
> >>
> >> Make it sense or there is not necessary to touch it or other way?
> > it's a ressources so it's the right type as in the kernel
> >
> > the driver need to cast based on it's need
> >
> > as done in linux
> You are right. Linus type for map_base is same like in barebox.
> Anyway if you pass some resource to driver it is always re-mapped and
> used remapped value over all code for IO access.
> 
> Maybe best would be cast map_base in probe function of driver with IOMEM() macro
> and this value store in driver structure and use. Good idea?
I agree too

we could first apply the mutli ressource and then do this

Best Regards,
J.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-25 11:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-24 12:39 RFC: change map_base type Belisko Marek
2010-11-24 14:48 ` Jean-Christophe PLAGNIOL-VILLARD
2010-11-24 20:09   ` Belisko Marek
2010-11-25  8:29     ` Sascha Hauer
2010-11-25 11:23     ` Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox