linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MPC8555CDS & CCSRBAR
@ 2005-08-09 14:04 Eric Kampman
  2005-08-09 14:15 ` Gerhard Jaeger
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Kampman @ 2005-08-09 14:04 UTC (permalink / raw)
  To: linuxppc-embedded

Trying to port an SEC driver to Linux/PPC8555. Reading
the default CCSRBAR @ 0xFF700000 I read 0xFFFFFFFF
which is wrong. Looking at Metrowerks init files and
uboot code (1.1.2) I see it's likely been moved to
0xE0000000, but I get a seg fault when I try to read
there. 

So, what am I doing wrong, and even better, how do I
at runtime find out where CCSRBAR is? Thanks in
advance, and please forgive the likely ignorance, 

Eric


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

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

* Re: MPC8555CDS & CCSRBAR
  2005-08-09 14:04 MPC8555CDS & CCSRBAR Eric Kampman
@ 2005-08-09 14:15 ` Gerhard Jaeger
  2005-08-09 14:33   ` Kumar Gala
  2005-08-09 15:53   ` Clemens Koller
  0 siblings, 2 replies; 5+ messages in thread
From: Gerhard Jaeger @ 2005-08-09 14:15 UTC (permalink / raw)
  To: linuxppc-embedded; +Cc: Eric Kampman

On Tuesday 09 August 2005 16:04, Eric Kampman wrote:
> Trying to port an SEC driver to Linux/PPC8555. Reading
> the default CCSRBAR @ 0xFF700000 I read 0xFFFFFFFF
> which is wrong. Looking at Metrowerks init files and
> uboot code (1.1.2) I see it's likely been moved to
> 0xE0000000, but I get a seg fault when I try to read
> there. 
> 
> So, what am I doing wrong, and even better, how do I
> at runtime find out where CCSRBAR is? Thanks in
> advance, and please forgive the likely ignorance, 
> 
> Eric
> 

use the get_ccsrbar() function to get the address, then ioremap()
will be your friend ;)

HTH
Gerhard


-- 
Gerhard Jaeger <gjaeger@sysgo.com>            
SYSGO AG                      Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.pikeos.com | www.osek.de 

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

* Re: MPC8555CDS & CCSRBAR
  2005-08-09 14:15 ` Gerhard Jaeger
@ 2005-08-09 14:33   ` Kumar Gala
  2005-08-09 15:53   ` Clemens Koller
  1 sibling, 0 replies; 5+ messages in thread
From: Kumar Gala @ 2005-08-09 14:33 UTC (permalink / raw)
  To: Gerhard Jaeger; +Cc: Eric Kampman, linuxppc-embedded


On Aug 9, 2005, at 9:15 AM, Gerhard Jaeger wrote:

> On Tuesday 09 August 2005 16:04, Eric Kampman wrote:
>
>> Trying to port an SEC driver to Linux/PPC8555. Reading
>> the default CCSRBAR @ 0xFF700000 I read 0xFFFFFFFF
>> which is wrong. Looking at Metrowerks init files and
>> uboot code (1.1.2) I see it's likely been moved to
>> 0xE0000000, but I get a seg fault when I try to read
>> there.
>>
>> So, what am I doing wrong, and even better, how do I
>> at runtime find out where CCSRBAR is? Thanks in
>> advance, and please forgive the likely ignorance,
>>
>> Eric
>>
>>
>
> use the get_ccsrbar() function to get the address, then ioremap()
> will be your friend ;)

Depending on the kernel version you might want to use the driver  
model instead.  There is an entry for the security engine which will  
give you the physical address to ioremap and the interrupt number to  
use.  Doing this will be more portable.  However, this is only in  
newer 2.6 kernels.

- kumar

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

* Re: MPC8555CDS & CCSRBAR
  2005-08-09 14:15 ` Gerhard Jaeger
  2005-08-09 14:33   ` Kumar Gala
@ 2005-08-09 15:53   ` Clemens Koller
  2005-08-09 16:04     ` Kim Phillips
  1 sibling, 1 reply; 5+ messages in thread
From: Clemens Koller @ 2005-08-09 15:53 UTC (permalink / raw)
  To: Gerhard Jaeger; +Cc: Eric Kampman, linuxppc-embedded

Hi!

You might want to try that:

#include <asm/mpc85xx.h>
#include <immap_85xx.h>		/* see mail archives for complete mpc8540 version */
...

void foo(void)
{
	volatile ccsr_t *immap;
	phys_addr_t ccsrbar;

	ccsrbar=get_ccsrbar();
        immap=ioremap(ccsrbar,sizeof(ccsr_t));	/* is ioremap_nochache() the same on mpc85xx? */
        if (!immap) {
                printk(KERN_ALERT "Failed to ioremap CCSRBAR!\n");
                err = -EIO;
                goto out;
        }

	/* examples */
        printk(KERN_INFO "CCSRBAR addr        %.8lx\n",ccsrbar);
	printk(KERN_INFO "IMMAP addr          %p\n",immap);
	printk(KERN_INFO "BR0        %.8x\n",immap->im_lbc.br0);
	printk(KERN_INFO "OR0        %.8x\n",immap->im_lbc.or0);

	/* unmap the ccsr*/
	iounmap(immap);
out:
}

I hope that's all current code.
Comments are welcome.

Greets,

Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19


Gerhard Jaeger wrote:
> On Tuesday 09 August 2005 16:04, Eric Kampman wrote:
> 
>>Trying to port an SEC driver to Linux/PPC8555. Reading
>>the default CCSRBAR @ 0xFF700000 I read 0xFFFFFFFF
>>which is wrong. Looking at Metrowerks init files and
>>uboot code (1.1.2) I see it's likely been moved to
>>0xE0000000, but I get a seg fault when I try to read
>>there. 
>>
>>So, what am I doing wrong, and even better, how do I
>>at runtime find out where CCSRBAR is? Thanks in
>>advance, and please forgive the likely ignorance, 
>>
>>Eric
>>
> 
> 
> use the get_ccsrbar() function to get the address, then ioremap()
> will be your friend ;)
> 
> HTH
> Gerhard

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

* Re: MPC8555CDS & CCSRBAR
  2005-08-09 15:53   ` Clemens Koller
@ 2005-08-09 16:04     ` Kim Phillips
  0 siblings, 0 replies; 5+ messages in thread
From: Kim Phillips @ 2005-08-09 16:04 UTC (permalink / raw)
  To: Clemens Koller; +Cc: linuxppc-embedded, erickampman

or this...

static int sec_probe(struct device *device)
{
	struct platform_device *pdev = to_platform_device(device);
	struct resource *r;

	sec_irq = platform_get_irq(pdev, 0);
	rc = request_irq(sc->sc_irq, talitos_intr, 0, "talitos", sc);
	if (rc) {
		printk("failed to hook irq %d\n", sec_irq);
		sec_irq = -1;
		goto out;
	}

	/* we read its hardware registers as memory */
	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);

	sec_base_addr = (ocf_iomem_t) ioremap(r->start, (r->end - r->start));
	if (!sec_base_addr) {
		printk("failed to ioremap 0x%x-0x%x\n",
				(u32)r->start, (u32)r->end - (u32)r->start);
		goto out;
	}
...
}

Kim

On Tue, 09 Aug 2005 17:53:42 +0200
Clemens Koller <clemens.koller@anagramm.de> wrote:

> Hi!
> 
> You might want to try that:
> 
> #include <asm/mpc85xx.h>
> #include <immap_85xx.h>		/* see mail archives for complete mpc8540 version */
> ...
> 
> void foo(void)
> {
> 	volatile ccsr_t *immap;
> 	phys_addr_t ccsrbar;
> 
> 	ccsrbar=get_ccsrbar();
>         immap=ioremap(ccsrbar,sizeof(ccsr_t));	/* is ioremap_nochache() the same on mpc85xx? */
>         if (!immap) {
>                 printk(KERN_ALERT "Failed to ioremap CCSRBAR!\n");
>                 err = -EIO;
>                 goto out;
>         }
> 
> 	/* examples */
>         printk(KERN_INFO "CCSRBAR addr        %.8lx\n",ccsrbar);
> 	printk(KERN_INFO "IMMAP addr          %p\n",immap);
> 	printk(KERN_INFO "BR0        %.8x\n",immap->im_lbc.br0);
> 	printk(KERN_INFO "OR0        %.8x\n",immap->im_lbc.or0);
> 
> 	/* unmap the ccsr*/
> 	iounmap(immap);
> out:
> }
> 
> I hope that's all current code.
> Comments are welcome.
> 
> Greets,
> 
> Clemens Koller
> _______________________________
> R&D Imaging Devices
> Anagramm GmbH
> Rupert-Mayer-Str. 45/1
> 81379 Muenchen
> Germany
> 
> http://www.anagramm.de
> Phone: +49-89-741518-50
> Fax: +49-89-741518-19
> 
> 
> Gerhard Jaeger wrote:
> > On Tuesday 09 August 2005 16:04, Eric Kampman wrote:
> > 
> >>Trying to port an SEC driver to Linux/PPC8555. Reading
> >>the default CCSRBAR @ 0xFF700000 I read 0xFFFFFFFF
> >>which is wrong. Looking at Metrowerks init files and
> >>uboot code (1.1.2) I see it's likely been moved to
> >>0xE0000000, but I get a seg fault when I try to read
> >>there. 
> >>
> >>So, what am I doing wrong, and even better, how do I
> >>at runtime find out where CCSRBAR is? Thanks in
> >>advance, and please forgive the likely ignorance, 
> >>
> >>Eric
> >>
> > 
> > 
> > use the get_ccsrbar() function to get the address, then ioremap()
> > will be your friend ;)
> > 
> > HTH
> > Gerhard
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded


-- 
Kim

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

end of thread, other threads:[~2005-08-09 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-09 14:04 MPC8555CDS & CCSRBAR Eric Kampman
2005-08-09 14:15 ` Gerhard Jaeger
2005-08-09 14:33   ` Kumar Gala
2005-08-09 15:53   ` Clemens Koller
2005-08-09 16:04     ` Kim Phillips

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