35 { .
addr =
addr, .flags = 0, .len = 1, .buf = ® },
50 { .
addr =
addr, .flags = 0, .len = 1, .buf = ® },
51 { .
addr =
addr, .flags = 0, .len = 1, .buf = &val },
93 if (i2c && ver >= 0x30) {
94 u8 auxidx = nv_ro08(bios, i2c + 4);
96 index = (auxidx & 0x0f) >> 0;
98 index = (auxidx & 0xf0) >> 4;
105 if (port->
index == index)
109 if (&port->
head == &i2c->ports)
112 if (nv_device(i2c)->
card_type >= NV_50 && (port->
dcb & 0x00000100)) {
114 if (port->
type == 6) {
115 reg += port->
drive * 0x50;
118 reg += ((port->
dcb & 0x1e00) >> 9) * 0x50;
123 nv_mask(i2c, reg + 0x0c, 0x00000001, 0x00000000);
125 nv_mask(i2c, reg + 0x00, 0x0000f003,
val);
132 nouveau_i2c_identify(
struct nouveau_i2c *i2c,
int index,
const char *
what,
141 nv_debug(i2c,
"no bus when probing %s on %d\n", what, index);
145 nv_debug(i2c,
"probing %ss on bus: %d\n", what, port->
index);
146 for (i = 0; info[
i].
addr; i++) {
149 nv_info(i2c,
"detected %s: %s\n", what, info[i].
type);
154 nv_debug(i2c,
"no devices found.\n");
165 if (state) val |= 0x20;
170 nv_mask(port->
i2c, port->
drive, 0x2f, state ? 0x21 : 0x01);
173 if (state) port->
state |= 0x01;
174 else port->
state &= 0xfe;
186 if (state) val |= 0x10;
191 nv_mask(port->
i2c, port->
drive, 0x1f, state ? 0x11 : 0x01);
194 if (state) port->
state |= 0x02;
195 else port->
state &= 0xfd;
210 return !!(nv_rd32(port->
i2c, port->
sense) & 0x00040000);
214 return !!(nv_rd32(port->
i2c, port->
sense) & 0x01);
216 return !!(nv_rd32(port->
i2c, port->
sense) & 0x10);
232 return !!(nv_rd32(port->
i2c, port->
sense) & 0x00080000);
236 return !!(nv_rd32(port->
i2c, port->
sense) & 0x02);
238 return !!(nv_rd32(port->
i2c, port->
sense) & 0x20);
244 static const u32 nv50_i2c_port[] = {
245 0x00e138, 0x00e150, 0x00e168, 0x00e180,
246 0x00e254, 0x00e274, 0x00e764, 0x00e780,
264 *pobject = nv_object(i2c);
268 i2c->
find = nouveau_i2c_find;
269 i2c->
identify = nouveau_i2c_identify;
270 INIT_LIST_HEAD(&i2c->
ports);
278 nv_error(i2c,
"failed port memory alloc at %d\n", i);
283 switch (port->
type) {
285 port->
drive = info.drive;
286 port->
sense = info.sense;
289 port->
drive = 0x600800 + info.drive;
293 port->
drive = info.drive & 0x0f;
300 port->
drive = 0x00d014 + (port->
drive * 0x20);
305 port->
drive = info.drive & 0x0f;
314 nv_error(i2c,
"I2C%d: type %d index %x/%x unknown\n",
321 "nouveau-%s-%d", device->
name, i);
326 port->
dcb = info.data;
327 i2c_set_adapdata(&port->
adapter, i2c);
334 #ifdef CONFIG_NOUVEAU_I2C_INTERNAL_DEFAULT
343 port->
bit.udelay = 10;
358 nv_error(i2c,
"I2C%d: failed register: %d\n", i, ret);
402 .ctor = nouveau_i2c_ctor,
403 .dtor = nouveau_i2c_dtor,
404 .init = nouveau_i2c_init,
405 .fini = nouveau_i2c_fini,