Renesas IPMMU driver for sh7372
Subsystems (5)
v2 cover Renesas IPMMU driver for sh7372
This is the Renesas IPMMU driver, IOMMU API implementation and IPMMU device support for sh7372 (AP4EVB and Mackerel).
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.
v2:
- Rebased on v3.6-rc1.
- Make variable names clear.
- Page table size can now be selected by config.
Hideki EIRAKU (2):
iommu/shmobile: Add iommu driver for Renesas IPMMU modules
ARM: mach-shmobile: sh7372: Add IPMMU device
arch/arm/mach-shmobile/Kconfig | 6 + arch/arm/mach-shmobile/Makefile | 3 + arch/arm/mach-shmobile/board-ap4evb.c | 5 + arch/arm/mach-shmobile/board-mackerel.c | 5 + arch/arm/mach-shmobile/include/mach/ipmmu.h | 10 + arch/arm/mach-shmobile/ipmmu.c | 130 ++++++++++ arch/arm/mach-shmobile/setup-sh7372.c | 22 ++ drivers/iommu/Kconfig | 35 +++ drivers/iommu/Makefile | 1 + drivers/iommu/shmobile-iommu.c | 342 +++++++++++++++++++++++++++ 10 files changed, 559 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-shmobile/include/mach/ipmmu.h create mode 100644 arch/arm/mach-shmobile/ipmmu.c create mode 100644 drivers/iommu/shmobile-iommu.c
PATCH v2 1/2 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.
--- arch/arm/mach-shmobile/Kconfig | 6 + arch/arm/mach-shmobile/Makefile | 3 + arch/arm/mach-shmobile/include/mach/ipmmu.h | 10 + arch/arm/mach-shmobile/ipmmu.c | 130 ++++++++++ drivers/iommu/Kconfig | 35 +++ drivers/iommu/Makefile | 1 + drivers/iommu/shmobile-iommu.c | 342 +++++++++++++++++++++++++++ 7 files changed, 527 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-shmobile/include/mach/ipmmu.h create mode 100644 arch/arm/mach-shmobile/ipmmu.c create mode 100644 drivers/iommu/shmobile-iommu.c
arch/arm/mach-shmobile/Kconfig +6 -0
@@ -210,6 +210,12 @@ endmenu config SH_CLK_CPG bool +config SHMOBILE_IPMMU + bool "IPMMU/IPMMUI driver" + default n + help + This enables build of the IPMMU/IPMMUI driver. + source "drivers/sh/Kconfig" endif
arch/arm/mach-shmobile/Makefile +3 -0
@@ -60,3 +60,6 @@ obj-$(CONFIG_MACH_KZM9G) += board-kzm9g.o # Framework support obj-$(CONFIG_SMP) += $(smp-y) obj-$(CONFIG_GENERIC_GPIO) += $(pfc-y) + +# IPMMU/IPMMUI +obj-$(CONFIG_SHMOBILE_IPMMU) += ipmmu.o
arch/arm/mach-shmobile/include/mach/ipmmu.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifdef CONFIG_SHMOBILE_IPMMU +void ipmmu_tlb_flush (void ); +void ipmmu_tlb_set (unsigned long phys,int size,int asid); +void ipmmu_add_device (struct device *dev); +int ipmmu_iommu_init (struct device *dev); +#else +static inline void ipmmu_add_device (struct device *dev) +{ +} +#endif
arch/arm/mach-shmobile/ipmmu.c new file +130 -0
130 lines not on this page · raw message
drivers/iommu/Kconfig +35 -0
@@ -187,4 +187,39 @@ config EXYNOS_IOMMU_DEBUG Say N unless you need kernel log message for IOMMU debugging +config SHMOBILE_IOMMU + bool "IOMMU for Renesas IPMMU/IPMMUI" + default n + depends on SHMOBILE_IPMMU + select IOMMU_API + select ARM_DMA_USE_IOMMU + +choice + prompt "IPMMU/IPMMUI 1st level page table size" + default SHMOBILE_IOMMU_L1SIZE_8192 + depends on SHMOBILE_IOMMU + + config SHMOBILE_IOMMU_L1SIZE_8192 + bool "8192 bytes (2 GiB address space)" + + config SHMOBILE_IOMMU_L1SIZE_4096 + bool "4096 bytes (1 GiB address space)" + + config SHMOBILE_IOMMU_L1SIZE_2048 + bool "2048 bytes (512 MiB address space)" + + config SHMOBILE_IOMMU_L1SIZE_1024 + bool "1024 bytes (256 MiB address space)" + + config SHMOBILE_IOMMU_L1SIZE_512 + bool "512 bytes (128 MiB address space)" + + config SHMOBILE_IOMMU_L1SIZE_256 + bool "256 bytes (64 MiB address space)" + + config SHMOBILE_IOMMU_L1SIZE_128 + bool "128 bytes (32 MiB address space)" + +endchoice + endif # IOMMU_SUPPORT
drivers/iommu/Makefile +1 -0
@@ -12,3 +12,4 @@ 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
drivers/iommu/shmobile-iommu.c new file +342 -0
342 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 2/2 ARM: mach-shmobile: sh7372: Add IPMMU device
In reply to Hideki EIRAKUThis 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/board-ap4evb.c | 5 +++++ arch/arm/mach-shmobile/board-mackerel.c | 5 +++++ arch/arm/mach-shmobile/setup-sh7372.c | 22 ++++++++++++++++++++++ 3 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-shmobile/board-ap4evb.c +5 -0
@@ -61,6 +61,7 @@#include <mach/common.h> #include <mach/irqs.h> #include <mach/sh7372.h> +#include <mach/ipmmu.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -1448,6 +1449,10 @@ static void __init ap4evb_init(void)sh7372_add_standard_devices (); +ipmmu_add_device (&lcdc_device.dev); +ipmmu_add_device (&lcdc1_device.dev); +ipmmu_add_device (&ceu_device.dev); +/* HDMI */ gpio_request (GPIO_FN_HDMI_HPD ,NULL );gpio_request (GPIO_FN_HDMI_CEC ,NULL );
arch/arm/mach-shmobile/board-mackerel.c +5 -0
@@ -60,6 +60,7 @@#include <mach/common.h> #include <mach/irqs.h> #include <mach/sh7372.h> +#include <mach/ipmmu.h> #include <asm/mach/arch.h> #include <asm/mach-types.h>
@@ -1621,6 +1622,10 @@ static void __init mackerel_init(void)sh7372_add_standard_devices (); +ipmmu_add_device (&lcdc_device.dev); +ipmmu_add_device (&hdmi_lcdc_device.dev); +ipmmu_add_device (&ceu_device.dev); +platform_add_devices (mackerel_devices,ARRAY_SIZE (mackerel_devices));rmobile_add_device_to_domain (&sh7372_pd_a4lc, &lcdc_device);
arch/arm/mach-shmobile/setup-sh7372.c +22 -0
@@ -38,6 +38,7 @@#include <mach/irqs.h> #include <mach/sh7372.h> #include <mach/common.h> +#include <mach/ipmmu.h> #include <asm/mach/map.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -968,6 +969,23 @@ 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 struct platform_device ipmmu_device = { + .name ="ipmmu" , + .id =-1 , + .resource = ipmmu_resources, + .num_resources =ARRAY_SIZE (ipmmu_resources), +}; +static struct platform_device *sh7372_early_devices[]__initdata = { &scif0_device, &scif1_device,
@@ -979,6 +997,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 = {
@@ -1020,6 +1039,9 @@ void __init sh7372_add_standard_devices(void)platform_add_devices (sh7372_early_devices,ARRAY_SIZE (sh7372_early_devices)); +ipmmu_add_device (&vpu_device.dev); +ipmmu_add_device (&jpu_device.dev); +platform_add_devices (sh7372_late_devices,ARRAY_SIZE (sh7372_late_devices));
Signature · 1 line
1.7.0.4