if (of_machine_is_compatible("keymile,km_kirkwood"))
                km_kirkwood_init();
  
-       of_platform_populate(NULL, kirkwood_dt_match_table,
-                            kirkwood_auxdata_lookup, NULL);
 +      if (of_machine_is_compatible("lacie,inetspace_v2") ||
 +          of_machine_is_compatible("lacie,netspace_v2") ||
 +          of_machine_is_compatible("lacie,netspace_max_v2") ||
 +          of_machine_is_compatible("lacie,netspace_lite_v2") ||
 +          of_machine_is_compatible("lacie,netspace_mini_v2"))
 +              ns2_init();
 +
 +      if (of_machine_is_compatible("mpl,cec4"))
 +              mplcec4_init();
 +
 +      if (of_machine_is_compatible("plathome,openblocks-a6"))
 +              openblocks_a6_init();
 +
 +      if (of_machine_is_compatible("usi,topkick"))
 +              usi_topkick_init();
 +
 +      if (of_machine_is_compatible("zyxel,nsa310"))
 +              nsa310_init();
 +
+       of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
  }
  
 -static const char *kirkwood_dt_board_compat[] = {
 +static const char * const kirkwood_dt_board_compat[] = {
        "globalscale,dreamplug",
        "dlink,dns-320",
        "dlink,dns-325",
 
   */
  #define MV_XOR_TEST_SIZE 2000
  
- static int mv_xor_memcpy_self_test(struct mv_xor_device *device)
 -static int __devinit mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
++static int mv_xor_memcpy_self_test(struct mv_xor_chan *mv_chan)
  {
        int i;
        void *src, *dest;
  }
  
  #define MV_XOR_NUM_SRC_TEST 4 /* must be <= 15 */
 -static int __devinit
 +static int
- mv_xor_xor_self_test(struct mv_xor_device *device)
+ mv_xor_xor_self_test(struct mv_xor_chan *mv_chan)
  {
        int i, src_idx;
        struct page *dest;
  
        writel(win_enable, base + WINDOW_BAR_ENABLE(0));
        writel(win_enable, base + WINDOW_BAR_ENABLE(1));
+       writel(0, base + WINDOW_OVERRIDE_CTRL(0));
+       writel(0, base + WINDOW_OVERRIDE_CTRL(1));
  }
  
- static struct platform_driver mv_xor_driver = {
-       .probe          = mv_xor_probe,
-       .remove         = mv_xor_remove,
-       .driver         = {
-               .owner  = THIS_MODULE,
-               .name   = MV_XOR_NAME,
-       },
- };
- 
- static int mv_xor_shared_probe(struct platform_device *pdev)
 -static int __devinit mv_xor_probe(struct platform_device *pdev)
++static int mv_xor_probe(struct platform_device *pdev)
  {
        const struct mbus_dram_target_info *dram;
-       struct mv_xor_shared_private *msp;
+       struct mv_xor_device *xordev;
+       struct mv_xor_platform_data *pdata = pdev->dev.platform_data;
        struct resource *res;
+       int i, ret;
  
-       dev_printk(KERN_NOTICE, &pdev->dev, "Marvell shared XOR driver\n");
+       dev_notice(&pdev->dev, "Marvell XOR driver\n");
  
-       msp = devm_kzalloc(&pdev->dev, sizeof(*msp), GFP_KERNEL);
-       if (!msp)
+       xordev = devm_kzalloc(&pdev->dev, sizeof(*xordev), GFP_KERNEL);
+       if (!xordev)
                return -ENOMEM;
  
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        /* Not all platforms can gate the clock, so it is not
         * an error if the clock does not exists.
         */
-       msp->clk = clk_get(&pdev->dev, NULL);
-       if (!IS_ERR(msp->clk))
-               clk_prepare_enable(msp->clk);
+       xordev->clk = clk_get(&pdev->dev, NULL);
+       if (!IS_ERR(xordev->clk))
+               clk_prepare_enable(xordev->clk);
+ 
+       if (pdev->dev.of_node) {
+               struct device_node *np;
+               int i = 0;
+ 
+               for_each_child_of_node(pdev->dev.of_node, np) {
+                       dma_cap_mask_t cap_mask;
+                       int irq;
+ 
+                       dma_cap_zero(cap_mask);
+                       if (of_property_read_bool(np, "dmacap,memcpy"))
+                               dma_cap_set(DMA_MEMCPY, cap_mask);
+                       if (of_property_read_bool(np, "dmacap,xor"))
+                               dma_cap_set(DMA_XOR, cap_mask);
+                       if (of_property_read_bool(np, "dmacap,memset"))
+                               dma_cap_set(DMA_MEMSET, cap_mask);
+                       if (of_property_read_bool(np, "dmacap,interrupt"))
+                               dma_cap_set(DMA_INTERRUPT, cap_mask);
+ 
+                       irq = irq_of_parse_and_map(np, 0);
+                       if (!irq) {
+                               ret = -ENODEV;
+                               goto err_channel_add;
+                       }
+ 
+                       xordev->channels[i] =
+                               mv_xor_channel_add(xordev, pdev, i,
+                                                  cap_mask, irq);
+                       if (IS_ERR(xordev->channels[i])) {
+                               ret = PTR_ERR(xordev->channels[i]);
+                               xordev->channels[i] = NULL;
+                               irq_dispose_mapping(irq);
+                               goto err_channel_add;
+                       }
+ 
+                       i++;
+               }
+       } else if (pdata && pdata->channels) {
+               for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
+                       struct mv_xor_channel_data *cd;
+                       int irq;
+ 
+                       cd = &pdata->channels[i];
+                       if (!cd) {
+                               ret = -ENODEV;
+                               goto err_channel_add;
+                       }
+ 
+                       irq = platform_get_irq(pdev, i);
+                       if (irq < 0) {
+                               ret = irq;
+                               goto err_channel_add;
+                       }
+ 
+                       xordev->channels[i] =
+                               mv_xor_channel_add(xordev, pdev, i,
+                                                  cd->cap_mask, irq);
+                       if (IS_ERR(xordev->channels[i])) {
+                               ret = PTR_ERR(xordev->channels[i]);
+                               goto err_channel_add;
+                       }
+               }
+       }
  
        return 0;
+ 
+ err_channel_add:
+       for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
+               if (xordev->channels[i]) {
+                       if (pdev->dev.of_node)
+                               irq_dispose_mapping(xordev->channels[i]->irq);
+                       mv_xor_channel_remove(xordev->channels[i]);
+               }
+ 
+       clk_disable_unprepare(xordev->clk);
+       clk_put(xordev->clk);
+       return ret;
  }
  
- static int mv_xor_shared_remove(struct platform_device *pdev)
 -static int __devexit mv_xor_remove(struct platform_device *pdev)
++static int mv_xor_remove(struct platform_device *pdev)
  {
-       struct mv_xor_shared_private *msp = platform_get_drvdata(pdev);
+       struct mv_xor_device *xordev = platform_get_drvdata(pdev);
+       int i;
+ 
+       for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) {
+               if (xordev->channels[i])
+                       mv_xor_channel_remove(xordev->channels[i]);
+       }
  
-       if (!IS_ERR(msp->clk)) {
-               clk_disable_unprepare(msp->clk);
-               clk_put(msp->clk);
+       if (!IS_ERR(xordev->clk)) {
+               clk_disable_unprepare(xordev->clk);
+               clk_put(xordev->clk);
        }
  
        return 0;
  }
  
- static struct platform_driver mv_xor_shared_driver = {
-       .probe          = mv_xor_shared_probe,
-       .remove         = mv_xor_shared_remove,
+ #ifdef CONFIG_OF
 -static struct of_device_id mv_xor_dt_ids[] __devinitdata = {
++static struct of_device_id mv_xor_dt_ids[] = {
+        { .compatible = "marvell,orion-xor", },
+        {},
+ };
+ MODULE_DEVICE_TABLE(of, mv_xor_dt_ids);
+ #endif
+ 
+ static struct platform_driver mv_xor_driver = {
+       .probe          = mv_xor_probe,
 -      .remove         = __devexit_p(mv_xor_remove),
++      .remove         = mv_xor_remove,
        .driver         = {
-               .owner  = THIS_MODULE,
-               .name   = MV_XOR_SHARED_NAME,
+               .owner          = THIS_MODULE,
+               .name           = MV_XOR_NAME,
+               .of_match_table = of_match_ptr(mv_xor_dt_ids),
        },
  };