ARM: tegra: Add Tegra AHB driver
Subsystems (7)
PATCH v3 1/4 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 param could be passed from DT too.
--- arch/arm/mach-tegra/Kconfig | 8 ++ drivers/Makefile | 2 +- drivers/amba/Makefile | 4 +- drivers/amba/tegra-ahb.c | 272 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 283 insertions(+), 3 deletions(-)
arch/arm/mach-tegra/Kconfig +8 -0
@@ -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
@@ -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
@@ -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 +272 -0
272 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH v3 2/4 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
@@ -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
@@ -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 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
Re: [PATCHv3 2/4] ARM: tegra: Add SMMU enabler in AHB
Quoted 5 lines · Hiroshi DOYU
Add extern func, "
tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready.Signed-off-by Hiroshi DOYU <[email protected]>Cc Felipe Balbi <[email protected]>
PATCH v3 3/4 iommu/tegra: smmu: Refrain from accessing to AHB
In reply to Hiroshi DOYUUse "tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready, instead of directly aceessing AHB registers.
--- drivers/iommu/tegra-smmu.c | 60 +++++++++++++++++-------------------------- 1 files changed, 24 insertions(+), 36 deletions(-)
drivers/iommu/tegra-smmu.c +24 -36
@@ -30,12 +30,14 @@#include <linux/sched.h> #include <linux/iommu.h> #include <linux/io.h> +#include <linux/of.h> #include <asm/page.h> #include <asm/cacheflush.h> #include <mach/iomap.h> #include <mach/smmu.h> +#include <mach/tegra-ahb.h> /* bitmap of the page sizes currently supported */ #define SMMU_IOMMU_PGSIZES (SZ_4K)
@@ -111,11 +113,6 @@#define SMMU_PDE_NEXT_SHIFT 28 -/* AHB Arbiter Registers */ -#define AHB_XBAR_CTRL 0xe0 -#define AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE 1 -#define AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT 17 -#define SMMU_NUM_ASIDS 4#define SMMU_TLB_FLUSH_VA_SECTION__MASK 0xffc00000#define SMMU_TLB_FLUSH_VA_SECTION__SHIFT 12/* right shift */
@@ -235,7 +232,7 @@ struct smmu_as {* Per SMMU device - IOMMU device */ struct smmu_device { -void __iomem *regs, *regs_ahbarb; +void __iomem *regs;unsigned long iovmm_base;/* remappable base address */ unsigned long page_count;/* total remappable size */ spinlock_t lock;
@@ -252,12 +249,14 @@ struct smmu_device {unsigned long translation_enable_1;unsigned long translation_enable_2;unsigned long asid_security; + +struct device_node *ahb; };static struct smmu_device *smmu_handle;/* unique for a system */ /* -* SMMU/AHB register accessors +* SMMU register accessors */ static inline u32 smmu_read (struct smmu_device *smmu,size_t offs) {
@@ -268,15 +267,6 @@ static inline void smmu_write(struct smmu_device *smmu, u32 val, size_t offs)writel (val, smmu->regs + offs); } -static inline u32 ahb_read (struct smmu_device *smmu,size_t offs) -{ -return readl (smmu->regs_ahbarb + offs); -} -static inline void ahb_write (struct smmu_device *smmu,u32 val,size_t offs) -{ -writel (val, smmu->regs_ahbarb + offs); -} -#define VA_PAGE_TO_PA (va, page) \ (page_to_phys(page) + ((unsigned long)(va) & ~PAGE_MASK))
@@ -370,9 +360,9 @@ static void smmu_flush_regs(struct smmu_device *smmu, int enable)FLUSH_SMMU_REGS (smmu); } -static void smmu_setup_regs (struct smmu_device *smmu) +static int smmu_setup_regs (struct smmu_device *smmu) { -int i; +int i, err;u32 val;for (i =0 ; i < smmu->num_as; i++) {
@@ -398,10 +388,8 @@ static void smmu_setup_regs(struct smmu_device *smmu)smmu_flush_regs (smmu,1 ); - val =ahb_read (smmu,AHB_XBAR_CTRL ); - val |=AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE << -AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT ; -ahb_write (smmu, val,AHB_XBAR_CTRL ); + err =tegra_ahb_enable_smmu (smmu->ahb); +return err; } static void flush_ptc_and_tlb(struct smmu_device *smmu,
@@ -873,17 +861,18 @@ static int tegra_smmu_resume(struct device *dev) {struct smmu_device *smmu =dev_get_drvdata (dev);unsigned long flags; +int err;spin_lock_irqsave (&smmu->lock, flags); -smmu_setup_regs (smmu); + err =smmu_setup_regs (smmu);spin_unlock_irqrestore (&smmu->lock, flags); -return 0 ; +return err; }static int tegra_smmu_probe (struct platform_device *pdev) {struct smmu_device *smmu; -struct resource *regs, *regs2, *window; +struct resource *regs, *window;struct device *dev = &pdev->dev;int i, err =0 ;
@@ -893,9 +882,8 @@ static int tegra_smmu_probe(struct platform_device *pdev)BUILD_BUG_ON (PAGE_SHIFT !=SMMU_PAGE_SHIFT ); regs =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - regs2 =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); - window =platform_get_resource (pdev,IORESOURCE_MEM ,2 ); -if (!regs || !regs2 || !window) { + window =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); +if (!regs || !window) {dev_err (dev,"No SMMU resources\n" );return -ENODEV ; }
@@ -911,14 +899,16 @@ static int tegra_smmu_probe(struct platform_device *pdev) smmu->iovmm_base = (unsigned long )window->start; smmu->page_count =resource_size (window) >>SMMU_PAGE_SHIFT ; smmu->regs =devm_ioremap (dev, regs->start,resource_size (regs)); - smmu->regs_ahbarb =devm_ioremap (dev, regs2->start, -resource_size (regs2)); -if (!smmu->regs || !smmu->regs_ahbarb) { +if (!smmu->regs) {dev_err (dev,"failed to remap SMMU registers\n" ); err = -ENXIO ; goto fail; } + smmu->ahb =of_parse_phandle (pdev->dev.of_node,"ahb" ,0 ); +if (!smmu->ahb) +return -ENODEV ; + smmu->translation_enable_0 = ~0 ; smmu->translation_enable_1 = ~0 ; smmu->translation_enable_2 = ~0 ;
@@ -945,7 +935,9 @@ static int tegra_smmu_probe(struct platform_device *pdev)INIT_LIST_HEAD (&as->client); }spin_lock_init (&smmu->lock); -smmu_setup_regs (smmu); + err =smmu_setup_regs (smmu); +if (err) + goto fail;platform_set_drvdata (pdev, smmu); smmu->avp_vector_page =alloc_page (GFP_KERNEL );
@@ -960,8 +952,6 @@ fail:__free_page (smmu->avp_vector_page);if (smmu->regs)devm_iounmap (dev, smmu->regs); -if (smmu->regs_ahbarb) -devm_iounmap (dev, smmu->regs_ahbarb);if (smmu && smmu->as) {for (i =0 ; i < smmu->num_as; i++) {if (smmu->as[i].pdir_page) {
@@ -993,8 +983,6 @@ static int tegra_smmu_remove(struct platform_device *pdev)__free_page (smmu->avp_vector_page);if (smmu->regs)devm_iounmap (dev, smmu->regs); -if (smmu->regs_ahbarb) -devm_iounmap (dev, smmu->regs_ahbarb);devm_kfree (dev, smmu); smmu_handle =NULL ;return 0 ;
Signature · 1 line
1.7.5.4
Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
Quoted 2 lines · Hiroshi DOYU
Use "
tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready, instead of directly aceessing AHB registers.
You need to make the Kconfig option for the SMMU either depend on or select the TEGRA_AHB option. If you don't, then if someone disables the AHB driver, the SMMU driver may still build, yet fail to link since the AHB API it calls doesn't exist.
drivers/iommu/tegra-smmu.c static void smmu_setup_regs(struct smmu_device *smmu) · line 392
Quoted 12 lines
drivers/iommu/tegra-smmu.c +2
-4@@ -398,10 +388,8 @@ static void smmu_setup_regs(struct smmu_device *smmu)smmu_flush_regs (smmu,1 ); - val =ahb_read (smmu,AHB_XBAR_CTRL ); - val |=AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE << -AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT ; -ahb_write (smmu, val,AHB_XBAR_CTRL ); + err =tegra_ahb_enable_smmu (smmu->ahb); +return err;
You can just "return tegra_ahb_..." here.
drivers/iommu/tegra-smmu.c static int tegra_smmu_probe(struct platform_device *pdev) · line 900
Quoted 3 lines
drivers/iommu/tegra-smmu.c +1
-0@@ -911,14 +899,16 @@ static int tegra_smmu_probe(struct platform_device *pdev) + smmu->ahb =of_parse_phandle (pdev->dev.of_node,"ahb" ,0 );
Hmm, "ahb" should probably be "nvidia,ahb".
I see that neither this patch nor the next patch include binding documentation that describe this property. Can you please add documentation.
Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
From: Stephen Warren <[email protected]>
Subject: Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
Date: Thu, 3 May 2012 19:48:25 +0200
Message-ID: <[email protected]>
Quoted 24 lines · Hiroshi DOYU
Quoted 2 lines
Use "
tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready, instead of directly aceessing AHB registers.You need to make the
Kconfigoption for the SMMU either depend on or select theTEGRA_AHBoption. If you don't, then if someone disables the AHB driver, the SMMU driver may still build, yet fail to link since the AHB API it calls doesn't exist.drivers/iommu/tegra-smmu.c static void smmu_setup_regs(struct smmu_device *smmu) · line 392
Quoted 12 lines
drivers/iommu/tegra-smmu.c +2
-4@@ -398,10 +388,8 @@ static void smmu_setup_regs(struct smmu_device *smmu)smmu_flush_regs (smmu,1 ); - val =ahb_read (smmu,AHB_XBAR_CTRL ); - val |=AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE << -AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT ; -ahb_write (smmu, val,AHB_XBAR_CTRL ); + err =tegra_ahb_enable_smmu (smmu->ahb); +return err;You can just "return
tegra_ahb_..." here.
Quoted 8 lines
drivers/iommu/tegra-smmu.c static int tegra_smmu_probe(struct platform_device *pdev) · line 900
Quoted 3 lines
drivers/iommu/tegra-smmu.c +1
-0@@ -911,14 +899,16 @@ static int tegra_smmu_probe(struct platform_device *pdev) + smmu->ahb =of_parse_phandle (pdev->dev.of_node,"ahb" ,0 );Hmm, "ahb" should probably be "nvidia,ahb".
I see that neither this patch nor the next patch include binding documentation that describe this property. Can you please add documentation.
There will be the tegra Memory Controller(MC) patches following, which will change the way DT is passed, where SMMU/dt is passed from MC.
Can we wait for the following MC patches, not haveing doc for this patch?
Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
In reply to Stephen WarrenQuoted 3 lines · Stephen Warren
Quoted 2 lines · Hiroshi DOYU
Use "
tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready, instead of directly aceessing AHB registers.
Oh, that should be "accessing".
Quoted 8 lines
drivers/iommu/tegra-smmu.c static int tegra_smmu_probe(struct platform_device *pdev) · line 900
Quoted 3 lines
drivers/iommu/tegra-smmu.c +1
-0@@ -911,14 +899,16 @@ static int tegra_smmu_probe(struct platform_device *pdev) + smmu->ahb =of_parse_phandle (pdev->dev.of_node,"ahb" ,0 );Hmm, "ahb" should probably be "nvidia,ahb".
I see that neither this patch nor the next patch include binding documentation that describe this property. Can you please add documentation.
Oh, the next patch is just adding the entry to the .dtsi file for the AHB, so no surprise it doesn't add a binding document for the SMMU!
I see that with this patch, the driver still expects the DMA window to be represented as a reg property (IORESOURCE_MEM), so if we add a binding document to this patch it won't be very consistent either:-( And then, there's the issue of whether the SMMU should be it's own device or a child of some MC device, since there's non-SMMU functionality in these registers too. This makes all the SMMU rework need a little more thought.
So, I propose dropping this patch from this series, since this series is all about adding the AHB driver. We should move this patch to a series relating to the SMMU driver.
Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
From: Stephen Warren <[email protected]>
Subject: Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
Date: Thu, 3 May 2012 19:58:30 +0200
Message-ID: <[email protected]>
Quoted 26 lines · Stephen Warren
Quoted 3 lines · Hiroshi DOYU
Quoted 2 lines
Use "
tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready, instead of directly aceessing AHB registers.Oh, that should be "accessing".
Quoted 8 lines
drivers/iommu/tegra-smmu.c static int tegra_smmu_probe(struct platform_device *pdev) · line 900
Quoted 3 lines
drivers/iommu/tegra-smmu.c +1
-0@@ -911,14 +899,16 @@ static int tegra_smmu_probe(struct platform_device *pdev) + smmu->ahb =of_parse_phandle (pdev->dev.of_node,"ahb" ,0 );Hmm, "ahb" should probably be "nvidia,ahb".
I see that neither this patch nor the next patch include binding documentation that describe this property. Can you please add documentation.
Oh, the next patch is just adding the entry to the .dtsi file for the AHB, so no surprise it doesn't add a binding document for the SMMU!
I see that with this patch, the driver still expects the DMA window to be represented as a reg property (
IORESOURCE_MEM), so if we add a binding document to this patch it won't be very consistent either:-( And then, there's the issue of whether the SMMU should be it's own device or a child of some MC device, since there's non-SMMU functionality in these registers too. This makes all the SMMU rework need a little more thought.
Quoted 3 lines
So, I propose dropping this patch from this series, since this series is all about adding the AHB driver. We should move this patch to a series relating to the SMMU driver.
Ok, I'll post the first 3 patches.
Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
In reply to Stephen WarrenFrom: Stephen Warren <[email protected]>
Subject: Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
Date: Thu, 3 May 2012 19:48:25 +0200
Message-ID: <[email protected]>
Quoted 24 lines · Hiroshi DOYU
Quoted 2 lines
Use "
tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready, instead of directly aceessing AHB registers.You need to make the
Kconfigoption for the SMMU either depend on or select theTEGRA_AHBoption. If you don't, then if someone disables the AHB driver, the SMMU driver may still build, yet fail to link since the AHB API it calls doesn't exist.drivers/iommu/tegra-smmu.c static void smmu_setup_regs(struct smmu_device *smmu) · line 392
Quoted 12 lines
drivers/iommu/tegra-smmu.c +2
-4@@ -398,10 +388,8 @@ static void smmu_setup_regs(struct smmu_device *smmu)smmu_flush_regs (smmu,1 ); - val =ahb_read (smmu,AHB_XBAR_CTRL ); - val |=AHB_XBAR_CTRL_SMMU_INIT_DONE_DONE << -AHB_XBAR_CTRL_SMMU_INIT_DONE_SHIFT ; -ahb_write (smmu, val,AHB_XBAR_CTRL ); + err =tegra_ahb_enable_smmu (smmu->ahb); +return err;You can just "return
tegra_ahb_..." here.
Quoted 5 lines
drivers/iommu/tegra-smmu.c static int tegra_smmu_probe(struct platform_device *pdev) · line 900
Quoted 3 lines
drivers/iommu/tegra-smmu.c +1
-0@@ -911,14 +899,16 @@ static int tegra_smmu_probe(struct platform_device *pdev) + smmu->ahb =of_parse_phandle (pdev->dev.of_node,"ahb" ,0 );Hmm, "ahb" should probably be "nvidia,ahb".
Does this mean the following in dts?
ahb: ahb at 6000c004 {
compatible = "nvidia,tegra30-ahb";
reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */
};
smmu: smmu at 7000f000 {
nvidia,ahb = &ahb;
}; ^^^^^^^^^^Re: [PATCHv3 3/4] iommu/tegra: smmu: Refrain from accessing to AHB
Quoted 4 lines · Hiroshi Doyu
Stephen Warren wrote at Thu, 3 May 2012 19:48:25 +0200:
Quoted 3 lines · Hiroshi DOYU
Quoted 2 lines
Use "
tegra_ahb_enable_smmu()" to inform AHB that SMMU is ready, instead of directly aceessing AHB registers.
...
Quoted 8 lines
Quoted 5 lines
drivers/iommu/tegra-smmu.c static int tegra_smmu_probe(struct platform_device *pdev) · line 900
Quoted 3 lines
drivers/iommu/tegra-smmu.c +1
-0@@ -911,14 +899,16 @@ static int tegra_smmu_probe(struct platform_device *pdev) + smmu->ahb =of_parse_phandle (pdev->dev.of_node,"ahb" ,0 );Hmm, "ahb" should probably be "nvidia,ahb".
Does this mean the following in dts?
Quoted 9 lines
ahb: ahb at 6000c004 {
compatible = "nvidia,tegra30-ahb";
reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */
};
smmu: smmu at 7000f000 {
nvidia,ahb = &ahb;
}; ^^^^^^^^^^Yes.
PATCH v3 4/4 ARM: dt: tegra: Add device tree support for AHB
In reply to Hiroshi DOYUAdd 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
@@ -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
@@ -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
Re: [PATCHv3 4/4] ARM: dt: tegra: Add device tree support for AHB
Quoted 1 line · Hiroshi DOYU
Add AHB entry for tegra20/30.
This looks OK. I can take it through the Tegra tree once the review issues are fixed.
Quoted 13 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.
Some of configuration param could be passed from DT too.
drivers/amba/tegra-ahb.c line 79
Quoted 1 line
drivers/amba/tegra-ahb.c +1
-0+static u32 tegra_ahb_gizmo[] = {
const?
drivers/amba/tegra-ahb.c line 261
Quoted 5 lines
drivers/amba/tegra-ahb.c +5
-0+static int __init tegra_ahb_module_init (void ) +{ +return platform_driver_register (&tegra_ahb_driver); +} +postcore_initcall (tegra_ahb_module_init);
Can this be a module_init() instead of postcore_initcall()?
drivers/amba/tegra-ahb.c line 267
Quoted 6 lines
drivers/amba/tegra-ahb.c +6
-0+ +static void __exit tegra_ahb_module_exit(void) +{ +platform_driver_unregister (&tegra_ahb_driver); +} +module_exit (tegra_ahb_module_exit);
If so, all of the previous two quoted chunks can be replaced with just:
module_platform_driver(tegra_ahb_module_init);
From: Stephen Warren <[email protected]>
Subject: Re: [PATCHv3 1/4] ARM: tegra: Add Tegra AHB driver
Date: Thu, 3 May 2012 19:41:35 +0200
Message-ID: <[email protected]>
Quoted 11 lines · Hiroshi DOYU
Quoted 10 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.
Quoted 6 lines
drivers/amba/tegra-ahb.c line 79
Quoted 4 lines
Some of configuration param could be passed from DT too.
drivers/amba/tegra-ahb.c +1
-0+static u32 tegra_ahb_gizmo[] = {const?
Yes.
Quoted 7 lines
drivers/amba/tegra-ahb.c line 261
Quoted 5 lines
drivers/amba/tegra-ahb.c +5
-0+static int __init tegra_ahb_module_init (void ) +{ +return platform_driver_register (&tegra_ahb_driver); +} +postcore_initcall (tegra_ahb_module_init);Can this be a
module_init()instead ofpostcore_initcall()?
Since this driver configures prefetch size from AHB client devices, it's better to make this driver available before other AHB client drivers get ready. So "postcore_initcall()" seems to make sense if there's no other better initcall.
Quoted 10 lines
drivers/amba/tegra-ahb.c line 267
Quoted 6 lines
drivers/amba/tegra-ahb.c +6
-0+ +static void __exit tegra_ahb_module_exit(void) +{ +platform_driver_unregister (&tegra_ahb_driver); +} +module_exit (tegra_ahb_module_exit);If so, all of the previous two quoted chunks can be replaced with just:
module_platform_driver(tegra_ahb_module_init);
Quoted 4 lines · Hiroshi Doyu
Stephen Warren wrote at Thu, 3 May 2012 19:41:35 +0200:
Quoted 3 lines · Hiroshi DOYU
Quoted 2 lines
Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.
...
Quoted 8 lines
Quoted 7 lines
drivers/amba/tegra-ahb.c line 261
Quoted 5 lines
drivers/amba/tegra-ahb.c new file +5
-0+static int __init tegra_ahb_module_init (void ) +{ +return platform_driver_register (&tegra_ahb_driver); +} +postcore_initcall (tegra_ahb_module_init);Can this be a
module_init()instead ofpostcore_initcall()?
Quoted 4 lines
Since this driver configures prefetch size from AHB client devices, it's better to make this driver available before other AHB client drivers get ready. So "
postcore_initcall()" seems to make sense if there's no other better initcall.
I believe this only affects when the driver is registered and has no influence over when the device itself is probed.
When booting with board files rather than DT, it was possible to register drivers and platform devices early using various initcalls to control the order. However, with DT, I believe all the devices are instantiated from DT at the same time (well, one by one in whatever order as the DT is parsed), so the time when the driver is registered isn't relevant.
So, if the other AHB devices really need this AHB driver to initialize first, you'd better move all the AHB devices inside the AHB node in DT, so that the AHB driver can influence when the children get probed. Still, I'd suggest leaving that to a later patch, since everything clearly works fine right now without this driver even existing.
Quoted 10 lines
Quoted 10 lines
drivers/amba/tegra-ahb.c line 267
Quoted 6 lines
drivers/amba/tegra-ahb.c new file +6
-0+ +static void __exit tegra_ahb_module_exit(void) +{ +platform_driver_unregister (&tegra_ahb_driver); +} +module_exit (tegra_ahb_module_exit);If so, all of the previous two quoted chunks can be replaced with just:
module_platform_driver(tegra_ahb_module_init);
Quoted 29 lines · On Fri, 4 May 2012 18:48:56 +0200 Stephen Warren <[email protected]> wrote:
Quoted 4 lines · Hiroshi Doyu
Stephen Warren wrote at Thu, 3 May 2012 19:41:35 +0200:
Quoted 3 lines · Hiroshi DOYU
Quoted 2 lines
Tegra AHB Bus conforms to the AMBA Specification (Rev 2.0) Advanced High-performance Bus (AHB) architecture.
...
Quoted 8 lines
Quoted 7 lines
drivers/amba/tegra-ahb.c line 261
Quoted 5 lines
drivers/amba/tegra-ahb.c new file +5
-0+static int __init tegra_ahb_module_init (void ) +{ +return platform_driver_register (&tegra_ahb_driver); +} +postcore_initcall (tegra_ahb_module_init);Can this be a
module_init()instead ofpostcore_initcall()?Quoted 4 lines
Since this driver configures prefetch size from AHB client devices, it's better to make this driver available before other AHB client drivers get ready. So "
postcore_initcall()" seems to make sense if there's no other better initcall.I believe this only affects when the driver is registered and has no influence over when the device itself is probed.
When booting with board files rather than DT, it was possible to register drivers and platform devices early using various initcalls to control the order. However, with DT, I believe all the devices are instantiated from DT at the same time (well, one by one in whatever order as the DT is parsed), so the time when the driver is registered isn't relevant.
Quoted 5 lines
So, if the other AHB devices really need this AHB driver to initialize first, you'd better move all the AHB devices inside the AHB node in DT, so that the AHB driver can influence when the children get probed. Still, I'd suggest leaving that to a later patch, since everything clearly works fine right now without this driver even existing.
Ok, I'll use module_platform_driver(tegra_ahb_driver). These order would be revisited.
Quoted 11 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.
Some of configuration param could be passed from DT too.
This patch should add Documentation/devicetree/bindings/arm/tegra/tegra20-ahb.txt to describe the DT binding.
From: Stephen Warren <[email protected]>
Subject: Re: [PATCHv3 1/4] ARM: tegra: Add Tegra AHB driver
Date: Thu, 3 May 2012 19:59:33 +0200
Message-ID: <[email protected]>
Quoted 11 lines · Hiroshi DOYU
Quoted 10 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.
Quoted 7 lines
Quoted 1 line
Some of configuration param could be passed from DT too.
This patch should add
Documentation/devicetree/bindings/arm/tegra/tegra20-ahb.txtto describe the DT binding.From 'dts' POV, there's no difference between tegra20 and
tegra30. They just have a register range. Is "../bindings/arm/tegra/tegra-ahb.txt" ok, instead of having both tegra{20,30}-ahb.txt?
Quoted 8 lines · Hiroshi Doyu
Quoted 3 lines
This patch should add
Documentation/devicetree/bindings/arm/tegra/tegra20-ahb.txtto describe the DT binding.From 'dts' POV, there's no difference between tegra20 and tegra30. They just have a register range. Is "
../bindings/arm/tegra/tegra-ahb.txt" ok, instead of having both tegra{20,30}-ahb.txt?
I think either one is ok. Just calling it tegra20-ahb.txt would be fine too because tegra30 is compatible to that.
Arnd
Quoted 18 lines · Hiroshi Doyu
From: Stephen Warren <[email protected]>
Subject: Re: [PATCHv3 1/4] ARM: tegra: Add Tegra AHB driver
Date: Thu, 3 May 2012 19:59:33 +0200
Message-ID: <[email protected]>Quoted 13 lines · Hiroshi DOYU
Quoted 11 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.
Some of configuration param could be passed from DT too.
Quoted 8 lines
Quoted 3 lines
This patch should add
Documentation/devicetree/bindings/arm/tegra/tegra20-ahb.txtto describe the DT binding.From 'dts' POV, there's no difference between tegra20 and tegra30. They just have a register range. Is "
../bindings/arm/tegra/tegra-ahb.txt" ok, instead of having both tegra{20,30}-ahb.txt?
Personally, I prefer to name files using the exact compatible value of the first SoC version that introduced the HW. This allows e.g. "tegra40-ahb.txt" to be introduced without making "tegra-ahb.txt" no longer fully general.