Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
56aba286
Commit
56aba286
authored
Sep 23, 2019
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated and moved to a patch to make it easier updating next time
parent
e74c663c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
4067 deletions
+78
-4067
macb_main.c
src/drivers/net/ethernet/cadence/macb_main.c
+0
-4067
macb_main.c.patch
src/patches/macb_main.c.patch
+78
-0
No files found.
src/drivers/net/ethernet/cadence/macb_main.c
deleted
100644 → 0
View file @
e74c663c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/patches/macb_main.c.patch
0 → 100644
View file @
56aba286
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 401a6c5..1244b75 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -80,6 +80,10 @@
#define MACB_HALT_TIMEOUT 1230
#define MACB_PM_TIMEOUT 100 /* ms */
+/* Elphel */
+#define AT803X_PHY_ID 0x004dd072 /*Particular one, AR8035 but we'll use a broad mask */
+#define AT803X_PHY_ID_MASK 0xffffffe0
+
/* DMA buffer descriptor might be different size
* depends on hardware configuration:
*
@@ -609,12 +613,62 @@ static int macb_mii_probe(struct net_device *dev)
return 0;
}
+// Elphel BEGIN
+/* http://www.spinics.net/lists/devicetree/msg06322.html */
+static int ar8035_phy_fixup(struct phy_device *dev)
+{
+ u16 val;
+
+ pr_debug("fixup start");
+
+ /* Ar803x phy SmartEEE feature cause link status generates glitch,
+ * which cause ethernet link down/up issue, so disable SmartEEE
+ */
+ phy_write(dev, 0xd, 0x3);
+ phy_write(dev, 0xe, 0x805d);
+ phy_write(dev, 0xd, 0x4003);
+
+ val = phy_read(dev, 0xe);
+ phy_write(dev, 0xe, val & ~(1 << 8));
+ /*Enable if needed */
+#if 0
+ /* To enable AR8031 output a 125MHz clk from CLK_25M */
+ phy_write(dev, 0xd, 0x7);
+ phy_write(dev, 0xe, 0x8016);
+ phy_write(dev, 0xd, 0x4007);
+
+ val = phy_read(dev, 0xe);
+ val &= 0xffe3;
+ val |= 0x18;
+ phy_write(dev, 0xe, val);
+#endif
+/* Next one what is really needed for Elphel 393 */
+ /* introduce tx clock delay */
+ phy_write(dev, 0x1d, 0x5);
+ val = phy_read(dev, 0x1e);
+ val |= 0x0100;
+ phy_write(dev, 0x1e, val);
+
+ /*check phy power*/
+ val = phy_read(dev, 0x0);
+ if (val & BMCR_PDOWN)
+ phy_write(dev, 0x0, val & ~BMCR_PDOWN);
+
+ pr_debug("fixup end");
+
+ return 0;
+}
+// Elphel END
+
static int macb_mii_init(struct macb *bp)
{
struct macb_platform_data *pdata;
struct device_node *np, *mdio_np;
int err = -ENXIO, i;
+ // Elphel, fixup for Atheros 8035
+ phy_register_fixup_for_uid(AT803X_PHY_ID, AT803X_PHY_ID_MASK, ar8035_phy_fixup);
+
/* Enable management port */
macb_writel(bp, NCR, MACB_BIT(MPE));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment