Skip to content

Commit

Permalink
Merge branches 'devel-iommu-mailbox' and 'devel-l2x0' into omap-for-l…
Browse files Browse the repository at this point in the history
…inus
  • Loading branch information
Tony Lindgren committed Dec 21, 2010
3 parents f0c61d3 + c7d3e9e + b89cd71 commit 4584acc
Show file tree
Hide file tree
Showing 21 changed files with 238 additions and 137 deletions.
12 changes: 11 additions & 1 deletion arch/arm/include/asm/hardware/cache-l2x0.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,17 @@
#define L2X0_CACHE_ID_PART_MASK (0xf << 6)
#define L2X0_CACHE_ID_PART_L210 (1 << 6)
#define L2X0_CACHE_ID_PART_L310 (3 << 6)
#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x3 << 17)

#define L2X0_AUX_CTRL_MASK 0xc0000fff
#define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT 16
#define L2X0_AUX_CTRL_WAY_SIZE_SHIFT 17
#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x3 << 17)
#define L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT 22
#define L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT 26
#define L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT 27
#define L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT 28
#define L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT 29
#define L2X0_AUX_CTRL_EARLY_BRESP_SHIFT 30

#ifndef __ASSEMBLY__
extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
Expand Down
13 changes: 5 additions & 8 deletions arch/arm/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,15 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
*
*/
#ifndef __arch_ioremap
#define ioremap(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE)
#define ioremap_nocache(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE)
#define ioremap_cached(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE_CACHED)
#define ioremap_wc(cookie,size) __arm_ioremap(cookie, size, MT_DEVICE_WC)
#define iounmap(cookie) __iounmap(cookie)
#else
#define __arch_ioremap __arm_ioremap
#define __arch_iounmap __iounmap
#endif

#define ioremap(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
#define ioremap_nocache(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
#define ioremap_cached(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_CACHED)
#define ioremap_wc(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_WC)
#define iounmap(cookie) __arch_iounmap(cookie)
#endif
#define iounmap __arch_iounmap

/*
* io{read,write}{8,16,32} macros
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-davinci/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#define __mem_isa(a) (a)

#ifndef __ASSEMBLER__
#define __arch_ioremap(p, s, t) davinci_ioremap(p, s, t)
#define __arch_iounmap(v) davinci_iounmap(v)
#define __arch_ioremap davinci_ioremap
#define __arch_iounmap davinci_iounmap

void __iomem *davinci_ioremap(unsigned long phys, size_t size,
unsigned int type);
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-iop13xx/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extern u32 iop13xx_atux_mem_base;
extern size_t iop13xx_atue_mem_size;
extern size_t iop13xx_atux_mem_size;

#define __arch_ioremap(a, s, f) __iop13xx_ioremap(a, s, f)
#define __arch_iounmap(a) __iop13xx_iounmap(a)
#define __arch_ioremap __iop13xx_ioremap
#define __arch_iounmap __iop13xx_iounmap

#endif
4 changes: 2 additions & 2 deletions arch/arm/mach-iop32x/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern void __iop3xx_iounmap(void __iomem *addr);
#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
#define __mem_pci(a) (a)

#define __arch_ioremap(a, s, f) __iop3xx_ioremap(a, s, f)
#define __arch_iounmap(a) __iop3xx_iounmap(a)
#define __arch_ioremap __iop3xx_ioremap
#define __arch_iounmap __iop3xx_iounmap

#endif
4 changes: 2 additions & 2 deletions arch/arm/mach-iop33x/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern void __iop3xx_iounmap(void __iomem *addr);
#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
#define __mem_pci(a) (a)

#define __arch_ioremap(a, s, f) __iop3xx_ioremap(a, s, f)
#define __arch_iounmap(a) __iop3xx_iounmap(a)
#define __arch_ioremap __iop3xx_ioremap
#define __arch_iounmap __iop3xx_iounmap

#endif
4 changes: 2 additions & 2 deletions arch/arm/mach-ixp23xx/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ ixp23xx_iounmap(void __iomem *addr)
__iounmap(addr);
}

#define __arch_ioremap(a,s,f) ixp23xx_ioremap(a,s,f)
#define __arch_iounmap(a) ixp23xx_iounmap(a)
#define __arch_ioremap ixp23xx_ioremap
#define __arch_iounmap ixp23xx_iounmap


#endif
4 changes: 2 additions & 2 deletions arch/arm/mach-ixp4xx/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ static inline void __indirect_iounmap(void __iomem *addr)
__iounmap(addr);
}

#define __arch_ioremap(a, s, f) __indirect_ioremap(a, s, f)
#define __arch_iounmap(a) __indirect_iounmap(a)
#define __arch_ioremap __indirect_ioremap
#define __arch_iounmap __indirect_iounmap

#define writeb(v, p) __indirect_writeb(v, p)
#define writew(v, p) __indirect_writew(v, p)
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-kirkwood/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ __arch_iounmap(void __iomem *addr)
__iounmap(addr);
}

#define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m)
#define __arch_iounmap(a) __arch_iounmap(a)
#define __arch_ioremap __arch_ioremap
#define __arch_iounmap __arch_iounmap
#define __io(a) __io(a)
#define __mem_pci(a) (a)

Expand Down
19 changes: 11 additions & 8 deletions arch/arm/mach-omap2/mailbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ static struct omap_mbox_ops omap2_mbox_ops = {

/* FIXME: the following structs should be filled automatically by the user id */

#if defined(CONFIG_ARCH_OMAP3430) || defined(CONFIG_ARCH_OMAP2420)
#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP2)
/* DSP */
static struct omap_mbox2_priv omap2_mbox_dsp_priv = {
.tx_fifo = {
Expand All @@ -306,7 +306,7 @@ struct omap_mbox mbox_dsp_info = {
};
#endif

#if defined(CONFIG_ARCH_OMAP3430)
#if defined(CONFIG_ARCH_OMAP3)
struct omap_mbox *omap3_mboxes[] = { &mbox_dsp_info, NULL };
#endif

Expand Down Expand Up @@ -394,15 +394,19 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)

if (false)
;
#if defined(CONFIG_ARCH_OMAP3430)
else if (cpu_is_omap3430()) {
#if defined(CONFIG_ARCH_OMAP3)
else if (cpu_is_omap34xx()) {
list = omap3_mboxes;

list[0]->irq = platform_get_irq_byname(pdev, "dsp");
}
#endif
#if defined(CONFIG_ARCH_OMAP2420)
else if (cpu_is_omap2420()) {
#if defined(CONFIG_ARCH_OMAP2)
else if (cpu_is_omap2430()) {
list = omap2_mboxes;

list[0]->irq = platform_get_irq_byname(pdev, "dsp");
} else if (cpu_is_omap2420()) {
list = omap2_mboxes;

list[0]->irq = platform_get_irq_byname(pdev, "dsp");
Expand Down Expand Up @@ -432,9 +436,8 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
iounmap(mbox_base);
return ret;
}
return 0;

return ret;
return 0;
}

static int __devexit omap2_mbox_remove(struct platform_device *pdev)
Expand Down
10 changes: 9 additions & 1 deletion arch/arm/mach-omap2/omap-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,20 @@ static struct iommu_device omap3_devices[] = {
.name = "isp",
.nr_tlb_entries = 8,
.clk_name = "cam_ick",
.da_start = 0x0,
.da_end = 0xFFFFF000,
},
},
#if defined(CONFIG_MPU_BRIDGE_IOMMU)
#if defined(CONFIG_OMAP_IOMMU_IVA2)
{
.base = 0x5d000000,
.irq = 28,
.pdata = {
.name = "iva2",
.nr_tlb_entries = 32,
.clk_name = "iva2_ck",
.da_start = 0x11000000,
.da_end = 0xFFFFF000,
},
},
#endif
Expand All @@ -64,6 +68,8 @@ static struct iommu_device omap4_devices[] = {
.name = "ducati",
.nr_tlb_entries = 32,
.clk_name = "ducati_ick",
.da_start = 0x0,
.da_end = 0xFFFFF000,
},
},
#if defined(CONFIG_MPU_TESLA_IOMMU)
Expand All @@ -74,6 +80,8 @@ static struct iommu_device omap4_devices[] = {
.name = "tesla",
.nr_tlb_entries = 32,
.clk_name = "tesla_ick",
.da_start = 0x0,
.da_end = 0xFFFFF000,
},
},
#endif
Expand Down
30 changes: 23 additions & 7 deletions arch/arm/mach-omap2/omap4-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ static void omap4_l2x0_disable(void)

static int __init omap_l2_cache_init(void)
{
u32 aux_ctrl = 0;

/*
* To avoid code running on other OMAPs in
* multi-omap builds
Expand All @@ -64,18 +66,32 @@ static int __init omap_l2_cache_init(void)
l2cache_base = ioremap(OMAP44XX_L2CACHE_BASE, SZ_4K);
BUG_ON(!l2cache_base);

/* Enable PL310 L2 Cache controller */
omap_smc1(0x102, 0x1);

/*
* 16-way associativity, parity disabled
* Way size - 32KB (es1.0)
* Way size - 64KB (es2.0 +)
*/
if (omap_rev() == OMAP4430_REV_ES1_0)
l2x0_init(l2cache_base, 0x0e050000, 0xc0000fff);
else
l2x0_init(l2cache_base, 0x0e070000, 0xc0000fff);
aux_ctrl = ((1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT) |
(0x1 << 25) |
(0x1 << L2X0_AUX_CTRL_NS_LOCKDOWN_SHIFT) |
(0x1 << L2X0_AUX_CTRL_NS_INT_CTRL_SHIFT));

if (omap_rev() == OMAP4430_REV_ES1_0) {
aux_ctrl |= 0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT;
} else {
aux_ctrl |= ((0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) |
(1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) |
(1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) |
(1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) |
(1 << L2X0_AUX_CTRL_EARLY_BRESP_SHIFT));
}
if (omap_rev() != OMAP4430_REV_ES1_0)
omap_smc1(0x109, aux_ctrl);

/* Enable PL310 L2 Cache controller */
omap_smc1(0x102, 0x1);

l2x0_init(l2cache_base, aux_ctrl, L2X0_AUX_CTRL_MASK);

/*
* Override default outer_cache.disable with a OMAP4
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-orion5x/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ __arch_iounmap(void __iomem *addr)
__iounmap(addr);
}

#define __arch_ioremap(p, s, m) __arch_ioremap(p, s, m)
#define __arch_iounmap(a) __arch_iounmap(a)
#define __arch_ioremap __arch_ioremap
#define __arch_iounmap __arch_iounmap
#define __io(a) __typesafe_io(a)
#define __mem_pci(a) (a)

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-tegra/include/mach/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@

#ifndef __ASSEMBLER__

#define __arch_ioremap(p, s, t) tegra_ioremap(p, s, t)
#define __arch_iounmap(v) tegra_iounmap(v)
#define __arch_ioremap tegra_ioremap
#define __arch_iounmap tegra_iounmap

void __iomem *tegra_ioremap(unsigned long phys, size_t size, unsigned int type);
void tegra_iounmap(volatile void __iomem *addr);
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/plat-omap/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ config OMAP_IOMMU_DEBUG

Say N unless you know you need this.

config OMAP_IOMMU_IVA2
bool

choice
prompt "System timer"
default OMAP_32K_TIMER if !ARCH_OMAP15XX
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/plat-omap/include/plat/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ static inline void omap44xx_map_common_io(void)
extern void omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
struct omap_sdrc_params *sdrc_cs1);

#define __arch_ioremap(p,s,t) omap_ioremap(p,s,t)
#define __arch_iounmap(v) omap_iounmap(v)
#define __arch_ioremap omap_ioremap
#define __arch_iounmap omap_iounmap

void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type);
void omap_iounmap(volatile void __iomem *addr);
Expand Down
5 changes: 5 additions & 0 deletions arch/arm/plat-omap/include/plat/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ struct iommu {
int (*isr)(struct iommu *obj);

void *ctx; /* iommu context: registres saved area */
u32 da_start;
u32 da_end;
};

struct cr_regs {
Expand Down Expand Up @@ -103,6 +105,8 @@ struct iommu_platform_data {
const char *name;
const char *clk_name;
const int nr_tlb_entries;
u32 da_start;
u32 da_end;
};

#if defined(CONFIG_ARCH_OMAP1)
Expand Down Expand Up @@ -152,6 +156,7 @@ extern void flush_iotlb_all(struct iommu *obj);
extern int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e);
extern size_t iopgtable_clear_entry(struct iommu *obj, u32 iova);

extern int iommu_set_da_range(struct iommu *obj, u32 start, u32 end);
extern struct iommu *iommu_get(const char *name);
extern void iommu_put(struct iommu *obj);

Expand Down
8 changes: 5 additions & 3 deletions arch/arm/plat-omap/include/plat/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ struct omap_mbox_queue {
struct kfifo fifo;
struct work_struct work;
struct tasklet_struct tasklet;
int (*callback)(void *);
struct omap_mbox *mbox;
bool full;
};

struct omap_mbox {
Expand All @@ -57,13 +57,15 @@ struct omap_mbox {
struct omap_mbox_ops *ops;
struct device *dev;
void *priv;
int use_count;
struct blocking_notifier_head notifier;
};

int omap_mbox_msg_send(struct omap_mbox *, mbox_msg_t msg);
void omap_mbox_init_seq(struct omap_mbox *);

struct omap_mbox *omap_mbox_get(const char *);
void omap_mbox_put(struct omap_mbox *);
struct omap_mbox *omap_mbox_get(const char *, struct notifier_block *nb);
void omap_mbox_put(struct omap_mbox *mbox, struct notifier_block *nb);

int omap_mbox_register(struct device *parent, struct omap_mbox **);
int omap_mbox_unregister(void);
Expand Down
24 changes: 24 additions & 0 deletions arch/arm/plat-omap/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,28 @@ static int device_match_by_alias(struct device *dev, void *data)
return strcmp(obj->name, name) == 0;
}

/**
* iommu_set_da_range - Set a valid device address range
* @obj: target iommu
* @start Start of valid range
* @end End of valid range
**/
int iommu_set_da_range(struct iommu *obj, u32 start, u32 end)
{

if (!obj)
return -EFAULT;

if (end < start || !PAGE_ALIGN(start | end))
return -EINVAL;

obj->da_start = start;
obj->da_end = end;

return 0;
}
EXPORT_SYMBOL_GPL(iommu_set_da_range);

/**
* iommu_get - Get iommu handler
* @name: target iommu name
Expand Down Expand Up @@ -922,6 +944,8 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
obj->name = pdata->name;
obj->dev = &pdev->dev;
obj->ctx = (void *)obj + sizeof(*obj);
obj->da_start = pdata->da_start;
obj->da_end = pdata->da_end;

mutex_init(&obj->iommu_lock);
mutex_init(&obj->mmap_lock);
Expand Down
Loading

0 comments on commit 4584acc

Please sign in to comment.