Skip to contentSkip to conversation

ARM: tegra: Add Tegra AHB driver

PATCH In review Hiroshi DOYU 5 participants 14 messages May 7, 2012 – May 8, 2012

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

PATCH v5 1/3 ARM: tegra: Add Tegra AHB driver

Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.

The AHB Arbiter controls AHB bus master arbitration. This effectively forms a second level of arbitration for access to the memory controller through the AHB Slave Memory device. The AHB pre-fetch logic can be configured to enhance performance for devices doing sequential access. Each AHB master is assigned to either the high or low priority bin. Both Tegra20/30 have this AHB bus.

Some of configuration params could be passed from DT too if needed.

Cc Felipe Balbi <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 .../bindings/arm/tegra/nvidia,tegra20-ahb.txt      |   11 +
 arch/arm/mach-tegra/Kconfig                        |    8 +
 drivers/Makefile                                   |    2 +-
 drivers/amba/Makefile                              |    4 +-
 drivers/amba/tegra-ahb.c                           |  261 ++++++++++++++++++++
 5 files changed, 283 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-ahb.txt new file +11 -0
new file mode 100644
index 0000000..234406d
@@ -0,0 +1,11 @@
+NVIDIA Tegra AHB
+
+Required properties:
+- compatible : "nvidia,tegra20-ahb" or "nvidia,tegra30-ahb"
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+	ahb: ahb at 6000c004 {
+		compatible = "nvidia,tegra20-ahb";
+		reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */
+	};
arch/arm/mach-tegra/Kconfig +8 -0
index 204d3d4..6a113a9 100644
@@ -50,6 +50,14 @@ config TEGRA_PCI
 	depends on ARCH_TEGRA_2x_SOC
 	select PCI
 
+config TEGRA_AHB
+	bool "Enable AHB driver for NVIDIA Tegra SoCs"
+	default y
+	help
+	  Adds AHB configuration functionality for NVIDIA Tegra SoCs,
+	  which controls AHB bus master arbitration and some
+	  perfomance parameters(priority, prefech size).
+
 comment "Tegra board type"
 
 config MACH_HARMONY
drivers/Makefile +1 -1
index 5870322..d97e2e2 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_SFI)		+= sfi/
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)		+= pnp/
-obj-$(CONFIG_ARM_AMBA)		+= amba/
+obj-$(CONFIG_ARM)		+= amba/
 # Many drivers will want to use DMA so this has to be made available
 # really early.
 obj-$(CONFIG_DMA_ENGINE)	+= dma/
drivers/amba/Makefile +2 -2
index 40fe740..66e81c2 100644
@@ -1,2 +1,2 @@
-obj-y		+= bus.o
-
+obj-$(CONFIG_ARM_AMBA)		+= bus.o
+obj-$(CONFIG_TEGRA_AHB)		+= tegra-ahb.o
drivers/amba/tegra-ahb.c new file +261 -0

261 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v5 2/3 ARM: tegra: Add SMMU enabler in AHB

Add extern func, "tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready.

---
 arch/arm/mach-tegra/include/mach/tegra-ahb.h |   19 +++++++++++++++
 drivers/amba/tegra-ahb.c                     |   32 ++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)
arch/arm/mach-tegra/include/mach/tegra-ahb.h new file +19 -0
new file mode 100644
index 0000000..e0f8c84
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#ifndef __MACH_TEGRA_AHB_H__
+#define __MACH_TEGRA_AHB_H__
+
+extern int tegra_ahb_enable_smmu(struct device_node *ahb);
+
+#endif	/* __MACH_TEGRA_AHB_H__ */
drivers/amba/tegra-ahb.c +32 -0
index 106a780..aa0b1f1 100644
@@ -76,6 +76,10 @@
 
 #define AHB_ARBITRATION_AHB_MEM_WRQUE_MST_ID	0xf8
 
+#define AHB_ARBITRATION_XBAR_CTRL_SMMU_INIT_DONE BIT(17)
+
+static struct platform_driver tegra_ahb_driver;
+
 static const u32 tegra_ahb_gizmo[] = {
 	AHB_ARBITRATION_DISABLE,
 	AHB_ARBITRATION_PRIORITY_CTRL,
@@ -124,6 +128,34 @@ static inline void gizmo_writel(struct tegra_ahb *ahb, u32 value, u32 offset)
 	writel(value, ahb->regs + offset);
 }
 
+#ifdef CONFIG_ARCH_TEGRA_3x_SOC
+static int tegra_ahb_match_by_smmu(struct device *dev, void *data)
+{
+	struct tegra_ahb *ahb = dev_get_drvdata(dev);
+	struct device_node *dn = data;
+
+	return (ahb->dev->of_node == dn) ? 1 : 0;
+}
+
+int tegra_ahb_enable_smmu(struct device_node *dn)
+{
+	struct device *dev;
+	u32 val;
+	struct tegra_ahb *ahb;
+
+	dev = driver_find_device(&tegra_ahb_driver.driver, NULL, dn,
+				 tegra_ahb_match_by_smmu);
+	if (!dev)
+		return -EPROBE_DEFER;
+	ahb = dev_get_drvdata(dev);
+	val = gizmo_readl(ahb, AHB_ARBITRATION_XBAR_CTRL);
+	val |= AHB_ARBITRATION_XBAR_CTRL_SMMU_INIT_DONE;
+	gizmo_writel(ahb, val, AHB_ARBITRATION_XBAR_CTRL);
+	return 0;
+}
+EXPORT_SYMBOL(tegra_ahb_enable_smmu);
+#endif
+
 static int tegra_ahb_suspend(struct device *dev)
 {
 	int i;
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH v5 3/3 ARM: dt: tegra: Add device tree support for AHB

In reply to Hiroshi DOYU

Add AHB entry for tegra20/30.

---
 arch/arm/boot/dts/tegra20.dtsi |    5 +++++
 arch/arm/boot/dts/tegra30.dtsi |    5 +++++
 2 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +5 -0
index 52cab08..ea6de57 100644
@@ -212,5 +212,10 @@
 		reg = < 0x7000f000 0x00000100    /* controller registers */
 		        0x58000000 0x02000000 >; /* GART aperture */
 	};
+
+	ahb: ahb at 6000c004 {
+		compatible = "nvidia,tegra20-ahb";
+		reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */
+	};
 };
 
arch/arm/boot/dts/tegra30.dtsi +5 -0
index 15200a9..9d650fb 100644
@@ -224,4 +224,9 @@
 			nvidia,ahub-cif-ids = <8 8>;
 		};
 	};
+
+	ahb: ahb at 6000c004 {
+		compatible = "nvidia,tegra30-ahb";
+		reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */
+	};
 };
Signature · 1 line
1.7.5.4
#3 lore raw
In reply to Hiroshi DOYU

drivers/Makefile obj-$(CONFIG_SFI) += sfi/ · line 21

Quoted 10 lines · Hiroshi DOYU
drivers/Makefile +1 -1
index 5870322..d97e2e2 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_SFI)		+= sfi/
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)		+= pnp/
-obj-$(CONFIG_ARM_AMBA)		+= amba/
+obj-$(CONFIG_ARM)		+= amba/

NAK. This makes amba only buildable for ARM which is not the intention. Other architectures do have Primecells.

#4 lore raw

From: Russell King - ARM Linux <[email protected]>
Subject: Re: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver
Date: Mon, 7 May 2012 09:42:28 +0200
Message-ID: <[email protected]>

Quoted 6 lines · Hiroshi DOYU
Quoted 5 lines
drivers/Makefile +0 -0
index 5870322..d97e2e2 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_SFI)		+= sfi/
Quoted 8 lines

drivers/Makefile obj-$(CONFIG_SFI) += sfi/ · line 21

Quoted 5 lines
drivers/Makefile +1 -1
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)		+= pnp/
-obj-$(CONFIG_ARM_AMBA)		+= amba/
+obj-$(CONFIG_ARM)		+= amba/

NAK. This makes amba only buildable for ARM which is not the intention. Other architectures do have Primecells.

What about the following?

+obj-y += amba/

#5 lore raw
Quoted 15 lines · Hiroshi Doyu
Quoted 6 lines · Hiroshi DOYU
Quoted 5 lines
drivers/Makefile +0 -0
index 5870322..d97e2e2 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_SFI)         += sfi/
Quoted 8 lines

drivers/Makefile obj-$(CONFIG_SFI) += sfi/ · line 21

Quoted 5 lines
drivers/Makefile +1 -1
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)          += pnp/
-obj-$(CONFIG_ARM_AMBA)             += amba/
+obj-$(CONFIG_ARM)          += amba/

NAK. This makes amba only buildable for ARM which is not the intention. Other architectures do have Primecells.

Quoted 3 lines

What about the following?

+obj-y += amba/

Looks ok to me, but which problem are you trying to solve anyway? Tegra always enables ARM_AMBA, so AFAICT there is no difference between this and the original code.

Arnd

#6 lore raw

From: Arnd Bergmann <[email protected]>
Subject: Re: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver
Date: Mon, 7 May 2012 10:59:28 +0200
Message-ID: <[email protected]>

Quoted 16 lines · Hiroshi Doyu
Quoted 15 lines
Quoted 14 lines · Hiroshi DOYU

drivers/Makefile obj-$(CONFIG_SFI) += sfi/ · line 21

Quoted 10 lines
drivers/Makefile +1 -1
index 5870322..d97e2e2 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_SFI)         += sfi/
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)          += pnp/
-obj-$(CONFIG_ARM_AMBA)             += amba/
+obj-$(CONFIG_ARM)          += amba/

NAK. This makes amba only buildable for ARM which is not the intention. Other architectures do have Primecells.

Quoted 7 lines
Quoted 3 lines

What about the following?

+obj-y += amba/

Looks ok to me, but which problem are you trying to solve anyway? Tegra always enables ARM_AMBA, so AFAICT there is no difference between this and the original code.

Tegra doesn't enable ARM_AMBA and Tegra doesn't use the following "drivers/amba/bus.c" right now. I needed to make this directory available to ones without ARM_AMBA enabled.

drivers/amba/Makefile:

obj-$(CONFIG_ARM_AMBA) += bus.o
obj-$(CONFIG_TEGRA_AHB) += tegra-ahb.o

#7 lore raw
Quoted 3 lines · Hiroshi Doyu

Tegra doesn't enable ARM_AMBA and Tegra doesn't use the following "drivers/amba/bus.c" right now. I needed to make this directory available to ones without ARM_AMBA enabled.

Ah, right. I looked at arch/arm/Kconfig earlier to see if tegra enabled ARM_AMBA but was accidentally looking at ARCH_INtegraTOR when grepping for TEGRA ;-)

Your proposed solution sounds good then.

Arnd

author Acked-by Arnd Bergmann
#8 lore raw

From: Arnd Bergmann <[email protected]>
Subject: Re: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver
Date: Mon, 7 May 2012 12:24:48 +0200
Message-ID: <[email protected]>

Quoted 10 lines · Hiroshi Doyu
Quoted 3 lines

Tegra doesn't enable ARM_AMBA and Tegra doesn't use the following "drivers/amba/bus.c" right now. I needed to make this directory available to ones without ARM_AMBA enabled.

Ah, right. I looked at arch/arm/Kconfig earlier to see if tegra enabled ARM_AMBA but was accidentally looking at ARCH_INtegraTOR when grepping for TEGRA ;-)

Your proposed solution sounds good then.

Thank you for reviewing patches & ACK. Attached the update one here, instead of sending a while series again.

Quoted 1 line

From 16cc2b0fab00c33cd24bb5c43c45a4cda646ad42 Mon Sep 17 00:00:00 2001

From: Hiroshi DOYU <[email protected]>
Date: Wed, 18 Apr 2012 11:41:56 +0300
Subject: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver

Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.

The AHB Arbiter controls AHB bus master arbitration. This effectively forms a second level of arbitration for access to the memory controller through the AHB Slave Memory device. The AHB pre-fetch logic can be configured to enhance performance for devices doing sequential access. Each AHB master is assigned to either the high or low priority bin. Both Tegra20/30 have this AHB bus.

Some of configuration params could be passed from DT too if needed.

Change-Id I184e0e1ce033e76881353a4bb99234e2850e99c2
Cc Felipe Balbi <[email protected]>
---
 .../bindings/arm/tegra/nvidia,tegra20-ahb.txt      |   11 +
 arch/arm/mach-tegra/Kconfig                        |    8 +
 drivers/Makefile                                   |    2 +-
 drivers/amba/Makefile                              |    4 +-
 drivers/amba/tegra-ahb.c                           |  261 ++++++++++++++++++++
 5 files changed, 283 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-ahb.txt new file +11 -0
new file mode 100644
index 0000000..234406d
@@ -0,0 +1,11 @@
+NVIDIA Tegra AHB
+
+Required properties:
+- compatible : "nvidia,tegra20-ahb" or "nvidia,tegra30-ahb"
+- reg : Should contain 1 register ranges(address and length)
+
+Example:
+	ahb: ahb at 6000c004 {
+		compatible = "nvidia,tegra20-ahb";
+		reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */
+	};
arch/arm/mach-tegra/Kconfig +8 -0
index 204d3d4..6a113a9 100644
@@ -50,6 +50,14 @@ config TEGRA_PCI
 	depends on ARCH_TEGRA_2x_SOC
 	select PCI
 
+config TEGRA_AHB
+	bool "Enable AHB driver for NVIDIA Tegra SoCs"
+	default y
+	help
+	  Adds AHB configuration functionality for NVIDIA Tegra SoCs,
+	  which controls AHB bus master arbitration and some
+	  perfomance parameters(priority, prefech size).
+
 comment "Tegra board type"
 
 config MACH_HARMONY
drivers/Makefile +1 -1
index 5870322..8ba23a7 100644
@@ -18,7 +18,7 @@ obj-$(CONFIG_SFI)		+= sfi/
 # PnP must come after ACPI since it will eventually need to check if acpi
 # was used and do nothing if so
 obj-$(CONFIG_PNP)		+= pnp/
-obj-$(CONFIG_ARM_AMBA)		+= amba/
+obj-y				+= amba/
 # Many drivers will want to use DMA so this has to be made available
 # really early.
 obj-$(CONFIG_DMA_ENGINE)	+= dma/
drivers/amba/Makefile +2 -2
index 40fe740..66e81c2 100644
@@ -1,2 +1,2 @@
-obj-y		+= bus.o
-
+obj-$(CONFIG_ARM_AMBA)		+= bus.o
+obj-$(CONFIG_TEGRA_AHB)		+= tegra-ahb.o
drivers/amba/tegra-ahb.c new file +261 -0

261 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#9 lore raw
Quoted 10 lines · Hiroshi Doyu

From: Arnd Bergmann <[email protected]>
Subject: Re: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver
Date: Mon, 7 May 2012 12:24:48 +0200
Message-ID: <[email protected]>

Quoted 5 lines · Hiroshi Doyu
Quoted 3 lines

Tegra doesn't enable ARM_AMBA and Tegra doesn't use the following "drivers/amba/bus.c" right now. I needed to make this directory available to ones without ARM_AMBA enabled.

Quoted 8 lines
Quoted 5 lines

Ah, right. I looked at arch/arm/Kconfig earlier to see if tegra enabled ARM_AMBA but was accidentally looking at ARCH_INtegraTOR when grepping for TEGRA ;-)

Your proposed solution sounds good then.

Thank you for reviewing patches & ACK. Attached the update one here, instead of sending a while series again.

Russell, assuming you're OK with this update patch, is it OK if I take the whole series through the Tegra tree?

#10 lore raw
In reply to Hiroshi Doyu
Quoted 34 lines · Hiroshi Doyu

From: Arnd Bergmann <[email protected]>
Subject: Re: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver
Date: Mon, 7 May 2012 12:24:48 +0200
Message-ID: <[email protected]>

Quoted 10 lines · Hiroshi Doyu
Quoted 3 lines

Tegra doesn't enable ARM_AMBA and Tegra doesn't use the following "drivers/amba/bus.c" right now. I needed to make this directory available to ones without ARM_AMBA enabled.

Ah, right. I looked at arch/arm/Kconfig earlier to see if tegra enabled ARM_AMBA but was accidentally looking at ARCH_INtegraTOR when grepping for TEGRA ;-)

Your proposed solution sounds good then.

Thank you for reviewing patches & ACK. Attached the update one here, instead of sending a while series again.

Quoted 1 line

From 16cc2b0fab00c33cd24bb5c43c45a4cda646ad42 Mon Sep 17 00:00:00 2001

From: Hiroshi DOYU <[email protected]>
Date: Wed, 18 Apr 2012 11:41:56 +0300
Subject: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver

Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.

The AHB Arbiter controls AHB bus master arbitration. This effectively forms a second level of arbitration for access to the memory controller through the AHB Slave Memory device. The AHB pre-fetch logic can be configured to enhance performance for devices doing sequential access. Each AHB master is assigned to either the high or low priority bin. Both Tegra20/30 have this AHB bus.

Quoted 3 lines

Some of configuration params could be passed from DT too if needed.

Change-Id: I184e0e1ce033e76881353a4bb99234e2850e99c2

What nonsense is this? Please never put that in a patch you want accepted upstream, as it makes no sense and we just have to edit it out by hand, making us grumpy...

greg k-h

#11 lore raw
Quoted 35 lines · On Mon, 7 May 2012 20:36:11 +0200 "gregkh at linuxfoundation.org"…
Quoted 34 lines · Hiroshi Doyu

From: Arnd Bergmann <[email protected]>
Subject: Re: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver
Date: Mon, 7 May 2012 12:24:48 +0200
Message-ID: <[email protected]>

Quoted 10 lines · Hiroshi Doyu
Quoted 3 lines

Tegra doesn't enable ARM_AMBA and Tegra doesn't use the following "drivers/amba/bus.c" right now. I needed to make this directory available to ones without ARM_AMBA enabled.

Ah, right. I looked at arch/arm/Kconfig earlier to see if tegra enabled ARM_AMBA but was accidentally looking at ARCH_INtegraTOR when grepping for TEGRA ;-)

Your proposed solution sounds good then.

Thank you for reviewing patches & ACK. Attached the update one here, instead of sending a while series again.

Quoted 1 line

From 16cc2b0fab00c33cd24bb5c43c45a4cda646ad42 Mon Sep 17 00:00:00 2001

From: Hiroshi DOYU <[email protected]>
Date: Wed, 18 Apr 2012 11:41:56 +0300
Subject: [PATCHv5 1/3] ARM: tegra: Add Tegra AHB driver

Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.

The AHB Arbiter controls AHB bus master arbitration. This effectively forms a second level of arbitration for access to the memory controller through the AHB Slave Memory device. The AHB pre-fetch logic can be configured to enhance performance for devices doing sequential access. Each AHB master is assigned to either the high or low priority bin. Both Tegra20/30 have this AHB bus.

Quoted 7 lines
Quoted 3 lines

Some of configuration params could be passed from DT too if needed.

Change-Id: I184e0e1ce033e76881353a4bb99234e2850e99c2

What nonsense is this? Please never put that in a patch you want accepted upstream, as it makes no sense and we just have to edit it out by hand, making us grumpy...

Sorry, my bad.

Stephen, would you mind removing that line when you take them in?

#12 lore raw
In reply to Hiroshi Doyu

On 05/07/2012 05:36 AM, Hiroshi Doyu wrote:
...

Quoted 9 lines

Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.

The AHB Arbiter controls AHB bus master arbitration. This effectively forms a second level of arbitration for access to the memory controller through the AHB Slave Memory device. The AHB pre-fetch logic can be configured to enhance performance for devices doing sequential access. Each AHB master is assigned to either the high or low priority bin. Both Tegra20/30 have this AHB bus.

I've applied this (minus the Change-Id line) and the other two patches to Tegra's for-next branch. I'll let it sit there for a day or two before sending a pull request into arm-soc for 3.5; hopefully it's not too late for that.

Acked-by on v5 1/3
#13 lore raw
In reply to Hiroshi DOYU
Quoted 10 lines · Hiroshi DOYU

Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.

The AHB Arbiter controls AHB bus master arbitration. This effectively forms a second level of arbitration for access to the memory controller through the AHB Slave Memory device. The AHB pre-fetch logic can be configured to enhance performance for devices doing sequential access. Each AHB master is assigned to either the high or low priority bin. Both Tegra20/30 have this AHB bus.

Quoted 5 lines

Some of configuration params could be passed from DT too if needed.

Cc Felipe Balbi <[email protected]>
Cc Arnd Bergmann <[email protected]>

for the driver, but please fix the issue pointed out by Russell.

Arnd