Skip to content

Commit 9c4d234

Browse files
roylee123lguohan
authored andcommitted
[device][accton]: add support for as7312-54xs (sonic-net#3140)
* Add driver and util for peripherals of as7312-54xs, most are copied from as7312-54s. Signed-off-by: roy_lee <[email protected]> * Add default port speed and index from 1. Signed-off-by: roy_lee <[email protected]> * Update i2c addr of psus. Add system logging for monitor. Signed-off-by: roy_lee <[email protected]> * Correct syntax of module_dirs. Signed-off-by: roy_lee <[email protected]> * Validate sfputil after tested. Signed-off-by: roy_lee <[email protected]> * Correct the index of eeprom mapping. Signed-off-by: roy_lee <[email protected]>
1 parent ef3b817 commit 9c4d234

21 files changed

Lines changed: 6217 additions & 154 deletions

File tree

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
# name lanes alias index
2-
Ethernet0 41 twentyfiveGigE1 0
3-
Ethernet1 42 twentyfiveGigE2 1
4-
Ethernet2 43 twentyfiveGigE3 2
5-
Ethernet3 44 twentyfiveGigE4 3
6-
Ethernet4 49 twentyfiveGigE5 4
7-
Ethernet5 50 twentyfiveGigE6 5
8-
Ethernet6 51 twentyfiveGigE7 6
9-
Ethernet7 52 twentyfiveGigE8 7
10-
Ethernet8 53 twentyfiveGigE9 8
11-
Ethernet9 54 twentyfiveGigE10 9
12-
Ethernet10 55 twentyfiveGigE11 10
13-
Ethernet11 56 twentyfiveGigE12 11
14-
Ethernet12 65 twentyfiveGigE13 12
15-
Ethernet13 66 twentyfiveGigE14 13
16-
Ethernet14 67 twentyfiveGigE15 14
17-
Ethernet15 68 twentyfiveGigE16 15
18-
Ethernet16 33 twentyfiveGigE17 16
19-
Ethernet17 34 twentyfiveGigE18 17
20-
Ethernet18 35 twentyfiveGigE19 18
21-
Ethernet19 36 twentyfiveGigE20 19
22-
Ethernet20 37 twentyfiveGigE21 20
23-
Ethernet21 38 twentyfiveGigE22 21
24-
Ethernet22 39 twentyfiveGigE23 22
25-
Ethernet23 40 twentyfiveGigE24 23
26-
Ethernet24 69 twentyfiveGigE25 24
27-
Ethernet25 70 twentyfiveGigE26 25
28-
Ethernet26 71 twentyfiveGigE27 26
29-
Ethernet27 72 twentyfiveGigE28 27
30-
Ethernet28 81 twentyfiveGigE29 28
31-
Ethernet29 82 twentyfiveGigE30 29
32-
Ethernet30 83 twentyfiveGigE31 30
33-
Ethernet31 84 twentyfiveGigE32 31
34-
Ethernet32 85 twentyfiveGigE33 32
35-
Ethernet33 86 twentyfiveGigE34 33
36-
Ethernet34 87 twentyfiveGigE35 34
37-
Ethernet35 88 twentyfiveGigE36 35
38-
Ethernet36 97 twentyfiveGigE37 36
39-
Ethernet37 98 twentyfiveGigE38 37
40-
Ethernet38 99 twentyfiveGigE39 38
41-
Ethernet39 100 twentyfiveGigE40 39
42-
Ethernet40 101 twentyfiveGigE41 40
43-
Ethernet41 102 twentyfiveGigE42 41
44-
Ethernet42 103 twentyfiveGigE43 42
45-
Ethernet43 104 twentyfiveGigE44 43
46-
Ethernet44 105 twentyfiveGigE45 44
47-
Ethernet45 106 twentyfiveGigE46 45
48-
Ethernet46 107 twentyfiveGigE47 46
49-
Ethernet47 108 twentyfiveGigE48 47
50-
Ethernet48 5,6,7,8 hundredGigE49 48
51-
Ethernet52 1,2,3,4 hundredGigE50 52
52-
Ethernet56 109,110,111,112 hundredGigE51 56
53-
Ethernet60 21,22,23,24 hundredGigE52 60
54-
Ethernet64 9,10,11,12 hundredGigE53 64
55-
Ethernet68 117,118,119,120 hundredGigE54 68
1+
# name lanes alias index speed
2+
Ethernet0 41 twentyfiveGigE1 1 25000
3+
Ethernet1 42 twentyfiveGigE2 2 25000
4+
Ethernet2 43 twentyfiveGigE3 3 25000
5+
Ethernet3 44 twentyfiveGigE4 4 25000
6+
Ethernet4 49 twentyfiveGigE5 5 25000
7+
Ethernet5 50 twentyfiveGigE6 6 25000
8+
Ethernet6 51 twentyfiveGigE7 7 25000
9+
Ethernet7 52 twentyfiveGigE8 8 25000
10+
Ethernet8 53 twentyfiveGigE9 9 25000
11+
Ethernet9 54 twentyfiveGigE10 10 25000
12+
Ethernet10 55 twentyfiveGigE11 11 25000
13+
Ethernet11 56 twentyfiveGigE12 12 25000
14+
Ethernet12 65 twentyfiveGigE13 13 25000
15+
Ethernet13 66 twentyfiveGigE14 14 25000
16+
Ethernet14 67 twentyfiveGigE15 15 25000
17+
Ethernet15 68 twentyfiveGigE16 16 25000
18+
Ethernet16 33 twentyfiveGigE17 17 25000
19+
Ethernet17 34 twentyfiveGigE18 18 25000
20+
Ethernet18 35 twentyfiveGigE19 19 25000
21+
Ethernet19 36 twentyfiveGigE20 20 25000
22+
Ethernet20 37 twentyfiveGigE21 21 25000
23+
Ethernet21 38 twentyfiveGigE22 22 25000
24+
Ethernet22 39 twentyfiveGigE23 23 25000
25+
Ethernet23 40 twentyfiveGigE24 24 25000
26+
Ethernet24 69 twentyfiveGigE25 25 25000
27+
Ethernet25 70 twentyfiveGigE26 26 25000
28+
Ethernet26 71 twentyfiveGigE27 27 25000
29+
Ethernet27 72 twentyfiveGigE28 28 25000
30+
Ethernet28 81 twentyfiveGigE29 29 25000
31+
Ethernet29 82 twentyfiveGigE30 30 25000
32+
Ethernet30 83 twentyfiveGigE31 31 25000
33+
Ethernet31 84 twentyfiveGigE32 32 25000
34+
Ethernet32 85 twentyfiveGigE33 33 25000
35+
Ethernet33 86 twentyfiveGigE34 34 25000
36+
Ethernet34 87 twentyfiveGigE35 35 25000
37+
Ethernet35 88 twentyfiveGigE36 36 25000
38+
Ethernet36 97 twentyfiveGigE37 37 25000
39+
Ethernet37 98 twentyfiveGigE38 38 25000
40+
Ethernet38 99 twentyfiveGigE39 39 25000
41+
Ethernet39 100 twentyfiveGigE40 40 25000
42+
Ethernet40 101 twentyfiveGigE41 41 25000
43+
Ethernet41 102 twentyfiveGigE42 42 25000
44+
Ethernet42 103 twentyfiveGigE43 43 25000
45+
Ethernet43 104 twentyfiveGigE44 44 25000
46+
Ethernet44 105 twentyfiveGigE45 45 25000
47+
Ethernet45 106 twentyfiveGigE46 46 25000
48+
Ethernet46 107 twentyfiveGigE47 47 25000
49+
Ethernet47 108 twentyfiveGigE48 48 25000
50+
Ethernet48 5,6,7,8 hundredGigE49 49 100000
51+
Ethernet52 1,2,3,4 hundredGigE50 50 100000
52+
Ethernet56 109,110,111,112 hundredGigE51 51 100000
53+
Ethernet60 21,22,23,24 hundredGigE52 52 100000
54+
Ethernet64 9,10,11,12 hundredGigE53 53 100000
55+
Ethernet68 117,118,119,120 hundredGigE54 54 100000

device/accton/x86_64-accton_as7312_54xs-r0/plugins/sfputil.py

Lines changed: 64 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
class SfpUtil(SfpUtilBase):
1616
"""Platform-specific SfpUtil class"""
1717

18-
PORT_START = 0
19-
PORT_END = 71
20-
PORTS_IN_BLOCK = 72
21-
QSFP_PORT_START = 48
22-
QSFP_PORT_END = 72
18+
PORT_START = 1
19+
PORT_END = 54
20+
PORTS_IN_BLOCK = 54
21+
QSFP_PORT_START = 49
22+
QSFP_PORT_END = 54
2323

2424
BASE_VAL_PATH = "/sys/class/i2c-adapter/i2c-{0}/{1}-0050/"
2525

@@ -33,78 +33,60 @@ class SfpUtil(SfpUtilBase):
3333
2: "6-0064",
3434
}
3535
_port_to_i2c_mapping = {
36-
0: 18,
37-
1: 19,
38-
2: 20,
39-
3: 21,
40-
4: 22,
41-
5: 23,
42-
6: 24,
43-
7: 25,
44-
8: 26,
45-
9: 27,
46-
10: 28,
47-
11: 29,
48-
12: 30,
49-
13: 31,
50-
14: 32,
51-
15: 33,
52-
16: 34,
53-
17: 35,
54-
18: 36,
55-
19: 37,
56-
20: 38,
57-
21: 39,
58-
22: 40,
59-
23: 41,
60-
24: 42,
61-
25: 43,
62-
26: 44,
63-
27: 45,
64-
28: 46,
65-
29: 47,
66-
30: 48,
67-
31: 49,
68-
32: 50,
69-
33: 51,
70-
34: 52,
71-
35: 53,
72-
36: 54,
73-
37: 55,
74-
38: 56,
75-
39: 57,
76-
40: 58,
77-
41: 59,
78-
42: 60,
79-
43: 61,
80-
44: 62,
81-
45: 63,
82-
46: 64,
83-
47: 65,
84-
48: 66, #QSFP49
85-
49: 66,
86-
50: 66,
87-
51: 66,
88-
52: 67, #QSFP50
89-
53: 67,
90-
54: 67,
91-
55: 67,
92-
56: 68, #QSFP51
93-
57: 68,
94-
58: 68,
95-
59: 68,
96-
60: 69, #QSFP52
97-
61: 69,
98-
62: 69,
99-
63: 69,
100-
64: 70, #QSFP53
101-
65: 70,
102-
66: 70,
103-
67: 70,
104-
68: 71, #QSFP54
105-
69: 71,
106-
70: 71,
107-
71: 71,
36+
1: 18,
37+
2: 19,
38+
3: 20,
39+
4: 21,
40+
5: 22,
41+
6: 23,
42+
7: 24,
43+
8: 25,
44+
9: 26,
45+
10: 27,
46+
11: 28,
47+
12: 29,
48+
13: 30,
49+
14: 31,
50+
15: 32,
51+
16: 33,
52+
17: 34,
53+
18: 35,
54+
19: 36,
55+
20: 37,
56+
21: 38,
57+
22: 39,
58+
23: 40,
59+
24: 41,
60+
25: 42,
61+
26: 43,
62+
27: 44,
63+
28: 45,
64+
29: 46,
65+
30: 47,
66+
31: 48,
67+
32: 49,
68+
33: 50,
69+
34: 51,
70+
35: 52,
71+
36: 53,
72+
37: 54,
73+
38: 55,
74+
39: 56,
75+
40: 57,
76+
41: 58,
77+
42: 59,
78+
43: 60,
79+
44: 61,
80+
45: 62,
81+
46: 63,
82+
47: 64,
83+
48: 65,
84+
49: 66, #QSFP49
85+
50: 67,
86+
51: 68,
87+
52: 69,
88+
53: 70,
89+
54: 71, #QSFP54
10890
}
10991

11092
@property
@@ -133,30 +115,18 @@ def port_to_eeprom_mapping(self):
133115

134116
def __init__(self):
135117
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/eeprom'
136-
for x in range(0, self.port_end+1):
118+
for x in range(self.port_start, self.port_end+1):
137119
self.port_to_eeprom_mapping[x] = eeprom_path.format(
138120
self._port_to_i2c_mapping[x])
139121

140122
SfpUtilBase.__init__(self)
141123

142-
143-
# For port 48~51 are QSFP, here presumed they're all split to 4 lanes.
144-
def get_cage_num(self, port_num):
145-
cage_num = port_num
146-
if (port_num >= self.QSFP_PORT_START):
147-
cage_num = (port_num - self.QSFP_PORT_START)/4
148-
cage_num = cage_num + self.QSFP_PORT_START
149-
150-
return cage_num
151-
152-
# For cage 0~23 and 48~51 are at cpld2, others are at cpld3.
153124
def get_cpld_num(self, port_num):
154125
cpld_i = 1
155-
cage_num = self.get_cage_num(port_num)
156-
if (port_num > 23 and port_num < self.QSFP_PORT_START):
126+
if (port_num > 24 and port_num < self.qsfp_port_start):
157127
cpld_i = 2
158128

159-
if (cage_num >= 52):
129+
if (port_num > 52):
160130
cpld_i = 2
161131

162132
return cpld_i
@@ -166,12 +136,11 @@ def get_presence(self, port_num):
166136
if port_num < self.port_start or port_num > self.port_end:
167137
return False
168138

169-
cage_num = self.get_cage_num(port_num)
170139
cpld_i = self.get_cpld_num(port_num)
171140

172141
cpld_ps = self._cpld_mapping[cpld_i]
173142
path = "/sys/bus/i2c/devices/{0}/module_present_{1}"
174-
port_ps = path.format(cpld_ps, cage_num+1)
143+
port_ps = path.format(cpld_ps, port_num)
175144

176145
try:
177146
val_file = open(port_ps)
@@ -250,11 +219,10 @@ def reset(self, port_num):
250219
if port_num < self.qsfp_port_start or port_num > self.qsfp_port_end:
251220
return False
252221

253-
cage_num = self.get_cage_num(port_num)
254222
cpld_i = self.get_cpld_num(port_num)
255223
cpld_ps = self._cpld_mapping[cpld_i]
256224
path = "/sys/bus/i2c/devices/{0}/module_reset_{1}"
257-
port_ps = path.format(cpld_ps, cage_num+1)
225+
port_ps = path.format(cpld_ps, port_num)
258226
try:
259227
reg_file = open(port_ps, 'w')
260228
except IOError as e:

platform/broadcom/one-image.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
2929
$(ACCTON_AS5835_54X_PLATFORM_MODULE) \
3030
$(ACCTON_AS9716_32D_PLATFORM_MODULE) \
3131
$(ACCTON_AS5835_54T_PLATFORM_MODULE) \
32+
$(ACCTON_AS7312_54XS_PLATFORM_MODULE) \
3233
$(INVENTEC_D7032Q28B_PLATFORM_MODULE) \
3334
$(INVENTEC_D7054Q28B_PLATFORM_MODULE) \
3435
$(INVENTEC_D7264Q28B_PLATFORM_MODULE) \

platform/broadcom/platform-modules-accton.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ ACCTON_AS5812_54X_PLATFORM_MODULE_VERSION = 1.1
1515
ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION = 1.1
1616
ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION = 1.1
1717
ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION = 1.1
18+
ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION = 1.1
1819

1920
export ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION
2021
export ACCTON_AS5712_54X_PLATFORM_MODULE_VERSION
@@ -31,6 +32,7 @@ export ACCTON_AS5812_54X_PLATFORM_MODULE_VERSION
3132
export ACCTON_AS5835_54X_PLATFORM_MODULE_VERSION
3233
export ACCTON_AS9716_32D_PLATFORM_MODULE_VERSION
3334
export ACCTON_AS5835_54T_PLATFORM_MODULE_VERSION
35+
export ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION
3436

3537
ACCTON_AS7712_32X_PLATFORM_MODULE = sonic-platform-accton-as7712-32x_$(ACCTON_AS7712_32X_PLATFORM_MODULE_VERSION)_amd64.deb
3638
$(ACCTON_AS7712_32X_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-accton
@@ -54,6 +56,10 @@ ACCTON_AS7312_54X_PLATFORM_MODULE = sonic-platform-accton-as7312-54x_$(ACCTON_AS
5456
$(ACCTON_AS7312_54X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7312_54x-r0
5557
$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7312_54X_PLATFORM_MODULE)))
5658

59+
ACCTON_AS7312_54XS_PLATFORM_MODULE = sonic-platform-accton-as7312-54xs_$(ACCTON_AS7312_54XS_PLATFORM_MODULE_VERSION)_amd64.deb
60+
$(ACCTON_AS7312_54XS_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7312_54xs-r0
61+
$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7312_54XS_PLATFORM_MODULE)))
62+
5763
ACCTON_AS7326_56X_PLATFORM_MODULE = sonic-platform-accton-as7326-56x_$(ACCTON_AS7326_56X_PLATFORM_MODULE_VERSION)_amd64.deb
5864
$(ACCTON_AS7326_56X_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as7326_56x-r0
5965
$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS7326_56X_PLATFORM_MODULE)))
@@ -74,7 +80,6 @@ ACCTON_AS4630_54PE_PLATFORM_MODULE = sonic-platform-accton-as4630-54pe_$(ACCTON_
7480
$(ACCTON_AS4630_54PE_PLATFORM_MODULE)_PLATFORM = x86_64-accton_as4630_54pe-r0
7581
$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_AS4630_54PE_PLATFORM_MODULE)))
7682

77-
7883
ACCTON_MINIPACK_PLATFORM_MODULE = sonic-platform-accton-minipack_$(ACCTON_MINIPACK_PLATFORM_MODULE_VERSION)_amd64.deb
7984
$(ACCTON_MINIPACK_PLATFORM_MODULE)_PLATFORM = x86_64-accton_minipack-r0
8085
$(eval $(call add_extra_package,$(ACCTON_AS7712_32X_PLATFORM_MODULE),$(ACCTON_MINIPACK_PLATFORM_MODULE)))

platform/broadcom/sonic-platform-modules-accton/as7312-54xs/classes/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)