Lines Matching refs:index

40 int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data)
47 value, index, tmp, size, 500);
53 int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data)
60 value, index, tmp, size, 500);
63 int generic_ocp_read(struct r8152 *tp, u16 index, u16 size,
70 /* both size and index must be 4 bytes align */
71 if ((size & 3) || !size || (index & 3) || !data)
74 if (index + size > 0xffff)
79 ret = get_registers(tp, index, type, txsize, data);
83 index += txsize;
91 int generic_ocp_write(struct r8152 *tp, u16 index, u16 byteen,
99 /* both size and index must be 4 bytes align */
100 if ((size & 3) || !size || (index & 3) || !data)
103 if (index + size > 0xffff)
110 ret = set_registers(tp, index, type | byte_en_to_hw, 4, data);
114 index += 4;
124 ret = set_registers(tp, index,
130 index += txsize;
136 ret = set_registers(tp, index, type | byte_en_to_hw, 4, data);
144 int pla_ocp_read(struct r8152 *tp, u16 index, u16 size, void *data)
146 return generic_ocp_read(tp, index, size, data, MCU_TYPE_PLA);
149 int pla_ocp_write(struct r8152 *tp, u16 index, u16 byteen, u16 size, void *data)
151 return generic_ocp_write(tp, index, byteen, size, data, MCU_TYPE_PLA);
154 int usb_ocp_read(struct r8152 *tp, u16 index, u16 size, void *data)
156 return generic_ocp_read(tp, index, size, data, MCU_TYPE_USB);
159 int usb_ocp_write(struct r8152 *tp, u16 index, u16 byteen, u16 size, void *data)
161 return generic_ocp_write(tp, index, byteen, size, data, MCU_TYPE_USB);
164 u32 ocp_read_dword(struct r8152 *tp, u16 type, u16 index)
168 generic_ocp_read(tp, index, sizeof(data), &data, type);
173 void ocp_write_dword(struct r8152 *tp, u16 type, u16 index, u32 data)
177 generic_ocp_write(tp, index, BYTE_EN_DWORD, sizeof(tmp), &tmp, type);
180 u16 ocp_read_word(struct r8152 *tp, u16 type, u16 index)
184 u8 shift = index & 2;
186 index &= ~3;
188 generic_ocp_read(tp, index, sizeof(tmp), &tmp, type);
197 void ocp_write_word(struct r8152 *tp, u16 type, u16 index, u32 data)
202 u8 shift = index & 2;
206 if (index & 2) {
210 index &= ~3;
215 generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type);
218 u8 ocp_read_byte(struct r8152 *tp, u16 type, u16 index)
222 u8 shift = index & 3;
224 index &= ~3;
226 generic_ocp_read(tp, index, sizeof(tmp), &tmp, type);
235 void ocp_write_byte(struct r8152 *tp, u16 type, u16 index, u32 data)
240 u8 shift = index & 3;
244 if (index & 3) {
248 index &= ~3;
253 generic_ocp_write(tp, index, byen, sizeof(tmp), &tmp, type);
306 int r8152_wait_for_bit(struct r8152 *tp, bool ocp_reg, u16 type, u16 index,
313 val = ocp_reg_read(tp, index);
315 val = ocp_read_dword(tp, type, index);
326 debug("%s: Timeout (index=%04x mask=%08x timeout=%d)\n",
327 __func__, index, mask, timeout);