if_rk_dwc: Fix delays handling

The property are named {t,r}x_delay and not {t,r}-delay.
The upper bits of the register are a mask of which bits is allowed
to be written, set it otherwise we write nothing.
OF_getencprop returns <0 = for an error.

Pointy Hat: myself
Reported by:	jmcneill (delay and mask bits)
This commit is contained in:
manu 2018-06-20 14:45:26 +00:00
parent 8cdb928f9c
commit 31dbcedad5

View File

@ -70,16 +70,17 @@ rk3328_set_delays(struct syscon *grf, phandle_t node)
{
uint32_t tx, rx;
if (OF_getencprop(node, "tx-delay", &tx, sizeof(tx)) >= 0)
if (OF_getencprop(node, "tx_delay", &tx, sizeof(tx)) <= 0)
tx = 0x30;
if (OF_getencprop(node, "rx-delay", &rx, sizeof(rx)) >= 0)
if (OF_getencprop(node, "rx_delay", &rx, sizeof(rx)) <= 0)
rx = 0x10;
tx = ((tx & RK3328_GRF_MAC_CON0_TX_MASK) <<
RK3328_GRF_MAC_CON0_TX_SHIFT);
rx = ((rx & RK3328_GRF_MAC_CON0_TX_MASK) <<
RK3328_GRF_MAC_CON0_RX_SHIFT);
SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON0, tx | rx);
SYSCON_WRITE_4(grf, RK3328_GRF_MAC_CON0, tx | rx | 0xFFFF0000);
}
static int