drm/ast: Bugfix display error for ps23xx when using ast bmc
card When the ast bmc card is detected on ps23xx SoCs, change the card's vram to uncache mode to avoid unnecessary trouble. Reviewed-by: Jiakun Shuai<shuaijiakun1288@phytium.com.cn> Signed-off-by: Xu Yan <xuyan1481@phytium.com.cn> Signed-off-by: WangHao <wanghao1851@cphytium.com.cn>
This commit is contained in:
parent
c328a15761
commit
19f3a59713
|
@ -44,6 +44,24 @@ int ast_modeset = -1;
|
||||||
MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
|
MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
|
||||||
module_param_named(modeset, ast_modeset, int, 0400);
|
module_param_named(modeset, ast_modeset, int, 0400);
|
||||||
|
|
||||||
|
#define DRM_AST_VRAM_TYPE_DEVICE 0x0
|
||||||
|
#define DRM_IOCTL_AST_VRAM_TYPE_DEVICE DRM_IO(DRM_COMMAND_BASE\
|
||||||
|
+ DRM_AST_VRAM_TYPE_DEVICE)
|
||||||
|
|
||||||
|
static int ast_ioctl_check_ft5c01_host(struct drm_device *dev, void *data,
|
||||||
|
struct drm_file *file_priv)
|
||||||
|
{
|
||||||
|
struct ast_private *priv = dev->dev_private;
|
||||||
|
|
||||||
|
return priv->is_ft5c01_host ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct drm_ioctl_desc ast_ioctls[] = {
|
||||||
|
/* for test, none so far */
|
||||||
|
DRM_IOCTL_DEF_DRV(AST_VRAM_TYPE_DEVICE, ast_ioctl_check_ft5c01_host,
|
||||||
|
DRM_AUTH|DRM_UNLOCKED),
|
||||||
|
};
|
||||||
|
|
||||||
#define PCI_VENDOR_ASPEED 0x1a03
|
#define PCI_VENDOR_ASPEED 0x1a03
|
||||||
|
|
||||||
static struct drm_driver driver;
|
static struct drm_driver driver;
|
||||||
|
@ -212,6 +230,8 @@ static struct drm_driver driver = {
|
||||||
.load = ast_driver_load,
|
.load = ast_driver_load,
|
||||||
.unload = ast_driver_unload,
|
.unload = ast_driver_unload,
|
||||||
|
|
||||||
|
.ioctls = ast_ioctls,
|
||||||
|
.num_ioctls = ARRAY_SIZE(ast_ioctls),
|
||||||
.fops = &ast_fops,
|
.fops = &ast_fops,
|
||||||
.name = DRIVER_NAME,
|
.name = DRIVER_NAME,
|
||||||
.desc = DRIVER_DESC,
|
.desc = DRIVER_DESC,
|
||||||
|
|
|
@ -99,6 +99,8 @@ struct ast_private {
|
||||||
|
|
||||||
struct drm_gem_object *cursor_cache;
|
struct drm_gem_object *cursor_cache;
|
||||||
int next_cursor;
|
int next_cursor;
|
||||||
|
|
||||||
|
bool is_ft5c01_host;
|
||||||
bool support_wide_screen;
|
bool support_wide_screen;
|
||||||
enum {
|
enum {
|
||||||
ast_use_p2a,
|
ast_use_p2a,
|
||||||
|
|
|
@ -34,11 +34,65 @@
|
||||||
|
|
||||||
#include "ast_drv.h"
|
#include "ast_drv.h"
|
||||||
|
|
||||||
|
static int ast_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
|
||||||
|
struct ttm_mem_reg *mem)
|
||||||
|
{
|
||||||
|
struct ttm_mem_type_manager *man = bdev->man + mem->mem_type;
|
||||||
|
struct drm_vram_mm *vmm = drm_vram_mm_of_bdev(bdev);
|
||||||
|
|
||||||
|
if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
mem->bus.addr = NULL;
|
||||||
|
mem->bus.size = mem->num_pages << PAGE_SHIFT;
|
||||||
|
|
||||||
|
switch (mem->mem_type) {
|
||||||
|
case TTM_PL_SYSTEM: /* nothing to do */
|
||||||
|
mem->bus.offset = 0;
|
||||||
|
mem->bus.base = 0;
|
||||||
|
mem->bus.is_iomem = false;
|
||||||
|
break;
|
||||||
|
case TTM_PL_VRAM:
|
||||||
|
mem->bus.offset = mem->start << PAGE_SHIFT;
|
||||||
|
mem->bus.base = vmm->vram_base;
|
||||||
|
mem->bus.is_iomem = true;
|
||||||
|
|
||||||
|
mem->placement = TTM_PL_FLAG_UNCACHED;
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool ast_pci_host_is_5c01(struct pci_bus *bus)
|
||||||
|
{
|
||||||
|
struct pci_bus *child = bus;
|
||||||
|
struct pci_dev *root = NULL;
|
||||||
|
|
||||||
|
while (child) {
|
||||||
|
if (child->parent->parent)
|
||||||
|
child = child->parent;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
root = child->self;
|
||||||
|
|
||||||
|
if ((root->vendor == 0x1db7) && (root->device == 0x5c01))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int ast_mm_init(struct ast_private *ast)
|
int ast_mm_init(struct ast_private *ast)
|
||||||
{
|
{
|
||||||
struct drm_vram_mm *vmm;
|
struct drm_vram_mm *vmm;
|
||||||
int ret;
|
int ret;
|
||||||
struct drm_device *dev = ast->dev;
|
struct drm_device *dev = ast->dev;
|
||||||
|
struct pci_dev *pdev = to_pci_dev(dev->dev);
|
||||||
|
|
||||||
|
|
||||||
vmm = drm_vram_helper_alloc_mm(
|
vmm = drm_vram_helper_alloc_mm(
|
||||||
dev, pci_resource_start(dev->pdev, 0),
|
dev, pci_resource_start(dev->pdev, 0),
|
||||||
|
@ -49,6 +103,13 @@ int ast_mm_init(struct ast_private *ast)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ast_pci_host_is_5c01(pdev->bus) && dev->vram_mm->bdev.driver) {
|
||||||
|
ast->is_ft5c01_host = true;
|
||||||
|
dev->vram_mm->bdev.driver->io_mem_reserve = ast_ttm_io_mem_reserve;
|
||||||
|
} else {
|
||||||
|
ast->is_ft5c01_host = false;
|
||||||
|
}
|
||||||
|
|
||||||
arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0),
|
arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0),
|
||||||
pci_resource_len(dev->pdev, 0));
|
pci_resource_len(dev->pdev, 0));
|
||||||
ast->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
|
ast->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0),
|
||||||
|
|
Loading…
Reference in New Issue