2005-03-31 05:38:25

by nobin matthew

[permalink] [raw]
Subject: HELP: PC104 IO card driver Problem

Dear Friends,

Can anybody Help me in this Pc104 driver Problem;
What is the basics steps in doing read and write on
Pc104 cards.

Deatails Given Below:
I am writing a Linux device driver for
Diamond systems
IR104 digital IO card. This is a PC104 bus device(that
means it ISA
bus compatible).
The Platform is Arcom Viper borad(with support for
PC104), This is a
Xscale, Little endian Platform.

The Specification of PC104 interface given in Viper
borad manual is:
0x3C000000-0x3CFFFFFF PC/104 memory space(16MB)
0x30000000-0x300003FF PC/104 IO space(1KB)

Specification given in IR104 manual is:
I made the jumber setting so that, the IO space
addresses taken by 8
registers will be 0x300-0x307

The driver should do read and write on this
registers(character device
driver).

I took two approaches one is:
i added IO space and 0x300, did inb() and oub().(IO
space base address
and 0x300)
otherway i did ioremap on added result, did inb() and
oub().

In the second method:
I did same procedures using IO memory space

both methods are giving errors, i think that is
related to paging. i think
there is a need for disabling paging in this space.

Please help regarding this. How to solve this.

Nobin Mathew




__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo


2005-03-31 09:37:42

by Ian Campbell

[permalink] [raw]
Subject: Re: HELP: PC104 IO card driver Problem

On Wed, 2005-03-30 at 21:37 -0800, nobin matthew wrote:
> The Platform is Arcom Viper borad(with support for
> PC104), This is a Xscale, Little endian Platform.

If you contact Arcom technical support on either [email protected]
or [email protected] then they will be able to help you with any
problems you are having with the VIPER platform.

The answer to your question is that the ISA I/O address space is mapped
at address 0xf7000000 on the VIPER so the address you need to use with
inb() and outb() is actually 0xf7000300 rather than just 0x300. This is
described in the Quickstart manual that ships with the development kit.
There is also a document describing this (because it is an FAQ) in the
support site http://www.arcom.com/support/faq/Embed_Sys.htm#Linux

Cheers,
Ian.

--
Ian Campbell, Senior Design Engineer
Web: http://www.arcom.com
Arcom, Clifton Road, Direct: +44 (0)1223 403 465
Cambridge CB1 7EA, United Kingdom Phone: +44 (0)1223 411 200

2005-04-01 05:19:51

by saroj kumar pradhan

[permalink] [raw]
Subject: Re: HELP: PC104 IO card driver Problem

On Thu, 2005-03-31 at 11:07, nobin matthew wrote:
> Dear Friends,
>
> Can anybody Help me in this Pc104 driver Problem;
> What is the basics steps in doing read and write on
> Pc104 cards.
>
> Deatails Given Below:
> I am writing a Linux device driver for
> Diamond systems
> IR104 digital IO card. This is a PC104 bus device(that
> means it ISA
> bus compatible).
> The Platform is Arcom Viper borad(with support for
> PC104), This is a
> Xscale, Little endian Platform.
>
> The Specification of PC104 interface given in Viper
> borad manual is:
> 0x3C000000-0x3CFFFFFF PC/104 memory space(16MB)
> 0x30000000-0x300003FF PC/104 IO space(1KB)
>
> Specification given in IR104 manual is:
> I made the jumber setting so that, the IO space
> addresses taken by 8
> registers will be 0x300-0x307
>
> The driver should do read and write on this
> registers(character device
> driver).
>
> I took two approaches one is:
> i added IO space and 0x300, did inb() and oub().(IO
> space base address
> and 0x300)
> otherway i did ioremap on added result, did inb() and
> oub().

/* Remap a not (necessarily) aligned port region */
void *short_remap(unsigned long phys_addr)
{
/* The code comes mainly from arch/any/mm/ioremap.c */
unsigned long offset, last_addr, size;

last_addr = phys_addr + SHORT_NR_PORTS - 1;
offset = phys_addr & ~PAGE_MASK;

/* Adjust the begin and end to remap a full page */
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr) - phys_addr;
return ioremap(phys_addr, size) + offset;
}

/* Unmap a region obtained with short_remap */
void short_unmap(void *virt_add)
{
iounmap((void *)((unsigned long)virt_add & PAGE_MASK));
}

>
> In the second method:
> I did same procedures using IO memory space
Here Use ioremap to get a base address in the
region(0x3C000000-0x3CFFFFFF).
Suppose ISA_BEGIN = 0x3C000000, ISA_END = 0x3CFFFFFF
void *base;
base = ioremap(ISA_BEGIN, ISA_END - ISA_BEGIN);
base = base - ISA_BEGIN; /* offset */

Use these base address to read and write the IO region.



For more details go to http://www.xml.com/ldd/chapter/book/ch08.html
to get more info.


>
> both methods are giving errors, i think that is
> related to paging. i think
> there is a need for disabling paging in this space.
>
> Please help regarding this. How to solve this.
>
> Nobin Mathew
>
>
>
>
> __________________________________
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
> http://mobile.yahoo.com/maildemo
>
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive: http://mail.nl.linux.org/kernelnewbies/
> FAQ: http://kernelnewbies.org/faq/
>
>