aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2009-01-06 06:32:28 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-01-08 00:25:15 -0500
commit993e62e674ba670341f11f60398446bb37a88e8b (patch)
tree46b8c4b9096722b0f3d2d68e66d3c5002d85ee55
parentf259d74e030faab15b95fb4bb56d7f424773c278 (diff)
mtd/ps3vram: Use proper kernel types
Replace the use of stdint.h types with kernel types in the ps3vram driver. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--drivers/mtd/devices/ps3vram.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/drivers/mtd/devices/ps3vram.c b/drivers/mtd/devices/ps3vram.c
index f5cc2908bdca..91cc2afbe14e 100644
--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -65,15 +65,15 @@ struct ps3vram_cache {
65}; 65};
66 66
67struct ps3vram_priv { 67struct ps3vram_priv {
68 uint64_t memory_handle; 68 u64 memory_handle;
69 uint64_t context_handle; 69 u64 context_handle;
70 uint8_t *base; 70 u32 *ctrl;
71 uint32_t *ctrl; 71 u32 *reports;
72 uint32_t *reports; 72 u8 *base;
73 uint8_t *xdr_buf; 73 u8 *xdr_buf;
74 74
75 uint32_t *fifo_base; 75 u32 *fifo_base;
76 uint32_t *fifo_ptr; 76 u32 *fifo_ptr;
77 77
78 struct device *dev; 78 struct device *dev;
79 struct ps3vram_cache cache; 79 struct ps3vram_cache cache;
@@ -92,7 +92,7 @@ char *size = "256M-";
92module_param(size, charp, 0); 92module_param(size, charp, 0);
93MODULE_PARM_DESC(size, "memory size"); 93MODULE_PARM_DESC(size, "memory size");
94 94
95static inline uint32_t *ps3vram_get_notifier(uint32_t *reports, int notifier) 95static u32 *ps3vram_get_notifier(u32 *reports, int notifier)
96{ 96{
97 return (void *) reports + 97 return (void *) reports +
98 DMA_NOTIFIER_OFFSET_BASE + 98 DMA_NOTIFIER_OFFSET_BASE +
@@ -102,8 +102,9 @@ static inline uint32_t *ps3vram_get_notifier(uint32_t *reports, int notifier)
102static void ps3vram_notifier_reset(struct mtd_info *mtd) 102static void ps3vram_notifier_reset(struct mtd_info *mtd)
103{ 103{
104 int i; 104 int i;
105
105 struct ps3vram_priv *priv = mtd->priv; 106 struct ps3vram_priv *priv = mtd->priv;
106 uint32_t *notify = ps3vram_get_notifier(priv->reports, NOTIFIER); 107 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
107 for (i = 0; i < 4; i++) 108 for (i = 0; i < 4; i++)
108 notify[i] = 0xffffffff; 109 notify[i] = 0xffffffff;
109} 110}
@@ -111,7 +112,7 @@ static void ps3vram_notifier_reset(struct mtd_info *mtd)
111static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms) 112static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms)
112{ 113{
113 struct ps3vram_priv *priv = mtd->priv; 114 struct ps3vram_priv *priv = mtd->priv;
114 uint32_t *notify = ps3vram_get_notifier(priv->reports, NOTIFIER); 115 u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
115 116
116 timeout_ms *= 1000; 117 timeout_ms *= 1000;
117 118
@@ -155,13 +156,13 @@ static int ps3vram_wait_ring(struct mtd_info *mtd, int timeout)
155 return 0; 156 return 0;
156} 157}
157 158
158static inline void ps3vram_out_ring(struct ps3vram_priv *priv, uint32_t data) 159static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data)
159{ 160{
160 *(priv->fifo_ptr)++ = data; 161 *(priv->fifo_ptr)++ = data;
161} 162}
162 163
163static inline void ps3vram_begin_ring(struct ps3vram_priv *priv, uint32_t chan, 164static void ps3vram_begin_ring(struct ps3vram_priv *priv, u32 chan,
164 uint32_t tag, uint32_t size) 165 u32 tag, u32 size)
165{ 166{
166 ps3vram_out_ring(priv, (size << 18) | (chan << 13) | tag); 167 ps3vram_out_ring(priv, (size << 18) | (chan << 13) | tag);
167} 168}
@@ -194,7 +195,7 @@ static void ps3vram_fire_ring(struct mtd_info *mtd)
194 mutex_lock(&ps3_gpu_mutex); 195 mutex_lock(&ps3_gpu_mutex);
195 196
196 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET + 197 priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET +
197 (priv->fifo_ptr - priv->fifo_base) * sizeof(uint32_t); 198 (priv->fifo_ptr - priv->fifo_base) * sizeof(u32);
198 199
199 /* asking the HV for a blit will kick the fifo */ 200 /* asking the HV for a blit will kick the fifo */
200 status = lv1_gpu_context_attribute(priv->context_handle, 201 status = lv1_gpu_context_attribute(priv->context_handle,
@@ -204,8 +205,8 @@ static void ps3vram_fire_ring(struct mtd_info *mtd)
204 dev_err(priv->dev, "%s:%d: lv1_gpu_context_attribute failed\n", 205 dev_err(priv->dev, "%s:%d: lv1_gpu_context_attribute failed\n",
205 __func__, __LINE__); 206 __func__, __LINE__);
206 207
207 if ((priv->fifo_ptr - priv->fifo_base) * sizeof(uint32_t) > 208 if ((priv->fifo_ptr - priv->fifo_base) * sizeof(u32) >
208 FIFO_SIZE - 1024) { 209 FIFO_SIZE - 1024) {
209 dev_dbg(priv->dev, "%s:%d: fifo full, rewinding\n", __func__, 210 dev_dbg(priv->dev, "%s:%d: fifo full, rewinding\n", __func__,
210 __LINE__); 211 __LINE__);
211 ps3vram_wait_ring(mtd, 200); 212 ps3vram_wait_ring(mtd, 200);
@@ -538,10 +539,13 @@ static int ps3vram_write(struct mtd_info *mtd, loff_t to, size_t len,
538static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev) 539static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
539{ 540{
540 struct ps3vram_priv *priv; 541 struct ps3vram_priv *priv;
541 uint64_t status; 542 int status;
542 uint64_t ddr_lpar, ctrl_lpar, info_lpar, reports_lpar; 543 u64 ddr_lpar;
543 int64_t ddr_size; 544 u64 ctrl_lpar;
544 uint64_t reports_size; 545 u64 info_lpar;
546 u64 reports_lpar;
547 u64 ddr_size;
548 u64 reports_size;
545 int ret = -ENOMEM; 549 int ret = -ENOMEM;
546 char *rest; 550 char *rest;
547 551
@@ -555,8 +559,8 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
555 priv->dev = &dev->core; 559 priv->dev = &dev->core;
556 560
557 /* Allocate XDR buffer (1MiB aligned) */ 561 /* Allocate XDR buffer (1MiB aligned) */
558 priv->xdr_buf = (uint8_t *) __get_free_pages(GFP_KERNEL, 562 priv->xdr_buf = (void *)__get_free_pages(GFP_KERNEL,
559 get_order(XDR_BUF_SIZE)); 563 get_order(XDR_BUF_SIZE));
560 if (priv->xdr_buf == NULL) { 564 if (priv->xdr_buf == NULL) {
561 dev_dbg(&dev->core, "%s:%d: could not allocate XDR buffer\n", 565 dev_dbg(&dev->core, "%s:%d: could not allocate XDR buffer\n",
562 __func__, __LINE__); 566 __func__, __LINE__);
@@ -565,7 +569,7 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
565 } 569 }
566 570
567 /* Put FIFO at begginning of XDR buffer */ 571 /* Put FIFO at begginning of XDR buffer */
568 priv->fifo_base = (uint32_t *) (priv->xdr_buf + FIFO_OFFSET); 572 priv->fifo_base = (u32 *) (priv->xdr_buf + FIFO_OFFSET);
569 priv->fifo_ptr = priv->fifo_base; 573 priv->fifo_ptr = priv->fifo_base;
570 574
571 /* XXX: Need to open GPU, in case ps3fb or snd_ps3 aren't loaded */ 575 /* XXX: Need to open GPU, in case ps3fb or snd_ps3 aren't loaded */
@@ -593,11 +597,11 @@ static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
593 status = lv1_gpu_memory_allocate(ddr_size, 0, 0, 0, 0, 597 status = lv1_gpu_memory_allocate(ddr_size, 0, 0, 0, 0,
594 &priv->memory_handle, 598 &priv->memory_handle,
595 &ddr_lpar); 599 &ddr_lpar);
596 if (status == 0) 600 if (!status)
597 break; 601 break;
598 ddr_size -= 1024*1024; 602 ddr_size -= 1024*1024;
599 } 603 }
600 if (status != 0 || ddr_size <= 0) { 604 if (status || ddr_size <= 0) {
601 dev_err(&dev->core, "%s:%d: lv1_gpu_memory_allocate failed\n", 605 dev_err(&dev->core, "%s:%d: lv1_gpu_memory_allocate failed\n",
602 __func__, __LINE__); 606 __func__, __LINE__);
603 ret = -ENOMEM; 607 ret = -ENOMEM;