MPC8313 and IO mapping a localbus space.
Hi,
I'm working on implementing a linux 2.6.23 kernel for a machine based on the MPC8313. It's
basically a clone of the Freescale ERDB dev kit module with the addition of an FPGA on CS3 of the localbus.
(it also has NAND and a FLASH NOR part on the localbus as well).
All of the code is based off of the ltib BSP kit provided by Freescale's 2008-12-22 release.
I am able to address the FPGA in u-boot using "md.w" as well as all the other localbus devices.
However, when I load up linux, I can't seem to map in the FPGA and read or write to it. I don't bus error,
I just get zeros.
The driver code is pretty basic (below), and I've verified that the LBLAWARx and LBLAWBARx registers
match what was set in u-boot. I've also verified that the eLBC ORx and BRx registers match.
The only thing that seems to be missing is that there aren't entries in the BATs for anything
but the SDRAM. This is a bit confusing because I seem to be able to read from NAND and NOR
mtd devices without any issues.
Is there more that I need to do beyond an ioremap() to map in the address space?
Thanks.
-Mike
#define HW_FPGA 0xfa000000
#define HW_FPGA_SIZE 32768
static int __init mapfpga_load(void)
{
u16 tmp;
int res = 0;
printk(KERN_ALERT "%s: loading\n", dev_name);
mapfpga_dev.fpgaimg_res = request_mem_region(HW_FPGA,
HW_FPGA_SIZE, dev_name);
if (mapfpga_dev.fpgaimg_res == NULL) {
printk(KERN_ALERT "%s: could not request memory region"
" 0x%08x\n", dev_name, HW_FPGA);
res = -EINVAL;
goto out;
}
mapfpga_dev.fpgaimg = ioremap_nocache(HW_FPGA, HW_FPGA_SIZE);
if (mapfpga_dev.fpgaimg == NULL) {
printk(KERN_ALERT "%s: could not map i/o region"
" 0x%08x\n", dev_name, HW_FPGA);
res = -EINVAL;
goto out;
}
/* this should generate a non-zero number, it's a version register */
tmp = ioread16(mapfpga_dev.fpgaimg); /* always zero... */
...
}Signature · 3 lines
Michael Williamson 315-425-4045x230 www.criticallink.com