[openchrome-devel] drm-openchrome: Branch 'drm-next-4.20' - 4 commits - drivers/gpu/drm
Kevin Brace
kevinbrace at kemper.freedesktop.org
Fri Oct 12 03:30:22 UTC 2018
drivers/gpu/drm/openchrome/openchrome_drv.c | 115 ++++++++++++++++------
drivers/gpu/drm/openchrome/openchrome_drv.h | 11 +-
drivers/gpu/drm/openchrome/openchrome_h1_cmdbuf.c | 2
drivers/gpu/drm/openchrome/openchrome_ttm.c | 32 ------
4 files changed, 94 insertions(+), 66 deletions(-)
New commits:
commit 46caf7ce2b78b498240b4eb01d9889635e39531d
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Thu Oct 11 20:29:39 2018 -0700
drm/openchrome: Version bumped to 3.0.87
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 429c44495efc..5bde11a83947 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -31,11 +31,11 @@
#define DRIVER_AUTHOR "OpenChrome Project"
#define DRIVER_NAME "openchrome"
#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20180905"
+#define DRIVER_DATE "20181011"
#define DRIVER_MAJOR 3
#define DRIVER_MINOR 0
-#define DRIVER_PATCHLEVEL 86
+#define DRIVER_PATCHLEVEL 87
#include <linux/module.h>
#include "ttm/ttm_bo_api.h"
commit 0ff2fa7f7d4dde2026a43c49a91971f085c91ca5
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Thu Oct 11 20:27:12 2018 -0700
drm/openchrome: Map MMIO without TTM
Previously, it was done via TTM, but it can be done without it.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index dabc0f6c064d..d5899ed20506 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -135,28 +135,72 @@ static void via_agp_engine_init(struct via_device *dev_priv)
}
#endif
-static void via_mmio_setup(struct via_device *dev_priv)
+static int openchrome_mmio_init(struct via_device *dev_priv)
{
- void __iomem *regs = ioport_map(0x3c0, 100);
- u8 val;
+ struct drm_device *dev = dev_priv->dev;
+ int ret = 0;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- val = ioread8(regs + 0x03);
- iowrite8(val | 0x1, regs + 0x03);
- val = ioread8(regs + 0x0C);
- iowrite8(val | 0x1, regs + 0x02);
+ /*
+ * PCI BAR1 is the MMIO memory window for all
+ * VIA Technologies Chrome IGPs.
+ * Obtain the starting base address and size, and
+ * map it to the OS for use.
+ */
+ dev_priv->mmio_base = pci_resource_start(dev->pdev, 1);
+ dev_priv->mmio_size = pci_resource_len(dev->pdev, 1);
+ dev_priv->mmio = ioremap(dev_priv->mmio_base,
+ dev_priv->mmio_size);
+ if (!dev_priv->mmio) {
+ ret = -ENOMEM;
+ goto exit;
+ }
- /* Unlock Extended IO Space */
- iowrite8(0x10, regs + 0x04);
- iowrite8(0x01, regs + 0x05);
- /* Unlock CRTC register protect */
- iowrite8(0x47, regs + 0x14);
+ DRM_INFO("VIA Technologies Chrome IGP MMIO Physical Address: "
+ "0x%08llx\n",
+ dev_priv->mmio_base);
+exit:
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+ return ret;
+}
- /* Enable MMIO */
- iowrite8(0x1a, regs + 0x04);
- val = ioread8(regs + 0x05);
- iowrite8(val | 0x38, regs + 0x05);
+static void openchrome_mmio_fini(struct via_device *dev_priv)
+{
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ if (dev_priv->mmio) {
+ iounmap(dev_priv->mmio);
+ dev_priv->mmio = NULL;
+ }
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
+static void openchrome_graphics_unlock(struct via_device *dev_priv)
+{
+ uint8_t temp;
+
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ /*
+ * Enable VGA subsystem.
+ */
+ temp = vga_io_r(0x03C3);
+ vga_io_w(0x03C3, temp | 0x01);
+ svga_wmisc_mask(VGABASE, BIT(0), BIT(0));
+
+ /*
+ * Unlock VIA Technologies Chrome IGP extended
+ * registers.
+ */
+ svga_wseq_mask(VGABASE, 0x10, BIT(0), BIT(0));
+
+ /*
+ * Unlock VIA Technologies Chrome IGP extended
+ * graphics functionality.
+ */
+ svga_wseq_mask(VGABASE, 0x1a, BIT(3), BIT(3));
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -403,7 +447,13 @@ static int via_device_init(struct via_device *dev_priv)
goto exit;
}
- via_mmio_setup(dev_priv);
+ ret = openchrome_mmio_init(dev_priv);
+ if (ret) {
+ DRM_ERROR("Failed to initialize MMIO.\n");
+ goto exit;
+ }
+
+ openchrome_graphics_unlock(dev_priv);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
@@ -447,14 +497,10 @@ static void via_driver_unload(struct drm_device *dev)
ttm_bo_unref(&bo);
}
- bo = dev_priv->mmio.bo;
- if (bo) {
- via_bo_unpin(bo, &dev_priv->mmio);
- ttm_bo_unref(&bo);
- }
-
via_mm_fini(dev);
+ openchrome_mmio_fini(dev_priv);
+
#if IS_ENABLED(CONFIG_AGP)
if (dev->agp && dev->agp->acquired)
drm_agp_release(dev);
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 73e5e933fb76..429c44495efc 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -150,7 +150,6 @@ struct via_device {
int revision;
struct ttm_bo_kmap_obj dmabuf;
- struct ttm_bo_kmap_obj mmio;
struct ttm_bo_kmap_obj gart;
struct ttm_bo_kmap_obj vq;
@@ -160,6 +159,10 @@ struct via_device {
unsigned int vram_size;
int vram_mtrr;
+ unsigned long long mmio_base;
+ unsigned int mmio_size;
+ void __iomem *mmio;
+
struct via_state pm_cache;
enum via_engine engine_type;
@@ -291,7 +294,7 @@ struct via_device {
#define VIA_MEM_DDR3_1600 0x12
/* VIA MMIO register access */
-#define VIA_BASE ((dev_priv->mmio.virtual))
+#define VIA_BASE ((dev_priv->mmio))
#define VIA_READ(reg) ioread32(VIA_BASE + reg)
#define VIA_WRITE(reg, val) iowrite32(val, VIA_BASE + reg)
diff --git a/drivers/gpu/drm/openchrome/openchrome_h1_cmdbuf.c b/drivers/gpu/drm/openchrome/openchrome_h1_cmdbuf.c
index efec57522a5b..85a7a0ea77ae 100644
--- a/drivers/gpu/drm/openchrome/openchrome_h1_cmdbuf.c
+++ b/drivers/gpu/drm/openchrome/openchrome_h1_cmdbuf.c
@@ -176,7 +176,7 @@ static int via_initialize(struct drm_device *dev,
dev_priv->dma_offset = bo->offset;
dev_priv->last_pause_ptr = NULL;
dev_priv->hw_addr_ptr =
- (void *)(dev_priv->mmio.virtual + init->reg_pause_addr);
+ (void *)(dev_priv->mmio + init->reg_pause_addr);
via_cmdbuf_start(dev_priv);
out_err:
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 33f7754b9297..29ccfd9e1ff0 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -582,9 +582,6 @@ static struct ttm_bo_driver via_bo_driver = {
int via_mm_init(struct via_device *dev_priv)
{
struct drm_device *dev = dev_priv->dev;
- struct ttm_buffer_object *bo;
- unsigned long long start;
- int len;
int ret;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -623,35 +620,6 @@ int via_mm_init(struct via_device *dev_priv)
"address 0x%08llx.\n",
(unsigned long long) dev_priv->vram_size >> 20,
dev_priv->vram_start);
-
- start = (unsigned long long) pci_resource_start(dev->pdev, 1);
- len = pci_resource_len(dev->pdev, 1);
- ret = ttm_bo_init_mm(&dev_priv->ttm.bdev,
- TTM_PL_PRIV, len >> PAGE_SHIFT);
- if (ret) {
- DRM_ERROR("Failed to map MMIO: %d\n", ret);
- goto exit;
- }
-
- ret = via_bo_create(&dev_priv->ttm.bdev, &bo, VIA_MMIO_REGSIZE,
- ttm_bo_type_kernel, TTM_PL_FLAG_PRIV,
- 1, PAGE_SIZE, false, NULL, NULL);
- if (ret) {
- DRM_ERROR("Failed to create a buffer object "
- "for MMIO: %d\n", ret);
- goto exit;
- }
-
- ret = via_bo_pin(bo, &dev_priv->mmio);
- if (ret) {
- DRM_ERROR("Failed to map a buffer object for "
- "MMIO: %d\n", ret);
- ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_PRIV);
- goto exit;
- }
-
- DRM_INFO("Mapped MMIO at physical address 0x%08llx.\n",
- start);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
commit 07443cf35f9ba1c044548fbf6f2d3e878d9f70b4
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Thu Oct 11 20:24:37 2018 -0700
drm/openchrome: Add openchrome_flag_init
Initialize private data struct flag registers here.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index 28924204ffef..dabc0f6c064d 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -376,15 +376,26 @@ static int gem_dumb_destroy(struct drm_file *filp,
return ret;
}
+static void openchrome_flag_init(struct via_device *dev_priv)
+{
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ /*
+ * Special handling flags for a few special models.
+ */
+ dev_priv->is_via_nanobook = false;
+ dev_priv->is_quanta_il1 = false;
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
static int via_device_init(struct via_device *dev_priv)
{
int ret;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- /* Temporary implementation. */
- dev_priv->is_via_nanobook = false;
- dev_priv->is_quanta_il1 = false;
+ openchrome_flag_init(dev_priv);
ret = via_vram_init(dev_priv);
if (ret) {
commit c5408ffdbc1afaf4b3fa840ed43161cb136da730
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Thu Oct 11 20:21:14 2018 -0700
drm/openchrome: Change chip_revision_info input parameter
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index 2eb616c03ecb..28924204ffef 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -161,9 +161,9 @@ static void via_mmio_setup(struct via_device *dev_priv)
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void chip_revision_info(struct drm_device *dev)
+static void chip_revision_info(struct via_device *dev_priv)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct drm_device *dev = dev_priv->dev;
struct pci_bus *bus = NULL;
u16 device_id, subsystem_vendor_id, subsystem_device_id;
u8 tmp;
@@ -489,7 +489,7 @@ static int via_driver_load(struct drm_device *dev,
goto init_error;
}
- chip_revision_info(dev);
+ chip_revision_info(dev_priv);
#if IS_ENABLED(CONFIG_AGP)
if ((dev_priv->engine_type <= VIA_ENG_H2) ||
More information about the openchrome-devel
mailing list