aboutsummaryrefslogtreecommitdiffstats
path: root/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0001-net-phy-support-fixed-PHY.patch
blob: e745be73ab54c212ed1f596c9dffb5e05550fb03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
From 1f65b4710c1f51d01032db201543d0a8269a715f Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Fri, 20 May 2016 01:18:44 +0300
Subject: [PATCH] uboot: net: support fixed-PHY

Add support for fixed-PHY

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/net/phy/Makefile      |  1 +
 drivers/net/phy/fixed.c       | 43 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/phy.c         |  5 ++++-
 include/phy.h                 |  1 +
 6 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/fixed.c

diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index d096db8..497785e 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_PHY_BROADCOM) += broadcom.o
 obj-$(CONFIG_PHY_CORTINA) += cortina.o
 obj-$(CONFIG_PHY_DAVICOM) += davicom.o
 obj-$(CONFIG_PHY_ET1011C) += et1011c.o
+obj-$(CONFIG_PHY_FIXED) += fixed.o
 obj-$(CONFIG_PHY_LXT) += lxt.o
 obj-$(CONFIG_PHY_MARVELL) += marvell.o
 obj-$(CONFIG_PHY_MICREL) += micrel.o
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
new file mode 100644
index 0000000..4d44aad
--- /dev/null
+++ b/drivers/net/phy/fixed.c
@@ -0,0 +1,43 @@
+/*
+ * Fixed PHY driver
+ *
+ * Copyright (C) 2016 Renesas Electronics Corporation
+ * Copyright (C) 2016 Cogent Embedded, Inc.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <config.h>
+#include <common.h>
+#include <phy.h>
+
+int fixed_config(struct phy_device *phydev)
+{
+	phydev->speed = CONFIG_PHY_FIXED_SPEED;
+	phydev->duplex = CONFIG_PHY_FIXED_DUPLEX;
+	phydev->link = 1;
+
+	return 0;
+}
+
+static int fixed_startup(struct phy_device *phydev)
+{
+	return 0;
+}
+
+static struct phy_driver fixed_driver = {
+	.uid		= 0x0,
+	.mask		= 0x0,
+	.name		= "fixed-PHY",
+	.features	= PHY_10G_FEATURES,
+	.config		= &fixed_config,
+	.startup	= &fixed_startup,
+	.shutdown	= &genphy_shutdown,
+};
+
+int phy_fixed_init(void)
+{
+	phy_register(&fixed_driver);
+
+	return 0;
+}
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index df7e945..3ee6402 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -484,6 +484,9 @@ int phy_init(void)
 #ifdef CONFIG_PHY_VITESSE
 	phy_vitesse_init();
 #endif
+#ifdef CONFIG_PHY_FIXED
+	phy_fixed_init();
+#endif
 
 	return 0;
 }
@@ -764,7 +767,7 @@ void phy_connect_dev(struct phy_device *phydev, struct eth_device *dev)
 				phydev->dev->name, dev->name);
 	}
 	phydev->dev = dev;
-	debug("%s connected to %s\n", dev->name, phydev->drv->name);
+	printf("%s connected to %s\n", dev->name, phydev->drv->name);
 }
 
 struct phy_device *phy_connect(struct mii_dev *bus, int addr,
diff --git a/include/phy.h b/include/phy.h
index d117fc1..c2f2cbc 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -239,6 +239,7 @@ int phy_realtek_init(void);
 int phy_smsc_init(void);
 int phy_teranetics_init(void);
 int phy_vitesse_init(void);
+int phy_fixed_init(void);
 
 int board_phy_config(struct phy_device *phydev);
 
-- 
1.9.1