[PATCH 0/2] Add DRA7xx platform support in cpsw-phy-sel driver
From: Mugunthan V N <hidden>
Date: 2014-05-09 11:03:22
4 messages, 1 author, 2014-05-09 · open the first message on its own page
From: Mugunthan V N <hidden>
Date: 2014-05-09 11:03:22
Adding DRA7xx platform support to cpsw-phy-sel driver to select phy mode in control driver and fixing the uninitialized dev by initializing to platform device structure pointer. Mugunthan V N (2): drivers: net: cpsw-phy-sel: add dra7xx support for phy sel drivers: net: cpsw-phy-sel: add am43xx platform support .../devicetree/bindings/net/cpsw-phy-sel.txt | 4 +- drivers/net/ethernet/ti/cpsw-phy-sel.c | 61 +++++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) -- 1.9.2.459.g68773ac
From: Mugunthan V N <hidden>
Date: 2014-05-09 11:03:23
Add dra7xx support for selecting the phy mode which is present in control module of dra7xx SoC Signed-off-by: Mugunthan V N <redacted> --- .../devicetree/bindings/net/cpsw-phy-sel.txt | 3 +- drivers/net/ethernet/ti/cpsw-phy-sel.c | 57 +++++++++++++++++++++- 2 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt b/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
index 7ff57a1..d9da911 100644
--- a/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
+++ b/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt@@ -2,7 +2,8 @@ TI CPSW Phy mode Selection Device Tree Bindings ----------------------------------------------- Required properties: -- compatible : Should be "ti,am3352-cpsw-phy-sel" +- compatible : Should be "ti,am3352-cpsw-phy-sel" for am335x platform and + "ti,dra7xx-cpsw-phy-sel" for dra7xx platform - reg : physical base address and size of the cpsw registers map - reg-names : names of the register map given in "reg" node
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index 86b5dce..b93838d 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c@@ -29,6 +29,8 @@ #define AM33XX_GMII_SEL_RMII2_IO_CLK_EN BIT(7) #define AM33XX_GMII_SEL_RMII1_IO_CLK_EN BIT(6) +#define GMII_SEL_MODE_MASK 0x3 + struct cpsw_phy_sel_priv { struct device *dev; u32 __iomem *gmii_sel;
@@ -65,7 +67,7 @@ static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv, break; }; - mask = 0x3 << (slave * 2) | BIT(slave + 6); + mask = GMII_SEL_MODE_MASK << (slave * 2) | BIT(slave + 6); mode <<= slave * 2; if (priv->rmii_clock_external) {
@@ -81,6 +83,55 @@ static void cpsw_gmii_sel_am3352(struct cpsw_phy_sel_priv *priv, writel(reg, priv->gmii_sel); } +static void cpsw_gmii_sel_dra7xx(struct cpsw_phy_sel_priv *priv, + phy_interface_t phy_mode, int slave) +{ + u32 reg; + u32 mask; + u32 mode = 0; + + reg = readl(priv->gmii_sel); + + switch (phy_mode) { + case PHY_INTERFACE_MODE_RMII: + mode = AM33XX_GMII_SEL_MODE_RMII; + break; + + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + mode = AM33XX_GMII_SEL_MODE_RGMII; + break; + + case PHY_INTERFACE_MODE_MII: + default: + mode = AM33XX_GMII_SEL_MODE_MII; + break; + }; + + switch (slave) { + case 0: + mask = GMII_SEL_MODE_MASK; + break; + case 1: + mask = GMII_SEL_MODE_MASK << 4; + mode <<= 4; + break; + default: + dev_err(priv->dev, "invalid slave number...\n"); + return; + } + + if (priv->rmii_clock_external) + dev_err(priv->dev, "RMII External clock is not supported\n"); + + reg &= ~mask; + reg |= mode; + + writel(reg, priv->gmii_sel); +} + static struct platform_driver cpsw_phy_sel_driver; static int match(struct device *dev, void *data) {
@@ -112,6 +163,10 @@ static const struct of_device_id cpsw_phy_sel_id_table[] = { .compatible = "ti,am3352-cpsw-phy-sel", .data = &cpsw_gmii_sel_am3352, }, + { + .compatible = "ti,dra7xx-cpsw-phy-sel", + .data = &cpsw_gmii_sel_dra7xx, + }, {} }; MODULE_DEVICE_TABLE(of, cpsw_phy_sel_id_table);
--
1.9.2.459.g68773ac
From: Mugunthan V N <hidden>
Date: 2014-05-09 11:03:24
AM43xx phy mode selection is similar to AM33xx platform, so adding only the compatibility string to the driver Signed-off-by: Mugunthan V N <redacted> --- Documentation/devicetree/bindings/net/cpsw-phy-sel.txt | 1 + drivers/net/ethernet/ti/cpsw-phy-sel.c | 4 ++++ 2 files changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt b/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
index d9da911..764c0c7 100644
--- a/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt
+++ b/Documentation/devicetree/bindings/net/cpsw-phy-sel.txt@@ -4,6 +4,7 @@ TI CPSW Phy mode Selection Device Tree Bindings Required properties: - compatible : Should be "ti,am3352-cpsw-phy-sel" for am335x platform and "ti,dra7xx-cpsw-phy-sel" for dra7xx platform + "ti,am43xx-cpsw-phy-sel" for am43xx platform - reg : physical base address and size of the cpsw registers map - reg-names : names of the register map given in "reg" node
diff --git a/drivers/net/ethernet/ti/cpsw-phy-sel.c b/drivers/net/ethernet/ti/cpsw-phy-sel.c
index b93838d..aa8bf45 100644
--- a/drivers/net/ethernet/ti/cpsw-phy-sel.c
+++ b/drivers/net/ethernet/ti/cpsw-phy-sel.c@@ -167,6 +167,10 @@ static const struct of_device_id cpsw_phy_sel_id_table[] = { .compatible = "ti,dra7xx-cpsw-phy-sel", .data = &cpsw_gmii_sel_dra7xx, }, + { + .compatible = "ti,am43xx-cpsw-phy-sel", + .data = &cpsw_gmii_sel_am3352, + }, {} }; MODULE_DEVICE_TABLE(of, cpsw_phy_sel_id_table);
--
1.9.2.459.g68773ac
From: Mugunthan V N <hidden>
Date: 2014-05-09 13:32:39
On Friday 09 May 2014 04:33 PM, Mugunthan V N wrote:
Adding DRA7xx platform support to cpsw-phy-sel driver to select phy mode in control driver and fixing the uninitialized dev by initializing to platform device structure pointer. Mugunthan V N (2): drivers: net: cpsw-phy-sel: add dra7xx support for phy sel drivers: net: cpsw-phy-sel: add am43xx platform support .../devicetree/bindings/net/cpsw-phy-sel.txt | 4 +- drivers/net/ethernet/ti/cpsw-phy-sel.c | 61 +++++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-)
Please ignore the patch as the second patch is not applicable and one patch is missing. Regards Mugunthan V N