diff options
Diffstat (limited to 'drivers/uio/uio_pruss.c')
-rw-r--r-- | drivers/uio/uio_pruss.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c index 96c4a19b1918..c28d6e2e3df2 100644 --- a/drivers/uio/uio_pruss.c +++ b/drivers/uio/uio_pruss.c | |||
@@ -91,8 +91,7 @@ static irqreturn_t pruss_handler(int irq, struct uio_info *info) | |||
91 | return IRQ_HANDLED; | 91 | return IRQ_HANDLED; |
92 | } | 92 | } |
93 | 93 | ||
94 | static void pruss_cleanup(struct platform_device *dev, | 94 | static void pruss_cleanup(struct device *dev, struct uio_pruss_dev *gdev) |
95 | struct uio_pruss_dev *gdev) | ||
96 | { | 95 | { |
97 | int cnt; | 96 | int cnt; |
98 | struct uio_info *p = gdev->info; | 97 | struct uio_info *p = gdev->info; |
@@ -103,7 +102,7 @@ static void pruss_cleanup(struct platform_device *dev, | |||
103 | } | 102 | } |
104 | iounmap(gdev->prussio_vaddr); | 103 | iounmap(gdev->prussio_vaddr); |
105 | if (gdev->ddr_vaddr) { | 104 | if (gdev->ddr_vaddr) { |
106 | dma_free_coherent(&dev->dev, extram_pool_sz, gdev->ddr_vaddr, | 105 | dma_free_coherent(dev, extram_pool_sz, gdev->ddr_vaddr, |
107 | gdev->ddr_paddr); | 106 | gdev->ddr_paddr); |
108 | } | 107 | } |
109 | if (gdev->sram_vaddr) | 108 | if (gdev->sram_vaddr) |
@@ -115,13 +114,14 @@ static void pruss_cleanup(struct platform_device *dev, | |||
115 | kfree(gdev); | 114 | kfree(gdev); |
116 | } | 115 | } |
117 | 116 | ||
118 | static int pruss_probe(struct platform_device *dev) | 117 | static int pruss_probe(struct platform_device *pdev) |
119 | { | 118 | { |
120 | struct uio_info *p; | 119 | struct uio_info *p; |
121 | struct uio_pruss_dev *gdev; | 120 | struct uio_pruss_dev *gdev; |
122 | struct resource *regs_prussio; | 121 | struct resource *regs_prussio; |
122 | struct device *dev = &pdev->dev; | ||
123 | int ret = -ENODEV, cnt = 0, len; | 123 | int ret = -ENODEV, cnt = 0, len; |
124 | struct uio_pruss_pdata *pdata = dev_get_platdata(&dev->dev); | 124 | struct uio_pruss_pdata *pdata = dev_get_platdata(dev); |
125 | 125 | ||
126 | gdev = kzalloc(sizeof(struct uio_pruss_dev), GFP_KERNEL); | 126 | gdev = kzalloc(sizeof(struct uio_pruss_dev), GFP_KERNEL); |
127 | if (!gdev) | 127 | if (!gdev) |
@@ -132,10 +132,11 @@ static int pruss_probe(struct platform_device *dev) | |||
132 | kfree(gdev); | 132 | kfree(gdev); |
133 | return -ENOMEM; | 133 | return -ENOMEM; |
134 | } | 134 | } |
135 | |||
135 | /* Power on PRU in case its not done as part of boot-loader */ | 136 | /* Power on PRU in case its not done as part of boot-loader */ |
136 | gdev->pruss_clk = clk_get(&dev->dev, "pruss"); | 137 | gdev->pruss_clk = clk_get(dev, "pruss"); |
137 | if (IS_ERR(gdev->pruss_clk)) { | 138 | if (IS_ERR(gdev->pruss_clk)) { |
138 | dev_err(&dev->dev, "Failed to get clock\n"); | 139 | dev_err(dev, "Failed to get clock\n"); |
139 | ret = PTR_ERR(gdev->pruss_clk); | 140 | ret = PTR_ERR(gdev->pruss_clk); |
140 | kfree(gdev->info); | 141 | kfree(gdev->info); |
141 | kfree(gdev); | 142 | kfree(gdev); |
@@ -144,14 +145,14 @@ static int pruss_probe(struct platform_device *dev) | |||
144 | clk_enable(gdev->pruss_clk); | 145 | clk_enable(gdev->pruss_clk); |
145 | } | 146 | } |
146 | 147 | ||
147 | regs_prussio = platform_get_resource(dev, IORESOURCE_MEM, 0); | 148 | regs_prussio = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
148 | if (!regs_prussio) { | 149 | if (!regs_prussio) { |
149 | dev_err(&dev->dev, "No PRUSS I/O resource specified\n"); | 150 | dev_err(dev, "No PRUSS I/O resource specified\n"); |
150 | goto out_free; | 151 | goto out_free; |
151 | } | 152 | } |
152 | 153 | ||
153 | if (!regs_prussio->start) { | 154 | if (!regs_prussio->start) { |
154 | dev_err(&dev->dev, "Invalid memory resource\n"); | 155 | dev_err(dev, "Invalid memory resource\n"); |
155 | goto out_free; | 156 | goto out_free; |
156 | } | 157 | } |
157 | 158 | ||
@@ -161,27 +162,27 @@ static int pruss_probe(struct platform_device *dev) | |||
161 | (unsigned long)gen_pool_dma_alloc(gdev->sram_pool, | 162 | (unsigned long)gen_pool_dma_alloc(gdev->sram_pool, |
162 | sram_pool_sz, &gdev->sram_paddr); | 163 | sram_pool_sz, &gdev->sram_paddr); |
163 | if (!gdev->sram_vaddr) { | 164 | if (!gdev->sram_vaddr) { |
164 | dev_err(&dev->dev, "Could not allocate SRAM pool\n"); | 165 | dev_err(dev, "Could not allocate SRAM pool\n"); |
165 | goto out_free; | 166 | goto out_free; |
166 | } | 167 | } |
167 | } | 168 | } |
168 | 169 | ||
169 | gdev->ddr_vaddr = dma_alloc_coherent(&dev->dev, extram_pool_sz, | 170 | gdev->ddr_vaddr = dma_alloc_coherent(dev, extram_pool_sz, |
170 | &(gdev->ddr_paddr), GFP_KERNEL | GFP_DMA); | 171 | &(gdev->ddr_paddr), GFP_KERNEL | GFP_DMA); |
171 | if (!gdev->ddr_vaddr) { | 172 | if (!gdev->ddr_vaddr) { |
172 | dev_err(&dev->dev, "Could not allocate external memory\n"); | 173 | dev_err(dev, "Could not allocate external memory\n"); |
173 | goto out_free; | 174 | goto out_free; |
174 | } | 175 | } |
175 | 176 | ||
176 | len = resource_size(regs_prussio); | 177 | len = resource_size(regs_prussio); |
177 | gdev->prussio_vaddr = ioremap(regs_prussio->start, len); | 178 | gdev->prussio_vaddr = ioremap(regs_prussio->start, len); |
178 | if (!gdev->prussio_vaddr) { | 179 | if (!gdev->prussio_vaddr) { |
179 | dev_err(&dev->dev, "Can't remap PRUSS I/O address range\n"); | 180 | dev_err(dev, "Can't remap PRUSS I/O address range\n"); |
180 | goto out_free; | 181 | goto out_free; |
181 | } | 182 | } |
182 | 183 | ||
183 | gdev->pintc_base = pdata->pintc_base; | 184 | gdev->pintc_base = pdata->pintc_base; |
184 | gdev->hostirq_start = platform_get_irq(dev, 0); | 185 | gdev->hostirq_start = platform_get_irq(pdev, 0); |
185 | 186 | ||
186 | for (cnt = 0, p = gdev->info; cnt < MAX_PRUSS_EVT; cnt++, p++) { | 187 | for (cnt = 0, p = gdev->info; cnt < MAX_PRUSS_EVT; cnt++, p++) { |
187 | p->mem[0].addr = regs_prussio->start; | 188 | p->mem[0].addr = regs_prussio->start; |
@@ -204,12 +205,12 @@ static int pruss_probe(struct platform_device *dev) | |||
204 | p->handler = pruss_handler; | 205 | p->handler = pruss_handler; |
205 | p->priv = gdev; | 206 | p->priv = gdev; |
206 | 207 | ||
207 | ret = uio_register_device(&dev->dev, p); | 208 | ret = uio_register_device(dev, p); |
208 | if (ret < 0) | 209 | if (ret < 0) |
209 | goto out_free; | 210 | goto out_free; |
210 | } | 211 | } |
211 | 212 | ||
212 | platform_set_drvdata(dev, gdev); | 213 | platform_set_drvdata(pdev, gdev); |
213 | return 0; | 214 | return 0; |
214 | 215 | ||
215 | out_free: | 216 | out_free: |
@@ -221,7 +222,7 @@ static int pruss_remove(struct platform_device *dev) | |||
221 | { | 222 | { |
222 | struct uio_pruss_dev *gdev = platform_get_drvdata(dev); | 223 | struct uio_pruss_dev *gdev = platform_get_drvdata(dev); |
223 | 224 | ||
224 | pruss_cleanup(dev, gdev); | 225 | pruss_cleanup(&dev->dev, gdev); |
225 | return 0; | 226 | return 0; |
226 | } | 227 | } |
227 | 228 | ||