linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* virtex 4 linux driver bus error
@ 2008-10-22 12:10 Mirsad Vejseli
  2008-10-22 23:38 ` John Linn
  2008-10-23  4:17 ` Grant Likely
  0 siblings, 2 replies; 3+ messages in thread
From: Mirsad Vejseli @ 2008-10-22 12:10 UTC (permalink / raw)
  To: linuxppc-embedded

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

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

* RE: virtex 4 linux driver bus error
  2008-10-22 12:10 virtex 4 linux driver bus error Mirsad Vejseli
@ 2008-10-22 23:38 ` John Linn
  2008-10-23  4:17 ` Grant Likely
  1 sibling, 0 replies; 3+ messages in thread
From: John Linn @ 2008-10-22 23:38 UTC (permalink / raw)
  To: Mirsad Vejseli, linuxppc-embedded

See the inline comments.

> -----Original Message-----
> From: linuxppc-embedded-bounces+john.linn=3Dxilinx.com@ozlabs.org [mailto=
:linuxppc-embedded-
> bounces+john.linn=3Dxilinx.com@ozlabs.org] On Behalf Of Mirsad Vejseli
> Sent: Wednesday, October 22, 2008 6:10 AM
> To: linuxppc-embedded@ozlabs.org
> Subject: virtex 4 linux driver bus error
> =

> 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) in=
to 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

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.

> 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
> =

> =

> her the two importent functions  of the driver:
> =

> #define REG_BASE 	(u32) XPAR_komponente_0_BASEADDR // defined in xparamet=
ers_ml41x.h
> #define REG_HIGH 	(u32) XPAR_komponente_0_HIGHADDR // defined in xparamet=
ers_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
> =

> 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
> =

> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> 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.

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

* Re: virtex 4 linux driver bus error
  2008-10-22 12:10 virtex 4 linux driver bus error Mirsad Vejseli
  2008-10-22 23:38 ` John Linn
@ 2008-10-23  4:17 ` Grant Likely
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Likely @ 2008-10-23  4:17 UTC (permalink / raw)
  To: Mirsad Vejseli; +Cc: linuxppc-embedded

On Wed, Oct 22, 2008 at 02:10:12PM +0200, Mirsad Vejseli wrote:
> 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!  
> 
> 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.

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

end of thread, other threads:[~2008-10-23  4:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22 12:10 virtex 4 linux driver bus error Mirsad Vejseli
2008-10-22 23:38 ` John Linn
2008-10-23  4:17 ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).