File tree Expand file tree Collapse file tree 3 files changed +58
-0
lines changed
drivers/net/dsa/mv88e6xxx Expand file tree Collapse file tree 3 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -2293,12 +2293,19 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
2293
2293
bus -> write = mv88e6xxx_mdio_write ;
2294
2294
bus -> parent = chip -> dev ;
2295
2295
2296
+ if (!external ) {
2297
+ err = mv88e6xxx_g2_irq_mdio_setup (chip , bus );
2298
+ if (err )
2299
+ return err ;
2300
+ }
2301
+
2296
2302
if (np )
2297
2303
err = of_mdiobus_register (bus , np );
2298
2304
else
2299
2305
err = mdiobus_register (bus );
2300
2306
if (err ) {
2301
2307
dev_err (chip -> dev , "Cannot register MDIO bus (%d)\n" , err );
2308
+ mv88e6xxx_g2_irq_mdio_free (chip , bus );
2302
2309
return err ;
2303
2310
}
2304
2311
@@ -2325,6 +2332,9 @@ static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip)
2325
2332
list_for_each_entry (mdio_bus , & chip -> mdios , list ) {
2326
2333
bus = mdio_bus -> bus ;
2327
2334
2335
+ if (!mdio_bus -> external )
2336
+ mv88e6xxx_g2_irq_mdio_free (chip , bus );
2337
+
2328
2338
mdiobus_unregister (bus );
2329
2339
}
2330
2340
}
Original file line number Diff line number Diff line change @@ -1107,6 +1107,38 @@ int mv88e6xxx_g2_irq_setup(struct mv88e6xxx_chip *chip)
1107
1107
return err ;
1108
1108
}
1109
1109
1110
+ int mv88e6xxx_g2_irq_mdio_setup (struct mv88e6xxx_chip * chip ,
1111
+ struct mii_bus * bus )
1112
+ {
1113
+ int phy , irq , err , err_phy ;
1114
+
1115
+ for (phy = 0 ; phy < chip -> info -> num_internal_phys ; phy ++ ) {
1116
+ irq = irq_find_mapping (chip -> g2_irq .domain , phy );
1117
+ if (irq < 0 ) {
1118
+ err = irq ;
1119
+ goto out ;
1120
+ }
1121
+ bus -> irq [chip -> info -> port_base_addr + phy ] = irq ;
1122
+ }
1123
+ return 0 ;
1124
+ out :
1125
+ err_phy = phy ;
1126
+
1127
+ for (phy = 0 ; phy < err_phy ; phy ++ )
1128
+ irq_dispose_mapping (bus -> irq [phy ]);
1129
+
1130
+ return err ;
1131
+ }
1132
+
1133
+ void mv88e6xxx_g2_irq_mdio_free (struct mv88e6xxx_chip * chip ,
1134
+ struct mii_bus * bus )
1135
+ {
1136
+ int phy ;
1137
+
1138
+ for (phy = 0 ; phy < chip -> info -> num_internal_phys ; phy ++ )
1139
+ irq_dispose_mapping (bus -> irq [phy ]);
1140
+ }
1141
+
1110
1142
int mv88e6xxx_g2_setup (struct mv88e6xxx_chip * chip )
1111
1143
{
1112
1144
u16 reg ;
Original file line number Diff line number Diff line change @@ -317,6 +317,11 @@ int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip);
317
317
int mv88e6xxx_g2_irq_setup (struct mv88e6xxx_chip * chip );
318
318
void mv88e6xxx_g2_irq_free (struct mv88e6xxx_chip * chip );
319
319
320
+ int mv88e6xxx_g2_irq_mdio_setup (struct mv88e6xxx_chip * chip ,
321
+ struct mii_bus * bus );
322
+ void mv88e6xxx_g2_irq_mdio_free (struct mv88e6xxx_chip * chip ,
323
+ struct mii_bus * bus );
324
+
320
325
int mv88e6185_g2_mgmt_rsvd2cpu (struct mv88e6xxx_chip * chip );
321
326
int mv88e6352_g2_mgmt_rsvd2cpu (struct mv88e6xxx_chip * chip );
322
327
@@ -450,6 +455,17 @@ static inline void mv88e6xxx_g2_irq_free(struct mv88e6xxx_chip *chip)
450
455
{
451
456
}
452
457
458
+ static inline int mv88e6xxx_g2_irq_mdio_setup (struct mv88e6xxx_chip * chip ,
459
+ struct mii_bus * bus )
460
+ {
461
+ return 0 ;
462
+ }
463
+
464
+ static inline void mv88e6xxx_g2_irq_mdio_free (struct mv88e6xxx_chip * chip ,
465
+ struct mii_bus * bus )
466
+ {
467
+ }
468
+
453
469
static inline int mv88e6185_g2_mgmt_rsvd2cpu (struct mv88e6xxx_chip * chip )
454
470
{
455
471
return - EOPNOTSUPP ;
You can’t perform that action at this time.
0 commit comments