2 * Freescale SGMII Riser Card
4 * This driver supports the SGMII Riser card found on the
5 * "DS" style of development board from Freescale.
7 * This software may be used and distributed according to the
8 * terms of the GNU Public License, Version 2, incorporated
11 * Copyright 2008 Freescale Semiconductor, Inc.
20 #include <fdt_support.h>
22 void fsl_sgmii_riser_init(struct tsec_info_struct
*tsec_info
, int num
)
26 for (i
= 0; i
< num
; i
++)
27 if (tsec_info
[i
].flags
& TSEC_SGMII
)
28 tsec_info
[i
].phyaddr
+= SGMII_RISER_PHY_OFFSET
;
31 void fsl_sgmii_riser_fdt_fixup(void *fdt
)
33 struct eth_device
*dev
;
39 node
= fdt_path_offset(fdt
, "/aliases");
43 while ((dev
= eth_get_dev_by_index(++i
)) != NULL
) {
44 struct tsec_private
*priv
;
54 if (!strstr(dev
->name
, "eTSEC"))
58 if (!(priv
->flags
& TSEC_SGMII
)) {
63 mdio_node
= fdt_node_offset_by_compatible(fdt
, -1,
68 sprintf(sgmii_phy
, "sgmii-phy@%d", etsec_num
);
69 phy_node
= fdt_subnode_offset(fdt
, mdio_node
, sgmii_phy
);
71 fdt_increase_size(fdt
, 32);
72 ph
= fdt_create_phandle(fdt
, phy_node
);
77 sprintf(enet
, "ethernet%d", etsec_num
++);
78 path
= fdt_getprop(fdt
, node
, enet
, NULL
);
80 debug("No alias for %s\n", enet
);
84 enet_node
= fdt_path_offset(fdt
, path
);
88 model
= fdt_getprop(fdt
, enet_node
, "model", NULL
);
91 * We only want to do this to eTSECs. On some platforms
92 * there are more than one type of gianfar-style ethernet
93 * controller, and as we are creating an implicit connection
94 * between ethernet nodes and eTSEC devices, it is best to
95 * make the connection use as much explicit information
98 if (!strstr(model
, "TSEC"))
103 * This part is only for old device tree without
104 * sgmii_phy nodes. It's kept just for compatible
105 * reason. Soon to be deprecated if all device tree
108 phyh
= fdt_getprop(fdt
, enet_node
, "phy-handle", NULL
);
112 phy_node
= fdt_node_offset_by_phandle(fdt
,
113 fdt32_to_cpu(*phyh
));
117 if (priv
->flags
& TSEC_SGMII
)
118 fdt_setprop_cell(fdt
, phy_node
, "reg",
121 fdt_setprop(fdt
, enet_node
, "phy-handle", &ph
,
123 fdt_setprop_string(fdt
, enet_node
,
124 "phy-connection-type",
125 phy_string_for_interface(
126 PHY_INTERFACE_MODE_SGMII
));