aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/video/via/hw.h1
-rw-r--r--drivers/video/via/share.h11
-rw-r--r--drivers/video/via/via-core.h48
-rw-r--r--drivers/video/via/via_io.h67
-rw-r--r--drivers/video/via/via_modesetting.c2
-rw-r--r--drivers/video/via/via_utility.c1
-rw-r--r--drivers/video/via/viamode.c1
7 files changed, 53 insertions, 78 deletions
diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h
index a58701f3bf7f..a109de379816 100644
--- a/drivers/video/via/hw.h
+++ b/drivers/video/via/hw.h
@@ -24,7 +24,6 @@
24 24
25#include "viamode.h" 25#include "viamode.h"
26#include "global.h" 26#include "global.h"
27#include "via_io.h"
28#include "via_modesetting.h" 27#include "via_modesetting.h"
29 28
30#define viafb_read_reg(p, i) via_read_reg(p, i) 29#define viafb_read_reg(p, i) via_read_reg(p, i)
diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h
index 861b4142efad..7f0de7f006ad 100644
--- a/drivers/video/via/share.h
+++ b/drivers/video/via/share.h
@@ -43,14 +43,9 @@
43/* Video Memory Size */ 43/* Video Memory Size */
44#define VIDEO_MEMORY_SIZE_16M 0x1000000 44#define VIDEO_MEMORY_SIZE_16M 0x1000000
45 45
46/* standard VGA IO port 46/*
47*/ 47 * Lengths of the VPIT structure arrays.
48#define VIAStatus 0x3DA 48 */
49#define VIACR 0x3D4
50#define VIASR 0x3C4
51#define VIAGR 0x3CE
52#define VIAAR 0x3C0
53
54#define StdCR 0x19 49#define StdCR 0x19
55#define StdSR 0x04 50#define StdSR 0x04
56#define StdGR 0x09 51#define StdGR 0x09
diff --git a/drivers/video/via/via-core.h b/drivers/video/via/via-core.h
index 087c562abaec..7ffb521e1a7a 100644
--- a/drivers/video/via/via-core.h
+++ b/drivers/video/via/via-core.h
@@ -1,7 +1,8 @@
1/* 1/*
2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved. 2 * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. 3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4 * Copyright 2009 Jonathan Corbet <corbet@lwn.net> 4 * Copyright 2009-2010 Jonathan Corbet <corbet@lwn.net>
5 * Copyright 2010 Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
5 * 6 *
6 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public 8 * modify it under the terms of the GNU General Public
@@ -22,6 +23,8 @@
22 23
23#ifndef __VIA_CORE_H__ 24#ifndef __VIA_CORE_H__
24#define __VIA_CORE_H__ 25#define __VIA_CORE_H__
26#include <linux/types.h>
27#include <linux/io.h>
25#include <linux/spinlock.h> 28#include <linux/spinlock.h>
26#include <linux/pci.h> 29#include <linux/pci.h>
27 30
@@ -170,4 +173,47 @@ int viafb_dma_copy_out_sg(unsigned int offset, struct scatterlist *sg, int nsg);
170#define VGA_WIDTH 640 173#define VGA_WIDTH 640
171#define VGA_HEIGHT 480 174#define VGA_HEIGHT 480
172 175
176/*
177 * Indexed port operations. Note that these are all multi-op
178 * functions; every invocation will be racy if you're not holding
179 * reg_lock.
180 */
181
182#define VIAStatus 0x3DA /* Non-indexed port */
183#define VIACR 0x3D4
184#define VIASR 0x3C4
185#define VIAGR 0x3CE
186#define VIAAR 0x3C0
187
188static inline u8 via_read_reg(u16 port, u8 index)
189{
190 outb(index, port);
191 return inb(port + 1);
192}
193
194static inline void via_write_reg(u16 port, u8 index, u8 data)
195{
196 outb(index, port);
197 outb(data, port + 1);
198}
199
200static inline void via_write_reg_mask(u16 port, u8 index, u8 data, u8 mask)
201{
202 u8 old;
203
204 outb(index, port);
205 old = inb(port + 1);
206 outb((data & mask) | (old & ~mask), port + 1);
207}
208
209#define VIA_MISC_REG_READ 0x03CC
210#define VIA_MISC_REG_WRITE 0x03C2
211
212static inline void via_write_misc_reg_mask(u8 data, u8 mask)
213{
214 u8 old = inb(VIA_MISC_REG_READ);
215 outb((data & mask) | (old & ~mask), VIA_MISC_REG_WRITE);
216}
217
218
173#endif /* __VIA_CORE_H__ */ 219#endif /* __VIA_CORE_H__ */
diff --git a/drivers/video/via/via_io.h b/drivers/video/via/via_io.h
deleted file mode 100644
index a3d2aca65540..000000000000
--- a/drivers/video/via/via_io.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved.
4 * Copyright 2010 Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation;
9 * either version 2, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTIES OR REPRESENTATIONS; without even
13 * the implied warranty of MERCHANTABILITY or FITNESS FOR
14 * A PARTICULAR PURPOSE.See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22/*
23 * basic io functions
24 */
25
26#ifndef __VIA_IO_H__
27#define __VIA_IO_H__
28
29#include <linux/types.h>
30#include <linux/io.h>
31
32#define VIA_MISC_REG_READ 0x03CC
33#define VIA_MISC_REG_WRITE 0x03C2
34
35/*
36 * Indexed port operations. Note that these are all multi-op
37 * functions; every invocation will be racy if you're not holding
38 * reg_lock.
39 */
40static inline u8 via_read_reg(u16 port, u8 index)
41{
42 outb(index, port);
43 return inb(port + 1);
44}
45
46static inline void via_write_reg(u16 port, u8 index, u8 data)
47{
48 outb(index, port);
49 outb(data, port + 1);
50}
51
52static inline void via_write_reg_mask(u16 port, u8 index, u8 data, u8 mask)
53{
54 u8 old;
55
56 outb(index, port);
57 old = inb(port + 1);
58 outb((data & mask) | (old & ~mask), port + 1);
59}
60
61static inline void via_write_misc_reg_mask(u8 data, u8 mask)
62{
63 u8 old = inb(VIA_MISC_REG_READ);
64 outb((data & mask) | (old & ~mask), VIA_MISC_REG_WRITE);
65}
66
67#endif /* __VIA_IO_H__ */
diff --git a/drivers/video/via/via_modesetting.c b/drivers/video/via/via_modesetting.c
index 69ff28575008..b4e735cc350e 100644
--- a/drivers/video/via/via_modesetting.c
+++ b/drivers/video/via/via_modesetting.c
@@ -25,7 +25,7 @@
25 25
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include "via_modesetting.h" 27#include "via_modesetting.h"
28#include "via_io.h" 28#include "via-core.h"
29#include "share.h" 29#include "share.h"
30#include "debug.h" 30#include "debug.h"
31 31
diff --git a/drivers/video/via/via_utility.c b/drivers/video/via/via_utility.c
index aefdeeec89b1..575703141868 100644
--- a/drivers/video/via/via_utility.c
+++ b/drivers/video/via/via_utility.c
@@ -19,6 +19,7 @@
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */ 20 */
21 21
22#include "via-core.h"
22#include "global.h" 23#include "global.h"
23 24
24void viafb_get_device_support_state(u32 *support_state) 25void viafb_get_device_support_state(u32 *support_state)
diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c
index 6f3bcda8cb47..2fdb9e6724a4 100644
--- a/drivers/video/via/viamode.c
+++ b/drivers/video/via/viamode.c
@@ -19,6 +19,7 @@
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */ 20 */
21 21
22#include "via-core.h"
22#include "global.h" 23#include "global.h"
23struct res_map_refresh res_map_refresh_tbl[] = { 24struct res_map_refresh res_map_refresh_tbl[] = {
24/*hres, vres, vclock, vmode_refresh*/ 25/*hres, vres, vclock, vmode_refresh*/