Skip to content

Commit

Permalink
Merge tag 'tegra-for-3.19-dt' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/tegra/linux into next/dt2

Pull "ARM: tegra: Device tree changes for v3.19" from Thierry Reding:

The bulk of these changes add memory controller nodes for Tegra30,
Tegra114 and Tegra124. The memory controller implements an IOMMU that
the display controllers are attached to. This allows them to scan out
physically non-contiguous framebuffers and removes one of the primary
users of CMA.

The only other change adds a new MIPI pad control bank to the pin
controller on Tegra124. The corresponding driver patch for this went
into v3.18 as:

        3ccc11f pinctrl: tegra: Add MIPI pad control

* tag 'tegra-for-3.19-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
  ARM: tegra: Enable IOMMU for display controllers on Tegra124
  ARM: tegra: Enable IOMMU for display controllers on Tegra114
  ARM: tegra: Enable IOMMU for display controllers on Tegra30
  ARM: tegra: Add memory controller support for Tegra124
  ARM: tegra: Add memory controller support for Tegra114
  ARM: tegra: Add memory controller support for Tegra30
  ARM: tegra: Add APB_MISC_GP as a MIPI pad control bank

These additional commits are merged as dependencies:

  memory: Add NVIDIA Tegra memory controller support
  of: Add NVIDIA Tegra memory controller binding
  ARM: tegra: Move AHB Kconfig to drivers/amba
  amba: Add Kconfig file
  clk: tegra: Implement memory-controller clock
  powerpc/iommu: Rename iommu_[un]map_sg functions
  iommu: Improve error handling when setting bus iommu
  iommu: Do more input validation in iommu_map_sg()
  iommu: Add iommu_map_sg() function

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann committed Dec 4, 2014
2 parents 2f84411 + 5b605d4 commit 1d5f497
Show file tree
Hide file tree
Showing 48 changed files with 4,232 additions and 1,551 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
NVIDIA Tegra Memory Controller device tree bindings
===================================================

Required properties:
- compatible: Should be "nvidia,tegra<chip>-mc"
- reg: Physical base address and length of the controller's registers.
- clocks: Must contain an entry for each entry in clock-names.
See ../clocks/clock-bindings.txt for details.
- clock-names: Must include the following entries:
- mc: the module's clock input
- interrupts: The interrupt outputs from the controller.
- #iommu-cells: Should be 1. The single cell of the IOMMU specifier defines
the SWGROUP of the master.

This device implements an IOMMU that complies with the generic IOMMU binding.
See ../iommu/iommu.txt for details.

Example:
--------

mc: memory-controller@0,70019000 {
compatible = "nvidia,tegra124-mc";
reg = <0x0 0x70019000 0x0 0x1000>;
clocks = <&tegra_car TEGRA124_CLK_MC>;
clock-names = "mc";

interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;

#iommu-cells = <1>;
};

sdhci@0,700b0000 {
compatible = "nvidia,tegra124-sdhci";
...
iommus = <&mc TEGRA_SWGROUP_SDMMC1A>;
};
3 changes: 0 additions & 3 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1259,9 +1259,6 @@ source "arch/arm/common/Kconfig"

menu "Bus support"

config ARM_AMBA
bool

config ISA
bool
help
Expand Down
23 changes: 14 additions & 9 deletions arch/arm/boot/dts/tegra114.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <dt-bindings/clock/tegra114-car.h>
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/memory/tegra114-mc.h>
#include <dt-bindings/pinctrl/pinctrl-tegra.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

Expand Down Expand Up @@ -57,6 +58,8 @@
resets = <&tegra_car 27>;
reset-names = "dc";

iommus = <&mc TEGRA_SWGROUP_DC>;

nvidia,head = <0>;

rgb {
Expand All @@ -74,6 +77,8 @@
resets = <&tegra_car 26>;
reset-names = "dc";

iommus = <&mc TEGRA_SWGROUP_DCB>;

nvidia,head = <1>;

rgb {
Expand Down Expand Up @@ -505,15 +510,15 @@
reset-names = "fuse";
};

iommu@70019010 {
compatible = "nvidia,tegra114-smmu", "nvidia,tegra30-smmu";
reg = <0x70019010 0x02c
0x700191f0 0x010
0x70019228 0x074>;
nvidia,#asids = <4>;
dma-window = <0 0x40000000>;
nvidia,swgroups = <0x18659fe>;
nvidia,ahb = <&ahb>;
mc: memory-controller@70019000 {
compatible = "nvidia,tegra114-mc";
reg = <0x70019000 0x1000>;
clocks = <&tegra_car TEGRA114_CLK_MC>;
clock-names = "mc";

interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;

#iommu-cells = <1>;
};

ahub@70080000 {
Expand Down
19 changes: 18 additions & 1 deletion arch/arm/boot/dts/tegra124.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <dt-bindings/clock/tegra124-car.h>
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/memory/tegra124-mc.h>
#include <dt-bindings/pinctrl/pinctrl-tegra.h>
#include <dt-bindings/pinctrl/pinctrl-tegra-xusb.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
Expand Down Expand Up @@ -102,6 +103,8 @@
resets = <&tegra_car 27>;
reset-names = "dc";

iommus = <&mc TEGRA_SWGROUP_DC>;

nvidia,head = <0>;
};

Expand All @@ -115,6 +118,8 @@
resets = <&tegra_car 26>;
reset-names = "dc";

iommus = <&mc TEGRA_SWGROUP_DCB>;

nvidia,head = <1>;
};

Expand Down Expand Up @@ -275,7 +280,8 @@
pinmux: pinmux@0,70000868 {
compatible = "nvidia,tegra124-pinmux";
reg = <0x0 0x70000868 0x0 0x164>, /* Pad control registers */
<0x0 0x70003000 0x0 0x434>; /* Mux registers */
<0x0 0x70003000 0x0 0x434>, /* Mux registers */
<0x0 0x70000820 0x0 0x008>; /* MIPI pad control */
};

/*
Expand Down Expand Up @@ -551,6 +557,17 @@
reset-names = "fuse";
};

mc: memory-controller@0,70019000 {
compatible = "nvidia,tegra124-mc";
reg = <0x0 0x70019000 0x0 0x1000>;
clocks = <&tegra_car TEGRA124_CLK_MC>;
clock-names = "mc";

interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;

#iommu-cells = <1>;
};

sata@0,70020000 {
compatible = "nvidia,tegra124-ahci";

Expand Down
25 changes: 11 additions & 14 deletions arch/arm/boot/dts/tegra30.dtsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <dt-bindings/clock/tegra30-car.h>
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/memory/tegra30-mc.h>
#include <dt-bindings/pinctrl/pinctrl-tegra.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

Expand Down Expand Up @@ -174,6 +175,8 @@
resets = <&tegra_car 27>;
reset-names = "dc";

iommus = <&mc TEGRA_SWGROUP_DC>;

nvidia,head = <0>;

rgb {
Expand All @@ -191,6 +194,8 @@
resets = <&tegra_car 26>;
reset-names = "dc";

iommus = <&mc TEGRA_SWGROUP_DCB>;

nvidia,head = <1>;

rgb {
Expand Down Expand Up @@ -623,23 +628,15 @@
clock-names = "pclk", "clk32k_in";
};

memory-controller@7000f000 {
mc: memory-controller@7000f000 {
compatible = "nvidia,tegra30-mc";
reg = <0x7000f000 0x010
0x7000f03c 0x1b4
0x7000f200 0x028
0x7000f284 0x17c>;
reg = <0x7000f000 0x400>;
clocks = <&tegra_car TEGRA30_CLK_MC>;
clock-names = "mc";

interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
};

iommu@7000f010 {
compatible = "nvidia,tegra30-smmu";
reg = <0x7000f010 0x02c
0x7000f1f0 0x010
0x7000f228 0x05c>;
nvidia,#asids = <4>; /* # of ASIDs */
dma-window = <0 0x40000000>; /* IOVA start & length */
nvidia,ahb = <&ahb>;
#iommu-cells = <1>;
};

fuse@7000f800 {
Expand Down
9 changes: 1 addition & 8 deletions arch/arm/mach-tegra/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ menuconfig ARCH_TEGRA
bool "NVIDIA Tegra" if ARCH_MULTI_V7
select ARCH_REQUIRE_GPIOLIB
select ARCH_SUPPORTS_TRUSTED_FOUNDATIONS
select ARM_AMBA
select ARM_GIC
select CLKSRC_MMIO
select HAVE_ARM_SCU if SMP
Expand Down Expand Up @@ -59,12 +60,4 @@ config ARCH_TEGRA_124_SOC
Support for NVIDIA Tegra T124 processor family, based on the
ARM CortexA15MP CPU

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
performance parameters(priority, prefech size).

endif
3 changes: 0 additions & 3 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,6 @@ endmenu

menu "Bus support"

config ARM_AMBA
bool

config PCI
bool "PCI support"
help
Expand Down
17 changes: 10 additions & 7 deletions arch/powerpc/include/asm/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,16 @@ static inline void set_iommu_table_base_and_group(struct device *dev,
iommu_add_device(dev);
}

extern int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
struct scatterlist *sglist, int nelems,
unsigned long mask, enum dma_data_direction direction,
struct dma_attrs *attrs);
extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction,
struct dma_attrs *attrs);
extern int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
struct scatterlist *sglist, int nelems,
unsigned long mask,
enum dma_data_direction direction,
struct dma_attrs *attrs);
extern void ppc_iommu_unmap_sg(struct iommu_table *tbl,
struct scatterlist *sglist,
int nelems,
enum dma_data_direction direction,
struct dma_attrs *attrs);

extern void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl,
size_t size, dma_addr_t *dma_handle,
Expand Down
8 changes: 4 additions & 4 deletions arch/powerpc/kernel/dma-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ static int dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction,
struct dma_attrs *attrs)
{
return iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems,
device_to_mask(dev), direction, attrs);
return ppc_iommu_map_sg(dev, get_iommu_table_base(dev), sglist, nelems,
device_to_mask(dev), direction, attrs);
}

static void dma_iommu_unmap_sg(struct device *dev, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction,
struct dma_attrs *attrs)
{
iommu_unmap_sg(get_iommu_table_base(dev), sglist, nelems, direction,
attrs);
ppc_iommu_unmap_sg(get_iommu_table_base(dev), sglist, nelems,
direction, attrs);
}

/* We support DMA to/from any memory page via the iommu */
Expand Down
16 changes: 8 additions & 8 deletions arch/powerpc/kernel/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,10 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
ppc_md.tce_flush(tbl);
}

int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
struct scatterlist *sglist, int nelems,
unsigned long mask, enum dma_data_direction direction,
struct dma_attrs *attrs)
int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
struct scatterlist *sglist, int nelems,
unsigned long mask, enum dma_data_direction direction,
struct dma_attrs *attrs)
{
dma_addr_t dma_next = 0, dma_addr;
struct scatterlist *s, *outs, *segstart;
Expand Down Expand Up @@ -539,7 +539,7 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,

DBG("mapped %d elements:\n", outcount);

/* For the sake of iommu_unmap_sg, we clear out the length in the
/* For the sake of ppc_iommu_unmap_sg, we clear out the length in the
* next entry of the sglist if we didn't fill the list completely
*/
if (outcount < incount) {
Expand Down Expand Up @@ -572,9 +572,9 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
}


void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction,
struct dma_attrs *attrs)
void ppc_iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
int nelems, enum dma_data_direction direction,
struct dma_attrs *attrs)
{
struct scatterlist *sg;

Expand Down
9 changes: 5 additions & 4 deletions arch/powerpc/platforms/cell/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,9 @@ static int dma_fixed_map_sg(struct device *dev, struct scatterlist *sg,
if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs))
return dma_direct_ops.map_sg(dev, sg, nents, direction, attrs);
else
return iommu_map_sg(dev, cell_get_iommu_table(dev), sg, nents,
device_to_mask(dev), direction, attrs);
return ppc_iommu_map_sg(dev, cell_get_iommu_table(dev), sg,
nents, device_to_mask(dev),
direction, attrs);
}

static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg,
Expand All @@ -632,8 +633,8 @@ static void dma_fixed_unmap_sg(struct device *dev, struct scatterlist *sg,
if (iommu_fixed_is_weak == dma_get_attr(DMA_ATTR_WEAK_ORDERING, attrs))
dma_direct_ops.unmap_sg(dev, sg, nents, direction, attrs);
else
iommu_unmap_sg(cell_get_iommu_table(dev), sg, nents, direction,
attrs);
ppc_iommu_unmap_sg(cell_get_iommu_table(dev), sg, nents,
direction, attrs);
}

static int dma_fixed_dma_supported(struct device *dev, u64 mask)
Expand Down
2 changes: 2 additions & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
menu "Device Drivers"

source "drivers/amba/Kconfig"

source "drivers/base/Kconfig"

source "drivers/bus/Kconfig"
Expand Down
14 changes: 14 additions & 0 deletions drivers/amba/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
config ARM_AMBA
bool

if ARM_AMBA

config TEGRA_AHB
bool "Enable AHB driver for NVIDIA Tegra SoCs"
default y if ARCH_TEGRA
help
Adds AHB configuration functionality for NVIDIA Tegra SoCs,
which controls AHB bus master arbitration and some performance
parameters (priority, prefetch size).

endif
13 changes: 13 additions & 0 deletions drivers/clk/tegra/clk-divider.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,16 @@ struct clk *tegra_clk_register_divider(const char *name,

return clk;
}

static const struct clk_div_table mc_div_table[] = {
{ .val = 0, .div = 2 },
{ .val = 1, .div = 1 },
{ .val = 0, .div = 0 },
};

struct clk *tegra_clk_register_mc(const char *name, const char *parent_name,
void __iomem *reg, spinlock_t *lock)
{
return clk_register_divider_table(NULL, name, parent_name, 0, reg,
16, 1, 0, mc_div_table, lock);
}
Loading

0 comments on commit 1d5f497

Please sign in to comment.