[Celestica/Seastone2] Add support Seastone2 device and platform (#3761)

* [device/celestica] Add seastone2 device specific plugins and SKU

* [platform/broadcom] Add Celestica seastone2 platform module

* update minigraph for Seastone_2 and remove 10KR port configuration

* [device/celestica] hwsku:Seastone2 update port configuration

* [plugins/psuutil] fix psutuil cannot run in pmon docker

* [plugins/sfputil] raise error in get_transceiver_change_event

* [device/celestica] Seastone2 add config to skip ledd in pmon

Co-authored-by: tiantianlv <38775940+tiantianlv@users.noreply.github.com>
This commit is contained in:
Pradchaya Phucharoen 2020-01-16 10:42:09 +08:00 committed by lguohan
parent 6bd17d4780
commit 522916397d
27 changed files with 3695 additions and 3 deletions

View File

@ -0,0 +1,33 @@
# name lanes alias fec index speed
Ethernet0 1,2,3,4 QSFP1 rs 1 100000
Ethernet4 5,6,7,8 QSFP2 rs 2 100000
Ethernet8 9,10,11,12 QSFP3 rs 3 100000
Ethernet12 13,14,15,16 QSFP4 rs 4 100000
Ethernet16 17,18,19,20 QSFP5 rs 5 100000
Ethernet20 21,22,23,24 QSFP6 rs 6 100000
Ethernet24 25,26,27,28 QSFP7 rs 7 100000
Ethernet28 29,30,31,32 QSFP8 rs 8 100000
Ethernet32 33,34,35,36 QSFP9 rs 9 100000
Ethernet36 37,38,39,40 QSFP10 rs 10 100000
Ethernet40 41,42,43,44 QSFP11 rs 11 100000
Ethernet44 45,46,47,48 QSFP12 rs 12 100000
Ethernet48 49,50,51,52 QSFP13 rs 13 100000
Ethernet52 53,54,55,56 QSFP14 rs 14 100000
Ethernet56 57,58,59,60 QSFP15 rs 15 100000
Ethernet60 61,62,63,64 QSFP16 rs 16 100000
Ethernet64 65,66,67,68 QSFP17 rs 17 100000
Ethernet68 69,70,71,72 QSFP18 rs 18 100000
Ethernet72 73,74,75,76 QSFP19 rs 19 100000
Ethernet76 77,78,79,80 QSFP20 rs 20 100000
Ethernet80 81,82,83,84 QSFP21 rs 21 100000
Ethernet84 85,86,87,88 QSFP22 rs 22 100000
Ethernet88 89,90,91,92 QSFP23 rs 23 100000
Ethernet92 93,94,95,96 QSFP24 rs 24 100000
Ethernet96 97,98,99,100 QSFP25 rs 25 100000
Ethernet100 101,102,103,104 QSFP26 rs 26 100000
Ethernet104 105,106,107,108 QSFP27 rs 27 100000
Ethernet108 109,110,111,112 QSFP28 rs 28 100000
Ethernet112 113,114,115,116 QSFP29 rs 29 100000
Ethernet116 117,118,119,120 QSFP30 rs 30 100000
Ethernet120 121,122,123,124 QSFP31 rs 31 100000
Ethernet124 125,126,127,128 QSFP32 rs 32 100000

View File

@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-seastone_2-32x100G.config.bcm

View File

@ -0,0 +1,597 @@
help_cli_enable=1
ifp_inports_support_enable=1
ipv6_lpm_128b_enable=0x1
l2_mem_entries=32768
l2xmsg_mode=1
l3_max_ecmp_mode=1
l3_mem_entries=16384
lpm_scaling_enable=1
max_vp_lags=0
mem_cache_enable=0
memlist_enable=1
miim_intr_enable=0
module_64ports=1
oversubscribe_mode=1
parity_enable=0
serdes_lane_config_dfe=on
#serdes_fec_enable=1
serdes_if_type_ce=14
pbmp_gport_stack.0=0x0000000000000000000000000000000000000000000000000000000000000000
pbmp_xport_xe=0x88888888888888882222222222222222
ptp_ts_pll_fref=50000000
ptp_bs_fref_0=50000000
ptp_bs_fref_1=50000000
portmap_1.0=1:100
portmap_5.0=5:100
portmap_9.0=9:100
portmap_13.0=13:100
portmap_17.0=17:100
portmap_21.0=21:100
portmap_25.0=25:100
portmap_29.0=29:100
portmap_33.0=33:100
portmap_37.0=37:100
portmap_41.0=41:100
portmap_45.0=45:100
portmap_49.0=49:100
portmap_53.0=53:100
portmap_57.0=57:100
portmap_61.0=61:100
portmap_67.0=65:100
portmap_71.0=69:100
portmap_75.0=73:100
portmap_79.0=77:100
portmap_83.0=81:100
portmap_87.0=85:100
portmap_91.0=89:100
portmap_95.0=93:100
portmap_99.0=97:100
portmap_103.0=101:100
portmap_107.0=105:100
portmap_111.0=109:100
portmap_115.0=113:100
portmap_119.0=117:100
portmap_123.0=121:100
portmap_127.0=125:100
#portmap_66.0=129:10:m
#portmap_130.0=128:10:m
#wc0 lane swap
phy_chain_tx_lane_map_physical{1.0}=0x0132
phy_chain_rx_lane_map_physical{1.0}=0x3210
#wc1 lane swap
phy_chain_tx_lane_map_physical{5.0}=0x2301
phy_chain_rx_lane_map_physical{5.0}=0x2031
#wc2 lane swap
phy_chain_tx_lane_map_physical{9.0}=0x0132
phy_chain_rx_lane_map_physical{9.0}=0x3210
#wc3 lane swap
phy_chain_tx_lane_map_physical{13.0}=0x3201
phy_chain_rx_lane_map_physical{13.0}=0x2031
#wc4 lane swap
phy_chain_tx_lane_map_physical{17.0}=0x0123
phy_chain_rx_lane_map_physical{17.0}=0x3210
#wc5 lane swap
phy_chain_tx_lane_map_physical{21.0}=0x2301
phy_chain_rx_lane_map_physical{21.0}=0x2031
#wc6 lane swap
phy_chain_tx_lane_map_physical{25.0}=0x0123
phy_chain_rx_lane_map_physical{25.0}=0x3210
#wc7 lane swap
phy_chain_tx_lane_map_physical{29.0}=0x3201
phy_chain_rx_lane_map_physical{29.0}=0x2031
#wc8 lane swap
phy_chain_tx_lane_map_physical{33.0}=0x0213
phy_chain_rx_lane_map_physical{33.0}=0x1302
#wc9 lane swap
phy_chain_tx_lane_map_physical{37.0}=0x1302
phy_chain_rx_lane_map_physical{37.0}=0x2031
#wc10 lane swap
phy_chain_tx_lane_map_physical{41.0}=0x0231
phy_chain_rx_lane_map_physical{41.0}=0x3120
#wc11 lane swap
phy_chain_tx_lane_map_physical{45.0}=0x1302
phy_chain_rx_lane_map_physical{45.0}=0x2031
#wc12 lane swap
phy_chain_tx_lane_map_physical{49.0}=0x2103
phy_chain_rx_lane_map_physical{49.0}=0x3120
#wc13 lane swap
phy_chain_tx_lane_map_physical{53.0}=0x2301
phy_chain_rx_lane_map_physical{53.0}=0x2031
#wc14 lane swap
phy_chain_tx_lane_map_physical{57.0}=0x0123
phy_chain_rx_lane_map_physical{57.0}=0x2301
#wc15 lane swap
phy_chain_tx_lane_map_physical{61.0}=0x3210
phy_chain_rx_lane_map_physical{61.0}=0x1032
#wc16 lane swap
phy_chain_tx_lane_map_physical{65.0}=0x3210
phy_chain_rx_lane_map_physical{65.0}=0x1023
#wc17 lane swap
phy_chain_tx_lane_map_physical{69.0}=0x0123
phy_chain_rx_lane_map_physical{69.0}=0x1302
#wc18 lane swap
phy_chain_tx_lane_map_physical{73.0}=0x2301
phy_chain_rx_lane_map_physical{73.0}=0x1032
#wc19 lane swap
phy_chain_tx_lane_map_physical{77.0}=0x2013
phy_chain_rx_lane_map_physical{77.0}=0x3120
#wc20 lane swap
phy_chain_tx_lane_map_physical{81.0}=0x1302
phy_chain_rx_lane_map_physical{81.0}=0x2031
#wc21 lane swap
phy_chain_tx_lane_map_physical{85.0}=0x0123
phy_chain_rx_lane_map_physical{85.0}=0x2130
#wc22 lane swap
phy_chain_tx_lane_map_physical{89.0}=0x2301
phy_chain_rx_lane_map_physical{89.0}=0x2031
#wc23 lane swap
phy_chain_tx_lane_map_physical{93.0}=0x0312
phy_chain_rx_lane_map_physical{93.0}=0x2310
#wc24 lane swap
phy_chain_tx_lane_map_physical{97.0}=0x2301
phy_chain_rx_lane_map_physical{97.0}=0x1032
#wc25 lane swap
phy_chain_tx_lane_map_physical{101.0}=0x0123
phy_chain_rx_lane_map_physical{101.0}=0x3210
#wc26 lane swap
phy_chain_tx_lane_map_physical{105.0}=0x2301
phy_chain_rx_lane_map_physical{105.0}=0x1032
#wc27 lane swap
phy_chain_tx_lane_map_physical{109.0}=0x0123
phy_chain_rx_lane_map_physical{109.0}=0x3210
#wc28 lane swap
phy_chain_tx_lane_map_physical{113.0}=0x2301
phy_chain_rx_lane_map_physical{113.0}=0x2031
#wc29 lane swap
phy_chain_tx_lane_map_physical{117.0}=0x0123
phy_chain_rx_lane_map_physical{117.0}=0x3210
#wc30 lane swap
phy_chain_tx_lane_map_physical{121.0}=0x2301
phy_chain_rx_lane_map_physical{121.0}=0x1032
#wc31 lane swap
phy_chain_tx_lane_map_physical{125.0}=0x0123
phy_chain_rx_lane_map_physical{125.0}=0x3210
#MC lane swap
phy_chain_tx_lane_map_physical{129.0}=0x3210
phy_chain_rx_lane_map_physical{129.0}=0x3210
#wc0 P/N flip
phy_chain_tx_polarity_flip_physical{1.0}=0x0
phy_chain_rx_polarity_flip_physical{1.0}=0x0
phy_chain_tx_polarity_flip_physical{2.0}=0x0
phy_chain_rx_polarity_flip_physical{2.0}=0x1
phy_chain_tx_polarity_flip_physical{3.0}=0x0
phy_chain_rx_polarity_flip_physical{3.0}=0x0
phy_chain_tx_polarity_flip_physical{4.0}=0x1
phy_chain_rx_polarity_flip_physical{4.0}=0x1
#wc1 P/N flip
phy_chain_tx_polarity_flip_physical{5.0}=0x0
phy_chain_rx_polarity_flip_physical{5.0}=0x0
phy_chain_tx_polarity_flip_physical{6.0}=0x1
phy_chain_rx_polarity_flip_physical{6.0}=0x1
phy_chain_tx_polarity_flip_physical{7.0}=0x0
phy_chain_rx_polarity_flip_physical{7.0}=0x1
phy_chain_tx_polarity_flip_physical{8.0}=0x1
phy_chain_rx_polarity_flip_physical{8.0}=0x1
#wc2 P/N flip
phy_chain_tx_polarity_flip_physical{9.0}=0x0
phy_chain_rx_polarity_flip_physical{9.0}=0x0
phy_chain_tx_polarity_flip_physical{10.0}=0x0
phy_chain_rx_polarity_flip_physical{10.0}=0x1
phy_chain_tx_polarity_flip_physical{11.0}=0x0
phy_chain_rx_polarity_flip_physical{11.0}=0x0
phy_chain_tx_polarity_flip_physical{12.0}=0x1
phy_chain_rx_polarity_flip_physical{12.0}=0x1
#wc3 P/N flip
phy_chain_tx_polarity_flip_physical{13.0}=0x0
phy_chain_rx_polarity_flip_physical{13.0}=0x0
phy_chain_tx_polarity_flip_physical{14.0}=0x1
phy_chain_rx_polarity_flip_physical{14.0}=0x1
phy_chain_tx_polarity_flip_physical{15.0}=0x0
phy_chain_rx_polarity_flip_physical{15.0}=0x1
phy_chain_tx_polarity_flip_physical{16.0}=0x0
phy_chain_rx_polarity_flip_physical{16.0}=0x1
#wc4 P/N flip
phy_chain_tx_polarity_flip_physical{17.0}=0x0
phy_chain_rx_polarity_flip_physical{17.0}=0x0
phy_chain_tx_polarity_flip_physical{18.0}=0x1
phy_chain_rx_polarity_flip_physical{18.0}=0x1
phy_chain_tx_polarity_flip_physical{19.0}=0x0
phy_chain_rx_polarity_flip_physical{19.0}=0x0
phy_chain_tx_polarity_flip_physical{20.0}=0x1
phy_chain_rx_polarity_flip_physical{20.0}=0x1
#wc5 P/N flip
phy_chain_tx_polarity_flip_physical{21.0}=0x0
phy_chain_rx_polarity_flip_physical{21.0}=0x0
phy_chain_tx_polarity_flip_physical{22.0}=0x1
phy_chain_rx_polarity_flip_physical{22.0}=0x1
phy_chain_tx_polarity_flip_physical{23.0}=0x0
phy_chain_rx_polarity_flip_physical{23.0}=0x1
phy_chain_tx_polarity_flip_physical{24.0}=0x1
phy_chain_rx_polarity_flip_physical{24.0}=0x1
#wc6 P/N flip
phy_chain_tx_polarity_flip_physical{25.0}=0x0
phy_chain_rx_polarity_flip_physical{25.0}=0x1
phy_chain_tx_polarity_flip_physical{26.0}=0x1
phy_chain_rx_polarity_flip_physical{26.0}=0x0
phy_chain_tx_polarity_flip_physical{27.0}=0x0
phy_chain_rx_polarity_flip_physical{27.0}=0x1
phy_chain_tx_polarity_flip_physical{28.0}=0x1
phy_chain_rx_polarity_flip_physical{28.0}=0x0
#wc7 P/N flip
phy_chain_tx_polarity_flip_physical{29.0}=0x1
phy_chain_rx_polarity_flip_physical{29.0}=0x1
phy_chain_tx_polarity_flip_physical{30.0}=0x1
phy_chain_rx_polarity_flip_physical{30.0}=0x0
phy_chain_tx_polarity_flip_physical{31.0}=0x0
phy_chain_rx_polarity_flip_physical{31.0}=0x0
phy_chain_tx_polarity_flip_physical{32.0}=0x0
phy_chain_rx_polarity_flip_physical{32.0}=0x0
#wc8 P/N flip
phy_chain_tx_polarity_flip_physical{33.0}=0x1
phy_chain_rx_polarity_flip_physical{33.0}=0x1
phy_chain_tx_polarity_flip_physical{34.0}=0x0
phy_chain_rx_polarity_flip_physical{34.0}=0x0
phy_chain_tx_polarity_flip_physical{35.0}=0x0
phy_chain_rx_polarity_flip_physical{35.0}=0x0
phy_chain_tx_polarity_flip_physical{36.0}=0x1
phy_chain_rx_polarity_flip_physical{36.0}=0x0
#wc9 P/N flip
phy_chain_tx_polarity_flip_physical{37.0}=0x1
phy_chain_rx_polarity_flip_physical{37.0}=0x1
phy_chain_tx_polarity_flip_physical{38.0}=0x1
phy_chain_rx_polarity_flip_physical{38.0}=0x0
phy_chain_tx_polarity_flip_physical{39.0}=0x1
phy_chain_rx_polarity_flip_physical{39.0}=0x0
phy_chain_tx_polarity_flip_physical{40.0}=0x0
phy_chain_rx_polarity_flip_physical{40.0}=0x1
#wc10 P/N flip
phy_chain_tx_polarity_flip_physical{41.0}=0x1
phy_chain_rx_polarity_flip_physical{41.0}=0x1
phy_chain_tx_polarity_flip_physical{42.0}=0x0
phy_chain_rx_polarity_flip_physical{42.0}=0x1
phy_chain_tx_polarity_flip_physical{43.0}=0x1
phy_chain_rx_polarity_flip_physical{43.0}=0x0
phy_chain_tx_polarity_flip_physical{44.0}=0x1
phy_chain_rx_polarity_flip_physical{44.0}=0x1
#wc11 P/N flip
phy_chain_tx_polarity_flip_physical{45.0}=0x1
phy_chain_rx_polarity_flip_physical{45.0}=0x0
phy_chain_tx_polarity_flip_physical{46.0}=0x1
phy_chain_rx_polarity_flip_physical{46.0}=0x0
phy_chain_tx_polarity_flip_physical{47.0}=0x1
phy_chain_rx_polarity_flip_physical{47.0}=0x1
phy_chain_tx_polarity_flip_physical{48.0}=0x0
phy_chain_rx_polarity_flip_physical{48.0}=0x1
#wc12 P/N flip
phy_chain_tx_polarity_flip_physical{49.0}=0x1
phy_chain_rx_polarity_flip_physical{49.0}=0x0
phy_chain_tx_polarity_flip_physical{50.0}=0x1
phy_chain_rx_polarity_flip_physical{50.0}=0x0
phy_chain_tx_polarity_flip_physical{51.0}=0x0
phy_chain_rx_polarity_flip_physical{51.0}=0x1
phy_chain_tx_polarity_flip_physical{52.0}=0x1
phy_chain_rx_polarity_flip_physical{52.0}=0x1
#wc13 P/N flip
phy_chain_tx_polarity_flip_physical{53.0}=0x0
phy_chain_rx_polarity_flip_physical{53.0}=0x0
phy_chain_tx_polarity_flip_physical{54.0}=0x1
phy_chain_rx_polarity_flip_physical{54.0}=0x1
phy_chain_tx_polarity_flip_physical{55.0}=0x0
phy_chain_rx_polarity_flip_physical{55.0}=0x1
phy_chain_tx_polarity_flip_physical{56.0}=0x1
phy_chain_rx_polarity_flip_physical{56.0}=0x1
#wc14 P/N flip
phy_chain_tx_polarity_flip_physical{57.0}=0x1
phy_chain_rx_polarity_flip_physical{57.0}=0x0
phy_chain_tx_polarity_flip_physical{58.0}=0x1
phy_chain_rx_polarity_flip_physical{58.0}=0x1
phy_chain_tx_polarity_flip_physical{59.0}=0x0
phy_chain_rx_polarity_flip_physical{59.0}=0x0
phy_chain_tx_polarity_flip_physical{60.0}=0x1
phy_chain_rx_polarity_flip_physical{60.0}=0x1
#wc15 P/N flip
phy_chain_tx_polarity_flip_physical{61.0}=0x0
phy_chain_rx_polarity_flip_physical{61.0}=0x1
phy_chain_tx_polarity_flip_physical{62.0}=0x1
phy_chain_rx_polarity_flip_physical{62.0}=0x0
phy_chain_tx_polarity_flip_physical{63.0}=0x0
phy_chain_rx_polarity_flip_physical{63.0}=0x1
phy_chain_tx_polarity_flip_physical{64.0}=0x0
phy_chain_rx_polarity_flip_physical{64.0}=0x0
#wc16 P/N flip
phy_chain_tx_polarity_flip_physical{65.0}=0x1
phy_chain_rx_polarity_flip_physical{65.0}=0x0
phy_chain_tx_polarity_flip_physical{66.0}=0x0
phy_chain_rx_polarity_flip_physical{66.0}=0x0
phy_chain_tx_polarity_flip_physical{67.0}=0x1
phy_chain_rx_polarity_flip_physical{67.0}=0x1
phy_chain_tx_polarity_flip_physical{68.0}=0x0
phy_chain_rx_polarity_flip_physical{68.0}=0x0
#wc17 P/N flip
phy_chain_tx_polarity_flip_physical{69.0}=0x1
phy_chain_rx_polarity_flip_physical{69.0}=0x1
phy_chain_tx_polarity_flip_physical{70.0}=0x0
phy_chain_rx_polarity_flip_physical{70.0}=0x0
phy_chain_tx_polarity_flip_physical{71.0}=0x1
phy_chain_rx_polarity_flip_physical{71.0}=0x0
phy_chain_tx_polarity_flip_physical{72.0}=0x0
phy_chain_rx_polarity_flip_physical{72.0}=0x0
#wc18 P/N flip
phy_chain_tx_polarity_flip_physical{73.0}=0x0
phy_chain_rx_polarity_flip_physical{73.0}=0x1
phy_chain_tx_polarity_flip_physical{74.0}=0x1
phy_chain_rx_polarity_flip_physical{74.0}=0x0
phy_chain_tx_polarity_flip_physical{75.0}=0x0
phy_chain_rx_polarity_flip_physical{75.0}=0x1
phy_chain_tx_polarity_flip_physical{76.0}=0x1
phy_chain_rx_polarity_flip_physical{76.0}=0x0
#wc19 P/N flip
phy_chain_tx_polarity_flip_physical{77.0}=0x0
phy_chain_rx_polarity_flip_physical{77.0}=0x0
phy_chain_tx_polarity_flip_physical{78.0}=0x0
phy_chain_rx_polarity_flip_physical{78.0}=0x0
phy_chain_tx_polarity_flip_physical{79.0}=0x1
phy_chain_rx_polarity_flip_physical{79.0}=0x1
phy_chain_tx_polarity_flip_physical{80.0}=0x1
phy_chain_rx_polarity_flip_physical{80.0}=0x1
#wc20 P/N flip
phy_chain_tx_polarity_flip_physical{81.0}=0x0
phy_chain_rx_polarity_flip_physical{81.0}=0x0
phy_chain_tx_polarity_flip_physical{82.0}=0x0
phy_chain_rx_polarity_flip_physical{82.0}=0x0
phy_chain_tx_polarity_flip_physical{83.0}=0x1
phy_chain_rx_polarity_flip_physical{83.0}=0x1
phy_chain_tx_polarity_flip_physical{84.0}=0x1
phy_chain_rx_polarity_flip_physical{84.0}=0x0
#wc21 P/N flip
phy_chain_tx_polarity_flip_physical{85.0}=0x1
phy_chain_rx_polarity_flip_physical{85.0}=0x1
phy_chain_tx_polarity_flip_physical{86.0}=0x0
phy_chain_rx_polarity_flip_physical{86.0}=0x1
phy_chain_tx_polarity_flip_physical{87.0}=0x1
phy_chain_rx_polarity_flip_physical{87.0}=0x0
phy_chain_tx_polarity_flip_physical{88.0}=0x0
phy_chain_rx_polarity_flip_physical{88.0}=0x0
#wc22 P/N flip
phy_chain_tx_polarity_flip_physical{89.0}=0x1
phy_chain_rx_polarity_flip_physical{89.0}=0x0
phy_chain_tx_polarity_flip_physical{90.0}=0x0
phy_chain_rx_polarity_flip_physical{90.0}=0x0
phy_chain_tx_polarity_flip_physical{91.0}=0x1
phy_chain_rx_polarity_flip_physical{91.0}=0x1
phy_chain_tx_polarity_flip_physical{92.0}=0x0
phy_chain_rx_polarity_flip_physical{92.0}=0x1
#wc23 P/N flip
phy_chain_tx_polarity_flip_physical{93.0}=0x1
phy_chain_rx_polarity_flip_physical{93.0}=0x1
phy_chain_tx_polarity_flip_physical{94.0}=0x1
phy_chain_rx_polarity_flip_physical{94.0}=0x1
phy_chain_tx_polarity_flip_physical{95.0}=0x0
phy_chain_rx_polarity_flip_physical{95.0}=0x0
phy_chain_tx_polarity_flip_physical{96.0}=0x0
phy_chain_rx_polarity_flip_physical{96.0}=0x1
#wc24 P/N flip
phy_chain_tx_polarity_flip_physical{97.0}=0x1
phy_chain_rx_polarity_flip_physical{97.0}=0x1
phy_chain_tx_polarity_flip_physical{98.0}=0x0
phy_chain_rx_polarity_flip_physical{98.0}=0x0
phy_chain_tx_polarity_flip_physical{99.0}=0x1
phy_chain_rx_polarity_flip_physical{99.0}=0x1
phy_chain_tx_polarity_flip_physical{100.0}=0x0
phy_chain_rx_polarity_flip_physical{100.0}=0x0
#wc25 P/N flip
phy_chain_tx_polarity_flip_physical{101.0}=0x1
phy_chain_rx_polarity_flip_physical{101.0}=0x0
phy_chain_tx_polarity_flip_physical{102.0}=0x0
phy_chain_rx_polarity_flip_physical{102.0}=0x1
phy_chain_tx_polarity_flip_physical{103.0}=0x1
phy_chain_rx_polarity_flip_physical{103.0}=0x0
phy_chain_tx_polarity_flip_physical{104.0}=0x0
phy_chain_rx_polarity_flip_physical{104.0}=0x0
#wc26 P/N flip
phy_chain_tx_polarity_flip_physical{105.0}=0x1
phy_chain_rx_polarity_flip_physical{105.0}=0x0
phy_chain_tx_polarity_flip_physical{106.0}=0x0
phy_chain_rx_polarity_flip_physical{106.0}=0x1
phy_chain_tx_polarity_flip_physical{107.0}=0x1
phy_chain_rx_polarity_flip_physical{107.0}=0x0
phy_chain_tx_polarity_flip_physical{108.0}=0x0
phy_chain_rx_polarity_flip_physical{108.0}=0x1
#wc27 P/N flip
phy_chain_tx_polarity_flip_physical{109.0}=0x1
phy_chain_rx_polarity_flip_physical{109.0}=0x1
phy_chain_tx_polarity_flip_physical{110.0}=0x0
phy_chain_rx_polarity_flip_physical{110.0}=0x0
phy_chain_tx_polarity_flip_physical{111.0}=0x1
phy_chain_rx_polarity_flip_physical{111.0}=0x1
phy_chain_tx_polarity_flip_physical{112.0}=0x0
phy_chain_rx_polarity_flip_physical{112.0}=0x0
#wc28 P/N flip
phy_chain_tx_polarity_flip_physical{113.0}=0x1
phy_chain_rx_polarity_flip_physical{113.0}=0x1
phy_chain_tx_polarity_flip_physical{114.0}=0x0
phy_chain_rx_polarity_flip_physical{114.0}=0x0
phy_chain_tx_polarity_flip_physical{115.0}=0x1
phy_chain_rx_polarity_flip_physical{115.0}=0x0
phy_chain_tx_polarity_flip_physical{116.0}=0x0
phy_chain_rx_polarity_flip_physical{116.0}=0x0
#wc29 P/N flip
phy_chain_tx_polarity_flip_physical{117.0}=0x1
phy_chain_rx_polarity_flip_physical{117.0}=0x1
phy_chain_tx_polarity_flip_physical{118.0}=0x0
phy_chain_rx_polarity_flip_physical{118.0}=0x0
phy_chain_tx_polarity_flip_physical{119.0}=0x1
phy_chain_rx_polarity_flip_physical{119.0}=0x1
phy_chain_tx_polarity_flip_physical{120.0}=0x0
phy_chain_rx_polarity_flip_physical{120.0}=0x0
#wc30 P/N flip
phy_chain_tx_polarity_flip_physical{121.0}=0x1
phy_chain_rx_polarity_flip_physical{121.0}=0x0
phy_chain_tx_polarity_flip_physical{122.0}=0x0
phy_chain_rx_polarity_flip_physical{122.0}=0x1
phy_chain_tx_polarity_flip_physical{123.0}=0x1
phy_chain_rx_polarity_flip_physical{123.0}=0x0
phy_chain_tx_polarity_flip_physical{124.0}=0x0
phy_chain_rx_polarity_flip_physical{124.0}=0x1
#wc31 P/N flip
phy_chain_tx_polarity_flip_physical{125.0}=0x1
phy_chain_rx_polarity_flip_physical{125.0}=0x1
phy_chain_tx_polarity_flip_physical{126.0}=0x0
phy_chain_rx_polarity_flip_physical{126.0}=0x0
phy_chain_tx_polarity_flip_physical{127.0}=0x1
phy_chain_rx_polarity_flip_physical{127.0}=0x1
phy_chain_tx_polarity_flip_physical{128.0}=0x0
phy_chain_rx_polarity_flip_physical{128.0}=0x0
#MC P/N flip
phy_chain_tx_polarity_flip_physical{129.0}=0x0
phy_chain_rx_polarity_flip_physical{129.0}=0x0
phy_chain_tx_polarity_flip_physical{130.0}=0x0
phy_chain_rx_polarity_flip_physical{130.0}=0x0
phy_chain_tx_polarity_flip_physical{131.0}=0x0
phy_chain_rx_polarity_flip_physical{131.0}=0x0
phy_chain_tx_polarity_flip_physical{132.0}=0x0
phy_chain_rx_polarity_flip_physical{132.0}=0x0
dport_map_port_1=1
dport_map_port_5=2
dport_map_port_9=3
dport_map_port_13=4
dport_map_port_17=5
dport_map_port_21=6
dport_map_port_25=7
dport_map_port_29=8
dport_map_port_33=9
dport_map_port_37=10
dport_map_port_41=11
dport_map_port_45=12
dport_map_port_49=13
dport_map_port_53=14
dport_map_port_57=15
dport_map_port_61=16
dport_map_port_67=17
dport_map_port_71=18
dport_map_port_75=19
dport_map_port_79=20
dport_map_port_83=21
dport_map_port_87=22
dport_map_port_91=23
dport_map_port_95=24
dport_map_port_99=25
dport_map_port_103=26
dport_map_port_107=27
dport_map_port_111=28
dport_map_port_115=29
dport_map_port_119=30
dport_map_port_123=31
dport_map_port_127=32
#dport_map_port_66=33
#dport_map_port_130=34
# configuration for 100G optical module
serdes_preemphasis_1=0x164608
serdes_preemphasis_5=0x164608
serdes_preemphasis_9=0x164608
serdes_preemphasis_13=0x134908
serdes_preemphasis_17=0x134908
serdes_preemphasis_21=0x134908
serdes_preemphasis_25=0x124a08
serdes_preemphasis_29=0x124a08
serdes_preemphasis_33=0x114b08
serdes_preemphasis_37=0x114b08
serdes_preemphasis_41=0x0f4d08
serdes_preemphasis_45=0x0f4d08
serdes_preemphasis_49=0x0d4f08
serdes_preemphasis_53=0x0d4f08
serdes_preemphasis_57=0x0d4f08
serdes_preemphasis_61=0x0d4f08
serdes_preemphasis_67=0x0d4f08
serdes_preemphasis_71=0x0d4f08
serdes_preemphasis_75=0x0d4f08
serdes_preemphasis_79=0x0d4f08
serdes_preemphasis_83=0x0d4f08
serdes_preemphasis_87=0x0f4d08
serdes_preemphasis_91=0x0f4d08
serdes_preemphasis_95=0x0f4d08
serdes_preemphasis_99=0x114b08
serdes_preemphasis_103=0x114b08
serdes_preemphasis_107=0x114b08
serdes_preemphasis_111=0x124a08
serdes_preemphasis_115=0x134908
serdes_preemphasis_119=0x134908
serdes_preemphasis_123=0x134908
serdes_preemphasis_127=0x164608
reglist_enable=1
scache_filename=/tmp/scache
schan_intr_enable=0
stable_size=0x5500000
tdma_timeout_usec=3000000

Binary file not shown.

View File

@ -0,0 +1 @@
Seastone_2 t1

View File

@ -0,0 +1,3 @@
CONSOLE_DEV=0
CONSOLE_SPEED=115200
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="earlycon=uart8250,mmio,0xdf37b000"

View File

@ -0,0 +1,9 @@
#Enable all ports
port all en=1
sleep 6
#linkscan 250000; port xe,ce linkscan=on
#Load LED
led auto on; led start

View File

@ -0,0 +1,23 @@
#!/usr/bin/env python
#############################################################################
# Celestica Seastone2
#
# Platform and model specific eeprom subclass, inherits from the base class,
# and provides the followings:
# - the eeprom format definition
# - specific encoder/decoder if there is special need
#############################################################################
try:
from sonic_eeprom import eeprom_tlvinfo
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
class board(eeprom_tlvinfo.TlvInfoDecoder):
def __init__(self, name, path, cpld_root, ro):
self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0056/eeprom"
super(board, self).__init__(self.eeprom_path, 0, '', True)

View File

@ -0,0 +1,88 @@
#!/usr/bin/env python
import os.path
import subprocess
import sys
import re
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
def __init__(self):
self.ipmi_sensor = "ipmitool sensor"
PsuBase.__init__(self)
def run_command(self, command):
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
(out, err) = proc.communicate()
if proc.returncode != 0:
sys.exit(proc.returncode)
return out
def find_value(self, grep_string):
result = re.search(".+\| (0x\d{2})\d{2}\|.+", grep_string)
if result:
return result.group(1)
else:
return result
def get_num_psus(self):
"""
Retrieves the number of PSUs available on the device
:return: An integer, the number of PSUs available on the device
"""
return 2
def get_psu_status(self, index):
"""
Retrieves the oprational status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is operating properly, False if PSU is faulty
"""
if index is None:
return False
grep_key = "PSUL_Status" if index == 1 else "PSUR_Status"
grep_string = self.run_command(self.ipmi_sensor + ' | grep '+ grep_key)
status_byte = self.find_value(grep_string)
if status_byte is None:
return False
failure_detected = (int(status_byte, 16) >> 1) & 1
input_lost = (int(status_byte, 16) >> 3) & 1
if failure_detected or input_lost:
return False
else:
return True
def get_psu_presence(self, index):
"""
Retrieves the presence status of power supply unit (PSU) defined
by 1-based index <index>
:param index: An integer, 1-based index of the PSU of which to query status
:return: Boolean, True if PSU is plugged, False if not
"""
if index is None:
return False
grep_key = "PSUL_Status" if index == 1 else "PSUR_Status"
grep_string = self.run_command(self.ipmi_sensor + ' | grep '+ grep_key)
status_byte = self.find_value(grep_string)
if status_byte is None:
return False
presence = ( int(status_byte, 16) >> 0 ) & 1
if presence:
return True
else:
return False

View File

@ -0,0 +1,182 @@
#!/usr/bin/env python
#
# Platform-specific SFP transceiver interface for SONiC
#
try:
import time
from sonic_sfp.sfputilbase import SfpUtilBase
except ImportError as e:
raise ImportError("%s - required module not found" % str(e))
class SfpUtil(SfpUtilBase):
"""Platform-specific SfpUtil class"""
PORT_START = 1
PORT_END = 33
QSFP_PORT_START = 1
QSFP_PORT_END = 32
EEPROM_OFFSET = 1
PORT_INFO_PATH = '/sys/class/seastone2_fpga'
_port_name = ""
_port_to_eeprom_mapping = {}
_port_to_i2cbus_mapping = {}
@property
def port_start(self):
return self.PORT_START
@property
def port_end(self):
return self.PORT_END
@property
def qsfp_ports(self):
return range(self.QSFP_PORT_START, self.QSFP_PORT_END + 1)
@property
def port_to_eeprom_mapping(self):
return self._port_to_eeprom_mapping
@property
def port_to_i2cbus_mapping(self):
return self._port_to_i2cbus_mapping
def get_port_name(self, port_num):
if port_num in self.qsfp_ports:
self._port_name = "QSFP" + str(port_num - self.QSFP_PORT_START + 1)
else:
self._port_name = "SFP" + str(port_num)
return self._port_name
# def get_eeprom_dom_raw(self, port_num):
# if port_num in self.qsfp_ports:
# # QSFP DOM EEPROM is also at addr 0x50 and thus also stored in eeprom_ifraw
# return None
# else:
# # Read dom eeprom at addr 0x51
# return self._read_eeprom_devid(port_num, self.DOM_EEPROM_ADDR, 256)
def __init__(self):
# Override port_to_eeprom_mapping for class initialization
eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom'
for x in range(self.PORT_START, self.PORT_END+1):
self.port_to_i2cbus_mapping[x] = (x + self.EEPROM_OFFSET)
self.port_to_eeprom_mapping[x] = eeprom_path.format(
x + self.EEPROM_OFFSET)
SfpUtilBase.__init__(self)
def get_presence(self, port_num):
# Check for invalid port_num
if port_num not in range(self.port_start, self.port_end + 1):
return False
# Get path for access port presence status
port_name = self.get_port_name(port_num)
sysfs_filename = "qsfp_modprs" if port_num in self.qsfp_ports else "sfp_modabs"
reg_path = "/".join([self.PORT_INFO_PATH, port_name, sysfs_filename])
# Read status
try:
reg_file = open(reg_path)
content = reg_file.readline().rstrip()
reg_value = int(content)
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
# Module present is active low
if reg_value == 0:
return True
return False
def get_low_power_mode(self, port_num):
# Check for invalid QSFP port_num
if port_num not in self.qsfp_ports:
return False
try:
port_name = self.get_port_name(port_num)
reg_file = open(
"/".join([self.PORT_INFO_PATH, port_name, "qsfp_lpmode"]), "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
# Read status
content = reg_file.readline().rstrip()
reg_value = int(content, 16)
# ModPrsL is active low
if reg_value == 0:
return False
return True
def set_low_power_mode(self, port_num, lpmode):
# Check for invalid QSFP port_num
if port_num not in self.qsfp_ports:
return False
try:
port_name = self.get_port_name(port_num)
reg_file = open(
"/".join([self.PORT_INFO_PATH, port_name, "qsfp_lpmode"]), "r+")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
content = hex(lpmode)
reg_file.seek(0)
reg_file.write(content)
reg_file.close()
return True
def reset(self, port_num):
# Check for invalid QSFP port_num
if port_num not in self.qsfp_ports:
return False
try:
port_name = self.get_port_name(port_num)
reg_file = open(
"/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
# Convert our register value back to a hex string and write back
reg_file.seek(0)
reg_file.write(hex(0))
reg_file.close()
# Sleep 1 second to allow it to settle
time.sleep(1)
# Flip the bit back high and write back to the register to take port out of reset
try:
reg_file = open(
"/".join([self.PORT_INFO_PATH, port_name, "qsfp_reset"]), "w")
except IOError as e:
print "Error: unable to open file: %s" % str(e)
return False
reg_file.seek(0)
reg_file.write(hex(1))
reg_file.close()
return True
def get_transceiver_change_event(self, timeout=0):
"""
TBD: When the feature request.
"""
raise NotImplementedError

View File

@ -0,0 +1,6 @@
{
"skip_ledd": true,
"skip_xcvrd": false,
"skip_psud": false,
"skip_syseepromd": false
}

View File

@ -41,6 +41,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
$(INVENTEC_D6356_PLATFORM_MODULE) \
$(CEL_DX010_PLATFORM_MODULE) \
$(CEL_HALIBURTON_PLATFORM_MODULE) \
$(CEL_SEASTONE2_PLATFORM_MODULE) \
$(DELTA_AG9032V1_PLATFORM_MODULE) \
$(DELTA_AG9064_PLATFORM_MODULE) \
$(DELTA_AG5648_PLATFORM_MODULE) \

View File

@ -2,10 +2,12 @@
CEL_DX010_PLATFORM_MODULE_VERSION = 0.9
CEL_HALIBURTON_PLATFORM_MODULE_VERSION = 0.9
CEL_SEASTONE2_PLATFORM_MODULE_VERSION = 0.9
CEL_SILVERSTONE_PLATFORM_MODULE_VERSION = 0.9
export CEL_DX010_PLATFORM_MODULE_VERSION
export CEL_HALIBURTON_PLATFORM_MODULE_VERSION
export CEL_SEASTONE2_PLATFORM_MODULE_VERSION
export CEL_SILVERSTONE_PLATFORM_MODULE_VERSION
CEL_DX010_PLATFORM_MODULE = platform-modules-dx010_$(CEL_DX010_PLATFORM_MODULE_VERSION)_amd64.deb
@ -18,6 +20,10 @@ CEL_HALIBURTON_PLATFORM_MODULE = platform-modules-haliburton_$(CEL_HALIBURTON_PL
$(CEL_HALIBURTON_PLATFORM_MODULE)_PLATFORM = x86_64-cel_e1031-r0
$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_HALIBURTON_PLATFORM_MODULE)))
CEL_SEASTONE2_PLATFORM_MODULE = platform-modules-seastone2_$(CEL_SEASTONE2_PLATFORM_MODULE_VERSION)_amd64.deb
$(CEL_SEASTONE2_PLATFORM_MODULE)_PLATFORM = x86_64-cel_seastone_2-r0
$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_SEASTONE2_PLATFORM_MODULE)))
CEL_SILVERSTONE_PLATFORM_MODULE = platform-modules-silverstone_$(CEL_SILVERSTONE_PLATFORM_MODULE_VERSION)_amd64.deb
$(CEL_SILVERSTONE_PLATFORM_MODULE)_PLATFORM = x86_64-cel_silverstone-r0
$(eval $(call add_extra_package,$(CEL_DX010_PLATFORM_MODULE),$(CEL_SILVERSTONE_PLATFORM_MODULE)))

View File

@ -1 +1 @@
platform drivers for Celestica DX010 and Haliburton for the SONiC project
platform drivers of Celestica network switchs for the SONiC project

View File

@ -1,7 +1,7 @@
Source: sonic-cel-platform-modules
Section: main
Priority: extra
Maintainer: Abhisit Sangjan <asang@celestica.com>
Maintainer: Wirut Getbamrung <wgetbumr@celestica.com>
Build-Depends: debhelper (>= 8.0.0), bzip2
Standards-Version: 3.9.3
@ -16,6 +16,11 @@ Architecture: amd64
Depends: linux-image-4.9.0-9-2-amd64
Description: kernel modules for platform devices such as fan, led, sfp
Package: platform-modules-seastone2
Architecture: amd64
Depends: linux-image-4.9.0-9-2-amd64
Description: kernel modules for platform devices such as led, sfp
Package: platform-modules-silverstone
Architecture: amd64
Depends: linux-image-4.9.0-9-2-amd64

View File

@ -0,0 +1,52 @@
#!/bin/bash
### BEGIN INIT INFO
# Provides: setup-board
# Required-Start: $portmap
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Setup seastone2 board.
### END INIT INFO
case "$1" in
start)
echo -n "Setting up board... "
# Add driver to support HW
modprobe i2c-dev
modprobe ipmi_devintf
modprobe ipmi_si
modprobe baseboard_cpld
modprobe switchboard_fpga
modprobe mc24lc64t
# Add driver to support TLV - EEPROM
for devnum in 0 1; do
devname=`cat /sys/bus/i2c/devices/i2c-${devnum}/name`
if [[ $devname == 'SMBus iSMT adapter at '* ]]; then
echo 24lc64t 0x56 > /sys/bus/i2c/devices/i2c-${devnum}/new_device
break
fi
done
sleep 1
echo "done."
;;
stop)
echo "done."
;;
force-reload|restart)
echo "Not supported"
;;
*)
echo "Usage: /etc/init.d/platform-modules-seastone2.init {start|stop}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,2 @@
seastone2/cfg/seastone2-modules.conf etc/modules-load.d
seastone2/systemd/platform-modules-seastone2.service lib/systemd/system

View File

@ -0,0 +1,3 @@
depmod -a
systemctl enable platform-modules-seastone2.service
systemctl start platform-modules-seastone2.service

View File

@ -5,7 +5,7 @@ export INSTALL_MOD_DIR:=extra
KVERSION ?= $(shell uname -r)
KERNEL_SRC := /lib/modules/$(KVERSION)
MOD_SRC_DIR:= $(shell pwd)
MODULE_DIRS:= dx010 haliburton silverstone
MODULE_DIRS:= dx010 haliburton silverstone seastone2
%:
dh $@

View File

@ -0,0 +1,16 @@
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
i2c-i801
i2c-isch
i2c-ismt
i2c-dev
i2c-mux
i2c-smbus
i2c-mux-gpio
i2c-mux-pca954x
ipmi_devintf
ipmi_si

View File

@ -0,0 +1,2 @@
KBUILD_CFLAGS+=-DSEASTONE2
obj-m := mc24lc64t.o baseboard_cpld.o switchboard_fpga.o

View File

@ -0,0 +1,378 @@
/*
* baseboard_cpld.c - driver for Seastone2 Base Board CPLD
* This driver implement sysfs for CPLD register access using LPC bus.
* Copyright (C) 2019 Celestica Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/stddef.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/acpi.h>
#include <linux/io.h>
#include <linux/dmi.h>
#include <linux/slab.h>
#include <linux/wait.h>
#include <linux/err.h>
#include <linux/platform_device.h>
#include <linux/types.h>
#include <uapi/linux/stat.h>
#include <linux/string.h>
#define DRIVER_NAME "baseboard"
/**
* CPLD register address for read and write.
*/
#define VERSION_ADDR 0xA100
#define SCRATCH_ADDR 0xA101
#define SYS_LED_ADDR 0xA162
#define CPLD_REGISTER_SIZE 0x77
struct baseboard_cpld_data {
struct mutex cpld_lock;
uint16_t read_addr;
};
struct baseboard_cpld_data *cpld_data;
/**
* Read the value from scratch register as hex string.
* @param dev kernel device
* @param devattr kernel device attribute
* @param buf buffer for get value
* @return Hex string read from scratch register.
*/
static ssize_t scratch_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{
unsigned char data = 0;
mutex_lock(&cpld_data->cpld_lock);
data = inb(SCRATCH_ADDR);
mutex_unlock(&cpld_data->cpld_lock);
return sprintf(buf,"0x%2.2x\n", data);
}
/**
* Set scratch register with specific hex string.
* @param dev kernel device
* @param devattr kernel device attribute
* @param buf buffer of set value
* @param count number of bytes in buffer
* @return number of bytes written, or error code < 0.
*/
static ssize_t scratch_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{
unsigned long data;
char *last;
mutex_lock(&cpld_data->cpld_lock);
data = (uint16_t)strtoul(buf,&last,16);
if(data == 0 && buf == last){
mutex_unlock(&cpld_data->cpld_lock);
return -EINVAL;
}
outb(data, SCRATCH_ADDR);
mutex_unlock(&cpld_data->cpld_lock);
return count;
}
static DEVICE_ATTR_RW(scratch);
/* CPLD version attributes */
static ssize_t version_show(struct device *dev, struct device_attribute *attr, char *buf)
{
int len = -EIO;
// CPLD register is one byte
mutex_lock(&cpld_data->cpld_lock);
len = sprintf(buf, "0x%2.2x\n",inb(VERSION_ADDR));
mutex_unlock(&cpld_data->cpld_lock);
return len;
}
static DEVICE_ATTR_RO(version);
static ssize_t getreg_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{
// CPLD register is one byte
uint16_t addr;
char *last;
addr = (uint16_t)strtoul(buf,&last,16);
if(addr == 0 && buf == last){
return -EINVAL;
}
cpld_data->read_addr = addr;
return count;
}
static ssize_t getreg_show(struct device *dev, struct device_attribute *attr, char *buf)
{
int len = -EIO;
// CPLD register is one byte
mutex_lock(&cpld_data->cpld_lock);
len = sprintf(buf, "0x%2.2x\n",inb(cpld_data->read_addr));
mutex_unlock(&cpld_data->cpld_lock);
return len;
}
static DEVICE_ATTR_RW(getreg);
static ssize_t setreg_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{
// CPLD register is one byte
uint16_t addr;
uint8_t value;
char *tok;
char clone[count];
char *pclone = clone;
char *last;
strcpy(clone, buf);
mutex_lock(&cpld_data->cpld_lock);
tok = strsep((char**)&pclone, " ");
if(tok == NULL){
mutex_unlock(&cpld_data->cpld_lock);
return -EINVAL;
}
addr = (uint16_t)strtoul(tok,&last,16);
if(addr == 0 && tok == last){
mutex_unlock(&cpld_data->cpld_lock);
return -EINVAL;
}
tok = strsep((char**)&pclone, " ");
if(tok == NULL){
mutex_unlock(&cpld_data->cpld_lock);
return -EINVAL;
}
value = (uint8_t)strtoul(tok,&last,16);
if(value == 0 && tok == last){
mutex_unlock(&cpld_data->cpld_lock);
return -EINVAL;
}
outb(value,addr);
mutex_unlock(&cpld_data->cpld_lock);
return count;
}
static DEVICE_ATTR_WO(setreg);
/**
* Show system led status - on/off/1hz/4hz
* @param dev kernel device
* @param devattr kernel device attribute
* @param buf buffer for get value
* @return Hex string read from scratch register.
*/
static ssize_t sys_led_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{
unsigned char data = 0;
mutex_lock(&cpld_data->cpld_lock);
data = inb(SYS_LED_ADDR);
mutex_unlock(&cpld_data->cpld_lock);
data = data & 0x3;
return sprintf(buf, "%s\n",
data == 0x03 ? "off" : data == 0x02 ? "4hz" : data ==0x01 ? "1hz": "on");
}
/**
* Set the status of system led - on/off/1hz/4hz
* @param dev kernel device
* @param devattr kernel device attribute
* @param buf buffer of set value
* @param count number of bytes in buffer
* @return number of bytes written, or error code < 0.
*/
static ssize_t sys_led_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{
unsigned char led_status,data;
if(sysfs_streq(buf, "off")){
led_status = 0x03;
}else if(sysfs_streq(buf, "4hz")){
led_status = 0x02;
}else if(sysfs_streq(buf, "1hz")){
led_status = 0x01;
}else if(sysfs_streq(buf, "on")){
led_status = 0x00;
}else{
count = -EINVAL;
return count;
}
mutex_lock(&cpld_data->cpld_lock);
data = inb(SYS_LED_ADDR);
data = data & ~(0x3);
data = data | led_status;
outb(data, SYS_LED_ADDR);
mutex_unlock(&cpld_data->cpld_lock);
return count;
}
static DEVICE_ATTR_RW(sys_led);
/**
* Show system led color - both/green/yellow/none
* @param dev kernel device
* @param devattr kernel device attribute
* @param buf buffer for get value
* @return Hex string read from scratch register.
*/
static ssize_t sys_led_color_show(struct device *dev, struct device_attribute *devattr,
char *buf)
{
unsigned char data = 0;
mutex_lock(&cpld_data->cpld_lock);
data = inb(SYS_LED_ADDR);
mutex_unlock(&cpld_data->cpld_lock);
data = (data >> 4) & 0x3;
return sprintf(buf, "%s\n",
data == 0x03 ? "off" : data == 0x02 ? "yellow" : data ==0x01 ? "green": "both");
}
/**
* Set the color of system led - both/green/yellow/none
* @param dev kernel device
* @param devattr kernel device attribute
* @param buf buffer of set value
* @param count number of bytes in buffer
* @return number of bytes written, or error code < 0.
*/
static ssize_t sys_led_color_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{
unsigned char led_status,data;
if(sysfs_streq(buf, "off")){
led_status = 0x03;
}else if(sysfs_streq(buf, "yellow")){
led_status = 0x02;
}else if(sysfs_streq(buf, "green")){
led_status = 0x01;
}else if(sysfs_streq(buf, "both")){
led_status = 0x00;
}else{
count = -EINVAL;
return count;
}
mutex_lock(&cpld_data->cpld_lock);
data = inb(SYS_LED_ADDR);
data = data & ~( 0x3 << 4);
data = data | (led_status << 4);
outb(data, SYS_LED_ADDR);
mutex_unlock(&cpld_data->cpld_lock);
return count;
}
static DEVICE_ATTR_RW(sys_led_color);
static struct attribute *baseboard_cpld_attrs[] = {
&dev_attr_version.attr,
&dev_attr_scratch.attr,
&dev_attr_getreg.attr,
&dev_attr_setreg.attr,
&dev_attr_sys_led.attr,
&dev_attr_sys_led_color.attr,
NULL,
};
static struct attribute_group baseboard_cpld_attrs_grp = {
.attrs = baseboard_cpld_attrs,
};
static struct resource baseboard_cpld_resources[] = {
{
.start = 0xA100,
.end = 0xA1FF,
.flags = IORESOURCE_IO,
},
};
static void baseboard_cpld_dev_release( struct device * dev)
{
return;
}
static struct platform_device baseboard_cpld_dev = {
.name = DRIVER_NAME,
.id = -1,
.num_resources = ARRAY_SIZE(baseboard_cpld_resources),
.resource = baseboard_cpld_resources,
.dev = {
.release = baseboard_cpld_dev_release,
}
};
static int baseboard_cpld_drv_probe(struct platform_device *pdev)
{
struct resource *res;
int ret =0;
cpld_data = devm_kzalloc(&pdev->dev, sizeof(struct baseboard_cpld_data),
GFP_KERNEL);
if (!cpld_data)
return -ENOMEM;
mutex_init(&cpld_data->cpld_lock);
cpld_data->read_addr = VERSION_ADDR;
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (unlikely(!res)) {
printk(KERN_ERR "Specified Resource Not Available...\n");
return -1;
}
ret = sysfs_create_group(&pdev->dev.kobj, &baseboard_cpld_attrs_grp);
if (ret) {
printk(KERN_ERR "Cannot create sysfs for baseboard CPLD\n");
}
return 0;
}
static int baseboard_cpld_drv_remove(struct platform_device *pdev)
{
sysfs_remove_group(&pdev->dev.kobj, &baseboard_cpld_attrs_grp);
return 0;
}
static struct platform_driver baseboard_cpld_drv = {
.probe = baseboard_cpld_drv_probe,
.remove = __exit_p(baseboard_cpld_drv_remove),
.driver = {
.name = DRIVER_NAME,
},
};
int baseboard_cpld_init(void)
{
// Register platform device and platform driver
platform_device_register(&baseboard_cpld_dev);
platform_driver_register(&baseboard_cpld_drv);
return 0;
}
void baseboard_cpld_exit(void)
{
// Unregister platform device and platform driver
platform_driver_unregister(&baseboard_cpld_drv);
platform_device_unregister(&baseboard_cpld_dev);
}
module_init(baseboard_cpld_init);
module_exit(baseboard_cpld_exit);
MODULE_AUTHOR("Pradchaya Phucharoen <pphuchar@celestica.com>");
MODULE_DESCRIPTION("Celestica Seastone2 Baseboard CPLD Driver");
MODULE_LICENSE("GPL");

View File

@ -0,0 +1,174 @@
/*
* mc24lc64t.c - driver for Microchip 24LC64T
*
* Copyright (C) 2017 Celestica Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#define EEPROM_SIZE 8192 //mc24lt64t eeprom size in bytes.
struct mc24lc64t_data {
struct mutex update_lock;
};
static ssize_t mc24lc64t_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
struct i2c_client *client = kobj_to_i2c_client(kobj);
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
unsigned long timeout, read_time, i = 0;
int status;
mutex_lock(&drvdata->update_lock);
if (i2c_smbus_write_byte_data(client, off>>8, off))
{
status = -EIO;
goto exit;
}
msleep(1);
begin:
if (i < count)
{
timeout = jiffies + msecs_to_jiffies(25); /* 25 mS timeout*/
do {
read_time = jiffies;
status = i2c_smbus_read_byte(client);
if (status >= 0)
{
buf[i++] = status;
goto begin;
}
} while (time_before(read_time, timeout));
status = -ETIMEDOUT;
goto exit;
}
status = count;
exit:
mutex_unlock(&drvdata->update_lock);
return status;
}
static ssize_t mc24lc64t_write (struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count){
struct i2c_client *client = kobj_to_i2c_client(kobj);
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
unsigned long timeout, write_time, i = 0;
int status;
u16 value;
mutex_lock(&drvdata->update_lock);
begin:
if (i < count){
timeout = jiffies + msecs_to_jiffies(25); /* 25 mS timeout*/
value = (buf[i] << 8 | ( off &0xff));
do {
write_time = jiffies;
status = i2c_smbus_write_word_data(client, off>>8, value);
if (status >= 0)
{
// increase offset
off++;
// increase buffer index
i++;
goto begin;
}
} while (time_before(write_time, timeout));
status = -ETIMEDOUT;
goto exit;
}
status = count;
exit:
mutex_unlock(&drvdata->update_lock);
return status;
}
static struct bin_attribute mc24lc64t_bit_attr = {
.attr = {
.name = "eeprom",
.mode = S_IRUGO | S_IWUGO,
},
.size = EEPROM_SIZE,
.read = mc24lc64t_read,
.write = mc24lc64t_write,
};
static int mc24lc64t_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adapter = client->adapter;
struct mc24lc64t_data *drvdata;
int err;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WRITE_BYTE_DATA
| I2C_FUNC_SMBUS_READ_BYTE))
return -EPFNOSUPPORT;
if (!(drvdata = devm_kzalloc(&client->dev,
sizeof(struct mc24lc64t_data), GFP_KERNEL)))
return -ENOMEM;
i2c_set_clientdata(client, drvdata);
mutex_init(&drvdata->update_lock);
err = sysfs_create_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
return err;
}
static int mc24lc64t_remove(struct i2c_client *client)
{
struct mc24lc64t_data *drvdata = i2c_get_clientdata(client);
sysfs_remove_bin_file(&client->dev.kobj, &mc24lc64t_bit_attr);
return 0;
}
static const struct i2c_device_id mc24lc64t_id[] = {
{ "24lc64t", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, mc24lc64t_id);
static struct i2c_driver mc24lc64t_driver = {
.driver = {
.name = "mc24lc64t",
.owner = THIS_MODULE,
},
.probe = mc24lc64t_probe,
.remove = mc24lc64t_remove,
.id_table = mc24lc64t_id,
};
module_i2c_driver(mc24lc64t_driver);
MODULE_AUTHOR("Abhisit Sangjan <asang@celestica.com>");
MODULE_DESCRIPTION("Microchip 24LC64T Driver");
MODULE_LICENSE("GPL");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
[Unit]
Description=Celestica seastone2 platform modules
After=local-fs.target
Before=pmon.service
[Service]
Type=oneshot
ExecStart=-/etc/init.d/platform-modules-seastone2 start
ExecStop=-/etc/init.d/platform-modules-seastone2 stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

View File

@ -210,3 +210,10 @@ sai_preinit_cmd_file
sai_preinit_warmboot_cmd_file
sai_postinit_cmd_file
sai_postinit_warmboot_cmd_file
help_cli_enable
memlist_enable
serdes_lane_config_dfe
serdes_fec_enable
pbmp_gport_stack
reglist_enable
scache_filename