Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106848
b: refs/heads/master
c: 1eca5c9
h: refs/heads/master
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Jul 28, 2008
1 parent 38bd6b4 commit 2c665f5
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 714750dd5c6aef8e204d35ba28c1be9641418671
refs/heads/master: 1eca5c92729a83f64826d15a9ecb1652dda54bcb
8 changes: 8 additions & 0 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7343.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ static struct resource vpu_resources[] = {
.end = 0xfe9022eb,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device vpu_device = {
Expand All @@ -91,6 +94,9 @@ static struct resource veu_resources[] = {
.end = 0xfe9200b7,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device veu_device = {
Expand Down Expand Up @@ -132,6 +138,8 @@ static struct platform_device *sh7343_devices[] __initdata = {

static int __init sh7343_devices_setup(void)
{
platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
return platform_add_devices(sh7343_devices,
ARRAY_SIZE(sh7343_devices));
}
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ static struct resource vpu_resources[] = {
.end = 0xfe902807,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device vpu_device = {
Expand All @@ -73,6 +76,9 @@ static struct resource veu0_resources[] = {
.end = 0xfe9200b7,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device veu0_device = {
Expand All @@ -98,6 +104,9 @@ static struct resource veu1_resources[] = {
.end = 0xfe9240b7,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device veu1_device = {
Expand Down Expand Up @@ -139,6 +148,9 @@ static struct platform_device *sh7366_devices[] __initdata = {

static int __init sh7366_devices_setup(void)
{
platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
return platform_add_devices(sh7366_devices,
ARRAY_SIZE(sh7366_devices));
}
Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ static struct resource vpu_resources[] = {
.end = 0xfe9022eb,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device vpu_device = {
Expand All @@ -98,6 +101,9 @@ static struct resource veu_resources[] = {
.end = 0xfe9200b7,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device veu_device = {
Expand Down Expand Up @@ -152,6 +158,8 @@ static struct platform_device *sh7722_devices[] __initdata = {

static int __init sh7722_devices_setup(void)
{
platform_resource_setup_memory(&vpu_device, "vpu", 1 << 20);
platform_resource_setup_memory(&veu_device, "veu", 2 << 20);
return platform_add_devices(sh7722_devices,
ARRAY_SIZE(sh7722_devices));
}
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ static struct resource vpu_resources[] = {
.end = 0xfe902807,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device vpu_device = {
Expand All @@ -53,6 +56,9 @@ static struct resource veu0_resources[] = {
.end = 0xfe92027b,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device veu0_device = {
Expand All @@ -78,6 +84,9 @@ static struct resource veu1_resources[] = {
.end = 0xfe92427b,
.flags = IORESOURCE_MEM,
},
[1] = {
/* place holder for contiguous memory */
},
};

static struct platform_device veu1_device = {
Expand Down Expand Up @@ -221,6 +230,9 @@ static struct platform_device *sh7723_devices[] __initdata = {

static int __init sh7723_devices_setup(void)
{
platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
return platform_add_devices(sh7723_devices,
ARRAY_SIZE(sh7723_devices));
}
Expand Down
30 changes: 30 additions & 0 deletions trunk/arch/sh/mm/consistent.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* for more details.
*/
#include <linux/mm.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <asm/cacheflush.h>
#include <asm/addrspace.h>
Expand Down Expand Up @@ -185,3 +186,32 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
}
}
EXPORT_SYMBOL(dma_cache_sync);

int platform_resource_setup_memory(struct platform_device *pdev,
char *name, unsigned long memsize)
{
struct resource *r;
dma_addr_t dma_handle;
void *buf;

r = pdev->resource + pdev->num_resources - 1;
if (r->flags) {
pr_warning("%s: unable to find empty space for resource\n",
name);
return -EINVAL;
}

buf = dma_alloc_coherent(NULL, memsize, &dma_handle, GFP_KERNEL);
if (!buf) {
pr_warning("%s: unable to allocate memory\n", name);
return -ENOMEM;
}

memset(buf, 0, memsize);

r->flags = IORESOURCE_MEM;
r->start = dma_handle;
r->end = r->start + memsize - 1;
r->name = name;
return 0;
}
5 changes: 5 additions & 0 deletions trunk/include/asm-sh/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
*/
#include <asm-generic/device.h>

struct platform_device;
/* allocate contiguous memory chunk and fill in struct resource */
int platform_resource_setup_memory(struct platform_device *pdev,
char *name, unsigned long memsize);

0 comments on commit 2c665f5

Please sign in to comment.