Commit c4c21f22 authored by Thierry Reding's avatar Thierry Reding

memory: tegra: Set DMA mask based on supported address bits

The memory controller on Tegra124 and later supports 34 or more address
bits. Advertise that by setting the DMA mask based on the number of the
address bits.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
parent 3feb4a3c
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -626,6 +627,7 @@ static int tegra_mc_probe(struct platform_device *pdev) ...@@ -626,6 +627,7 @@ static int tegra_mc_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct tegra_mc *mc; struct tegra_mc *mc;
void *isr; void *isr;
u64 mask;
int err; int err;
mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL); mc = devm_kzalloc(&pdev->dev, sizeof(*mc), GFP_KERNEL);
...@@ -637,6 +639,14 @@ static int tegra_mc_probe(struct platform_device *pdev) ...@@ -637,6 +639,14 @@ static int tegra_mc_probe(struct platform_device *pdev)
mc->soc = of_device_get_match_data(&pdev->dev); mc->soc = of_device_get_match_data(&pdev->dev);
mc->dev = &pdev->dev; mc->dev = &pdev->dev;
mask = DMA_BIT_MASK(mc->soc->num_address_bits);
err = dma_coerce_mask_and_coherent(&pdev->dev, mask);
if (err < 0) {
dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
return err;
}
/* length of MC tick in nanoseconds */ /* length of MC tick in nanoseconds */
mc->tick = 30; mc->tick = 30;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment