* @phy_interface: Phy interface type.
* @phy_flags: Phy interface flags.
* @eth_hasnobuf: Ethernet is configured in Non buf mode.
+ * @axienet_config: Ethernet config structure
*/
struct axienet_local {
struct net_device *ndev;
u32 phy_interface;
u32 phy_flags;
bool eth_hasnobuf;
+ const struct axienet_config *axienet_config;
+};
+
+/**
+ * enum axienet_ip_type - AXIENET IP/MAC type.
+ *
+ * @XAXIENET_1G: IP is 1G MAC
+ *
+ */
+enum axienet_ip_type {
+ XAXIENET_1G = 0,
+};
+
+struct axienet_config {
+ enum axienet_ip_type mactype;
+ void (*setoptions)(struct net_device *ndev, u32 options);
};
/**
#define AXIENET_REGS_N 32
-/* Match table for of_platform binding */
-static const struct of_device_id axienet_of_match[] = {
- { .compatible = "xlnx,axi-ethernet-1.00.a", },
- { .compatible = "xlnx,axi-ethernet-1.01.a", },
- { .compatible = "xlnx,axi-ethernet-2.01.a", },
- {},
-};
-
-MODULE_DEVICE_TABLE(of, axienet_of_match);
-
/* Option table for setting up Axi Ethernet hardware options */
static struct axienet_option axienet_options[] = {
/* Turn on jumbo packet support for both Rx and Tx */
axienet_setoptions(ndev, lp->options);
}
+static const struct axienet_config axienet_1g_config = {
+ .mactype = XAXIENET_1G,
+ .setoptions = axienet_setoptions,
+};
+
+/* Match table for of_platform binding */
+static const struct of_device_id axienet_of_match[] = {
+ { .compatible = "xlnx,axi-ethernet-1.00.a", .data = &axienet_1g_config},
+ { .compatible = "xlnx,axi-ethernet-1.01.a", .data = &axienet_1g_config},
+ { .compatible = "xlnx,axi-ethernet-2.01.a", .data = &axienet_1g_config},
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, axienet_of_match);
+
/**
* axienet_probe - Axi Ethernet probe function.
* @pdev: Pointer to platform device structure.
/* Setup checksum offload, but default to off if not specified */
lp->features = 0;
+ if (pdev->dev.of_node) {
+ const struct of_device_id *match;
+
+ match = of_match_node(axienet_of_match, pdev->dev.of_node);
+ if (match && match->data)
+ lp->axienet_config = match->data;
+ }
+
ret = of_property_read_u32(pdev->dev.of_node, "xlnx,txcsum", &value);
if (!ret) {
switch (value) {