static int
anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh)
{
+ struct nvkm_i2c *i2c = nvkm_i2c(port);
+ struct nvkm_subdev *subdev = &i2c->subdev;
struct anx9805_i2c_port *chan = (void *)port;
struct nvkm_i2c_port *mast = (void *)nv_object(chan)->parent;
u8 tmp, i;
- DBG("ANX9805 train %d 0x%02x %d\n", link_nr, link_bw, enh);
+ DBG("ANX9805 train %d %02x %d\n", link_nr, link_bw, enh);
nv_wri2cr(mast, chan->addr, 0xa0, link_bw);
nv_wri2cr(mast, chan->addr, 0xa1, link_nr | (enh ? 0x80 : 0x00));
while ((tmp = nv_rdi2cr(mast, chan->addr, 0xa8)) & 0x01) {
mdelay(5);
if (i++ == 100) {
- nv_error(port, "link training timed out\n");
+ nvkm_error(subdev, "link training timed out\n");
return -ETIMEDOUT;
}
}
if (tmp & 0x70) {
- nv_error(port, "link training failed: 0x%02x\n", tmp);
+ nvkm_error(subdev, "link training failed: %02x\n", tmp);
return -EIO;
}
bool (*match)(struct nvkm_i2c_port *,
struct i2c_board_info *, void *), void *data)
{
+ struct nvkm_subdev *subdev = &i2c->subdev;
struct nvkm_i2c_port *port = nvkm_i2c_find(i2c, index);
int i;
if (!port) {
- nv_debug(i2c, "no bus when probing %s on %d\n", what, index);
+ nvkm_debug(subdev, "no bus when probing %s on %d\n",
+ what, index);
return -ENODEV;
}
- nv_debug(i2c, "probing %ss on bus: %d\n", what, port->index);
+ nvkm_debug(subdev, "probing %ss on bus: %d\n", what, port->index);
for (i = 0; info[i].dev.addr; i++) {
u8 orig_udelay = 0;
if ((port->adapter.algo == &i2c_bit_algo) &&
(info[i].udelay != 0)) {
struct i2c_algo_bit_data *algo = port->adapter.algo_data;
- nv_debug(i2c, "using custom udelay %d instead of %d\n",
- info[i].udelay, algo->udelay);
+ nvkm_debug(subdev,
+ "using custom udelay %d instead of %d\n",
+ info[i].udelay, algo->udelay);
orig_udelay = algo->udelay;
algo->udelay = info[i].udelay;
}
if (nv_probe_i2c(port, info[i].dev.addr) &&
(!match || match(port, &info[i].dev, data))) {
- nv_info(i2c, "detected %s: %s\n", what,
- info[i].dev.type);
+ nvkm_info(subdev, "detected %s: %s\n", what,
+ info[i].dev.type);
return i;
}
}
}
- nv_debug(i2c, "no devices found.\n");
+ nvkm_debug(subdev, "no devices found.\n");
return -ENODEV;
}
nvkm_wr32(device, 0x00e068, temp);
}
-#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args)
-#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_DBG(fmt, args...) \
+ nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_ERR(fmt, args...) \
+ nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
static void
auxch_fini(struct nvkm_i2c *i2c, int ch)
ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("begin idle timeout 0x%08x\n", ctrl);
+ AUX_ERR("begin idle timeout %08x\n", ctrl);
return -EBUSY;
}
} while (ctrl & 0x03010000);
ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("magic wait 0x%08x\n", ctrl);
+ AUX_ERR("magic wait %08x\n", ctrl);
auxch_fini(i2c, ch);
return -EBUSY;
}
int ch = port->addr;
int ret, i;
- AUX_DBG("%d: 0x%08x %d\n", type, addr, size);
+ AUX_DBG("%d: %08x %d\n", type, addr, size);
ret = auxch_init(i2c, ch);
if (ret < 0)
if (!(type & 1)) {
memcpy(xbuf, data, size);
for (i = 0; i < 16; i += 4) {
- AUX_DBG("wr 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("wr %08x\n", xbuf[i / 4]);
nvkm_wr32(device, 0x00e4c0 + (ch * 0x50) + i, xbuf[i / 4]);
}
}
ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("tx req timeout 0x%08x\n", ctrl);
+ AUX_ERR("tx req timeout %08x\n", ctrl);
ret = -EIO;
goto out;
}
if ((stat & 0x00000e00))
ret = -EIO;
- AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat);
+ AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
}
if (type & 1) {
for (i = 0; i < 16; i += 4) {
xbuf[i / 4] = nvkm_rd32(device, 0x00e4d0 + (ch * 0x50) + i);
- AUX_DBG("rd 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("rd %08x\n", xbuf[i / 4]);
}
memcpy(data, xbuf, size);
}
*/
#include "nv50.h"
-#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args)
-#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_DBG(fmt, args...) \
+ nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_ERR(fmt, args...) \
+ nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
static void
auxch_fini(struct nvkm_i2c *i2c, int ch)
ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("begin idle timeout 0x%08x\n", ctrl);
+ AUX_ERR("begin idle timeout %08x\n", ctrl);
return -EBUSY;
}
} while (ctrl & 0x03010000);
ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("magic wait 0x%08x\n", ctrl);
+ AUX_ERR("magic wait %08x\n", ctrl);
auxch_fini(i2c, ch);
return -EBUSY;
}
int ch = port->addr;
int ret, i;
- AUX_DBG("%d: 0x%08x %d\n", type, addr, size);
+ AUX_DBG("%d: %08x %d\n", type, addr, size);
ret = auxch_init(i2c, ch);
if (ret < 0)
if (!(type & 1)) {
memcpy(xbuf, data, size);
for (i = 0; i < 16; i += 4) {
- AUX_DBG("wr 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("wr %08x\n", xbuf[i / 4]);
nvkm_wr32(device, 0x00d930 + (ch * 0x50) + i, xbuf[i / 4]);
}
}
ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("tx req timeout 0x%08x\n", ctrl);
+ AUX_ERR("tx req timeout %08x\n", ctrl);
ret = -EIO;
goto out;
}
if ((stat & 0x00000e00))
ret = -EIO;
- AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat);
+ AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
}
if (type & 1) {
for (i = 0; i < 16; i += 4) {
xbuf[i / 4] = nvkm_rd32(device, 0x00d940 + (ch * 0x50) + i);
- AUX_DBG("rd 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("rd %08x\n", xbuf[i / 4]);
}
memcpy(data, xbuf, size);
}
#ifndef MSG
#define MSG(l,f,a...) do { \
struct nvkm_i2c_pad *_pad = (void *)pad; \
- nv_##l(_pad, "PAD:%c:%02x: "f, \
- _pad->index >= 0x100 ? 'X' : 'S', \
- _pad->index >= 0x100 ? _pad->index - 0x100 : _pad->index, ##a); \
+ struct nvkm_i2c *_i2c = nvkm_i2c(_pad); \
+ nvkm_##l(&_i2c->subdev, "PAD:%c:%02x: "f, \
+ _pad->index >= 0x100 ? 'X' : 'S', \
+ _pad->index >= 0x100 ? \
+ _pad->index - 0x100 : _pad->index, ##a); \
} while(0)
#define DBG(f,a...) MSG(debug, f, ##a)
#define ERR(f,a...) MSG(error, f, ##a)
#ifndef MSG
#define MSG(l,f,a...) do { \
- struct nvkm_i2c_port *_port = (void *)port; \
- nv_##l(_port, "PORT:%02x: "f, _port->index, ##a); \
+ struct nvkm_i2c_port *_port = (void *)port; \
+ struct nvkm_i2c *_i2c = nvkm_i2c(_port); \
+ nvkm_##l(&_i2c->subdev, "PORT:%02x: "f, _port->index, ##a); \
} while(0)
#define DBG(f,a...) MSG(debug, f, ##a)
#define ERR(f,a...) MSG(error, f, ##a)