Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 4/4] ARM: OMAP: gpmc: add DT bindings for GPMC timings and NAND
From: Jon Hunter @ 2012-11-02 19:18 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <5093AB14.9090402@gmail.com>


On 11/02/2012 06:14 AM, Daniel Mack wrote:
> Hi Jon,
> 
> as all comments so far focussed on patch 4/4, could we agree to merge
> 1-3 of this series already? These are all small and straight-forward
> things that don't depend on 4/4. That way, I only need to resend the
> last one under discussion.

Not sure it makes sense to take 3 without 4.

> On 02.11.2012 11:41, Jon Hunter wrote:
>> Hi Daniel,
>>
>> On 11/01/2012 01:36 PM, Daniel Mack wrote:
>>> This patch adds basic DT bindings for OMAP GPMC.
>>>
>>> The actual peripherals are instanciated from child nodes within the GPMC
>>> node, and the only type of device that is currently supported is NAND.
>>>
>>> Code was added to parse the generic GPMC timing parameters and some
>>> documentation with examples on how to use them.
>>>
>>> Successfully tested on an AM33xx board.
>>>
>>> Signed-off-by: Daniel Mack <zonque@gmail.com>
>>> ---
>>>  Documentation/devicetree/bindings/bus/ti-gpmc.txt  |  73 +++++++++++
>>>  .../devicetree/bindings/mtd/gpmc-nand.txt          |  61 +++++++++
>>>  arch/arm/mach-omap2/gpmc.c                         | 139 +++++++++++++++++++++
>>>  3 files changed, 273 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>  create mode 100644 Documentation/devicetree/bindings/mtd/gpmc-nand.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/bus/ti-gpmc.txt b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>> new file mode 100644
>>> index 0000000..6f44487
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>> @@ -0,0 +1,73 @@
>>> +Device tree bindings for OMAP general purpose memory controllers (GPMC)
>>> +
>>> +The actual devices are instantiated from the child nodes of a GPMC node.
>>> +
>>> +Required properties:
>>> +
>>> + - compatible:		Should be set to "ti,gpmc"
>>> + - reg:			A resource specifier for the register space
>>> +			(see the example below)
>>> + - ti,hwmods:		Should be set to "ti,gpmc" until the DT transition is
>>> +			completed.
>>> + - #address-cells:	Must be set to 2 to allow memory address translation
>>> + - #size-cells:		Must be set to 1 to allow CS address passing
>>> + - ranges:		Must be set up to reflect the memory layout
>>> +			Note that this property is not currently parsed.
>>> +			Calculated values derived from the contents of
>>> +			GPMC_CS_CONFIG7 as set up by the bootloader. That will
>>> +			change in the future, so be sure to fill the correct
>>> +			values here.
>>
>> I still think it would be good to add number of chip-selects and
>> wait-pins here.
> 
> The number of chip-selects can be derived from the ranges property.
> Namely, each 4-value entry to this property maps to one chip-select. I
> can try and make the more clear in the documentation.

Yes but that only tells you how many you are using. The binding should
describe the hardware and so should tell us how many chip-selects we
have. We should get away from using GPMC_CS_NUM in the code.

What about wait-pins?

>>> +Timing properties for child nodes. All are optional and default to 0.
>>> +
>>> + - gpmc,sync-clk:	Minimum clock period for synchronous mode, in picoseconds
>>> +
>>> + Chip-select signal timings corresponding to GPMC_CS_CONFIG2:
>>> + - gpmc,cs-on:		Assertion time
>>> + - gpmc,cs-rd-off:	Read deassertion time
>>> + - gpmc,cs-wr-off:	Write deassertion time
>>> +
>>> + ADV signal timings corresponding to GPMC_CONFIG3:
>>> + - gpmc,adv-on:		Assertion time
>>> + - gpmc,adv-rd-off:	Read deassertion time
>>> + - gpmc,adv-wr-off:	Write deassertion time
>>
>> Nit-pick, looks like you are mixing GPMC_CS_CONFIGx and GPMC_CONFIGx
>> naming conventions in the above and below. Would be good to make this
>> consistent.
> 
> Ok, but these were just copied from arch/arm/mach-omap2/gpmc.h. So it's
> wrong there, too.

Please feel free to submit a patch.

>>> + WE signals timings corresponding to GPMC_CONFIG4:
>>> + - gpmc,we-on:		Assertion time
>>> + - gpmc,we-off:		Deassertion time
>>> +
>>> + OE signals timings corresponding to GPMC_CONFIG4
>>> + - gpmc,oe-on:		Assertion time
>>> + - gpmc,oe-off:		Deassertion time
>>> +
>>> + Access time and cycle time timings corresponding to GPMC_CONFIG5
>>> + - gpmc,page-burst-access: Multiple access word delay
>>> + - gpmc,access:		Start-cycle to first data valid delay
>>> + - gpmc,rd-cycle:	Total read cycle time
>>> + - gpmc,wr-cycle:	Total write cycle time
>>> +
>>> +The following are only on OMAP3430
>>> + - gpmc,wr-access
>>> + - gpmc,wr-data-mux-bus
>>> +
>>> +
>>> +Example for an AM33xx board:
>>> +
>>> +	gpmc: gpmc at 50000000 {
>>> +		compatible = "ti,gpmc";
>>> +		ti,hwmods = "gpmc";
>>> +		reg = <0x50000000 0x2000>;
>>> +		interrupt-parent = <&intc>;
>>
>> We should drop interrupt-parent. We are declaring the interrupt-parent
>> globally in the dts files and so no need to replicate in each individual
>> binding.
> 
> Right, will remove.

Thanks.

>>> +		interrupts = <100>;
>>> +		#address-cells = <2>;
>>> +		#size-cells = <1>;
>>> +		ranges = <0 0 0x08000000 0x10000000>;	/* CS0: NAND */
>>> +
>>> +		nand at 0,0 {
>>> +			reg = <0 0 0>; /* CS0, offset 0 */
>>
>> The above description says that this is just the chip-select number. Are
>> the other fields used here? If so, what for?
> 
> Thanks to the translation done by the 'ranges' mechanism, these just
> denote the offset to the address range specified above. So they can be
> left 0.
>>> +			nand-bus-width = <16>;
>>> +			nand-ecc-mode = "none";
>>
>> I am still wondering if the above needs to be mandatory. Or if not then
>> may be these should be documented as optional and if these a omitted
>> then what the default configuration would be.
> 
> In my docs, I referred to Documentation/devicetree/bindings/mtd/nand.txt
> which states:
> 
> - nand-ecc-mode : String, operation mode of the NAND ecc mode.
>   Supported values are: "none", "soft", "hw", "hw_syndrome",
> "hw_oob_first", "soft_bch".
> - nand-bus-width : 8 or 16 bus width if not present 8
> 
> So ecc-mode is mandatory, even though the code currently really defaults
> to 0 ("none"). nand-bus-width isn't. I don't know if it makes sense to
> duplicate the Documentation here.

Well maybe there should be some reference?

>>> +static int gpmc_probe_dt(struct platform_device *pdev)
>>> +{
>>> +	u32 val;
>>> +	struct device_node *child;
>>> +	struct gpmc_timings gpmc_t;
>>> +	const struct of_device_id *of_id =
>>> +		of_match_device(gpmc_dt_ids, &pdev->dev);
>>> +
>>> +	if (!of_id)
>>> +		return 0;
>>> +
>>> +	for_each_node_by_name(child, "nand") {
>>> +		struct omap_nand_platform_data *gpmc_nand_data;
>>> +
>>> +		if (of_property_read_u32(child, "reg", &val) < 0) {
>>> +			dev_err(&pdev->dev, "%s has no 'reg' property\n",
>>> +				child->full_name);
>>> +			continue;
>>> +		}
>>> +
>>> +		gpmc_nand_data = devm_kzalloc(&pdev->dev,
>>> +					      sizeof(*gpmc_nand_data),
>>> +					      GFP_KERNEL);
>>> +		if (!gpmc_nand_data) {
>>> +			dev_err(&pdev->dev, "unable to allocate memory?");
>>> +			return -ENOMEM;
>>> +		}
>>> +
>>> +		gpmc_nand_data->cs = val;
>>> +		gpmc_nand_data->of_node = child;
>>> +
>>> +		val = of_get_nand_ecc_mode(child);
>>> +		if (val >= 0)
>>> +			gpmc_nand_data->ecc_opt = val;
>>> +
>>> +		val = of_get_nand_bus_width(child);
>>> +		if (val == 16)
>>> +			gpmc_nand_data->devsize = NAND_BUSWIDTH_16;
>>
>> Do we need any error checking here? I believe we only support 8-bit and
>> 16-bit width devices and so if 16-bit is not set then we default to 8-bit.
> 
> Yes, that's that the code does. If val != 16, ->devsize is left set to 0
> (from kzalloc). There is no NAND_BUSWIDTH_8, so I think that should be ok?

Ok.

>>> +
>>> +		gpmc_read_timings_dt(child, &gpmc_t);
>>> +		gpmc_nand_init(gpmc_nand_data, &gpmc_t);
>>
>> I believe that you need an "of_node_put()" when you are done with the child.
> 
> Good point.

No problem.

Cheers
Jon

^ permalink raw reply

* [PATCH v2 4/4] ARM: OMAP: gpmc: add DT bindings for GPMC timings and NAND
From: Daniel Mack @ 2012-11-02 19:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <50941C6C.3030403@ti.com>

Hi Jon,

On 02.11.2012 20:18, Jon Hunter wrote:
> On 11/02/2012 06:14 AM, Daniel Mack wrote:
>> Hi Jon,
>>
>> as all comments so far focussed on patch 4/4, could we agree to merge
>> 1-3 of this series already? These are all small and straight-forward
>> things that don't depend on 4/4. That way, I only need to resend the
>> last one under discussion.
> 
> Not sure it makes sense to take 3 without 4.

Ok, no problem. I already submitted v3 :)

>>>>  Documentation/devicetree/bindings/bus/ti-gpmc.txt  |  73 +++++++++++
>>>>  .../devicetree/bindings/mtd/gpmc-nand.txt          |  61 +++++++++
>>>>  arch/arm/mach-omap2/gpmc.c                         | 139 +++++++++++++++++++++
>>>>  3 files changed, 273 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>>  create mode 100644 Documentation/devicetree/bindings/mtd/gpmc-nand.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/bus/ti-gpmc.txt b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>> new file mode 100644
>>>> index 0000000..6f44487
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>> @@ -0,0 +1,73 @@
>>>> +Device tree bindings for OMAP general purpose memory controllers (GPMC)
>>>> +
>>>> +The actual devices are instantiated from the child nodes of a GPMC node.
>>>> +
>>>> +Required properties:
>>>> +
>>>> + - compatible:		Should be set to "ti,gpmc"
>>>> + - reg:			A resource specifier for the register space
>>>> +			(see the example below)
>>>> + - ti,hwmods:		Should be set to "ti,gpmc" until the DT transition is
>>>> +			completed.
>>>> + - #address-cells:	Must be set to 2 to allow memory address translation
>>>> + - #size-cells:		Must be set to 1 to allow CS address passing
>>>> + - ranges:		Must be set up to reflect the memory layout
>>>> +			Note that this property is not currently parsed.
>>>> +			Calculated values derived from the contents of
>>>> +			GPMC_CS_CONFIG7 as set up by the bootloader. That will
>>>> +			change in the future, so be sure to fill the correct
>>>> +			values here.
>>>
>>> I still think it would be good to add number of chip-selects and
>>> wait-pins here.
>>
>> The number of chip-selects can be derived from the ranges property.
>> Namely, each 4-value entry to this property maps to one chip-select. I
>> can try and make the more clear in the documentation.
> 
> Yes but that only tells you how many you are using. The binding should
> describe the hardware and so should tell us how many chip-selects we
> have. We should get away from using GPMC_CS_NUM in the code.

Maybe I don't get your point, but we only need to care for as many cs
lines as we actually use, right?

> What about wait-pins?

Afaik, their use depends on the driver acting as GPMC client, right?
Could you point me to code that acts conditionally and that should be
reflected in DT?

>>> I am still wondering if the above needs to be mandatory. Or if not then
>>> may be these should be documented as optional and if these a omitted
>>> then what the default configuration would be.
>>
>> In my docs, I referred to Documentation/devicetree/bindings/mtd/nand.txt
>> which states:
>>
>> - nand-ecc-mode : String, operation mode of the NAND ecc mode.
>>   Supported values are: "none", "soft", "hw", "hw_syndrome",
>> "hw_oob_first", "soft_bch".
>> - nand-bus-width : 8 or 16 bus width if not present 8
>>
>> So ecc-mode is mandatory, even though the code currently really defaults
>> to 0 ("none"). nand-bus-width isn't. I don't know if it makes sense to
>> duplicate the Documentation here.
> 
> Well maybe there should be some reference?

Well, it's there already, that what I'm saying :)

Quoting Documentation/devicetree/bindings/mtd/gpmc-nand.txt:

	For NAND specific properties such as ECC modes or bus width,
	please refer to Documentation/devicetree/bindings/mtd/nand.txt


Thanks for your review,

Daniel

^ permalink raw reply

* [PATCH v5 0/6] Move rest of omap-iommu to live in drivers/iommu
From: Tony Lindgren @ 2012-11-02 19:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Resending again, now using the updated email address
for Joerg.

We need to move the iommu code to live under drivers
for arm common zImage support.

Regards,

Tony

---

Ido Yariv (3):
      ARM: OMAP: Merge iommu2.h into iommu.h
      ARM: OMAP2+: Move iopgtable header to drivers/iommu/
      ARM: OMAP2+: Make some definitions local

Tony Lindgren (3):
      ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h
      ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c
      ARM: OMAP2+: Move iommu/iovmm headers to platform_data


 arch/arm/mach-omap2/Makefile                |    2 
 arch/arm/mach-omap2/devices.c               |    2 
 arch/arm/mach-omap2/omap-iommu.c            |    2 
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c  |    2 
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c  |    2 
 arch/arm/plat-omap/include/plat/iommu2.h    |   96 -------------------
 arch/arm/plat-omap/include/plat/iovmm.h     |   89 ------------------
 drivers/iommu/Makefile                      |    1 
 drivers/iommu/omap-iommu-debug.c            |    8 +-
 drivers/iommu/omap-iommu.c                  |   39 ++++++++
 drivers/iommu/omap-iommu.h                  |  133 ++++++++++++++-------------
 drivers/iommu/omap-iommu2.c                 |   11 ++
 drivers/iommu/omap-iopgtable.h              |   22 ----
 drivers/iommu/omap-iovmm.c                  |   50 ++++++++++
 drivers/media/platform/omap3isp/isp.c       |    1 
 drivers/media/platform/omap3isp/isp.h       |    4 -
 drivers/media/platform/omap3isp/ispccdc.c   |    1 
 drivers/media/platform/omap3isp/ispstat.c   |    1 
 drivers/media/platform/omap3isp/ispvideo.c  |    3 -
 include/linux/omap-iommu.h                  |   52 +++++++++++
 include/linux/platform_data/iommu-omap.h    |   49 ++++++++++
 21 files changed, 279 insertions(+), 291 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/plat/iommu2.h
 delete mode 100644 arch/arm/plat-omap/include/plat/iovmm.h
 rename arch/arm/plat-omap/include/plat/iommu.h => drivers/iommu/omap-iommu.h (69%)
 rename arch/arm/mach-omap2/iommu2.c => drivers/iommu/omap-iommu2.c (96%)
 rename arch/arm/plat-omap/include/plat/iopgtable.h => drivers/iommu/omap-iopgtable.h (85%)
 create mode 100644 include/linux/omap-iommu.h
 create mode 100644 include/linux/platform_data/iommu-omap.h

-- 
Signature

^ permalink raw reply

* [PATCH 1/6] ARM: OMAP: Merge iommu2.h into iommu.h
From: Tony Lindgren @ 2012-11-02 19:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102192221.4253.34303.stgit@muffinssi.local>

From: Ido Yariv <ido@wizery.com>

Since iommu is not supported on OMAP1 and will not likely to ever be
supported, merge plat/iommu2.h into iommu.h so only one file would have
to move to platform_data/ as part of the single zImage effort.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/include/plat/iommu.h  |   88 ++++++++++++++++++++++++++--
 arch/arm/plat-omap/include/plat/iommu2.h |   96 ------------------------------
 2 files changed, 83 insertions(+), 101 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/plat/iommu2.h

diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
index 68b5f03..7e8c7b6 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -13,6 +13,12 @@
 #ifndef __MACH_IOMMU_H
 #define __MACH_IOMMU_H
 
+#include <linux/io.h>
+
+#if defined(CONFIG_ARCH_OMAP1)
+#error "iommu for this processor not implemented yet"
+#endif
+
 struct iotlb_entry {
 	u32 da;
 	u32 pa;
@@ -159,11 +165,70 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
 #define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
 #define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
 
-#if defined(CONFIG_ARCH_OMAP1)
-#error "iommu for this processor not implemented yet"
-#else
-#include <plat/iommu2.h>
-#endif
+/*
+ * MMU Register offsets
+ */
+#define MMU_REVISION		0x00
+#define MMU_SYSCONFIG		0x10
+#define MMU_SYSSTATUS		0x14
+#define MMU_IRQSTATUS		0x18
+#define MMU_IRQENABLE		0x1c
+#define MMU_WALKING_ST		0x40
+#define MMU_CNTL		0x44
+#define MMU_FAULT_AD		0x48
+#define MMU_TTB			0x4c
+#define MMU_LOCK		0x50
+#define MMU_LD_TLB		0x54
+#define MMU_CAM			0x58
+#define MMU_RAM			0x5c
+#define MMU_GFLUSH		0x60
+#define MMU_FLUSH_ENTRY		0x64
+#define MMU_READ_CAM		0x68
+#define MMU_READ_RAM		0x6c
+#define MMU_EMU_FAULT_AD	0x70
+
+#define MMU_REG_SIZE		256
+
+/*
+ * MMU Register bit definitions
+ */
+#define MMU_LOCK_BASE_SHIFT	10
+#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
+#define MMU_LOCK_BASE(x)	\
+	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
+
+#define MMU_LOCK_VICT_SHIFT	4
+#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
+#define MMU_LOCK_VICT(x)	\
+	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
+
+#define MMU_CAM_VATAG_SHIFT	12
+#define MMU_CAM_VATAG_MASK \
+	((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
+#define MMU_CAM_P		(1 << 3)
+#define MMU_CAM_V		(1 << 2)
+#define MMU_CAM_PGSZ_MASK	3
+#define MMU_CAM_PGSZ_1M		(0 << 0)
+#define MMU_CAM_PGSZ_64K	(1 << 0)
+#define MMU_CAM_PGSZ_4K		(2 << 0)
+#define MMU_CAM_PGSZ_16M	(3 << 0)
+
+#define MMU_RAM_PADDR_SHIFT	12
+#define MMU_RAM_PADDR_MASK \
+	((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
+#define MMU_RAM_ENDIAN_SHIFT	9
+#define MMU_RAM_ENDIAN_MASK	(1 << MMU_RAM_ENDIAN_SHIFT)
+#define MMU_RAM_ENDIAN_BIG	(1 << MMU_RAM_ENDIAN_SHIFT)
+#define MMU_RAM_ENDIAN_LITTLE	(0 << MMU_RAM_ENDIAN_SHIFT)
+#define MMU_RAM_ELSZ_SHIFT	7
+#define MMU_RAM_ELSZ_MASK	(3 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_8		(0 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_16		(1 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_32		(2 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_NONE	(3 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_MIXED_SHIFT	6
+#define MMU_RAM_MIXED_MASK	(1 << MMU_RAM_MIXED_SHIFT)
+#define MMU_RAM_MIXED		MMU_RAM_MIXED_MASK
 
 /*
  * utilities for super page(16MB, 1MB, 64KB and 4KB)
@@ -218,4 +283,17 @@ omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
 extern size_t
 omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len);
 
+/*
+ * register accessors
+ */
+static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs)
+{
+	return __raw_readl(obj->regbase + offs);
+}
+
+static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
+{
+	__raw_writel(val, obj->regbase + offs);
+}
+
 #endif /* __MACH_IOMMU_H */
diff --git a/arch/arm/plat-omap/include/plat/iommu2.h b/arch/arm/plat-omap/include/plat/iommu2.h
deleted file mode 100644
index d4116b5..0000000
--- a/arch/arm/plat-omap/include/plat/iommu2.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * omap iommu: omap2 architecture specific definitions
- *
- * Copyright (C) 2008-2009 Nokia Corporation
- *
- * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
- *
- * 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.
- */
-
-#ifndef __MACH_IOMMU2_H
-#define __MACH_IOMMU2_H
-
-#include <linux/io.h>
-
-/*
- * MMU Register offsets
- */
-#define MMU_REVISION		0x00
-#define MMU_SYSCONFIG		0x10
-#define MMU_SYSSTATUS		0x14
-#define MMU_IRQSTATUS		0x18
-#define MMU_IRQENABLE		0x1c
-#define MMU_WALKING_ST		0x40
-#define MMU_CNTL		0x44
-#define MMU_FAULT_AD		0x48
-#define MMU_TTB			0x4c
-#define MMU_LOCK		0x50
-#define MMU_LD_TLB		0x54
-#define MMU_CAM			0x58
-#define MMU_RAM			0x5c
-#define MMU_GFLUSH		0x60
-#define MMU_FLUSH_ENTRY		0x64
-#define MMU_READ_CAM		0x68
-#define MMU_READ_RAM		0x6c
-#define MMU_EMU_FAULT_AD	0x70
-
-#define MMU_REG_SIZE		256
-
-/*
- * MMU Register bit definitions
- */
-#define MMU_LOCK_BASE_SHIFT	10
-#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
-#define MMU_LOCK_BASE(x)	\
-	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
-
-#define MMU_LOCK_VICT_SHIFT	4
-#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
-#define MMU_LOCK_VICT(x)	\
-	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
-
-#define MMU_CAM_VATAG_SHIFT	12
-#define MMU_CAM_VATAG_MASK \
-	((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
-#define MMU_CAM_P		(1 << 3)
-#define MMU_CAM_V		(1 << 2)
-#define MMU_CAM_PGSZ_MASK	3
-#define MMU_CAM_PGSZ_1M		(0 << 0)
-#define MMU_CAM_PGSZ_64K	(1 << 0)
-#define MMU_CAM_PGSZ_4K		(2 << 0)
-#define MMU_CAM_PGSZ_16M	(3 << 0)
-
-#define MMU_RAM_PADDR_SHIFT	12
-#define MMU_RAM_PADDR_MASK \
-	((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
-#define MMU_RAM_ENDIAN_SHIFT	9
-#define MMU_RAM_ENDIAN_MASK	(1 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ENDIAN_BIG	(1 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ENDIAN_LITTLE	(0 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ELSZ_SHIFT	7
-#define MMU_RAM_ELSZ_MASK	(3 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_ELSZ_8		(0 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_ELSZ_16		(1 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_ELSZ_32		(2 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_ELSZ_NONE	(3 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_MIXED_SHIFT	6
-#define MMU_RAM_MIXED_MASK	(1 << MMU_RAM_MIXED_SHIFT)
-#define MMU_RAM_MIXED		MMU_RAM_MIXED_MASK
-
-/*
- * register accessors
- */
-static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs)
-{
-	return __raw_readl(obj->regbase + offs);
-}
-
-static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
-{
-	__raw_writel(val, obj->regbase + offs);
-}
-
-#endif /* __MACH_IOMMU2_H */

^ permalink raw reply related

* [PATCH 2/6] ARM: OMAP2+: Move iopgtable header to drivers/iommu/
From: Tony Lindgren @ 2012-11-02 19:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102192221.4253.34303.stgit@muffinssi.local>

From: Ido Yariv <ido@wizery.com>

The iopgtable header file is only used by the iommu & iovmm drivers, so
move it to drivers/iommu/, as part of the single zImage effort.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Signed-off-by: Ido Yariv <ido@wizery.com>
[tony at atomide.com: updated to be earlier in the series]
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/iommu/omap-iommu-debug.c            |    2 +-
 drivers/iommu/omap-iommu.c                  |    2 +-
 drivers/iommu/omap-iopgtable.h              |    0 
 drivers/iommu/omap-iovmm.c                  |    2 +-
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename arch/arm/plat-omap/include/plat/iopgtable.h => drivers/iommu/omap-iopgtable.h (100%)

diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index f55fc5d..0cac372 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -22,7 +22,7 @@
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
 
-#include <plat/iopgtable.h>
+#include "omap-iopgtable.h"
 
 #define MAXCOLUMN 100 /* for short messages */
 
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d0b1234..f2bbfb0 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -26,7 +26,7 @@
 
 #include <plat/iommu.h>
 
-#include <plat/iopgtable.h>
+#include "omap-iopgtable.h"
 
 #define for_each_iotlb_cr(obj, n, __i, cr)				\
 	for (__i = 0;							\
diff --git a/arch/arm/plat-omap/include/plat/iopgtable.h b/drivers/iommu/omap-iopgtable.h
similarity index 100%
rename from arch/arm/plat-omap/include/plat/iopgtable.h
rename to drivers/iommu/omap-iopgtable.h
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c
index 2e10c3e..b332392 100644
--- a/drivers/iommu/omap-iovmm.c
+++ b/drivers/iommu/omap-iovmm.c
@@ -24,7 +24,7 @@
 #include <plat/iommu.h>
 #include <plat/iovmm.h>
 
-#include <plat/iopgtable.h>
+#include "omap-iopgtable.h"
 
 static struct kmem_cache *iovm_area_cachep;
 

^ permalink raw reply related

* [PATCH 3/6] ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h
From: Tony Lindgren @ 2012-11-02 19:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102192221.4253.34303.stgit@muffinssi.local>

Looks like the iommu framework does not have generic functions
exported for all the needs yet. The hardware specific functions
are defined in files like intel-iommu.h and amd-iommu.h. Follow
the same standard for omap-iommu.h.

This is needed because we are removing plat and mach includes
for ARM common zImage support. Further work should continue
in the iommu framework context as only pure platform data will
be communicated from arch/arm/*omap*/* code to the iommu
framework.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Ido Yariv <ido@wizery.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: linux-media at vger.kernel.org
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/iommu2.c               |    1 
 arch/arm/plat-omap/include/plat/iommu.h    |   10 +--
 arch/arm/plat-omap/include/plat/iovmm.h    |   89 ----------------------------
 drivers/iommu/omap-iommu-debug.c           |    2 -
 drivers/iommu/omap-iommu.c                 |    1 
 drivers/iommu/omap-iovmm.c                 |   46 ++++++++++++++
 drivers/media/platform/omap3isp/isp.c      |    1 
 drivers/media/platform/omap3isp/isp.h      |    4 -
 drivers/media/platform/omap3isp/ispccdc.c  |    1 
 drivers/media/platform/omap3isp/ispstat.c  |    1 
 drivers/media/platform/omap3isp/ispvideo.c |    2 -
 include/linux/omap-iommu.h                 |   52 ++++++++++++++++
 12 files changed, 107 insertions(+), 103 deletions(-)
 delete mode 100644 arch/arm/plat-omap/include/plat/iovmm.h
 create mode 100644 include/linux/omap-iommu.h

diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c
index eefc379..e8116cf 100644
--- a/arch/arm/mach-omap2/iommu2.c
+++ b/arch/arm/mach-omap2/iommu2.c
@@ -15,6 +15,7 @@
 #include <linux/device.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
+#include <linux/omap-iommu.h>
 #include <linux/slab.h>
 #include <linux/stringify.h>
 
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
index 7e8c7b6..a4b71b1 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -216,13 +216,10 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
 #define MMU_RAM_PADDR_SHIFT	12
 #define MMU_RAM_PADDR_MASK \
 	((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
-#define MMU_RAM_ENDIAN_SHIFT	9
+
 #define MMU_RAM_ENDIAN_MASK	(1 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ENDIAN_BIG	(1 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ENDIAN_LITTLE	(0 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ELSZ_SHIFT	7
 #define MMU_RAM_ELSZ_MASK	(3 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_ELSZ_8		(0 << MMU_RAM_ELSZ_SHIFT)
+
 #define MMU_RAM_ELSZ_16		(1 << MMU_RAM_ELSZ_SHIFT)
 #define MMU_RAM_ELSZ_32		(2 << MMU_RAM_ELSZ_SHIFT)
 #define MMU_RAM_ELSZ_NONE	(3 << MMU_RAM_ELSZ_SHIFT)
@@ -269,9 +266,6 @@ extern int omap_iommu_set_isr(const char *name,
 				    void *priv),
 			 void *isr_priv);
 
-extern void omap_iommu_save_ctx(struct device *dev);
-extern void omap_iommu_restore_ctx(struct device *dev);
-
 extern int omap_install_iommu_arch(const struct iommu_functions *ops);
 extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
 
diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h
deleted file mode 100644
index 498e57c..0000000
--- a/arch/arm/plat-omap/include/plat/iovmm.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * omap iommu: simple virtual address space management
- *
- * Copyright (C) 2008-2009 Nokia Corporation
- *
- * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
- *
- * 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.
- */
-
-#ifndef __IOMMU_MMAP_H
-#define __IOMMU_MMAP_H
-
-#include <linux/iommu.h>
-
-struct iovm_struct {
-	struct omap_iommu	*iommu;	/* iommu object which this belongs to */
-	u32			da_start; /* area definition */
-	u32			da_end;
-	u32			flags; /* IOVMF_: see below */
-	struct list_head	list; /* linked in ascending order */
-	const struct sg_table	*sgt; /* keep 'page' <-> 'da' mapping */
-	void			*va; /* mpu side mapped address */
-};
-
-/*
- * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma)
- *
- * lower 16 bit is used for h/w and upper 16 bit is for s/w.
- */
-#define IOVMF_SW_SHIFT		16
-
-/*
- * iovma: h/w flags derived from cam and ram attribute
- */
-#define IOVMF_CAM_MASK		(~((1 << 10) - 1))
-#define IOVMF_RAM_MASK		(~IOVMF_CAM_MASK)
-
-#define IOVMF_PGSZ_MASK		(3 << 0)
-#define IOVMF_PGSZ_1M		MMU_CAM_PGSZ_1M
-#define IOVMF_PGSZ_64K		MMU_CAM_PGSZ_64K
-#define IOVMF_PGSZ_4K		MMU_CAM_PGSZ_4K
-#define IOVMF_PGSZ_16M		MMU_CAM_PGSZ_16M
-
-#define IOVMF_ENDIAN_MASK	(1 << 9)
-#define IOVMF_ENDIAN_BIG	MMU_RAM_ENDIAN_BIG
-#define IOVMF_ENDIAN_LITTLE	MMU_RAM_ENDIAN_LITTLE
-
-#define IOVMF_ELSZ_MASK		(3 << 7)
-#define IOVMF_ELSZ_8		MMU_RAM_ELSZ_8
-#define IOVMF_ELSZ_16		MMU_RAM_ELSZ_16
-#define IOVMF_ELSZ_32		MMU_RAM_ELSZ_32
-#define IOVMF_ELSZ_NONE		MMU_RAM_ELSZ_NONE
-
-#define IOVMF_MIXED_MASK	(1 << 6)
-#define IOVMF_MIXED		MMU_RAM_MIXED
-
-/*
- * iovma: s/w flags, used for mapping and umapping internally.
- */
-#define IOVMF_MMIO		(1 << IOVMF_SW_SHIFT)
-#define IOVMF_ALLOC		(2 << IOVMF_SW_SHIFT)
-#define IOVMF_ALLOC_MASK	(3 << IOVMF_SW_SHIFT)
-
-/* "superpages" is supported just with physically linear pages */
-#define IOVMF_DISCONT		(1 << (2 + IOVMF_SW_SHIFT))
-#define IOVMF_LINEAR		(2 << (2 + IOVMF_SW_SHIFT))
-#define IOVMF_LINEAR_MASK	(3 << (2 + IOVMF_SW_SHIFT))
-
-#define IOVMF_DA_FIXED		(1 << (4 + IOVMF_SW_SHIFT))
-
-
-extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
-extern u32
-omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
-			const struct sg_table *sgt, u32 flags);
-extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
-				struct device *dev, u32 da);
-extern u32
-omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
-				u32 da, size_t bytes, u32 flags);
-extern void
-omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
-				const u32 da);
-extern void *omap_da_to_va(struct device *dev, u32 da);
-
-#endif /* __IOMMU_MMAP_H */
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index 0cac372..cf4a0b5 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -18,9 +18,9 @@
 #include <linux/uaccess.h>
 #include <linux/platform_device.h>
 #include <linux/debugfs.h>
+#include <linux/omap-iommu.h>
 
 #include <plat/iommu.h>
-#include <plat/iovmm.h>
 
 #include "omap-iopgtable.h"
 
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index f2bbfb0..eadcfde 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 #include <linux/platform_device.h>
 #include <linux/iommu.h>
+#include <linux/omap-iommu.h>
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c
index b332392..9852101 100644
--- a/drivers/iommu/omap-iovmm.c
+++ b/drivers/iommu/omap-iovmm.c
@@ -17,15 +17,59 @@
 #include <linux/device.h>
 #include <linux/scatterlist.h>
 #include <linux/iommu.h>
+#include <linux/omap-iommu.h>
 
 #include <asm/cacheflush.h>
 #include <asm/mach/map.h>
 
 #include <plat/iommu.h>
-#include <plat/iovmm.h>
 
 #include "omap-iopgtable.h"
 
+/*
+ * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma)
+ *
+ * lower 16 bit is used for h/w and upper 16 bit is for s/w.
+ */
+#define IOVMF_SW_SHIFT		16
+
+/*
+ * iovma: h/w flags derived from cam and ram attribute
+ */
+#define IOVMF_CAM_MASK		(~((1 << 10) - 1))
+#define IOVMF_RAM_MASK		(~IOVMF_CAM_MASK)
+
+#define IOVMF_PGSZ_MASK		(3 << 0)
+#define IOVMF_PGSZ_1M		MMU_CAM_PGSZ_1M
+#define IOVMF_PGSZ_64K		MMU_CAM_PGSZ_64K
+#define IOVMF_PGSZ_4K		MMU_CAM_PGSZ_4K
+#define IOVMF_PGSZ_16M		MMU_CAM_PGSZ_16M
+
+#define IOVMF_ENDIAN_MASK	(1 << 9)
+#define IOVMF_ENDIAN_BIG	MMU_RAM_ENDIAN_BIG
+
+#define IOVMF_ELSZ_MASK		(3 << 7)
+#define IOVMF_ELSZ_16		MMU_RAM_ELSZ_16
+#define IOVMF_ELSZ_32		MMU_RAM_ELSZ_32
+#define IOVMF_ELSZ_NONE		MMU_RAM_ELSZ_NONE
+
+#define IOVMF_MIXED_MASK	(1 << 6)
+#define IOVMF_MIXED		MMU_RAM_MIXED
+
+/*
+ * iovma: s/w flags, used for mapping and umapping internally.
+ */
+#define IOVMF_MMIO		(1 << IOVMF_SW_SHIFT)
+#define IOVMF_ALLOC		(2 << IOVMF_SW_SHIFT)
+#define IOVMF_ALLOC_MASK	(3 << IOVMF_SW_SHIFT)
+
+/* "superpages" is supported just with physically linear pages */
+#define IOVMF_DISCONT		(1 << (2 + IOVMF_SW_SHIFT))
+#define IOVMF_LINEAR		(2 << (2 + IOVMF_SW_SHIFT))
+#define IOVMF_LINEAR_MASK	(3 << (2 + IOVMF_SW_SHIFT))
+
+#define IOVMF_DA_FIXED		(1 << (4 + IOVMF_SW_SHIFT))
+
 static struct kmem_cache *iovm_area_cachep;
 
 /* return the offset of the first scatterlist entry in a sg table */
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 99640d8..7f182f0 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -61,6 +61,7 @@
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/omap-iommu.h>
 #include <linux/platform_device.h>
 #include <linux/regulator/consumer.h>
 #include <linux/slab.h>
diff --git a/drivers/media/platform/omap3isp/isp.h b/drivers/media/platform/omap3isp/isp.h
index 8be7487..8d68669 100644
--- a/drivers/media/platform/omap3isp/isp.h
+++ b/drivers/media/platform/omap3isp/isp.h
@@ -31,11 +31,9 @@
 #include <media/v4l2-device.h>
 #include <linux/device.h>
 #include <linux/io.h>
+#include <linux/iommu.h>
 #include <linux/platform_device.h>
 #include <linux/wait.h>
-#include <linux/iommu.h>
-#include <plat/iommu.h>
-#include <plat/iovmm.h>
 
 #include "ispstat.h"
 #include "ispccdc.h"
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index 60181ab..6ae1ffb2 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -30,6 +30,7 @@
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/mm.h>
+#include <linux/omap-iommu.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <media/v4l2-event.h>
diff --git a/drivers/media/platform/omap3isp/ispstat.c b/drivers/media/platform/omap3isp/ispstat.c
index d7ac76b..35c3823 100644
--- a/drivers/media/platform/omap3isp/ispstat.c
+++ b/drivers/media/platform/omap3isp/ispstat.c
@@ -26,6 +26,7 @@
  */
 
 #include <linux/dma-mapping.h>
+#include <linux/omap-iommu.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
 
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index a0b737fe..a4b8290 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -27,6 +27,7 @@
 #include <linux/clk.h>
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/omap-iommu.h>
 #include <linux/pagemap.h>
 #include <linux/scatterlist.h>
 #include <linux/sched.h>
@@ -35,7 +36,6 @@
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
 #include <plat/iommu.h>
-#include <plat/iovmm.h>
 #include <plat/omap-pm.h>
 
 #include "ispvideo.h"
diff --git a/include/linux/omap-iommu.h b/include/linux/omap-iommu.h
new file mode 100644
index 0000000..cac78de
--- /dev/null
+++ b/include/linux/omap-iommu.h
@@ -0,0 +1,52 @@
+/*
+ * omap iommu: simple virtual address space management
+ *
+ * Copyright (C) 2008-2009 Nokia Corporation
+ *
+ * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
+ *
+ * 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.
+ */
+
+#ifndef _INTEL_IOMMU_H_
+#define _INTEL_IOMMU_H_
+
+struct iovm_struct {
+	struct omap_iommu	*iommu;	/* iommu object which this belongs to */
+	u32			da_start; /* area definition */
+	u32			da_end;
+	u32			flags; /* IOVMF_: see below */
+	struct list_head	list; /* linked in ascending order */
+	const struct sg_table	*sgt; /* keep 'page' <-> 'da' mapping */
+	void			*va; /* mpu side mapped address */
+};
+
+#define MMU_RAM_ENDIAN_SHIFT	9
+#define MMU_RAM_ENDIAN_LITTLE	(0 << MMU_RAM_ENDIAN_SHIFT)
+#define MMU_RAM_ELSZ_8		(0 << MMU_RAM_ELSZ_SHIFT)
+#define IOVMF_ENDIAN_LITTLE	MMU_RAM_ENDIAN_LITTLE
+#define MMU_RAM_ELSZ_SHIFT	7
+#define IOVMF_ELSZ_8		MMU_RAM_ELSZ_8
+
+struct iommu_domain;
+
+extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
+extern u32
+omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da,
+			const struct sg_table *sgt, u32 flags);
+extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
+				struct device *dev, u32 da);
+extern u32
+omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev,
+				u32 da, size_t bytes, u32 flags);
+extern void
+omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
+				const u32 da);
+extern void *omap_da_to_va(struct device *dev, u32 da);
+
+extern void omap_iommu_save_ctx(struct device *dev);
+extern void omap_iommu_restore_ctx(struct device *dev);
+
+#endif

^ permalink raw reply related

* [PATCH 4/6] ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c
From: Tony Lindgren @ 2012-11-02 19:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102192221.4253.34303.stgit@muffinssi.local>

This file should not be in arch/arm. Move it to drivers/iommu
to allow making most of the header local to drivers/iommu.

This is needed as we are removing plat and mach includes
from drivers for ARM common zImage support.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Ido Yariv <ido@wizery.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Cc: linux-media at vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/Makefile            |    2 
 arch/arm/plat-omap/include/plat/iommu.h |  272 ++-----------------------------
 drivers/iommu/Makefile                  |    1 
 drivers/iommu/omap-iommu-debug.c        |    1 
 drivers/iommu/omap-iommu.c              |   19 ++
 drivers/iommu/omap-iommu.h              |  255 +++++++++++++++++++++++++++++
 drivers/iommu/omap-iommu2.c             |    2 
 drivers/iommu/omap-iopgtable.h          |   22 ---
 drivers/iommu/omap-iovmm.c              |    1 
 9 files changed, 293 insertions(+), 282 deletions(-)
 create mode 100644 drivers/iommu/omap-iommu.h
 rename arch/arm/mach-omap2/iommu2.c => drivers/iommu/omap-iommu2.c (99%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index fe40d9e..d6721a7 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -184,8 +184,6 @@ obj-$(CONFIG_HW_PERF_EVENTS)		+= pmu.o
 obj-$(CONFIG_OMAP_MBOX_FWK)		+= mailbox_mach.o
 mailbox_mach-objs			:= mailbox.o
 
-obj-$(CONFIG_OMAP_IOMMU)		+= iommu2.o
-
 iommu-$(CONFIG_OMAP_IOMMU)		:= omap-iommu.o
 obj-y					+= $(iommu-m) $(iommu-y)
 
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h
index a4b71b1..c677b9f 100644
--- a/arch/arm/plat-omap/include/plat/iommu.h
+++ b/arch/arm/plat-omap/include/plat/iommu.h
@@ -10,103 +10,21 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __MACH_IOMMU_H
-#define __MACH_IOMMU_H
-
-#include <linux/io.h>
-
-#if defined(CONFIG_ARCH_OMAP1)
-#error "iommu for this processor not implemented yet"
-#endif
-
-struct iotlb_entry {
-	u32 da;
-	u32 pa;
-	u32 pgsz, prsvd, valid;
-	union {
-		u16 ap;
-		struct {
-			u32 endian, elsz, mixed;
-		};
-	};
-};
-
-struct omap_iommu {
-	const char	*name;
-	struct module	*owner;
-	struct clk	*clk;
-	void __iomem	*regbase;
-	struct device	*dev;
-	void		*isr_priv;
-	struct iommu_domain *domain;
-
-	unsigned int	refcount;
-	spinlock_t	iommu_lock;	/* global for this whole object */
-
-	/*
-	 * We don't change iopgd for a situation like pgd for a task,
-	 * but share it globally for each iommu.
-	 */
-	u32		*iopgd;
-	spinlock_t	page_table_lock; /* protect iopgd */
-
-	int		nr_tlb_entries;
-
-	struct list_head	mmap;
-	struct mutex		mmap_lock; /* protect mmap */
-
-	void *ctx; /* iommu context: registres saved area */
-	u32 da_start;
-	u32 da_end;
-};
-
-struct cr_regs {
-	union {
-		struct {
-			u16 cam_l;
-			u16 cam_h;
-		};
-		u32 cam;
-	};
-	union {
-		struct {
-			u16 ram_l;
-			u16 ram_h;
-		};
-		u32 ram;
-	};
-};
-
-struct iotlb_lock {
-	short base;
-	short vict;
-};
-
-/* architecture specific functions */
-struct iommu_functions {
-	unsigned long	version;
-
-	int (*enable)(struct omap_iommu *obj);
-	void (*disable)(struct omap_iommu *obj);
-	void (*set_twl)(struct omap_iommu *obj, bool on);
-	u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra);
-
-	void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-	void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr);
-
-	struct cr_regs *(*alloc_cr)(struct omap_iommu *obj,
-							struct iotlb_entry *e);
-	int (*cr_valid)(struct cr_regs *cr);
-	u32 (*cr_to_virt)(struct cr_regs *cr);
-	void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e);
-	ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr,
-							char *buf);
-
-	u32 (*get_pte_attr)(struct iotlb_entry *e);
+#define MMU_REG_SIZE		256
 
-	void (*save_ctx)(struct omap_iommu *obj);
-	void (*restore_ctx)(struct omap_iommu *obj);
-	ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
+/**
+ * struct iommu_arch_data - omap iommu private data
+ * @name: name of the iommu device
+ * @iommu_dev: handle of the iommu device
+ *
+ * This is an omap iommu private data object, which binds an iommu user
+ * to its iommu device. This object should be placed at the iommu user's
+ * dev_archdata so generic IOMMU API can be used without having to
+ * utilize omap-specific plumbing anymore.
+ */
+struct omap_iommu_arch_data {
+	const char *name;
+	struct omap_iommu *iommu_dev;
 };
 
 /**
@@ -129,165 +47,3 @@ struct iommu_platform_data {
 	u32 da_start;
 	u32 da_end;
 };
-
-/**
- * struct iommu_arch_data - omap iommu private data
- * @name: name of the iommu device
- * @iommu_dev: handle of the iommu device
- *
- * This is an omap iommu private data object, which binds an iommu user
- * to its iommu device. This object should be placed at the iommu user's
- * dev_archdata so generic IOMMU API can be used without having to
- * utilize omap-specific plumbing anymore.
- */
-struct omap_iommu_arch_data {
-	const char *name;
-	struct omap_iommu *iommu_dev;
-};
-
-#ifdef CONFIG_IOMMU_API
-/**
- * dev_to_omap_iommu() - retrieves an omap iommu object from a user device
- * @dev: iommu client device
- */
-static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
-{
-	struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
-
-	return arch_data->iommu_dev;
-}
-#endif
-
-/* IOMMU errors */
-#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
-#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
-#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
-#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
-#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
-
-/*
- * MMU Register offsets
- */
-#define MMU_REVISION		0x00
-#define MMU_SYSCONFIG		0x10
-#define MMU_SYSSTATUS		0x14
-#define MMU_IRQSTATUS		0x18
-#define MMU_IRQENABLE		0x1c
-#define MMU_WALKING_ST		0x40
-#define MMU_CNTL		0x44
-#define MMU_FAULT_AD		0x48
-#define MMU_TTB			0x4c
-#define MMU_LOCK		0x50
-#define MMU_LD_TLB		0x54
-#define MMU_CAM			0x58
-#define MMU_RAM			0x5c
-#define MMU_GFLUSH		0x60
-#define MMU_FLUSH_ENTRY		0x64
-#define MMU_READ_CAM		0x68
-#define MMU_READ_RAM		0x6c
-#define MMU_EMU_FAULT_AD	0x70
-
-#define MMU_REG_SIZE		256
-
-/*
- * MMU Register bit definitions
- */
-#define MMU_LOCK_BASE_SHIFT	10
-#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
-#define MMU_LOCK_BASE(x)	\
-	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
-
-#define MMU_LOCK_VICT_SHIFT	4
-#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
-#define MMU_LOCK_VICT(x)	\
-	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
-
-#define MMU_CAM_VATAG_SHIFT	12
-#define MMU_CAM_VATAG_MASK \
-	((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
-#define MMU_CAM_P		(1 << 3)
-#define MMU_CAM_V		(1 << 2)
-#define MMU_CAM_PGSZ_MASK	3
-#define MMU_CAM_PGSZ_1M		(0 << 0)
-#define MMU_CAM_PGSZ_64K	(1 << 0)
-#define MMU_CAM_PGSZ_4K		(2 << 0)
-#define MMU_CAM_PGSZ_16M	(3 << 0)
-
-#define MMU_RAM_PADDR_SHIFT	12
-#define MMU_RAM_PADDR_MASK \
-	((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
-
-#define MMU_RAM_ENDIAN_MASK	(1 << MMU_RAM_ENDIAN_SHIFT)
-#define MMU_RAM_ELSZ_MASK	(3 << MMU_RAM_ELSZ_SHIFT)
-
-#define MMU_RAM_ELSZ_16		(1 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_ELSZ_32		(2 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_ELSZ_NONE	(3 << MMU_RAM_ELSZ_SHIFT)
-#define MMU_RAM_MIXED_SHIFT	6
-#define MMU_RAM_MIXED_MASK	(1 << MMU_RAM_MIXED_SHIFT)
-#define MMU_RAM_MIXED		MMU_RAM_MIXED_MASK
-
-/*
- * utilities for super page(16MB, 1MB, 64KB and 4KB)
- */
-
-#define iopgsz_max(bytes)			\
-	(((bytes) >= SZ_16M) ? SZ_16M :		\
-	 ((bytes) >= SZ_1M)  ? SZ_1M  :		\
-	 ((bytes) >= SZ_64K) ? SZ_64K :		\
-	 ((bytes) >= SZ_4K)  ? SZ_4K  :	0)
-
-#define bytes_to_iopgsz(bytes)				\
-	(((bytes) == SZ_16M) ? MMU_CAM_PGSZ_16M :	\
-	 ((bytes) == SZ_1M)  ? MMU_CAM_PGSZ_1M  :	\
-	 ((bytes) == SZ_64K) ? MMU_CAM_PGSZ_64K :	\
-	 ((bytes) == SZ_4K)  ? MMU_CAM_PGSZ_4K  : -1)
-
-#define iopgsz_to_bytes(iopgsz)				\
-	(((iopgsz) == MMU_CAM_PGSZ_16M)	? SZ_16M :	\
-	 ((iopgsz) == MMU_CAM_PGSZ_1M)	? SZ_1M  :	\
-	 ((iopgsz) == MMU_CAM_PGSZ_64K)	? SZ_64K :	\
-	 ((iopgsz) == MMU_CAM_PGSZ_4K)	? SZ_4K  : 0)
-
-#define iopgsz_ok(bytes) (bytes_to_iopgsz(bytes) >= 0)
-
-/*
- * global functions
- */
-extern u32 omap_iommu_arch_version(void);
-
-extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e);
-
-extern int
-omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e);
-
-extern int omap_iommu_set_isr(const char *name,
-		 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
-				    void *priv),
-			 void *isr_priv);
-
-extern int omap_install_iommu_arch(const struct iommu_functions *ops);
-extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
-
-extern int omap_foreach_iommu_device(void *data,
-				int (*fn)(struct device *, void *));
-
-extern ssize_t
-omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
-extern size_t
-omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len);
-
-/*
- * register accessors
- */
-static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs)
-{
-	return __raw_readl(obj->regbase + offs);
-}
-
-static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
-{
-	__raw_writel(val, obj->regbase + offs);
-}
-
-#endif /* __MACH_IOMMU_H */
diff --git a/drivers/iommu/Makefile b/drivers/iommu/Makefile
index 14a4d5f..f66b816 100644
--- a/drivers/iommu/Makefile
+++ b/drivers/iommu/Makefile
@@ -7,6 +7,7 @@ obj-$(CONFIG_DMAR_TABLE) += dmar.o
 obj-$(CONFIG_INTEL_IOMMU) += iova.o intel-iommu.o
 obj-$(CONFIG_IRQ_REMAP) += intel_irq_remapping.o irq_remapping.o
 obj-$(CONFIG_OMAP_IOMMU) += omap-iommu.o
+obj-$(CONFIG_OMAP_IOMMU) += omap-iommu2.o
 obj-$(CONFIG_OMAP_IOVMM) += omap-iovmm.o
 obj-$(CONFIG_OMAP_IOMMU_DEBUG) += omap-iommu-debug.o
 obj-$(CONFIG_TEGRA_IOMMU_GART) += tegra-gart.o
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index cf4a0b5..d0427bd 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -23,6 +23,7 @@
 #include <plat/iommu.h>
 
 #include "omap-iopgtable.h"
+#include "omap-iommu.h"
 
 #define MAXCOLUMN 100 /* for short messages */
 
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index eadcfde..4db86e1 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -22,12 +22,14 @@
 #include <linux/omap-iommu.h>
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
+#include <linux/io.h>
 
 #include <asm/cacheflush.h>
 
 #include <plat/iommu.h>
 
 #include "omap-iopgtable.h"
+#include "omap-iommu.h"
 
 #define for_each_iotlb_cr(obj, n, __i, cr)				\
 	for (__i = 0;							\
@@ -1016,6 +1018,23 @@ static void iopte_cachep_ctor(void *iopte)
 	clean_dcache_area(iopte, IOPTE_TABLE_SIZE);
 }
 
+static u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa,
+				   u32 flags)
+{
+	memset(e, 0, sizeof(*e));
+
+	e->da		= da;
+	e->pa		= pa;
+	e->valid	= 1;
+	/* FIXME: add OMAP1 support */
+	e->pgsz		= flags & MMU_CAM_PGSZ_MASK;
+	e->endian	= flags & MMU_RAM_ENDIAN_MASK;
+	e->elsz		= flags & MMU_RAM_ELSZ_MASK;
+	e->mixed	= flags & MMU_RAM_MIXED_MASK;
+
+	return iopgsz_to_bytes(e->pgsz);
+}
+
 static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
 			 phys_addr_t pa, size_t bytes, int prot)
 {
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
new file mode 100644
index 0000000..8c3378d
--- /dev/null
+++ b/drivers/iommu/omap-iommu.h
@@ -0,0 +1,255 @@
+/*
+ * omap iommu: main structures
+ *
+ * Copyright (C) 2008-2009 Nokia Corporation
+ *
+ * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
+ *
+ * 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.
+ */
+
+#if defined(CONFIG_ARCH_OMAP1)
+#error "iommu for this processor not implemented yet"
+#endif
+
+struct iotlb_entry {
+	u32 da;
+	u32 pa;
+	u32 pgsz, prsvd, valid;
+	union {
+		u16 ap;
+		struct {
+			u32 endian, elsz, mixed;
+		};
+	};
+};
+
+struct omap_iommu {
+	const char	*name;
+	struct module	*owner;
+	struct clk	*clk;
+	void __iomem	*regbase;
+	struct device	*dev;
+	void		*isr_priv;
+	struct iommu_domain *domain;
+
+	unsigned int	refcount;
+	spinlock_t	iommu_lock;	/* global for this whole object */
+
+	/*
+	 * We don't change iopgd for a situation like pgd for a task,
+	 * but share it globally for each iommu.
+	 */
+	u32		*iopgd;
+	spinlock_t	page_table_lock; /* protect iopgd */
+
+	int		nr_tlb_entries;
+
+	struct list_head	mmap;
+	struct mutex		mmap_lock; /* protect mmap */
+
+	void *ctx; /* iommu context: registres saved area */
+	u32 da_start;
+	u32 da_end;
+};
+
+struct cr_regs {
+	union {
+		struct {
+			u16 cam_l;
+			u16 cam_h;
+		};
+		u32 cam;
+	};
+	union {
+		struct {
+			u16 ram_l;
+			u16 ram_h;
+		};
+		u32 ram;
+	};
+};
+
+struct iotlb_lock {
+	short base;
+	short vict;
+};
+
+/* architecture specific functions */
+struct iommu_functions {
+	unsigned long	version;
+
+	int (*enable)(struct omap_iommu *obj);
+	void (*disable)(struct omap_iommu *obj);
+	void (*set_twl)(struct omap_iommu *obj, bool on);
+	u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra);
+
+	void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr);
+	void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr);
+
+	struct cr_regs *(*alloc_cr)(struct omap_iommu *obj,
+							struct iotlb_entry *e);
+	int (*cr_valid)(struct cr_regs *cr);
+	u32 (*cr_to_virt)(struct cr_regs *cr);
+	void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e);
+	ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr,
+							char *buf);
+
+	u32 (*get_pte_attr)(struct iotlb_entry *e);
+
+	void (*save_ctx)(struct omap_iommu *obj);
+	void (*restore_ctx)(struct omap_iommu *obj);
+	ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len);
+};
+
+#ifdef CONFIG_IOMMU_API
+/**
+ * dev_to_omap_iommu() - retrieves an omap iommu object from a user device
+ * @dev: iommu client device
+ */
+static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
+{
+	struct omap_iommu_arch_data *arch_data = dev->archdata.iommu;
+
+	return arch_data->iommu_dev;
+}
+#endif
+
+/* IOMMU errors */
+#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
+#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
+#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
+#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
+#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
+
+/*
+ * MMU Register offsets
+ */
+#define MMU_REVISION		0x00
+#define MMU_SYSCONFIG		0x10
+#define MMU_SYSSTATUS		0x14
+#define MMU_IRQSTATUS		0x18
+#define MMU_IRQENABLE		0x1c
+#define MMU_WALKING_ST		0x40
+#define MMU_CNTL		0x44
+#define MMU_FAULT_AD		0x48
+#define MMU_TTB			0x4c
+#define MMU_LOCK		0x50
+#define MMU_LD_TLB		0x54
+#define MMU_CAM			0x58
+#define MMU_RAM			0x5c
+#define MMU_GFLUSH		0x60
+#define MMU_FLUSH_ENTRY		0x64
+#define MMU_READ_CAM		0x68
+#define MMU_READ_RAM		0x6c
+#define MMU_EMU_FAULT_AD	0x70
+
+#define MMU_REG_SIZE		256
+
+/*
+ * MMU Register bit definitions
+ */
+#define MMU_LOCK_BASE_SHIFT	10
+#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
+#define MMU_LOCK_BASE(x)	\
+	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
+
+#define MMU_LOCK_VICT_SHIFT	4
+#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
+#define MMU_LOCK_VICT(x)	\
+	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
+
+#define MMU_CAM_VATAG_SHIFT	12
+#define MMU_CAM_VATAG_MASK \
+	((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
+#define MMU_CAM_P		(1 << 3)
+#define MMU_CAM_V		(1 << 2)
+#define MMU_CAM_PGSZ_MASK	3
+#define MMU_CAM_PGSZ_1M		(0 << 0)
+#define MMU_CAM_PGSZ_64K	(1 << 0)
+#define MMU_CAM_PGSZ_4K		(2 << 0)
+#define MMU_CAM_PGSZ_16M	(3 << 0)
+
+#define MMU_RAM_PADDR_SHIFT	12
+#define MMU_RAM_PADDR_MASK \
+	((~0UL >> MMU_RAM_PADDR_SHIFT) << MMU_RAM_PADDR_SHIFT)
+
+#define MMU_RAM_ENDIAN_MASK	(1 << MMU_RAM_ENDIAN_SHIFT)
+#define MMU_RAM_ENDIAN_BIG	(1 << MMU_RAM_ENDIAN_SHIFT)
+
+#define MMU_RAM_ELSZ_MASK	(3 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_8		(0 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_16		(1 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_32		(2 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_ELSZ_NONE	(3 << MMU_RAM_ELSZ_SHIFT)
+#define MMU_RAM_MIXED_SHIFT	6
+#define MMU_RAM_MIXED_MASK	(1 << MMU_RAM_MIXED_SHIFT)
+#define MMU_RAM_MIXED		MMU_RAM_MIXED_MASK
+
+/*
+ * utilities for super page(16MB, 1MB, 64KB and 4KB)
+ */
+
+#define iopgsz_max(bytes)			\
+	(((bytes) >= SZ_16M) ? SZ_16M :		\
+	 ((bytes) >= SZ_1M)  ? SZ_1M  :		\
+	 ((bytes) >= SZ_64K) ? SZ_64K :		\
+	 ((bytes) >= SZ_4K)  ? SZ_4K  :	0)
+
+#define bytes_to_iopgsz(bytes)				\
+	(((bytes) == SZ_16M) ? MMU_CAM_PGSZ_16M :	\
+	 ((bytes) == SZ_1M)  ? MMU_CAM_PGSZ_1M  :	\
+	 ((bytes) == SZ_64K) ? MMU_CAM_PGSZ_64K :	\
+	 ((bytes) == SZ_4K)  ? MMU_CAM_PGSZ_4K  : -1)
+
+#define iopgsz_to_bytes(iopgsz)				\
+	(((iopgsz) == MMU_CAM_PGSZ_16M)	? SZ_16M :	\
+	 ((iopgsz) == MMU_CAM_PGSZ_1M)	? SZ_1M  :	\
+	 ((iopgsz) == MMU_CAM_PGSZ_64K)	? SZ_64K :	\
+	 ((iopgsz) == MMU_CAM_PGSZ_4K)	? SZ_4K  : 0)
+
+#define iopgsz_ok(bytes) (bytes_to_iopgsz(bytes) >= 0)
+
+/*
+ * global functions
+ */
+extern u32 omap_iommu_arch_version(void);
+
+extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e);
+
+extern int
+omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e);
+
+extern int omap_iommu_set_isr(const char *name,
+		 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
+				    void *priv),
+			 void *isr_priv);
+
+extern void omap_iommu_save_ctx(struct device *dev);
+extern void omap_iommu_restore_ctx(struct device *dev);
+
+extern int omap_install_iommu_arch(const struct iommu_functions *ops);
+extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
+
+extern int omap_foreach_iommu_device(void *data,
+				int (*fn)(struct device *, void *));
+
+extern ssize_t
+omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
+extern size_t
+omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len);
+
+/*
+ * register accessors
+ */
+static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs)
+{
+	return __raw_readl(obj->regbase + offs);
+}
+
+static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs)
+{
+	__raw_writel(val, obj->regbase + offs);
+}
diff --git a/arch/arm/mach-omap2/iommu2.c b/drivers/iommu/omap-iommu2.c
similarity index 99%
rename from arch/arm/mach-omap2/iommu2.c
rename to drivers/iommu/omap-iommu2.c
index e8116cf..f97c386 100644
--- a/arch/arm/mach-omap2/iommu2.c
+++ b/drivers/iommu/omap-iommu2.c
@@ -13,6 +13,7 @@
 
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/io.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
 #include <linux/omap-iommu.h>
@@ -20,6 +21,7 @@
 #include <linux/stringify.h>
 
 #include <plat/iommu.h>
+#include "omap-iommu.h"
 
 /*
  * omap2 architecture specific register bit definitions
diff --git a/drivers/iommu/omap-iopgtable.h b/drivers/iommu/omap-iopgtable.h
index 66a8139..cd4ae9e 100644
--- a/drivers/iommu/omap-iopgtable.h
+++ b/drivers/iommu/omap-iopgtable.h
@@ -10,9 +10,6 @@
  * published by the Free Software Foundation.
  */
 
-#ifndef __PLAT_OMAP_IOMMU_H
-#define __PLAT_OMAP_IOMMU_H
-
 /*
  * "L2 table" address mask and size definitions.
  */
@@ -97,24 +94,5 @@ static inline phys_addr_t omap_iommu_translate(u32 d, u32 va, u32 mask)
 #define iopte_index(da)		(((da) >> IOPTE_SHIFT) & (PTRS_PER_IOPTE - 1))
 #define iopte_offset(iopgd, da)	(iopgd_page_vaddr(iopgd) + iopte_index(da))
 
-static inline u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa,
-				   u32 flags)
-{
-	memset(e, 0, sizeof(*e));
-
-	e->da		= da;
-	e->pa		= pa;
-	e->valid	= 1;
-	/* FIXME: add OMAP1 support */
-	e->pgsz		= flags & MMU_CAM_PGSZ_MASK;
-	e->endian	= flags & MMU_RAM_ENDIAN_MASK;
-	e->elsz		= flags & MMU_RAM_ELSZ_MASK;
-	e->mixed	= flags & MMU_RAM_MIXED_MASK;
-
-	return iopgsz_to_bytes(e->pgsz);
-}
-
 #define to_iommu(dev)							\
 	(struct omap_iommu *)platform_get_drvdata(to_platform_device(dev))
-
-#endif /* __PLAT_OMAP_IOMMU_H */
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c
index 9852101..3e3b242 100644
--- a/drivers/iommu/omap-iovmm.c
+++ b/drivers/iommu/omap-iovmm.c
@@ -25,6 +25,7 @@
 #include <plat/iommu.h>
 
 #include "omap-iopgtable.h"
+#include "omap-iommu.h"
 
 /*
  * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma)

^ permalink raw reply related

* [PATCH 5/6] ARM: OMAP2+: Make some definitions local
From: Tony Lindgren @ 2012-11-02 19:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102192221.4253.34303.stgit@muffinssi.local>

From: Ido Yariv <ido@wizery.com>

Move some of the definitions in omap-iommu.h that can be made local to
either drivers/iommu.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Signed-off-by: Ido Yariv <ido@wizery.com>
[tony at atomide.com: updated for header changes in the series]
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/iommu/omap-iommu.c  |   15 +++++++++++++++
 drivers/iommu/omap-iommu.h  |   33 +++------------------------------
 drivers/iommu/omap-iommu2.c |    6 ++++++
 3 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 4db86e1..df84087 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -54,6 +54,21 @@ struct omap_iommu_domain {
 	spinlock_t lock;
 };
 
+#define MMU_LOCK_BASE_SHIFT	10
+#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
+#define MMU_LOCK_BASE(x)	\
+	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
+
+#define MMU_LOCK_VICT_SHIFT	4
+#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
+#define MMU_LOCK_VICT(x)	\
+	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
+
+struct iotlb_lock {
+	short base;
+	short vict;
+};
+
 /* accommodate the difference between omap1 and omap2/3 */
 static const struct iommu_functions *arch_iommu;
 
diff --git a/drivers/iommu/omap-iommu.h b/drivers/iommu/omap-iommu.h
index 8c3378d..2b5f3c0 100644
--- a/drivers/iommu/omap-iommu.h
+++ b/drivers/iommu/omap-iommu.h
@@ -72,11 +72,6 @@ struct cr_regs {
 	};
 };
 
-struct iotlb_lock {
-	short base;
-	short vict;
-};
-
 /* architecture specific functions */
 struct iommu_functions {
 	unsigned long	version;
@@ -117,13 +112,6 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
 }
 #endif
 
-/* IOMMU errors */
-#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
-#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
-#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
-#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
-#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
-
 /*
  * MMU Register offsets
  */
@@ -151,16 +139,6 @@ static inline struct omap_iommu *dev_to_omap_iommu(struct device *dev)
 /*
  * MMU Register bit definitions
  */
-#define MMU_LOCK_BASE_SHIFT	10
-#define MMU_LOCK_BASE_MASK	(0x1f << MMU_LOCK_BASE_SHIFT)
-#define MMU_LOCK_BASE(x)	\
-	((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)
-
-#define MMU_LOCK_VICT_SHIFT	4
-#define MMU_LOCK_VICT_MASK	(0x1f << MMU_LOCK_VICT_SHIFT)
-#define MMU_LOCK_VICT(x)	\
-	((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)
-
 #define MMU_CAM_VATAG_SHIFT	12
 #define MMU_CAM_VATAG_MASK \
 	((~0UL >> MMU_CAM_VATAG_SHIFT) << MMU_CAM_VATAG_SHIFT)
@@ -222,20 +200,15 @@ extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e);
 extern int
 omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e);
 
-extern int omap_iommu_set_isr(const char *name,
-		 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
-				    void *priv),
-			 void *isr_priv);
-
 extern void omap_iommu_save_ctx(struct device *dev);
 extern void omap_iommu_restore_ctx(struct device *dev);
 
-extern int omap_install_iommu_arch(const struct iommu_functions *ops);
-extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
-
 extern int omap_foreach_iommu_device(void *data,
 				int (*fn)(struct device *, void *));
 
+extern int omap_install_iommu_arch(const struct iommu_functions *ops);
+extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
+
 extern ssize_t
 omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
 extern size_t
diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c
index f97c386..29e98a2 100644
--- a/drivers/iommu/omap-iommu2.c
+++ b/drivers/iommu/omap-iommu2.c
@@ -68,6 +68,12 @@
 	 ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 :	\
 	 ((pgsz) == MMU_CAM_PGSZ_4K)  ? 0xfffff000 : 0)
 
+/* IOMMU errors */
+#define OMAP_IOMMU_ERR_TLB_MISS		(1 << 0)
+#define OMAP_IOMMU_ERR_TRANS_FAULT	(1 << 1)
+#define OMAP_IOMMU_ERR_EMU_MISS		(1 << 2)
+#define OMAP_IOMMU_ERR_TBLWALK_FAULT	(1 << 3)
+#define OMAP_IOMMU_ERR_MULTIHIT_FAULT	(1 << 4)
 
 static void __iommu_set_twl(struct omap_iommu *obj, bool on)
 {

^ permalink raw reply related

* [PATCH 6/6] ARM: OMAP2+: Move iommu/iovmm headers to platform_data
From: Tony Lindgren @ 2012-11-02 19:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102192221.4253.34303.stgit@muffinssi.local>

Move iommu/iovmm headers from plat/ to platform_data/ as part of the
single zImage work.

Partially based on an earlier version by Ido Yariv <ido@wizery.com>.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Ido Yariv <ido@wizery.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Omar Ramirez Luna <omar.luna@linaro.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/devices.c              |    2 +-
 arch/arm/mach-omap2/omap-iommu.c           |    2 +-
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |    2 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |    2 +-
 drivers/iommu/omap-iommu-debug.c           |    3 +--
 drivers/iommu/omap-iommu.c                 |    2 +-
 drivers/iommu/omap-iommu2.c                |    2 +-
 drivers/iommu/omap-iovmm.c                 |    3 +--
 drivers/media/platform/omap3isp/ispvideo.c |    1 -
 include/linux/platform_data/iommu-omap.h   |    0 
 10 files changed, 8 insertions(+), 11 deletions(-)
 rename arch/arm/plat-omap/include/plat/iommu.h => include/linux/platform_data/iommu-omap.h (100%)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index cba60e0..1002ff8 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -126,7 +126,7 @@ static struct platform_device omap2cam_device = {
 
 #if defined(CONFIG_IOMMU_API)
 
-#include <plat/iommu.h>
+#include <linux/platform_data/iommu-omap.h>
 
 static struct resource omap3isp_resources[] = {
 	{
diff --git a/arch/arm/mach-omap2/omap-iommu.c b/arch/arm/mach-omap2/omap-iommu.c
index df298d4..a6a4ff8 100644
--- a/arch/arm/mach-omap2/omap-iommu.c
+++ b/arch/arm/mach-omap2/omap-iommu.c
@@ -13,7 +13,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <plat/iommu.h>
+#include <linux/platform_data/iommu-omap.h>
 
 #include "soc.h"
 #include "common.h"
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
index f67b7ee..621bc71 100644
--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
@@ -26,8 +26,8 @@
 #include <plat/mmc.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 <plat/dmtimer.h>
-#include <plat/iommu.h>
 
 #include "am35xx.h"
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 652d028..5850b3e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -27,10 +27,10 @@
 #include <plat/dma.h>
 #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/mmc.h>
 #include <plat/dmtimer.h>
 #include <plat/common.h>
-#include <plat/iommu.h>
 
 #include "omap_hwmod_common_data.h"
 #include "cm1_44xx.h"
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index d0427bd..d97fbe4 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -19,8 +19,7 @@
 #include <linux/platform_device.h>
 #include <linux/debugfs.h>
 #include <linux/omap-iommu.h>
-
-#include <plat/iommu.h>
+#include <linux/platform_data/iommu-omap.h>
 
 #include "omap-iopgtable.h"
 #include "omap-iommu.h"
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index df84087..badc17c 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -26,7 +26,7 @@
 
 #include <asm/cacheflush.h>
 
-#include <plat/iommu.h>
+#include <linux/platform_data/iommu-omap.h>
 
 #include "omap-iopgtable.h"
 #include "omap-iommu.h"
diff --git a/drivers/iommu/omap-iommu2.c b/drivers/iommu/omap-iommu2.c
index 29e98a2..c020202 100644
--- a/drivers/iommu/omap-iommu2.c
+++ b/drivers/iommu/omap-iommu2.c
@@ -19,8 +19,8 @@
 #include <linux/omap-iommu.h>
 #include <linux/slab.h>
 #include <linux/stringify.h>
+#include <linux/platform_data/iommu-omap.h>
 
-#include <plat/iommu.h>
 #include "omap-iommu.h"
 
 /*
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c
index 3e3b242..46d87569 100644
--- a/drivers/iommu/omap-iovmm.c
+++ b/drivers/iommu/omap-iovmm.c
@@ -18,12 +18,11 @@
 #include <linux/scatterlist.h>
 #include <linux/iommu.h>
 #include <linux/omap-iommu.h>
+#include <linux/platform_data/iommu-omap.h>
 
 #include <asm/cacheflush.h>
 #include <asm/mach/map.h>
 
-#include <plat/iommu.h>
-
 #include "omap-iopgtable.h"
 #include "omap-iommu.h"
 
diff --git a/drivers/media/platform/omap3isp/ispvideo.c b/drivers/media/platform/omap3isp/ispvideo.c
index a4b8290..21f7313 100644
--- a/drivers/media/platform/omap3isp/ispvideo.c
+++ b/drivers/media/platform/omap3isp/ispvideo.c
@@ -35,7 +35,6 @@
 #include <linux/vmalloc.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
-#include <plat/iommu.h>
 #include <plat/omap-pm.h>
 
 #include "ispvideo.h"
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/include/linux/platform_data/iommu-omap.h
similarity index 100%
rename from arch/arm/plat-omap/include/plat/iommu.h
rename to include/linux/platform_data/iommu-omap.h

^ permalink raw reply related

* [PATCH v3 0/4] RFC: OMAP GPMC DT bindings
From: Jon Hunter @ 2012-11-02 19:29 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351869956-2787-1-git-send-email-zonque@gmail.com>


On 11/02/2012 10:25 AM, Daniel Mack wrote:
> This is a series of patches to support GPMC peripherals on OMAP boards.
> 
> Depends on Linus' master +
> omap-next (branch omap-for-v3.8/cleanup-headers-gpmc)
> 
> The only supported peripheral for now is NAND, but other types would be
> easy to add.
> 
> Version 2 addresses details pointed out by Jon Hunter, Afzal Mohammed
> and Rob Herring:
> 
>  - add "reg" and "ti,hwmod" properties to Documentation
>  - use generic of_mtd functions and the property names defined by them,
>    namely "nand-bus-width" and "nand-ecc-mode"
>  - reduce the default register space size in the Documentation to 8K,
>    as found in the hwmod code
>  - switch to a DT layout based on ranges and address translation.
>    Although this property is not currently looked at as long as the
>    handling code still uses the runtime calculation methods, we now
>    have these values in the bindings, eventually allowing us to
>    switch the implementation with less pain.
> 
> Version 3 includes fixes pointed out by Jon Hunter:
> 
>  - better documentation of the 'ranges' property to describe the
>    fact that it's representing the CS lines
>  - GPMC_CS_CONFIGx -> GPMC_CONFIGx in comments
>  - drop interrupt-parent from example bindings
>  - add of_node_put() at the end of the child iteration

Thanks. But I am still not completely happy with this. You may wish to
wait until we have resolved all the current comments before sending out
another version.

Cheers
Jon

^ permalink raw reply

* [PATCH v2 4/4] ARM: OMAP: gpmc: add DT bindings for GPMC timings and NAND
From: Jon Hunter @ 2012-11-02 19:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <50941DC4.2050209@gmail.com>


On 11/02/2012 02:23 PM, Daniel Mack wrote:
> Hi Jon,
> 
> On 02.11.2012 20:18, Jon Hunter wrote:
>> On 11/02/2012 06:14 AM, Daniel Mack wrote:
>>> Hi Jon,
>>>
>>> as all comments so far focussed on patch 4/4, could we agree to merge
>>> 1-3 of this series already? These are all small and straight-forward
>>> things that don't depend on 4/4. That way, I only need to resend the
>>> last one under discussion.
>>
>> Not sure it makes sense to take 3 without 4.
> 
> Ok, no problem. I already submitted v3 :)
> 
>>>>>  Documentation/devicetree/bindings/bus/ti-gpmc.txt  |  73 +++++++++++
>>>>>  .../devicetree/bindings/mtd/gpmc-nand.txt          |  61 +++++++++
>>>>>  arch/arm/mach-omap2/gpmc.c                         | 139 +++++++++++++++++++++
>>>>>  3 files changed, 273 insertions(+)
>>>>>  create mode 100644 Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>>>  create mode 100644 Documentation/devicetree/bindings/mtd/gpmc-nand.txt
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/bus/ti-gpmc.txt b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>>> new file mode 100644
>>>>> index 0000000..6f44487
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>>> @@ -0,0 +1,73 @@
>>>>> +Device tree bindings for OMAP general purpose memory controllers (GPMC)
>>>>> +
>>>>> +The actual devices are instantiated from the child nodes of a GPMC node.
>>>>> +
>>>>> +Required properties:
>>>>> +
>>>>> + - compatible:		Should be set to "ti,gpmc"
>>>>> + - reg:			A resource specifier for the register space
>>>>> +			(see the example below)
>>>>> + - ti,hwmods:		Should be set to "ti,gpmc" until the DT transition is
>>>>> +			completed.
>>>>> + - #address-cells:	Must be set to 2 to allow memory address translation
>>>>> + - #size-cells:		Must be set to 1 to allow CS address passing
>>>>> + - ranges:		Must be set up to reflect the memory layout
>>>>> +			Note that this property is not currently parsed.
>>>>> +			Calculated values derived from the contents of
>>>>> +			GPMC_CS_CONFIG7 as set up by the bootloader. That will
>>>>> +			change in the future, so be sure to fill the correct
>>>>> +			values here.
>>>>
>>>> I still think it would be good to add number of chip-selects and
>>>> wait-pins here.
>>>
>>> The number of chip-selects can be derived from the ranges property.
>>> Namely, each 4-value entry to this property maps to one chip-select. I
>>> can try and make the more clear in the documentation.
>>
>> Yes but that only tells you how many you are using. The binding should
>> describe the hardware and so should tell us how many chip-selects we
>> have. We should get away from using GPMC_CS_NUM in the code.
> 
> Maybe I don't get your point, but we only need to care for as many cs
> lines as we actually use, right?

But how many does your device have? How many clients can you support?

If we know how many the device has and then we can get rid of "#define
GPMC_CS_NUM". We currently allocate the CS by calling gpmc_cs_request().
Hmmm ... I now see that your patch is not calling this before
configuring the CS and so that needs to be fixed too.

Without knowing the total CS available, how do we ensure we have the CS
available that someone is asking for?

>> What about wait-pins?
> 
> Afaik, their use depends on the driver acting as GPMC client, right?
> Could you point me to code that acts conditionally and that should be
> reflected in DT?

Again we need to know how many the device has. Clients may or may not
use these. However, if a client wants one they need to request one which
is just like a chip-select. This is not in the current driver but Afzal
has a patch for this [1].

Bottom line, for such hardware specific features, device tree is a good
place to describe how many resources we have. Then we can eliminate such
#defines from the driver code.

>>>> I am still wondering if the above needs to be mandatory. Or if not then
>>>> may be these should be documented as optional and if these a omitted
>>>> then what the default configuration would be.
>>>
>>> In my docs, I referred to Documentation/devicetree/bindings/mtd/nand.txt
>>> which states:
>>>
>>> - nand-ecc-mode : String, operation mode of the NAND ecc mode.
>>>   Supported values are: "none", "soft", "hw", "hw_syndrome",
>>> "hw_oob_first", "soft_bch".
>>> - nand-bus-width : 8 or 16 bus width if not present 8
>>>
>>> So ecc-mode is mandatory, even though the code currently really defaults
>>> to 0 ("none"). nand-bus-width isn't. I don't know if it makes sense to
>>> duplicate the Documentation here.
>>
>> Well maybe there should be some reference?
> 
> Well, it's there already, that what I'm saying :)
> 
> Quoting Documentation/devicetree/bindings/mtd/gpmc-nand.txt:
> 
> 	For NAND specific properties such as ECC modes or bus width,
> 	please refer to Documentation/devicetree/bindings/mtd/nand.txt

Ok, thanks I see that now. Looking at other bindings, some also include
these details but not all. Could be worth listing ecc-mode under
mandatory and bus-width under optional with a reference to nand.txt
binding. I don't think it is worth duplicating but listing the actual
property names would be nice.

Cheers
Jon

[1]
http://gitorious.org/x0148406-public/linux-kernel/commit/f7cbee399ece42e64f9ad2205171c3c67c3f1a9e/diffs

^ permalink raw reply

* [PATCH v2 4/4] ARM: OMAP: gpmc: add DT bindings for GPMC timings and NAND
From: Daniel Mack @ 2012-11-02 20:23 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <50942590.5010202@ti.com>

On 02.11.2012 20:57, Jon Hunter wrote:
> On 11/02/2012 02:23 PM, Daniel Mack wrote:
>> On 02.11.2012 20:18, Jon Hunter wrote:
>>> On 11/02/2012 06:14 AM, Daniel Mack wrote:

>>>>>> diff --git a/Documentation/devicetree/bindings/bus/ti-gpmc.txt b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>>>> new file mode 100644
>>>>>> index 0000000..6f44487
>>>>>> --- /dev/null
>>>>>> +++ b/Documentation/devicetree/bindings/bus/ti-gpmc.txt
>>>>>> @@ -0,0 +1,73 @@
>>>>>> +Device tree bindings for OMAP general purpose memory controllers (GPMC)
>>>>>> +
>>>>>> +The actual devices are instantiated from the child nodes of a GPMC node.
>>>>>> +
>>>>>> +Required properties:
>>>>>> +
>>>>>> + - compatible:		Should be set to "ti,gpmc"
>>>>>> + - reg:			A resource specifier for the register space
>>>>>> +			(see the example below)
>>>>>> + - ti,hwmods:		Should be set to "ti,gpmc" until the DT transition is
>>>>>> +			completed.
>>>>>> + - #address-cells:	Must be set to 2 to allow memory address translation
>>>>>> + - #size-cells:		Must be set to 1 to allow CS address passing
>>>>>> + - ranges:		Must be set up to reflect the memory layout
>>>>>> +			Note that this property is not currently parsed.
>>>>>> +			Calculated values derived from the contents of
>>>>>> +			GPMC_CS_CONFIG7 as set up by the bootloader. That will
>>>>>> +			change in the future, so be sure to fill the correct
>>>>>> +			values here.
>>>>>
>>>>> I still think it would be good to add number of chip-selects and
>>>>> wait-pins here.
>>>>
>>>> The number of chip-selects can be derived from the ranges property.
>>>> Namely, each 4-value entry to this property maps to one chip-select. I
>>>> can try and make the more clear in the documentation.
>>>
>>> Yes but that only tells you how many you are using. The binding should
>>> describe the hardware and so should tell us how many chip-selects we
>>> have. We should get away from using GPMC_CS_NUM in the code.
>>
>> Maybe I don't get your point, but we only need to care for as many cs
>> lines as we actually use, right?
> 
> But how many does your device have? How many clients can you support?

Well, you state that in the ranges property. Even if the chip could in
theory support 8 CS lines - if the actual setup only uses the first one
of them, the code would only need to allocate and set up the one that is
in use. And as the entries in "ranges" are mandatory, there can actually
be no mis-allocation.

I can still add the maximum number as a separate property, but I wanted
to outline my idea here. Is "num-cs" a good name for the property?

> If we know how many the device has and then we can get rid of "#define
> GPMC_CS_NUM". We currently allocate the CS by calling gpmc_cs_request().
> Hmmm ... I now see that your patch is not calling this before
> configuring the CS and so that needs to be fixed too.

It does implicitly, by calling gpmc_nand_init().

> Without knowing the total CS available, how do we ensure we have the CS
> available that someone is asking for?
> 
>>> What about wait-pins?
>>
>> Afaik, their use depends on the driver acting as GPMC client, right?
>> Could you point me to code that acts conditionally and that should be
>> reflected in DT?
> 
> Again we need to know how many the device has. Clients may or may not
> use these. However, if a client wants one they need to request one which
> is just like a chip-select. This is not in the current driver but Afzal
> has a patch for this [1].

Ah, thanks for the pointer to the patch. Ok, I'll add a "num-waitpins"
property. Does that name sound appropriate?

> Bottom line, for such hardware specific features, device tree is a good
> place to describe how many resources we have. Then we can eliminate such
> #defines from the driver code.

Agreed.

>> Quoting Documentation/devicetree/bindings/mtd/gpmc-nand.txt:
>>
>> 	For NAND specific properties such as ECC modes or bus width,
>> 	please refer to Documentation/devicetree/bindings/mtd/nand.txt
> 
> Ok, thanks I see that now. Looking at other bindings, some also include
> these details but not all. Could be worth listing ecc-mode under
> mandatory and bus-width under optional with a reference to nand.txt
> binding. I don't think it is worth duplicating but listing the actual
> property names would be nice.

Ok, I amended my local version. With the details above sorted out and
"num-cs" and "num-waitpins" in place, do you think we're ready for v4?


Thanks,
Daniel

^ permalink raw reply

* [PATCH 2/5] ARM: PXA: Zipit Z2: Add USB host and device support
From: Vasily Khoruzhick @ 2012-11-02 20:52 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAN1soZyAuo4UUze9yWKTOqwJ0TC4cf+uywWo1Ypbrcq0+zez0g@mail.gmail.com>

On Wed, Oct 31, 2012 at 6:31 PM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:

Hi Haojian Zhuang,

> I prefer to use pinctrl-single driver instead. I'm updating mmp
> pinctrol driver to
> pinctrl-single driver framework. You can find them in mailist. I'm submitting
> a third round in these days.

Do you have public git repo with those changes somewhere?

Regards
Vasily

^ permalink raw reply

* [PATCH 2/5] ARM: PXA: Zipit Z2: Add USB host and device support
From: Vasily Khoruzhick @ 2012-11-02 21:29 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAN1soZyAuo4UUze9yWKTOqwJ0TC4cf+uywWo1Ypbrcq0+zez0g@mail.gmail.com>

On Wed, Oct 31, 2012 at 6:31 PM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
> On Wed, Oct 31, 2012 at 4:05 AM, Daniel Mack <zonque@gmail.com> wrote:
>>
>> On 30.10.2012 21:01, Vasily Khoruzhick wrote:
>> > On Mon, Oct 29, 2012 at 2:14 PM, Daniel Mack <zonque@gmail.com> wrote:
>> >> On 29.10.2012 12:12, Vasily Khoruzhick wrote:
>> >>> On Mon, Oct 29, 2012 at 2:00 PM, Daniel Mack <zonque@gmail.com> wrote:
>> >>>
>> >>>>> Well, there's an issue - Z2 does not preserve memory contents in deep sleep
>> >>>>> (but it does in sleep), so userspace can't be fixed here unfortunatelly.
>> >>>>> There's no another possibility to turn Z2 off, and plain sleep is too
>> >>>>> power hungry.
>> >>>>> So the only way to keep Z2 in low-power mode is fake power off, which just puts
>> >>>>> Z2 in deep sleep.
>> >>>>
>> >>>> Why can't the userspace trigger a deep sleep then instead of powering
>> >>>> off? Which details do I lack?
>> >>>
>> >>> How? echo mem >/sys/power/state puts system into non-deep sleep. Anyway, kernel
>> >>> is not ready for fake power off instead of suspend (we can't resume
>> >>> from deep sleep,
>> >>> memory content is not preserved), so there can be some data loss.
>> >>> Adding some sysfs file to control sleep type does not look like a good
>> >>> idea to me.
>> >>>
>> >>> Btw, how other DT-capable boards handle power off?
>> >>
>> >> No idea. I never actually used that kind of power state.
>> >
>> > Hi Daniel,
>> >
>> > One more question: what should I use instead of pxa2xx_mfp_config in
>> > DT board to configure pin modes?
>>
>> Haojian was working on the PXA pinctrl drivers, but I don't know how far
>> that is yet.
>>
>> If that's not yet there, have a look at the pinctrl-single driver. It's
>> admittedly not as nice to use as the constants in the board file as DT
>> lacks defines for numerical constants, but's at least a workaround.
>>
>> On a more general note, it's arguable whether this kind of setup should
>> be done in the bootloader after all.
>>
>>
>> Daniel
>>
>
> I prefer to use pinctrl-single driver instead. I'm updating mmp
> pinctrol driver to
> pinctrl-single driver framework. You can find them in mailist. I'm submitting
> a third round in these days.
>
> Regards
> Haojian

OK, one more question:

On PXA2xx GPIO and PINMUX are not separate blocks. Each pin can be
either input or output and have 4 modes (gpio + 3 alternate functions)
== 8 states , so we have: gpio in, gpio out, 3 alt in, 3 alt out.
To control pin mode one should write to GPDR (direction register) and
GAFR (alternate function register). pxa-gpio driver controls both of
those registers, so does pxa2xx-mfp.

I'm not sure what to do in this case. Should I move code controlling
GPDR and GAFR into some pinctrl-pxa2xx driver, and modify pxa-gpio
driver to use it?

Regards
Vasily

^ permalink raw reply

* [RFC 00/15] Add basic suspend-resume support for AM33XX
From: Daniel Mack @ 2012-11-02 22:16 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351859566-24818-1-git-send-email-vaibhav.bedia@ti.com>

On 02.11.2012 13:32, Vaibhav Bedia wrote:
> This patch series adds support for suspend-resume on AM33XX.

Thanks a lot for working on this!

[...]

> [root at arago /]# echo 1 > ./sys/devices/ocp.2/wkup_m3.4/firmware/am335x-pm-firmware.bin/loading
> [root at arago /]# cat binary_blob > ./sys/devices/ocp.2/wkup_m3.4/firmware/am335x-pm-firmware.bin/data
> [root at arago /]# echo 0 > ./sys/devices/ocp.2/wkup_m3.4/firmware/am335x-pm-firmware.bin/loading
> [   28.770356] Copied the M3 firmware to UMEM
> [   28.778178] omap_hwmod: wkup_m3: _wait_target_disable failed
> [root at arago /]# echo mem > /sys/power/state
> [   32.959753] PM: Syncing filesystems ... done.
> [   32.988434] Freezing user space processes ... (elapsed 0.02 seconds) done.
> [   33.016120] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done.
> [   33.047607] Suspending console(s) (use no_console_suspend to debug)
> [   33.070420] PM: suspend of devices complete after 11.538 msecs
> [   33.074095] PM: late suspend of devices complete after 3.651 msecs
> [   33.079135] PM: noirq suspend of devices complete after 5.011 msecs
> [   33.079196] Disabling non-boot CPUs ...
> [   33.083923] GFX domain entered low power state
> [   33.083973] Successfully transitioned to low power state
> [   33.087132] PM: noirq resume of devices complete after 2.663 msecs
> [   33.090629] PM: early resume of devices complete after 2.346 msecs
> [   33.097607] PM: resume of devices complete after 6.951 msecs
> [   33.155869] Restarting tasks ... done.
> [root at arago /]#
> 
> All the patches have been run through checkpatch and i have also
> tried a few OMAP build configs that Paul uses to ensure that these
> patches do not introduce any new build warnings/errors for the OMAP
> family.
> 
> A few TODOs
> 0. Test all the patches on OMAP platforms like BeagleBoard

I'm testing this on a custom AM33xx board, and with
"no_console_suspend", I get the following:

# echo mem >/sys/power/state
[   27.306144] PM: Syncing filesystems ... done.
[   27.335524] Freezing user space processes ... (elapsed 0.01 seconds)
done.
[   27.361603] Freezing remaining freezable tasks ... (elapsed 0.02
seconds) done.
[   27.408269] ------------[ cut here ]------------
[   27.413147] WARNING: at drivers/net/ethernet/ti/cpsw.c:298
cpsw_rx_handler+0xbd/0xdc()
[   27.421438] Modules linked in: ipv6
[   27.425158] [<c0010d85>] (unwind_backtrace+0x1/0x9c) from
[<c0319f77>] (dump_stack+0xb/0xc)
[   27.433932] [<c0319f77>] (dump_stack+0xb/0xc) from [<c00266a3>]
(warn_slowpath_common+0x33/0x48)
[   27.443149] [<c00266a3>] (warn_slowpath_common+0x33/0x48) from
[<c00266c9>] (warn_slowpath_null+0x11/0x14)
[   27.453273] [<c00266c9>] (warn_slowpath_null+0x11/0x14) from
[<c020f4b9>] (cpsw_rx_handler+0xbd/0xdc)
[   27.462943] [<c020f4b9>] (cpsw_rx_handler+0xbd/0xdc) from
[<c020d773>] (__cpdma_chan_free+0x83/0x90)
[   27.472519] [<c020d773>] (__cpdma_chan_free+0x83/0x90) from
[<c020d815>] (__cpdma_chan_process+0x95/0xb8)
[   27.482550] [<c020d815>] (__cpdma_chan_process+0x95/0xb8) from
[<c020d8ff>] (cpdma_chan_stop+0x93/0x110)
[   27.492490] [<c020d8ff>] (cpdma_chan_stop+0x93/0x110) from
[<c020d9ab>] (cpdma_ctlr_stop+0x2f/0x6c)
[   27.501975] [<c020d9ab>] (cpdma_ctlr_stop+0x2f/0x6c) from
[<c020f033>] (cpsw_ndo_stop+0x2b/0x128)
[   27.511278] [<c020f033>] (cpsw_ndo_stop+0x2b/0x128) from [<c020f145>]
(cpsw_suspend+0x15/0x20)
[   27.520311] [<c020f145>] (cpsw_suspend+0x15/0x20) from [<c01cce83>]
(platform_pm_suspend+0x13/0x28)
[   27.529809] [<c01cce83>] (platform_pm_suspend+0x13/0x28) from
[<c01cfb8b>] (dpm_run_callback.clone.6+0x1f/0x78)
[   27.540390] [<c01cfb8b>] (dpm_run_callback.clone.6+0x1f/0x78) from
[<c01d0337>] (__device_suspend+0xb3/0x168)
[   27.550789] [<c01d0337>] (__device_suspend+0xb3/0x168) from
[<c01d0a3d>] (dpm_suspend+0x45/0x178)
[   27.560095] [<c01d0a3d>] (dpm_suspend+0x45/0x178) from [<c01d0d15>]
(dpm_suspend_start+0x39/0x44)
[   27.569404] [<c01d0d15>] (dpm_suspend_start+0x39/0x44) from
[<c0046fdd>] (suspend_devices_and_enter+0x31/0x148)
[   27.579981] [<c0046fdd>] (suspend_devices_and_enter+0x31/0x148) from
[<c0047203>] (pm_suspend+0x10f/0x170)
[   27.590103] [<c0047203>] (pm_suspend+0x10f/0x170) from [<c004693f>]
(state_store+0x43/0x7c)
[   27.598870] [<c004693f>] (state_store+0x43/0x7c) from [<c019500d>]
(kobj_attr_store+0x9/0x10)
[   27.607828] [<c019500d>] (kobj_attr_store+0x9/0x10) from [<c00cdb2d>]
(sysfs_write_file+0xb5/0x104)
[   27.617319] [<c00cdb2d>] (sysfs_write_file+0xb5/0x104) from
[<c008cb5b>] (vfs_write+0x77/0x110)
[   27.626442] [<c008cb5b>] (vfs_write+0x77/0x110) from [<c008cd75>]
(sys_write+0x2d/0x48)
[   27.634844] [<c008cd75>] (sys_write+0x2d/0x48) from [<c000cfc1>]
(ret_fast_syscall+0x1/0x50)
[   27.643683] ---[ end trace f2a0c58ea7742606 ]---
[   27.650834] PM: suspend of devices complete after 253.597 msecs
[   27.660392] PM: late suspend of devices complete after 3.253 msecs
[   27.674504] omap_hwmod: cpgmac0: _wait_target_disable failed

And the power consumption does not drop noticable at this point.

What event did you use to bring the system back to life? I tried a GPIO
button which has "linux,wakeup" set and is connected to GPIO bank 0, but
without success.


Thanks,
Daniel

^ permalink raw reply

* [PATCH v4] Network driver for the Armada 370 and Armada XP ARM Marvell SoCs
From: Thomas Petazzoni @ 2012-11-02 22:21 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121030105154.5b7c8e48@skate>

Hello,

On Tue, 30 Oct 2012 10:51:54 +0100, Thomas Petazzoni wrote:

> > This patch set adds a new network driver for the network unit
> > available in the newest Marvell ARM SoCs Armada 370 and Armada XP,
> > as well as the necessary Device Tree information to use this driver
> > in the two evaluation platforms of those SoCs.
> 
> Besides Nobuhiro's small comment on the Device Tree part, are there
> any comments on the driver itself, or is the code good to go?
> 
> I can send a fifth version with just the fix for Nobuhiro's comment,
> but it probably makes sense to take into account a few more comments
> (if any) at the same time.

Any comments on this patch set? What should I do to make it progress
towards integration?

Thanks,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply

* [PATCH 0/4] Support the MX6 FEC as a PTP hardware clock
From: Ben Hutchings @ 2012-11-02 23:25 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102084324.GA2486@netboy.at.omicron.at>

On Fri, 2012-11-02 at 09:43 +0100, Richard Cochran wrote:
> On Fri, Nov 02, 2012 at 10:36:09AM +0800, Frank Li wrote:
> > >
> > > All applied to net-next.
> > >
> > > Please make sure your changes are in sync with Ben's PTP/PPS
> > > Kconfig changes of today, and send me any changes if necessary.
> > >
> > 
> > Thank you very much.
> > I checked Ben's patch, which not affect FEC.
> 
> Maybe just remove the Kconfig line "select PPS".

More than that: FEC should select PTP_1588_CLOCK, FEC_PTP should be
removed and all the conditional code made unconditional.  Alternately,
if that would cost too much (in terms of performance or memory) on some
systems where the driver is used, FEC_PTP should default to 'y'.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* [PATCH] ARM: backtrace: avoid crash on large invalid fp value
From: Colin Cross @ 2012-11-02 23:47 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121010111517.GC2131@linaro.org>

On Wed, Oct 10, 2012 at 4:15 AM, Dave Martin <dave.martin@linaro.org> wrote:
> On Tue, Oct 09, 2012 at 11:46:12PM -0700, Todd Poynor wrote:
>> Invalid frame pointer (signed) -4 <= fp <= -1 defeats check for too high
>> on overflow.
>>
>> Signed-off-by: Todd Poynor <toddpoynor@google.com>
>> ---
>>  arch/arm/kernel/stacktrace.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
>> index 00f79e5..6315162 100644
>> --- a/arch/arm/kernel/stacktrace.c
>> +++ b/arch/arm/kernel/stacktrace.c
>> @@ -31,7 +31,7 @@ int notrace unwind_frame(struct stackframe *frame)
>>       high = ALIGN(low, THREAD_SIZE);
>>
>>       /* check current frame pointer is within bounds */
>> -     if (fp < (low + 12) || fp + 4 >= high)
>> +     if (fp < (low + 12) || fp >= high - 4)
>>               return -EINVAL;
>>
>>       /* restore the registers from the stack frame */
>
> sp and fp can still be complete garbage in the case of a corrupted frame,
> so low + 12 can still overflow and cause us to read beyond the stack base.
>
> A more robust patch might be as follows.  This also checks for misaligned
> fp and sp values, since those indicate corruption and there can be no
> sensible way to interpret the resulting frame in that case.
>
> Also, according to the definition of current_thread_info(),
> IS_ALIGNED(sp, THREAD_SIZE) indicates a full stack extending from sp
> to sp + THREAD_SIZE, and not an empty stack extending from sp -
> THREAD_SIZE to sp.  We cannot backtrace this situation anyway, since
> that would imply that the frame record extends beyond the stack...
> but this patch tidies it up in the interest of clarity.
>
> Cheers
> ---Dave
>
> (untested)
>
> diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
> index 00f79e5..fec82be 100644
> --- a/arch/arm/kernel/stacktrace.c
> +++ b/arch/arm/kernel/stacktrace.c
> @@ -28,10 +28,20 @@ int notrace unwind_frame(struct stackframe *frame)
>
>         /* only go to a higher address on the stack */
>         low = frame->sp;
> -       high = ALIGN(low, THREAD_SIZE);
> +       if (!IS_ALIGNED(fp, 4))
> +               return -EINVAL;
> +
> +       /*
> +        * low + 1 here ensures that high > sp, consistent with the
> +        * definition of current_thread_info().
> +        * We subtract 1 to compute the highest allowable byte address.
> +        * Otherwise, we might get high == 0 which would confuse our
> +        * comparisons.
> +        */
> +       high = ALIGN(low + 1, THREAD_SIZE) - 1;
>
>         /* check current frame pointer is within bounds */
> -       if (fp < (low + 12) || fp + 4 >= high)
> +       if (fp < 12 || fp - 12 < low || fp > high)
>                 return -EINVAL;
>
>         /* restore the registers from the stack frame */
> @@ -39,6 +49,10 @@ int notrace unwind_frame(struct stackframe *frame)
>         frame->sp = *(unsigned long *)(fp - 8);
>         frame->pc = *(unsigned long *)(fp - 4);
>
> +       /* Do not claim the frame is valid if if is obviously corrupt: */
> +       if (!IS_ALIGNED(frame->fp, 4))
> +               return -EINVAL;
> +
>         return 0;
>  }
>  #endif
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Dave or Todd, mind reposting this, or should I squash it into my
CONFIG_SMP stacktrace series?

^ permalink raw reply

* [PATCH 02/15] ARM: OMAP2+: mailbox: Add support for AM33XX
From: Russ Dill @ 2012-11-03  0:14 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1351859566-24818-3-git-send-email-vaibhav.bedia@ti.com>

On Fri, Nov 2, 2012 at 5:32 AM, Vaibhav Bedia <vaibhav.bedia@ti.com> wrote:
> Mailbox IP on AM33XX, is the same as that present
> in OMAP4. The single instance of Mailbox module
> contains 8 sub-modules and facilitates communication
> between MPU, PRUs and WKUP_M3.
>
> The first mailbox sub-module is assigned for
> communication between MPU and WKUP-M3.
>
> Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
> ---
>  arch/arm/mach-omap2/mailbox.c |   35 ++++++++++++++++++++++++++++++++++-
>  1 files changed, 34 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
> index f38b4fa..7a343aa 100644
> --- a/arch/arm/mach-omap2/mailbox.c
> +++ b/arch/arm/mach-omap2/mailbox.c
> @@ -155,7 +155,7 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
>         struct omap_mbox2_priv *p = mbox->priv;
>         u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
>
> -       if (!cpu_is_omap44xx())
> +       if (!cpu_is_omap44xx() || !soc_is_am33xx())
>                 bit = mbox_read_reg(p->irqdisable) & ~bit;

Do you mean &&?

>         mbox_write_reg(bit, p->irqdisable);
> @@ -358,6 +358,32 @@ struct omap_mbox mbox_2_info = {
>  struct omap_mbox *omap4_mboxes[] = { &mbox_1_info, &mbox_2_info, NULL };
>  #endif
>
> +#if defined(CONFIG_SOC_AM33XX)
> +static struct omap_mbox2_priv omap2_mbox_wkup_m3_priv = {
> +       .tx_fifo = {
> +               .msg            = MAILBOX_MESSAGE(0),
> +               .fifo_stat      = MAILBOX_FIFOSTATUS(0),
> +               .msg_stat       = MAILBOX_MSGSTATUS(0),
> +       },
> +       .rx_fifo = {
> +               .msg            = MAILBOX_MESSAGE(1),
> +               .msg_stat       = MAILBOX_MSGSTATUS(1),
> +       },
> +       .irqenable      = OMAP4_MAILBOX_IRQENABLE(3),
> +       .irqstatus      = OMAP4_MAILBOX_IRQSTATUS(3),
> +       .irqdisable     = OMAP4_MAILBOX_IRQENABLE_CLR(3),
> +       .notfull_bit    = MAILBOX_IRQ_NOTFULL(0),
> +       .newmsg_bit     = MAILBOX_IRQ_NEWMSG(0),
> +};
> +
> +struct omap_mbox mbox_wkup_m3_info = {
> +       .name   = "wkup_m3",
> +       .ops    = &omap2_mbox_ops,
> +       .priv   = &omap2_mbox_wkup_m3_priv,
> +};
> +struct omap_mbox *am33xx_mboxes[] = { &mbox_wkup_m3_info, NULL };
> +#endif
> +
>  static int __devinit omap2_mbox_probe(struct platform_device *pdev)
>  {
>         struct resource *mem;
> @@ -392,6 +418,13 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
>                 list[0]->irq = list[1]->irq = platform_get_irq(pdev, 0);
>         }
>  #endif
> +#if defined(CONFIG_SOC_AM33XX)
> +       else if (soc_is_am33xx()) {
> +               list = am33xx_mboxes;
> +
> +               list[0]->irq = platform_get_irq(pdev, 0);
> +       }
> +#endif
>         else {
>                 pr_err("%s: platform not supported\n", __func__);
>                 return -ENODEV;
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* linux-next: Tree for Sept 24 (irqchip)
From: Randy Dunlap @ 2012-11-03  1:47 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAOesGMjYE0WgPr4ahPUdBVCZP=dkVPia-dmpDKgiOM_2HgsJgg@mail.gmail.com>

On 09/24/2012 09:46 AM, Olof Johansson wrote:

> On Mon, Sep 24, 2012 at 9:07 AM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>> Hi Randy,
>>
>> On Mon, 24 Sep 2012 08:39:05 -0700 Randy Dunlap <rdunlap@xenotime.net> wrote:
>>>
>>> On 09/24/2012 07:53 AM, Stephen Rothwell wrote:
>>>
>>>> Today was a train wreck, with lots of new conflicts across several trees
>>>> and a few build failures as well.
>>>
>>> I agree.  I mostly get this:
>>>
>>> drivers/Kconfig:157: can't open file "drivers/irqchip/Kconfig"
>>>
>>> i.e., no such file.
>>>
>>> How does this happen?  :(
>>>
>>> who handles irqchip?
>>
>> Hmm, commit 89214f009c1d ("ARM: bcm2835: add interrupt controller
>> driver") from the arm-soc tree adds that file as an empty file (I have
>> the empty file in my tree).  Nothing adds anything to it.
> 
> Yeah, the directory came in through arm-soc for-next (since the
> bcm2835 driver was added), but there is an empty Kconfig in arm-soc. I
> can see it in linux-next as well.
> 
> I wonder why it doesn't show up in your tree, Randy. You just did a
> regular git checkout?


Sorry for the very delayed reply (and this is already fixed).

It doesn't show up in my kernel tree because I use linux-v3.x tarballs
and patch-3.x-rcY patches and linux-next patches, and
'patch' does not keep empty files around.

-- 
~Randy

^ permalink raw reply

* Possible regression in 3.7-rc3 on Marvell Kirkwood
From: Josh Coombs @ 2012-11-03  3:50 UTC (permalink / raw)
  To: linux-arm-kernel

I'm still trying to nail down the exact cause, but I seem to have
stumbled onto a regression with 3.7-rc3 on my GoFlex Net compared to
3.7-rc2 using the same config.

On rc3 I get a bunch of scheduler bugs, mostly in the swapper, then a
panic.  The panic isn't consistent in the triggering process.  I've
included an example of the crash at the bottom of this email.  Loading
the GFN (doing a git clone of v3.7-rc3 for example) speeds up the
inevitable failure.

I haven't started the process of doing bisects to see which commit is
responsible yet, I want to test with a default config kernel first
which will require a different rootfs than I'm currently using.

I'm open to suggestions on how to debug this further.  I'd also be
curious to know if anyone else is seeing similar on their devices.

Joshua Coombs

[   64.312377] BUG: scheduling while atomic: crond/151/0x40000300
[   79.771862] BUG: scheduling while atomic: swapper/0/0x40000500
[   81.826267] BUG: scheduling while atomic: swapper/0/0x40000500
[   90.330911] BUG: scheduling while atomic: swapper/0/0x40000500
[  105.554243] BUG: scheduling while atomic: swapper/0/0x40000500
[  123.199184] BUG: scheduling while atomic: ksoftirqd/0/3/0x40000500
[  138.204989] BUG: scheduling while atomic: swapper/0/0x40000500
[  174.995737] BUG: scheduling while atomic: swapper/0/0x40000500
[  195.378153] BUG: scheduling while atomic: swapper/0/0x40000500
[  211.334239] BUG: scheduling while atomic: swapper/0/0x40000500
[  212.384170] BUG: scheduling while atomic: swapper/0/0x40000500
[  216.563944] BUG: scheduling while atomic: swapper/0/0x40000500
[  216.884007] BUG: scheduling while atomic: git/614/0x40000500
[  217.153998] BUG: scheduling while atomic: git/614/0x40000500
[  218.853983] BUG: scheduling while atomic: kswapd0/19/0x40000500
[  218.893905] BUG: scheduling while atomic: systemd-journal/68/0x40000500
[  218.935826] BUG: scheduling while atomic: systemd-journal/68/0x40000100
[  221.603951] BUG: scheduling while atomic: kswapd0/19/0x40000500
[  221.653299] BUG: scheduling while atomic: kswapd0/19/0x40000100
[  221.661248] BUG: scheduling while atomic: kswapd0/19/0x40000100
[  221.753701] BUG: scheduling while atomic: git/614/0x40000500
[  225.733440] BUG: scheduling while atomic: git/613/0x40000600
[  225.823719] BUG: scheduling while atomic: kswapd0/19/0x40000500
[  228.563311] BUG: scheduling while atomic: git/614/0x40000500
[  230.023481] BUG: scheduling while atomic: git/613/0x40000500
[  230.856815] BUG: scheduling while atomic: git/613/0x40000600
[  231.833160] BUG: scheduling while atomic: flush-8:0/58/0x40000500
[  231.933192] BUG: scheduling while atomic: kswapd0/19/0x40000500
[  232.003387] BUG: scheduling while atomic: swapper/0/0x40000500
[  240.910363] BUG: scheduling while atomic: git/614/0x40000500
[  241.393191] BUG: scheduling while atomic: git/614/0x40000500
[  241.522874] BUG: scheduling while atomic: git/614/0x40000500
[  243.842504] BUG: scheduling while atomic: swapper/0/0x40000500
[  243.849303] BUG: scheduling while atomic: swapper/0/0x40000500
[  246.832000] BUG: scheduling while atomic: ls/619/0x40000500
[  246.845717] Unable to handle kernel NULL pointer dereference at
virtual address 00000038
[  246.853900] pgd = c71f8000
[  246.856630] [00000038] *pgd=070e4831, *pte=00000000, *ppte=00000000
[  246.862976] Internal error: Oops: 17 [#1] ARM
[  246.867356] Modules linked in: rmd160 hmac blowfish_generic
blowfish_common sr_mod cdrom fbcon bitblit softcursor font udlfb
syscopyarea sysfillrect sysimgblt fb_sys_fops fb hid_generic
snd_usb_audio snd_usbmidi_lib snd_hwdep snd_rawmidi snd_seq_device
snd_pcm snd_page_alloc mct_u232 usbserial usbhid hid snd_timer snd
soundcore orion_wdt mv_cesa cryptodev(O) ipv6 autofs4
[  246.900659] CPU: 0    Tainted: G        W  O  (3.7.0-0-ARCH+ #1)
[  246.906706] PC is at tcp_fastretrans_alert+0x5b0/0xa30
[  246.911874] LR is at tcp_ack+0xbec/0xdf0
[  246.915816] pc : [<c03abe00>]    lr : [<c03acf14>]    psr: 60000013
[  246.915816] sp : c7139b68  ip : 20000013  fp : 00000001
[  246.927350] r10: 00000000  r9 : 00000000  r8 : 00000000
[  246.932599] r7 : 00000001  r6 : 00000000  r5 : 00000000  r4 : c26f0500
[  246.939157] r3 : 00000000  r2 : c05c2720  r1 : 00000003  r0 : c26f0500
[  246.945715] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  246.952882] Control: 0005397f  Table: 071f8000  DAC: 00000015
[  246.958656] Process systemd-journal (pid: 68, stack limit = 0xc71381b8)
[  246.965300] Stack: (0xc7139b68 to 0xc713a000)
2012 Nov  2 17:56:08 alarm [  246.862976] Internal error: Oops: 17 [#1] ARM
201[  246.983204] 9b60:                   00000001 c26f0500 00000001
00000000 00000000 00000000
2 Nov  2 17:56:0[  246.992194] 9b80: 0fa01da8 00000001 00000000
c03acf14 00000000 00000083 c705b200 00000000
8 alarm [  246.9[  247.003023] 9ba0: c7b2d000 c7139c08 00000001
00000001 00000000 00000083 00000000 00000000
58656] Process s[  247.011437] 9bc0: 00000000 00000001 00000000
00000000 00000000 ffffe652 00000000 c26f0590
ystemd-journal ([  247.022250] 9be0: c001223c 00000200 0000238c
00000200 00000020 c26f0500 c70edd80 00000020
pid: 68, stack l[  247.030726] 9c00: c6dbc078 00000020 c05e8440
c05b9aec c05b9038 c03ad5e4 c26f0500 c70edd80
imit = 0xc71381b[  247.041492] 9c20: c6dbc078 c70edd80 c26f0500
c70ec380 c05e8440 c6dbc064 c05b9aec c03b4d24
8)
2012 Nov  2 [  247.050670] 9c40: c7139c8c c7b2d0f8 c0012478 c07a0100
00000002 c000f220 c70edd80 c26f0500
17:56:08 alarm [[  247.060303] 9c60: 00000000 c05e8440 c6dbc064
c03b75a4 00000000 c03438b4 c0343720 00000000
  246.965300] St[  247.069941] 9c80: c05e8440 c78ef4a0 c70edd80
c05e8440 c043dcc0 00000006 00000000 c70edd80
ack: (0xc7139b68[  247.079584] 9ca0: c05e8440 c05b9aec c05b9038
c03977f4 c6dbc064 c05b9014 c70edd80 00400100
[  247.089215] 9cc0: c7000000 00000008 00000000 c0397620 c70edd80
ffffffd4 c05ba058 c05b9014

2012 Nov  2 17:[  247.098848] 9ce0: c70edd80 c036d4ac c70353e0
c03523f0 c7000460 c70edd80 c7b9ea80 c05b9038
56:08 alarm [  2[  247.108482] 9d00: c7000460 c05ed9a0 00000000
00000001 c05ed960 c05ed974 ffffe654 00000000
46.983204] 9b60:[  247.118120] 9d20: c05c2720 c036d624 c036d5a8
c05ed9a0 c05ed960 00000000 0000012c 00000040
                [  247.127756] 9d40: c05ed968 c036f784 c067412c
ffffe654 c067412c 00000001 0000000c c7138000
   00000001 c26f[  247.137390] 9d60: 00000003 00000100 c0674100
00000009 c0674120 c001eeb0 c05c6918 c7b1f600
0500 00000001 00[  247.147026] 9d80: 00013757 c05c6918 00000000
00400100 c7139e04 00000013 00000000 fed20200
000000 00000000 [  247.156664] 9da0: c7139e04 c3180508 c71fad20
051d4187 c70ee7b4 c001f2cc 00002000 c00095ec
00000000
2012 N[  247.166356] 9dc0: c00a3b6c c0012024 00000013 c03fce54
b4942660 b4943000 000000ff 00001000
ov  2 17:56:08 a[  247.175984] 9de0: c0763a80 c70e5580 b4942000
00000001 c3180508 c71fad20 051d4187 c70ee7b4
larm [  246.9921[  247.185607] 9e00: 00000a7d c7139e18 c00a3b6c
c0012024 00000013 ffffffff 000001b4 00000028
94] 9b80: 0fa01d[  247.195248] 9e20: 00000000 c05c3284 00000005
000001b4 b4942000 c0763a80 c70edd80 b4942000
a8 00000001 0000[  247.204883] 9e40: 000005a4 c71f8000 c71fad20
c70ee780 00000029 c70e5580 c70ee7b4 c00a5a3c
0000 c03acf14 00[  247.214521] 9e60: c71fad20 051d4187 c7139fb0
c70e5580 b49428b0 c71b2a20 c70ee780 00000029
000000 00000083 [  247.224207] 9e80: 0000081f c03fe420 c05b9038
c03977f4 c6dbbec4 c05b9014 00000800 00000000
c705b200 0000000[  247.233809] 9ea0: c7000000 00000008 00000000
c0397620 c70edd80 ffffffd4 c05ba058 c05b9014
0
2012 Nov  2 1[  247.243433] 9ec0: c70edd80 c036d4ac c7035358 c03523f0
c7000460 c70edd80 c70edcc0 c05b9038
7:56:08 alarm [ [  247.253071] 9ee0: c7000460 c05ed9a0 00000000
0000081f c05bc750 b49428b0 c7139fb0 0003ed10
 247.003023] 9ba[  247.262004] 9f00: bed5f2cc 001b47f0 00000000
c0008418 c05ed960 00000000 0000012c 00000040
0: c7b2d000 c713[  247.272222] ------------[ cut here ]------------
9c08 00000001 00[  247.277675] WARNING: at net/ipv4/tcp_timer.c:361
tcp_retransmit_timer+0x110/0x6d0()
000001 00000000 [  247.286773] Modules linked in:00000083 0000000
rmd1600 00000000
2012 hmac Nov  2 17:56:08 blowfish_generic alarm [  247.01
blowfish_common1437] 9bc0: 0000 sr_mod0000 00000001 00 cdrom000000
00000000  fbcon00000000 ffffe65 bitblit2 00000000 c26f0 softcursor590
2012 Nov  2 font 17:56:08 alarm  udlfb[  247.022250] 9 syscopyareabe0:
c001223c 00 sysfillrect000200 0000238c  sysimgblt00000200 0000002
fb_sys_fops0 c26f0500 c70ed fbd80 00000020
20 hid_generic12 Nov  2 17:56: snd_usb_audio08 alarm [  247.
snd_usbmidi_lib030726] 9c00: c6 snd_hwdepdbc078 00000020
snd_rawmidic05e8440 c05b9ae snd_seq_devicec c05b9038 c03ad snd_pcm5e4
c26f0500 c70 snd_page_allocedd80
2012 Nov  mct_u232 2 17:56:08 alar usbserialm [  247.041492] usbhid
9c20: c6dbc078  hidc70edd80 c26f050 snd_timer0 c70ec380 c05e8 snd440
c6dbc064 c05 soundcoreb9aec c03b4d24
 orion_wdt2012 Nov  2 17:5 mv_cesa6:08 alarm [  24
cryptodev(O)7.050670] 9c40:  ipv6c7139c8c c7b2d0f autofs48 c0012478
c07a0
100 00000002 c00[  247.373215] [<c000d634>]
(unwind_backtrace+0x0/0xe0) from [<c0017d90>]
(warn_slowpath_common+0x4c/0x64)
0f220 c70edd80 c[  247.384042] [<c0017d90>]
(warn_slowpath_common+0x4c/0x64) from [<c0017dc0>]
(warn_slowpath_null+0x18/0x1c)
26f0500
2012 No[  247.395146] [<c0017dc0>] (warn_slowpath_null+0x18/0x1c) from
[<c03b34d4>] (tcp_retransmit_timer+0x110/0x6d0)
v  2 17:56:08 al[  247.406422] [<c03b34d4>]
(tcp_retransmit_timer+0x110/0x6d0) from [<c03b3af8>]
(tcp_write_timer_handler+0x64/0x168)
arm [  247.06030[  247.418215] [<c03b3af8>]
(tcp_write_timer_handler+0x64/0x168) from [<c03b3c14>]
(tcp_write_timer+0x18/0x90)
3] 9c60: 0000000[  247.429417] [<c03b3c14>]
(tcp_write_timer+0x18/0x90) from [<c0023de4>]
(call_timer_fn+0x2c/0x120)
0 c05e8440 c6dbc[  247.439725] [<c0023de4>] (call_timer_fn+0x2c/0x120)
from [<c00251ac>] (run_timer_softirq+0x1d4/0x244)
064 c03b75a4 000[  247.450386] [<c00251ac>]
(run_timer_softirq+0x1d4/0x244) from [<c001eeb0>]
(__do_softirq+0xa0/0x1fc)
00000 c03438b4 c[  247.460964] [<c001eeb0>] (__do_softirq+0xa0/0x1fc)
from [<c001f2cc>] (irq_exit+0x40/0x8c)
0343720 00000000[  247.470581] [<c001f2cc>] (irq_exit+0x40/0x8c) from
[<c00095ec>] (handle_IRQ+0x64/0x84)

2012 Nov  2 17[  247.479937] [<c00095ec>] (handle_IRQ+0x64/0x84) from
[<c03fce54>] (__irq_svc+0x34/0x78)
:56:08 alarm [  [  247.489390] [<c03fce54>] (__irq_svc+0x34/0x78) from
[<c0045884>] (current_kernel_time+0xc/0x50)
247.069941] 9c80[  247.499532] [<c0045884>]
(current_kernel_time+0xc/0x50) from [<c001dfb8>]
(current_fs_time+0x14/0x30)
: c05e8440 c78ef[  247.510192] [<c001dfb8>]
(current_fs_time+0x14/0x30) from [<c00d04f8>] (touch_atime+0x7c/0x178)
4a0 c70edd80 c05[  247.520337] [<c00d04f8>] (touch_atime+0x7c/0x178)
from [<c00c5de8>] (link_path_walk+0x3a4/0x794)
e8440 c043dcc0 0[  247.530562] [<c00c5de8>]
(link_path_walk+0x3a4/0x794) from [<c00c6aa8>]
(path_lookupat+0x54/0x720)
0000006 00000000[  247.540963] [<c00c6aa8>] (path_lookupat+0x54/0x720)
from [<c00c7194>] (filename_lookup+0x20/0x60)
 c70edd80
2012 [  247.551279] [<c00c7194>] (filename_lookup+0x20/0x60) from
[<c00c8fe4>] (user_path_at_empty+0x54/0x80)
Nov  2 17:56:08 [  247.561944] [<c00c8fe4>]
(user_path_at_empty+0x54/0x80) from [<c00c9020>]
(user_path_at+0x10/0x14)
alarm [  247.079[  247.572354] [<c00c9020>] (user_path_at+0x10/0x14)
from [<c00bbde8>] (sys_faccessat+0x98/0x184)
584] 9ca0: c05e8[  247.582400] [<c00bbde8>] (sys_faccessat+0x98/0x184)
from [<c0008d20>] (ret_fast_syscall+0x0/0x2c)
440 c05b9aec c05[  247.592706] ---[ end trace 121b1f97ee5f2bac ]---
b9038 c03977f4 c[  247.598752] Unable to handle kernel NULL pointer
dereference at virtual address 0000003d
6dbc064 c05b9014[  247.608276] pgd = c26d8000
 c70edd80 004001[  247.612400] [0000003d] *pgd=026ad83100
2012 Nov  2 , *pte=0000000017:56:08 alarm [, *ppte=00000000  247.089215] 9c
c0: c7000000 000[  247.624313] Internal error: Oops: 17 [#2] ARM
[  247.630068] Modules linked in: rmd160 hmac blowfish_generic
blowfish_common sr_mod cdrom fbcon bitblit softcursor font udlfb
syscopyarea sysfillrect sysimgblt fb_sys_fops fb hid_generic
snd_usb_audio snd_usbmidi_lib snd_hwdep snd_rawmidi snd_seq_device
snd_pcm snd_page_alloc mct_u232 usbserial usbhid hid snd_timer snd
soundcore orion_wdt mv_cesa cryptodev(O) ipv6 autofs4
[  247.663399] CPU: 0    Tainted: G        W  O  (3.7.0-0-ARCH+ #1)
[  247.669441] PC is at tcp_enter_frto+0x100/0x224
[  247.673994] LR is at tcp_enter_frto+0xc0/0x224
[  247.678460] pc : [<c03ab4b4>]    lr : [<c03ab474>]    psr: 60000013
[  247.678460] sp : c26c5ce0  ip : 40000013  fp : c05c2720
[  247.689992] r10: c05ef7f8  r9 : 00200200  r8 : c26f0500
[  247.695242] r7 : c03b3bfc  r6 : c26f0734  r5 : 0000000f  r4 : c26f0500
[  247.701800] r3 : 00000000  r2 : c26f0590  r1 : 00000000  r0 : 00000006
[  247.708358] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[  247.715526] Control: 0005397f  Table: 026d8000  DAC: 00000015
[  247.721298] Process syslog-ng (pid: 153, stack limit = 0xc26c41b8)
[  247.727506] Stack: (0xc26c5ce0 to 0xc26c6000)
00008 00000000 c[  247.732113] 9f20: c05ed968 c036f784 c067412c
ffffe654 c067412c 00000001 0000000c c7138000
0397620 c70edd80[  247.741628] 9f40: 00000003 00000100 60000093
00000000 00000010 c001ef8c c05c6918 c7b1f600
 ffffffd4 c05ba0[  247.751298] 5ce0: 00000003 c26f0500 0000000f
c03b38a4 c26f0500 00000000 c26f0500 00000100
58 c05b9014
201[  247.760873] 9f60: 00013756 c05c6918 00000000 00400100 00000000
00000013 00000000 fed20200
2 Nov  2 17:56:0[  247.770498] 5d00: c26f0734 c03b3af8 00000000
c26f0500 00000100 c03b3c14 c0674280 c0023de4
8 alarm [  247.0[  247.780117] 9f80: 00000000 00000006 00002000
00000013 00000000 fed20200 00000000 0001f310
98848] 9ce0: c70[  247.789743] 5d20: c26f0734 c03b3bfc c0674280
c26f0734 c26c5d50 c26f0500 c03b3bfc c00251ac
edd80 c036d4ac c[  247.799359] 9fa0: 00000010 ffffffff 00000000
c03fcfdc 00201050 00000000 00000022 00000000
70353e0 c03523f0[  247.808981] 5d40: a49d4202 00000036 ffffe67d
00000000 c26c5d50 c26c5d50 00000001 00000005
 c7000460 c70edd[  247.818605] 9fc0: b4942898 00000000 b49427f0
00000000 0003ed10 bed5f2cc 001b47f0 00000000
80 c7b9ea80 c05b[  247.828223] 5d60: 00000004 c26c4000 00000001
00000100 c0674100 0000000a c0674120 c001eeb0
9038
2012 Nov  [  247.837846] 9fe0: 000000e8 bed5f2b0 0001f198 0001f310
00000010 ffffffff 00000000 00000000
2 17:56:08 alarm[  247.847467] [<c03abe00>]
(tcp_fastretrans_alert+0x5b0/0xa30) from [<c03acf14>]
(tcp_ack+0xbec/0xdf0)
 [  247.108482] [  247.858048] [<c03acf14>] (tcp_ack+0xbec/0xdf0) from
[<c03ad5e4>] (tcp_rcv_established+0x108/0x5e0)
9d00: c7000460 c[  247.868452] [<c03ad5e4>]
(tcp_rcv_established+0x108/0x5e0) from [<c03b4d24>]
(tcp_v4_do_rcv+0x7c/0x234)
05ed9a0 00000000[  247.879288] [<c03b4d24>] (tcp_v4_do_rcv+0x7c/0x234)
from [<c03b75a4>] (tcp_v4_rcv+0x854/0x8c8)
 00000001 c05ed9[  247.889342] [<c03b75a4>] (tcp_v4_rcv+0x854/0x8c8)
from [<c03977f4>] (ip_local_deliver_finish+0x18c/0x294)
60 c05ed974 ffff[  247.900356] [<c03977f4>]
(ip_local_deliver_finish+0x18c/0x294) from [<c0397620>]
(ip_rcv_finish+0x2e4/0x32c)
e654 00000000
2[  247.911636] [<c0397620>] (ip_rcv_finish+0x2e4/0x32c) from
[<c036d4ac>] (__netif_receive_skb+0x6dc/0x7d8)
012 Nov  2 17:56[  247.922560] [<c036d4ac>]
(__netif_receive_skb+0x6dc/0x7d8) from [<c036d624>]
(process_backlog+0x7c/0x140)
:08 alarm [  247[  247.933574] [<c036d624>]
(process_backlog+0x7c/0x140) from [<c036f784>]
(net_rx_action+0x8c/0x224)
.118120] 9d20: c[  247.943987] [<c036f784>] (net_rx_action+0x8c/0x224)
from [<c001eeb0>] (__do_softirq+0xa0/0x1fc)
05c2720 c036d624[  247.954126] [<c001eeb0>] (__do_softirq+0xa0/0x1fc)
from [<c001f2cc>] (irq_exit+0x40/0x8c)
 c036d5a8 c05ed9[  247.963743] [<c001f2cc>] (irq_exit+0x40/0x8c) from
[<c00095ec>] (handle_IRQ+0x64/0x84)
a0 c05ed960 0000[  247.973099] [<c00095ec>] (handle_IRQ+0x64/0x84)
from [<c03fce54>] (__irq_svc+0x34/0x78)
0000 0000012c 00[  247.982543] [<c03fce54>] (__irq_svc+0x34/0x78) from
[<c0012024>] (feroceon_flush_user_cache_range+0x24/0x40)
000040
2012 Nov[  247.993826] [<c0012024>]
(feroceon_flush_user_cache_range+0x24/0x40) from [<000001b4>] (0x1b4)
  2 17:56:08 ala[  248.003887] 5d80: c05c6138 c05bdde0 000137c5
c05c6138 c7139dd0 00400100 c26c5e0c 00000001
rm [  247.127756[  248.013496] 5da0: c7139dd0 fed20200 c26c5e0c
c141bcc0 c26c4000 c71d7018 50944178 c001f2cc
] 9d40: c05ed968[  248.023113] 5dc0: 00002000 c00095ec c001dfb8
c0045884 40000013 c03fce54 c26c5e30 c705b200
 c036f784 c06741[  248.032726] 5de0: 70018000 c0676b80 c76e07d0
c26c5e48 c26c5e30 c26c4000 c141bcc0 c26c4000
2c ffffe654 c067[  248.042344] 5e00: c71d7018 50944178 c76144c8
c26c5e20 c001dfb8 c0045884 40000013 ffffffff
412c 00000001 00[  248.051956] 5e20: c76e07d0 c26c5e48 c705b200
c001dfb8 c26c5e48 c705b200 c76e07d0 c780abf0
[  248.061571] 5e40: c71d7019 c00d04f8 c26c5f08 0028f3c6 c26c5f08
c00c477c 00000051 c26c5f08

2012 Nov  2 17:[  248.071189] 5e60: 00000001 c00c5de8 00000000
c76e07d0 c780abf0 c141bcc0 c780abf0 c141bcc0
56:08 alarm [  2[  248.080807] 5e80: 0028f3c6 00000003 c71d7015
c71d7010 00000051 c26c5f08 00000000 00000041
47.137390] 9d60:[  248.090424] 5ea0: c71d7010 c712d180 00000000
c00c6aa8 c26c5eb8 00000000 00000000 c0244834
 00000003 000001[  248.100047] 5ec0: 00000000 c71d7000 00000001
00000ff0 00000001 c71d7000 c26c5f08 ffffff9c
00 c0674100 0000[  248.109662] 5ee0: c712d180 c26c4000 00000000
c00c7194 c71d7000 00000001 c26c5f88 ffffff9c
0009 c0674120 c0[  248.119280] 5f00: c712d180 c00c8fe4 c780abf0
c76144c8 c26c5f24 c003b4a8 00000000 00000000
01eeb0 c05c6918 [  248.128899] 5f20: c780abf0 c74e1a18 c76a87d0
00000011 00000002 00000001 00000001 c73008c8
c7b1f600
2012 N[  248.138517] 5f40: 00000002 c74c8780 50944178 c00b9694
c7802300 000000d0 c26c5f78 c3c1d440
ov  2 17:56:08 a[  248.148134] 5f60: c712d180 c6de7980 b6c96c0c
00000000 ffffff9c c00c9020 00000000 b6c96c0c
larm [  247.1470[  248.157757] 5f80: 00000001 c00bbde8 ffffff9c
b6c96c0c b6c96c0c b6ca7950 00049030 00000021
26] 9d80: 000137[  248.167379] Code: e5b23090 e1530002 e59f245c
03a03000 (e5933038)
57 c05c6918 0000[  248.174899] ---[ end trace 121b1f97ee5f2bad ]---
0000 00400100 c7[  248.180926] Kernel panic - not syncing: Fatal
exception in interrupt
139e04 00000013 00000000 fed20200
2012 Nov  2 17:56:08 alarm [  247.156664] 9da0: c7139e04 c3180508
c71fad20 051d4187 c70ee7b4 c001f2cc 00002000 c00095ec
2012 Nov  2 17:56:08 alarm [  247.166356] 9dc0: c00a3b6c c0012024
00000013 c03fce54 b4942660 b4943000 000000ff 00001000
2012 Nov  2 17:56:08 alarm [  247.175984] 9de0: c0763a80 c70e5580
b4942000 00000001 c3180508 c71fad20 051d4187 c70ee7b4
2012 Nov  2 17:56:08 alarm [  247.185607] 9e00: 00000a7d c7139e18
c00a3b6c c0012024 00000013 ffffffff 000001b4 00000028
2012 Nov  2 17:56:08 alarm [  247.195248] 9e20: 00000000 c05c3284
00000005 000001b4 b4942000 c0763a80 c70edd80 b4942000
2012 Nov  2 17:56:08 alarm [  247.204883] 9e40: 000005a4 c71f8000
c71fad20 c70ee780 00000029 c70e5580 c70ee7b4 c00a5a3c
2012 Nov  2 17:56:08 alarm [  247.214521] 9e60: c71fad20 051d4187
c7139fb0 c70e5580 b49428b0 c71b2a20 c70ee780 00000029
2012 Nov  2 17:56:08 alarm [  247.224207] 9e80: 0000081f c03fe420
c05b9038 c03977f4 c6dbbec4 c05b9014 00000800 00000000
2012 Nov  2 17:56:08 alarm [  247.233809] 9ea0: c7000000 00000008
00000000 c0397620 c70edd80 ffffffd4 c05ba058 c05b9014
2012 Nov  2 17:56:08 alarm [  247.243433] 9ec0: c70edd80 c036d4ac
c7035358 c03523f0 c7000460 c70edd80 c70edcc0 c05b9038
2012 Nov  2 17:56:08 alarm [  247.253071] 9ee0: c7000460 c05ed9a0
00000000 0000081f c05bc750 b49428b0 c7139fb0 0003ed10

^ permalink raw reply

* i2c support for imx23 linux-3.7-rc3 imx23-olinuxino
From: Tim Michals @ 2012-11-03  3:50 UTC (permalink / raw)
  To: linux-arm-kernel

After updating device tree files in  linux-3.7-rc3
 imx23.dts:
i2c0_pins_a: i2c0 at 0 {
reg = <0>;
fsl,pinmux-ids = <
0x1171 /* MX23_PAD_LCD_ENABLE__LCD_ENABLE */
0x1181 /* MX23_PAD_LCD_HSYNC__LCD_HSYNC */
>;
fsl,drive-strength = <1>;
fsl,voltage = <1>;
fsl,pull-up = <1>;
};
i2c0: i2c at 80058000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx28-i2c";
reg = <0x80058000 0x2000>;
interrupts = <27 26>;
clock-frequency = <100000>;
fsl,i2c-dma-channel = <3>;
status = "disabled";
};
imx23-olinuxino.dts
i2c0: i2c at 80058000 {
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins_a>;
status = "okay";
 };
using i2cdetect -r 0 to scan for devices the following message repeats:
 [  647.380000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write
descriptor..

# i2cdetect -l

i2c-0   i2c             MXS I2C adapter                         I2C adapter
If I load fsl kernel 2.6.35 it works fine.. Is it my dts files? Or
interrupt processing issues?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121102/66748c06/attachment-0001.html>

^ permalink raw reply

* Possible regression in 3.7-rc3 on Marvell Kirkwood
From: Andrew Lunn @ 2012-11-03  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Josh

Are you not seeing a stack trace?

[   64.312377] BUG: scheduling while atomic: crond/151/0x40000300
[   79.771862] BUG: scheduling while atomic: swapper/0/0x40000500
[   81.826267] BUG: scheduling while atomic: swapper/0/0x40000500
[   90.330911] BUG: scheduling while atomic: swapper/0/0x40000500

        printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
                prev->comm, prev->pid, preempt_count());

        debug_show_held_locks(prev);
        print_modules();
        if (irqs_disabled())
                print_irqtrace_events(prev);
        dump_stack();
        add_taint(TAINT_WARN);

Andrew

^ permalink raw reply

* [PATCH 01/15] ARM: OMAP2+: mailbox: Add an API for flushing the FIFO
From: Bedia, Vaibhav @ 2012-11-03  8:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20121102190002.GA15766@atomide.com>

Hi Tony,

On Sat, Nov 03, 2012 at 00:30:04, Tony Lindgren wrote:
[...]
> 
> Patches have been posted to move the mailbox related
> files out of arch/arm, so you'll have to update those
> for that. Please see thread "[PATCH 0/2] ARM: OMAP:
> mailbox out of plat code" for more information.
> 

Thanks for pointing this out. I'll update the patches for these.

I had used your master branch as the baseline. Some of the patches
also need rework to account the header file and timer code changes.
Is there some other branch of yours that I could use or should I
just mention the dependencies in the next version of patches?

Regards,
Vaibhav 

^ permalink raw reply

* [PATCH net-next 0/2] cpsw: fix resource leak for v3.8
From: Richard Cochran @ 2012-11-03  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

While looking at the idea of removing all of the register offsets in
the CPSW's device tree, I noticed that the driver would be leaking IO
mappings. Although this is, strictly speaking, a bug fix, still it can
wait to appear in v3.8, since there is no way to use the driver in
v3.7 (or earlier) anyhow.

Thanks,
Richard


Richard Cochran (2):
  cpsw: rename register banks to match the reference manual, part 2
  cpsw: fix leaking IO mappings

 drivers/net/ethernet/ti/cpsw.c |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

-- 
1.7.2.5

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox