ps3: Update kernel to linux-2.6.30
[lede.git] / target / linux / ps3 / patches-2.6.28 / 0013-mtd-ps3vram-Use-_PAGE_NO_CACHE-in-memory-ioremap.patch
1 From 2efd72af0f18860927084df618f7419c82f69be3 Mon Sep 17 00:00:00 2001
2 From: Geoff Levand <geoffrey.levand@am.sony.com>
3 Date: Wed, 7 Jan 2009 17:22:07 -0800
4 Subject: [PATCH] mtd/ps3vram: Use _PAGE_NO_CACHE in memory ioremap
5
6 Use _PAGE_NO_CACHE for gpu memory ioremap.  Also,
7 add __iomem attribute to gpu memory pointer and
8 change use of memset() to memset_io().
9
10 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
11 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
12 ---
13  drivers/mtd/devices/ps3vram.c |   14 ++++++++------
14  1 files changed, 8 insertions(+), 6 deletions(-)
15
16 diff --git a/drivers/mtd/devices/ps3vram.c b/drivers/mtd/devices/ps3vram.c
17 index d592414..d21e9be 100644
18 --- a/drivers/mtd/devices/ps3vram.c
19 +++ b/drivers/mtd/devices/ps3vram.c
20 @@ -6,6 +6,7 @@
21   */
22  
23  #include <linux/io.h>
24 +#include <linux/mm.h>
25  #include <linux/init.h>
26  #include <linux/kernel.h>
27  #include <linux/list.h>
28 @@ -69,7 +70,7 @@ struct ps3vram_priv {
29         u64 context_handle;
30         u32 *ctrl;
31         u32 *reports;
32 -       u8 *base;
33 +       u8 __iomem *ddr_base;
34         u8 *xdr_buf;
35  
36         u32 *fifo_base;
37 @@ -425,7 +426,7 @@ static int ps3vram_erase(struct mtd_info *mtd, struct erase_info *instr)
38         ps3vram_cache_flush(mtd);
39  
40         /* Set bytes to 0xFF */
41 -       memset(priv->base + instr->addr, 0xFF, instr->len);
42 +       memset_io(priv->ddr_base + instr->addr, 0xFF, instr->len);
43  
44         mutex_unlock(&priv->lock);
45  
46 @@ -628,8 +629,9 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
47                 goto out_free_context;
48         }
49  
50 -       priv->base = ioremap(ddr_lpar, ddr_size);
51 -       if (!priv->base) {
52 +       priv->ddr_base = ioremap_flags(ddr_lpar, ddr_size, _PAGE_NO_CACHE);
53 +
54 +       if (!priv->ddr_base) {
55                 dev_err(&dev->core, "%s:%d: ioremap failed\n", __func__,
56                         __LINE__);
57                 ret = -ENOMEM;
58 @@ -702,7 +704,7 @@ out_unmap_reports:
59  out_unmap_ctrl:
60         iounmap(priv->ctrl);
61  out_unmap_vram:
62 -       iounmap(priv->base);
63 +       iounmap(priv->ddr_base);
64  out_free_context:
65         lv1_gpu_context_free(priv->context_handle);
66  out_free_memory:
67 @@ -728,7 +730,7 @@ static int ps3vram_shutdown(struct ps3_system_bus_device *dev)
68         ps3vram_cache_cleanup(&ps3vram_mtd);
69         iounmap(priv->reports);
70         iounmap(priv->ctrl);
71 -       iounmap(priv->base);
72 +       iounmap(priv->ddr_base);
73         lv1_gpu_context_free(priv->context_handle);
74         lv1_gpu_memory_free(priv->memory_handle);
75         ps3_close_hv_device(dev);
76 -- 
77 1.6.0.4
78