Hello,
I try to connect an FPGA to the Pandaboard gpmc. At the moment I just stuck to get the gpmc of the omap running.
This is the test module witch I use (without DMA), for now I just want to see the data signals of the gpmc changing when loading the module.
But unfortunately nothing happens on AD0 to AD15 or CLK
#define MY_CS 0
#define GPMC_SYSCONFIG 0x10
#define DA_M1 0x05
#define GPMC_CONFIG 0x50
#define GPMC_CS0_OFFSET 0x60
#define GPMC_CS_SIZE 0x30
#define GPMC_REVISION 0x00
static void __iomem *gpmc_base;
static void __iomem *gpmc_cs4_base=0;
unsigned long cs4_mem_base;
static struct clk *gpmc_l3_clk;
void gpmc_cs_write_reg(int cs, int idx, u32 val)
{
void __iomem *reg_addr;
reg_addr = gpmc_base + GPMC_CS0_OFFSET + (cs * GPMC_CS_SIZE) + idx;
__raw_writel(val, reg_addr);
}
static u32 gpmc_read_reg(int idx)
{
return __raw_readl(gpmc_base + idx);
}
static void gpmc_write_reg(int idx, u32 val)
{
__raw_writel(val, gpmc_base + idx);
}
int my_gpmc_init()
{
gpmc_write_reg(GPMC_SYSCONFIG, 0x18); // SIDLEMODE Do not use
gpmc_write_reg(GPMC_CONFIG, 0x12);
//sychronous,16bit,NOR,no multiplexed,GPMC_CLK==GPMC_
gpmc_cs_write_reg(MY_CS, GPMC_CS_CONFIG1,0x28001000);
//asychronous,16bit,NOR,no multiplexed,GPMC_CLK==GPMC_FCLK
//gpmc_cs_write_reg(MY_CS, GPMC_CS_CONFIG1,0x00001000);
if (gpmc_cs_request(MY_CS, SZ_16M, &cs4_mem_base) < 0)
{
printk("<1>Failed to request GPMC mem for cs4\n");
return -1;
}
printk("<1>cs4_mem_base:%x\n",cs4_mem_base);
gpmc_cs4_base=ioremap(cs4_mem_base,SZ_16M);
return 0;
}
int init_gpmc_module(void)
{
u32 l;
char *ck = NULL;
int i = 0;
l = OMAP44XX_GPMC_BASE;
printk("<1>OMAP44XX_GPMC_BASE:%x", OMAP44XX_GPMC_BASE);
ck = "gpmc_ck";
if (WARN_ON(!ck))
return -1;
gpmc_l3_clk = clk_get(NULL, ck);
if (IS_ERR(gpmc_l3_clk)) {
printk(KERN_ERR "Could not get GPMC clock %s\n", ck);
}
gpmc_base = ioremap(l, SZ_4K);
if (!gpmc_base) {
clk_put(gpmc_l3_clk);
printk(KERN_ERR "Could not get GPMC register memory\n");
}
printk("<2>gpmc_base:%x",gpmc_base);
clk_enable(gpmc_l3_clk);
l = gpmc_read_reg(GPMC_REVISION);
printk(KERN_INFO "GPMC revision %d.%d\n", (l >> 4) & 0x0f, l & 0x0f);
my_gpmc_init();
printk("my_gpmc_init() FIN");
if(gpmc_cs4_base!=0)
{
printk("<3>gpmc_cs4_base:%x",gpmc_cs4_base);
for(i = 0; i < 10 ; i++)
{
__raw_writel(i, gpmc_cs4_base+ i*4);
}
}
return 0;
}
void cleanup_gpmc_module(void)
{
gpmc_cs_free(MY_CS);
printk("<1>cleanup module ......\n");
}
module_init(init_gpmc_module);
module_exit(cleanup_gpmc_module);
I configure the alt gpmc related IOs to mux mode0
cd /sys/kernel/debug/omap_mux
sudo echo 0x00 > gpmc_ad0
sudo echo 0x00 > gpmc_ad1
..
..
The kernel output is the following
[ 1013.248565] OMAP44XX_GPMC_BASE:50000000
[ 1013.252624] gpmc_base:f01f6000
[ 1013.256164] GPMC revision 6.0
[ 1013.256408] cs4_mem_base:1000000
[ 1013.260925] my_gpmc_init() FIN
[ 1013.260925] gpmc_cs4_base:f4000000
Dose anybody know what is missing or wrong with this code ?
I use panda ES omap4460
Thanks for your help!