From: <srinivas.kandagatla@st.com>
To: <netdev@vger.kernel.org>
Cc: Giuseppe CAVALLARO <peppe.cavallaro@st.com>,
David Miller <davem@davemloft.net>,
<linux-kernel@vger.kernel.org>, <srinivas.kandagatla@st.com>
Subject: [PATCH v2 1/9] net: stmmac: support max-speed device tree property
Date: Thu, 16 Jan 2014 10:51:43 +0000 [thread overview]
Message-ID: <1389869503-28052-1-git-send-email-srinivas.kandagatla@st.com> (raw)
In-Reply-To: <1389869450-28003-1-git-send-email-srinivas.kandagatla@st.com>
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch adds support to "max-speed" property which is a standard
Ethernet device tree property. max-speed specifies maximum speed
(specified in megabits per second) supported the device.
Depending on the clocking schemes some of the boards can only support
few link speeds, so having a way to limit the link speed in the mac
driver would allow such setups to work reliably.
Without this patch there is no way to tell the driver to limit the
link speed.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 ++++
include/linux/stmmac.h | 1 +
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index ecdc8ab..15192c0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -776,6 +776,7 @@ static int stmmac_init_phy(struct net_device *dev)
char phy_id_fmt[MII_BUS_ID_SIZE + 3];
char bus_id[MII_BUS_ID_SIZE];
int interface = priv->plat->interface;
+ int max_speed = priv->plat->max_speed;
priv->oldlink = 0;
priv->speed = 0;
priv->oldduplex = -1;
@@ -800,7 +801,8 @@ static int stmmac_init_phy(struct net_device *dev)
/* Stop Advertising 1000BASE Capability if interface is not GMII */
if ((interface == PHY_INTERFACE_MODE_MII) ||
- (interface == PHY_INTERFACE_MODE_RMII))
+ (interface == PHY_INTERFACE_MODE_RMII) ||
+ (max_speed < 1000 && max_speed > 0))
phydev->advertising &= ~(SUPPORTED_1000baseT_Half |
SUPPORTED_1000baseT_Full);
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 38bd1f4..9377ee6 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -42,6 +42,10 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
*mac = of_get_mac_address(np);
plat->interface = of_get_phy_mode(np);
+ /* Get max speed of operation from device tree */
+ if (of_property_read_u32(np, "max-speed", &plat->max_speed))
+ plat->max_speed = -1;
+
plat->bus_id = of_alias_get_id(np, "ethernet");
if (plat->bus_id < 0)
plat->bus_id = 0;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index bb5deb0..33ace71 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -110,6 +110,7 @@ struct plat_stmmacenet_data {
int force_sf_dma_mode;
int force_thresh_dma_mode;
int riwt_off;
+ int max_speed;
void (*fix_mac_speed)(void *priv, unsigned int speed);
void (*bus_setup)(void __iomem *ioaddr);
int (*init)(struct platform_device *pdev);
--
1.7.6.5
next prev parent reply other threads:[~2014-01-16 10:57 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-18 11:30 [PATCH RFC 0/9]net: stmmac PM related fixes srinivas.kandagatla
2013-11-18 11:31 ` [PATCH RFC 1/9] net: stmmac: support max-speed device tree property srinivas.kandagatla
2013-11-18 11:31 ` [PATCH RFC 2/9] net: stmmac: mdio: remove reset gpio free srinivas.kandagatla
2013-11-18 11:31 ` [PATCH RFC 3/9] net: stmmac: move dma allocation to new function srinivas.kandagatla
2013-11-18 11:32 ` [PATCH RFC 4/9] net: stmmac: move hardware setup for stmmac_open " srinivas.kandagatla
2013-11-18 11:32 ` [PATCH RFC 5/9] net: stmmac: make stmmac_mdio_reset non-static srinivas.kandagatla
2013-11-18 11:32 ` [PATCH RFC 6/9] net: stmmac: fix power mangement suspend-resume case srinivas.kandagatla
2013-11-18 11:32 ` [PATCH RFC 7/9] net: stmmac: use suspend functions for hibernation srinivas.kandagatla
2013-11-18 11:32 ` [PATCH RFC 8/9] net: stmmac: restore pinstate in pm resume srinivas.kandagatla
2013-11-18 11:32 ` [PATCH RFC 9/9] net: stmmac: notify the PM core of a wakeup event srinivas.kandagatla
2013-11-19 5:24 ` [PATCH RFC 0/9]net: stmmac PM related fixes Giuseppe CAVALLARO
2013-11-19 9:03 ` srinivas kandagatla
2013-12-02 10:48 ` srinivas kandagatla
2013-12-02 16:18 ` David Miller
2014-01-14 10:05 ` srinivas kandagatla
2014-01-15 21:49 ` David Miller
2014-01-16 10:48 ` [PATCH v2 0/9] net: " srinivas.kandagatla
2014-01-16 23:24 ` David Miller
2014-01-16 10:50 ` srinivas.kandagatla
2014-01-16 10:51 ` srinivas.kandagatla [this message]
2014-01-16 10:51 ` [PATCH v2 2/9] net: stmmac: mdio: remove reset gpio free srinivas.kandagatla
2014-01-16 10:52 ` [PATCH v2 3/9] net: stmmac: move dma allocation to new function srinivas.kandagatla
2014-01-16 10:52 ` [PATCH v2 4/9] net: stmmac: move hardware setup for stmmac_open " srinivas.kandagatla
2014-01-16 10:52 ` [PATCH v2 5/9] net: stmmac: make stmmac_mdio_reset non-static srinivas.kandagatla
2014-01-16 10:52 ` [PATCH v2 6/9] net: stmmac: fix power management suspend-resume case srinivas.kandagatla
2014-01-16 10:52 ` [PATCH v2 7/9] net: stmmac: use suspend functions for hibernation srinivas.kandagatla
2014-01-16 10:52 ` [PATCH v2 8/9] net: stmmac: restore pinstate in pm resume srinivas.kandagatla
2014-01-16 10:53 ` [PATCH v2 9/9] net: stmmac: notify the PM core of a wakeup event srinivas.kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389869503-28052-1-git-send-email-srinivas.kandagatla@st.com \
--to=srinivas.kandagatla@st.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®