--- zzzz-none-000/linux-2.6.32.61/drivers/mtd/maps/plat-ram.c 2013-06-10 09:43:48.000000000 +0000 +++ virian-300e-630/linux-2.6.32.61/drivers/mtd/maps/plat-ram.c 2014-08-06 12:33:27.000000000 +0000 @@ -38,6 +38,8 @@ #include +/*--- #define DEBUG_PLAT_RAM ---*/ + /* private structure for each mtd platform ram device created */ struct platram_info { @@ -129,6 +131,30 @@ * called from device drive system when a device matching our * driver is found. */ +void debug_print_memmaps(struct resource *root, int level){ + int i; + char prefix[30]; + + for (i = 0; i < level * 3; i++) { + prefix[i] = ' '; + } + prefix[i] = 0; + + printk("%s [%d]-----------\n",prefix, level); + printk("%s name=%s \n",prefix, root->name ); + printk("%s start=0x%08x \n",prefix, (unsigned int)root->start ); + printk("%s end=0x%08x \n",prefix, (unsigned int)root->end ); + printk("%s flags=%#lx \n",prefix, (long unsigned int)root->flags ); + printk("%s ------------\n", prefix); + if (root->child) { + debug_print_memmaps(root->child, level + 1 ); + } + if (root->sibling) { + debug_print_memmaps(root->sibling, level); + } + return; +} + static int platram_probe(struct platform_device *pdev) { @@ -137,6 +163,7 @@ struct resource *res; int err = 0; + printk("[%s] %d\n ", __FUNCTION__, __LINE__); dev_dbg(&pdev->dev, "probe entered\n"); if (pdev->dev.platform_data == NULL) { @@ -181,10 +208,16 @@ info->map.bankwidth = pdata->bankwidth; /* register our usage of the memory area */ +#if defined(DEBUG_PLAT_RAM) + debug_print_memmaps( &iomem_resource, 0); +#endif info->area = request_mem_region(res->start, info->map.size, pdev->name); if (info->area == NULL) { dev_err(&pdev->dev, "failed to request memory region\n"); +#if defined(DEBUG_PLAT_RAM) + debug_print_memmaps( &iomem_resource, 0); +#endif err = -EIO; goto exit_free; } @@ -192,6 +225,7 @@ /* remap the memory area */ info->map.virt = ioremap(res->start, info->map.size); + printk("[%s] ioremap start=%#x, virt=%#x \n", __FUNCTION__, (unsigned int)res->start, (unsigned int)info->map.virt); dev_dbg(&pdev->dev, "virt %p, %lu bytes\n", info->map.virt, info->map.size); if (info->map.virt == NULL) {