Skip to content

Commit f845a02

Browse files
ParthibanI17164kuba-moo
authored andcommitted
net: ethernet: oa_tc6: enable open alliance tc6 data communication
Enabling Configuration Synchronization bit (SYNC) in the Configuration Register #0 enables data communication in the MAC-PHY. The state of this bit is reflected in the data footer SYNC bit. Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Parthiban Veerasooran <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 18a9187 commit f845a02

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

drivers/net/ethernet/oa_tc6.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
#define OA_TC6_REG_RESET 0x0003
2121
#define RESET_SWRESET BIT(0) /* Software Reset */
2222

23+
/* Configuration Register #0 */
24+
#define OA_TC6_REG_CONFIG0 0x0004
25+
#define CONFIG0_SYNC BIT(15)
26+
2327
/* Status Register #0 */
2428
#define OA_TC6_REG_STATUS0 0x0008
2529
#define STATUS0_RESETC BIT(6) /* Reset Complete */
@@ -559,6 +563,21 @@ static int oa_tc6_unmask_macphy_error_interrupts(struct oa_tc6 *tc6)
559563
return oa_tc6_write_register(tc6, OA_TC6_REG_INT_MASK0, regval);
560564
}
561565

566+
static int oa_tc6_enable_data_transfer(struct oa_tc6 *tc6)
567+
{
568+
u32 value;
569+
int ret;
570+
571+
ret = oa_tc6_read_register(tc6, OA_TC6_REG_CONFIG0, &value);
572+
if (ret)
573+
return ret;
574+
575+
/* Enable configuration synchronization for data transfer */
576+
value |= CONFIG0_SYNC;
577+
578+
return oa_tc6_write_register(tc6, OA_TC6_REG_CONFIG0, value);
579+
}
580+
562581
/**
563582
* oa_tc6_init - allocates and initializes oa_tc6 structure.
564583
* @spi: device with which data will be exchanged.
@@ -618,7 +637,18 @@ struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
618637
return NULL;
619638
}
620639

640+
ret = oa_tc6_enable_data_transfer(tc6);
641+
if (ret) {
642+
dev_err(&tc6->spi->dev, "Failed to enable data transfer: %d\n",
643+
ret);
644+
goto phy_exit;
645+
}
646+
621647
return tc6;
648+
649+
phy_exit:
650+
oa_tc6_phy_exit(tc6);
651+
return NULL;
622652
}
623653
EXPORT_SYMBOL_GPL(oa_tc6_init);
624654

0 commit comments

Comments
 (0)