[Desire Android Development] maxrfon:
Hi,

I am trying to make custom mtd module, to expand the mtd devices to read whole nand and i am using as an example msm_nand.c

So what i have done is added a few devices to mtd partition and compiled. But at the compilation ld says msm_dmov_exec_cmd in not found.. Does not sound good, because original msm_nand.c compiled good as well as the whole kernel.

Could someone help me?

Here is the code i added, i left last lines from the original and my addition due to the code length restriction here:

/* drivers/mtd/devices/msm_nand.c
.....

msm_nand_release_ex(&info->mtd);
dma_free_coherent(/*dev*/ NULL, SZ_4K,
info->msm_nand.dma_buffer,
info->msm_nand.dma_addr);
kfree(info);
}

return 0;
}

#define DRIVER_NAME "msm_nand_ex"

static struct platform_driver msm_nand_driver = {
.probe	= msm_nand_probe,
.remove	= __devexit_p(msm_nand_remove_ex),
.driver = {
.name	= DRIVER_NAME,
}
};

MODULE_ALIAS(DRIVER_NAME);

#if defined(CONFIG_ARCH_MSM7X30)
#define MSM_NAND_PHYS	0xA0200000
#else
#define MSM_NAND_PHYS	0xA0A00000
#endif

static struct resource resources_nand[] = {
[0] = {
.name = "msm_nand_dmac",
.start	= DMOV_NAND_CHAN,
.end	= DMOV_NAND_CHAN,
.flags	= IORESOURCE_DMA,
},
[1] = {
.name = "msm_nand_phys",
.start = MSM_NAND_PHYS,
.end = MSM_NAND_PHYS + 0x7FF,
.flags = IORESOURCE_MEM,
},
};

static struct mtd_partition nand_ex_partitions[] = {
{
.name = "bootloader",
.size = 0x00000016,
.offset = 0,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "amss",
.size = 0x000000bf,
.offset = 0x00000016,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "amss_fs",
.size = 0x00000058,
.offset = 0x000000d5,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "fota0",
.size = 0x00000022,
.offset = 0x0000012d,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "fota1",
.size = 0x00000022,
.offset = 0x0000014f,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "recovery",
.size = 0x00000062,
.offset = 0x00000171,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "dsp1",
.size = 0x000000a2,
.offset = 0x000001d3,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}, {
.name = "boot",
.size = 0x00000062,
.offset = 0x00000275,
.mask_flags = MTD_WRITEABLE, /* force read-only */
}
};

struct flash_platform_data msm_nand_ex_data = {
.parts	= nand_ex_partitions,
.nr_parts	= ARRAY_SIZE(nand_ex_partitions),
};

static struct platform_device *msm_device_nand_ex;

static int __init msm_nand_init(void)
{
int ret;
msm_device_nand_ex = platform_device_alloc("msm_nand_ex", -1);
if (!msm_device_nand_ex)
return -ENOMEM;

ret = platform_device_add_data(msm_device_nand_ex, &msm_nand_ex_data,
sizeof(msm_nand_ex_data));

ret = platform_device_add_resources(msm_device_nand_ex, resources_nand,
ARRAY_SIZE(resources_nand));
printk("%s : res=%d\n", __FUNCTION__, ARRAY_SIZE(resources_nand));

if (ret == 0)
ret = platform_device_add(msm_device_nand_ex);

if (ret){
platform_device_put(msm_device_nand_ex);
return ret;
}

return platform_driver_register(&msm_nand_driver);
}

static void __exit msm_nand_exit(void)
{
platform_driver_unregister(&msm_nand_driver);
platform_device_unregister(msm_device_nand_ex);
}

module_init(msm_nand_init);
module_exit(msm_nand_exit);

MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("msm_nand flash driver code");

And also i get in dmesg weird message that my kernel version string is wrong, though i used same kernel except the last modification string. And i can't find any other kernel..

Thanks guys!