From: David Brownell <[EMAIL PROTECTED]>

 - Correct handling of the NOR-vs-IDE issue:
     * only register devices which are configured
     * don't issue the warning unless it's appropriate

 - Improve IDE registration:
     * fix device tree ... don't forget to set the parent device
     * let init/exit code be removed where practical

The IDE setup is still wrongly EVM-specific, not generic.

Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Kevin Hilman <[EMAIL PROTECTED]>
---
 arch/arm/mach-davinci/board-evm.c |   19 +++++++++++++++++++
 drivers/ide/arm/palm_bk3710.c     |    7 +++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-davinci/board-evm.c 
b/arch/arm/mach-davinci/board-evm.c
index 0e15e6c..686593f 100644
--- a/arch/arm/mach-davinci/board-evm.c
+++ b/arch/arm/mach-davinci/board-evm.c
@@ -43,6 +43,9 @@ void __init davinci_irq_init(void);
 void __init davinci_map_common_io(void);
 void __init davinci_init_common_hw(void);
 
+#if defined(CONFIG_MTD_PHYSMAP) || \
+    defined(CONFIG_MTD_PHYSMAP_MODULE)
+
 static struct mtd_partition davinci_evm_norflash_partitions[] = {
        /* bootloader (U-Boot, etc) in first 4 sectors */
        {
@@ -98,6 +101,8 @@ static struct platform_device davinci_evm_norflash_device = {
        .resource       = &davinci_evm_norflash_resource,
 };
 
+#endif
+
 #if defined(CONFIG_MTD_NAND_DAVINCI) || defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
 struct mtd_partition davinci_evm_nandflash_partition[] = {
        /* 5 MB space at the beginning for bootloader and kernel */
@@ -202,6 +207,9 @@ static struct platform_device rtc_dev = {
        .id             = -1,
 };
 
+#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
+    defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
+
 static struct resource ide_resources[] = {
        {
                .start          = DAVINCI_CFC_ATA_BASE,
@@ -222,6 +230,8 @@ static struct platform_device ide_dev = {
        .num_resources  = ARRAY_SIZE(ide_resources),
 };
 
+#endif
+
 /*----------------------------------------------------------------------*/
 
 /*
@@ -457,7 +467,10 @@ static struct i2c_board_info __initdata i2c_info[] =  {
 };
 
 static struct platform_device *davinci_evm_devices[] __initdata = {
+#if defined(CONFIG_MTD_PHYSMAP) || \
+    defined(CONFIG_MTD_PHYSMAP_MODULE)
        &davinci_evm_norflash_device,
+#endif
 #if defined(CONFIG_MTD_NAND_DAVINCI) || defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
        &davinci_evm_nandflash_device,
 #endif
@@ -468,7 +481,10 @@ static struct platform_device *davinci_evm_devices[] 
__initdata = {
        &usb_dev,
 #endif
        &rtc_dev,
+#if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
+    defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
        &ide_dev,
+#endif
 };
 
 static struct davinci_uart_config davinci_evm_uart_config __initdata = {
@@ -491,9 +507,12 @@ static __init void davinci_evm_init(void)
 
 #if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \
     defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE)
+#if defined(CONFIG_MTD_PHYSMAP) || \
+    defined(CONFIG_MTD_PHYSMAP_MODULE)
        printk(KERN_WARNING "WARNING: both IDE and NOR flash are enabled, "
               "but share pins.\n\t Disable IDE for NOR support.\n");
 #endif
+#endif
 
        platform_add_devices(davinci_evm_devices,
                             ARRAY_SIZE(davinci_evm_devices));
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c
index 581a7d1..ff3124d 100644
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -343,7 +343,7 @@ static struct ide_port_info __devinitdata 
palm_bk3710_port_info = {
        .mwdma_mask             = ATA_MWDMA2,
 };
 
-static int __devinit palm_bk3710_probe(struct platform_device *pdev)
+static int __init palm_bk3710_probe(struct platform_device *pdev)
 {
        struct clk *clk;
        struct resource *mem, *irq;
@@ -390,6 +390,7 @@ static int __devinit palm_bk3710_probe(struct 
platform_device *pdev)
        hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET;
        hw.irq = irq->start;
        hw.chipset = ide_palm3710;
+       hw.dev = &pdev->dev;
 
        palm_bk3710_port_info.udma_mask = rate < 100000000 ? ATA_UDMA4 :
                                                             ATA_UDMA5;
@@ -412,13 +413,11 @@ static struct platform_driver platform_bk_driver = {
                .name = "palm_bk3710",
                .owner = THIS_MODULE,
        },
-       .probe = palm_bk3710_probe,
-       .remove = NULL,
 };
 
 static int __init palm_bk3710_init(void)
 {
-       return platform_driver_register(&platform_bk_driver);
+       return platform_driver_probe(&platform_bk_driver, palm_bk3710_probe);
 }
 
 module_init(palm_bk3710_init);
-- 
1.5.6.4


_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to