Skip to content

Commit 41c1093

Browse files
Timur Tabidavem330
authored andcommitted
net: qcom/emac: rename emac_phy to emac_sgmii and move it
The EMAC has an internal PHY that is often called the "SGMII". This SGMII is also connected to an external PHY, which is managed by phylib. These dual PHYs often cause confusion. In this case, the data structure for managing the SGMII was mis-named and located in the wrong header file. Structure emac_phy is renamed to emac_sgmii to clearly indicate it applies to the internal PHY only. It also also moved from emac_phy.h (which supports the external PHY) to emac_sgmii.h (where it belongs). To keep the changes minimal, only the structure name is changed, not the names of any variables of that type. Signed-off-by: Timur Tabi <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b903274 commit 41c1093

File tree

9 files changed

+23
-24
lines changed

9 files changed

+23
-24
lines changed

drivers/net/ethernet/qualcomm/emac/emac-phy.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include <linux/acpi.h>
2323
#include "emac.h"
2424
#include "emac-mac.h"
25-
#include "emac-phy.h"
26-
#include "emac-sgmii.h"
2725

2826
/* EMAC base register offsets */
2927
#define EMAC_MDIO_CTRL 0x001414

drivers/net/ethernet/qualcomm/emac/emac-phy.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,6 @@
1313
#ifndef _EMAC_PHY_H_
1414
#define _EMAC_PHY_H_
1515

16-
typedef int (*emac_sgmii_initialize)(struct emac_adapter *adpt);
17-
18-
/** emac_phy - internal emac phy
19-
* @base base address
20-
* @digital per-lane digital block
21-
* @initialize initialization function
22-
*/
23-
struct emac_phy {
24-
void __iomem *base;
25-
void __iomem *digital;
26-
emac_sgmii_initialize initialize;
27-
};
28-
2916
struct emac_adapter;
3017

3118
int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt);

drivers/net/ethernet/qualcomm/emac/emac-sgmii-fsm9900.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static const struct emac_reg_write tx_rx_setting[] = {
214214

215215
int emac_sgmii_init_fsm9900(struct emac_adapter *adpt)
216216
{
217-
struct emac_phy *phy = &adpt->phy;
217+
struct emac_sgmii *phy = &adpt->phy;
218218
unsigned int i;
219219

220220
emac_reg_write_all(phy->base, physical_coding_sublayer_programming,

drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2400.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static const struct emac_reg_write physical_coding_sublayer_programming[] = {
174174

175175
int emac_sgmii_init_qdf2400(struct emac_adapter *adpt)
176176
{
177-
struct emac_phy *phy = &adpt->phy;
177+
struct emac_sgmii *phy = &adpt->phy;
178178
void __iomem *phy_regs = phy->base;
179179
void __iomem *laned = phy->digital;
180180
unsigned int i;

drivers/net/ethernet/qualcomm/emac/emac-sgmii-qdf2432.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static const struct emac_reg_write physical_coding_sublayer_programming[] = {
167167

168168
int emac_sgmii_init_qdf2432(struct emac_adapter *adpt)
169169
{
170-
struct emac_phy *phy = &adpt->phy;
170+
struct emac_sgmii *phy = &adpt->phy;
171171
void __iomem *phy_regs = phy->base;
172172
void __iomem *laned = phy->digital;
173173
unsigned int i;

drivers/net/ethernet/qualcomm/emac/emac-sgmii.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
static int emac_sgmii_link_init(struct emac_adapter *adpt)
5151
{
5252
struct phy_device *phydev = adpt->phydev;
53-
struct emac_phy *phy = &adpt->phy;
53+
struct emac_sgmii *phy = &adpt->phy;
5454
u32 val;
5555

5656
val = readl(phy->base + EMAC_SGMII_PHY_AUTONEG_CFG2);
@@ -89,7 +89,7 @@ static int emac_sgmii_link_init(struct emac_adapter *adpt)
8989

9090
static int emac_sgmii_irq_clear(struct emac_adapter *adpt, u32 irq_bits)
9191
{
92-
struct emac_phy *phy = &adpt->phy;
92+
struct emac_sgmii *phy = &adpt->phy;
9393
u32 status;
9494

9595
writel_relaxed(irq_bits, phy->base + EMAC_SGMII_PHY_INTERRUPT_CLEAR);
@@ -123,7 +123,7 @@ static int emac_sgmii_irq_clear(struct emac_adapter *adpt, u32 irq_bits)
123123

124124
static void emac_sgmii_reset_prepare(struct emac_adapter *adpt)
125125
{
126-
struct emac_phy *phy = &adpt->phy;
126+
struct emac_sgmii *phy = &adpt->phy;
127127
u32 val;
128128

129129
/* Reset PHY */
@@ -217,7 +217,7 @@ static const struct of_device_id emac_sgmii_dt_match[] = {
217217
int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
218218
{
219219
struct platform_device *sgmii_pdev = NULL;
220-
struct emac_phy *phy = &adpt->phy;
220+
struct emac_sgmii *phy = &adpt->phy;
221221
struct resource *res;
222222
int ret;
223223

drivers/net/ethernet/qualcomm/emac/emac-sgmii.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@
1616
struct emac_adapter;
1717
struct platform_device;
1818

19+
typedef int (*emac_sgmii_initialize)(struct emac_adapter *adpt);
20+
21+
/** emac_sgmii - internal emac phy
22+
* @base base address
23+
* @digital per-lane digital block
24+
* @initialize initialization function
25+
*/
26+
struct emac_sgmii {
27+
void __iomem *base;
28+
void __iomem *digital;
29+
emac_sgmii_initialize initialize;
30+
};
31+
1932
int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
2033
void emac_sgmii_reset(struct emac_adapter *adpt);
2134

drivers/net/ethernet/qualcomm/emac/emac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static int emac_probe(struct platform_device *pdev)
602602
{
603603
struct net_device *netdev;
604604
struct emac_adapter *adpt;
605-
struct emac_phy *phy;
605+
struct emac_sgmii *phy;
606606
u16 devid, revid;
607607
u32 reg;
608608
int ret;

drivers/net/ethernet/qualcomm/emac/emac.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/platform_device.h>
2020
#include "emac-mac.h"
2121
#include "emac-phy.h"
22+
#include "emac-sgmii.h"
2223

2324
/* EMAC base register offsets */
2425
#define EMAC_DMA_MAS_CTRL 0x001400
@@ -291,7 +292,7 @@ struct emac_adapter {
291292
void __iomem *base;
292293
void __iomem *csr;
293294

294-
struct emac_phy phy;
295+
struct emac_sgmii phy;
295296
struct emac_stats stats;
296297

297298
struct emac_irq irq;

0 commit comments

Comments
 (0)