|
@@ -183,28 +183,10 @@ void fsl_pq_mdio_bus_name(char *name, struct device_node *np)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name);
|
|
EXPORT_SYMBOL_GPL(fsl_pq_mdio_bus_name);
|
|
|
|
|
|
-/* Scan the bus in reverse, looking for an empty spot */
|
|
|
|
-static int fsl_pq_mdio_find_free(struct mii_bus *new_bus)
|
|
|
|
-{
|
|
|
|
- int i;
|
|
|
|
-
|
|
|
|
- for (i = PHY_MAX_ADDR; i > 0; i--) {
|
|
|
|
- u32 phy_id;
|
|
|
|
-
|
|
|
|
- if (get_phy_id(new_bus, i, &phy_id))
|
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- if (phy_id == 0xffffffff)
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return i;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
|
|
-#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
|
|
|
|
static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np)
|
|
static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np)
|
|
{
|
|
{
|
|
|
|
+#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
|
|
struct gfar __iomem *enet_regs;
|
|
struct gfar __iomem *enet_regs;
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -220,15 +202,15 @@ static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct devi
|
|
} else if (of_device_is_compatible(np, "fsl,etsec2-mdio") ||
|
|
} else if (of_device_is_compatible(np, "fsl,etsec2-mdio") ||
|
|
of_device_is_compatible(np, "fsl,etsec2-tbi")) {
|
|
of_device_is_compatible(np, "fsl,etsec2-tbi")) {
|
|
return of_iomap(np, 1);
|
|
return of_iomap(np, 1);
|
|
- } else
|
|
|
|
- return NULL;
|
|
|
|
-}
|
|
|
|
|
|
+ }
|
|
#endif
|
|
#endif
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
-#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
|
|
|
|
static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
|
|
static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
|
|
{
|
|
{
|
|
|
|
+#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
|
|
struct device_node *np = NULL;
|
|
struct device_node *np = NULL;
|
|
int err = 0;
|
|
int err = 0;
|
|
|
|
|
|
@@ -261,9 +243,10 @@ static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
|
|
return err;
|
|
return err;
|
|
else
|
|
else
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
-}
|
|
|
|
|
|
+#else
|
|
|
|
+ return -ENODEV;
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
|
|
+}
|
|
|
|
|
|
static int fsl_pq_mdio_probe(struct platform_device *ofdev)
|
|
static int fsl_pq_mdio_probe(struct platform_device *ofdev)
|
|
{
|
|
{
|
|
@@ -339,19 +322,13 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev)
|
|
of_device_is_compatible(np, "fsl,etsec2-mdio") ||
|
|
of_device_is_compatible(np, "fsl,etsec2-mdio") ||
|
|
of_device_is_compatible(np, "fsl,etsec2-tbi") ||
|
|
of_device_is_compatible(np, "fsl,etsec2-tbi") ||
|
|
of_device_is_compatible(np, "gianfar")) {
|
|
of_device_is_compatible(np, "gianfar")) {
|
|
-#if defined(CONFIG_GIANFAR) || defined(CONFIG_GIANFAR_MODULE)
|
|
|
|
tbipa = get_gfar_tbipa(regs, np);
|
|
tbipa = get_gfar_tbipa(regs, np);
|
|
if (!tbipa) {
|
|
if (!tbipa) {
|
|
err = -EINVAL;
|
|
err = -EINVAL;
|
|
goto err_free_irqs;
|
|
goto err_free_irqs;
|
|
}
|
|
}
|
|
-#else
|
|
|
|
- err = -ENODEV;
|
|
|
|
- goto err_free_irqs;
|
|
|
|
-#endif
|
|
|
|
} else if (of_device_is_compatible(np, "fsl,ucc-mdio") ||
|
|
} else if (of_device_is_compatible(np, "fsl,ucc-mdio") ||
|
|
of_device_is_compatible(np, "ucc_geth_phy")) {
|
|
of_device_is_compatible(np, "ucc_geth_phy")) {
|
|
-#if defined(CONFIG_UCC_GETH) || defined(CONFIG_UCC_GETH_MODULE)
|
|
|
|
u32 id;
|
|
u32 id;
|
|
static u32 mii_mng_master;
|
|
static u32 mii_mng_master;
|
|
|
|
|
|
@@ -364,10 +341,6 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev)
|
|
mii_mng_master = id;
|
|
mii_mng_master = id;
|
|
ucc_set_qe_mux_mii_mng(id - 1);
|
|
ucc_set_qe_mux_mii_mng(id - 1);
|
|
}
|
|
}
|
|
-#else
|
|
|
|
- err = -ENODEV;
|
|
|
|
- goto err_free_irqs;
|
|
|
|
-#endif
|
|
|
|
} else {
|
|
} else {
|
|
err = -ENODEV;
|
|
err = -ENODEV;
|
|
goto err_free_irqs;
|
|
goto err_free_irqs;
|
|
@@ -386,16 +359,6 @@ static int fsl_pq_mdio_probe(struct platform_device *ofdev)
|
|
}
|
|
}
|
|
|
|
|
|
if (tbiaddr == -1) {
|
|
if (tbiaddr == -1) {
|
|
- out_be32(tbipa, 0);
|
|
|
|
-
|
|
|
|
- tbiaddr = fsl_pq_mdio_find_free(new_bus);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * We define TBIPA at 0 to be illegal, opting to fail for boards that
|
|
|
|
- * have PHYs at 1-31, rather than change tbipa and rescan.
|
|
|
|
- */
|
|
|
|
- if (tbiaddr == 0) {
|
|
|
|
err = -EBUSY;
|
|
err = -EBUSY;
|
|
|
|
|
|
goto err_free_irqs;
|
|
goto err_free_irqs;
|