Commit 41c1093f authored by Timur Tabi's avatar Timur Tabi Committed by David S. Miller

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: default avatarTimur Tabi <timur@codeaurora.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b9032741
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include "emac.h" #include "emac.h"
#include "emac-mac.h" #include "emac-mac.h"
#include "emac-phy.h"
#include "emac-sgmii.h"
/* EMAC base register offsets */ /* EMAC base register offsets */
#define EMAC_MDIO_CTRL 0x001414 #define EMAC_MDIO_CTRL 0x001414
......
...@@ -13,19 +13,6 @@ ...@@ -13,19 +13,6 @@
#ifndef _EMAC_PHY_H_ #ifndef _EMAC_PHY_H_
#define _EMAC_PHY_H_ #define _EMAC_PHY_H_
typedef int (*emac_sgmii_initialize)(struct emac_adapter *adpt);
/** emac_phy - internal emac phy
* @base base address
* @digital per-lane digital block
* @initialize initialization function
*/
struct emac_phy {
void __iomem *base;
void __iomem *digital;
emac_sgmii_initialize initialize;
};
struct emac_adapter; struct emac_adapter;
int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt); int emac_phy_config(struct platform_device *pdev, struct emac_adapter *adpt);
......
...@@ -214,7 +214,7 @@ static const struct emac_reg_write tx_rx_setting[] = { ...@@ -214,7 +214,7 @@ static const struct emac_reg_write tx_rx_setting[] = {
int emac_sgmii_init_fsm9900(struct emac_adapter *adpt) int emac_sgmii_init_fsm9900(struct emac_adapter *adpt)
{ {
struct emac_phy *phy = &adpt->phy; struct emac_sgmii *phy = &adpt->phy;
unsigned int i; unsigned int i;
emac_reg_write_all(phy->base, physical_coding_sublayer_programming, emac_reg_write_all(phy->base, physical_coding_sublayer_programming,
......
...@@ -174,7 +174,7 @@ static const struct emac_reg_write physical_coding_sublayer_programming[] = { ...@@ -174,7 +174,7 @@ static const struct emac_reg_write physical_coding_sublayer_programming[] = {
int emac_sgmii_init_qdf2400(struct emac_adapter *adpt) int emac_sgmii_init_qdf2400(struct emac_adapter *adpt)
{ {
struct emac_phy *phy = &adpt->phy; struct emac_sgmii *phy = &adpt->phy;
void __iomem *phy_regs = phy->base; void __iomem *phy_regs = phy->base;
void __iomem *laned = phy->digital; void __iomem *laned = phy->digital;
unsigned int i; unsigned int i;
......
...@@ -167,7 +167,7 @@ static const struct emac_reg_write physical_coding_sublayer_programming[] = { ...@@ -167,7 +167,7 @@ static const struct emac_reg_write physical_coding_sublayer_programming[] = {
int emac_sgmii_init_qdf2432(struct emac_adapter *adpt) int emac_sgmii_init_qdf2432(struct emac_adapter *adpt)
{ {
struct emac_phy *phy = &adpt->phy; struct emac_sgmii *phy = &adpt->phy;
void __iomem *phy_regs = phy->base; void __iomem *phy_regs = phy->base;
void __iomem *laned = phy->digital; void __iomem *laned = phy->digital;
unsigned int i; unsigned int i;
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
static int emac_sgmii_link_init(struct emac_adapter *adpt) static int emac_sgmii_link_init(struct emac_adapter *adpt)
{ {
struct phy_device *phydev = adpt->phydev; struct phy_device *phydev = adpt->phydev;
struct emac_phy *phy = &adpt->phy; struct emac_sgmii *phy = &adpt->phy;
u32 val; u32 val;
val = readl(phy->base + EMAC_SGMII_PHY_AUTONEG_CFG2); val = readl(phy->base + EMAC_SGMII_PHY_AUTONEG_CFG2);
...@@ -89,7 +89,7 @@ static int emac_sgmii_link_init(struct emac_adapter *adpt) ...@@ -89,7 +89,7 @@ static int emac_sgmii_link_init(struct emac_adapter *adpt)
static int emac_sgmii_irq_clear(struct emac_adapter *adpt, u32 irq_bits) static int emac_sgmii_irq_clear(struct emac_adapter *adpt, u32 irq_bits)
{ {
struct emac_phy *phy = &adpt->phy; struct emac_sgmii *phy = &adpt->phy;
u32 status; u32 status;
writel_relaxed(irq_bits, phy->base + EMAC_SGMII_PHY_INTERRUPT_CLEAR); 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) ...@@ -123,7 +123,7 @@ static int emac_sgmii_irq_clear(struct emac_adapter *adpt, u32 irq_bits)
static void emac_sgmii_reset_prepare(struct emac_adapter *adpt) static void emac_sgmii_reset_prepare(struct emac_adapter *adpt)
{ {
struct emac_phy *phy = &adpt->phy; struct emac_sgmii *phy = &adpt->phy;
u32 val; u32 val;
/* Reset PHY */ /* Reset PHY */
...@@ -217,7 +217,7 @@ static const struct of_device_id emac_sgmii_dt_match[] = { ...@@ -217,7 +217,7 @@ static const struct of_device_id emac_sgmii_dt_match[] = {
int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt) int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt)
{ {
struct platform_device *sgmii_pdev = NULL; struct platform_device *sgmii_pdev = NULL;
struct emac_phy *phy = &adpt->phy; struct emac_sgmii *phy = &adpt->phy;
struct resource *res; struct resource *res;
int ret; int ret;
......
...@@ -16,6 +16,19 @@ ...@@ -16,6 +16,19 @@
struct emac_adapter; struct emac_adapter;
struct platform_device; struct platform_device;
typedef int (*emac_sgmii_initialize)(struct emac_adapter *adpt);
/** emac_sgmii - internal emac phy
* @base base address
* @digital per-lane digital block
* @initialize initialization function
*/
struct emac_sgmii {
void __iomem *base;
void __iomem *digital;
emac_sgmii_initialize initialize;
};
int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt); int emac_sgmii_config(struct platform_device *pdev, struct emac_adapter *adpt);
void emac_sgmii_reset(struct emac_adapter *adpt); void emac_sgmii_reset(struct emac_adapter *adpt);
......
...@@ -602,7 +602,7 @@ static int emac_probe(struct platform_device *pdev) ...@@ -602,7 +602,7 @@ static int emac_probe(struct platform_device *pdev)
{ {
struct net_device *netdev; struct net_device *netdev;
struct emac_adapter *adpt; struct emac_adapter *adpt;
struct emac_phy *phy; struct emac_sgmii *phy;
u16 devid, revid; u16 devid, revid;
u32 reg; u32 reg;
int ret; int ret;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include "emac-mac.h" #include "emac-mac.h"
#include "emac-phy.h" #include "emac-phy.h"
#include "emac-sgmii.h"
/* EMAC base register offsets */ /* EMAC base register offsets */
#define EMAC_DMA_MAS_CTRL 0x001400 #define EMAC_DMA_MAS_CTRL 0x001400
...@@ -291,7 +292,7 @@ struct emac_adapter { ...@@ -291,7 +292,7 @@ struct emac_adapter {
void __iomem *base; void __iomem *base;
void __iomem *csr; void __iomem *csr;
struct emac_phy phy; struct emac_sgmii phy;
struct emac_stats stats; struct emac_stats stats;
struct emac_irq irq; struct emac_irq irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment