public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [linux 2.4.18] via-rhine.c
@ 2003-05-19 19:43 Pawan Deepika
  2003-05-20 13:44 ` Roger Luethi
  0 siblings, 1 reply; 2+ messages in thread
From: Pawan Deepika @ 2003-05-19 19:43 UTC (permalink / raw)
  To: linux-kernel

Hi,

 I am learning device driver only now. I was going
through the source code in via-rhine.c. What I
understand till now is that in Memory-mapped devices,
I/O operation is performed using
read(b/w/l)/write(b/w/l) functions while in IO mapped
devices it is done using in/out(b/w/l). Am I right?

But in via-rhine.c I notice use of inb and outb even
in memory mapped case(code is shown below)

------------------------------------------------------
#ifdef USE_MEM
530 static void __devinit enable_mmio(long ioaddr, int
chip_id)
531 {
532         int n;
533         if (chip_id == VT3043 || chip_id ==
VT86C100A) {
534                 /* More recent docs say that this
bit is reserved ... */
535                 n = inb(ioaddr + ConfigA) | 0x20;
536                 outb(n, ioaddr + ConfigA);
537         } else if (chip_id == VT6102) {
538                 n = inb(ioaddr + ConfigD) | 0x80;
539                 outb(n, ioaddr + ConfigD);
540         }
541 }
542 #endif
-----------------------------------------------------

Can anyone tell me how does it work here? Also, don't
we need to allocate I/O ports(using request_region() )
before performing any inb/outb operations?

Please advise.

Thanks & regards,
Deepika

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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

* Re: [linux 2.4.18] via-rhine.c
  2003-05-19 19:43 [linux 2.4.18] via-rhine.c Pawan Deepika
@ 2003-05-20 13:44 ` Roger Luethi
  0 siblings, 0 replies; 2+ messages in thread
From: Roger Luethi @ 2003-05-20 13:44 UTC (permalink / raw)
  To: Pawan Deepika; +Cc: linux-kernel

You should ask this kind of questions on the kernelnewbies list.

On Mon, 19 May 2003 12:43:17 -0700, Pawan Deepika wrote:
> through the source code in via-rhine.c. What I
> understand till now is that in Memory-mapped devices,
> I/O operation is performed using
> read(b/w/l)/write(b/w/l) functions while in IO mapped
> devices it is done using in/out(b/w/l). Am I right?

What you do with inb etc. is called PIO (Programmed I/O).

> But in via-rhine.c I notice use of inb and outb even
> in memory mapped case(code is shown below)
> 
> ------------------------------------------------------
> #ifdef USE_MEM
> 530 static void __devinit enable_mmio(long ioaddr, int
> chip_id)
> 531 {

It does exactly what the function name says: it uses PIO to flip a bit in
some register to enable MMIO, which is just a different (and better) way to
transfer the data.

Roger

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

end of thread, other threads:[~2003-05-20 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-19 19:43 [linux 2.4.18] via-rhine.c Pawan Deepika
2003-05-20 13:44 ` Roger Luethi

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