All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@redhat.com, sam@ravnborg.org,
	emil.velikov@collabora.com, lyude@redhat.com, krzk@kernel.org,
	john.p.donnelly@Oracle.com, rong.a.chen@intel.com,
	kraxel@redhat.com, eich@suse.com, tiwai@suse.de
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH 4/8] drm/mgag200: Enable MGA mode during device register initialization
Date: Wed, 15 Jul 2020 16:58:58 +0200	[thread overview]
Message-ID: <20200715145902.13122-5-tzimmermann@suse.de> (raw)
In-Reply-To: <20200715145902.13122-1-tzimmermann@suse.de>

MGA cards can run in traditional VGA mode or an enhanced MGA mode; with
the latter being required for KMS. So far, MGA mode was enabled during
modesetting. As it's fundamental for device operation, the patch moves
it next to the device register setup.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/mgag200/mgag200_drv.c  | 5 +++++
 drivers/gpu/drm/mgag200/mgag200_mode.c | 6 +-----
 drivers/gpu/drm/mgag200/mgag200_reg.h  | 2 ++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 3dbb00045c24..ac9ac5b6d587 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -61,6 +61,7 @@ static int mgag200_regs_init(struct mga_device *mdev)
 {
 	struct drm_device *dev = &mdev->base;
 	u32 option, option2;
+	u8 crtcext3;
 
 	switch (mdev->type) {
 	case G200_SE_A:
@@ -107,6 +108,10 @@ static int mgag200_regs_init(struct mga_device *mdev)
 	if (mdev->rmmio == NULL)
 		return -ENOMEM;
 
+	RREG_ECRT(0x03, crtcext3);
+	crtcext3 |= MGAREG_CRTCEXT3_MGAMODE;
+	WREG_ECRT(0x03, crtcext3);
+
 	return 0;
 }
 
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index 3aa078e69a5a..7161b1651aa0 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -946,7 +946,7 @@ static void mgag200_set_dac_regs(struct mga_device *mdev)
 
 static void mgag200_init_regs(struct mga_device *mdev)
 {
-	u8 crtc11, crtcext3, crtcext4, misc;
+	u8 crtc11, crtcext4, misc;
 
 	mgag200_set_dac_regs(mdev);
 
@@ -961,12 +961,8 @@ static void mgag200_init_regs(struct mga_device *mdev)
 	WREG_CRT(14, 0);
 	WREG_CRT(15, 0);
 
-	RREG_ECRT(0x03, crtcext3);
-
-	crtcext3 |= BIT(7); /* enable MGA mode */
 	crtcext4 = 0x00;
 
-	WREG_ECRT(0x03, crtcext3);
 	WREG_ECRT(0x04, crtcext4);
 
 	RREG_CRT(0x11, crtc11);
diff --git a/drivers/gpu/drm/mgag200/mgag200_reg.h b/drivers/gpu/drm/mgag200/mgag200_reg.h
index a44c08bf4074..977be0565c06 100644
--- a/drivers/gpu/drm/mgag200/mgag200_reg.h
+++ b/drivers/gpu/drm/mgag200/mgag200_reg.h
@@ -256,6 +256,8 @@
 #define MGAREG_CRTCEXT1_VSYNCOFF	BIT(5)
 #define MGAREG_CRTCEXT1_HSYNCOFF	BIT(4)
 
+#define MGAREG_CRTCEXT3_MGAMODE		BIT(7)
+
 /* Cursor X and Y position */
 #define MGA_CURPOSXL 0x3c0c
 #define MGA_CURPOSXH 0x3c0d
-- 
2.27.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-07-15 14:59 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15 14:58 [PATCH 0/8] drm/mgag200: Support desktop chips Thomas Zimmermann
2020-07-15 14:58 ` [PATCH 1/8] drm/mgag200: Enable caching for SHMEM pages Thomas Zimmermann
2020-07-15 14:58 ` [PATCH 2/8] drm/mgag200: Move register initialization into helper function Thomas Zimmermann
2020-07-15 14:58 ` [PATCH 3/8] drm/mgag200: Initialize PCI registers early during device setup Thomas Zimmermann
2020-07-15 14:58 ` Thomas Zimmermann [this message]
2020-07-15 14:58 ` [PATCH 5/8] drm/mgag200: Set MISC memory flags in mm init code Thomas Zimmermann
2020-07-15 14:59 ` [PATCH 6/8] drm/mgag200: Clear <page> field during MM init Thomas Zimmermann
2020-07-15 14:59 ` [PATCH 7/8] drm/mgag200: Move G200SE's unique id into model-specific data Thomas Zimmermann
2020-07-15 14:59 ` [PATCH 8/8] drm/mgag200: Add support for G200 desktop cards Thomas Zimmermann
2020-07-15 23:33   ` kernel test robot
2020-07-16 22:43   ` Lyude Paul
2020-07-17  5:45     ` Sam Ravnborg
2020-07-20  7:04     ` Thomas Zimmermann
2020-07-20 19:18       ` Lyude Paul
2020-07-20 20:16         ` Sam Ravnborg
2020-07-21  7:19         ` Thomas Zimmermann
2020-07-15 19:56 ` [PATCH 0/8] drm/mgag200: Support desktop chips Dave Airlie
2020-07-15 20:48   ` Daniel Vetter
2020-07-16  5:44   ` Thomas Zimmermann
2020-07-16  5:55     ` Thomas Zimmermann
2020-07-16  8:22   ` Egbert Eich
2020-07-15 22:32 ` Lyude Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200715145902.13122-5-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eich@suse.com \
    --cc=emil.velikov@collabora.com \
    --cc=john.p.donnelly@Oracle.com \
    --cc=kraxel@redhat.com \
    --cc=krzk@kernel.org \
    --cc=lyude@redhat.com \
    --cc=rong.a.chen@intel.com \
    --cc=sam@ravnborg.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.