I add some other info on my problem, so I hope that someone can help me.
I set up Flexbus chip select in this way:
CS1 --> BASE 0x90000000 with 64K window
CS2 --> BASE 0x90010000 with 64K window
CS3 --> BASE 0x90020000 with 64K window
This is my code extracted from 'arch/m68k/coldfire/m5445x/config.c' to set up chip select on Flexbus:
#if defined(CONFIG_PERIPHERAL_1) || defined(CONFIG_PERIPHERAL_1_MODULE)
MCF_FBCS_CSAR(1) = PERIPHERAL_1_BASE_PHY;
MCF_FBCS_CSMR(1) = MCF_FBCS_CSMR_BAM_64K | MCF_FBCS_CSMR_V;
MCF_FBCS_CSCR(1) = MCF_FBCS_CSCR_WRAH(0x00) |
MCF_FBCS_CSCR_RDAH(0x00) |
MCF_FBCS_CSCR_ASET(0x01) |
MCF_FBCS_CSCR_WS(0x00) |
MCF_FBCS_CSCR_AA |
MCF_FBCS_CSCR_PS_32 |
MCF_FBCS_CSCR_BEM;
#endif
#if defined(CONFIG_PERIPHERAL_2) || defined(CONFIG_PERIPHERAL_2_MODULE)
MCF_FBCS_CSAR(2) = PERIPHERAL_2_BASE_PHY;
MCF_FBCS_CSMR(2) = MCF_FBCS_CSMR_BAM_64K | MCF_FBCS_CSMR_V;
MCF_FBCS_CSCR(2) = MCF_FBCS_CSCR_WRAH(0x00) |
MCF_FBCS_CSCR_RDAH(0x00) |
MCF_FBCS_CSCR_ASET(0x01) |
MCF_FBCS_CSCR_WS(0x00) |
MCF_FBCS_CSCR_AA |
MCF_FBCS_CSCR_PS_32 |
MCF_FBCS_CSCR_BEM;
#endif
#if defined(CONFIG_PERIPHERAL_3) || defined(CONFIG_PERIPHERAL_3_MODULE)
MCF_FBCS_CSAR(3) = PERIPHERAL_3_BASE_PHY;
MCF_FBCS_CSMR(3) = MCF_FBCS_CSMR_BAM_64K | MCF_FBCS_CSMR_V;
MCF_FBCS_CSCR(3) = MCF_FBCS_CSCR_WRAH(0x00) |
MCF_FBCS_CSCR_RDAH(0x00) |
MCF_FBCS_CSCR_ASET(0x01) |
MCF_FBCS_CSCR_WS(0x00) |
MCF_FBCS_CSCR_AA |
MCF_FBCS_CSCR_PS_32 |
MCF_FBCS_CSCR_BEM;
#endif
Then in my drivers, I did 'ioremap()' ro remap this physical address to virtual kernel address in this way:
static void * __iomem bus_va_base = NULL;
/* Remap I/O devices */
if (!request_mem_region(PERIPHERAL_1_BASE_PHY, PAGE_SIZE, "peripheral_1")) {
printk(KERN_ERR "peripheral_1: request mem region failed");
sts = -EINVAL;
goto init_fail;
}
bus_va_base = ioremap(PERIPHERAL_1_BASE_PHY,PAGE_SIZE);
if(!bus_va_base){
printk("Can't map device!!!");
goto init_fail2;
}
Then to write on that virtual address I use iowrite32be()/ioread32be() functions.
Debugging with Trace32, I can see that bus_va_base have 0xD0000000 as virtual address of PERIPHERAL_1_BASE_PHY (0x90000000). Note that 0xD0000000 is where KMAP_START begin. I think that is everything is right, or not? Why I can't write to bus with addresses class?
Why, instead, if I choose as physical address 0xD0000000 and I remap it, can I write to bus?
At this point I can't understand how memory is mapped on m68k with Linux. I had some experience with ppc and arm, and Linux ran at 0xC0000000.
In m68k/coldfire arch, instead, Linux run at 0x40000000 with 1:1 map to SDRAM (SDRAM physical address is 0x40000000), so how virtual memory works?
Sorry for my bad english.
Thank you very much again.