Skip to contentSkip to conversation

virtex 4 linux driver bus error

DISCUSSION Mirsad Vejseli 3 participants 3 messages Oct 22, 2008 – Oct 23, 2008

lore
Share & tools
lore
#0 lore raw

hello at all,

at the moment I use development board ML410 with montavistalinux.=20

I have a problem, please help me!=20

I try to write a linux-driver for writing or reading registers.
I have a ace-file, which contents Linux and EDK-project with a component (= IP-wizard) which is added on a PLB-bus.
I also have a driver-construct which I can register (insmod driver.ko) int=
o the linux-Kernel only if i do not use functions to write or read the bus= (XIO=5Fout32() or XIO=5Fin32 () ). If I use this function after registering =
the driver I got an error.
If I try to insert the modul with Insmod driver.ko I get a bus error! =20

my driver is similar to http://ozlabs.org/pipermail/linuxppc-embedded/2006=
-January/021578.html
=20

her the two importent functions of the driver:

#define REG=5FBASE (u32) XPAR=5Fkomponente=5F0=5FBASEADDR // defined in xparamete=
rs=5Fml41x.h=20
#define REG=5FHIGH (u32) XPAR=5Fkomponente=5F0=5FHIGHADDR // defined in xparamete=
rs=5Fml41x.h=20

#define reg0=5Fupper (u32) komponente=5FSLV=5FREG0=5FOFFSET // 32-bit register / d=
efined in komponente.h
#define reg1=5Fupper (u32) komponente=5FSLV=5FREG1=5FOFFSET // 32-bit register / d=
efined in komponente.h
#define reg2=5Fupper (u32) komponente=5FSLV=5FREG2=5FOFFSET // 32-bit register / d=
efined in komponente.h

const static long remap=5Fsize =3D REG=5FHIGH - REG=5FBASE + 1;

static void read=5Fregister=5Fvalues(void)

{
	static u32 upper;

=09

	printk("%s:\n",DRIVERNAME);
	printk("%s:                      |     upper         |\n",DRIVERNAME);
	printk("%s:----------------------|-------------------|\n",DRIVERNAME);
=09
	upper =3D XIo=5FIn32(reg=5Fremapped=5Faddress + reg1=5Fupper);

    printk("%s: Daten im Register 35 |%15X |\n", DRIVERNAME, upper );

=09
}

static int =5F=5Finit meintreiber=5Finit(void) =20
reg=5Fremapped=5Faddress =3D (u32) ioremap(REG=5FBASE, remap=5Fsize);
=20

    rtn =3D misc=5Fregister(&miscdev);
    if (rtn)=20
    {
		printk("%s: %s error driver not reg. \n",DRIVERNAME, miscdev.name);
        return rtn;
    }

	read2=5Fregister=5Fvalues();

=09
in the messeges log file i got the 3 printk lins and this line=20 "upper =3D XIo=5FIn32(reg=5Fremapped=5Faddress + reg1=5Fupper);" creates a error

=20

Thank you very much for your kind help!=20 =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F Schon geh=F6rt=3F Bei WEB.DE gibt' s viele kostenlose Spiele:
http://games.entertainment.web.de/de/entertainment/games/free/index.html

#1 lore raw

See the inline comments.

Quoted 2 lines

-----Original Message-----
From: [email protected] [mailto=

:linuxppc-embedded-

Quoted 9 lines

[email protected]] On Behalf Of Mirsad Vejseli
Sent: Wednesday, October 22, 2008 6:10 AM
To: [email protected]
Subject: virtex 4 linux driver bus error
=

hello at all,
=

Quoted 8 lines

at the moment I use development board ML410 with montavistalinux. =

I have a problem, please help me!
=

I try to write a linux-driver for writing or reading registers. I have a ace-file, which contents Linux and EDK-project with a component =

(IP-wizard) which is added

Quoted 2 lines

on a PLB-bus.
I also have a driver-construct which I can register (insmod driver.ko) in=

to the linux-Kernel only if

Quoted 1 line

i do not use functions to write or read the bus (XIO_out32() or XIO_in32 =

() ). If I use this

I don't know MontaVista Linux, but in general these are functions provided = by Xilinx for standalone (no RTOS) operation unless MontaVista has changed = them. I would recommend that you go look at other Linux drivers to see the=
pattern for I/O such as the uartlite serial driver or the xilinx_ps2.c dri=
ver. I realize each driver already in the mainline can be different but th= ey are working.

I would also add some debug to print out the virtual address after the iore= map. You aren't checking the result of the ioremap to make sure it didn't f= ail. =

Is the ioremap bad or the I/O operation is the question.

Quoted 5 lines

function after registering the driver I got an error.
If I try to insert the modul with Insmod driver.ko I get a bus error! =

my driver is similar to http://ozlabs.org/pipermail/linuxppc-embedded/200=

6-January/021578.html

Quoted 8 lines

=

=

her the two importent functions of the driver:
=

#define REG_BASE (u32) XPAR_komponente_0_BASEADDR // defined in xparamet=

ers_ml41x.h

Quoted 1 line

#define REG_HIGH (u32) XPAR_komponente_0_HIGHADDR // defined in xparamet=

ers_ml41x.h

Quoted 5 lines

=

=

#define reg0_upper (u32) komponente_SLV_REG0_OFFSET // 32-bit register / =

defined in komponente.h

Quoted 1 line

#define reg1_upper (u32) komponente_SLV_REG1_OFFSET // 32-bit register / =

defined in komponente.h

Quoted 1 line

#define reg2_upper (u32) komponente_SLV_REG2_OFFSET // 32-bit register / =

defined in komponente.h

Quoted 60 lines

=

const static long remap_size =3D REG_HIGH - REG_BASE + 1; =

static void read_register_values(void)

{
	static u32 upper;

=

=

	printk("%s:\n",DRIVERNAME);
	printk("%s:                      |     upper         |\n",DRIVERNAME);
	printk("%s:----------------------|-------------------|\n",DRIVERNAME);

=

	upper =3D XIo_In32(reg_remapped_address + reg1_upper);

=

    printk("%s: Daten im Register 35 |%15X |\n", DRIVERNAME, upper );

=

}
=

=

static int __init meintreiber_init(void) reg_remapped_address =3D (u32) ioremap(REG_BASE, remap_size); =

    rtn =3D misc_register(&miscdev);
    if (rtn)
    {
		printk("%s: %s error driver not reg. \n",DRIVERNAME, miscdev.name);
        return rtn;
    }

=

	read2_register_values();

=

in the messeges log file i got the 3 printk lins and this line "upper =3D XIo_In32(reg_remapped_address + reg1_upper);" creates a error
=

=

=

=

Thank you very much for your kind help!
________________________________________________________________________
Schon geh=F6rt? Bei WEB.DE gibt' s viele kostenlose Spiele:
http://games.entertainment.web.de/de/entertainment/games/free/index.html
=

Quoted 4 lines

_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

This email and any attachments are intended for the sole use of the named r= ecipient(s) and contain(s) confidential information that may be proprietary= , privileged or copyrighted under applicable law. If you are not the intend= ed recipient, do not read, copy, or forward this email message or any attac= hments. Delete this email message and any attachments immediately.

#2 lore raw
In reply to Mirsad Vejseli
Quoted 11 lines · Mirsad Vejseli

hello at all,

at the moment I use development board ML410 with montavistalinux.

I have a problem, please help me!

I try to write a linux-driver for writing or reading registers.
I have a ace-file, which contents Linux and EDK-project with a component (IP-wizard) which is added on a PLB-bus.
I also have a driver-construct which I can register (insmod driver.ko) into the linux-Kernel only if i do not use functions to write or read the bus (XIO_out32() or XIO_in32 () ). If I use this function after registering the driver I got an error. If I try to insert the modul with Insmod driver.ko I get a bus error!

Quoted 5 lines

my driver is similar to http://ozlabs.org/pipermail/linuxppc-embedded/2006-January/021578.html

her the two importent functions of the driver:

Try something like this:

#define REG_BASE (u32) XPAR_komponente_0_BASEADDR // defined in xparameters_ml41x.h
#define REG_HIGH (u32) XPAR_komponente_0_HIGHADDR // defined in xparameters_ml41x.h

#define reg0_upper (u32) komponente_SLV_REG0_OFFSET // 32-bit register / defined in komponente.h
#define reg1_upper (u32) komponente_SLV_REG1_OFFSET // 32-bit register / defined in komponente.h
#define reg2_upper (u32) komponente_SLV_REG2_OFFSET // 32-bit register / defined in komponente.h

static int __init meintreiber_init(void)

{
	int rtn, upper;

	reg_remapped_address = (u32) ioremap(REG_BASE, REG_HIGH - REG_BASE + 1);
	if (!reg_remapped_address) {
		printk("error mapping registers\n");
		return -ENOMEM;
	}

	upper = in_be32(reg_mapped_address + reg1_upper);
	printk("Data in: %.8X\n", upper);
	return 0;
}

g.