]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/openslug-kernel-2.6.11.2/mtd-shutdown.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / openslug-kernel-2.6.11.2 / mtd-shutdown.patch
1 # Ensure that the MTD is shut down on halt/reboot, otherwise the
2 # hardware reset hangs
3
4 --- linux-2.6.12.2/drivers/mtd/maps/ixp4xx.c.orig       2005-07-17 15:07:47.790388300 -0700
5 +++ linux-2.6.12.2/drivers/mtd/maps/ixp4xx.c    2005-07-17 17:00:08.082672710 -0700
6 @@ -144,6 +144,52 @@
7         return 0;
8  }
9  
10 +static void ixp4xx_flash_shutdown(struct device *_dev)
11 +{
12 +       struct platform_device *dev = to_platform_device(_dev);
13 +       struct flash_platform_data *plat = dev->dev.platform_data;
14 +       struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
15 +       map_word d;
16 +
17 +       dev_set_drvdata(&dev->dev, NULL);
18 +
19 +       if(!info)
20 +               return;
21 +
22 +       /*
23 +        * This is required for a soft reboot to work.
24 +        */
25 +       d.x[0] = 0xff;
26 +       ixp4xx_write16(&info->map, d, 0x55 * 0x2);
27 +
28 +#if 0
29 +       /* This is commented out because it seems to cause a kernel
30 +        * panic (at least if it isn't commented out the kernel fails
31 +        * to shut down).  Should be investigated.
32 +        */
33 +       if (info->mtd) {
34 +               del_mtd_partitions(info->mtd);
35 +               map_destroy(info->mtd);
36 +       }
37 +#endif
38 +       if (info->map.map_priv_1)
39 +               iounmap((void *) info->map.map_priv_1);
40 +
41 +       if (info->partitions)
42 +               kfree(info->partitions);
43 +
44 +       if (info->res) {
45 +               release_resource(info->res);
46 +               kfree(info->res);
47 +       }
48 +
49 +       if (plat->exit)
50 +               plat->exit();
51 +
52 +       /* Disable flash write */
53 +       *IXP4XX_EXP_CS0 &= ~IXP4XX_FLASH_WRITABLE;
54 +}
55 +
56  static int ixp4xx_flash_probe(struct device *_dev)
57  {
58         struct platform_device *dev = to_platform_device(_dev);
59 @@ -243,6 +289,7 @@
60         .bus            = &platform_bus_type,
61         .probe          = ixp4xx_flash_probe,
62         .remove         = ixp4xx_flash_remove,
63 +       .shutdown       = ixp4xx_flash_shutdown,
64  };
65  
66  static int __init ixp4xx_flash_init(void)