Revert r261014. Let Kevin fix it.

MFC after:	1 week
This commit is contained in:
Hans Petter Selasky 2014-01-23 10:18:28 +00:00
parent dccae053f7
commit 2719d9c909
2 changed files with 17 additions and 26 deletions

View File

@ -1356,22 +1356,11 @@ run_efuse_read(struct run_softc *sc, uint16_t addr, uint16_t *val, int count)
uint16_t reg; uint16_t reg;
int error, ntries; int error, ntries;
switch (count) {
case 1:
*val = 0xff; /* address not found */
break;
case 2:
*val = 0xffff; /* address not found */
addr *= 2;
break;
default:
*val = 0xffff; /* address not found */
return (USB_ERR_INVAL);
}
if ((error = run_read(sc, RT3070_EFUSE_CTRL, &tmp)) != 0) if ((error = run_read(sc, RT3070_EFUSE_CTRL, &tmp)) != 0)
return (error); return (error);
if (count == 2)
addr *= 2;
/*- /*-
* Read one 16-byte block into registers EFUSE_DATA[0-3]: * Read one 16-byte block into registers EFUSE_DATA[0-3]:
* DATA0: F E D C * DATA0: F E D C
@ -1392,21 +1381,21 @@ run_efuse_read(struct run_softc *sc, uint16_t addr, uint16_t *val, int count)
if (ntries == 100) if (ntries == 100)
return (ETIMEDOUT); return (ETIMEDOUT);
if ((tmp & RT3070_EFUSE_AOUT_MASK) == RT3070_EFUSE_AOUT_MASK) if ((tmp & RT3070_EFUSE_AOUT_MASK) == RT3070_EFUSE_AOUT_MASK) {
*val = 0xffff; /* address not found */
return (0); return (0);
}
/* determine to which 32-bit register our 16-bit word belongs */ /* determine to which 32-bit register our 16-bit word belongs */
reg = RT3070_EFUSE_DATA3 - (addr & 0xc); reg = RT3070_EFUSE_DATA3 - (addr & 0xc);
if ((error = run_read(sc, reg, &tmp)) != 0) if ((error = run_read(sc, reg, &tmp)) != 0)
return (error); return (error);
/* get correct bytes */ if (count == 2)
*val = (uint16_t)(tmp >> (8 * (addr & 0x3))); *val = (addr & 2) ? tmp >> 16 : tmp & 0xffff;
else {
/* mask for byte read, if any */ tmp >>= (8 *(addr & 0x3));
if (count == 1) memmove(val, &tmp, sizeof(*val));
*val &= 0xff; }
return (0); return (0);
} }
@ -3095,8 +3084,9 @@ run_bulk_tx_callbackN(struct usb_xfer *xfer, usb_error_t error, u_int index)
m = data->m; m = data->m;
size = (sc->mac_ver == 0x5592) ? size = (sc->mac_ver == 0x5592) ?
sizeof(data->desc) + sizeof(uint32_t) : sizeof(data->desc); RUN_MAX_TXSZ + sizeof(uint32_t) : RUN_MAX_TXSZ;
if ((m->m_pkthdr.len + size + 3 + 8) > RUN_MAX_TXSZ) { if ((m->m_pkthdr.len +
sizeof(data->desc) + 3 + 8) > size) {
DPRINTF("data overflow, %u bytes\n", DPRINTF("data overflow, %u bytes\n",
m->m_pkthdr.len); m->m_pkthdr.len);
@ -3108,6 +3098,8 @@ run_bulk_tx_callbackN(struct usb_xfer *xfer, usb_error_t error, u_int index)
} }
pc = usbd_xfer_get_frame(xfer, 0); pc = usbd_xfer_get_frame(xfer, 0);
size = (sc->mac_ver == 0x5592) ?
sizeof(data->desc) + sizeof(uint32_t) : sizeof(data->desc);
usbd_copy_in(pc, 0, &data->desc, size); usbd_copy_in(pc, 0, &data->desc, size);
usbd_m_copy_in(pc, size, m, 0, m->m_pkthdr.len); usbd_m_copy_in(pc, size, m, 0, m->m_pkthdr.len);
size += m->m_pkthdr.len; size += m->m_pkthdr.len;

View File

@ -89,7 +89,6 @@ struct run_tx_data {
uint32_t align[0]; /* dummy field */ uint32_t align[0]; /* dummy field */
uint8_t desc[sizeof(struct rt2870_txd) + uint8_t desc[sizeof(struct rt2870_txd) +
sizeof(struct rt2860_txwi)]; sizeof(struct rt2860_txwi)];
uint8_t desc_extra[4]; /* used by v5592 */
uint8_t ridx; uint8_t ridx;
}; };
STAILQ_HEAD(run_tx_data_head, run_tx_data); STAILQ_HEAD(run_tx_data_head, run_tx_data);