aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/savage
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/savage')
-rw-r--r--drivers/video/savage/savagefb-i2c.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/video/savage/savagefb-i2c.c b/drivers/video/savage/savagefb-i2c.c
index 8db066ccca6b..35c1ce62b216 100644
--- a/drivers/video/savage/savagefb-i2c.c
+++ b/drivers/video/savage/savagefb-i2c.c
@@ -41,10 +41,6 @@
41#define SAVAGE4_I2C_SCL_IN 0x00000008 41#define SAVAGE4_I2C_SCL_IN 0x00000008
42#define SAVAGE4_I2C_SDA_IN 0x00000010 42#define SAVAGE4_I2C_SDA_IN 0x00000010
43 43
44#define SET_CR_IX(base, val) writeb((val), base + 0x8000 + VGA_CR_IX)
45#define SET_CR_DATA(base, val) writeb((val), base + 0x8000 + VGA_CR_DATA)
46#define GET_CR_DATA(base) readb(base + 0x8000 + VGA_CR_DATA)
47
48static void savage4_gpio_setscl(void *data, int val) 44static void savage4_gpio_setscl(void *data, int val)
49{ 45{
50 struct savagefb_i2c_chan *chan = data; 46 struct savagefb_i2c_chan *chan = data;
@@ -92,15 +88,15 @@ static void prosavage_gpio_setscl(void* data, int val)
92 struct savagefb_i2c_chan *chan = data; 88 struct savagefb_i2c_chan *chan = data;
93 u32 r; 89 u32 r;
94 90
95 SET_CR_IX(chan->ioaddr, chan->reg); 91 r = VGArCR(chan->reg, chan->par);
96 r = GET_CR_DATA(chan->ioaddr);
97 r |= PROSAVAGE_I2C_ENAB; 92 r |= PROSAVAGE_I2C_ENAB;
98 if (val) { 93 if (val) {
99 r |= PROSAVAGE_I2C_SCL_OUT; 94 r |= PROSAVAGE_I2C_SCL_OUT;
100 } else { 95 } else {
101 r &= ~PROSAVAGE_I2C_SCL_OUT; 96 r &= ~PROSAVAGE_I2C_SCL_OUT;
102 } 97 }
103 SET_CR_DATA(chan->ioaddr, r); 98
99 VGAwCR(chan->reg, r, chan->par);
104} 100}
105 101
106static void prosavage_gpio_setsda(void* data, int val) 102static void prosavage_gpio_setsda(void* data, int val)
@@ -108,31 +104,29 @@ static void prosavage_gpio_setsda(void* data, int val)
108 struct savagefb_i2c_chan *chan = data; 104 struct savagefb_i2c_chan *chan = data;
109 unsigned int r; 105 unsigned int r;
110 106
111 SET_CR_IX(chan->ioaddr, chan->reg); 107 r = VGArCR(chan->reg, chan->par);
112 r = GET_CR_DATA(chan->ioaddr);
113 r |= PROSAVAGE_I2C_ENAB; 108 r |= PROSAVAGE_I2C_ENAB;
114 if (val) { 109 if (val) {
115 r |= PROSAVAGE_I2C_SDA_OUT; 110 r |= PROSAVAGE_I2C_SDA_OUT;
116 } else { 111 } else {
117 r &= ~PROSAVAGE_I2C_SDA_OUT; 112 r &= ~PROSAVAGE_I2C_SDA_OUT;
118 } 113 }
119 SET_CR_DATA(chan->ioaddr, r); 114
115 VGAwCR(chan->reg, r, chan->par);
120} 116}
121 117
122static int prosavage_gpio_getscl(void* data) 118static int prosavage_gpio_getscl(void* data)
123{ 119{
124 struct savagefb_i2c_chan *chan = data; 120 struct savagefb_i2c_chan *chan = data;
125 121
126 SET_CR_IX(chan->ioaddr, chan->reg); 122 return (VGArCR(chan->reg, chan->par) & PROSAVAGE_I2C_SCL_IN) ? 1 : 0;
127 return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SCL_IN));
128} 123}
129 124
130static int prosavage_gpio_getsda(void* data) 125static int prosavage_gpio_getsda(void* data)
131{ 126{
132 struct savagefb_i2c_chan *chan = data; 127 struct savagefb_i2c_chan *chan = data;
133 128
134 SET_CR_IX(chan->ioaddr, chan->reg); 129 return (VGArCR(chan->reg, chan->par) & PROSAVAGE_I2C_SDA_IN) ? 1 : 0;
135 return (0 != (GET_CR_DATA(chan->ioaddr) & PROSAVAGE_I2C_SDA_IN));
136} 130}
137 131
138static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan, 132static int savage_setup_i2c_bus(struct savagefb_i2c_chan *chan,