Skip to contentSkip to conversation

Renesas IPMMU driver for sh7372, sh73a0 and r8a7740

PATCH In review Hideki EIRAKU 4 participants 11 messages Jan 21, 2013 – Feb 6, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v6 cover Renesas IPMMU driver for sh7372, sh73a0 and r8a7740

This is the Renesas IPMMU driver, IOMMU API implementation and IPMMU device support for sh7372 (AP4EVB and Mackerel), sh73a0 and r8a7740.

The IPMMU module supports the MMU function and the PMB function. The MMU function provides address translation by pagetable compatible with ARMv6. The PMB function provides address translation including tile-linear translation. This is implementation of the MMU function.

Note: The IPMMU module translates DMA memory address from all of the IP blocks on the ICB. The IOMMU API has iommu_attach_device() which attaches one device to one domain, but the IPMMU module cannot attach only one device. The IPMMU module only can attach all devices to one domain.

Tested on:
- armadillo800eva
- kzma9
- mackerel (I could not make it boot the v3.8-rc4 with Device Tree, so I tested a kernel without Device Tree support, reverting 3b7b70552afe351a8bd8fff1eb2d60aab2206576 and 0ce53cdc5c7e28f378e480363a0b0c2ed7e7eaf9)

How to test:
1. Boot a kernel built with CONFIG_SHMOBILE_IOMMU=y.
2. Check whether a display on the board shows console normally.
3. Check whether the IMCTR1 register is 1 which means the MMU function enabled. To read the IMCTR1 register:

   # peekpoke 0xfe951000
4. Change the IMCTR1 to 0 to disable the MMU function.
   To change the IMCTR1 register to 0:
   # peekpoke 0xfe951000 0
5. Check whether the display shows broken data.
6. Change the IMCTR1 to 1 to enable the MMU function.
   To change the IMCTR1 register to 1:
   # peekpoke 0xfe951000 1
7. Check whether a display on the board shows console normally.
8. Capture and check the framebuffer contents via memory mapped by mmap().
   To capture the framebuffer contents and save the image to a file "filename":
   # fbcat /dev/fb0 > filename
   To look at the contents saved by fbcat on a PC:
   $ display filename
- fbcat can be downloaded from https://code.google.com/p/fbcat/.
- display is one of the ImageMagick tools.
- peekpoke is:
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <err.h>
int main(int argc,char**argv){
  uint32_t*p,addr;
  int fd=open("/dev/mem",O_RDWR);
  if(fd<0)err(1,"open");
  addr=strtoul(argv[1],NULL,0);
  p=mmap(NULL,0x1000,PROT_READ|PROT_WRITE,MAP_SHARED,fd,addr&~0xfff);
  if(p==MAP_FAILED)err(1,"mmap");
  if(argc<=2)printf("0x%08x\n",p[addr/4&0x3ff]);
  else printf("wrote 0x%08x\n",p[addr/4&0x3ff]=strtoul(argv[2],NULL,0));
}

TODO:
- Multiple IPMMU device initialization support.
The ipmmu_iommu_init function and the shmobile_iommu_add_device function currently do not support multiple IPMMU instances.
- Device Tree support.

Changelog:
v6:
- Rebased on 3.8-rc4.
- Use cached memory for IPMMU page tables.
- Use macros defined in linux/sizes.h.
- Fix a memory leak of page tables when the domain is not attached.
- Use GFP_ATOMIC for allocating page tables.
v5:
- Rebased on 3.8-rc1.
- Add sh73a0 and r8a7740 support.
- CONFIG_SHMOBILE_IOMMU is now selectable only for arm shmobile architecture.
- Fix "defined but not used" warnings when CONFIG_SHMOBILE_IOMMU is not set.
- Add help text of CONFIG_SHMOBILE_IOMMU.
- Apply some of Laurent Pinchart's rework patches: Move the driver to drivers/iommu/.
- Use platform_data to specify attaching devices instead of ipmmu_add_device() API.
v4:
- Rebased on 3.7-rc1.
- Use address space size instead of page table size in config.
- Use Kconfig default value instead of #ifdef-#define-#endif. v3:
- Rebased on 3.6-rc5.
- Simplify configs. SHMOBILE_IPMMU is now selected by setting SHMOBILE_IOMMU.
- Remove weak symbols.
- Use drvdata to store private driver data.
- Make a function for writing to a register of IPMMU.
- Add a lock to accessing the tlb_enabled member.
- Make unmap work correctly with size larger than map size.
- Free L2 page table when 1MiB page is mapped or unmapped.
- Add VEU devices as IP blocks on the ICB.
v2:
- Rebased on v3.6-rc1.
- Make variable names clear.
- Page table size can now be selected by config.

Hideki EIRAKU (4):
iommu/shmobile: Add iommu driver for Renesas IPMMU modules
ARM: mach-shmobile: sh7372: Add IPMMU device
ARM: mach-shmobile: sh73a0: Add IPMMU device
ARM: mach-shmobile: r8a7740: Add IPMMU device

 arch/arm/mach-shmobile/setup-r8a7740.c |  33 +++
 arch/arm/mach-shmobile/setup-sh7372.c  |  39 ++++
 arch/arm/mach-shmobile/setup-sh73a0.c  |  31 +++
 drivers/iommu/Kconfig                  |  74 ++++++
 drivers/iommu/Makefile                 |   2 +
 drivers/iommu/shmobile-iommu.c         | 395 +++++++++++++++++++++++++++++++++
 drivers/iommu/shmobile-ipmmu.c         | 136 ++++++++++++
 drivers/iommu/shmobile-ipmmu.h         |  34 +++
 include/linux/platform_data/sh_ipmmu.h |  18 ++
 9 files changed, 762 insertions(+)
 create mode 100644 drivers/iommu/shmobile-iommu.c
 create mode 100644 drivers/iommu/shmobile-ipmmu.c
 create mode 100644 drivers/iommu/shmobile-ipmmu.h
 create mode 100644 include/linux/platform_data/sh_ipmmu.h
Signature · 1 line
1.8.0
#1 lore raw

PATCH v6 1/4 iommu/shmobile: Add iommu driver for Renesas IPMMU modules

This is the Renesas IPMMU driver and IOMMU API implementation.

The IPMMU module supports the MMU function and the PMB function. The MMU function provides address translation by pagetable compatible with ARMv6. The PMB function provides address translation including tile-linear translation. This patch implements the MMU function.

The iommu driver does not register a platform driver directly because:
- the register space of the MMU function and the PMB function have a common register (used for settings flush), so they should ideally have a way to appropriately share this register.
- the MMU function uses the IOMMU API while the PMB function does not.
- the two functions may be used independently.

---
 drivers/iommu/Kconfig                  |  74 ++++++
 drivers/iommu/Makefile                 |   2 +
 drivers/iommu/shmobile-iommu.c         | 395 +++++++++++++++++++++++++++++++++
 drivers/iommu/shmobile-ipmmu.c         | 136 ++++++++++++
 drivers/iommu/shmobile-ipmmu.h         |  34 +++
 include/linux/platform_data/sh_ipmmu.h |  18 ++
 6 files changed, 659 insertions(+)
 create mode 100644 drivers/iommu/shmobile-iommu.c
 create mode 100644 drivers/iommu/shmobile-ipmmu.c
 create mode 100644 drivers/iommu/shmobile-ipmmu.h
 create mode 100644 include/linux/platform_data/sh_ipmmu.h
drivers/iommu/Kconfig +74 -0
index e39f9db..d364494 100644
@@ -187,4 +187,78 @@ config EXYNOS_IOMMU_DEBUG
 
 	  Say N unless you need kernel log message for IOMMU debugging
 
+config SHMOBILE_IPMMU
+	bool
+
+config SHMOBILE_IPMMU_TLB
+	bool
+
+config SHMOBILE_IOMMU
+	bool "IOMMU for Renesas IPMMU/IPMMUI"
+	default n
+	depends on (ARM && ARCH_SHMOBILE)
+	select IOMMU_API
+	select ARM_DMA_USE_IOMMU
+	select SHMOBILE_IPMMU
+	select SHMOBILE_IPMMU_TLB
+	help
+	  Support for Renesas IPMMU/IPMMUI. This option enables
+	  remapping of DMA memory accesses from all of the IP blocks
+	  on the ICB.
+
+	  Warning: Drivers (including userspace drivers of UIO
+	  devices) of the IP blocks on the ICB *must* use addresses
+	  allocated from the IPMMU (iova) for DMA with this option
+	  enabled.
+
+	  If unsure, say N.
+
+choice
+	prompt "IPMMU/IPMMUI address space size"
+	default SHMOBILE_IOMMU_ADDRSIZE_2048MB
+	depends on SHMOBILE_IOMMU
+	help
+	  This option sets IPMMU/IPMMUI address space size by
+	  adjusting the 1st level page table size. The page table size
+	  is calculated as follows:
+
+	      page table size = number of page table entries * 4 bytes
+	      number of page table entries = address space size / 1 MiB
+
+	  For example, when the address space size is 2048 MiB, the
+	  1st level page table size is 8192 bytes.
+
+	config SHMOBILE_IOMMU_ADDRSIZE_2048MB
+		bool "2 GiB"
+
+	config SHMOBILE_IOMMU_ADDRSIZE_1024MB
+		bool "1 GiB"
+
+	config SHMOBILE_IOMMU_ADDRSIZE_512MB
+		bool "512 MiB"
+
+	config SHMOBILE_IOMMU_ADDRSIZE_256MB
+		bool "256 MiB"
+
+	config SHMOBILE_IOMMU_ADDRSIZE_128MB
+		bool "128 MiB"
+
+	config SHMOBILE_IOMMU_ADDRSIZE_64MB
+		bool "64 MiB"
+
+	config SHMOBILE_IOMMU_ADDRSIZE_32MB
+		bool "32 MiB"
+
+endchoice
+
+config SHMOBILE_IOMMU_L1SIZE
+	int
+	default 8192 if SHMOBILE_IOMMU_ADDRSIZE_2048MB
+	default 4096 if SHMOBILE_IOMMU_ADDRSIZE_1024MB
+	default 2048 if SHMOBILE_IOMMU_ADDRSIZE_512MB
+	default 1024 if SHMOBILE_IOMMU_ADDRSIZE_256MB
+	default 512 if SHMOBILE_IOMMU_ADDRSIZE_128MB
+	default 256 if SHMOBILE_IOMMU_ADDRSIZE_64MB
+	default 128 if SHMOBILE_IOMMU_ADDRSIZE_32MB
+
 endif # IOMMU_SUPPORT
drivers/iommu/Makefile +2 -0
index f66b816..ef0e520 100644
@@ -13,3 +13,5 @@ obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o
 obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o
 obj-$(CONFIG_TEGRA_IOMMU_SMMU) += tegra-smmu.o
 obj-$(CONFIG_EXYNOS_IOMMU) += exynos-iommu.o
+obj-$(CONFIG_SHMOBILE_IOMMU) += shmobile-iommu.o
+obj-$(CONFIG_SHMOBILE_IPMMU) += shmobile-ipmmu.o
drivers/iommu/shmobile-iommu.c new file +395 -0

395 lines not on this page · raw message

drivers/iommu/shmobile-ipmmu.c new file +136 -0

136 lines not on this page · raw message

drivers/iommu/shmobile-ipmmu.h new file +34 -0
new file mode 100644
index 0000000..4d53684
@@ -0,0 +1,34 @@
+/* shmobile-ipmmu.h
+ *
+ * Copyright (C) 2012  Hideki EIRAKU
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#ifndef __SHMOBILE_IPMMU_H__
+#define __SHMOBILE_IPMMU_H__
+
+struct shmobile_ipmmu {
+	struct device *dev;
+	void __iomem *ipmmu_base;
+	int tlb_enabled;
+	struct mutex flush_lock;
+	const char * const *dev_names;
+	unsigned int num_dev_names;
+};
+
+#ifdef CONFIG_SHMOBILE_IPMMU_TLB
+void ipmmu_tlb_flush(struct shmobile_ipmmu *ipmmu);
+void ipmmu_tlb_set(struct shmobile_ipmmu *ipmmu, unsigned long phys, int size,
+		   int asid);
+int ipmmu_iommu_init(struct shmobile_ipmmu *ipmmu);
+#else
+static inline int ipmmu_iommu_init(struct shmobile_ipmmu *ipmmu)
+{
+	return -EINVAL;
+}
+#endif
+
+#endif /* __SHMOBILE_IPMMU_H__ */
include/linux/platform_data/sh_ipmmu.h new file +18 -0
new file mode 100644
index 0000000..39f7405
@@ -0,0 +1,18 @@
+/* sh_ipmmu.h
+ *
+ * Copyright (C) 2012  Hideki EIRAKU
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#ifndef __SH_IPMMU_H__
+#define __SH_IPMMU_H__
+
+struct shmobile_ipmmu_platform_data {
+	const char * const *dev_names;
+	unsigned int num_dev_names;
+};
+
+#endif /* __SH_IPMMU_H__ */
Signature · 1 line
1.8.0
maintainer
#2 lore raw

Re: [PATCH v6 1/4] iommu/shmobile: Add iommu driver for Renesas IPMMU modules

Quoted 7 lines · Hideki EIRAKU

This is the Renesas IPMMU driver and IOMMU API implementation.

The IPMMU module supports the MMU function and the PMB function. The MMU function provides address translation by pagetable compatible with ARMv6. The PMB function provides address translation including tile-linear translation. This patch implements the MMU function.

Quoted 8 lines

The iommu driver does not register a platform driver directly because:
- the register space of the MMU function and the PMB function have a common register (used for settings flush), so they should ideally have a way to appropriately share this register.
- the MMU function uses the IOMMU API while the PMB function does not.
- the two functions may be used independently.

The patch looks good in general. Just one question inline.

drivers/iommu/shmobile-iommu.c line 59

Quoted 10 lines
drivers/iommu/shmobile-iommu.c new file +10 -0
+static int pgtable_alloc(struct shmobile_iommu_domain_pgtable *pgtable,
+			 struct kmem_cache *cache, size_t size)
+{
+	pgtable->pgtable = kmem_cache_zalloc(cache, GFP_ATOMIC);
+	if (!pgtable->pgtable)
+		return -ENOMEM;
+	pgtable->handle = dma_map_single(NULL, pgtable->pgtable, size,
+					 DMA_TO_DEVICE);
+	return 0;
+}

Why is it necessary to call dma_map_single() for IOMMU page-tables? usually the dma_* functions call into IOMMU drivers, so why are they used inside an IOMMU driver?

Regards,

Joerg

#3 lore raw

Re: [PATCH v6 1/4] iommu/shmobile: Add iommu driver for Renesas IPMMU modules

Joerg Roedel,

From: Joerg Roedel <[email protected]>
Subject: Re: [PATCH v6 1/4] iommu/shmobile: Add iommu driver for Renesas IPMMU modules
Date: Fri, 1 Feb 2013 14:54:57 +0100

Quoted 19 lines · Hideki EIRAKU
Quoted 7 lines

This is the Renesas IPMMU driver and IOMMU API implementation.

The IPMMU module supports the MMU function and the PMB function. The MMU function provides address translation by pagetable compatible with ARMv6. The PMB function provides address translation including tile-linear translation. This patch implements the MMU function.

Quoted 8 lines

The iommu driver does not register a platform driver directly because:
- the register space of the MMU function and the PMB function have a common register (used for settings flush), so they should ideally have a way to appropriately share this register.
- the MMU function uses the IOMMU API while the PMB function does not.
- the two functions may be used independently.

The patch looks good in general. Just one question inline.

Quoted 14 lines

drivers/iommu/shmobile-iommu.c line 59

Quoted 10 lines
drivers/iommu/shmobile-iommu.c new file +10 -0
+static int pgtable_alloc(struct shmobile_iommu_domain_pgtable *pgtable,
+			 struct kmem_cache *cache, size_t size)
+{
+	pgtable->pgtable = kmem_cache_zalloc(cache, GFP_ATOMIC);
+	if (!pgtable->pgtable)
+		return -ENOMEM;
+	pgtable->handle = dma_map_single(NULL, pgtable->pgtable, size,
+					 DMA_TO_DEVICE);
+	return 0;
+}

Why is it necessary to call dma_map_single() for IOMMU page-tables? usually the dma_* functions call into IOMMU drivers, so why are they used inside an IOMMU driver?

I use dma_map_single() for flushing the page table to the IOMMU device. The dma_map_ops set by arch/arm/mm/dma-mapping.c are per-device (unlike the intel-iommu). The dma_* functions call into IOMMU drivers if the device is attached by arm_iommu_attach_device(), but I am using a NULL device here, so that shouldn't happen.

Signature · 1 line
Hideki EIRAKU <[email protected]>
maintainer
#4 lore raw

Re: [PATCH v6 1/4] iommu/shmobile: Add iommu driver for Renesas IPMMU modules

Quoted 11 lines · Hideki EIRAKU

From: Joerg Roedel <[email protected]>

Quoted 3 lines

Why is it necessary to call dma_map_single() for IOMMU page-tables? usually the dma_* functions call into IOMMU drivers, so why are they used inside an IOMMU driver?

I use dma_map_single() for flushing the page table to the IOMMU device. The dma_map_ops set by arch/arm/mm/dma-mapping.c are per-device (unlike the intel-iommu). The dma_* functions call into IOMMU drivers if the device is attached by arm_iommu_attach_device(), but I am using a NULL device here, so that shouldn't happen.

Okay, I applied the patches to a new arm/shmobile branch. Will push them out soon. The use of the dma_* functions is dangerous anyway (but it works for now). Please send a follow-on patch to replace the use of the dma_* functions in the driver with explicit flushing routines. This protects the code from any future changes in the dma-api implementation.

Joerg

#5 lore raw

PATCH v6 2/4 ARM: mach-shmobile: sh7372: Add IPMMU device

In reply to Hideki EIRAKU

This patch adds an IPMMU device and notifies the IPMMU driver which devices are connected via the IPMMU module. All devices connected to the main memory bus via the IPMMU module MUST be registered when SHMOBILE_IPMMU and SHMOBILE_IOMMU are enabled because physical address cannot be used while the IPMMU module's MMU function is enabled.

---
 arch/arm/mach-shmobile/setup-sh7372.c | 39 +++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
arch/arm/mach-shmobile/setup-sh7372.c +39 -0
index c917882..04ad98e 100644
@@ -33,6 +33,7 @@
 #include <linux/sh_timer.h>
 #include <linux/pm_domain.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_data/sh_ipmmu.h>
 #include <mach/dma-register.h>
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -982,6 +983,43 @@ static struct platform_device spu1_device = {
 	.num_resources	= ARRAY_SIZE(spu1_resources),
 };
 
+/* IPMMUI (an IPMMU module for ICB/LMB) */
+static struct resource ipmmu_resources[] = {
+	[0] = {
+		.name	= "IPMMUI",
+		.start	= 0xfe951000,
+		.end	= 0xfe9510ff,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static const char * const ipmmu_dev_names[] = {
+	"sh_mobile_lcdc_fb.0",
+	"sh_mobile_lcdc_fb.1",
+	"sh_mobile_ceu.0",
+	"uio_pdrv_genirq.0",
+	"uio_pdrv_genirq.1",
+	"uio_pdrv_genirq.2",
+	"uio_pdrv_genirq.3",
+	"uio_pdrv_genirq.4",
+	"uio_pdrv_genirq.5",
+};
+
+static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
+	.dev_names = ipmmu_dev_names,
+	.num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
+};
+
+static struct platform_device ipmmu_device = {
+	.name           = "ipmmu",
+	.id             = -1,
+	.dev = {
+		.platform_data = &ipmmu_platform_data,
+	},
+	.resource       = ipmmu_resources,
+	.num_resources  = ARRAY_SIZE(ipmmu_resources),
+};
+
 static struct platform_device *sh7372_early_devices[] __initdata = {
 	&scif0_device,
 	&scif1_device,
@@ -993,6 +1031,7 @@ static struct platform_device *sh7372_early_devices[] __initdata = {
 	&cmt2_device,
 	&tmu00_device,
 	&tmu01_device,
+	&ipmmu_device,
 };
 
 static struct platform_device *sh7372_late_devices[] __initdata = {
Signature · 1 line
1.8.0
#6 lore raw

PATCH v6 3/4 ARM: mach-shmobile: sh73a0: Add IPMMU device

In reply to Hideki EIRAKU

This patch adds an IPMMU device and notifies the IPMMU driver which devices are connected via the IPMMU module. All devices connected to the main memory bus via the IPMMU module MUST be registered when SHMOBILE_IPMMU and SHMOBILE_IOMMU are enabled because physical address cannot be used while the IPMMU module's MMU function is enabled.

---
 arch/arm/mach-shmobile/setup-sh73a0.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
arch/arm/mach-shmobile/setup-sh73a0.c +31 -0
index db99a4a..36c2b2e 100644
@@ -30,6 +30,7 @@
 #include <linux/sh_dma.h>
 #include <linux/sh_intc.h>
 #include <linux/sh_timer.h>
+#include <linux/platform_data/sh_ipmmu.h>
 #include <mach/dma-register.h>
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -754,6 +755,35 @@ static struct platform_device pmu_device = {
 	.resource	= pmu_resources,
 };
 
+/* an IPMMU module for ICB */
+static struct resource ipmmu_resources[] = {
+	[0] = {
+		.name	= "IPMMU",
+		.start	= 0xfe951000,
+		.end	= 0xfe9510ff,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static const char * const ipmmu_dev_names[] = {
+	"sh_mobile_lcdc_fb.0",
+};
+
+static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
+	.dev_names = ipmmu_dev_names,
+	.num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
+};
+
+static struct platform_device ipmmu_device = {
+	.name           = "ipmmu",
+	.id             = -1,
+	.dev = {
+		.platform_data = &ipmmu_platform_data,
+	},
+	.resource       = ipmmu_resources,
+	.num_resources  = ARRAY_SIZE(ipmmu_resources),
+};
+
 static struct platform_device *sh73a0_early_devices[] __initdata = {
 	&scif0_device,
 	&scif1_device,
@@ -767,6 +797,7 @@ static struct platform_device *sh73a0_early_devices[] __initdata = {
 	&cmt10_device,
 	&tmu00_device,
 	&tmu01_device,
+	&ipmmu_device,
 };
 
 static struct platform_device *sh73a0_late_devices[] __initdata = {
Signature · 1 line
1.8.0
#7 lore raw

PATCH v6 4/4 ARM: mach-shmobile: r8a7740: Add IPMMU device

In reply to Hideki EIRAKU

This patch adds an IPMMU device and notifies the IPMMU driver which devices are connected via the IPMMU module. All devices connected to the main memory bus via the IPMMU module MUST be registered when SHMOBILE_IPMMU and SHMOBILE_IOMMU are enabled because physical address cannot be used while the IPMMU module's MMU function is enabled.

---
 arch/arm/mach-shmobile/setup-r8a7740.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/mach-shmobile/setup-r8a7740.c +33 -0
index 0952224..b85bea5 100644
@@ -28,6 +28,7 @@
 #include <linux/sh_dma.h>
 #include <linux/sh_timer.h>
 #include <linux/dma-mapping.h>
+#include <linux/platform_data/sh_ipmmu.h>
 #include <mach/dma-register.h>
 #include <mach/r8a7740.h>
 #include <mach/pm-rmobile.h>
@@ -262,6 +263,37 @@ static struct platform_device cmt10_device = {
 	.num_resources	= ARRAY_SIZE(cmt10_resources),
 };
 
+/* IPMMUI (an IPMMU module for ICB/LMB) */
+static struct resource ipmmu_resources[] = {
+	[0] = {
+		.name	= "IPMMUI",
+		.start	= 0xfe951000,
+		.end	= 0xfe9510ff,
+		.flags	= IORESOURCE_MEM,
+	},
+};
+
+static const char * const ipmmu_dev_names[] = {
+	"sh_mobile_lcdc_fb.0",
+	"sh_mobile_lcdc_fb.1",
+	"sh_mobile_ceu.0",
+};
+
+static struct shmobile_ipmmu_platform_data ipmmu_platform_data = {
+	.dev_names = ipmmu_dev_names,
+	.num_dev_names = ARRAY_SIZE(ipmmu_dev_names),
+};
+
+static struct platform_device ipmmu_device = {
+	.name           = "ipmmu",
+	.id             = -1,
+	.dev = {
+		.platform_data = &ipmmu_platform_data,
+	},
+	.resource       = ipmmu_resources,
+	.num_resources  = ARRAY_SIZE(ipmmu_resources),
+};
+
 static struct platform_device *r8a7740_early_devices[] __initdata = {
 	&scif0_device,
 	&scif1_device,
@@ -273,6 +305,7 @@ static struct platform_device *r8a7740_early_devices[] __initdata = {
 	&scif7_device,
 	&scifb_device,
 	&cmt10_device,
+	&ipmmu_device,
 };
 
 /* DMA */
Signature · 1 line
1.8.0
maintainer
#8 lore raw
In reply to Hideki EIRAKU
Quoted 5 lines · Hideki EIRAKU

Hideki EIRAKU (4):
iommu/shmobile: Add iommu driver for Renesas IPMMU modules
ARM: mach-shmobile: sh7372: Add IPMMU device
ARM: mach-shmobile: sh73a0: Add IPMMU device
ARM: mach-shmobile: r8a7740: Add IPMMU device

Paul, Magnus, any opinions on patches 2-4? Can you ACK them when they are ok for you?

Joerg

Acked-by
#9 lore raw
Quoted 10 lines · Joerg Roedel
Quoted 5 lines · Hideki EIRAKU

Hideki EIRAKU (4):
iommu/shmobile: Add iommu driver for Renesas IPMMU modules
ARM: mach-shmobile: sh7372: Add IPMMU device
ARM: mach-shmobile: sh73a0: Add IPMMU device
ARM: mach-shmobile: r8a7740: Add IPMMU device

Paul, Magnus, any opinions on patches 2-4? Can you ACK them when they are ok for you?

No strong opinions one way or the other, patches 2-4 don't really do anything of significance.

Acked-by
#10 lore raw
Quoted 8 lines · Paul Mundt
Quoted 7 lines · Joerg Roedel
Quoted 5 lines · Hideki EIRAKU

Hideki EIRAKU (4):
iommu/shmobile: Add iommu driver for Renesas IPMMU modules
ARM: mach-shmobile: sh7372: Add IPMMU device
ARM: mach-shmobile: sh73a0: Add IPMMU device
ARM: mach-shmobile: r8a7740: Add IPMMU device

Quoted 7 lines
Quoted 3 lines

Paul, Magnus, any opinions on patches 2-4? Can you ACK them when they are ok for you?

No strong opinions one way or the other, patches 2-4 don't really do anything of significance.

Likewise. shmobile patches: