W dniu 7 czerwca 2011 00:00 uÅytkownik Hauke Mehrtens <hauke@xxxxxxxxxx> napisaÅ: > On 06/06/2011 12:22 PM, RafaÅ MiÅecki wrote: >>> + Â Â Â if (bus->hosttype == BCMA_HOSTTYPE_EMBEDDED) { >>> + Â Â Â Â Â Â Â iounmap(bus->mmio); >>> + Â Â Â Â Â Â Â mmio = ioremap(BCMA_ADDR_BASE, BCMA_CORE_SIZE * bus->nr_cores); >>> + Â Â Â Â Â Â Â if (!mmio) >>> + Â Â Â Â Â Â Â Â Â Â Â return -ENOMEM; >>> + Â Â Â Â Â Â Â bus->mmio = mmio; >>> + >>> + Â Â Â Â Â Â Â mmio = ioremap(BCMA_WRAP_BASE, BCMA_CORE_SIZE * bus->nr_cores); >>> + Â Â Â Â Â Â Â if (!mmio) >>> + Â Â Â Â Â Â Â Â Â Â Â return -ENOMEM; >>> + Â Â Â Â Â Â Â bus->host_embedded = mmio; >> >> Do we really need both? mmio and host_embedded? What about keeping >> mmio only and using it in calculation for read/write[8,16,32]? > > These are two different memory regions, it should be possible to > calculate the other address, but I do not like that. As host_embedded is > in a union this does not waste any memory. Ah, OK, I can see what does happen here. You are using: 1) bus->mmio for first core 2) bus->host_embedded for first agent/wrapper I'm not sure if this is a correct approach. Doing "core_index * BCMA_CORE_SIZE" comes from ssb, where it was the way to calculate offset. In case of BCMA we are reading all the info from (E)EPROM, which also includes addresses of the cores. IMO you should use core->addr and core->wrap for read/write ops. I believe this is approach Broadcom decided to use for BCMA, when designing (E)EPROM. You should not need bus->host_embedded then, maybe you could even do not set bus->mmio? -- RafaÅ