mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-25 00:21:33 +00:00
tsec: General cleanup
- Cleanup formatting of phy_info structures - Fix lines > 80 chars - Fix some random indentation inconsistencies Signed-off-by: Peter Tyser <ptyser@xes-inc.com> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
parent
e1957ef02c
commit
c6dbdfda53
1 changed files with 324 additions and 343 deletions
|
@ -236,7 +236,8 @@ static void tsec_local_mdio_write(volatile tsec_mdio_t *phyregs, uint addr,
|
|||
|
||||
|
||||
/* Provide the default behavior of writing the PHY of this ethernet device */
|
||||
#define write_phy_reg(priv, regnum, value) tsec_local_mdio_write(priv->phyregs,priv->phyaddr,regnum,value)
|
||||
#define write_phy_reg(priv, regnum, value) \
|
||||
tsec_local_mdio_write(priv->phyregs,priv->phyaddr,regnum,value)
|
||||
|
||||
/* Reads register regnum on the device's PHY through the
|
||||
* specified registers. It lowers and raises the read
|
||||
|
@ -271,7 +272,8 @@ static uint tsec_local_mdio_read(volatile tsec_mdio_t *phyregs,
|
|||
}
|
||||
|
||||
/* #define to provide old read_phy_reg functionality without duplicating code */
|
||||
#define read_phy_reg(priv,regnum) tsec_local_mdio_read(priv->phyregs,priv->phyaddr,regnum)
|
||||
#define read_phy_reg(priv,regnum) \
|
||||
tsec_local_mdio_read(priv->phyregs,priv->phyaddr,regnum)
|
||||
|
||||
#define TBIANA_SETTINGS ( \
|
||||
TBIANA_ASYMMETRIC_PAUSE \
|
||||
|
@ -289,8 +291,8 @@ static uint tsec_local_mdio_read(volatile tsec_mdio_t *phyregs,
|
|||
/* Configure the TBI for SGMII operation */
|
||||
static void tsec_configure_serdes(struct tsec_private *priv)
|
||||
{
|
||||
/* Access TBI PHY registers at given TSEC register offset as opposed to the
|
||||
* register offset used for external PHY accesses */
|
||||
/* Access TBI PHY registers at given TSEC register offset as opposed
|
||||
* to the register offset used for external PHY accesses */
|
||||
tsec_local_mdio_write(priv->phyregs_sgmii, priv->regs->tbipa, TBI_ANA,
|
||||
TBIANA_SETTINGS);
|
||||
tsec_local_mdio_write(priv->phyregs_sgmii, priv->regs->tbipa, TBI_TBICON,
|
||||
|
@ -1014,8 +1016,7 @@ static struct phy_info phy_info_M88E1149S = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read,
|
||||
&mii_parse_88E1011_psr},
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read, &mii_parse_88E1011_psr},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1130,8 +1131,7 @@ static struct phy_info phy_info_M88E1011S = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read,
|
||||
&mii_parse_88E1011_psr},
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read, &mii_parse_88E1011_psr},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1160,8 +1160,7 @@ static struct phy_info phy_info_M88E1111S = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read,
|
||||
&mii_parse_88E1011_psr},
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read, &mii_parse_88E1011_psr},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1234,8 +1233,7 @@ static struct phy_info phy_info_M88E1121R = {
|
|||
{MIIM_GBIT_CONTROL, MIIM_GBIT_CONTROL_INIT, NULL},
|
||||
{MIIM_ANAR, MIIM_ANAR_INIT, NULL},
|
||||
/* Configure leds */
|
||||
{MIIM_88E1121_PHY_LED_CTRL, miim_read,
|
||||
&mii_88E1121_set_led},
|
||||
{MIIM_88E1121_PHY_LED_CTRL, miim_read, &mii_88E1121_set_led},
|
||||
{MIIM_CONTROL, MIIM_CONTROL_INIT, &mii_cr_init},
|
||||
/* Disable IRQs and de-assert interrupt */
|
||||
{MIIM_88E1121_PHY_IRQ_EN, 0, NULL},
|
||||
|
@ -1283,8 +1281,7 @@ static struct phy_info phy_info_M88E1145 = {
|
|||
/* Configure the PHY */
|
||||
{MIIM_GBIT_CONTROL, MIIM_GBIT_CONTROL_INIT, NULL},
|
||||
{MIIM_ANAR, MIIM_ANAR_INIT, NULL},
|
||||
{MIIM_88E1011_PHY_SCR, MIIM_88E1011_PHY_MDI_X_AUTO,
|
||||
NULL},
|
||||
{MIIM_88E1011_PHY_SCR, MIIM_88E1011_PHY_MDI_X_AUTO, NULL},
|
||||
{MIIM_88E1145_PHY_EXT_CR, 0, &m88e1145_setmode},
|
||||
{MIIM_CONTROL, MIIM_CONTROL_RESET, NULL},
|
||||
{MIIM_CONTROL, MIIM_CONTROL_INIT, NULL},
|
||||
|
@ -1295,11 +1292,9 @@ static struct phy_info phy_info_M88E1145 = {
|
|||
{MIIM_STATUS, miim_read, NULL},
|
||||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
{MIIM_88E1111_PHY_LED_CONTROL,
|
||||
MIIM_88E1111_PHY_LED_DIRECT, NULL},
|
||||
{MIIM_88E1111_PHY_LED_CONTROL, MIIM_88E1111_PHY_LED_DIRECT, NULL},
|
||||
/* Read the Status */
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read,
|
||||
&mii_parse_88E1011_psr},
|
||||
{MIIM_88E1011_PHY_STATUS, miim_read, &mii_parse_88E1011_psr},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1313,8 +1308,7 @@ static struct phy_info phy_info_cis8204 = {
|
|||
6,
|
||||
(struct phy_cmd[]) { /* config */
|
||||
/* Override PHY config settings */
|
||||
{MIIM_CIS8201_AUX_CONSTAT,
|
||||
MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
|
||||
{MIIM_CIS8201_AUX_CONSTAT, MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
|
||||
/* Configure some basic stuff */
|
||||
{MIIM_CONTROL, MIIM_CONTROL_INIT, &mii_cr_init},
|
||||
{MIIM_CIS8204_SLED_CON, MIIM_CIS8204_SLEDCON_INIT,
|
||||
|
@ -1329,8 +1323,7 @@ static struct phy_info phy_info_cis8204 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_CIS8201_AUX_CONSTAT, miim_read,
|
||||
&mii_parse_cis8201},
|
||||
{MIIM_CIS8201_AUX_CONSTAT, miim_read, &mii_parse_cis8201},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1345,11 +1338,9 @@ static struct phy_info phy_info_cis8201 = {
|
|||
4,
|
||||
(struct phy_cmd[]) { /* config */
|
||||
/* Override PHY config settings */
|
||||
{MIIM_CIS8201_AUX_CONSTAT,
|
||||
MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
|
||||
{MIIM_CIS8201_AUX_CONSTAT, MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
|
||||
/* Set up the interface mode */
|
||||
{MIIM_CIS8201_EXT_CON1, MIIM_CIS8201_EXTCON1_INIT,
|
||||
NULL},
|
||||
{MIIM_CIS8201_EXT_CON1, MIIM_CIS8201_EXTCON1_INIT, NULL},
|
||||
/* Configure some basic stuff */
|
||||
{MIIM_CONTROL, MIIM_CONTROL_INIT, &mii_cr_init},
|
||||
{miim_end,}
|
||||
|
@ -1360,8 +1351,7 @@ static struct phy_info phy_info_cis8201 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_CIS8201_AUX_CONSTAT, miim_read,
|
||||
&mii_parse_cis8201},
|
||||
{MIIM_CIS8201_AUX_CONSTAT, miim_read, &mii_parse_cis8201},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1375,11 +1365,9 @@ static struct phy_info phy_info_VSC8211 = {
|
|||
4,
|
||||
(struct phy_cmd[]) { /* config */
|
||||
/* Override PHY config settings */
|
||||
{MIIM_CIS8201_AUX_CONSTAT,
|
||||
MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
|
||||
{MIIM_CIS8201_AUX_CONSTAT, MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
|
||||
/* Set up the interface mode */
|
||||
{MIIM_CIS8201_EXT_CON1,
|
||||
MIIM_CIS8201_EXTCON1_INIT, NULL},
|
||||
{MIIM_CIS8201_EXT_CON1, MIIM_CIS8201_EXTCON1_INIT, NULL},
|
||||
/* Configure some basic stuff */
|
||||
{MIIM_CONTROL, MIIM_CONTROL_INIT, &mii_cr_init},
|
||||
{miim_end,}
|
||||
|
@ -1390,8 +1378,7 @@ static struct phy_info phy_info_VSC8211 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_CIS8201_AUX_CONSTAT, miim_read,
|
||||
&mii_parse_cis8201},
|
||||
{MIIM_CIS8201_AUX_CONSTAT, miim_read, &mii_parse_cis8201},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1415,8 +1402,7 @@ static struct phy_info phy_info_VSC8244 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read,
|
||||
&mii_parse_vsc8244},
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read, &mii_parse_vsc8244},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1439,8 +1425,7 @@ static struct phy_info phy_info_VSC8641 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read,
|
||||
&mii_parse_vsc8244},
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read, &mii_parse_vsc8244},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1463,8 +1448,7 @@ static struct phy_info phy_info_VSC8221 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read,
|
||||
&mii_parse_vsc8244},
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read, &mii_parse_vsc8244},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1484,7 +1468,8 @@ static struct phy_info phy_info_VSC8601 = {
|
|||
{MIIM_VSC8601_EPHY_CON,MIIM_VSC8601_EPHY_CON_INIT_SKEW,NULL},
|
||||
#if defined(CONFIG_SYS_VSC8601_SKEW_TX) && defined(CONFIG_SYS_VSC8601_SKEW_RX)
|
||||
{MIIM_EXT_PAGE_ACCESS,1,NULL},
|
||||
#define VSC8101_SKEW (CONFIG_SYS_VSC8601_SKEW_TX<<14)|(CONFIG_SYS_VSC8601_SKEW_RX<<12)
|
||||
#define VSC8101_SKEW \
|
||||
(CONFIG_SYS_VSC8601_SKEW_TX << 14) | (CONFIG_SYS_VSC8601_SKEW_RX << 12)
|
||||
{MIIM_VSC8601_SKEW_CTRL,VSC8101_SKEW,NULL},
|
||||
{MIIM_EXT_PAGE_ACCESS,0,NULL},
|
||||
#endif
|
||||
|
@ -1499,8 +1484,7 @@ static struct phy_info phy_info_VSC8601 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read,
|
||||
&mii_parse_vsc8244},
|
||||
{MIIM_VSC8244_AUX_CONSTAT, miim_read, &mii_parse_vsc8244},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1508,7 +1492,6 @@ static struct phy_info phy_info_VSC8601 = {
|
|||
},
|
||||
};
|
||||
|
||||
|
||||
static struct phy_info phy_info_dm9161 = {
|
||||
0x0181b88,
|
||||
"Davicom DM9161E",
|
||||
|
@ -1518,8 +1501,7 @@ static struct phy_info phy_info_dm9161 = {
|
|||
/* Do not bypass the scrambler/descrambler */
|
||||
{MIIM_DM9161_SCR, MIIM_DM9161_SCR_INIT, NULL},
|
||||
/* Clear 10BTCSR to default */
|
||||
{MIIM_DM9161_10BTCSR, MIIM_DM9161_10BTCSR_INIT,
|
||||
NULL},
|
||||
{MIIM_DM9161_10BTCSR, MIIM_DM9161_10BTCSR_INIT, NULL},
|
||||
/* Configure some basic stuff */
|
||||
{MIIM_CONTROL, MIIM_CR_INIT, NULL},
|
||||
/* Restart Auto Negotiation */
|
||||
|
@ -1532,14 +1514,14 @@ static struct phy_info phy_info_dm9161 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the status */
|
||||
{MIIM_DM9161_SCSR, miim_read,
|
||||
&mii_parse_dm9161_scsr},
|
||||
{MIIM_DM9161_SCSR, miim_read, &mii_parse_dm9161_scsr},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
{miim_end,}
|
||||
},
|
||||
};
|
||||
|
||||
/* a generic flavor. */
|
||||
static struct phy_info phy_info_generic = {
|
||||
0,
|
||||
|
@ -1561,7 +1543,6 @@ static struct phy_info phy_info_generic = {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
static uint mii_parse_lxt971_sr2(uint mii_reg, struct tsec_private *priv)
|
||||
{
|
||||
unsigned int speed;
|
||||
|
@ -1656,8 +1637,7 @@ static struct phy_info phy_info_dp83865 = {
|
|||
/* Auto-negotiate */
|
||||
{MIIM_STATUS, miim_read, &mii_parse_sr},
|
||||
/* Read the link and auto-neg status */
|
||||
{MIIM_DP83865_LANR, miim_read,
|
||||
&mii_parse_dp83865_lanr},
|
||||
{MIIM_DP83865_LANR, miim_read, &mii_parse_dp83865_lanr},
|
||||
{miim_end,}
|
||||
},
|
||||
(struct phy_cmd[]) { /* shutdown */
|
||||
|
@ -1746,7 +1726,8 @@ static struct phy_info *get_phy_info(struct eth_device *dev)
|
|||
}
|
||||
|
||||
if (theInfo == &phy_info_generic) {
|
||||
printf("%s: No support for PHY id %x; assuming generic\n", dev->name, phy_ID);
|
||||
printf("%s: No support for PHY id %x; assuming generic\n",
|
||||
dev->name, phy_ID);
|
||||
} else {
|
||||
debug("%s: PHY is %s (%x)\n", dev->name, theInfo->name, phy_ID);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue