Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191626
b: refs/heads/master
c: 7c4584d
h: refs/heads/master
v: v3
  • Loading branch information
Matt Fleming committed Apr 25, 2010
1 parent 73974ac commit e526088
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5bac942db3d2c4738df04104240d65a5d1eaec6a
refs/heads/master: 7c4584d39a8a144c60adaf4cf998c3233b6683d9
13 changes: 9 additions & 4 deletions trunk/arch/sh/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,18 @@ typedef struct page *pgtable_t;
* added or subtracted as required.
*/
#ifdef CONFIG_PMB
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
#define ___pa(x) ((x)-PAGE_OFFSET+__MEMORY_START)
#define ___va(x) ((x)+PAGE_OFFSET-__MEMORY_START)
#else
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
#define ___pa(x) ((x)-PAGE_OFFSET)
#define ___va(x) ((x)+PAGE_OFFSET)
#endif

#ifndef __ASSEMBLY__
#define __pa(x) ___pa((unsigned long)x)
#define __va(x) (void *)___va((unsigned long)x)
#endif /* !__ASSEMBLY__ */

#ifdef CONFIG_UNCACHED_MAPPING
#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + uncached_start)
#define CAC_ADDR(addr) ((addr) - uncached_start + PAGE_OFFSET)
Expand Down
6 changes: 3 additions & 3 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <cpu/dma-register.h>
#include <cpu/sh7722.h>

static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
static struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
{
.slave_id = SHDMA_SLAVE_SCIF0_TX,
.addr = 0xffe0000c,
Expand Down Expand Up @@ -78,7 +78,7 @@ static const struct sh_dmae_slave_config sh7722_dmae_slaves[] = {
},
};

static const struct sh_dmae_channel sh7722_dmae_channels[] = {
static struct sh_dmae_channel sh7722_dmae_channels[] = {
{
.offset = 0,
.dmars = 0,
Expand Down Expand Up @@ -106,7 +106,7 @@ static const struct sh_dmae_channel sh7722_dmae_channels[] = {
}
};

static const unsigned int ts_shift[] = TS_SHIFT;
static unsigned int ts_shift[] = TS_SHIFT;

static struct sh_dmae_pdata dma_platform_data = {
.slave = sh7722_dmae_slaves,
Expand Down
54 changes: 47 additions & 7 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <cpu/sh7724.h>

/* DMA */
static const struct sh_dmae_channel sh7724_dmae_channels[] = {
static struct sh_dmae_channel sh7724_dmae0_channels[] = {
{
.offset = 0,
.dmars = 0,
Expand Down Expand Up @@ -59,11 +59,51 @@ static const struct sh_dmae_channel sh7724_dmae_channels[] = {
}
};

static const unsigned int ts_shift[] = TS_SHIFT;
static struct sh_dmae_channel sh7724_dmae1_channels[] = {
{
.offset = 0,
.dmars = 0,
.dmars_bit = 0,
}, {
.offset = 0x10,
.dmars = 0,
.dmars_bit = 8,
}, {
.offset = 0x20,
.dmars = 4,
.dmars_bit = 0,
}, {
.offset = 0x30,
.dmars = 4,
.dmars_bit = 8,
}, {
.offset = 0x50,
.dmars = 8,
.dmars_bit = 0,
}, {
.offset = 0x60,
.dmars = 8,
.dmars_bit = 8,
}
};

static unsigned int ts_shift[] = TS_SHIFT;

static struct sh_dmae_pdata dma0_platform_data = {
.channel = sh7724_dmae0_channels,
.channel_num = ARRAY_SIZE(sh7724_dmae0_channels),
.ts_low_shift = CHCR_TS_LOW_SHIFT,
.ts_low_mask = CHCR_TS_LOW_MASK,
.ts_high_shift = CHCR_TS_HIGH_SHIFT,
.ts_high_mask = CHCR_TS_HIGH_MASK,
.ts_shift = ts_shift,
.ts_shift_num = ARRAY_SIZE(ts_shift),
.dmaor_init = DMAOR_INIT,
};

static struct sh_dmae_pdata dma_platform_data = {
.channel = sh7724_dmae_channels,
.channel_num = ARRAY_SIZE(sh7724_dmae_channels),
static struct sh_dmae_pdata dma1_platform_data = {
.channel = sh7724_dmae1_channels,
.channel_num = ARRAY_SIZE(sh7724_dmae1_channels),
.ts_low_shift = CHCR_TS_LOW_SHIFT,
.ts_low_mask = CHCR_TS_LOW_MASK,
.ts_high_shift = CHCR_TS_HIGH_SHIFT,
Expand Down Expand Up @@ -147,7 +187,7 @@ static struct platform_device dma0_device = {
.resource = sh7724_dmae0_resources,
.num_resources = ARRAY_SIZE(sh7724_dmae0_resources),
.dev = {
.platform_data = &dma_platform_data,
.platform_data = &dma0_platform_data,
},
.archdata = {
.hwblk_id = HWBLK_DMAC0,
Expand All @@ -160,7 +200,7 @@ static struct platform_device dma1_device = {
.resource = sh7724_dmae1_resources,
.num_resources = ARRAY_SIZE(sh7724_dmae1_resources),
.dev = {
.platform_data = &dma_platform_data,
.platform_data = &dma1_platform_data,
},
.archdata = {
.hwblk_id = HWBLK_DMAC1,
Expand Down
6 changes: 3 additions & 3 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7780.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static struct platform_device rtc_device = {
};

/* DMA */
static const struct sh_dmae_channel sh7780_dmae0_channels[] = {
static struct sh_dmae_channel sh7780_dmae0_channels[] = {
{
.offset = 0,
.dmars = 0,
Expand Down Expand Up @@ -261,7 +261,7 @@ static const struct sh_dmae_channel sh7780_dmae0_channels[] = {
}
};

static const struct sh_dmae_channel sh7780_dmae1_channels[] = {
static struct sh_dmae_channel sh7780_dmae1_channels[] = {
{
.offset = 0,
}, {
Expand All @@ -277,7 +277,7 @@ static const struct sh_dmae_channel sh7780_dmae1_channels[] = {
}
};

static const unsigned int ts_shift[] = TS_SHIFT;
static unsigned int ts_shift[] = TS_SHIFT;

static struct sh_dmae_pdata dma0_platform_data = {
.channel = sh7780_dmae0_channels,
Expand Down
6 changes: 3 additions & 3 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7785.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static struct platform_device tmu5_device = {
};

/* DMA */
static const struct sh_dmae_channel sh7785_dmae0_channels[] = {
static struct sh_dmae_channel sh7785_dmae0_channels[] = {
{
.offset = 0,
.dmars = 0,
Expand Down Expand Up @@ -303,7 +303,7 @@ static const struct sh_dmae_channel sh7785_dmae0_channels[] = {
}
};

static const struct sh_dmae_channel sh7785_dmae1_channels[] = {
static struct sh_dmae_channel sh7785_dmae1_channels[] = {
{
.offset = 0,
}, {
Expand All @@ -319,7 +319,7 @@ static const struct sh_dmae_channel sh7785_dmae1_channels[] = {
}
};

static const unsigned int ts_shift[] = TS_SHIFT;
static unsigned int ts_shift[] = TS_SHIFT;

static struct sh_dmae_pdata dma0_platform_data = {
.channel = sh7785_dmae0_channels,
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/sh/kernel/cpu/sh4a/setup-sh7786.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ static struct platform_device tmu11_device = {
.num_resources = ARRAY_SIZE(tmu11_resources),
};

static const struct sh_dmae_channel dmac0_channels[] = {
static struct sh_dmae_channel dmac0_channels[] = {
{
.offset = 0,
.dmars = 0,
Expand Down Expand Up @@ -473,7 +473,7 @@ static const struct sh_dmae_channel dmac0_channels[] = {
}
};

static const unsigned int ts_shift[] = TS_SHIFT;
static unsigned int ts_shift[] = TS_SHIFT;

static struct sh_dmae_pdata dma0_platform_data = {
.channel = dmac0_channels,
Expand Down
13 changes: 9 additions & 4 deletions trunk/arch/sh/mm/fault_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,15 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
*/
out_of_memory:
up_read(&mm->mmap_sem);
if (!user_mode(regs))
goto no_context;
pagefault_out_of_memory();
return;
if (is_global_init(current)) {
yield();
down_read(&mm->mmap_sem);
goto survive;
}
printk("VM: killing process %s\n", tsk->comm);
if (user_mode(regs))
do_group_exit(SIGKILL);
goto no_context;

do_sigbus:
up_read(&mm->mmap_sem);
Expand Down
19 changes: 15 additions & 4 deletions trunk/arch/sh/mm/tlbflush_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,22 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
* us unable to handle the page fault gracefully.
*/
out_of_memory:
if (is_global_init(current)) {
panic("INIT out of memory\n");
yield();
goto survive;
}
printk("fault:Out of memory\n");
up_read(&mm->mmap_sem);
if (!user_mode(regs))
goto no_context;
pagefault_out_of_memory();
return;
if (is_global_init(current)) {
yield();
down_read(&mm->mmap_sem);
goto survive;
}
printk("VM: killing process %s\n", tsk->comm);
if (user_mode(regs))
do_group_exit(SIGKILL);
goto no_context;

do_sigbus:
printk("fault:Do sigbus\n");
Expand Down
12 changes: 5 additions & 7 deletions trunk/drivers/dma/shdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ static int dmae_set_dmars(struct sh_dmae_chan *sh_chan, u16 val)
struct sh_dmae_device *shdev = container_of(sh_chan->common.device,
struct sh_dmae_device, common);
struct sh_dmae_pdata *pdata = shdev->pdata;
const struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
struct sh_dmae_channel *chan_pdata = &pdata->channel[sh_chan->id];
u16 __iomem *addr = shdev->dmars + chan_pdata->dmars / sizeof(u16);
int shift = chan_pdata->dmars_bit;

Expand Down Expand Up @@ -264,7 +264,7 @@ static struct sh_desc *sh_dmae_get_desc(struct sh_dmae_chan *sh_chan)
return NULL;
}

static const struct sh_dmae_slave_config *sh_dmae_find_slave(
static struct sh_dmae_slave_config *sh_dmae_find_slave(
struct sh_dmae_chan *sh_chan, struct sh_dmae_slave *param)
{
struct dma_device *dma_dev = sh_chan->common.device;
Expand Down Expand Up @@ -296,7 +296,7 @@ static int sh_dmae_alloc_chan_resources(struct dma_chan *chan)
* never runs concurrently with itself or free_chan_resources.
*/
if (param) {
const struct sh_dmae_slave_config *cfg;
struct sh_dmae_slave_config *cfg;

cfg = sh_dmae_find_slave(sh_chan, param);
if (!cfg)
Expand Down Expand Up @@ -557,14 +557,12 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
{
struct sh_dmae_slave *param;
struct sh_dmae_chan *sh_chan;
dma_addr_t slave_addr;

if (!chan)
return NULL;

sh_chan = to_sh_chan(chan);
param = chan->private;
slave_addr = param->config->addr;

/* Someone calling slave DMA on a public channel? */
if (!param || !sg_len) {
Expand All @@ -577,7 +575,7 @@ static struct dma_async_tx_descriptor *sh_dmae_prep_slave_sg(
* if (param != NULL), this is a successfully requested slave channel,
* therefore param->config != NULL too.
*/
return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &slave_addr,
return sh_dmae_prep_sg(sh_chan, sgl, sg_len, &param->config->addr,
direction, flags);
}

Expand Down Expand Up @@ -858,7 +856,7 @@ static int __devinit sh_dmae_chan_probe(struct sh_dmae_device *shdev, int id,
int irq, unsigned long flags)
{
int err;
const struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
struct sh_dmae_channel *chan_pdata = &shdev->pdata->channel[id];
struct platform_device *pdev = to_platform_device(shdev->common.dev);
struct sh_dmae_chan *new_sh_chan;

Expand Down
9 changes: 4 additions & 5 deletions trunk/include/linux/sh_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
struct sh_dmae_slave {
unsigned int slave_id; /* Set by the platform */
struct device *dma_dev; /* Set by the platform */
const struct sh_dmae_slave_config *config; /* Set by the driver */
struct sh_dmae_slave_config *config; /* Set by the driver */
};

struct sh_dmae_regs {
Expand All @@ -36,7 +36,6 @@ struct sh_desc {
int chunks;
int mark;
};

struct sh_dmae_slave_config {
unsigned int slave_id;
dma_addr_t addr;
Expand All @@ -51,15 +50,15 @@ struct sh_dmae_channel {
};

struct sh_dmae_pdata {
const struct sh_dmae_slave_config *slave;
struct sh_dmae_slave_config *slave;
int slave_num;
const struct sh_dmae_channel *channel;
struct sh_dmae_channel *channel;
int channel_num;
unsigned int ts_low_shift;
unsigned int ts_low_mask;
unsigned int ts_high_shift;
unsigned int ts_high_mask;
const unsigned int *ts_shift;
unsigned int *ts_shift;
int ts_shift_num;
u16 dmaor_init;
};
Expand Down

0 comments on commit e526088

Please sign in to comment.