mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
gpu: host1x: Simplify register mapping and add common aperture
Refactor 'regs' property loading using devm_platform_ioremap_* and add loading of the 'common' region found on Tegra234. Bug 3724727 Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Change-Id: I4652e4225ca72d1e61b4bdae122e5765eaa2455b Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2745951 Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com> Reviewed-by: Brad Griffis <bgriffis@nvidia.com> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: Brad Griffis <bgriffis@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
80828001d5
commit
d9c7b1421d
@@ -41,6 +41,11 @@
|
|||||||
#include "hw/host1x06.h"
|
#include "hw/host1x06.h"
|
||||||
#include "hw/host1x07.h"
|
#include "hw/host1x07.h"
|
||||||
|
|
||||||
|
void host1x_common_writel(struct host1x *host1x, u32 v, u32 r)
|
||||||
|
{
|
||||||
|
writel(v, host1x->common_regs + r);
|
||||||
|
}
|
||||||
|
|
||||||
void host1x_hypervisor_writel(struct host1x *host1x, u32 v, u32 r)
|
void host1x_hypervisor_writel(struct host1x *host1x, u32 v, u32 r)
|
||||||
{
|
{
|
||||||
writel(v, host1x->hv_regs + r);
|
writel(v, host1x->hv_regs + r);
|
||||||
@@ -455,7 +460,6 @@ static int host1x_get_resets(struct host1x *host)
|
|||||||
static int host1x_probe(struct platform_device *pdev)
|
static int host1x_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct host1x *host;
|
struct host1x *host;
|
||||||
struct resource *regs, *hv_regs = NULL;
|
|
||||||
int syncpt_irq;
|
int syncpt_irq;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -466,25 +470,23 @@ static int host1x_probe(struct platform_device *pdev)
|
|||||||
host->info = of_device_get_match_data(&pdev->dev);
|
host->info = of_device_get_match_data(&pdev->dev);
|
||||||
|
|
||||||
if (host->info->has_hypervisor) {
|
if (host->info->has_hypervisor) {
|
||||||
regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vm");
|
host->regs = devm_platform_ioremap_resource_byname(pdev, "vm");
|
||||||
if (!regs) {
|
if (IS_ERR(host->regs))
|
||||||
dev_err(&pdev->dev, "failed to get vm registers\n");
|
return PTR_ERR(host->regs);
|
||||||
return -ENXIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
hv_regs = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
host->hv_regs = devm_platform_ioremap_resource_byname(pdev, "hypervisor");
|
||||||
"hypervisor");
|
if (IS_ERR(host->hv_regs))
|
||||||
if (!hv_regs) {
|
return PTR_ERR(host->hv_regs);
|
||||||
dev_err(&pdev->dev,
|
|
||||||
"failed to get hypervisor registers\n");
|
if (host->info->has_common) {
|
||||||
return -ENXIO;
|
host->common_regs = devm_platform_ioremap_resource_byname(pdev, "common");
|
||||||
|
if (IS_ERR(host->common_regs))
|
||||||
|
return PTR_ERR(host->common_regs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
host->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||||
if (!regs) {
|
if (IS_ERR(host->regs))
|
||||||
dev_err(&pdev->dev, "failed to get registers\n");
|
return PTR_ERR(host->regs);
|
||||||
return -ENXIO;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
syncpt_irq = platform_get_irq(pdev, 0);
|
syncpt_irq = platform_get_irq(pdev, 0);
|
||||||
@@ -499,16 +501,6 @@ static int host1x_probe(struct platform_device *pdev)
|
|||||||
/* set common host1x device data */
|
/* set common host1x device data */
|
||||||
platform_set_drvdata(pdev, host);
|
platform_set_drvdata(pdev, host);
|
||||||
|
|
||||||
host->regs = devm_ioremap_resource(&pdev->dev, regs);
|
|
||||||
if (IS_ERR(host->regs))
|
|
||||||
return PTR_ERR(host->regs);
|
|
||||||
|
|
||||||
if (host->info->has_hypervisor) {
|
|
||||||
host->hv_regs = devm_ioremap_resource(&pdev->dev, hv_regs);
|
|
||||||
if (IS_ERR(host->hv_regs))
|
|
||||||
return PTR_ERR(host->hv_regs);
|
|
||||||
}
|
|
||||||
|
|
||||||
host->dev->dma_parms = &host->dma_parms;
|
host->dev->dma_parms = &host->dma_parms;
|
||||||
dma_set_max_seg_size(host->dev, UINT_MAX);
|
dma_set_max_seg_size(host->dev, UINT_MAX);
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ struct host1x_info {
|
|||||||
u64 dma_mask; /* mask of addressable memory */
|
u64 dma_mask; /* mask of addressable memory */
|
||||||
bool has_wide_gather; /* supports GATHER_W opcode */
|
bool has_wide_gather; /* supports GATHER_W opcode */
|
||||||
bool has_hypervisor; /* has hypervisor registers */
|
bool has_hypervisor; /* has hypervisor registers */
|
||||||
|
bool has_common; /* has common registers separate from hypervisor */
|
||||||
unsigned int num_sid_entries;
|
unsigned int num_sid_entries;
|
||||||
const struct host1x_sid_entry *sid_table;
|
const struct host1x_sid_entry *sid_table;
|
||||||
/*
|
/*
|
||||||
@@ -115,6 +116,7 @@ struct host1x {
|
|||||||
|
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
void __iomem *hv_regs; /* hypervisor region */
|
void __iomem *hv_regs; /* hypervisor region */
|
||||||
|
void __iomem *common_regs;
|
||||||
struct host1x_syncpt *syncpt;
|
struct host1x_syncpt *syncpt;
|
||||||
struct host1x_syncpt_base *bases;
|
struct host1x_syncpt_base *bases;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
@@ -156,6 +158,7 @@ struct host1x {
|
|||||||
struct host1x_bo_cache cache;
|
struct host1x_bo_cache cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void host1x_common_writel(struct host1x *host1x, u32 v, u32 r);
|
||||||
void host1x_hypervisor_writel(struct host1x *host1x, u32 r, u32 v);
|
void host1x_hypervisor_writel(struct host1x *host1x, u32 r, u32 v);
|
||||||
u32 host1x_hypervisor_readl(struct host1x *host1x, u32 r);
|
u32 host1x_hypervisor_readl(struct host1x *host1x, u32 r);
|
||||||
void host1x_sync_writel(struct host1x *host1x, u32 r, u32 v);
|
void host1x_sync_writel(struct host1x *host1x, u32 r, u32 v);
|
||||||
|
|||||||
Reference in New Issue
Block a user