Hi,
I am tring to read the attribute space of PCMCIA using following program.
Even the card is inserted or not it gives different reading in different loadings
of the module.Any idea...
-------------------------------------------------------
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include <linux/module.h>
#include <linux/kernel.h>
#include <asm/io.h>
unsigned long driver_start = 0x08000000;
int driver_count = 10;
int driver_i = 0;
MODULE_PARM(driver_start, "i");
MODULE_PARM(driver_count, "i");
int init_module(void) {
printk("<1> MECR: %x \n", MECR);
MECR = (MECR & (0x00000)) |0x7fe47fff;
for (driver_i; driver_i < driver_count; driver_i += 1 ) {
printk("<1> %x : ",PCIO_BASE + driver_start + driver_i);
printk("%x \n", inb( driver_start + driver_i));
}
return 0;
}
void cleanup_module(void) {
printk("<1>Clean up module\n");
}
~
-------------------------------------------------------
It really helps me if you can point out the problem with above code.
Regards,
Harsha
Nicolas Pitre wrote:
> On Mon, 8 May 2000, Nandana wrote:
>
> > Date: Mon, 08 May 2000 13:02:06 +0600
> > From: Nandana <[EMAIL PROTECTED]>
> > To: Nicolas Pitre <[EMAIL PROTECTED]>
> > Subject: Re: Question aboug hardware.h
> >
> > Hi,
> > Have someone got any idea about the method to access PCMCIA attribute
> > space .
> > We tried it using io_p2v but we had segmentation faults.
> > Regards
> > Harsha
>
> See linux/arch/arm/mm/mm-sa1100.c. There you'll find all physical vs
> virtual mappings for all peripherals.
>
> For example, PCMCIA 1 IO space is virtually mapped at 0xe0000000. Then
> you just need to access memory from that address (simple read or write)
> to
> get the data.
>
> The io_p2v macro is only used for definition inside SA-1100.h. You
> shouldn't have to use it directly.
>
> Nicolas
>
> --------------------------------------------------------------------------------
>
> Subject: Re: Question aboug hardware.h
> Date: Mon, 8 May 2000 13:02:06 íŽ
> From: Nandana Kuruwitage <[EMAIL PROTECTED]>
> To: Nicolas Pitre <[EMAIL PROTECTED]>
>
> Hi,
> Have someone got any idea about the method to access PCMCIA attribute
> space .
> We tried it using io_p2v but we had segmentation faults.
> Regards
> Harsha
>
> Nicolas Pitre wrote:
>
> > On Fri, 5 May 2000, Chien-Min Lee wrote:
> >
> > >
> > > >> However, if we use the physical address 0x91xxxxxx, after the
> > > >> transform of io_p2v(0x91xxxxxx), it can not get the original
> physical
> > > >> address by io_v2p.
> > >
> > > >Yes. All the virtual->physical and physical->virtual macros are
> only valid
> > > >for RAM areas, not general IO.
> > >
> > > Does this mean that these two macros are useless!??
> > > What address type(physical or virtual) do we use to access the
> registers of
> > > peripheral control modules??
> >
> > You really don't have to bother about virtual or physical location of
> > registers. If you want to clear some GPIOs, simply use
> >
> > GEDR |= (1<<x); /* set GPIO x direction for output */
> > GPCR = (1<<x); /* set GPIO x low */
> > val = (GPLR & (1<<y)); /* read GPIO y level (zero or not) */
> >
> > where x and y are your GPIO numbers. If you want to play with the
> memory
> > control register, simply use MECR like:
> >
> > MECR = (MECR & (some_bits)) | some_other_bits;
> >
> > All those peripheral registers are defined in
> include/asm/arch/SA-1100.h.
> > You should use them and not care about where and how they are mapped.
> >
> > Nicolas
> >
> > unsubscribe: body of `unsubscribe linux-arm-kernel' to
> [EMAIL PROTECTED]
unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]
++ Please use [EMAIL PROTECTED] for ++
++ kernel-related discussions. ++