Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108592905
D34764.id104940.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D34764.id104940.diff
View Options
diff --git a/sys/dev/cadence/if_cgem.c b/sys/dev/cadence/if_cgem.c
--- a/sys/dev/cadence/if_cgem.c
+++ b/sys/dev/cadence/if_cgem.c
@@ -100,18 +100,19 @@
#define CGEM_CKSUM_ASSIST (CSUM_IP | CSUM_TCP | CSUM_UDP | \
CSUM_TCP_IPV6 | CSUM_UDP_IPV6)
-#define HWTYPE_GENERIC_GEM 1
-#define HWTYPE_ZYNQ 2
-#define HWTYPE_ZYNQMP 3
-#define HWTYPE_SIFIVE 4
+#define HWQUIRK_NONE 0
+#define HWQUIRK_NEEDNULLQS 1
+#define HWQUIRK_RXHANGWAR 2
+#define HWQUIRK_TXCLK 4
+#define HWQUIRK_PCLK 8
static struct ofw_compat_data compat_data[] = {
- { "cdns,zynq-gem", HWTYPE_ZYNQ },
- { "cdns,zynqmp-gem", HWTYPE_ZYNQMP },
- { "sifive,fu540-c000-gem", HWTYPE_SIFIVE },
- { "sifive,fu740-c000-gem", HWTYPE_SIFIVE },
- { "cdns,gem", HWTYPE_GENERIC_GEM },
- { "cadence,gem", HWTYPE_GENERIC_GEM },
+ { "cdns,zynq-gem", HWQUIRK_RXHANGWAR | HWQUIRK_TXCLK },
+ { "cdns,zynqmp-gem", HWQUIRK_NEEDNULLQS | HWQUIRK_TXCLK },
+ { "sifive,fu540-c000-gem", HWQUIRK_PCLK },
+ { "sifive,fu740-c000-gem", HWQUIRK_PCLK },
+ { "cdns,gem", HWQUIRK_NONE },
+ { "cadence,gem", HWQUIRK_NONE },
{ NULL, 0 }
};
@@ -1712,7 +1713,7 @@
if (!ofw_bus_status_okay(dev))
return (ENXIO);
- if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
+ if (ofw_bus_search_compatible(dev, compat_data)->ocd_str == NULL)
return (ENXIO);
device_set_desc(dev, "Cadence CGEM Gigabit Ethernet Interface");
@@ -1726,25 +1727,25 @@
if_t ifp = NULL;
int rid, err;
u_char eaddr[ETHER_ADDR_LEN];
- int hwtype;
+ int hwquirks;
sc->dev = dev;
CGEM_LOCK_INIT(sc);
/* Key off of compatible string and set hardware-specific options. */
- hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
- if (hwtype == HWTYPE_ZYNQMP)
+ hwquirks = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+ if ((hwquirks & HWQUIRK_NEEDNULLQS) != 0)
sc->neednullqs = 1;
- if (hwtype == HWTYPE_ZYNQ)
+ if ((hwquirks & HWQUIRK_RXHANGWAR) != 0)
sc->rxhangwar = 1;
-
- if (hwtype == HWTYPE_ZYNQ || hwtype == HWTYPE_ZYNQMP) {
+ if ((hwquirks & HWQUIRK_TXCLK) != 0) {
if (clk_get_by_ofw_name(dev, 0, "tx_clk", &sc->ref_clk) != 0)
device_printf(dev,
"could not retrieve reference clock.\n");
else if (clk_enable(sc->ref_clk) != 0)
device_printf(dev, "could not enable clock.\n");
- } else if (hwtype == HWTYPE_SIFIVE) {
+ }
+ if ((hwquirks & HWQUIRK_PCLK) != 0) {
if (clk_get_by_ofw_name(dev, 0, "pclk", &sc->ref_clk) != 0)
device_printf(dev,
"could not retrieve reference clock.\n");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 6:04 PM (5 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16202826
Default Alt Text
D34764.id104940.diff (2 KB)
Attached To
Mode
D34764: Enhance if_cgem (add SGMII connection type, rewrite errata logic, fix typo)
Attached
Detach File
Event Timeline
Log In to Comment