endchoice
 
 config MTD_NAND_PXA3xx
-       bool "Support for NAND flash devices on PXA3xx"
+       tristate "Support for NAND flash devices on PXA3xx"
        depends on MTD_NAND && PXA3xx
        help
          This enables the driver for the NAND flash device found on
 
 
        this = &info->nand_chip;
        mtd->priv = info;
+       mtd->owner = THIS_MODULE;
 
        info->clk = clk_get(&pdev->dev, NULL);
        if (IS_ERR(info->clk)) {
 {
        struct mtd_info *mtd = platform_get_drvdata(pdev);
        struct pxa3xx_nand_info *info = mtd->priv;
+       struct resource *r;
 
        platform_set_drvdata(pdev, NULL);
 
                                info->data_buff, info->data_buff_phys);
        } else
                kfree(info->data_buff);
+
+       iounmap(info->mmio_base);
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       release_mem_region(r->start, resource_size(r));
+
+       clk_disable(info->clk);
+       clk_put(info->clk);
+
        kfree(mtd);
        return 0;
 }