@@ -995,14 +995,6 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
995
995
996
996
}
997
997
998
- static int mv88e6xxx_stats_set_histogram (struct mv88e6xxx_chip * chip )
999
- {
1000
- if (chip -> info -> ops -> stats_set_histogram )
1001
- return chip -> info -> ops -> stats_set_histogram (chip );
1002
-
1003
- return 0 ;
1004
- }
1005
-
1006
998
static int mv88e6xxx_get_regs_len (struct dsa_switch * ds , int port )
1007
999
{
1008
1000
return 32 * sizeof (u16 );
@@ -1104,6 +1096,25 @@ static void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port,
1104
1096
dev_err (ds -> dev , "p%d: failed to update state\n" , port );
1105
1097
}
1106
1098
1099
+ static int mv88e6xxx_pri_setup (struct mv88e6xxx_chip * chip )
1100
+ {
1101
+ int err ;
1102
+
1103
+ if (chip -> info -> ops -> ieee_pri_map ) {
1104
+ err = chip -> info -> ops -> ieee_pri_map (chip );
1105
+ if (err )
1106
+ return err ;
1107
+ }
1108
+
1109
+ if (chip -> info -> ops -> ip_pri_map ) {
1110
+ err = chip -> info -> ops -> ip_pri_map (chip );
1111
+ if (err )
1112
+ return err ;
1113
+ }
1114
+
1115
+ return 0 ;
1116
+ }
1117
+
1107
1118
static int mv88e6xxx_devmap_setup (struct mv88e6xxx_chip * chip )
1108
1119
{
1109
1120
int target , port ;
@@ -2248,45 +2259,16 @@ static int mv88e6xxx_set_ageing_time(struct dsa_switch *ds,
2248
2259
return err ;
2249
2260
}
2250
2261
2251
- static int mv88e6xxx_g1_setup (struct mv88e6xxx_chip * chip )
2262
+ static int mv88e6xxx_stats_setup (struct mv88e6xxx_chip * chip )
2252
2263
{
2253
2264
int err ;
2254
2265
2255
- /* Configure the IP ToS mapping registers. */
2256
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_0 , 0x0000 );
2257
- if (err )
2258
- return err ;
2259
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_1 , 0x0000 );
2260
- if (err )
2261
- return err ;
2262
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_2 , 0x5555 );
2263
- if (err )
2264
- return err ;
2265
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_3 , 0x5555 );
2266
- if (err )
2267
- return err ;
2268
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_4 , 0xaaaa );
2269
- if (err )
2270
- return err ;
2271
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_5 , 0xaaaa );
2272
- if (err )
2273
- return err ;
2274
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_6 , 0xffff );
2275
- if (err )
2276
- return err ;
2277
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IP_PRI_7 , 0xffff );
2278
- if (err )
2279
- return err ;
2280
-
2281
- /* Configure the IEEE 802.1p priority mapping register. */
2282
- err = mv88e6xxx_g1_write (chip , MV88E6XXX_G1_IEEE_PRI , 0xfa41 );
2283
- if (err )
2284
- return err ;
2285
-
2286
2266
/* Initialize the statistics unit */
2287
- err = mv88e6xxx_stats_set_histogram (chip );
2288
- if (err )
2289
- return err ;
2267
+ if (chip -> info -> ops -> stats_set_histogram ) {
2268
+ err = chip -> info -> ops -> stats_set_histogram (chip );
2269
+ if (err )
2270
+ return err ;
2271
+ }
2290
2272
2291
2273
return mv88e6xxx_g1_stats_clear (chip );
2292
2274
}
@@ -2312,11 +2294,6 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
2312
2294
goto unlock ;
2313
2295
}
2314
2296
2315
- /* Setup Switch Global 1 Registers */
2316
- err = mv88e6xxx_g1_setup (chip );
2317
- if (err )
2318
- goto unlock ;
2319
-
2320
2297
err = mv88e6xxx_irl_setup (chip );
2321
2298
if (err )
2322
2299
goto unlock ;
@@ -2365,6 +2342,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
2365
2342
if (err )
2366
2343
goto unlock ;
2367
2344
2345
+ err = mv88e6xxx_pri_setup (chip );
2346
+ if (err )
2347
+ goto unlock ;
2348
+
2368
2349
/* Setup PTP Hardware Clock and timestamping */
2369
2350
if (chip -> info -> ptp_support ) {
2370
2351
err = mv88e6xxx_ptp_setup (chip );
@@ -2376,6 +2357,10 @@ static int mv88e6xxx_setup(struct dsa_switch *ds)
2376
2357
goto unlock ;
2377
2358
}
2378
2359
2360
+ err = mv88e6xxx_stats_setup (chip );
2361
+ if (err )
2362
+ goto unlock ;
2363
+
2379
2364
unlock :
2380
2365
mutex_unlock (& chip -> reg_lock );
2381
2366
@@ -2592,6 +2577,8 @@ static int mv88e6xxx_set_eeprom(struct dsa_switch *ds,
2592
2577
2593
2578
static const struct mv88e6xxx_ops mv88e6085_ops = {
2594
2579
/* MV88E6XXX_FAMILY_6097 */
2580
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2581
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2595
2582
.irl_init_all = mv88e6352_g2_irl_init_all ,
2596
2583
.set_switch_mac = mv88e6xxx_g1_set_switch_mac ,
2597
2584
.phy_read = mv88e6185_phy_ppu_read ,
@@ -2628,6 +2615,8 @@ static const struct mv88e6xxx_ops mv88e6085_ops = {
2628
2615
2629
2616
static const struct mv88e6xxx_ops mv88e6095_ops = {
2630
2617
/* MV88E6XXX_FAMILY_6095 */
2618
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2619
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2631
2620
.set_switch_mac = mv88e6xxx_g1_set_switch_mac ,
2632
2621
.phy_read = mv88e6185_phy_ppu_read ,
2633
2622
.phy_write = mv88e6185_phy_ppu_write ,
@@ -2652,6 +2641,8 @@ static const struct mv88e6xxx_ops mv88e6095_ops = {
2652
2641
2653
2642
static const struct mv88e6xxx_ops mv88e6097_ops = {
2654
2643
/* MV88E6XXX_FAMILY_6097 */
2644
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2645
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2655
2646
.irl_init_all = mv88e6352_g2_irl_init_all ,
2656
2647
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
2657
2648
.phy_read = mv88e6xxx_g2_smi_phy_read ,
@@ -2686,6 +2677,8 @@ static const struct mv88e6xxx_ops mv88e6097_ops = {
2686
2677
2687
2678
static const struct mv88e6xxx_ops mv88e6123_ops = {
2688
2679
/* MV88E6XXX_FAMILY_6165 */
2680
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2681
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2689
2682
.irl_init_all = mv88e6352_g2_irl_init_all ,
2690
2683
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
2691
2684
.phy_read = mv88e6xxx_g2_smi_phy_read ,
@@ -2714,6 +2707,8 @@ static const struct mv88e6xxx_ops mv88e6123_ops = {
2714
2707
2715
2708
static const struct mv88e6xxx_ops mv88e6131_ops = {
2716
2709
/* MV88E6XXX_FAMILY_6185 */
2710
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2711
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2717
2712
.set_switch_mac = mv88e6xxx_g1_set_switch_mac ,
2718
2713
.phy_read = mv88e6185_phy_ppu_read ,
2719
2714
.phy_write = mv88e6185_phy_ppu_write ,
@@ -2747,6 +2742,8 @@ static const struct mv88e6xxx_ops mv88e6131_ops = {
2747
2742
2748
2743
static const struct mv88e6xxx_ops mv88e6141_ops = {
2749
2744
/* MV88E6XXX_FAMILY_6341 */
2745
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2746
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2750
2747
.irl_init_all = mv88e6352_g2_irl_init_all ,
2751
2748
.get_eeprom = mv88e6xxx_g2_get_eeprom8 ,
2752
2749
.set_eeprom = mv88e6xxx_g2_set_eeprom8 ,
@@ -2784,6 +2781,8 @@ static const struct mv88e6xxx_ops mv88e6141_ops = {
2784
2781
2785
2782
static const struct mv88e6xxx_ops mv88e6161_ops = {
2786
2783
/* MV88E6XXX_FAMILY_6165 */
2784
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2785
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2787
2786
.irl_init_all = mv88e6352_g2_irl_init_all ,
2788
2787
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
2789
2788
.phy_read = mv88e6xxx_g2_smi_phy_read ,
@@ -2817,6 +2816,8 @@ static const struct mv88e6xxx_ops mv88e6161_ops = {
2817
2816
2818
2817
static const struct mv88e6xxx_ops mv88e6165_ops = {
2819
2818
/* MV88E6XXX_FAMILY_6165 */
2819
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2820
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2820
2821
.irl_init_all = mv88e6352_g2_irl_init_all ,
2821
2822
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
2822
2823
.phy_read = mv88e6165_phy_read ,
@@ -2843,6 +2844,8 @@ static const struct mv88e6xxx_ops mv88e6165_ops = {
2843
2844
2844
2845
static const struct mv88e6xxx_ops mv88e6171_ops = {
2845
2846
/* MV88E6XXX_FAMILY_6351 */
2847
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2848
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2846
2849
.irl_init_all = mv88e6352_g2_irl_init_all ,
2847
2850
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
2848
2851
.phy_read = mv88e6xxx_g2_smi_phy_read ,
@@ -2877,6 +2880,8 @@ static const struct mv88e6xxx_ops mv88e6171_ops = {
2877
2880
2878
2881
static const struct mv88e6xxx_ops mv88e6172_ops = {
2879
2882
/* MV88E6XXX_FAMILY_6352 */
2883
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2884
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2880
2885
.irl_init_all = mv88e6352_g2_irl_init_all ,
2881
2886
.get_eeprom = mv88e6xxx_g2_get_eeprom16 ,
2882
2887
.set_eeprom = mv88e6xxx_g2_set_eeprom16 ,
@@ -2916,6 +2921,8 @@ static const struct mv88e6xxx_ops mv88e6172_ops = {
2916
2921
2917
2922
static const struct mv88e6xxx_ops mv88e6175_ops = {
2918
2923
/* MV88E6XXX_FAMILY_6351 */
2924
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2925
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2919
2926
.irl_init_all = mv88e6352_g2_irl_init_all ,
2920
2927
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
2921
2928
.phy_read = mv88e6xxx_g2_smi_phy_read ,
@@ -2951,6 +2958,8 @@ static const struct mv88e6xxx_ops mv88e6175_ops = {
2951
2958
2952
2959
static const struct mv88e6xxx_ops mv88e6176_ops = {
2953
2960
/* MV88E6XXX_FAMILY_6352 */
2961
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
2962
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2954
2963
.irl_init_all = mv88e6352_g2_irl_init_all ,
2955
2964
.get_eeprom = mv88e6xxx_g2_get_eeprom16 ,
2956
2965
.set_eeprom = mv88e6xxx_g2_set_eeprom16 ,
@@ -2990,6 +2999,8 @@ static const struct mv88e6xxx_ops mv88e6176_ops = {
2990
2999
2991
3000
static const struct mv88e6xxx_ops mv88e6185_ops = {
2992
3001
/* MV88E6XXX_FAMILY_6185 */
3002
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3003
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
2993
3004
.set_switch_mac = mv88e6xxx_g1_set_switch_mac ,
2994
3005
.phy_read = mv88e6185_phy_ppu_read ,
2995
3006
.phy_write = mv88e6185_phy_ppu_write ,
@@ -3129,6 +3140,8 @@ static const struct mv88e6xxx_ops mv88e6191_ops = {
3129
3140
3130
3141
static const struct mv88e6xxx_ops mv88e6240_ops = {
3131
3142
/* MV88E6XXX_FAMILY_6352 */
3143
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3144
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
3132
3145
.irl_init_all = mv88e6352_g2_irl_init_all ,
3133
3146
.get_eeprom = mv88e6xxx_g2_get_eeprom16 ,
3134
3147
.set_eeprom = mv88e6xxx_g2_set_eeprom16 ,
@@ -3208,6 +3221,8 @@ static const struct mv88e6xxx_ops mv88e6290_ops = {
3208
3221
3209
3222
static const struct mv88e6xxx_ops mv88e6320_ops = {
3210
3223
/* MV88E6XXX_FAMILY_6320 */
3224
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3225
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
3211
3226
.irl_init_all = mv88e6352_g2_irl_init_all ,
3212
3227
.get_eeprom = mv88e6xxx_g2_get_eeprom16 ,
3213
3228
.set_eeprom = mv88e6xxx_g2_set_eeprom16 ,
@@ -3244,6 +3259,8 @@ static const struct mv88e6xxx_ops mv88e6320_ops = {
3244
3259
3245
3260
static const struct mv88e6xxx_ops mv88e6321_ops = {
3246
3261
/* MV88E6XXX_FAMILY_6320 */
3262
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3263
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
3247
3264
.irl_init_all = mv88e6352_g2_irl_init_all ,
3248
3265
.get_eeprom = mv88e6xxx_g2_get_eeprom16 ,
3249
3266
.set_eeprom = mv88e6xxx_g2_set_eeprom16 ,
@@ -3278,6 +3295,8 @@ static const struct mv88e6xxx_ops mv88e6321_ops = {
3278
3295
3279
3296
static const struct mv88e6xxx_ops mv88e6341_ops = {
3280
3297
/* MV88E6XXX_FAMILY_6341 */
3298
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3299
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
3281
3300
.irl_init_all = mv88e6352_g2_irl_init_all ,
3282
3301
.get_eeprom = mv88e6xxx_g2_get_eeprom8 ,
3283
3302
.set_eeprom = mv88e6xxx_g2_set_eeprom8 ,
@@ -3316,6 +3335,8 @@ static const struct mv88e6xxx_ops mv88e6341_ops = {
3316
3335
3317
3336
static const struct mv88e6xxx_ops mv88e6350_ops = {
3318
3337
/* MV88E6XXX_FAMILY_6351 */
3338
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3339
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
3319
3340
.irl_init_all = mv88e6352_g2_irl_init_all ,
3320
3341
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
3321
3342
.phy_read = mv88e6xxx_g2_smi_phy_read ,
@@ -3350,6 +3371,8 @@ static const struct mv88e6xxx_ops mv88e6350_ops = {
3350
3371
3351
3372
static const struct mv88e6xxx_ops mv88e6351_ops = {
3352
3373
/* MV88E6XXX_FAMILY_6351 */
3374
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3375
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
3353
3376
.irl_init_all = mv88e6352_g2_irl_init_all ,
3354
3377
.set_switch_mac = mv88e6xxx_g2_set_switch_mac ,
3355
3378
.phy_read = mv88e6xxx_g2_smi_phy_read ,
@@ -3385,6 +3408,8 @@ static const struct mv88e6xxx_ops mv88e6351_ops = {
3385
3408
3386
3409
static const struct mv88e6xxx_ops mv88e6352_ops = {
3387
3410
/* MV88E6XXX_FAMILY_6352 */
3411
+ .ieee_pri_map = mv88e6085_g1_ieee_pri_map ,
3412
+ .ip_pri_map = mv88e6085_g1_ip_pri_map ,
3388
3413
.irl_init_all = mv88e6352_g2_irl_init_all ,
3389
3414
.get_eeprom = mv88e6xxx_g2_get_eeprom16 ,
3390
3415
.set_eeprom = mv88e6xxx_g2_set_eeprom16 ,
0 commit comments