linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Getting the LED light up... (A&M Rattler 8250PCI  linux 2.6.13-AM)
@ 2007-03-04 11:50 Robert Staven
  2007-03-05  8:27 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Staven @ 2007-03-04 11:50 UTC (permalink / raw)
  To: linuxppc-embedded

Got an Analogue & Micro Rattler 8250PCI board running Linux 2.6.13-AM

I'm trying to get the debug LEDs work (LED0-2 connected to PA0-2) but 
havent had any success yet (How #¤@"$! hard can it be to get a LED light 
up...? :)

Port D bit 24 is accessible on the boards expansion connector, and I 
successfully tested my code to use it as gen purpose I/O (both input and 
output).


But when I try to write (change) port A (bit 0-2), nothing changes in 
the register (nor do the LED light up). And my Ethernet FCC1 freezes 
up!! (fs mounted by NFS so I notice)

FCC1 is using a big part of port A, but I'm quite sure I don't touch any 
of those bits (see code below)

I'm a Linux newbie, but I'm starting to wonder if theres any 'lock' or 
something by the kernel on port A?

Any ideas/tips/anything welcome!

br
Robert

PS, I have a hard time find an immap for the 8250, but since the kernel 
and fs compile fine on my toolchain i assume it there somewhere?


---
snips of relevant parts of my code:

(it's written and compiled as a module)

typedef struct io_port {
	ulong	iop_padir;
	ulong	iop_papar;
	ulong	iop_pasor;
	ulong	iop_paodr;
	ulong	iop_padat;
	char	res1[12];
	ulong	iop_pbdir;
	ulong	iop_pbpar;
	ulong	iop_pbsor;
	ulong	iop_pbodr;
	ulong	iop_pbdat;
	char	res2[12];
	ulong	iop_pcdir;
	ulong	iop_pcpar;
	ulong	iop_pcsor;
	ulong	iop_pcodr;
	ulong	iop_pcdat;
	char	res3[12];
	ulong	iop_pddir;
	ulong	iop_pdpar;
	ulong	iop_pdsor;
	ulong	iop_pdodr;
	ulong	iop_pddat;
	//char	res4[12];
} iop8250_t;
#define IOPORT_BASE_ADDR 0x10D00 // Address to first reg in iop8250

volatile iop8250_t *iommap;

#define P0		0x8000 // P0 bit in registers
#define P1		0x4000 // P1 bit in registers
#define P2		0x2000 // P2 bit in registers
#define LED0 P2
#define LED1 P1
#define LED2 P0

iommap = (iop8250_t *)(CPM_MAP_ADDR+IOPORT_BASE_ADDR);

printk("PDIRA (0x%08X) = 0x%08X\n", &(iommap->iop_padir), 
iommap->iop_padir);
printk("PPARA (0x%08X) = 0x%08X\n", &(iommap->iop_papar), 
iommap->iop_papar);
printk("PSORA (0x%08X) = 0x%08X\n", &(iommap->iop_pasor), 
iommap->iop_pasor);
printk("PDATA (0x%08X) = 0x%08X\n", &(iommap->iop_padat), 
iommap->iop_padat);

iommap->iop_papar &= ~LED0; // set PA2 to general I/O
iommap->iop_padir |=  LED0; // set PA2 as output
iommap->iop_padat &= ~LED0; // Clear PA2 / LED0 on

printk("PDATA (0x%08X) = 0x%08X\n", &(iommap->iop_padat), 
iommap->iop_padat);

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

* Re: Getting the LED light up... (A&M Rattler 8250PCI linux 2.6.13-AM)
  2007-03-04 11:50 Getting the LED light up... (A&M Rattler 8250PCI linux 2.6.13-AM) Robert Staven
@ 2007-03-05  8:27 ` Laurent Pinchart
  2007-03-05 11:21   ` Robert Staven
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2007-03-05  8:27 UTC (permalink / raw)
  To: linuxppc-embedded

Hi Robert,

> Got an Analogue & Micro Rattler 8250PCI board running Linux 2.6.13-AM
>
> I'm trying to get the debug LEDs work (LED0-2 connected to PA0-2) but
> havent had any success yet (How #=A4@"$! hard can it be to get a LED light
> up...? :)
>
> Port D bit 24 is accessible on the boards expansion connector, and I
> successfully tested my code to use it as gen purpose I/O (both input and
> output).
>
>
> But when I try to write (change) port A (bit 0-2), nothing changes in
> the register (nor do the LED light up). And my Ethernet FCC1 freezes
> up!! (fs mounted by NFS so I notice)
>
> FCC1 is using a big part of port A, but I'm quite sure I don't touch any
> of those bits (see code below)
>
> I'm a Linux newbie, but I'm starting to wonder if theres any 'lock' or
> something by the kernel on port A?
>
> Any ideas/tips/anything welcome!
>
> br
> Robert
>
> PS, I have a hard time find an immap for the 8250, but since the kernel
> and fs compile fine on my toolchain i assume it there somewhere?
>
>
> ---
> snips of relevant parts of my code:
>
> (it's written and compiled as a module)
>
> typedef struct io_port {
> 	ulong	iop_padir;
> 	ulong	iop_papar;
> 	ulong	iop_pasor;
> 	ulong	iop_paodr;
> 	ulong	iop_padat;
> 	char	res1[12];
> 	ulong	iop_pbdir;
> 	ulong	iop_pbpar;
> 	ulong	iop_pbsor;
> 	ulong	iop_pbodr;
> 	ulong	iop_pbdat;
> 	char	res2[12];
> 	ulong	iop_pcdir;
> 	ulong	iop_pcpar;
> 	ulong	iop_pcsor;
> 	ulong	iop_pcodr;
> 	ulong	iop_pcdat;
> 	char	res3[12];
> 	ulong	iop_pddir;
> 	ulong	iop_pdpar;
> 	ulong	iop_pdsor;
> 	ulong	iop_pdodr;
> 	ulong	iop_pddat;
> 	//char	res4[12];
> } iop8250_t;
> #define IOPORT_BASE_ADDR 0x10D00 // Address to first reg in iop8250
>
> volatile iop8250_t *iommap;
>
> #define P0		0x8000 // P0 bit in registers
> #define P1		0x4000 // P1 bit in registers
> #define P2		0x2000 // P2 bit in registers

Shouldn't that be

#define P0		0x80000000 // P0 bit in registers
#define P1		0x40000000 // P1 bit in registers
#define P2		0x20000000 // P2 bit in registers

?

> #define LED0 P2
> #define LED1 P1
> #define LED2 P0
>
> iommap =3D (iop8250_t *)(CPM_MAP_ADDR+IOPORT_BASE_ADDR);
>
> printk("PDIRA (0x%08X) =3D 0x%08X\n", &(iommap->iop_padir),
> iommap->iop_padir);
> printk("PPARA (0x%08X) =3D 0x%08X\n", &(iommap->iop_papar),
> iommap->iop_papar);
> printk("PSORA (0x%08X) =3D 0x%08X\n", &(iommap->iop_pasor),
> iommap->iop_pasor);
> printk("PDATA (0x%08X) =3D 0x%08X\n", &(iommap->iop_padat),
> iommap->iop_padat);
>
> iommap->iop_papar &=3D ~LED0; // set PA2 to general I/O
> iommap->iop_padir |=3D  LED0; // set PA2 as output
> iommap->iop_padat &=3D ~LED0; // Clear PA2 / LED0 on
>
> printk("PDATA (0x%08X) =3D 0x%08X\n", &(iommap->iop_padat),
> iommap->iop_padat);

Cheers,

Laurent Pinchart

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

* Re: Getting the LED light up... (A&M Rattler 8250PCI linux 2.6.13-AM)
  2007-03-05  8:27 ` Laurent Pinchart
@ 2007-03-05 11:21   ` Robert Staven
  0 siblings, 0 replies; 3+ messages in thread
From: Robert Staven @ 2007-03-05 11:21 UTC (permalink / raw)
  To: linuxppc-embedded

 >> #define P0        0x8000 // P0 bit in registers
 >> #define P1        0x4000 // P1 bit in registers
 >> #define P2        0x2000 // P2 bit in registers
 >
 >
 > Shouldn't that be
 > #define P0        0x80000000 // P0 bit in registers
 > #define P1        0x40000000 // P1 bit in registers
 > #define P2        0x20000000 // P2 bit in registers
 > ?

<shamed>Hmmm, next time I'll better use my calculator figuring out how 
many digits there is in a 32bit hex number... :P </shamed>

Many thanks for the assistance Laurent! (the LED came to life)

And you all may have a good long laugh of me now, I deserve it! :)

br
Robert

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

end of thread, other threads:[~2007-03-05 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-04 11:50 Getting the LED light up... (A&M Rattler 8250PCI linux 2.6.13-AM) Robert Staven
2007-03-05  8:27 ` Laurent Pinchart
2007-03-05 11:21   ` Robert Staven

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).