Skip to contentSkip to conversation

Cleanup legacy OMAP IOMMU device creation

PATCH New Suman Anna 2 participants 7 messages Sep 16, 2015 – Nov 30, 2015

Subsystems (4)
lore
Share & tools
lore

Suman Anna

author
#0 lore raw

cover Cleanup legacy OMAP IOMMU device creation

Hi Tony,

The following series removes the legacy platform device creation logic for OMAP IOMMU devices. I will cleanup the legacy support from the OMAP IOMMU driver in a subsequent merge window after this series makes it to mainline.

Patches are based on 4.3-rc1 + the OMAP3 ISP instantiation cleanup patch [1]. All the patches need to be picked up sequentially, otherwise a NULL pointer dereference crash might be seen on OMAP3 legacy boots as the dev attribute structure is deferenced directly in mach-omap2/omap-iommu.c during platform data creation. Also, the last patch removes the structure definition altogether, so will cause build issues if picked separately from the hwmod cleanup patches.

I do not have any boards where I can still perform a legacy-style boot, so patches verified using DT-boot only.

regards
Suman

[1] https://patchwork.kernel.org/patch/6806891/

Suman Anna (4):
ARM: OMAP2+: Remove legacy device instantiation of IOMMUs
ARM: OMAP3: hwmod data: Remove legacy IOMMU data
ARM: OMAP4: hwmod data: Remove legacy IOMMU attr and addrs
ARM: OMAP2+: Remove omap_mmu_dev_attr structure

 arch/arm/mach-omap2/omap-iommu.c           | 66 ------------------------------
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 42 -------------------
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 31 --------------
 include/linux/platform_data/iommu-omap.h   |  9 ----
 4 files changed, 148 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/omap-iommu.c
Signature · 1 line
2.5.0
author
#1 lore raw

PATCH 1/4 ARM: OMAP2+: Remove legacy device instantiation of IOMMUs

The legacy-style IOMMU device creation is maintained currently only for OMAP3 SoC, as all other SoCs are DT-boot only, and also to ensure functionality of the OMAP3 ISP driver, the only in-kernel client user on OMAP3 that supported both modes.

Commit 78c66fbcec71 ("[media] v4l: omap3isp: Drop platform data support") removed the legacy device support from the OMAP3 ISP driver, so the legacy device instantiation of OMAP IOMMU devices is no longer needed, and is cleaned up.

---
 arch/arm/mach-omap2/omap-iommu.c | 66 ----------------------------------------
 1 file changed, 66 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/omap-iommu.c
arch/arm/mach-omap2/omap-iommu.c deleted +0 -66
deleted file mode 100644
index 8867eb4025bf..000000000000
@@ -1,66 +0,0 @@
-/*
- * omap iommu: omap device registration
- *
- * Copyright (C) 2008-2009 Nokia Corporation
- *
- * Written by Hiroshi DOYU <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/of.h>
-#include <linux/platform_device.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-
-#include <linux/platform_data/iommu-omap.h>
-#include "soc.h"
-#include "omap_hwmod.h"
-#include "omap_device.h"
-
-static int __init omap_iommu_dev_init(struct omap_hwmod *oh, void *unused)
-{
-	struct platform_device *pdev;
-	struct iommu_platform_data *pdata;
-	struct omap_mmu_dev_attr *a = (struct omap_mmu_dev_attr *)oh->dev_attr;
-	static int i;
-
-	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
-	if (!pdata)
-		return -ENOMEM;
-
-	pdata->name = oh->name;
-	pdata->nr_tlb_entries = a->nr_tlb_entries;
-
-	if (oh->rst_lines_cnt == 1) {
-		pdata->reset_name = oh->rst_lines->name;
-		pdata->assert_reset = omap_device_assert_hardreset;
-		pdata->deassert_reset = omap_device_deassert_hardreset;
-	}
-
-	pdev = omap_device_build("omap-iommu", i, oh, pdata, sizeof(*pdata));
-
-	kfree(pdata);
-
-	if (IS_ERR(pdev)) {
-		pr_err("%s: device build err: %ld\n", __func__, PTR_ERR(pdev));
-		return PTR_ERR(pdev);
-	}
-
-	i++;
-
-	return 0;
-}
-
-static int __init omap_iommu_init(void)
-{
-	/* If dtb is there, the devices will be created dynamically */
-	if (of_have_populated_dt())
-		return -ENODEV;
-
-	return omap_hwmod_for_each_by_class("mmu", omap_iommu_dev_init, NULL);
-}
-omap_subsys_initcall(omap_iommu_init);
-/* must be ready before omap3isp is probed */
Signature · 1 line
2.5.0
author
#2 lore raw

PATCH 2/4 ARM: OMAP3: hwmod data: Remove legacy IOMMU data

In reply to Suman Anna

The legacy-mode device creation logic for IOMMU devices has been cleaned up, so the device attribute data, irq information and address data are no longer required. Remove all of these data for the ISP & IVA IOMMU devices.

---
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 42 ------------------------------
 1 file changed, 42 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +0 -42
index dc55f8dedf2c..01dfccaa0c3e 100644
@@ -25,7 +25,6 @@
 #include "l4_3xxx.h"
 #include <linux/platform_data/asoc-ti-mcbsp.h>
 #include <linux/platform_data/spi-omap2-mcspi.h>
-#include <linux/platform_data/iommu-omap.h>
 #include <linux/platform_data/mailbox-omap.h>
 #include <plat/dmtimer.h>
 
@@ -2976,80 +2975,40 @@ static struct omap_hwmod_class omap3xxx_mmu_hwmod_class = {
 };
 
 /* mmu isp */
-
-static struct omap_mmu_dev_attr mmu_isp_dev_attr = {
-	.nr_tlb_entries = 8,
-};
-
 static struct omap_hwmod omap3xxx_mmu_isp_hwmod;
-static struct omap_hwmod_irq_info omap3xxx_mmu_isp_irqs[] = {
-	{ .irq = 24 + OMAP_INTC_START, },
-	{ .irq = -1 }
-};
-
-static struct omap_hwmod_addr_space omap3xxx_mmu_isp_addrs[] = {
-	{
-		.pa_start	= 0x480bd400,
-		.pa_end		= 0x480bd47f,
-		.flags		= ADDR_TYPE_RT,
-	},
-	{ }
-};
 
 /* l4_core -> mmu isp */
 static struct omap_hwmod_ocp_if omap3xxx_l4_core__mmu_isp = {
 	.master		= &omap3xxx_l4_core_hwmod,
 	.slave		= &omap3xxx_mmu_isp_hwmod,
-	.addr		= omap3xxx_mmu_isp_addrs,
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 static struct omap_hwmod omap3xxx_mmu_isp_hwmod = {
 	.name		= "mmu_isp",
 	.class		= &omap3xxx_mmu_hwmod_class,
-	.mpu_irqs	= omap3xxx_mmu_isp_irqs,
 	.main_clk	= "cam_ick",
-	.dev_attr	= &mmu_isp_dev_attr,
 	.flags		= HWMOD_NO_IDLEST,
 };
 
 /* mmu iva */
 
-static struct omap_mmu_dev_attr mmu_iva_dev_attr = {
-	.nr_tlb_entries = 32,
-};
-
 static struct omap_hwmod omap3xxx_mmu_iva_hwmod;
-static struct omap_hwmod_irq_info omap3xxx_mmu_iva_irqs[] = {
-	{ .irq = 28 + OMAP_INTC_START, },
-	{ .irq = -1 }
-};
 
 static struct omap_hwmod_rst_info omap3xxx_mmu_iva_resets[] = {
 	{ .name = "mmu", .rst_shift = 1, .st_shift = 9 },
 };
 
-static struct omap_hwmod_addr_space omap3xxx_mmu_iva_addrs[] = {
-	{
-		.pa_start	= 0x5d000000,
-		.pa_end		= 0x5d00007f,
-		.flags		= ADDR_TYPE_RT,
-	},
-	{ }
-};
-
 /* l3_main -> iva mmu */
 static struct omap_hwmod_ocp_if omap3xxx_l3_main__mmu_iva = {
 	.master		= &omap3xxx_l3_main_hwmod,
 	.slave		= &omap3xxx_mmu_iva_hwmod,
-	.addr		= omap3xxx_mmu_iva_addrs,
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
 static struct omap_hwmod omap3xxx_mmu_iva_hwmod = {
 	.name		= "mmu_iva",
 	.class		= &omap3xxx_mmu_hwmod_class,
-	.mpu_irqs	= omap3xxx_mmu_iva_irqs,
 	.clkdm_name	= "iva2_clkdm",
 	.rst_lines	= omap3xxx_mmu_iva_resets,
 	.rst_lines_cnt	= ARRAY_SIZE(omap3xxx_mmu_iva_resets),
@@ -3062,7 +3021,6 @@ static struct omap_hwmod omap3xxx_mmu_iva_hwmod = {
 			.idlest_idle_bit = OMAP3430_ST_IVA2_SHIFT,
 		},
 	},
-	.dev_attr	= &mmu_iva_dev_attr,
 	.flags		= HWMOD_NO_IDLEST,
 };
 
Signature · 1 line
2.5.0
author
#3 lore raw

PATCH 3/4 ARM: OMAP4: hwmod data: Remove legacy IOMMU attr and addrs

In reply to Suman Anna

OMAP4 has been DT-boot only for some time, and the legacy-mode device creation logic for IOMMU devices has also been cleaned up, so the dev_attr and address data is no longer required. So, remove these attribute data and hwmod addr space for the IPU & DSP IOMMU devices.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 31 ------------------------------
 1 file changed, 31 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +0 -31
index 43eebf2c59e2..56586b5d6051 100644
@@ -30,7 +30,6 @@
 
 #include <linux/platform_data/spi-omap2-mcspi.h>
 #include <linux/platform_data/asoc-ti-mcbsp.h>
-#include <linux/platform_data/iommu-omap.h>
 #include <plat/dmtimer.h>
 
 #include "omap_hwmod.h"
@@ -2088,30 +2087,16 @@ static struct omap_hwmod_class omap44xx_mmu_hwmod_class = {
 
 /* mmu ipu */
 
-static struct omap_mmu_dev_attr mmu_ipu_dev_attr = {
-	.nr_tlb_entries = 32,
-};
-
 static struct omap_hwmod omap44xx_mmu_ipu_hwmod;
 static struct omap_hwmod_rst_info omap44xx_mmu_ipu_resets[] = {
 	{ .name = "mmu_cache", .rst_shift = 2 },
 };
 
-static struct omap_hwmod_addr_space omap44xx_mmu_ipu_addrs[] = {
-	{
-		.pa_start	= 0x55082000,
-		.pa_end		= 0x550820ff,
-		.flags		= ADDR_TYPE_RT,
-	},
-	{ }
-};
-
 /* l3_main_2 -> mmu_ipu */
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__mmu_ipu = {
 	.master		= &omap44xx_l3_main_2_hwmod,
 	.slave		= &omap44xx_mmu_ipu_hwmod,
 	.clk		= "l3_div_ck",
-	.addr		= omap44xx_mmu_ipu_addrs,
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -2130,35 +2115,20 @@ static struct omap_hwmod omap44xx_mmu_ipu_hwmod = {
 			.modulemode   = MODULEMODE_HWCTRL,
 		},
 	},
-	.dev_attr	= &mmu_ipu_dev_attr,
 };
 
 /* mmu dsp */
 
-static struct omap_mmu_dev_attr mmu_dsp_dev_attr = {
-	.nr_tlb_entries = 32,
-};
-
 static struct omap_hwmod omap44xx_mmu_dsp_hwmod;
 static struct omap_hwmod_rst_info omap44xx_mmu_dsp_resets[] = {
 	{ .name = "mmu_cache", .rst_shift = 1 },
 };
 
-static struct omap_hwmod_addr_space omap44xx_mmu_dsp_addrs[] = {
-	{
-		.pa_start	= 0x4a066000,
-		.pa_end		= 0x4a0660ff,
-		.flags		= ADDR_TYPE_RT,
-	},
-	{ }
-};
-
 /* l4_cfg -> dsp */
 static struct omap_hwmod_ocp_if omap44xx_l4_cfg__mmu_dsp = {
 	.master		= &omap44xx_l4_cfg_hwmod,
 	.slave		= &omap44xx_mmu_dsp_hwmod,
 	.clk		= "l4_div_ck",
-	.addr		= omap44xx_mmu_dsp_addrs,
 	.user		= OCP_USER_MPU | OCP_USER_SDMA,
 };
 
@@ -2177,7 +2147,6 @@ static struct omap_hwmod omap44xx_mmu_dsp_hwmod = {
 			.modulemode   = MODULEMODE_HWCTRL,
 		},
 	},
-	.dev_attr	= &mmu_dsp_dev_attr,
 };
 
 /*
Signature · 1 line
2.5.0
author
#4 lore raw

PATCH 4/4 ARM: OMAP2+: Remove omap_mmu_dev_attr structure

In reply to Suman Anna

The structure omap_mmu_dev_attr was used in the hwmod data for supplying device-specific data through the .dev_attr field and used in constructing the platform data for legacy device creation. The legacy device creation of OMAP IOMMU devices has been cleaned up, and this structure is no longer needed, so remove it.

---
 include/linux/platform_data/iommu-omap.h | 9 ---------
 1 file changed, 9 deletions(-)
include/linux/platform_data/iommu-omap.h +0 -9
index 54a0a9582fad..0496d171700a 100644
@@ -29,15 +29,6 @@ struct omap_iommu_arch_data {
 	struct omap_iommu *iommu_dev;
 };
 
-/**
- * struct omap_mmu_dev_attr - OMAP mmu device attributes for omap_hwmod
- * @nr_tlb_entries:	number of entries supported by the translation
- *			look-aside buffer (TLB).
- */
-struct omap_mmu_dev_attr {
-	int nr_tlb_entries;
-};
-
 struct iommu_platform_data {
 	const char *name;
 	const char *reset_name;
Signature · 1 line
2.5.0
author
#5 lore raw

cover Cleanup legacy OMAP IOMMU device creation

In reply to Suman Anna

Hi Tony,

Quoted 22 lines · Suman Anna

Hi Tony,

The following series removes the legacy platform device creation logic for OMAP IOMMU devices. I will cleanup the legacy support from the OMAP IOMMU driver in a subsequent merge window after this series makes it to mainline.

Patches are based on 4.3-rc1 + the OMAP3 ISP instantiation cleanup patch [1]. All the patches need to be picked up sequentially, otherwise a NULL pointer dereference crash might be seen on OMAP3 legacy boots as the dev attribute structure is deferenced directly in mach-omap2/omap-iommu.c during platform data creation. Also, the last patch removes the structure definition altogether, so will cause build issues if picked separately from the hwmod cleanup patches.

I do not have any boards where I can still perform a legacy-style boot, so patches verified using DT-boot only.

regards
Suman

Quoted 7 lines

[1] https://patchwork.kernel.org/patch/6806891/

Suman Anna (4):
ARM: OMAP2+: Remove legacy device instantiation of IOMMUs
ARM: OMAP3: hwmod data: Remove legacy IOMMU data
ARM: OMAP4: hwmod data: Remove legacy IOMMU attr and addrs
ARM: OMAP2+: Remove omap_mmu_dev_attr structure

Ping on this series. You should be able to pick up atleast patch 1 if not picking all, now that the OMAP3 ISP cleanup patch is staged in your omap-for-4.4/cleanup branch.

Thanks
Suman

Quoted 8 lines
 arch/arm/mach-omap2/omap-iommu.c           | 66 ------------------------------
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 42 -------------------
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 31 --------------
 include/linux/platform_data/iommu-omap.h   |  9 ----
 4 files changed, 148 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/omap-iommu.c
maintainer
#6 lore raw

cover Cleanup legacy OMAP IOMMU device creation

Quoted 33 lines · Suman Anna

Hi Tony,

Quoted 22 lines · Suman Anna

Hi Tony,

The following series removes the legacy platform device creation logic for OMAP IOMMU devices. I will cleanup the legacy support from the OMAP IOMMU driver in a subsequent merge window after this series makes it to mainline.

Patches are based on 4.3-rc1 + the OMAP3 ISP instantiation cleanup patch [1]. All the patches need to be picked up sequentially, otherwise a NULL pointer dereference crash might be seen on OMAP3 legacy boots as the dev attribute structure is deferenced directly in mach-omap2/omap-iommu.c during platform data creation. Also, the last patch removes the structure definition altogether, so will cause build issues if picked separately from the hwmod cleanup patches.

I do not have any boards where I can still perform a legacy-style boot, so patches verified using DT-boot only.

regards
Suman

Quoted 7 lines

[1] https://patchwork.kernel.org/patch/6806891/

Suman Anna (4):
ARM: OMAP2+: Remove legacy device instantiation of IOMMUs
ARM: OMAP3: hwmod data: Remove legacy IOMMU data
ARM: OMAP4: hwmod data: Remove legacy IOMMU attr and addrs
ARM: OMAP2+: Remove omap_mmu_dev_attr structure

Quoted 3 lines

Ping on this series. You should be able to pick up atleast patch 1 if not picking all, now that the OMAP3 ISP cleanup patch is staged in your omap-for-4.4/cleanup branch.

Sorry for the delays, applying this series into omap-for-v4.5/soc.

Regards,

Tony