Skip to contentSkip to conversation

ARM: at91: Fix link breakage when !CONFIG_PHYLIB

PATCH Superseded Alexandre Belloni 3 participants 4 messages May 25, 2013 – May 27, 2013

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: at91: Fix link breakage when !CONFIG_PHYLIB

Fixes:
arch/arm/mach-at91/built-in.o: In function `ksz9021rn_phy_fixup':
:(.text+0x1174): undefined reference to mdiobus_write' :(.text+0x1188): undefined reference to mdiobus_write' :(.text+0x119c): undefined reference to mdiobus_write' :(.text+0x11b0): undefined reference to mdiobus_write' arch/arm/mach-at91/built-in.o: In function `sama5_dt_device_init':
:(.init.text+0x1e34): undefined reference to `phy_register_fixup_for_uid'

when CONFIG_PHYLIB is not selected.
---
Changes in v2:
use IS_BUILTIN
use CONFIG_PHYLIB and not CONFIG_PHY

 arch/arm/mach-at91/board-dt-sama5.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-at91/board-dt-sama5.c +12 -10
index 705305e..e9ce541 100644
@@ -47,22 +47,24 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
 #define GMII_ERCR	11
 #define GMII_ERDWR	12
 
-	/* Set delay values */
-	value = GMII_RCCPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
-	value = 0xF2F4;
-	phy_write(phy, GMII_ERDWR, value);
-	value = GMII_RRDPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
-	value = 0x2222;
-	phy_write(phy, GMII_ERDWR, value);
+	if (IS_BUILTIN(CONFIG_PHYLIB)) {
+		/* Set delay values */
+		value = GMII_RCCPSR | 0x8000;
+		phy_write(phy, GMII_ERCR, value);
+		value = 0xF2F4;
+		phy_write(phy, GMII_ERDWR, value);
+		value = GMII_RRDPSR | 0x8000;
+		phy_write(phy, GMII_ERCR, value);
+		value = 0x2222;
+		phy_write(phy, GMII_ERDWR, value);
+	}
 
 	return 0;
 }
 
 static void __init sama5_dt_device_init(void)
 {
-	if (of_machine_is_compatible("atmel,sama5d3xcm"))
+	if (of_machine_is_compatible("atmel,sama5d3xcm") && IS_BUILTIN(CONFIG_PHYLIB))
 		phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
 			ksz9021rn_phy_fixup);
 
Signature · 1 line
1.8.1.2
#1 lore raw
Quoted 9 lines · Alexandre Belloni

Fixes:
arch/arm/mach-at91/built-in.o: In function `ksz9021rn_phy_fixup':
:(.text+0x1174): undefined reference to mdiobus_write' :(.text+0x1188): undefined reference to mdiobus_write' :(.text+0x119c): undefined reference to mdiobus_write' :(.text+0x11b0): undefined reference to mdiobus_write' arch/arm/mach-at91/built-in.o: In function `sama5_dt_device_init':
:(.init.text+0x1e34): undefined reference to `phy_register_fixup_for_uid'

Quoted 6 lines

when CONFIG_PHYLIB is not selected.
---
Changes in v2:
use IS_BUILTIN
use CONFIG_PHYLIB and not CONFIG_PHY

I do not like this, I prefer we just drop the fixup by adding the dt support to the micrel phy as done for broadcom

if !PHYLIB just add an inline declaration of
phy_register_fixup_for_uid

so gcc will drop ksz9021rn_phy_fixup automatically

Best Regards,
J.

Quoted 46 lines
 arch/arm/mach-at91/board-dt-sama5.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-at91/board-dt-sama5.c +12 -10
index 705305e..e9ce541 100644
@@ -47,22 +47,24 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
 #define GMII_ERCR	11
 #define GMII_ERDWR	12
 
-	/* Set delay values */
-	value = GMII_RCCPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
-	value = 0xF2F4;
-	phy_write(phy, GMII_ERDWR, value);
-	value = GMII_RRDPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
-	value = 0x2222;
-	phy_write(phy, GMII_ERDWR, value);
+	if (IS_BUILTIN(CONFIG_PHYLIB)) {
+		/* Set delay values */
+		value = GMII_RCCPSR | 0x8000;
+		phy_write(phy, GMII_ERCR, value);
+		value = 0xF2F4;
+		phy_write(phy, GMII_ERDWR, value);
+		value = GMII_RRDPSR | 0x8000;
+		phy_write(phy, GMII_ERCR, value);
+		value = 0x2222;
+		phy_write(phy, GMII_ERDWR, value);
+	}
 
 	return 0;
 }
 
 static void __init sama5_dt_device_init(void)
 {
-	if (of_machine_is_compatible("atmel,sama5d3xcm"))
+	if (of_machine_is_compatible("atmel,sama5d3xcm") && IS_BUILTIN(CONFIG_PHYLIB))
 		phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
 			ksz9021rn_phy_fixup);
 
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v2 1/1 ARM: at91: Fix link breakage when !CONFIG_PHYLIB

Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines · Alexandre Belloni

Fixes:
arch/arm/mach-at91/built-in.o: In function `ksz9021rn_phy_fixup':
:(.text+0x1174): undefined reference to mdiobus_write' :(.text+0x1188): undefined reference to mdiobus_write' :(.text+0x119c): undefined reference to mdiobus_write' :(.text+0x11b0): undefined reference to mdiobus_write' arch/arm/mach-at91/built-in.o: In function `sama5_dt_device_init':
:(.init.text+0x1e34): undefined reference to `phy_register_fixup_for_uid'

when CONFIG_PHYLIB is not selected.

Signed-off-by missing.

Quoted 9 lines
Quoted 5 lines

---
Changes in v2:
use IS_BUILTIN
use CONFIG_PHYLIB and not CONFIG_PHY

I do not like this, I prefer we just drop the fixup by adding the dt support to the micrel phy as done for broadcom

Yes it will be a better solution but we don't have it. Even if we add dt support for micrel phy it won't go into 3.10 so it has to be fixed before the release.

Quoted 58 lines

if !PHYLIB just add an inline declaration of
phy_register_fixup_for_uid

so gcc will drop ksz9021rn_phy_fixup automatically

Best Regards,
J.

Quoted 46 lines
 arch/arm/mach-at91/board-dt-sama5.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-at91/board-dt-sama5.c +12 -10
index 705305e..e9ce541 100644
@@ -47,22 +47,24 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
 #define GMII_ERCR	11
 #define GMII_ERDWR	12
 
-	/* Set delay values */
-	value = GMII_RCCPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
-	value = 0xF2F4;
-	phy_write(phy, GMII_ERDWR, value);
-	value = GMII_RRDPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
-	value = 0x2222;
-	phy_write(phy, GMII_ERDWR, value);
+	if (IS_BUILTIN(CONFIG_PHYLIB)) {
+		/* Set delay values */
+		value = GMII_RCCPSR | 0x8000;
+		phy_write(phy, GMII_ERCR, value);
+		value = 0xF2F4;
+		phy_write(phy, GMII_ERDWR, value);
+		value = GMII_RRDPSR | 0x8000;
+		phy_write(phy, GMII_ERCR, value);
+		value = 0x2222;
+		phy_write(phy, GMII_ERDWR, value);
+	}
 
 	return 0;
 }
 
 static void __init sama5_dt_device_init(void)
 {
-	if (of_machine_is_compatible("atmel,sama5d3xcm"))
+	if (of_machine_is_compatible("atmel,sama5d3xcm") && IS_BUILTIN(CONFIG_PHYLIB))
 		phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK,
 			ksz9021rn_phy_fixup);
 
Signature · 1 line
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 11 lines · Ludovic Desroches
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 9 lines · Alexandre Belloni

Fixes:
arch/arm/mach-at91/built-in.o: In function `ksz9021rn_phy_fixup':
:(.text+0x1174): undefined reference to mdiobus_write' :(.text+0x1188): undefined reference to mdiobus_write' :(.text+0x119c): undefined reference to mdiobus_write' :(.text+0x11b0): undefined reference to mdiobus_write' arch/arm/mach-at91/built-in.o: In function `sama5_dt_device_init':
:(.init.text+0x1e34): undefined reference to `phy_register_fixup_for_uid'

Quoted 5 lines
Quoted 1 line
Quoted 1 line

when CONFIG_PHYLIB is not selected.

Signed-off-by missing.

I'll send a v3...

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

---
Changes in v2:
use IS_BUILTIN
use CONFIG_PHYLIB and not CONFIG_PHY

I do not like this, I prefer we just drop the fixup by adding the dt support to the micrel phy as done for broadcom

Yes it will be a better solution but we don't have it. Even if we add dt support for micrel phy it won't go into 3.10 so it has to be fixed before the release.

The fixup is also done like that on i.mx6. I think we'll have to stick to that for now.

Quoted 4 lines
Quoted 4 lines

if !PHYLIB just add an inline declaration of
phy_register_fixup_for_uid

so gcc will drop ksz9021rn_phy_fixup automatically

By using IS_BUILTIN, gcc is already optimizing out the offeding lines, else you would still get the linking error.

Signature · 3 lines
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com