30 #define AUX_DBG(fmt, args...) nv_debug(aux, "AUXCH(%d): " fmt, ch, ##args)
31 #define AUX_ERR(fmt, args...) nv_error(aux, "AUXCH(%d): " fmt, ch, ##args)
36 nv_mask(aux, 0x00e4e4 + (ch * 0x50), 0x00310000, 0x00000000);
43 const u32 ureq = unksel ? 0x00100000 : 0x00200000;
44 const u32 urep = unksel ? 0x01000000 : 0x02000000;
50 ctrl = nv_rd32(aux, 0x00e4e4 + (ch * 0x50));
53 AUX_ERR(
"begin idle timeout 0x%08x", ctrl);
56 }
while (ctrl & 0x03010000);
59 nv_mask(aux, 0x00e4e4 + (ch * 0x50), 0x00300000, ureq);
62 ctrl = nv_rd32(aux, 0x00e4e4 + (ch * 0x50));
65 AUX_ERR(
"magic wait 0x%08x\n", ctrl);
69 }
while ((ctrl & 0x03000000) != urep);
81 AUX_DBG(
"%d: 0x%08x %d\n", type, addr, size);
83 ret = auxch_init(aux, ch);
87 stat = nv_rd32(aux, 0x00e4e8 + (ch * 0x50));
88 if (!(stat & 0x10000000)) {
96 for (i = 0; i < 16; i += 4) {
97 AUX_DBG(
"wr 0x%08x\n", xbuf[i / 4]);
98 nv_wr32(aux, 0x00e4c0 + (ch * 0x50) + i, xbuf[i / 4]);
102 ctrl = nv_rd32(aux, 0x00e4e4 + (ch * 0x50));
106 nv_wr32(aux, 0x00e4e0 + (ch * 0x50), addr);
110 for (retries = 0; retries < 32; retries++) {
112 nv_wr32(aux, 0x00e4e4 + (ch * 0x50), 0x80000000 | ctrl);
113 nv_wr32(aux, 0x00e4e4 + (ch * 0x50), 0x00000000 | ctrl);
118 nv_wr32(aux, 0x00e4e4 + (ch * 0x50), 0x00010000 | ctrl);
122 ctrl = nv_rd32(aux, 0x00e4e4 + (ch * 0x50));
125 AUX_ERR(
"tx req timeout 0x%08x\n", ctrl);
128 }
while (ctrl & 0x00010000);
131 stat = nv_mask(aux, 0x00e4e8 + (ch * 0x50), 0, 0);
132 if (!(stat & 0x000f0f00)) {
137 AUX_DBG(
"%02d 0x%08x 0x%08x\n", retries, ctrl, stat);
141 for (i = 0; i < 16; i += 4) {
142 xbuf[i / 4] = nv_rd32(aux, 0x00e4d0 + (ch * 0x50) + i);
143 AUX_DBG(
"rd 0x%08x\n", xbuf[i / 4]);
156 return auxch_tx(auxch->
i2c, auxch->
drive, 9, addr, data, size);
162 return auxch_tx(auxch->
i2c, auxch->
drive, 8, addr, data, size);
173 u8 remaining = msg->
len;
177 u8 cnt = (remaining > 16) ? 16 : remaining;
185 if (mcnt || remaining > 16)
188 ret = auxch_tx(auxch->
i2c, auxch->
drive, cmd,
189 msg->
addr, ptr, cnt);
210 .master_xfer = aux_xfer,
211 .functionality = aux_func