diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/buffers.json.j2 b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/buffers.json.j2 new file mode 100755 index 000000000000..2c391214fa65 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/buffers.json.j2 @@ -0,0 +1,111 @@ +{# Default values which will be used if no actual configura available #} +{% set default_cable = '40m' %} +{% set default_speed = '10G' %} +{% set default_ports_num = 54 -%} + +{# Port configuration to cable length look-up table #} +{# Each record describes mapping of DUT (DUT port) role and neighbor role to cable length #} +{# Roles described in the minigraph #} +{% set ports2cable = { + 'torrouter_server' : '5m', + 'leafrouter_torrouter' : '40m', + 'spinerouter_leafrouter' : '300m' + } +%} + +{%- macro cable_length(port_name) -%} + {%- set cable_len = [] -%} + {%- for local_port in DEVICE_NEIGHBOR -%} + {%- if local_port == port_name -%} + {%- if DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor = DEVICE_NEIGHBOR_METADATA[DEVICE_NEIGHBOR[local_port].name] -%} + {%- set neighbor_role = neighbor.type -%} + {%- set roles1 = switch_role + '_' + neighbor_role %} + {%- set roles2 = neighbor_role + '_' + switch_role -%} + {%- set roles1 = roles1 | lower -%} + {%- set roles2 = roles2 | lower -%} + {%- if roles1 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles1]) -%}{%- endif -%} + {%- elif roles2 in ports2cable -%} + {%- if cable_len.append(ports2cable[roles2]) -%}{%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endif -%} + {%- endfor -%} + {%- if cable_len -%} + {{ cable_len.0 }} + {%- else -%} + {{ default_cable }} + {%- endif -%} +{% endmacro %} + +{%- if DEVICE_METADATA is defined %} +{%- set switch_role = DEVICE_METADATA['localhost']['type'] %} +{%- endif -%} + +{# Generate list of ports if not defined #} +{% if PORT is not defined %} + {% set PORT = [] %} + {% for port_idx in range(0,default_ports_num) %} + {% if PORT.append("Ethernet%d" % (port_idx)) %}{% endif %} + {% endfor %} +{% endif -%} + +{% set port_names_list = [] %} +{% for port in PORT %} + {%- if port_names_list.append(port) %}{% endif %} +{% endfor %} +{% set port_names = port_names_list | join(',') -%} + +{ + "CABLE_LENGTH": { + "AZURE": { + {% for port in PORT %} + {% set cable = cable_length(port) -%} + "{{ port }}": "{{ cable }}"{%- if not loop.last -%},{% endif %} + + {% endfor %} + } + }, + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "20971328", + "type": "ingress", + "mode": "static" + }, + "ingress_lossy_pool": { + "size": "20971328", + "type": "ingress", + "mode": "static" + }, + "egress_lossy_pool": { + "size": "20971328", + "type": "egress", + "mode": "static" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"[BUFFER_POOL|ingress_lossless_pool]", + "xon":"78400", + "xoff":"132160", + "size":"3584", + "static_th":"82880" + }, + "ingress_lossy_profile": { + "pool":"[BUFFER_POOL|ingress_lossy_pool]", + "size":"3584", + "dynamic_th":"-1" + }, + "egress_lossy_profile": { + "pool":"[BUFFER_POOL|egress_lossy_pool]", + "size":"3584", + "dynamic_th":"-4" + } + }, + "BUFFER_PG": { + }, + "BUFFER_QUEUE": { + } +} + \ No newline at end of file diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/pg_profile_lookup.ini b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/pg_profile_lookup.ini new file mode 100755 index 000000000000..d98b0eca6d19 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 3584 32256 59136 36736 + 25000 5m 3584 41216 68096 45696 + 40000 5m 3584 47488 74368 51968 + 50000 5m 3584 52864 79744 57344 + 100000 5m 3584 78400 132160 82880 + 10000 40m 3584 32256 59136 36736 + 25000 40m 3584 41216 68096 45696 + 40000 40m 3584 47488 74368 51968 + 50000 40m 3584 52864 79744 57344 + 100000 40m 3584 78400 132160 82880 + 10000 300m 3584 32256 65856 36736 + 25000 300m 3584 41216 84672 45696 + 40000 300m 3584 47488 101024 51968 + 50000 300m 3584 52864 113120 57344 + 100000 300m 3584 78400 198688 82880 \ No newline at end of file diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.ini b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.ini new file mode 100755 index 000000000000..71bdd87e5c1a --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.ini @@ -0,0 +1,57 @@ +# name lanes alias index +Ethernet0 8 Ethernet1/1 0 +Ethernet1 9 Ethernet2/1 1 +Ethernet2 10 Ethernet3/1 2 +Ethernet3 11 Ethernet4/1 3 +Ethernet4 12 Ethernet5/1 4 +Ethernet5 13 Ethernet6/1 5 +Ethernet6 14 Ethernet7/1 6 +Ethernet7 15 Ethernet8/1 7 +Ethernet8 16 Ethernet9/1 8 +Ethernet9 17 Ethernet10/1 9 +Ethernet10 18 Ethernet11/1 10 +Ethernet11 19 Ethernet12/1 11 +Ethernet12 20 Ethernet13/1 12 +Ethernet13 21 Ethernet14/1 13 +Ethernet14 22 Ethernet15/1 14 +Ethernet15 23 Ethernet16/1 15 +Ethernet16 32 Ethernet17/1 16 +Ethernet17 33 Ethernet18/1 17 +Ethernet18 34 Ethernet19/1 18 +Ethernet19 35 Ethernet20/1 19 +Ethernet20 40 Ethernet21/1 20 +Ethernet21 41 Ethernet22/1 21 +Ethernet22 42 Ethernet23/1 22 +Ethernet23 43 Ethernet24/1 23 +Ethernet24 48 Ethernet25/1 24 +Ethernet25 49 Ethernet26/1 25 +Ethernet26 50 Ethernet27/1 26 +Ethernet27 51 Ethernet28/1 27 +Ethernet28 56 Ethernet29/1 28 +Ethernet29 57 Ethernet30/1 29 +Ethernet30 58 Ethernet31/1 30 +Ethernet31 59 Ethernet32/1 31 +Ethernet32 64 Ethernet33/1 32 +Ethernet33 65 Ethernet34/1 33 +Ethernet34 66 Ethernet35/1 34 +Ethernet35 67 Ethernet36/1 35 +Ethernet36 68 Ethernet37/1 36 +Ethernet37 69 Ethernet38/1 37 +Ethernet38 70 Ethernet39/1 38 +Ethernet39 71 Ethernet40/1 39 +Ethernet40 72 Ethernet41/1 40 +Ethernet41 73 Ethernet42/1 41 +Ethernet42 74 Ethernet43/1 42 +Ethernet43 75 Ethernet44/1 43 +Ethernet44 76 Ethernet45/1 44 +Ethernet45 77 Ethernet46/1 45 +Ethernet46 78 Ethernet47/1 46 +Ethernet47 79 Ethernet48/1 47 +Ethernet48 84,85,86,87 Ethernet49/1 48 +Ethernet49 80,81,82,83 Ethernet50/1 49 +Ethernet50 92,93,94,95 Ethernet51/1 50 +Ethernet51 88,89,90,91 Ethernet52/1 51 +Ethernet52 108,109,110,111 Ethernet53/1 52 +Ethernet53 104,105,106,107 Ethernet54/1 53 +Ethernet54 116,117,118,119 Ethernet55/1 54 +Ethernet55 112,113,114,115 Ethernet56/1 55 \ No newline at end of file diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps new file mode 100755 index 000000000000..857e5f1ede5f --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps @@ -0,0 +1,702 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x3.2.0.1 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x2.0.1.3 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x1 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x0.1.1.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x1.1.1.1 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x3 +port set property unit=0 portlist=0 speed=25g +port set property unit=0 portlist=1 speed=25g +port set property unit=0 portlist=2 speed=25g +port set property unit=0 portlist=3 speed=25g +port set property unit=0 portlist=4 speed=25g +port set property unit=0 portlist=5 speed=25g +port set property unit=0 portlist=6 speed=25g +port set property unit=0 portlist=7 speed=25g +port set property unit=0 portlist=8 speed=25g +port set property unit=0 portlist=9 speed=25g +port set property unit=0 portlist=10 speed=25g +port set property unit=0 portlist=11 speed=25g +port set property unit=0 portlist=12 speed=25g +port set property unit=0 portlist=13 speed=25g +port set property unit=0 portlist=14 speed=25g +port set property unit=0 portlist=15 speed=25g +port set property unit=0 portlist=16 speed=25g +port set property unit=0 portlist=17 speed=25g +port set property unit=0 portlist=18 speed=25g +port set property unit=0 portlist=19 speed=25g +port set property unit=0 portlist=20 speed=25g +port set property unit=0 portlist=21 speed=25g +port set property unit=0 portlist=22 speed=25g +port set property unit=0 portlist=23 speed=25g +port set property unit=0 portlist=24 speed=25g +port set property unit=0 portlist=25 speed=25g +port set property unit=0 portlist=26 speed=25g +port set property unit=0 portlist=27 speed=25g +port set property unit=0 portlist=28 speed=25g +port set property unit=0 portlist=29 speed=25g +port set property unit=0 portlist=30 speed=25g +port set property unit=0 portlist=31 speed=25g +port set property unit=0 portlist=32 speed=25g +port set property unit=0 portlist=33 speed=25g +port set property unit=0 portlist=34 speed=25g +port set property unit=0 portlist=35 speed=25g +port set property unit=0 portlist=36 speed=25g +port set property unit=0 portlist=37 speed=25g +port set property unit=0 portlist=38 speed=25g +port set property unit=0 portlist=39 speed=25g +port set property unit=0 portlist=40 speed=25g +port set property unit=0 portlist=41 speed=25g +port set property unit=0 portlist=42 speed=25g +port set property unit=0 portlist=43 speed=25g +port set property unit=0 portlist=44 speed=25g +port set property unit=0 portlist=45 speed=25g +port set property unit=0 portlist=46 speed=25g +port set property unit=0 portlist=47 speed=25g +port set property unit=0 portlist=48 speed=100g +port set property unit=0 portlist=49 speed=100g +port set property unit=0 portlist=50 speed=100g +port set property unit=0 portlist=51 speed=100g +port set property unit=0 portlist=52 speed=100g +port set property unit=0 portlist=53 speed=100g +port set property unit=0 portlist=54 speed=100g +port set property unit=0 portlist=55 speed=100g +port set property unit=0 portlist=129 speed=10g +port set property unit=0 portlist=130 speed=1g +port set property unit=0 portlist=0 medium-type=sr +port set property unit=0 portlist=1 medium-type=sr +port set property unit=0 portlist=2 medium-type=sr +port set property unit=0 portlist=3 medium-type=sr +port set property unit=0 portlist=4 medium-type=sr +port set property unit=0 portlist=5 medium-type=sr +port set property unit=0 portlist=6 medium-type=sr +port set property unit=0 portlist=7 medium-type=sr +port set property unit=0 portlist=8 medium-type=sr +port set property unit=0 portlist=9 medium-type=sr +port set property unit=0 portlist=10 medium-type=sr +port set property unit=0 portlist=11 medium-type=sr +port set property unit=0 portlist=12 medium-type=sr +port set property unit=0 portlist=13 medium-type=sr +port set property unit=0 portlist=14 medium-type=sr +port set property unit=0 portlist=15 medium-type=sr +port set property unit=0 portlist=16 medium-type=sr +port set property unit=0 portlist=17 medium-type=sr +port set property unit=0 portlist=18 medium-type=sr +port set property unit=0 portlist=19 medium-type=sr +port set property unit=0 portlist=20 medium-type=sr +port set property unit=0 portlist=21 medium-type=sr +port set property unit=0 portlist=22 medium-type=sr +port set property unit=0 portlist=23 medium-type=sr +port set property unit=0 portlist=24 medium-type=sr +port set property unit=0 portlist=25 medium-type=sr +port set property unit=0 portlist=26 medium-type=sr +port set property unit=0 portlist=27 medium-type=sr +port set property unit=0 portlist=28 medium-type=sr +port set property unit=0 portlist=29 medium-type=sr +port set property unit=0 portlist=30 medium-type=sr +port set property unit=0 portlist=31 medium-type=sr +port set property unit=0 portlist=32 medium-type=sr +port set property unit=0 portlist=33 medium-type=sr +port set property unit=0 portlist=34 medium-type=sr +port set property unit=0 portlist=35 medium-type=sr +port set property unit=0 portlist=36 medium-type=sr +port set property unit=0 portlist=37 medium-type=sr +port set property unit=0 portlist=38 medium-type=sr +port set property unit=0 portlist=39 medium-type=sr +port set property unit=0 portlist=40 medium-type=sr +port set property unit=0 portlist=41 medium-type=sr +port set property unit=0 portlist=42 medium-type=sr +port set property unit=0 portlist=43 medium-type=sr +port set property unit=0 portlist=44 medium-type=sr +port set property unit=0 portlist=45 medium-type=sr +port set property unit=0 portlist=46 medium-type=sr +port set property unit=0 portlist=47 medium-type=sr +port set property unit=0 portlist=48 medium-type=sr4 +port set property unit=0 portlist=49 medium-type=sr4 +port set property unit=0 portlist=50 medium-type=sr4 +port set property unit=0 portlist=51 medium-type=sr4 +port set property unit=0 portlist=52 medium-type=sr4 +port set property unit=0 portlist=53 medium-type=sr4 +port set property unit=0 portlist=54 medium-type=sr4 +port set property unit=0 portlist=55 medium-type=sr4 +port set property unit=0 portlist=129 medium-type=kr +port set property unit=0 portlist=130 medium-type=x +port advertise unit=0 portlist=129 speed-10g-kr +port set property unit=0 portlist=129 an=enable +port set property unit=0 portlist=0 admin=enable +port set property unit=0 portlist=1 admin=enable +port set property unit=0 portlist=2 admin=enable +port set property unit=0 portlist=3 admin=enable +port set property unit=0 portlist=4 admin=enable +port set property unit=0 portlist=5 admin=enable +port set property unit=0 portlist=6 admin=enable +port set property unit=0 portlist=7 admin=enable +port set property unit=0 portlist=8 admin=enable +port set property unit=0 portlist=9 admin=enable +port set property unit=0 portlist=10 admin=enable +port set property unit=0 portlist=11 admin=enable +port set property unit=0 portlist=12 admin=enable +port set property unit=0 portlist=13 admin=enable +port set property unit=0 portlist=14 admin=enable +port set property unit=0 portlist=15 admin=enable +port set property unit=0 portlist=16 admin=enable +port set property unit=0 portlist=17 admin=enable +port set property unit=0 portlist=18 admin=enable +port set property unit=0 portlist=19 admin=enable +port set property unit=0 portlist=20 admin=enable +port set property unit=0 portlist=21 admin=enable +port set property unit=0 portlist=22 admin=enable +port set property unit=0 portlist=23 admin=enable +port set property unit=0 portlist=24 admin=enable +port set property unit=0 portlist=25 admin=enable +port set property unit=0 portlist=26 admin=enable +port set property unit=0 portlist=27 admin=enable +port set property unit=0 portlist=28 admin=enable +port set property unit=0 portlist=29 admin=enable +port set property unit=0 portlist=30 admin=enable +port set property unit=0 portlist=31 admin=enable +port set property unit=0 portlist=32 admin=enable +port set property unit=0 portlist=33 admin=enable +port set property unit=0 portlist=34 admin=enable +port set property unit=0 portlist=35 admin=enable +port set property unit=0 portlist=36 admin=enable +port set property unit=0 portlist=37 admin=enable +port set property unit=0 portlist=38 admin=enable +port set property unit=0 portlist=39 admin=enable +port set property unit=0 portlist=40 admin=enable +port set property unit=0 portlist=41 admin=enable +port set property unit=0 portlist=42 admin=enable +port set property unit=0 portlist=43 admin=enable +port set property unit=0 portlist=44 admin=enable +port set property unit=0 portlist=45 admin=enable +port set property unit=0 portlist=46 admin=enable +port set property unit=0 portlist=47 admin=enable +port set property unit=0 portlist=48 admin=enable +port set property unit=0 portlist=49 admin=enable +port set property unit=0 portlist=50 admin=enable +port set property unit=0 portlist=51 admin=enable +port set property unit=0 portlist=52 admin=enable +port set property unit=0 portlist=53 admin=enable +port set property unit=0 portlist=54 admin=enable +port set property unit=0 portlist=55 admin=enable +port set property unit=0 portlist=129 admin=enable +port set property unit=0 portlist=130 admin=enable diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.AOC.R0B b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.AOC.R0B new file mode 100755 index 000000000000..857e5f1ede5f --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.AOC.R0B @@ -0,0 +1,702 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x3.2.0.1 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x2.0.1.3 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x1 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x0.1.1.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x1.1.1.1 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x3 +port set property unit=0 portlist=0 speed=25g +port set property unit=0 portlist=1 speed=25g +port set property unit=0 portlist=2 speed=25g +port set property unit=0 portlist=3 speed=25g +port set property unit=0 portlist=4 speed=25g +port set property unit=0 portlist=5 speed=25g +port set property unit=0 portlist=6 speed=25g +port set property unit=0 portlist=7 speed=25g +port set property unit=0 portlist=8 speed=25g +port set property unit=0 portlist=9 speed=25g +port set property unit=0 portlist=10 speed=25g +port set property unit=0 portlist=11 speed=25g +port set property unit=0 portlist=12 speed=25g +port set property unit=0 portlist=13 speed=25g +port set property unit=0 portlist=14 speed=25g +port set property unit=0 portlist=15 speed=25g +port set property unit=0 portlist=16 speed=25g +port set property unit=0 portlist=17 speed=25g +port set property unit=0 portlist=18 speed=25g +port set property unit=0 portlist=19 speed=25g +port set property unit=0 portlist=20 speed=25g +port set property unit=0 portlist=21 speed=25g +port set property unit=0 portlist=22 speed=25g +port set property unit=0 portlist=23 speed=25g +port set property unit=0 portlist=24 speed=25g +port set property unit=0 portlist=25 speed=25g +port set property unit=0 portlist=26 speed=25g +port set property unit=0 portlist=27 speed=25g +port set property unit=0 portlist=28 speed=25g +port set property unit=0 portlist=29 speed=25g +port set property unit=0 portlist=30 speed=25g +port set property unit=0 portlist=31 speed=25g +port set property unit=0 portlist=32 speed=25g +port set property unit=0 portlist=33 speed=25g +port set property unit=0 portlist=34 speed=25g +port set property unit=0 portlist=35 speed=25g +port set property unit=0 portlist=36 speed=25g +port set property unit=0 portlist=37 speed=25g +port set property unit=0 portlist=38 speed=25g +port set property unit=0 portlist=39 speed=25g +port set property unit=0 portlist=40 speed=25g +port set property unit=0 portlist=41 speed=25g +port set property unit=0 portlist=42 speed=25g +port set property unit=0 portlist=43 speed=25g +port set property unit=0 portlist=44 speed=25g +port set property unit=0 portlist=45 speed=25g +port set property unit=0 portlist=46 speed=25g +port set property unit=0 portlist=47 speed=25g +port set property unit=0 portlist=48 speed=100g +port set property unit=0 portlist=49 speed=100g +port set property unit=0 portlist=50 speed=100g +port set property unit=0 portlist=51 speed=100g +port set property unit=0 portlist=52 speed=100g +port set property unit=0 portlist=53 speed=100g +port set property unit=0 portlist=54 speed=100g +port set property unit=0 portlist=55 speed=100g +port set property unit=0 portlist=129 speed=10g +port set property unit=0 portlist=130 speed=1g +port set property unit=0 portlist=0 medium-type=sr +port set property unit=0 portlist=1 medium-type=sr +port set property unit=0 portlist=2 medium-type=sr +port set property unit=0 portlist=3 medium-type=sr +port set property unit=0 portlist=4 medium-type=sr +port set property unit=0 portlist=5 medium-type=sr +port set property unit=0 portlist=6 medium-type=sr +port set property unit=0 portlist=7 medium-type=sr +port set property unit=0 portlist=8 medium-type=sr +port set property unit=0 portlist=9 medium-type=sr +port set property unit=0 portlist=10 medium-type=sr +port set property unit=0 portlist=11 medium-type=sr +port set property unit=0 portlist=12 medium-type=sr +port set property unit=0 portlist=13 medium-type=sr +port set property unit=0 portlist=14 medium-type=sr +port set property unit=0 portlist=15 medium-type=sr +port set property unit=0 portlist=16 medium-type=sr +port set property unit=0 portlist=17 medium-type=sr +port set property unit=0 portlist=18 medium-type=sr +port set property unit=0 portlist=19 medium-type=sr +port set property unit=0 portlist=20 medium-type=sr +port set property unit=0 portlist=21 medium-type=sr +port set property unit=0 portlist=22 medium-type=sr +port set property unit=0 portlist=23 medium-type=sr +port set property unit=0 portlist=24 medium-type=sr +port set property unit=0 portlist=25 medium-type=sr +port set property unit=0 portlist=26 medium-type=sr +port set property unit=0 portlist=27 medium-type=sr +port set property unit=0 portlist=28 medium-type=sr +port set property unit=0 portlist=29 medium-type=sr +port set property unit=0 portlist=30 medium-type=sr +port set property unit=0 portlist=31 medium-type=sr +port set property unit=0 portlist=32 medium-type=sr +port set property unit=0 portlist=33 medium-type=sr +port set property unit=0 portlist=34 medium-type=sr +port set property unit=0 portlist=35 medium-type=sr +port set property unit=0 portlist=36 medium-type=sr +port set property unit=0 portlist=37 medium-type=sr +port set property unit=0 portlist=38 medium-type=sr +port set property unit=0 portlist=39 medium-type=sr +port set property unit=0 portlist=40 medium-type=sr +port set property unit=0 portlist=41 medium-type=sr +port set property unit=0 portlist=42 medium-type=sr +port set property unit=0 portlist=43 medium-type=sr +port set property unit=0 portlist=44 medium-type=sr +port set property unit=0 portlist=45 medium-type=sr +port set property unit=0 portlist=46 medium-type=sr +port set property unit=0 portlist=47 medium-type=sr +port set property unit=0 portlist=48 medium-type=sr4 +port set property unit=0 portlist=49 medium-type=sr4 +port set property unit=0 portlist=50 medium-type=sr4 +port set property unit=0 portlist=51 medium-type=sr4 +port set property unit=0 portlist=52 medium-type=sr4 +port set property unit=0 portlist=53 medium-type=sr4 +port set property unit=0 portlist=54 medium-type=sr4 +port set property unit=0 portlist=55 medium-type=sr4 +port set property unit=0 portlist=129 medium-type=kr +port set property unit=0 portlist=130 medium-type=x +port advertise unit=0 portlist=129 speed-10g-kr +port set property unit=0 portlist=129 an=enable +port set property unit=0 portlist=0 admin=enable +port set property unit=0 portlist=1 admin=enable +port set property unit=0 portlist=2 admin=enable +port set property unit=0 portlist=3 admin=enable +port set property unit=0 portlist=4 admin=enable +port set property unit=0 portlist=5 admin=enable +port set property unit=0 portlist=6 admin=enable +port set property unit=0 portlist=7 admin=enable +port set property unit=0 portlist=8 admin=enable +port set property unit=0 portlist=9 admin=enable +port set property unit=0 portlist=10 admin=enable +port set property unit=0 portlist=11 admin=enable +port set property unit=0 portlist=12 admin=enable +port set property unit=0 portlist=13 admin=enable +port set property unit=0 portlist=14 admin=enable +port set property unit=0 portlist=15 admin=enable +port set property unit=0 portlist=16 admin=enable +port set property unit=0 portlist=17 admin=enable +port set property unit=0 portlist=18 admin=enable +port set property unit=0 portlist=19 admin=enable +port set property unit=0 portlist=20 admin=enable +port set property unit=0 portlist=21 admin=enable +port set property unit=0 portlist=22 admin=enable +port set property unit=0 portlist=23 admin=enable +port set property unit=0 portlist=24 admin=enable +port set property unit=0 portlist=25 admin=enable +port set property unit=0 portlist=26 admin=enable +port set property unit=0 portlist=27 admin=enable +port set property unit=0 portlist=28 admin=enable +port set property unit=0 portlist=29 admin=enable +port set property unit=0 portlist=30 admin=enable +port set property unit=0 portlist=31 admin=enable +port set property unit=0 portlist=32 admin=enable +port set property unit=0 portlist=33 admin=enable +port set property unit=0 portlist=34 admin=enable +port set property unit=0 portlist=35 admin=enable +port set property unit=0 portlist=36 admin=enable +port set property unit=0 portlist=37 admin=enable +port set property unit=0 portlist=38 admin=enable +port set property unit=0 portlist=39 admin=enable +port set property unit=0 portlist=40 admin=enable +port set property unit=0 portlist=41 admin=enable +port set property unit=0 portlist=42 admin=enable +port set property unit=0 portlist=43 admin=enable +port set property unit=0 portlist=44 admin=enable +port set property unit=0 portlist=45 admin=enable +port set property unit=0 portlist=46 admin=enable +port set property unit=0 portlist=47 admin=enable +port set property unit=0 portlist=48 admin=enable +port set property unit=0 portlist=49 admin=enable +port set property unit=0 portlist=50 admin=enable +port set property unit=0 portlist=51 admin=enable +port set property unit=0 portlist=52 admin=enable +port set property unit=0 portlist=53 admin=enable +port set property unit=0 portlist=54 admin=enable +port set property unit=0 portlist=55 admin=enable +port set property unit=0 portlist=129 admin=enable +port set property unit=0 portlist=130 admin=enable diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.DAC.R0B b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.DAC.R0B new file mode 100755 index 000000000000..857e5f1ede5f --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/port_config.nps.DAC.R0B @@ -0,0 +1,702 @@ +init start stage unit=0 low-level +init set port-map unit=0 port=0 eth-macro=2 lane=0 max-speed=25g active=true +init set port-map unit=0 port=1 eth-macro=2 lane=1 max-speed=25g active=true +init set port-map unit=0 port=2 eth-macro=2 lane=2 max-speed=25g active=true +init set port-map unit=0 port=3 eth-macro=2 lane=3 max-speed=25g active=true +init set port-map unit=0 port=4 eth-macro=3 lane=0 max-speed=25g active=true +init set port-map unit=0 port=5 eth-macro=3 lane=1 max-speed=25g active=true +init set port-map unit=0 port=6 eth-macro=3 lane=2 max-speed=25g active=true +init set port-map unit=0 port=7 eth-macro=3 lane=3 max-speed=25g active=true +init set port-map unit=0 port=8 eth-macro=4 lane=0 max-speed=25g active=true +init set port-map unit=0 port=9 eth-macro=4 lane=1 max-speed=25g active=true +init set port-map unit=0 port=10 eth-macro=4 lane=2 max-speed=25g active=true +init set port-map unit=0 port=11 eth-macro=4 lane=3 max-speed=25g active=true +init set port-map unit=0 port=12 eth-macro=5 lane=0 max-speed=25g active=true +init set port-map unit=0 port=13 eth-macro=5 lane=1 max-speed=25g active=true +init set port-map unit=0 port=14 eth-macro=5 lane=2 max-speed=25g active=true +init set port-map unit=0 port=15 eth-macro=5 lane=3 max-speed=25g active=true +init set port-map unit=0 port=16 eth-macro=8 lane=0 max-speed=25g active=true +init set port-map unit=0 port=17 eth-macro=8 lane=1 max-speed=25g active=true +init set port-map unit=0 port=18 eth-macro=8 lane=2 max-speed=25g active=true +init set port-map unit=0 port=19 eth-macro=8 lane=3 max-speed=25g active=true +init set port-map unit=0 port=20 eth-macro=10 lane=0 max-speed=25g active=true +init set port-map unit=0 port=21 eth-macro=10 lane=1 max-speed=25g active=true +init set port-map unit=0 port=22 eth-macro=10 lane=2 max-speed=25g active=true +init set port-map unit=0 port=23 eth-macro=10 lane=3 max-speed=25g active=true +init set port-map unit=0 port=24 eth-macro=12 lane=0 max-speed=25g active=true +init set port-map unit=0 port=25 eth-macro=12 lane=1 max-speed=25g active=true +init set port-map unit=0 port=26 eth-macro=12 lane=2 max-speed=25g active=true +init set port-map unit=0 port=27 eth-macro=12 lane=3 max-speed=25g active=true +init set port-map unit=0 port=28 eth-macro=14 lane=0 max-speed=25g active=true +init set port-map unit=0 port=29 eth-macro=14 lane=1 max-speed=25g active=true +init set port-map unit=0 port=30 eth-macro=14 lane=2 max-speed=25g active=true +init set port-map unit=0 port=31 eth-macro=14 lane=3 max-speed=25g active=true +init set port-map unit=0 port=32 eth-macro=16 lane=0 max-speed=25g active=true +init set port-map unit=0 port=33 eth-macro=16 lane=1 max-speed=25g active=true +init set port-map unit=0 port=34 eth-macro=16 lane=2 max-speed=25g active=true +init set port-map unit=0 port=35 eth-macro=16 lane=3 max-speed=25g active=true +init set port-map unit=0 port=36 eth-macro=17 lane=0 max-speed=25g active=true +init set port-map unit=0 port=37 eth-macro=17 lane=1 max-speed=25g active=true +init set port-map unit=0 port=38 eth-macro=17 lane=2 max-speed=25g active=true +init set port-map unit=0 port=39 eth-macro=17 lane=3 max-speed=25g active=true +init set port-map unit=0 port=40 eth-macro=18 lane=0 max-speed=25g active=true +init set port-map unit=0 port=41 eth-macro=18 lane=1 max-speed=25g active=true +init set port-map unit=0 port=42 eth-macro=18 lane=2 max-speed=25g active=true +init set port-map unit=0 port=43 eth-macro=18 lane=3 max-speed=25g active=true +init set port-map unit=0 port=44 eth-macro=19 lane=0 max-speed=25g active=true +init set port-map unit=0 port=45 eth-macro=19 lane=1 max-speed=25g active=true +init set port-map unit=0 port=46 eth-macro=19 lane=2 max-speed=25g active=true +init set port-map unit=0 port=47 eth-macro=19 lane=3 max-speed=25g active=true +init set port-map unit=0 port=48 eth-macro=21 lane=0 max-speed=100g active=true +init set port-map unit=0 port=49 eth-macro=20 lane=0 max-speed=100g active=true +init set port-map unit=0 port=50 eth-macro=23 lane=0 max-speed=100g active=true +init set port-map unit=0 port=51 eth-macro=22 lane=0 max-speed=100g active=true +init set port-map unit=0 port=52 eth-macro=27 lane=0 max-speed=100g active=true +init set port-map unit=0 port=53 eth-macro=26 lane=0 max-speed=100g active=true +init set port-map unit=0 port=54 eth-macro=29 lane=0 max-speed=100g active=true +init set port-map unit=0 port=55 eth-macro=28 lane=0 max-speed=100g active=true +init set port-map unit=0 port=129 eth-macro=0 lane=1 max-speed=10g active=true guarantee=true cpi=true +init set port-map unit=0 port=130 eth-macro=0 lane=0 max-speed=10g active=true guarantee=true cpi=true init-done=true +init start stage unit=0 task-rsrc +init start stage unit=0 module +init start stage unit=0 task +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=tx data=0x2 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=tx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=tx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.1.2.3 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=tx data=0x3.2.0.1 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=tx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=tx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set lane-swap unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=1 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=2 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=3 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=4 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=5 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=7 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=9 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=10 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=11 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=12 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=13 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=14 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=17 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=18 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=19 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=21 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=22 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=23 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=25 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=26 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=27 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=29 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=30 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=31 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=32 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=33 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=35 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=36 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=37 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=39 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=40 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=41 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=43 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=44 lane-cnt=1 property=rx data=0x2 +phy set lane-swap unit=0 portlist=45 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set lane-swap unit=0 portlist=47 lane-cnt=1 property=rx data=0x3 +phy set lane-swap unit=0 portlist=48 lane-cnt=4 property=rx data=0x3.1.0.2 +phy set lane-swap unit=0 portlist=49 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=50 lane-cnt=4 property=rx data=0x3.0.1.2 +phy set lane-swap unit=0 portlist=51 lane-cnt=4 property=rx data=0x3.2.1.0 +phy set lane-swap unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=53 lane-cnt=4 property=rx data=0x2.0.1.3 +phy set lane-swap unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=55 lane-cnt=4 property=rx data=0x1.0.3.2 +phy set lane-swap unit=0 portlist=129 lane-cnt=1 property=rx data=0x1 +phy set lane-swap unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=tx data=0x1 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=tx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=tx data=0x0 +phy set polarity-rev unit=0 portlist=0 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=1 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=2 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=3 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=4 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=5 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=6 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=7 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=8 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=9 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=10 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=11 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=12 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=13 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=14 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=15 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=16 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=17 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=18 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=19 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=20 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=21 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=22 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=23 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=24 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=25 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=26 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=27 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=28 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=29 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=30 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=31 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=32 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=33 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=34 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=35 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=36 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=37 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=38 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=39 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=40 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=41 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=42 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=43 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=44 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=45 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=46 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=47 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=48 lane-cnt=4 property=rx data=0x0.1.1.0 +phy set polarity-rev unit=0 portlist=49 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=50 lane-cnt=4 property=rx data=0x1.1.1.1 +phy set polarity-rev unit=0 portlist=51 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=52 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=53 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=54 lane-cnt=4 property=rx data=0x1.1.1.0 +phy set polarity-rev unit=0 portlist=55 lane-cnt=4 property=rx data=0x0.0.0.0 +phy set polarity-rev unit=0 portlist=129 lane-cnt=1 property=rx data=0x0 +phy set polarity-rev unit=0 portlist=130 lane-cnt=1 property=rx data=0x0 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=0 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=1 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=2 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=3 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=4 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=5 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=6 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c0 data=0x1a +phy set pre-emphasis unit=0 portlist=7 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=8 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=9 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=10 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=11 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=12 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=13 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=14 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c0 data=0x1b +phy set pre-emphasis unit=0 portlist=15 lane-cnt=1 property=c1 data=0x7 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=16 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=17 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=18 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=19 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=20 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=21 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=22 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=23 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=24 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=25 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=26 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=27 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=28 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=29 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=30 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=31 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=32 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=33 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=34 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=35 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=36 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=37 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=38 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=39 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=40 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=41 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=42 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=43 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=44 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=45 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=46 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c2 data=0x2 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c0 data=0x1c +phy set pre-emphasis unit=0 portlist=47 lane-cnt=1 property=c1 data=0x6 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=48 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=49 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=50 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=51 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=52 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=53 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=54 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c2 data=0x2.2.2.2 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=cn1 data=0x0.0.0.0 +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c0 data=0x1b.1b.1b.1b +phy set pre-emphasis unit=0 portlist=55 lane-cnt=4 property=c1 data=0x6.6.6.6 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=cn1 data=0x1 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=129 lane-cnt=1 property=c1 data=0x3 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c2 data=0x1 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=cn1 data=0x0 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c0 data=0x2 +phy set pre-emphasis unit=0 portlist=130 lane-cnt=1 property=c1 data=0x3 +port set property unit=0 portlist=0 speed=25g +port set property unit=0 portlist=1 speed=25g +port set property unit=0 portlist=2 speed=25g +port set property unit=0 portlist=3 speed=25g +port set property unit=0 portlist=4 speed=25g +port set property unit=0 portlist=5 speed=25g +port set property unit=0 portlist=6 speed=25g +port set property unit=0 portlist=7 speed=25g +port set property unit=0 portlist=8 speed=25g +port set property unit=0 portlist=9 speed=25g +port set property unit=0 portlist=10 speed=25g +port set property unit=0 portlist=11 speed=25g +port set property unit=0 portlist=12 speed=25g +port set property unit=0 portlist=13 speed=25g +port set property unit=0 portlist=14 speed=25g +port set property unit=0 portlist=15 speed=25g +port set property unit=0 portlist=16 speed=25g +port set property unit=0 portlist=17 speed=25g +port set property unit=0 portlist=18 speed=25g +port set property unit=0 portlist=19 speed=25g +port set property unit=0 portlist=20 speed=25g +port set property unit=0 portlist=21 speed=25g +port set property unit=0 portlist=22 speed=25g +port set property unit=0 portlist=23 speed=25g +port set property unit=0 portlist=24 speed=25g +port set property unit=0 portlist=25 speed=25g +port set property unit=0 portlist=26 speed=25g +port set property unit=0 portlist=27 speed=25g +port set property unit=0 portlist=28 speed=25g +port set property unit=0 portlist=29 speed=25g +port set property unit=0 portlist=30 speed=25g +port set property unit=0 portlist=31 speed=25g +port set property unit=0 portlist=32 speed=25g +port set property unit=0 portlist=33 speed=25g +port set property unit=0 portlist=34 speed=25g +port set property unit=0 portlist=35 speed=25g +port set property unit=0 portlist=36 speed=25g +port set property unit=0 portlist=37 speed=25g +port set property unit=0 portlist=38 speed=25g +port set property unit=0 portlist=39 speed=25g +port set property unit=0 portlist=40 speed=25g +port set property unit=0 portlist=41 speed=25g +port set property unit=0 portlist=42 speed=25g +port set property unit=0 portlist=43 speed=25g +port set property unit=0 portlist=44 speed=25g +port set property unit=0 portlist=45 speed=25g +port set property unit=0 portlist=46 speed=25g +port set property unit=0 portlist=47 speed=25g +port set property unit=0 portlist=48 speed=100g +port set property unit=0 portlist=49 speed=100g +port set property unit=0 portlist=50 speed=100g +port set property unit=0 portlist=51 speed=100g +port set property unit=0 portlist=52 speed=100g +port set property unit=0 portlist=53 speed=100g +port set property unit=0 portlist=54 speed=100g +port set property unit=0 portlist=55 speed=100g +port set property unit=0 portlist=129 speed=10g +port set property unit=0 portlist=130 speed=1g +port set property unit=0 portlist=0 medium-type=sr +port set property unit=0 portlist=1 medium-type=sr +port set property unit=0 portlist=2 medium-type=sr +port set property unit=0 portlist=3 medium-type=sr +port set property unit=0 portlist=4 medium-type=sr +port set property unit=0 portlist=5 medium-type=sr +port set property unit=0 portlist=6 medium-type=sr +port set property unit=0 portlist=7 medium-type=sr +port set property unit=0 portlist=8 medium-type=sr +port set property unit=0 portlist=9 medium-type=sr +port set property unit=0 portlist=10 medium-type=sr +port set property unit=0 portlist=11 medium-type=sr +port set property unit=0 portlist=12 medium-type=sr +port set property unit=0 portlist=13 medium-type=sr +port set property unit=0 portlist=14 medium-type=sr +port set property unit=0 portlist=15 medium-type=sr +port set property unit=0 portlist=16 medium-type=sr +port set property unit=0 portlist=17 medium-type=sr +port set property unit=0 portlist=18 medium-type=sr +port set property unit=0 portlist=19 medium-type=sr +port set property unit=0 portlist=20 medium-type=sr +port set property unit=0 portlist=21 medium-type=sr +port set property unit=0 portlist=22 medium-type=sr +port set property unit=0 portlist=23 medium-type=sr +port set property unit=0 portlist=24 medium-type=sr +port set property unit=0 portlist=25 medium-type=sr +port set property unit=0 portlist=26 medium-type=sr +port set property unit=0 portlist=27 medium-type=sr +port set property unit=0 portlist=28 medium-type=sr +port set property unit=0 portlist=29 medium-type=sr +port set property unit=0 portlist=30 medium-type=sr +port set property unit=0 portlist=31 medium-type=sr +port set property unit=0 portlist=32 medium-type=sr +port set property unit=0 portlist=33 medium-type=sr +port set property unit=0 portlist=34 medium-type=sr +port set property unit=0 portlist=35 medium-type=sr +port set property unit=0 portlist=36 medium-type=sr +port set property unit=0 portlist=37 medium-type=sr +port set property unit=0 portlist=38 medium-type=sr +port set property unit=0 portlist=39 medium-type=sr +port set property unit=0 portlist=40 medium-type=sr +port set property unit=0 portlist=41 medium-type=sr +port set property unit=0 portlist=42 medium-type=sr +port set property unit=0 portlist=43 medium-type=sr +port set property unit=0 portlist=44 medium-type=sr +port set property unit=0 portlist=45 medium-type=sr +port set property unit=0 portlist=46 medium-type=sr +port set property unit=0 portlist=47 medium-type=sr +port set property unit=0 portlist=48 medium-type=sr4 +port set property unit=0 portlist=49 medium-type=sr4 +port set property unit=0 portlist=50 medium-type=sr4 +port set property unit=0 portlist=51 medium-type=sr4 +port set property unit=0 portlist=52 medium-type=sr4 +port set property unit=0 portlist=53 medium-type=sr4 +port set property unit=0 portlist=54 medium-type=sr4 +port set property unit=0 portlist=55 medium-type=sr4 +port set property unit=0 portlist=129 medium-type=kr +port set property unit=0 portlist=130 medium-type=x +port advertise unit=0 portlist=129 speed-10g-kr +port set property unit=0 portlist=129 an=enable +port set property unit=0 portlist=0 admin=enable +port set property unit=0 portlist=1 admin=enable +port set property unit=0 portlist=2 admin=enable +port set property unit=0 portlist=3 admin=enable +port set property unit=0 portlist=4 admin=enable +port set property unit=0 portlist=5 admin=enable +port set property unit=0 portlist=6 admin=enable +port set property unit=0 portlist=7 admin=enable +port set property unit=0 portlist=8 admin=enable +port set property unit=0 portlist=9 admin=enable +port set property unit=0 portlist=10 admin=enable +port set property unit=0 portlist=11 admin=enable +port set property unit=0 portlist=12 admin=enable +port set property unit=0 portlist=13 admin=enable +port set property unit=0 portlist=14 admin=enable +port set property unit=0 portlist=15 admin=enable +port set property unit=0 portlist=16 admin=enable +port set property unit=0 portlist=17 admin=enable +port set property unit=0 portlist=18 admin=enable +port set property unit=0 portlist=19 admin=enable +port set property unit=0 portlist=20 admin=enable +port set property unit=0 portlist=21 admin=enable +port set property unit=0 portlist=22 admin=enable +port set property unit=0 portlist=23 admin=enable +port set property unit=0 portlist=24 admin=enable +port set property unit=0 portlist=25 admin=enable +port set property unit=0 portlist=26 admin=enable +port set property unit=0 portlist=27 admin=enable +port set property unit=0 portlist=28 admin=enable +port set property unit=0 portlist=29 admin=enable +port set property unit=0 portlist=30 admin=enable +port set property unit=0 portlist=31 admin=enable +port set property unit=0 portlist=32 admin=enable +port set property unit=0 portlist=33 admin=enable +port set property unit=0 portlist=34 admin=enable +port set property unit=0 portlist=35 admin=enable +port set property unit=0 portlist=36 admin=enable +port set property unit=0 portlist=37 admin=enable +port set property unit=0 portlist=38 admin=enable +port set property unit=0 portlist=39 admin=enable +port set property unit=0 portlist=40 admin=enable +port set property unit=0 portlist=41 admin=enable +port set property unit=0 portlist=42 admin=enable +port set property unit=0 portlist=43 admin=enable +port set property unit=0 portlist=44 admin=enable +port set property unit=0 portlist=45 admin=enable +port set property unit=0 portlist=46 admin=enable +port set property unit=0 portlist=47 admin=enable +port set property unit=0 portlist=48 admin=enable +port set property unit=0 portlist=49 admin=enable +port set property unit=0 portlist=50 admin=enable +port set property unit=0 portlist=51 admin=enable +port set property unit=0 portlist=52 admin=enable +port set property unit=0 portlist=53 admin=enable +port set property unit=0 portlist=54 admin=enable +port set property unit=0 portlist=55 admin=enable +port set property unit=0 portlist=129 admin=enable +port set property unit=0 portlist=130 admin=enable diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/qos.json.j2 b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/qos.json.j2 new file mode 100755 index 000000000000..5c5fc6e4969b --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/qos.json.j2 @@ -0,0 +1,136 @@ +{ + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "MAP_PFC_PRIORITY_TO_QUEUE": { + "AZURE": { + "3": "3", + "4": "4" + } + }, + "TC_TO_QUEUE_MAP": { + "AZURE": { + "0": "1", + "1": "0", + "3": "3", + "4": "4" + } + }, + "DSCP_TO_TC_MAP": { + "AZURE": { + "0":"1", + "1":"0", + "2":"0", + "3":"3", + "4":"4", + "5":"0", + "6":"0", + "7":"0", + "8":"1", + "9":"0", + "10":"0", + "11":"0", + "12":"0", + "13":"0", + "14":"0", + "15":"0", + "16":"0", + "17":"0", + "18":"0", + "19":"0", + "20":"0", + "21":"0", + "22":"0", + "23":"0", + "24":"0", + "25":"0", + "26":"0", + "27":"0", + "28":"0", + "29":"0", + "30":"0", + "31":"0", + "32":"0", + "33":"0", + "34":"0", + "35":"0", + "36":"0", + "37":"0", + "38":"0", + "39":"0", + "40":"0", + "41":"0", + "42":"0", + "43":"0", + "44":"0", + "45":"0", + "46":"0", + "47":"0", + "48":"0", + "49":"0", + "50":"0", + "51":"0", + "52":"0", + "53":"0", + "54":"0", + "55":"0", + "56":"0", + "57":"0", + "58":"0", + "59":"0", + "60":"0", + "61":"0", + "62":"0", + "63":"0" + } + }, + "SCHEDULER": { + "scheduler.0" : { + "type":"DWRR", + "weight": "25" + }, + "scheduler.1" : { + "type":"DWRR", + "weight": "30" + }, + "scheduler.2" : { + "type":"DWRR", + "weight": "20" + } + }, + "PORT_QOS_MAP": { + }, + "WRED_PROFILE": { + "AZURE_LOSSY" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + }, + "AZURE_LOSSLESS" : { + "wred_green_enable":"true", + "wred_yellow_enable":"true", + "wred_red_enable":"true", + "ecn":"ecn_all", + "red_max_threshold":"613984", + "red_min_threshold":"76608", + "yellow_max_threshold":"628320", + "yellow_min_threshold":"78400", + "green_max_threshold": "642656", + "green_min_threshold": "80192" + } + }, + "QUEUE": { + } +} diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/sai.profile b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/sai.profile new file mode 100755 index 000000000000..880f47910ac1 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/Cig-CS6436-56P/sai.profile @@ -0,0 +1,2 @@ +SAI_INIT_CONFIG_FILE=/usr/share/sonic/platform/led_proc_init.nps +SAI_DSH_CONFIG_FILE=/usr/share/sonic/hwsku/port_config.nps diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/installer.conf b/device/cig/x86_64-cig_cs6436_56p-r0/installer.conf new file mode 100755 index 000000000000..01b639138116 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/installer.conf @@ -0,0 +1,4 @@ +CONSOLE_PORT=0x3e8 +CONSOLE_DEV=2 +CONSOLE_SPEED=115200 +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="pci=noaer" diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/led_proc_init.nps b/device/cig/x86_64-cig_cs6436_56p-r0/led_proc_init.nps new file mode 100755 index 000000000000..3ba2f35e5517 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/led_proc_init.nps @@ -0,0 +1,10 @@ +#unit NPS_CFG_TYPE_XXX param0 param1 value +#---- ---------------- ------ ------ ----- +0 NPS_CFG_TYPE_USE_UNIT_PORT 0 0 1 +0 NPS_CFG_TYPE_LED_CFG 0 0 7 +0 NPS_CFG_TYPE_CPI_PORT_MODE 129 0 1 +0 NPS_CFG_TYPE_CPI_PORT_MODE 130 0 1 +0 NPS_CFG_TYPE_USER_BUF_CTRL 0 0 1 +0 NPS_CFG_TYPE_HASH_L2_FDB_REGION_ENTRY_NUM 0 0 49152 +0 NPS_CFG_TYPE_HASH_L3_WITH_IPV6_PREFIX_64_REGION_ENTRY_NUM 0 0 32768 + diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/minigraph.xml b/device/cig/x86_64-cig_cs6436_56p-r0/minigraph.xml new file mode 100755 index 000000000000..cd9fe2e801be --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/minigraph.xml @@ -0,0 +1,68 @@ + + + + + + + + + + HostIP + Loopback0 + + 10.1.0.32/32 + + 10.1.0.32/32 + + + + + + + + switch1 + + + + + + + + + + + + + switch1 + Cig-CS6436-56P + + + + + + + switch1 + + + DhcpResources + + + + + NtpResources + + 0.debian.pool.ntp.org;1.debian.pool.ntp.org;2.debian.pool.ntp.org;3.debian.pool.ntp.org + + + SyslogResources + + + + + + + + + switch1 + Cig-CS6436-56P + diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/plugins/eeprom.py b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/eeprom.py new file mode 100755 index 000000000000..c64a4d14dfc3 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/eeprom.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +try: + import exceptions + import binascii + import time + import optparse + import warnings + import os + import sys + from sonic_eeprom import eeprom_base + from sonic_eeprom import eeprom_tlvinfo + import subprocess +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + +class board(eeprom_tlvinfo.TlvInfoDecoder): + _TLV_INFO_MAX_LEN = 256 + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/bus/i2c/devices/6-0057/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/plugins/psuutil.py b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/psuutil.py new file mode 100755 index 000000000000..4ecf61051a66 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/psuutil.py @@ -0,0 +1,92 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +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""" + + SYSFS_PSU_DIR = ["/sys/bus/i2c/devices/4-005a", + "/sys/bus/i2c/devices/4-005b"] + + def __init__(self): + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + 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 + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + attr_file = 'psu_power_good' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + psu_absent = 0 + attr_file ='psu_present' + attr_path = self.SYSFS_PSU_DIR[index-1] +'/' + attr_file + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 16) + # Check for PSU presence + if (attr_value == 1): + status = 1 + + return status + diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/plugins/sfputil.py b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/sfputil.py new file mode 100755 index 000000000000..0d2edd85e6e4 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/plugins/sfputil.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python + +try: + import time + from sonic_sfp.sfputilbase import SfpUtilBase +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class SfpUtil(SfpUtilBase): + """Platform specific SfpUtill class""" + + _port_start = 0 + _port_end = 55 + _qsfp_port_start = 48 + _ports_in_block = 55 + + _port_to_eeprom_mapping = {} + _port_to_i2c_mapping = { + 0 : 7, + 1 : 8, + 2 : 9, + 3 : 10, + 4 : 11, + 5 : 12, + 6 : 13, + 7 : 14, + 8 : 15, + 9 : 16, + 10 : 17, + 11 : 18, + 12 : 19, + 13 : 20, + 14 : 21, + 15 : 22, + 16 : 23, + 17 : 24, + 18 : 25, + 19 : 26, + 20 : 27, + 21 : 28, + 22 : 29, + 23 : 30, + 24 : 31, + 25 : 32, + 26 : 33, + 27 : 34, + 28 : 35, + 29 : 36, + 30 : 37, + 31 : 38, + 32 : 39, + 33 : 40, + 34 : 41, + 35 : 42, + 36 : 43, + 37 : 44, + 38 : 45, + 39 : 46, + 40 : 47, + 41 : 48, + 42 : 49, + 43 : 50, + 44 : 51, + 45 : 52, + 46 : 53, + 47 : 54, + 48 : 55, + 49 : 56, + 50 : 57, + 51 : 58, + 52 : 59, + 53 : 60, + 54 : 61, + 55 : 62, + } + + _qsfp_ports = range(_qsfp_port_start, _ports_in_block + 1) + + def __init__(self): + eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom' + for x in range(self._port_start, self._port_end + 1): + port_eeprom_path = eeprom_path.format(self._port_to_i2c_mapping[x]) + self._port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset" + port_ps = path.format(self._port_to_i2c_mapping[port_num]) + + try: + reg_file = open(port_ps, 'w') + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + #toggle reset + reg_file.seek(0) + reg_file.write('1') + time.sleep(1) + reg_file.seek(0) + reg_file.write('0') + reg_file.close() + return True + + def set_low_power_mode(self, port_nuM, lpmode): + raise NotImplementedError + + def get_low_power_mode(self, port_num): + raise NotImplementedError + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self._port_start or port_num > self._port_end: + return False + + path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present" + port_ps = path.format(self._port_to_i2c_mapping[port_num]) + + + try: + reg_file = open(port_ps) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + reg_value = reg_file.readline().rstrip() + if reg_value == '1': + return True + + return False + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError + + @property + def port_start(self): + return self._port_start + + @property + def port_end(self): + return self._port_end + + @property + def qsfp_ports(self): + return self._qsfp_ports + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping diff --git a/device/cig/x86_64-cig_cs6436_56p-r0/sensors.conf b/device/cig/x86_64-cig_cs6436_56p-r0/sensors.conf new file mode 100755 index 000000000000..565186de2807 --- /dev/null +++ b/device/cig/x86_64-cig_cs6436_56p-r0/sensors.conf @@ -0,0 +1,13 @@ +# libsensors configuration file + +chip "cs6436_56p_fan-*" + label fan1 "front fan 1" + label fan2 "front fan 2" + label fan3 "front fan 3" + label fan4 "front fan 4" + label fan5 "front fan 5" + label fan6 "rear fan 1" + label fan7 "rear fan 2" + label fan8 "rear fan 3" + label fan9 "rear fan 4" + label fan10 "rear fan 5" diff --git a/platform/nephos/one-image.mk b/platform/nephos/one-image.mk old mode 100644 new mode 100755 index ace042d5ce4f..d29d0e8c9350 --- a/platform/nephos/one-image.mk +++ b/platform/nephos/one-image.mk @@ -5,7 +5,8 @@ $(SONIC_ONE_IMAGE)_MACHINE = nephos $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie $(SONIC_ONE_IMAGE)_INSTALLS += $(NEPHOS_NPS_KERNEL) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9130_32X_PLATFORM_MODULE) \ - $(INGRASYS_S9230_64X_PLATFORM_MODULE) \ - $(ACCTON_AS7116_54X_PLATFORM_MODULE) + $(INGRASYS_S9230_64X_PLATFORM_MODULE) \ + $(ACCTON_AS7116_54X_PLATFORM_MODULE) \ + $(CIG_CS6436_56P_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES) SONIC_INSTALLERS += $(SONIC_ONE_IMAGE) diff --git a/platform/nephos/platform-modules-cig.mk b/platform/nephos/platform-modules-cig.mk new file mode 100755 index 000000000000..98bbadf9ce3c --- /dev/null +++ b/platform/nephos/platform-modules-cig.mk @@ -0,0 +1,12 @@ +# Cig CS6436 56P Platform modules + +CIG_CS6436_56P_PLATFORM_MODULE_VERSION = 1.0.0 + +export CIG_CS6436_56P_PLATFORM_MODULE_VERSION + +CIG_CS6436_56P_PLATFORM_MODULE = sonic-platform-cig-cs6436-56p_$(CIG_CS6436_56P_PLATFORM_MODULE_VERSION)_amd64.deb +$(CIG_CS6436_56P_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-cig +$(CIG_CS6436_56P_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) +$(CIG_CS6436_56P_PLATFORM_MODULE)_PLATFORM = x86_64-cig_cs6436_56p-r0 +SONIC_DPKG_DEBS += $(CIG_CS6436_56P_PLATFORM_MODULE) +SONIC_STRETCH_DEBS += $(CIG_CS6436_56P_PLATFORM_MODULE) \ No newline at end of file diff --git a/platform/nephos/rules.mk b/platform/nephos/rules.mk old mode 100644 new mode 100755 index bf77ad0e6edf..2e2ee702fb5b --- a/platform/nephos/rules.mk +++ b/platform/nephos/rules.mk @@ -2,6 +2,7 @@ include $(PLATFORM_PATH)/sdk.mk include $(PLATFORM_PATH)/sai.mk include $(PLATFORM_PATH)/platform-modules-ingrasys.mk include $(PLATFORM_PATH)/platform-modules-accton.mk +include $(PLATFORM_PATH)/platform-modules-cig.mk include $(PLATFORM_PATH)/docker-orchagent-nephos.mk include $(PLATFORM_PATH)/docker-syncd-nephos.mk include $(PLATFORM_PATH)/docker-syncd-nephos-rpc.mk diff --git a/platform/nephos/sonic-platform-modules-cig/LICENSE b/platform/nephos/sonic-platform-modules-cig/LICENSE new file mode 100755 index 000000000000..baf27e167418 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/LICENSE @@ -0,0 +1,16 @@ +Copyright (C) 2016 Microsoft, Inc +Copyright (C) 2017 Cambridgeig Technology Corporation + +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. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/platform/nephos/sonic-platform-modules-cig/README.md b/platform/nephos/sonic-platform-modules-cig/README.md new file mode 100755 index 000000000000..9dc23910b59e --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/README.md @@ -0,0 +1 @@ +platform drivers of Cambridgeig products for the SONiC project diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/__init__.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/__init__.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/fanutil.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/fanutil.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/thermalutil.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/classes/thermalutil.py new file mode 100755 index 000000000000..e69de29bb2d1 diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/Makefile b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/Makefile new file mode 100755 index 000000000000..cdb114aad510 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/Makefile @@ -0,0 +1,5 @@ +obj-m := x86-64-cig-cs6436-56p-cpld.o \ + x86-64-cig-cs6436-56p-fan.o \ + x86-64-cig-cs6436-56p-led.o \ + x86-64-cig-cs6436-56p-psu.o \ + x86-64-cig-cs6436-56p-sfp.o diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc.h b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc.h new file mode 100755 index 000000000000..7ce6ae378596 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc.h @@ -0,0 +1,97 @@ +/* -------------------------------------------------------------------- + + * A hwmon driver for the CIG cs6436-56P + * + * Copyright (C) 2018 Cambridge, Inc. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* -------------------------------------------------------------------- */ + +#ifndef I2C_LPC_H +#define I2C_LPC_H 1 + +/* ----- Control register bits ---------------------------------------- */ +#define I2C_LPC_PIN 0x80 +#define I2C_LPC_ESO 0x40 +#define I2C_LPC_ES1 0x20 +#define I2C_LPC_ES2 0x10 +#define I2C_LPC_ENI 0x08 + +#define I2C_LPC_STO 0x40 +#define I2C_LPC_ACK 0x01 + +/*command register*/ +#define I2C_LPC_STA 0x80 +#define I2C_LPC_ABT 0x40 + +/*status register*/ +#define I2C_LPC_TBE 0x02 +#define I2C_LPC_IBB 0x80 +#define I2C_LPC_RBF 0x01 +#define I2C_LPC_TD 0x08 + +#define I2C_LPC_START I2C_LPC_STA +#define I2C_LPC_STOP I2C_LPC_STO +#define I2C_LPC_REPSTART I2C_LPC_STA +#define I2C_LPC_IDLE + +/* ----- Status register bits ----------------------------------------- */ +/*#define I2C_LPC_PIN 0x80 as above*/ + +#define I2C_LPC_INI 0x40 /* 1 if not initialized */ +#define I2C_LPC_STS 0x20 +#define I2C_LPC_BER 0x10 +#define I2C_LPC_AD0 0x08 +#define I2C_LPC_LRB 0x08 +#define I2C_LPC_AAS 0x04 +#define I2C_LPC_LAB 0x02 +#define I2C_LPC_BB 0x80 + +/* ----- Chip clock frequencies --------------------------------------- */ +#define I2C_LPC_CLK3 0x00 +#define I2C_LPC_CLK443 0x10 +#define I2C_LPC_CLK6 0x14 +#define I2C_LPC_CLK 0x18 +#define I2C_LPC_CLK12 0x1c + +/* ----- transmission frequencies ------------------------------------- */ +#define I2C_LPC_TRNS90 0x00 /* 90 kHz */ +#define I2C_LPC_TRNS45 0x01 /* 45 kHz */ +#define I2C_LPC_TRNS11 0x02 /* 11 kHz */ +#define I2C_LPC_TRNS15 0x03 /* 1.5 kHz */ + + +#define I2C_LPC_OWNADR 0 +#define I2C_LPC_INTREG I2C_LPC_ES2 +#define I2C_LPC_CLKREG I2C_LPC_ES1 + +#define I2C_LPC_REG_TEST 0x01 +#define I2C_LPC_REG_BUS_SEL 0x80 +#define I2C_LPC_REG_DEVICE_ADDR 0x81 +#define I2C_LPC_REG_BYTE_COUNT 0x83 +#define I2C_LPC_REG_COMMAND 0x84 +#define I2C_LPC_REG_STATUS 0x85 +#define I2C_LPC_REG_DATA_RX1 0x86 +#define I2C_LPC_REG_DATA_RX2 0x87 +#define I2C_LPC_REG_DATA_RX3 0x88 +#define I2C_LPC_REG_DATA_RX4 0x89 +#define I2C_LPC_REG_DATA_TX1 0x8a +#define I2C_LPC_REG_DATA_TX2 0x8b +#define I2C_LPC_REG_DATA_TX3 0x8c +#define I2C_LPC_REG_DATA_TX4 0x8d + +#endif /* I2C_LPC_H */ diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc2iic.h b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc2iic.h new file mode 100755 index 000000000000..6963bef734f1 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/i2c-algo-lpc2iic.h @@ -0,0 +1,48 @@ +/* -------------------------------------------------------------------- + + * A hwmon driver for the CIG cs6436-56P + * + * Copyright (C) 2018 Cambridge, Inc. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* -------------------------------------------------------------------- */ + + +#ifndef _LINUX_I2C_ALGO_LPC_H +#define _LINUX_I2C_ALGO_LPC_H + +struct i2c_algo_lpc_data { + void *data; /* private data for lolevel routines */ + void (*setlpc) (void *data, int ctl, int val); + int (*getlpc) (void *data, int ctl); + int (*getown) (void *data); + int (*getclock) (void *data); + void (*waitforpin) (void *data); + + int (*xfer_begin) (void *data); + int (*xfer_end) (void *data); + + /* Multi-master lost arbitration back-off delay (msecs) + * This should be set by the bus adapter or knowledgable client + * if bus is multi-mastered, else zero + */ + unsigned long lab_mdelay; +}; + +int lpc_add_iic_bus(struct i2c_adapter * adap, unsigned int id); + +#endif /* _LINUX_I2C_ALGO_LPC_H */ diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-cpld.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-cpld.c new file mode 100755 index 000000000000..a3c6e2db54eb --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-cpld.c @@ -0,0 +1,1632 @@ +/* + * A hwmon driver for the CIG cs6436-56P CPLD + * + * Copyright (C) 2018 Cambridge, Inc. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "i2c-algo-lpc.h" +#include "i2c-algo-lpc2iic.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef CPLD_USER +# include +#else +# include +#endif + +/* + * ISA bus. + */ + +static void platform_isa_bus_release(struct device * dev) +{ + return ; +} + + +static struct device isa_bus = { + .init_name = "lpc-isa", + .release = platform_isa_bus_release, +}; + +struct isa_dev { + struct device dev; + struct device *next; + unsigned int id; +}; + +#define to_isa_dev(x) container_of((x), struct isa_dev, dev) + +static int isa_bus_match(struct device *dev, struct device_driver *driver) +{ + struct isa_driver *isa_driver = to_isa_driver(driver); + + if (dev->platform_data == isa_driver) { + if (!isa_driver->match || + isa_driver->match(dev, to_isa_dev(dev)->id)) + return 1; + dev->platform_data = NULL; + } + return 0; +} + +static int isa_bus_probe(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->probe) + return isa_driver->probe(dev, to_isa_dev(dev)->id); + + return 0; +} + +static int isa_bus_remove(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->remove) + return isa_driver->remove(dev, to_isa_dev(dev)->id); + + return 0; +} + +static void isa_bus_shutdown(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->shutdown) + isa_driver->shutdown(dev, to_isa_dev(dev)->id); +} + +static int isa_bus_suspend(struct device *dev, pm_message_t state) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->suspend) + return isa_driver->suspend(dev, to_isa_dev(dev)->id, state); + + return 0; +} + +static int isa_bus_resume(struct device *dev) +{ + struct isa_driver *isa_driver = dev->platform_data; + + if (isa_driver->resume) + return isa_driver->resume(dev, to_isa_dev(dev)->id); + + return 0; +} + +static struct bus_type isa_bus_type = { + .name = "lpc-isa", + .match = isa_bus_match, + .probe = isa_bus_probe, + .remove = isa_bus_remove, + .shutdown = isa_bus_shutdown, + .suspend = isa_bus_suspend, + .resume = isa_bus_resume +}; + +static void isa_dev_release(struct device *dev) +{ + kfree(to_isa_dev(dev)); +} + +void lpc_unregister_driver(struct isa_driver *isa_driver) +{ + struct device *dev = isa_driver->devices; + + while (dev) { + struct device *tmp = to_isa_dev(dev)->next; + device_unregister(dev); + dev = tmp; + } + driver_unregister(&isa_driver->driver); +} + + +int lpc_register_driver(struct isa_driver *isa_driver, unsigned int ndev) +{ + int error; + unsigned int id; + + isa_driver->driver.bus = &isa_bus_type; + isa_driver->devices = NULL; + + error = driver_register(&isa_driver->driver); + if (error) + return error; + + for (id = 0; id < ndev; id++) { + struct isa_dev *isa_dev; + + isa_dev = kzalloc(sizeof *isa_dev, GFP_KERNEL); + if (!isa_dev) { + error = -ENOMEM; + break; + } + + isa_dev->dev.parent = &isa_bus; + isa_dev->dev.bus = &isa_bus_type; + + dev_set_name(&isa_dev->dev, "%s.%u", + isa_driver->driver.name, id); + isa_dev->dev.platform_data = isa_driver; + isa_dev->dev.release = isa_dev_release; + isa_dev->id = id; + + isa_dev->dev.coherent_dma_mask = DMA_BIT_MASK(24); + isa_dev->dev.dma_mask = &isa_dev->dev.coherent_dma_mask; + + error = device_register(&isa_dev->dev); + if (error) { + put_device(&isa_dev->dev); + break; + } + + if (isa_dev->dev.platform_data) { + isa_dev->next = isa_driver->devices; + isa_driver->devices = &isa_dev->dev; + } else + device_unregister(&isa_dev->dev); + } + + if (!error && !isa_driver->devices) + error = -ENODEV; + + if (error) + isa_unregister_driver(isa_driver); + + return error; +} + + +int lpc_bus_init(void) +{ + int error; + + error = bus_register(&isa_bus_type); + if (!error) { + error = device_register(&isa_bus); + if (error) + bus_unregister(&isa_bus_type); + } + return error; +} + +void lpc_bus_exit(void) +{ + + device_unregister(&isa_bus); + + bus_unregister(&isa_bus_type); +} + + +/* + * module parameters: + */ +static int i2c_debug = 0; +static struct mutex lpc_lock; + + +#define DEB2(x) if (i2c_debug >= 2) x +#define DEB3(x) if (i2c_debug >= 3) x + /* print several statistical values */ +#define DEBPROTO(x) if (i2c_debug >= 9) x; + /* debug the protocol by showing transferred bits */ +#define DEF_TIMEOUT 160 + + + +/* setting states on the bus with the right timing: */ + +#define set_lpc(adap, ctl, val) adap->setlpc(adap->data, ctl, val) +#define get_lpc(adap, ctl) adap->getlpc(adap->data, ctl) +#define get_own(adap) adap->getown(adap->data) +#define get_clock(adap) adap->getclock(adap->data) +#define i2c_outaddr(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DEVICE_ADDR, val) + +#define i2c_outbyte1(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX1, val) +#define i2c_outbyte2(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX2, val) +#define i2c_outbyte3(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX3, val) +#define i2c_outbyte4(adap, val) adap->setlpc(adap->data, I2C_LPC_REG_DATA_TX4, val) +#define i2c_inbyte1(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX1) +#define i2c_inbyte2(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX2) +#define i2c_inbyte3(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX3) +#define i2c_inbyte4(adap) adap->getlpc(adap->data, I2C_LPC_REG_DATA_RX4) + + + +#define LPC_FPRINTF_LOG_PATH "/tmp/file.log" +struct file *lpc_fprintf_file = NULL; + + +static int lpc_fprintf_debug(const char *fmt, ...) +{ + char lpc_fprintf_buf[256]={0}; + + struct va_format vaf; + va_list args; + int r; + unsigned int file_size = 0; + mm_segment_t old_fs; + struct timeval tv; + do_gettimeofday(&tv); + + va_start(args, fmt); + vaf.fmt = fmt; + vaf.va = &args; + r=snprintf(lpc_fprintf_buf,"[%012d.%012d] %pV\n",sizeof(lpc_fprintf_buf),tv.tv_sec, tv.tv_usec, &vaf); + va_end(args); + + old_fs = get_fs(); + set_fs(KERNEL_DS); + lpc_fprintf_file->f_op->write(lpc_fprintf_file, (char *)lpc_fprintf_buf, strlen(lpc_fprintf_buf), &lpc_fprintf_file->f_pos); + set_fs(old_fs); + + memset(lpc_fprintf_buf,0x0,sizeof(lpc_fprintf_buf)); + return r; + +} + + +static int lpc_fprintf_init(void) +{ + mm_segment_t old_fs; + + DEB2(printk("lpc_fprintf_init.\n");) + + + if(lpc_fprintf_file == NULL) + lpc_fprintf_file = filp_open(LPC_FPRINTF_LOG_PATH, O_RDWR | O_APPEND | O_CREAT, 0644); + if (IS_ERR(lpc_fprintf_file)) { + DEB2(printk("error occured while opening file %s, exiting...\n", LPC_FPRINTF_LOG_PATH);) + return 0; + } + + return 0; +} + +static int lpc_fprintf_exit(void) +{ + DEB2(printk("lpc_fprintf_exit.\n");) + + if(lpc_fprintf_file != NULL) + filp_close(lpc_fprintf_file, NULL); + return 0; +} + + +/* other auxiliary functions */ + + +void print_reg(struct i2c_algo_lpc_data *adap) +{ + unsigned char status; + DEBPROTO(lpc_fprintf_debug("================================================\n");) + status = get_lpc(adap, I2C_LPC_REG_BUS_SEL); + DEBPROTO(lpc_fprintf_debug("%s select reg %x : %x\n",__func__,I2C_LPC_REG_BUS_SEL, status);) + status = get_lpc(adap, I2C_LPC_REG_BYTE_COUNT); + DEBPROTO(lpc_fprintf_debug("%s count reg %x : %x\n",__func__,I2C_LPC_REG_BYTE_COUNT, status);) + + status = get_lpc(adap, I2C_LPC_REG_COMMAND); + DEBPROTO(lpc_fprintf_debug("%s command reg %x : %x\n",__func__,I2C_LPC_REG_COMMAND, status);) + status = get_lpc(adap, I2C_LPC_REG_DEVICE_ADDR); + DEBPROTO(lpc_fprintf_debug("%s address reg %x : %x\n",__func__,I2C_LPC_REG_DEVICE_ADDR, status);) + + status = get_lpc(adap, I2C_LPC_REG_STATUS); + DEBPROTO(lpc_fprintf_debug("%s status reg %x : %x\n",__func__,I2C_LPC_REG_STATUS, status);) +} + + + +static void i2c_repstart(struct i2c_algo_lpc_data *adap) +{ + DEBPROTO(lpc_fprintf_debug(" Sr\n")); + set_lpc(adap, I2C_LPC_REG_COMMAND, I2C_LPC_REPSTART); +} + +static void i2c_stop(struct i2c_algo_lpc_data *adap) +{ + DEBPROTO(lpc_fprintf_debug("%s :\n",__func__);) + + set_lpc(adap, I2C_LPC_REG_COMMAND, I2C_LPC_STOP); + udelay(60); + set_lpc(adap, I2C_LPC_REG_COMMAND, 0x00); +} + + + + +static void i2c_start(struct i2c_algo_lpc_data *adap) +{ + unsigned char status; + int timeout = DEF_TIMEOUT; + + print_reg(adap); + + set_lpc(adap, I2C_LPC_REG_COMMAND, I2C_LPC_START); + + print_reg(adap); + +} + + + + +static int wait_for_bb(struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + int status; + + while (--timeout) { + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus free status : %x\n",__func__,status);) + + if(status == I2C_LPC_TD) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is free status : %x\n",__func__,status);) + break; + } + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout for free busy status : %x\n",__func__,status);) + return -ETIMEDOUT; + } + + + + return 0; +} + + +static int wait_for_be(int mode,struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + unsigned char status; + + + while (--timeout) { + + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus empty status : %x\n",__func__,status);) + + if(mode == 1) + { + if((status & I2C_LPC_IBB) && (status & I2C_LPC_TBE)) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is empty status : %x\n",__func__,status);) + break; + } + } + else + { + if(status & I2C_LPC_TD) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is empty status : %x\n",__func__,status);) + break; + } + } + + status = get_lpc(adap, I2C_LPC_REG_TEST); + + DEBPROTO(lpc_fprintf_debug("%s : The test register data : %x\n",__func__,status);) + udelay(1); /* wait for 100 us */ + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout waiting for Bus Empty\n",__func__);) + return -ETIMEDOUT; + } + + return 0; +} + + +static int wait_for_bf(struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + int status; + + + while (--timeout) { + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus full status : %x\n",__func__,status);) + + if(status & I2C_LPC_RBF) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is full status : %x\n",__func__,status);) + break; + } + + status = get_lpc(adap, I2C_LPC_REG_TEST); + + DEBPROTO(lpc_fprintf_debug("%s : The test register data : %x\n",__func__,status);) + udelay(1); /* wait for 100 us */ + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout waiting for Bus Full\n",__func__);) + return -ETIMEDOUT; + } + + return 0; +} + +static int wait_for_td(struct i2c_algo_lpc_data *adap) +{ + + int timeout = DEF_TIMEOUT; + int status=0; + + while (--timeout) { + udelay(4); + status = get_lpc(adap, I2C_LPC_REG_STATUS); + + DEBPROTO(lpc_fprintf_debug("%s : Waiting for bus done status : %x\n",__func__,status);) + + if(status == I2C_LPC_TD) + { + DEBPROTO(lpc_fprintf_debug("%s : Bus is done status : %x\n",__func__,status);) + break; + } + } + + if (timeout == 0) { + DEBPROTO(lpc_fprintf_debug("%s : Timeout waiting for Bus Done\n",__func__);) + return -ETIMEDOUT; + } + + return 0; +} + + + +static int wait_for_pin(struct i2c_algo_lpc_data *adap, int *status) +{ + int timeout = DEF_TIMEOUT; + *status = get_lpc(adap, I2C_LPC_REG_STATUS); + + while ((*status & I2C_LPC_TBE) && --timeout) { + *status = get_lpc(adap, I2C_LPC_REG_STATUS); + } + + if (timeout == 0) + return -ETIMEDOUT; + + + return 0; +} + + +static int lpc_doAddress(struct i2c_algo_lpc_data *adap,struct i2c_msg *msg) +{ + unsigned short flags = msg->flags; + unsigned char addr; + + addr = msg->addr << 1; + if (flags & I2C_M_RD) + { + addr |= 1; + DEBPROTO(lpc_fprintf_debug("step 7 : read mode then write device address 0x%x\n",addr);) + } + else + { + DEBPROTO(lpc_fprintf_debug("step 2 : write mode then write device address 0x%x\n",addr);) + } + + if (flags & I2C_M_REV_DIR_ADDR) + { + addr ^= 1; + + } + i2c_outaddr(adap, addr); + return 0; + +} + + +static int lpc_sendbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +{ + struct i2c_algo_lpc_data *adap = i2c_adap->algo_data; + int i = 0,timeout=0; + + unsigned int count = msg->len; + unsigned char *buf = msg->buf; + + do{ + lpc_doAddress(adap,msg); + set_lpc(adap, I2C_LPC_REG_BYTE_COUNT, (count-i) >= 4 ? 4:(count - i)); + DEBPROTO(lpc_fprintf_debug("step 3 : write register count %x\n",count);) + + if((count -i) >= 4) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + i2c_outbyte2(adap, buf[i+1] & 0xff); + i2c_outbyte3(adap, buf[i+2] & 0xff); + i2c_outbyte4(adap, buf[i+3] & 0xff); + + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+2,buf[i+2]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+3,buf[i+3]);) + i += 4; + } + else if((count -i) == 3) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + i2c_outbyte2(adap, buf[i+1] & 0xff); + i2c_outbyte3(adap, buf[i+2] & 0xff); + + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+2,buf[i+2]);) + + i += 3; + } + else if((count -i) == 2) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + i2c_outbyte2(adap, buf[i+1] & 0xff); + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+1,buf[i+1]);) + i += 2; + } + else if((count -i) == 1) + { + i2c_outbyte1(adap, buf[i+0] & 0xff); + DEBPROTO(lpc_fprintf_debug("step 4 : Send data[%d] = %x\n",i+0,buf[i+0]);) + i += 1; + } + + /* Send START */ + DEBPROTO(lpc_fprintf_debug("step 5-1 : Delay 6mS \n");) + udelay(6000); + DEBPROTO(lpc_fprintf_debug("step 5-2 : Start to transfrom \n");) + i2c_stop(adap); + i2c_start(adap); + DEBPROTO(lpc_fprintf_debug("step 5-3 : Start done\n");) + + udelay(400); + DEBPROTO(lpc_fprintf_debug("step 6 : Waiting for BE\n");) + timeout = wait_for_td(adap); + if (timeout) { + DEBPROTO(lpc_fprintf_debug("step 6 : Timeout waiting for BE \n");) + return -1; + } + }while (i < count); + + if(i == count) + { + DEBPROTO(lpc_fprintf_debug("Writen %d bytes successd !\n",count);) + return i; + } + else + { + DEBPROTO(lpc_fprintf_debug("Writen %d bytes failed \n",count);) + return -1; + } +} + +static int lpc_readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) +{ + int i=0,timeout=0; + struct i2c_algo_lpc_data *adap = i2c_adap->algo_data; + int wfp; + + unsigned int count = msg->len; + unsigned char *buf = msg->buf; + + do{ + lpc_doAddress(adap,msg); + set_lpc(adap, I2C_LPC_REG_BYTE_COUNT, (count-i) >= 4 ? 4:(count - i)); + DEBPROTO(lpc_fprintf_debug("step 8 : write register count %d\n",count);) + + /* Send START */ + DEBPROTO(lpc_fprintf_debug("step 9-1 : Delay 6mS\n");) + udelay(6000); + DEBPROTO(lpc_fprintf_debug("step 9-2 : Start to receive data\n");) + i2c_stop(adap); + i2c_start(adap); + DEBPROTO(lpc_fprintf_debug("step 9-3 : Start done\n");) + + udelay(400); + DEBPROTO(lpc_fprintf_debug("step 10 : Waiting for TD\n");) + timeout = wait_for_td(adap); + if (timeout) { + DEBPROTO(lpc_fprintf_debug("step 10 : Timeout waiting for TD \n");) + return -1; + } + + if((count -i) >= 4) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + buf[i+1] = 0xff & i2c_inbyte2(adap); + buf[i+2] = 0xff & i2c_inbyte3(adap); + buf[i+3] = 0xff & i2c_inbyte4(adap); + + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+2,buf[i+2]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+3,buf[i+3]);) + + i += 4; + } + else if((count -i) == 3) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + buf[i+1] = 0xff & i2c_inbyte2(adap); + buf[i+2] = 0xff & i2c_inbyte3(adap); + + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+1,buf[i+1]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+2,buf[i+2]);) + + i += 3; + } + else if((count -i) == 2) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + buf[i+1] = 0xff & i2c_inbyte2(adap); + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+1,buf[i+1]);) + i += 2; + } + else if((count -i) == 1) + { + buf[i+0] = 0xff & i2c_inbyte1(adap); + DEBPROTO(lpc_fprintf_debug("step 11 : Receive data[%d] = %x\n",i+0,buf[i+0]);) + i += 1; + } + + + }while(i < count); + + if(i == count) + { + DEBPROTO(lpc_fprintf_debug("Read %d bytes successd !\n",count);) + return i; + } + else + { + DEBPROTO(lpc_fprintf_debug("Read %d bytes failed \n",count);) + return -1; + } + + return i; +} + + +struct cpld_client_node { + struct i2c_client *client; + struct list_head list; +}; +#define LPC_I2C_MAX_NCHANS 6 + + +struct lpc_iic { + struct i2c_adapter *virt_adaps[LPC_I2C_MAX_NCHANS]; + u8 last_chan; /* last register value */ +}; + + +static int lpc_master_xfer(struct i2c_adapter *i2c_adap, + struct i2c_msg *msgs, + int num) +{ + struct i2c_algo_lpc_data *adap = i2c_adap->algo_data; + struct i2c_msg *pmsg; + int i; + int ret=0, timeout, status; + + mutex_lock(&lpc_lock); + + if (adap->xfer_begin) + adap->xfer_begin(&i2c_adap->nr); + + + for (i = 0;ret >= 0 && i < num; i++) { + pmsg = &msgs[i]; + + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: Doing %s %d bytes to 0x%02x - %d of %d messages\n", + pmsg->flags & I2C_M_RD ? "read" : "write", + pmsg->len, pmsg->addr, i + 1, num);) + + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: Msg %d, addr=0x%x, flags=0x%x, len=%d\n", + i, msgs[i].addr, msgs[i].flags, msgs[i].len);) + + if (pmsg->flags & I2C_M_RD) { + ret = lpc_readbytes(i2c_adap, pmsg); + + if (ret != pmsg->len) { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: fail: " + "only read %d bytes.\n",ret)); + } else { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: read %d bytes.\n",ret)); + } + } else { + + ret = lpc_sendbytes(i2c_adap, pmsg); + + if (ret != pmsg->len) { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: fail: " + "only wrote %d bytes.\n",ret)); + } else { + DEBPROTO(lpc_fprintf_debug("lpc_xfer.o: wrote %d bytes.\n",ret)); + } + } + } + + if (adap->xfer_end) + adap->xfer_end(&i2c_adap->nr); + + mutex_unlock(&lpc_lock); + + return i; + +} + + +static u32 lpc_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_QUICK; +} + +/* exported algorithm data: */ +static const struct i2c_algorithm lpc_algo = { + .master_xfer = lpc_master_xfer, + //.smbus_xfer = lpc_smbus_xfer, + .functionality = lpc_func, +}; + + +/* + * registering functions to load algorithms at runtime + */ +int lpc_add_iic_bus(struct i2c_adapter *adap,unsigned int id) +{ + //struct i2c_algo_lpc_data *lpc_adap = adap->3; + int rval,num; + + DEB2(dev_dbg(&adap->dev, "hw routines registered.\n")); + + /* register new adapter to i2c module... */ + adap->algo = &lpc_algo; + + for(num = 0; num < LPC_I2C_MAX_NCHANS;num++) + { + adap->nr = num; + snprintf(adap->name, sizeof(adap->name), + "i2c-%d-lpc (chan_id %d)", i2c_adapter_id(adap), num); + if(num) + { + rval = i2c_add_numbered_adapter(adap); + } + else + { + rval = i2c_add_adapter(adap); + } + } + return rval; +} +EXPORT_SYMBOL(lpc_add_iic_bus); + + +#define DEFAULT_BASE 0x0a00 + +static int lpc_base= 0x0a00; +static u8 __iomem *lpc_base_iomem; + +static int lpc_irq; +static int lpc_clock = 0x1c; +static int lpc_own = 0x55; +static int lpc_mmapped; + +static unsigned long lpc_base_addr = 0x0a00; +static unsigned int lpc_io_space_size = 2; + +static unsigned long LPC_INDEX_REG; +static unsigned long LPC_DATA_REG; + + +/* notice : removed static struct i2c_lpc_iic gpi; code - + this module in real supports only one device, due to missing arguments + in some functions, called from the algo-lpc module. Sometimes it's + need to be rewriten - but for now just remove this for simpler reading */ + +static wait_queue_head_t lpc_wait; +static int lpc_pending; +static spinlock_t lock; +static spinlock_t lpc_slock; + +static struct i2c_adapter lpc_iic_ops; + +struct cpld_dev_type { + struct resource *io_resource; + struct semaphore sem; + struct cdev cdev; +}; + +struct cpld_dev_type *cpld_device; + + +/* ----- local functions ---------------------------------------------- */ + +static void lpc_cpld_setbyte(void *data, int ctl, int val) +{ + //udelay(2); + outb(ctl, LPC_INDEX_REG); + mb(); + + outb(val, LPC_DATA_REG); + mb(); +} + +static int lpc_cpld_getbyte(void *data, int ctl) +{ + u8 val = 0; + //udelay(2); + outb(ctl, LPC_INDEX_REG); + mb(); + + val = inb(LPC_DATA_REG); + mb(); + + return val; +} + +static void lpc_iic_setbyte(void *data, int ctl, int val) +{ + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + lpc_cpld_setbyte(data,ctl,val); + + up(&cpld_device->sem); + DEB2(printk("%s REG[%x] = %x\n",__func__,ctl,val);) +} + +static int lpc_iic_getbyte(void *data, int ctl) +{ + u8 val = 0; + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + val = lpc_cpld_getbyte(data,ctl); + + up(&cpld_device->sem); + DEB2(printk("%s REG[%x] = %x\n",__func__,ctl,val);) + return val; +} + +int cig_cpld_read_register(u8 reg_off, u8 *val) +{ + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + *val = lpc_cpld_getbyte(cpld_device, reg_off); + + up(&cpld_device->sem); + + return 0; +} +EXPORT_SYMBOL(cig_cpld_read_register); + +int cig_cpld_write_register(u8 reg_off, u8 val) +{ + if (!cpld_device) + return -ENOTTY; + + if (down_interruptible(&cpld_device->sem)) + return -ERESTARTSYS; + + lpc_cpld_setbyte(cpld_device, reg_off, val); + up(&cpld_device->sem); + return 0; +} +EXPORT_SYMBOL(cig_cpld_write_register); + + + +static int lpc_iic_getown(void *data) +{ + return (lpc_own); +} + + +static int lpc_iic_getclock(void *data) +{ + return (lpc_clock); +} + +static void lpc_iic_waitforpin(void *data) +{ + DEFINE_WAIT(wait); + int timeout = 2; + unsigned long flags; + + if (lpc_irq > 0) { + spin_lock_irqsave(&lock, flags); + if (lpc_pending == 0) { + spin_unlock_irqrestore(&lock, flags); + prepare_to_wait(&lpc_wait, &wait, TASK_INTERRUPTIBLE); + if (schedule_timeout(timeout*HZ)) { + spin_lock_irqsave(&lock, flags); + if (lpc_pending == 1) { + lpc_pending = 0; + } + spin_unlock_irqrestore(&lock, flags); + } + finish_wait(&lpc_wait, &wait); + } else { + lpc_pending = 0; + spin_unlock_irqrestore(&lock, flags); + } + } else { + udelay(100); + } +} + + +static irqreturn_t lpc_iic_handler(int this_irq, void *dev_id) { + spin_lock(&lock); + lpc_pending = 1; + spin_unlock(&lock); + wake_up_interruptible(&lpc_wait); + return IRQ_HANDLED; +} + +static int board_id = 0; + + +static int lpc_select_chan(void *data) +{ + unsigned int chan_id=0; + chan_id = *(unsigned int *)data; + chan_id -= 1; + DEB2(printk("step 1 : selest channel id = %d\n",chan_id);) + lpc_iic_setbyte(data,I2C_LPC_REG_BUS_SEL,chan_id); + + return 0; +} + +static int lpc_deselect_chan(void *data) +{ + + unsigned int chan_id=0; + chan_id = *(unsigned int *)data; + chan_id -= 1; + DEB2(printk("step last :deselect channel id = %d\n",chan_id);) + + return 0; +} + + +/* ------------------------------------------------------------------------ + * Encapsulate the above functions in the correct operations structure. + * This is only done when more than one hardware adapter is supported. + */ +static struct i2c_algo_lpc_data lpc_iic_data = { + .setlpc = lpc_iic_setbyte, + .getlpc = lpc_iic_getbyte, + .getown = lpc_iic_getown, + .getclock = lpc_iic_getclock, + .waitforpin = lpc_iic_waitforpin, + .xfer_begin = lpc_select_chan, + .xfer_end = lpc_deselect_chan, +}; + +#include + +static struct i2c_adapter lpc_iic_arr_ops[LPC_I2C_MAX_NCHANS] = {0}; + +static void dummy_setscl(void *data, int state) +{ + return 1; +} + +static void dummy_setsda(void *data, int state) +{ + return 1; + +} + +static int dummy_getscl(void *data) +{ + return 1; + +} + +static int dummy_getsda(void *data) +{ + return 1; +} + + +static struct i2c_algo_bit_data dummy_algo_data = { + .setsda = dummy_setsda, + .setscl = dummy_setscl, + .getsda = dummy_getsda, + .getscl = dummy_getscl, + .udelay = 50, + .timeout = HZ, +}; + + +static int dummy_xfer(struct i2c_adapter *i2c_adap, + struct i2c_msg *msgs, + int num) +{ + return 1; +} + +static u32 dummy_func(struct i2c_adapter *adap) +{ + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_QUICK; +} + + +static const struct i2c_algorithm dummy_algo = { + .master_xfer = dummy_xfer, + .functionality = dummy_func, +}; + + + +static struct i2c_adapter i2c_dummy = { + .owner = THIS_MODULE, + .class = I2C_CLASS_HWMON, + .algo_data = &dummy_algo_data, + .algo = &dummy_algo, + .name = "i2c_dummy", +}; + + +static int lpc_iic_match(struct device *dev, unsigned int id) +{ + /* sanity checks for lpc_mmapped I/O */ + + DEB2(printk("lpc_iic_match\n");) + + + if (lpc_base < DEFAULT_BASE) { + dev_err(dev, "incorrect lpc_base address (%#x) specified " + "for lpc_mmapped I/O\n", lpc_base); + return 0; + } + + if (lpc_base == 0) { + lpc_base = DEFAULT_BASE; + } + return 1; +} + +static int lpc_iic_probe(struct device *dev, unsigned int id) +{ + int rval,num; + + lpc_fprintf_init(); + + DEB2(printk("lpc_iic_probe\n");) + + mutex_init(&lpc_lock); + if(board_id == 1) + i2c_add_adapter(&i2c_dummy); + + for(num = 0; num < LPC_I2C_MAX_NCHANS;num++) + { + lpc_iic_arr_ops[num].dev.parent = dev; + lpc_iic_arr_ops[num].owner = THIS_MODULE; + lpc_iic_arr_ops[num].class = I2C_CLASS_HWMON | I2C_CLASS_SPD; + lpc_iic_arr_ops[num].algo = &lpc_algo; + lpc_iic_arr_ops[num].algo_data = &lpc_iic_data, + lpc_iic_arr_ops[num].nr=num; + snprintf(lpc_iic_arr_ops[num].name, sizeof(lpc_iic_arr_ops[num].name), "i2c-%d-lpc", i2c_adapter_id(&lpc_iic_arr_ops[num]), num); + rval |= i2c_add_adapter(&lpc_iic_arr_ops[num]); + DEB2(printk("%s\n",lpc_iic_arr_ops[num].name);) + } + + return 0; +} + +static int lpc_iic_remove(struct device *dev, unsigned int id) +{ + int num; + DEB2(printk("lpc_iic_remove\n")); + + lpc_fprintf_exit(); + for(num = LPC_I2C_MAX_NCHANS - 1; num >= 0 ;num--) + i2c_del_adapter(&lpc_iic_arr_ops[num]); + + if(board_id == 1) + i2c_del_adapter(&i2c_dummy); + + return 0; +} + +static struct isa_driver i2c_lpc_driver = { + .match = lpc_iic_match, + .probe = lpc_iic_probe, + .remove = lpc_iic_remove, + .driver = { + .owner = THIS_MODULE, + .name = "lpc-iic", + }, +}; + + +struct kset cpld_kset; +static int cpld_major = 0; +static int cpld_minor = 0; + +struct cpld_rw_msg { + unsigned char addr; + unsigned char data; +}; + + +static struct cpld_rw_msg param_read = {-1}; +static struct cpld_rw_msg param_write = {-1}; + +void cpld_sysfs_kobj_release(struct kobject *kobj) +{ + return; +} + +int cpld_sysfs_add_attr(struct kobject* kobj, char* attr_name) +{ + + struct attribute *attr; + + attr = kmalloc(sizeof(struct attribute), GFP_KERNEL); + attr->name = attr_name; + attr->mode = 0644; + + return sysfs_create_file(kobj, attr); +} + + +static ssize_t cpld_sysfs_show(struct kobject *kobj, struct attribute *attr, char *buffer) +{ + u8 val,ret; + + if (0 == strcmp(attr->name, "read")) + { + val = lpc_iic_getbyte(NULL,param_read.addr); + ret = sprintf(buffer,"read : addr = %x val = %x\n",param_read.addr, val); + + } + else if (0 == strcmp(attr->name, "write")) + { + lpc_iic_setbyte(NULL, param_write.addr,param_write.data); + ret = sprintf(buffer,"write : addr = %x val = %x\n",param_write.addr, param_write.data); + } + else if (0 == strcmp(attr->name, "version")) + { + val = lpc_iic_getbyte(NULL, 0x02); + ret = sprintf(buffer,"CPLD version : V%02x\n",val); + } + + return ret; + +} + +static ssize_t cpld_sysfs_store(struct kobject *kobj, struct attribute *attr, const char *buffer, size_t count) +{ + int param[3]; + + if (0 == strcmp(attr->name, "read")) + { + sscanf(buffer, "0x%02x", ¶m[0]); + param_read.addr = param[0]; + } + else if (0 == strcmp(attr->name, "write")) + { + sscanf(buffer, "0x%2x 0x%02x", ¶m[0], ¶m[1]); + param_write.addr = param[0]; + param_write.data = param[1]; + } + return count; +} + + + +static struct sysfs_ops cpld_sysfs_ops = +{ + .show = cpld_sysfs_show, + .store = cpld_sysfs_store, +}; + +static struct kobj_type cpld_kobj_type = +{ + .release = cpld_sysfs_kobj_release, + .sysfs_ops = &cpld_sysfs_ops, + .default_attrs = NULL, +}; + + +static const char driver_name[] = "cpld_drv"; +static atomic_t cpld_available = ATOMIC_INIT(1); +static struct class *cpld_class; +#define CPLD_IOC_MAGIC '[' + +#define CPLD_IOC_RDREG _IOR(CPLD_IOC_MAGIC, 0, struct cpld_rw_msg) +#define CPLD_IOC_WRREG _IOW(CPLD_IOC_MAGIC, 1, struct cpld_rw_msg) + +#define CPLD_IOC_MAXNR 2 + + +int cpld_open(struct inode *inode, struct file *filp) +{ + struct cpld_dev_type *dev; + + if (! atomic_dec_and_test(&cpld_available)) { + atomic_inc(&cpld_available); + return -EBUSY; + } + + dev = container_of(inode->i_cdev, struct cpld_dev_type, cdev); + filp->private_data = dev; + + return 0; +} + +int cpld_release(struct inode *inode, struct file *flip) +{ + atomic_inc(&cpld_available); + return 0; +} + + +long cpld_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +{ + int rc = 0; + int err = 0; + struct cpld_dev_type *dev = (struct cpld_dev_type *)filp->private_data; + struct cpld_rw_msg msg; + + if (_IOC_TYPE(cmd) != CPLD_IOC_MAGIC) + return -ENOTTY; + if (_IOC_NR(cmd) > CPLD_IOC_MAXNR) + return -ENOTTY; + + if (_IOC_DIR(cmd) & _IOC_READ) + err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd)); + if (_IOC_DIR(cmd) & _IOC_WRITE) + err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd)); + if (err) + return -EFAULT; + + if (down_interruptible(&dev->sem)) + return -ERESTARTSYS; + + switch(cmd){ + case CPLD_IOC_RDREG: + rc = copy_from_user(&msg, (void __user *)arg, sizeof(msg)); + if (!rc) { + msg.data = lpc_cpld_getbyte(dev, msg.addr); + rc = copy_to_user((void __user *)arg, &msg, sizeof(msg)); + } + break; + + case CPLD_IOC_WRREG: + rc = copy_from_user(&msg, (void __user *)arg, sizeof(msg)); + if (!rc) { + lpc_cpld_setbyte(dev, msg.addr, msg.data); + } + break; + default: + rc = -ENOTTY; + break; + } + up(&dev->sem); + + return rc; +} + +struct file_operations cpld_fops = { + .owner = THIS_MODULE, + .open = cpld_open, + .unlocked_ioctl = cpld_ioctl, + .release = cpld_release, +}; + + +static void cpld_setup_cdev(struct cpld_dev_type *dev) +{ + int err, devno = MKDEV(cpld_major, cpld_minor); + + cdev_init(&dev->cdev, &cpld_fops); + dev->cdev.owner = THIS_MODULE; + dev->cdev.ops = &cpld_fops; + err = cdev_add(&dev->cdev, devno, 1); + + if (err) + DEB2(printk(KERN_NOTICE "Error %d adding cpld", err);) +} +//#define CPLD_KTHREAD_TEST +#ifdef CPLD_KTHREAD_TEST +#include +#include +#include +#include +#include +#include +static struct task_struct *test_TaskStruct; +void get_random_bytes(void *buf, int nbytes); + +#define LM75_REAR_LEFT_PATH "/sys/class/hwmon/hwmon5/temp1_input" +#define LM75_REAR_RIGHT_PATH "/sys/class/hwmon/hwmon6/temp1_input" + + +static int threadTask(void* arg) +{ + static int count =0; + unsigned char lpc_read_data=0; + unsigned char lpc_write_data=0; + unsigned char lpc_random_data=0; + + struct file *temp1_file = NULL,*temp2_file = NULL; + unsigned char temp1_buffer[8]={0},temp2_buffer[8]={0}; + + mm_segment_t old_fs; + while(1) + { + if(kthread_should_stop()) + { + DEB2(printk("threadTask: kthread_should_stop\n")); + break; + } + +#if 1 + get_random_bytes(&lpc_random_data,1); + + lpc_write_data = lpc_random_data; + + lpc_iic_setbyte(NULL,I2C_LPC_REG_TEST,lpc_write_data); + //DEB2(printk("threadTask: lpc write reg[01] data : %02x\n",lpc_write_data)); + + lpc_read_data = lpc_iic_getbyte(NULL,I2C_LPC_REG_TEST); + //DEB2(printk("threadTask: lpc read reg[01] data : %02x\n",lpc_read_data)); + udelay(10000); + if(lpc_write_data != lpc_read_data) + { + printk("Error : WRITE %02x != READ %02x\n",lpc_write_data,lpc_read_data); + } + msleep(10); +#else + + if(temp1_file != NULL) + temp1_file = filp_open(LM75_REAR_LEFT_PATH, O_RDONLY , 0); + if (IS_ERR(temp1_file)) { + printk("error occured while opening file %s, exiting...\n", LM75_REAR_LEFT_PATH); + } + + if(temp2_file != NULL) + temp2_file = filp_open(LM75_REAR_RIGHT_PATH, O_RDONLY ,0); + if (IS_ERR(temp2_file)) { + printk("error occured while opening file %s, exiting...\n", LM75_REAR_RIGHT_PATH); + } + + + old_fs = get_fs(); + set_fs(KERNEL_DS); + + temp1_file->f_op->read(temp1_file, (char *)temp1_buffer, strlen(temp1_buffer), &temp1_file->f_pos); + + temp2_file->f_op->read(temp2_file, (char *)temp2_buffer, strlen(temp2_buffer), &temp2_file->f_pos); + + set_fs(old_fs); + + if((simple_strtoul(temp1_buffer,NULL,10) >=30000) || (simple_strtoul(temp2_buffer,NULL,10) >=30000)) + { + lpc_iic_setbyte(NULL,0x40,0xff); + printk("Full speed\n"); + } + + msleep(1000); +#endif + } +} + +static int init_kernel_Thread(void) +{ + test_TaskStruct=kthread_create(threadTask,NULL,"KernelThead",0); + if(IS_ERR(test_TaskStruct)) + { + printk("kthread_create error\n"); + } + else + { + wake_up_process(test_TaskStruct); + } + return 0; +} + +static void exit_kernel_Thread(void) +{ + kthread_stop(test_TaskStruct); + test_TaskStruct = NULL; +} + +#endif + + +static int __init cpld_init(void) +{ + int rval,rc; + dev_t dev; + + DEB2(printk("cpld_init\n");) + + cpld_device = kzalloc(sizeof(struct cpld_dev_type), GFP_KERNEL); + if (!cpld_device) + goto error3; + cpld_device->io_resource = request_region(lpc_base_addr, + lpc_io_space_size, "lpc-i2c"); + if (!cpld_device->io_resource) { + DEB2(printk("lpc: claim I/O resource fail\n");) + goto error2; + } + sema_init(&cpld_device->sem, 1); + + LPC_INDEX_REG = lpc_base_addr; + LPC_DATA_REG = lpc_base_addr + 1; + + rval = lpc_bus_init(); + rval = lpc_register_driver(&i2c_lpc_driver, 1); + + kobject_set_name(&cpld_kset.kobj, "cpld"); + cpld_kset.kobj.ktype= &cpld_kobj_type; + kset_register(&cpld_kset); + cpld_sysfs_add_attr(&cpld_kset.kobj, "read"); + cpld_sysfs_add_attr(&cpld_kset.kobj, "write"); + cpld_sysfs_add_attr(&cpld_kset.kobj, "version"); + + if (cpld_major) { + dev = MKDEV(cpld_major, cpld_minor); + rc = register_chrdev_region(dev, 1, "cpld"); + } else { + rc = alloc_chrdev_region(&dev, cpld_major, 1, "cpld"); + cpld_major = MAJOR(dev); + } + + cpld_setup_cdev(cpld_device); + + cpld_class = class_create(THIS_MODULE, KBUILD_MODNAME); + if (!cpld_class) { + DEB2(printk("failed to create class\n");) + goto error1; + } + + device_create(cpld_class, NULL, dev, NULL, "cpld"); +#ifdef CPLD_KTHREAD_TEST + init_kernel_Thread(); +#endif + + return 0; +error1: + cdev_del(&cpld_device->cdev); + unregister_chrdev_region(dev, 1); +error2: + release_resource(cpld_device->io_resource); +error3: + kfree(cpld_device); + + return rc; +} + +static void __exit cpld_exit(void) +{ + DEB2(printk("cpld_exit\n")); + + lpc_unregister_driver(&i2c_lpc_driver); + lpc_bus_exit(); +#ifdef CPLD_KTHREAD_TEST + exit_kernel_Thread(); +#endif + dev_t devno = MKDEV(cpld_major, cpld_minor); + + cdev_del(&cpld_device->cdev); + if (cpld_class) { + device_destroy(cpld_class, devno); + class_destroy(cpld_class); + } + + kobject_put(&cpld_kset.kobj); + + if(cpld_kset.kobj.ktype) + kset_unregister(&cpld_kset); + + if (cpld_device) { + if (cpld_device->io_resource) + release_resource(cpld_device->io_resource); + + kfree(cpld_device); + } + unregister_chrdev_region(devno, 1); + + +} + +module_param(cpld_major, int, S_IRUGO); +module_param(cpld_minor, int, S_IRUGO); +module_param(i2c_debug, int, S_IRUGO); +module_param(board_id, int, S_IRUGO); + +module_init(cpld_init); +module_exit(cpld_exit); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436-56p-cpld driver"); +MODULE_LICENSE("GPL"); + + + + + + + + + + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-fan.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-fan.c new file mode 100755 index 000000000000..09beb6912c32 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-fan.c @@ -0,0 +1,451 @@ +/* + * A hwmon driver for the CIG cs6436-56P fan + * + * Copyright (C) 2018 Cambridge, Inc. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#define FAN_SPEED_DUTY_TO_CPLD_STEP 10 + +static struct cs6436_56p_fan_data *cs6436_56p_fan_update_device(struct device *dev); +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count); + +extern int cig_cpld_write_register(u8 reg_off, u8 val); +extern int cig_cpld_read_register(u8 reg_off, u8 *val); + +/* fan related data, the index should match sysfs_fan_attributes + */ +static const u8 fan_reg[] = { + 0x41, /* fan enable/disable */ + 0x40, /* fan PWM(for all fan) */ + 0x42, /* front fan 1 speed(rpm) */ + 0x44, /* front fan 2 speed(rpm) */ + 0x46, /* front fan 3 speed(rpm) */ + 0x48, /* front fan 4 speed(rpm) */ + 0x4a, /* front fan 5 speed(rpm) */ + 0x43, /* rear fan 1 speed(rpm) */ + 0x45, /* rear fan 2 speed(rpm) */ + 0x47, /* rear fan 3 speed(rpm) */ + 0x49, /* rear fan 4 speed(rpm) */ + 0x4b, /* rear fan 5 speed(rpm) */ +}; + + +/* Each client has this additional data */ +struct cs6436_56p_fan_data { + struct platform_device *pdev; + struct device *hwmon_dev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[ARRAY_SIZE(fan_reg)]; /* Register value */ +}; + +static struct cs6436_56p_fan_data *fan_data = NULL; + +enum fan_id { + FAN1_ID, + FAN2_ID, + FAN3_ID, + FAN4_ID, + FAN5_ID, +}; + +enum sysfs_fan_attributes { + FAN_STATE_REG, + FAN_DUTY_CYCLE_PERCENTAGE, /* Only one CPLD register to control duty cycle for all fans */ + FAN1_FRONT_SPEED_RPM, + FAN2_FRONT_SPEED_RPM, + FAN3_FRONT_SPEED_RPM, + FAN4_FRONT_SPEED_RPM, + FAN5_FRONT_SPEED_RPM, + FAN1_REAR_SPEED_RPM, + FAN2_REAR_SPEED_RPM, + FAN3_REAR_SPEED_RPM, + FAN4_REAR_SPEED_RPM, + FAN5_REAR_SPEED_RPM, + FAN1_STATE, + FAN2_STATE, + FAN3_STATE, + FAN4_STATE, + FAN5_STATE, + FAN1_FAULT, + FAN2_FAULT, + FAN3_FAULT, + FAN4_FAULT, + FAN5_FAULT, +}; + +/* Define attributes + */ +#define DECLARE_FAN_STATE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_state, S_IRUGO, fan_show_value, NULL, FAN##index##_STATE) +#define DECLARE_FAN_STATE_ATTR(index) &sensor_dev_attr_fan##index##_state.dev_attr.attr + +#define DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_fault, S_IRUGO, fan_show_value, NULL, FAN##index##_FAULT) +#define DECLARE_FAN_FAULT_ATTR(index) &sensor_dev_attr_fan##index##_fault.dev_attr.attr + +#define DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_duty_cycle_percentage, S_IWUSR | S_IRUGO, fan_show_value, set_duty_cycle, FAN##index##_DUTY_CYCLE_PERCENTAGE) +#define DECLARE_FAN_DUTY_CYCLE_ATTR(index) &sensor_dev_attr_fan##index##_duty_cycle_percentage.dev_attr.attr + +#define DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(index) \ + static SENSOR_DEVICE_ATTR(fan##index##_front_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_FRONT_SPEED_RPM);\ + static SENSOR_DEVICE_ATTR(fan##index##_rear_speed_rpm, S_IRUGO, fan_show_value, NULL, FAN##index##_REAR_SPEED_RPM) +#define DECLARE_FAN_SPEED_RPM_ATTR(index) &sensor_dev_attr_fan##index##_front_speed_rpm.dev_attr.attr, \ + &sensor_dev_attr_fan##index##_rear_speed_rpm.dev_attr.attr + +/* 5 fan state attributes in this platform */ +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(1); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(2); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(3); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(4); +DECLARE_FAN_STATE_SENSOR_DEV_ATTR(5); + + +/* 5 fan fault attributes in this platform */ +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(1); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(2); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(3); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(4); +DECLARE_FAN_FAULT_SENSOR_DEV_ATTR(5); + +/* 5 fan speed(rpm) attributes in this platform */ +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(1); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(2); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(3); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(4); +DECLARE_FAN_SPEED_RPM_SENSOR_DEV_ATTR(5); + +/* 1 fan duty cycle attribute in this platform */ +DECLARE_FAN_DUTY_CYCLE_SENSOR_DEV_ATTR(); + +static struct attribute *cs6436_56p_fan_attributes[] = { + /* fan related attributes */ + DECLARE_FAN_STATE_ATTR(1), + DECLARE_FAN_STATE_ATTR(2), + DECLARE_FAN_STATE_ATTR(3), + DECLARE_FAN_STATE_ATTR(4), + DECLARE_FAN_STATE_ATTR(5), + DECLARE_FAN_FAULT_ATTR(1), + DECLARE_FAN_FAULT_ATTR(2), + DECLARE_FAN_FAULT_ATTR(3), + DECLARE_FAN_FAULT_ATTR(4), + DECLARE_FAN_FAULT_ATTR(5), + DECLARE_FAN_SPEED_RPM_ATTR(1), + DECLARE_FAN_SPEED_RPM_ATTR(2), + DECLARE_FAN_SPEED_RPM_ATTR(3), + DECLARE_FAN_SPEED_RPM_ATTR(4), + DECLARE_FAN_SPEED_RPM_ATTR(5), + DECLARE_FAN_DUTY_CYCLE_ATTR(), + NULL +}; + +#define FAN_MAX_DUTY_CYCLE 100 +#define FAN_REG_VAL_TO_SPEED_RPM_STEP 100 + +/* fan utility functions + */ +static u32 reg_val_to_duty_cycle(u8 reg_val) +{ + if (reg_val +== 0xFF) { + return 100; + } + return ((u32)(reg_val) * 100)/ 255; +} + +static u8 duty_cycle_to_reg_val(u8 duty_cycle) +{ + if (duty_cycle >= FAN_MAX_DUTY_CYCLE) { + return 0xFF; + } + + return 255 / 10 * (duty_cycle / 10); +} + +static u32 reg_val_to_speed_rpm(u8 reg_val) +{ + return (u32)reg_val * FAN_REG_VAL_TO_SPEED_RPM_STEP; +} + +static u8 reg_val_to_is_state(u8 reg_val, enum fan_id id) +{ + u8 mask = (1 << id); + + reg_val &= mask; + + return reg_val ? 0 : 1; +} + +static u8 is_fan_fault(struct cs6436_56p_fan_data *data, enum fan_id id) +{ + u8 ret = 1; + int front_fan_index = FAN1_FRONT_SPEED_RPM + id; + int rear_fan_index = FAN1_REAR_SPEED_RPM + id; + + /* Check if the speed of front or rear fan is ZERO, + */ + if (reg_val_to_speed_rpm(data->reg_val[front_fan_index]) && + reg_val_to_speed_rpm(data->reg_val[rear_fan_index])) { + ret = 0; + } + + return ret; +} + +static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + int error, value; + + error = kstrtoint(buf, 10, &value); + if (error) + return error; + + if (value <= 0 || value > FAN_MAX_DUTY_CYCLE) + return -EINVAL; + + cig_cpld_write_register(fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value)); + + return count; +} + +static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + + cs6436_56p_fan_update_device(dev); + + struct cs6436_56p_fan_data *data = fan_data; + + ssize_t ret = 0; + + if (data->valid) { + switch (attr->index) { + + case FAN1_STATE: + case FAN2_STATE: + case FAN3_STATE: + case FAN4_STATE: + case FAN5_STATE: + //printk("FAN_STATE_REG: 0x%x\n", data->reg_val[FAN_STATE_REG]); + //printk("index: %d\n", attr->index); + ret = sprintf(buf, "%d\n", + reg_val_to_is_state(data->reg_val[FAN_STATE_REG], + attr->index - FAN1_STATE)); + break; + case FAN_DUTY_CYCLE_PERCENTAGE: + { + u32 duty_cycle = reg_val_to_duty_cycle(data->reg_val[FAN_DUTY_CYCLE_PERCENTAGE]); + ret = sprintf(buf, "%u\n", duty_cycle); + break; + } + case FAN1_FRONT_SPEED_RPM: + case FAN2_FRONT_SPEED_RPM: + case FAN3_FRONT_SPEED_RPM: + case FAN4_FRONT_SPEED_RPM: + case FAN5_FRONT_SPEED_RPM: + case FAN1_REAR_SPEED_RPM: + case FAN2_REAR_SPEED_RPM: + case FAN3_REAR_SPEED_RPM: + case FAN4_REAR_SPEED_RPM: + case FAN5_REAR_SPEED_RPM: +// printk("FAN_seed_REG: 0x%x\n", data->reg_val[attr->index]); +// printk("index: %d\n", attr->index); + ret = sprintf(buf, "%u\n", reg_val_to_speed_rpm(data->reg_val[attr->index])); + break; + + case FAN1_FAULT: + case FAN2_FAULT: + case FAN3_FAULT: + case FAN4_FAULT: + case FAN5_FAULT: + ret = sprintf(buf, "%d\n", is_fan_fault(data, attr->index - FAN1_FAULT)); + break; + default: + break; + } + } + + return ret; +} + +static const struct attribute_group cs6436_56p_fan_group = { + .attrs = cs6436_56p_fan_attributes, +}; + +static struct cs6436_56p_fan_data *cs6436_56p_fan_update_device(struct device *dev) +{ + struct cs6436_56p_fan_data *data = fan_data; + + mutex_lock(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || + !data->valid) { + int i; + + data->valid = 0; + + /* Update fan data + */ + for (i = 0; i < ARRAY_SIZE(data->reg_val); i++) { + u8 status; + (void)cig_cpld_read_register(fan_reg[i], &status); + + if (status < 0) { + data->valid = 0; + mutex_unlock(&data->update_lock); + return data; + } + else { + data->reg_val[i] = status; + } + } + + data->last_updated = jiffies; + data->valid = 1; + } + + mutex_unlock(&data->update_lock); + + return data; +} + +static int cs6436_56p_fan_probe(struct platform_device *pdev) +{ + int status = -1; + /* Register sysfs hooks */ + status = sysfs_create_group(&pdev->dev.kobj, &cs6436_56p_fan_group); + if (status) { + goto exit; + + } + + fan_data->hwmon_dev = hwmon_device_register(&pdev->dev); + if (IS_ERR(fan_data->hwmon_dev)) { + status = PTR_ERR(fan_data->hwmon_dev); + goto exit_remove; + } + + dev_info(&pdev->dev, "cs6436_56p_fan\n"); + + return 0; + +exit_remove: + sysfs_remove_group(&pdev->dev.kobj, &cs6436_56p_fan_group); +exit: + return status; +} + +static int cs6436_56p_fan_remove(struct platform_device *pdev) +{ + hwmon_device_unregister(fan_data->hwmon_dev); + sysfs_remove_group(&fan_data->pdev->dev.kobj, &cs6436_56p_fan_group); + + return 0; +} + +#define DRVNAME "cs6436_56p_fan" + +static struct platform_driver cs6436_56p_fan_driver = { + .probe = cs6436_56p_fan_probe, + .remove = cs6436_56p_fan_remove, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + + + + + +static int __init cs6436_56p_fan_init(void) +{ + int ret; + + cig_cpld_write_register(0x40, duty_cycle_to_reg_val(50)); + + ret = platform_driver_register(&cs6436_56p_fan_driver); + if (ret < 0) { + goto exit; + } + + fan_data = kzalloc(sizeof(struct cs6436_56p_fan_data), GFP_KERNEL); + if (!fan_data) { + ret = -ENOMEM; + platform_driver_unregister(&cs6436_56p_fan_driver); + goto exit; + } + + mutex_init(&fan_data->update_lock); + fan_data->valid = 0; + + fan_data->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(fan_data->pdev)) { + ret = PTR_ERR(fan_data->pdev); + platform_driver_unregister(&cs6436_56p_fan_driver); + kfree(fan_data); + goto exit; + } + +exit: + return ret; +} + +static void __exit cs6436_56p_fan_exit(void) +{ + platform_device_unregister(fan_data->pdev); + platform_driver_unregister(&cs6436_56p_fan_driver); + kfree(fan_data); +} + +MODULE_AUTHOR("CIG"); +MODULE_DESCRIPTION("cs6436_56p_fan driver"); +MODULE_LICENSE("GPL"); + +module_init(cs6436_56p_fan_init); +module_exit(cs6436_56p_fan_exit); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_fan driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-led.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-led.c new file mode 100755 index 000000000000..4c7c629f3e7b --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-led.c @@ -0,0 +1,594 @@ +/* + * A hwmon driver for the CIG cs6436-56P LED + * + * Copyright (C) 2018 Cambridge, Inc. + + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*#define DEBUG*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +extern int cig_cpld_write_register(u8 reg_off, u8 val); + +extern int cig_cpld_read_register(u8 reg_off, u8 *val); + +extern void led_classdev_unregister(struct led_classdev *led_cdev); +extern int led_classdev_register(struct device *parent, struct led_classdev *led_cdev); +extern void led_classdev_resume(struct led_classdev *led_cdev); +extern void led_classdev_suspend(struct led_classdev *led_cdev); + +#define DRVNAME "cs6436_56p_led" + +struct cs6436_56p_led_data { + struct platform_device *pdev; + struct mutex update_lock; + char valid; /* != 0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 reg_val[6]; /* 0: system & location + 1: PSU1 &PSU12 + 2: fan & management + 3: console & ToD + 4-5 : fan1-fan5*/ +}; + +static struct cs6436_56p_led_data *ledctl = NULL; + +/* LED related data + */ +#define LED_TYPE_PSU1_REG_MASK 0x0C +#define LED_MODE_PSU1_GREEN_MASK 0x08 +#define LED_MODE_PSU1_RED_MASK 0x04 +#define LED_MODE_PSU1_AMBER_MASK 0x0C +#define LED_MODE_PSU1_OFF_MASK 0x00 + +#define LED_TYPE_PSU2_REG_MASK 0x30 +#define LED_MODE_PSU2_GREEN_MASK 0x20 +#define LED_MODE_PSU2_RED_MASK 0x10 +#define LED_MODE_PSU2_AMBER_MASK 0x30 +#define LED_MODE_PSU2_OFF_MASK 0x00 + +#define LED_TYPE_SYS_REG_MASK 0xF0 +#define LED_MODE_SYS_GREEN_MASK 0x40 +#define LED_MODE_SYS_RED_MASK 0x20 +#define LED_MODE_SYS_AMBER_MASK 0x60 +#define LED_MODE_SYS_AMBER_FLASHING_MASK 0x70 +#define LED_MODE_SYS_OFF_MASK 0x00 + +#define LED_TYPE_RES_REG_MASK 0x0F +#define LED_MODE_RES_GREEN_MASK 0x04 +#define LED_MODE_RES_RED_MASK 0x02 +#define LED_MODE_RES_AMBER_MASK 0x06 +#define LED_MODE_RES_AMBER_FLASHING_MASK 0x07 +#define LED_MODE_RES_OFF_MASK 0x00 + +#define LED_TYPE_FAN_REG_MASK 0x03 +#define LED_MODE_FAN_GREEN_MASK 0x02 +#define LED_MODE_FAN_RED_MASK 0x01 +#define LED_MODE_FAN_AMBER_MASK 0x03 +#define LED_MODE_FAN_OFF_MASK 0x00 + +#define LED_TYPE_FAN1_REG_MASK 0x03 +#define LED_TYPE_FAN2_REG_MASK 0x0C +#define LED_TYPE_FAN3_REG_MASK 0x30 +#define LED_TYPE_FAN4_REG_MASK 0xC0 +#define LED_TYPE_FAN5_REG_MASK 0x03 + +#define LED_MODE_FANX_GREEN_MASK 0x02 +#define LED_MODE_FANX_RED_MASK 0x01 +#define LED_MODE_FANX_AMBER_MASK 0x03 +#define LED_MODE_FANX_OFF_MASK 0x00 + +enum led_type { + LED_TYPE_SYS, + LED_TYPE_PSU2, + LED_TYPE_PSU1, + LED_TYPE_FAN, + LED_TYPE_FAN1, + LED_TYPE_FAN2, + LED_TYPE_FAN3, + LED_TYPE_FAN4, + LED_TYPE_FAN5, +}; + +static const u8 led_reg[] = { + 0x30, /* system & reserved*/ + 0x31, /* fan & PSU1 & PSU2 */ + 0x32, /* FAN5 LED */ + 0x33, /* FAN1-4 LED */ +}; + + +enum led_light_mode { + LED_MODE_OFF = 0, + LED_MODE_GREEN, + LED_MODE_AMBER, + LED_MODE_RED, + LED_MODE_GREEN_BLINK, + LED_MODE_AMBER_BLINK, + LED_MODE_RED_BLINK, + LED_MODE_GREEN_FLASHING, + LED_MODE_AMBER_FLASHING, + LED_MODE_RED_FLASHING, + LED_MODE_AUTO, + LED_MODE_UNKNOWN +}; + +struct led_type_mode { + enum led_type type; + int type_mask; + enum led_light_mode mode; + int mode_mask; +}; + +static struct led_type_mode led_type_mode_data[] = { +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU1_GREEN_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU1_AMBER_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_RED, LED_MODE_PSU1_RED_MASK}, +{LED_TYPE_PSU1, LED_TYPE_PSU1_REG_MASK, LED_MODE_OFF, LED_MODE_PSU1_OFF_MASK}, + +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_GREEN, LED_MODE_PSU2_GREEN_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_AMBER, LED_MODE_PSU2_AMBER_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_RED, LED_MODE_PSU2_RED_MASK}, +{LED_TYPE_PSU2, LED_TYPE_PSU2_REG_MASK, LED_MODE_OFF, LED_MODE_PSU2_OFF_MASK}, + +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_GREEN, LED_MODE_SYS_GREEN_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_AMBER, LED_MODE_SYS_AMBER_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_RED, LED_MODE_SYS_RED_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_AMBER_FLASHING, LED_MODE_SYS_AMBER_FLASHING_MASK}, +{LED_TYPE_SYS, LED_TYPE_SYS_REG_MASK, LED_MODE_OFF, LED_MODE_SYS_OFF_MASK}, + +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_GREEN, LED_MODE_FAN_GREEN_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_AMBER, LED_MODE_FAN_AMBER_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_RED, LED_MODE_FAN_RED_MASK}, +{LED_TYPE_FAN, LED_TYPE_FAN_REG_MASK, LED_MODE_OFF, LED_MODE_FAN_OFF_MASK}, + +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 0}, +{LED_TYPE_FAN1, LED_TYPE_FAN1_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 2}, +{LED_TYPE_FAN2, LED_TYPE_FAN2_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 2}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 4}, +{LED_TYPE_FAN3, LED_TYPE_FAN3_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 4}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 6}, +{LED_TYPE_FAN4, LED_TYPE_FAN4_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 6}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_GREEN, LED_MODE_FANX_GREEN_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_RED, LED_MODE_FANX_RED_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_AMBER, LED_MODE_FANX_AMBER_MASK << 0}, +{LED_TYPE_FAN5, LED_TYPE_FAN5_REG_MASK, LED_MODE_OFF, LED_MODE_FANX_OFF_MASK << 0}, +}; + +struct fanx_info_s { + u8 cname; /* device name */ + enum led_type type; + u8 reg_id; /* map to led_reg & reg_val */ +}; + +static struct fanx_info_s fanx_info[] = { + {'1', LED_TYPE_FAN1, 3}, + {'2', LED_TYPE_FAN2, 3}, + {'3', LED_TYPE_FAN3, 3}, + {'4', LED_TYPE_FAN4, 3}, + {'5', LED_TYPE_FAN5, 2}, +}; + + +static int led_reg_val_to_light_mode(enum led_type type, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + + if (type != led_type_mode_data[i].type) + continue; + + if ((led_type_mode_data[i].type_mask & reg_val) == + led_type_mode_data[i].mode_mask) + { + return led_type_mode_data[i].mode; + } + } + + return 0; +} + +static u8 led_light_mode_to_reg_val(enum led_type type, + enum led_light_mode mode, u8 reg_val) { + int i; + + for (i = 0; i < ARRAY_SIZE(led_type_mode_data); i++) { + if (type != led_type_mode_data[i].type) + continue; + + if (mode != led_type_mode_data[i].mode) + continue; + + reg_val = led_type_mode_data[i].mode_mask | + (reg_val & (~led_type_mode_data[i].type_mask)); + break; + } + + return reg_val; +} + +static void cs6436_56p_led_update(void) +{ + mutex_lock(&ledctl->update_lock); + + if (time_after(jiffies, ledctl->last_updated + HZ + HZ / 2) + || !ledctl->valid) { + int i; + + dev_dbg(&ledctl->pdev->dev, "Starting cs6436_56p_led update\n"); + + /* Update LED data + */ + for (i = 0; i < ARRAY_SIZE(ledctl->reg_val); i++) { + u8 status; + cig_cpld_read_register(led_reg[i], &status); + + if (status < 0) { + ledctl->valid = 0; + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", led_reg[i], status); + goto exit; + } + else + { + ledctl->reg_val[i] = status; + } + } + + ledctl->last_updated = jiffies; + ledctl->valid = 1; + } + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void cs6436_56p_led_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode, + u8 reg, enum led_type type) +{ + u8 reg_val; + mutex_lock(&ledctl->update_lock); + + cig_cpld_read_register(reg, ®_val); + if (reg_val < 0) { + dev_dbg(&ledctl->pdev->dev, "reg %d, err %d\n", reg, reg_val); + goto exit; + } + + reg_val = led_light_mode_to_reg_val(type, led_light_mode, reg_val); + + cig_cpld_write_register(reg, reg_val); + + /* to prevent the slow-update issue */ + ledctl->valid = 0; + +exit: + mutex_unlock(&ledctl->update_lock); +} + +static void cs6436_56p_led_fanx_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (led_cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[reg_id], led_type1); + return; + } + } +} + + +static enum led_brightness cs6436_56p_led_fanx_get(struct led_classdev *cdev) +{ + enum led_type led_type1; + int reg_id; + int i, nsize; + int ncount = sizeof(fanx_info)/sizeof(struct fanx_info_s); + + for(i=0;iname); + + if (cdev->name[nsize-1] == fanx_info[i].cname) + { + led_type1 = fanx_info[i].type; + reg_id = fanx_info[i].reg_id; + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(led_type1, ledctl->reg_val[reg_id]); + } + } + + return led_reg_val_to_light_mode(LED_TYPE_FAN1, ledctl->reg_val[5]); +} + + +static void cs6436_56p_led_psu1_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU1); +} + +static enum led_brightness cs6436_56p_led_psu1_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU1, ledctl->reg_val[1]); +} + +static void cs6436_56p_led_psu2_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_PSU2); +} + +static enum led_brightness cs6436_56p_led_psu2_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_PSU2, ledctl->reg_val[1]); +} + +static void cs6436_56p_led_sys_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode,led_reg[0], LED_TYPE_SYS); +} + +static enum led_brightness cs6436_56p_led_sys_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_SYS, ledctl->reg_val[0]); +} + + +static enum led_brightness cs6436_56p_led_fan_get(struct led_classdev *cdev) +{ + cs6436_56p_led_update(); + return led_reg_val_to_light_mode(LED_TYPE_FAN, ledctl->reg_val[1]); +} + +static void cs6436_56p_led_fan_set(struct led_classdev *led_cdev, + enum led_brightness led_light_mode) +{ + cs6436_56p_led_set(led_cdev, led_light_mode, led_reg[1], LED_TYPE_FAN); +} + + +static struct led_classdev cs6436_56p_leds[] = { + [LED_TYPE_SYS] = { + .name = "cs6436_56p_led::sys", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_sys_set, + .brightness_get = cs6436_56p_led_sys_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN] = { + .name = "cs6436_56p_led::fan", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fan_set, + .brightness_get = cs6436_56p_led_fan_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + + [LED_TYPE_PSU1] = { + .name = "cs6436_56p_led::psu1", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_psu1_set, + .brightness_get = cs6436_56p_led_psu1_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_PSU2] = { + .name = "cs6436_56p_led::psu2", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_psu2_set, + .brightness_get = cs6436_56p_led_psu2_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + + [LED_TYPE_FAN1] = { + .name = "cs6436_56p_led::fan1", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN2] = { + .name = "cs6436_56p_led::fan2", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN3] = { + .name = "cs6436_56p_led::fan3", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN4] = { + .name = "cs6436_56p_led::fan4", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + }, + [LED_TYPE_FAN5] = { + .name = "cs6436_56p_led::fan5", + .default_trigger = "unused", + .brightness_set = cs6436_56p_led_fanx_set, + .brightness_get = cs6436_56p_led_fanx_get, + .flags = LED_CORE_SUSPENDRESUME, + .max_brightness = LED_MODE_AUTO, + } +}; + +static int cs6436_56p_led_suspend(struct platform_device *dev, + pm_message_t state) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + led_classdev_suspend(&cs6436_56p_leds[i]); + } + + return 0; +} + +static int cs6436_56p_led_resume(struct platform_device *dev) +{ + int i = 0; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + led_classdev_resume(&cs6436_56p_leds[i]); + } + + return 0; +} + +static int cs6436_56p_led_probe(struct platform_device *pdev) +{ + int ret, i; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + ret = led_classdev_register(&pdev->dev, &cs6436_56p_leds[i]); + + if (ret < 0) + break; + } + + /* Check if all LEDs were successfully registered */ + if (i != ARRAY_SIZE(cs6436_56p_leds)) { + int j; + + /* only unregister the LEDs that were successfully registered */ + for (j = 0; j < i; j++) { + led_classdev_unregister(&cs6436_56p_leds[i]); + } + } + + return ret; +} + +static int cs6436_56p_led_remove(struct platform_device *pdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(cs6436_56p_leds); i++) { + led_classdev_unregister(&cs6436_56p_leds[i]); + } + + return 0; +} + +static struct platform_driver cs6436_56p_led_driver = { + .probe = cs6436_56p_led_probe, + .remove = cs6436_56p_led_remove, + .suspend = cs6436_56p_led_suspend, + .resume = cs6436_56p_led_resume, + .driver = { + .name = DRVNAME, + .owner = THIS_MODULE, + }, +}; + +static int cs6436_56p_led_default(void) +{ + cig_cpld_write_register(0x30, 0x40);// system green led solid on +} + +static int __init cs6436_56p_led_init(void) +{ + int ret; + + ret = platform_driver_register(&cs6436_56p_led_driver); + if (ret < 0) { + goto exit; + } + + ledctl = kzalloc(sizeof(struct cs6436_56p_led_data), GFP_KERNEL); + if (!ledctl) { + ret = -ENOMEM; + platform_driver_unregister(&cs6436_56p_led_driver); + goto exit; + } + + mutex_init(&ledctl->update_lock); + + ledctl->pdev = platform_device_register_simple(DRVNAME, -1, NULL, 0); + if (IS_ERR(ledctl->pdev)) { + ret = PTR_ERR(ledctl->pdev); + platform_driver_unregister(&cs6436_56p_led_driver); + kfree(ledctl); + goto exit; + } + + cs6436_56p_led_default(); + +exit: + return ret; +} + +static void __exit cs6436_56p_led_exit(void) +{ + platform_device_unregister(ledctl->pdev); + platform_driver_unregister(&cs6436_56p_led_driver); + kfree(ledctl); +} + +module_init(cs6436_56p_led_init); +module_exit(cs6436_56p_led_exit); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_led driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-psu.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-psu.c new file mode 100755 index 000000000000..8754007408c7 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-psu.c @@ -0,0 +1,586 @@ +/* + * A hwmon driver for the CIG cs6436-56P Power Module + * + * Copyright (C) 2018 Cambridge, Inc. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + + +#define MAX_FAN_DUTY_CYCLE 100 + +/* Address scanned */ +static const unsigned short normal_i2c[] = {I2C_CLIENT_END }; + +/* This is additional data */ +struct cs6436_56p_psu_data { + struct device *hwmon_dev; + struct mutex update_lock; + char valid; + unsigned long last_updated; /* In jiffies */ + + /* Registers value */ + u8 vout_mode; + u16 v_in; + u16 v_out; + u16 i_in; + u16 i_out; + u16 p_in; + u16 p_out; + u16 temp_input[3]; + u8 temp_fault; + u8 fan_fault; + u16 fan_duty_cycle[2]; + u16 fan_speed[2]; + u8 mfr_id[8]; + u8 mfr_model[20]; + u8 mfr_serial[20]; + u8 psu_is_present; + u8 psu_is_good; +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask); +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count); +static ssize_t for_linear_data(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_fan_fault(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_fan_warning(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_temp_fault(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_temp_warning(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_vout_data(struct device *dev, struct device_attribute *dev_attr, char *buf); +static int cs6436_56p_psu_read_byte(struct i2c_client *client, u8 reg); +static int cs6436_56p_psu_read_word(struct i2c_client *client, u8 reg); +static int cs6436_56p_psu_write_word(struct i2c_client *client, u8 reg, u16 value); +static int cs6436_56p_psu_read_block(struct i2c_client *client, u8 command, u8 *data, int data_len); +static struct cs6436_56p_psu_data *cs6436_56p_psu_update_device(struct device *dev); +static ssize_t for_ascii(struct device *dev, struct device_attribute *dev_attr, char *buf); +static ssize_t for_status(struct device *dev, struct device_attribute *dev_attr, char *buf); + +enum cs6436_56p_psu_sysfs_attributes { + PSU_V_IN, + PSU_V_OUT, + PSU_I_IN, + PSU_I_OUT, + PSU_P_IN, + PSU_P_OUT, + PSU_TEMP1_INPUT, + PSU_TEMP2_INPUT, + PSU_TEMP3_INPUT, + PSU_TEMP_FAULT, + PSU_TEMP_WARN, + PSU_FAN1_FAULT, + PSU_FAN1_WARN, + PSU_FAN1_DUTY_CYCLE, + PSU_FAN1_SPEED, + PSU_MFR_ID, + PSU_MFR_MODEL, + PSU_MFR_SERIAL, + PSU_PRESENT, + PSU_P_GOOD, +}; + +static int two_complement_to_int(u16 data, u8 valid_bit, int mask) +{ + u16 valid_data = data & mask; + + bool is_negative = valid_data >> (valid_bit - 1); + return is_negative ? (-(((~valid_data) & mask) + 1)) : valid_data; +} + +static ssize_t set_fan_duty_cycle(struct device *dev, struct device_attribute \ + *dev_attr, const char *buf, size_t count) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct i2c_client *client = to_i2c_client(dev); + struct cs6436_56p_psu_data *data = i2c_get_clientdata(client); + int nr = (attr->index == PSU_FAN1_DUTY_CYCLE) ? 0 : 1; + long speed; + int error; + + error = kstrtol(buf, 10, &speed); + if (error) + return error; + + if (speed < 0 || speed > MAX_FAN_DUTY_CYCLE) + return -EINVAL; + + + mutex_lock(&data->update_lock); + data->fan_duty_cycle[nr] = speed; + cs6436_56p_psu_write_word(client, 0x3B + nr, data->fan_duty_cycle[nr]); + mutex_unlock(&data->update_lock); + + return count; +} + +static ssize_t for_linear_data(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + u16 value = 0; + int exponent, mantissa; + int multiplier = 1000; + + switch (attr->index) { + case PSU_V_IN: + value = data->v_in; + break; + case PSU_I_IN: + value = data->i_in; + break; + case PSU_I_OUT: + value = data->i_out; + break; + case PSU_P_IN: + value = data->p_in; + break; + case PSU_P_OUT: + value = data->p_out; + break; + case PSU_TEMP1_INPUT: + value = data->temp_input[0]; + break; + case PSU_TEMP2_INPUT: + value = data->temp_input[1]; + break; + case PSU_TEMP3_INPUT: + value = data->temp_input[2]; + break; + case PSU_FAN1_DUTY_CYCLE: + multiplier = 1; + value = data->fan_duty_cycle[0]; + break; + case PSU_FAN1_SPEED: + multiplier = 1; + value = data->fan_speed[0]; + break; + default: + break; + } + + exponent = two_complement_to_int(value >> 11, 5, 0x1f); + mantissa = two_complement_to_int(value & 0x7ff, 11, 0x7ff); + + return (exponent >= 0) ? sprintf(buf, "%d\n", \ + (mantissa << exponent) * multiplier) : \ + sprintf(buf, "%d\n", (mantissa * multiplier) / (1 << -exponent)); +} + +static ssize_t for_fan_fault(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_FAULT) ? 7 : 6; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t for_fan_warning(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + u8 shift = (attr->index == PSU_FAN1_WARN) ? 5 : 4; + + return sprintf(buf, "%d\n", data->fan_fault >> shift); +} + +static ssize_t for_temp_fault(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + + return sprintf(buf, "%d\n", data->temp_fault >> 7); +} + +static ssize_t for_temp_warning(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + + return sprintf(buf, "%d\n", data->temp_fault >> 6); +} +static ssize_t for_vout_data(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + int exponent, mantissa; + int multiplier = 1000; + + exponent = two_complement_to_int(data->vout_mode, 5, 0x1f); + mantissa = data->v_out; + + return (exponent > 0) ? sprintf(buf, "%d\n", \ + (mantissa << exponent) * multiplier) : \ + sprintf(buf, "%d\n", ((mantissa * multiplier) >> (-exponent))); +} + +static ssize_t for_ascii(struct device *dev, struct device_attribute \ + *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + u8 *ptr = NULL; + + if (!data->valid) + return 0; + + switch (attr->index) { + case PSU_MFR_ID: + ptr = data->mfr_id + 1; + break; + case PSU_MFR_MODEL: + ptr = data->mfr_model + 1; + break; + case PSU_MFR_SERIAL: + ptr = data->mfr_serial + 1; + break; + default: + return 0; + } + return sprintf(buf, "%s\n", ptr); +} + + +static ssize_t for_status(struct device *dev, struct device_attribute *dev_attr, char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); + struct cs6436_56p_psu_data *data = cs6436_56p_psu_update_device(dev); + u8 *ptr = NULL; + + u8 status = 0; + + if (!data->valid) { + return -EIO; + } + + if (attr->index == PSU_PRESENT) { + status = data->psu_is_present; + } + else { /* PSU_POWER_GOOD */ + status = data->psu_is_good; + } + + return sprintf(buf, "%d\n", status); +} + + + +static int cs6436_56p_psu_read_byte(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_byte_data(client, reg); +} + +static int cs6436_56p_psu_read_word(struct i2c_client *client, u8 reg) +{ + return i2c_smbus_read_word_data(client, reg); +} + +static int cs6436_56p_psu_write_word(struct i2c_client *client, u8 reg, \ + u16 value) +{ + union i2c_smbus_data data; + data.word = value; + return i2c_smbus_xfer(client->adapter, client->addr, + client->flags |= I2C_CLIENT_PEC, + I2C_SMBUS_WRITE, reg, + I2C_SMBUS_WORD_DATA, &data); + +} + +static int cs6436_56p_psu_read_block(struct i2c_client *client, u8 command, \ + u8 *data, int data_len) +{ + int result = i2c_smbus_read_i2c_block_data(client, command, data_len, + data); + if (unlikely(result < 0)) + goto abort; + if (unlikely(result != data_len)) { + result = -EIO; + goto abort; + } + + result = 0; +abort: + return result; + +} + +struct reg_data_byte { + u8 reg; + u8 *value; +}; + +struct reg_data_word { + u8 reg; + u16 *value; +}; + +static struct cs6436_56p_psu_data *cs6436_56p_psu_update_device( \ + struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct cs6436_56p_psu_data *data = i2c_get_clientdata(client); + + mutex_lock(&data->update_lock); + + + if (time_after(jiffies, data->last_updated)) { + int i, status; + u8 command; + struct reg_data_byte regs_byte[] = { + {0x20, &data->vout_mode}, + {0x81, &data->fan_fault}, + {0x7d, &data->temp_fault}, + }; + struct reg_data_word regs_word[] = { + {0x88, &data->v_in}, + {0x8b, &data->v_out}, + {0x89, &data->i_in}, + {0x8c, &data->i_out}, + {0x96, &data->p_out}, + {0x97, &data->p_in}, + {0x8d, &(data->temp_input[0])}, + {0x8e, &(data->temp_input[1])}, + {0x8f, &(data->temp_input[2])}, + {0x3b, &(data->fan_duty_cycle[0])}, + {0x90, &(data->fan_speed[0])}, + }; + + dev_dbg(&client->dev, "start data update\n"); + + /* one milliseconds from now */ + data->last_updated = jiffies + HZ / 1000; + + for (i = 0; i < ARRAY_SIZE(regs_byte); i++) { + status = cs6436_56p_psu_read_byte(client, + regs_byte[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_byte[i].reg, status); + } else { + *(regs_byte[i].value) = status; + } + } + + for (i = 0; i < ARRAY_SIZE(regs_word); i++) { + status = cs6436_56p_psu_read_word(client, + regs_word[i].reg); + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", + regs_word[i].reg, status); + } else { + *(regs_word[i].value) = status; + } + } + + command = 0x99; /* PSU mfr_id */ + status = cs6436_56p_psu_read_block(client, command, + data->mfr_id, ARRAY_SIZE(data->mfr_id) - 1); + data->mfr_id[ARRAY_SIZE(data->mfr_id) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + command = 0x9a; /* PSU mfr_model */ + status = cs6436_56p_psu_read_block(client, command, + data->mfr_model, ARRAY_SIZE(data->mfr_model) - 1); + data->mfr_model[ARRAY_SIZE(data->mfr_model) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + + command = 0x9e; /* PSU mfr_serial */ + status = cs6436_56p_psu_read_block(client, command, + data->mfr_serial, ARRAY_SIZE(data->mfr_serial) - 1); + data->mfr_serial[ARRAY_SIZE(data->mfr_serial) - 1] = '\0'; + if (status < 0) { + dev_dbg(&client->dev, "reg %d, err %d\n", command, status); + } + data->valid = 1; + data->psu_is_present = strlen(data->mfr_id) > 1 ? 1:0; + if(data->psu_is_present) + data->psu_is_good = ((data->fan_fault) || (data->temp_fault))? 0:1; + else + data->psu_is_good = 0; + } + + mutex_unlock(&data->update_lock); + + return data; + +} + +/* sysfs attributes for hwmon */ +static SENSOR_DEVICE_ATTR(psu_v_in, S_IRUGO, for_linear_data, NULL, PSU_V_IN); +static SENSOR_DEVICE_ATTR(psu_v_out, S_IRUGO, for_vout_data, NULL, PSU_V_OUT); +static SENSOR_DEVICE_ATTR(psu_i_in, S_IRUGO, for_linear_data, NULL, PSU_I_IN); +static SENSOR_DEVICE_ATTR(psu_i_out, S_IRUGO, for_linear_data, NULL, PSU_I_OUT); +static SENSOR_DEVICE_ATTR(psu_p_in, S_IRUGO, for_linear_data, NULL, PSU_P_IN); +static SENSOR_DEVICE_ATTR(psu_p_out, S_IRUGO, for_linear_data, NULL, PSU_P_OUT); +static SENSOR_DEVICE_ATTR(psu_temp1_input, S_IRUGO, for_linear_data, NULL, PSU_TEMP1_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp2_input, S_IRUGO, for_linear_data, NULL, PSU_TEMP2_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp3_input, S_IRUGO, for_linear_data, NULL, PSU_TEMP3_INPUT); +static SENSOR_DEVICE_ATTR(psu_temp_fault, S_IRUGO, for_temp_fault, NULL, PSU_TEMP_FAULT); +static SENSOR_DEVICE_ATTR(psu_temp_warning, S_IRUGO, for_temp_warning, NULL, PSU_TEMP_WARN); +static SENSOR_DEVICE_ATTR(psu_fan1_fault, S_IRUGO, for_fan_fault, NULL, PSU_FAN1_FAULT); +static SENSOR_DEVICE_ATTR(psu_fan1_warning, S_IRUGO, for_fan_warning, NULL, PSU_FAN1_WARN); +static SENSOR_DEVICE_ATTR(psu_fan1_duty_cycle_percentage, S_IWUSR | S_IRUGO, for_linear_data, set_fan_duty_cycle, PSU_FAN1_DUTY_CYCLE); +static SENSOR_DEVICE_ATTR(psu_fan1_speed_rpm, S_IRUGO, for_linear_data, NULL, PSU_FAN1_SPEED); +static SENSOR_DEVICE_ATTR(psu_mfr_id, S_IRUGO, for_ascii, NULL, PSU_MFR_ID); +static SENSOR_DEVICE_ATTR(psu_mfr_model, S_IRUGO, for_ascii, NULL, PSU_MFR_MODEL); +static SENSOR_DEVICE_ATTR(psu_mfr_serial, S_IRUGO, for_ascii, NULL, PSU_MFR_SERIAL); +static SENSOR_DEVICE_ATTR(psu_present, S_IRUGO, for_status, NULL, PSU_PRESENT); +static SENSOR_DEVICE_ATTR(psu_power_good, S_IRUGO, for_status, NULL, PSU_P_GOOD); + + + +static struct attribute *cs6436_56p_psu_attributes[] = { + &sensor_dev_attr_psu_v_in.dev_attr.attr, + &sensor_dev_attr_psu_v_out.dev_attr.attr, + &sensor_dev_attr_psu_i_in.dev_attr.attr, + &sensor_dev_attr_psu_i_out.dev_attr.attr, + &sensor_dev_attr_psu_p_in.dev_attr.attr, + &sensor_dev_attr_psu_p_out.dev_attr.attr, + &sensor_dev_attr_psu_temp1_input.dev_attr.attr, + &sensor_dev_attr_psu_temp2_input.dev_attr.attr, + &sensor_dev_attr_psu_temp3_input.dev_attr.attr, + &sensor_dev_attr_psu_temp_fault.dev_attr.attr, + &sensor_dev_attr_psu_temp_warning.dev_attr.attr, + &sensor_dev_attr_psu_fan1_fault.dev_attr.attr, + &sensor_dev_attr_psu_fan1_warning.dev_attr.attr, + &sensor_dev_attr_psu_fan1_duty_cycle_percentage.dev_attr.attr, + &sensor_dev_attr_psu_fan1_speed_rpm.dev_attr.attr, + &sensor_dev_attr_psu_mfr_id.dev_attr.attr, + &sensor_dev_attr_psu_mfr_model.dev_attr.attr, + &sensor_dev_attr_psu_mfr_serial.dev_attr.attr, + &sensor_dev_attr_psu_present.dev_attr.attr, + &sensor_dev_attr_psu_power_good.dev_attr.attr, + NULL +}; + +static const struct attribute_group cs6436_56p_psu_group = { + .attrs = cs6436_56p_psu_attributes, +}; + +static int cs6436_56p_psu_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct cs6436_56p_psu_data *data; + int status; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) { + status = -EIO; + goto exit; + } + + data = kzalloc(sizeof(*data), GFP_KERNEL); + if (!data) { + status = -ENOMEM; + goto exit; + } + + i2c_set_clientdata(client, data); + data->valid = 0; + mutex_init(&data->update_lock); + + dev_info(&client->dev, "new chip found\n"); + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &cs6436_56p_psu_group); + if (status) + goto exit_sysfs_create_group; + + data->hwmon_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->hwmon_dev)) { + status = PTR_ERR(data->hwmon_dev); + goto exit_hwmon_device_register; + } + + return 0; + +exit_hwmon_device_register: + sysfs_remove_group(&client->dev.kobj, &cs6436_56p_psu_group); +exit_sysfs_create_group: + kfree(data); +exit: + return status; +} + +static int cs6436_56p_psu_remove(struct i2c_client *client) +{ + struct cs6436_56p_psu_data *data = i2c_get_clientdata(client); + hwmon_device_unregister(data->hwmon_dev); + sysfs_remove_group(&client->dev.kobj, &cs6436_56p_psu_group); + kfree(data); + + return 0; +} + +enum psu_index +{ + cs6436_56p_psu1, + cs6436_56p_psu2 +}; + +static const struct i2c_device_id cs6436_56p_psu_id[] = { + { "cs6436_56p_psu1", cs6436_56p_psu1 }, + { "cs6436_56p_psu2", cs6436_56p_psu2 }, + {} +}; +MODULE_DEVICE_TABLE(i2c, cs6436_56p_psu_id); + +static struct i2c_driver cs6436_56p_psu_driver = { + .class = I2C_CLASS_HWMON, + .driver = { + .name = "cs6436_56p_psu", + }, + .probe = cs6436_56p_psu_probe, + .remove = cs6436_56p_psu_remove, + .id_table = cs6436_56p_psu_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(cs6436_56p_psu_driver); + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_psu driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-sfp.c b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-sfp.c new file mode 100755 index 000000000000..f2b54a260fcb --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/modules/x86-64-cig-cs6436-56p-sfp.c @@ -0,0 +1,1454 @@ +/* + * A hwmon driver for the CIG cs6436-56P SFP Module + * + * Copyright (C) 2018 Cambridge, Inc. + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "cs6436_56p_sfp" /* Platform dependent */ + +#define DEBUG_MODE 0 + +#if (DEBUG_MODE == 1) + #define DEBUG_PRINT(fmt, args...) \ + printk (KERN_INFO "%s:%s[%d]: " fmt "\r\n", __FILE__, __FUNCTION__, __LINE__, ##args) +#else + #define DEBUG_PRINT(fmt, args...) +#endif + +#define EEPROM_NAME "sfp_eeprom" +#define EEPROM_SIZE 256 /* 256 byte eeprom */ +#define BIT_INDEX(i) (1ULL << (i)) +#define USE_I2C_BLOCK_READ 1 /* Platform dependent */ +#define I2C_RW_RETRY_COUNT 3 +#define I2C_RW_RETRY_INTERVAL 100 /* ms */ + +#define SFP_EEPROM_A0_I2C_ADDR (0xA0 >> 1) +#define SFP_EEPROM_A2_I2C_ADDR (0xA2 >> 1) + +#define SFF8024_PHYSICAL_DEVICE_ID_ADDR 0x0 +#define SFF8024_DEVICE_ID_SFP 0x3 +#define SFF8024_DEVICE_ID_QSFP 0xC +#define SFF8024_DEVICE_ID_QSFP_PLUS 0xD +#define SFF8024_DEVICE_ID_QSFP28 0x11 + +#define SFF8472_DIAG_MON_TYPE_ADDR 92 +#define SFF8472_DIAG_MON_TYPE_DDM_MASK 0x40 +#define SFF8472_10G_ETH_COMPLIANCE_ADDR 0x3 +#define SFF8472_10G_BASE_MASK 0xF0 + +#define SFF8436_RX_LOS_ADDR 3 +#define SFF8436_TX_FAULT_ADDR 4 +#define SFF8436_TX_DISABLE_ADDR 86 + + +#define ADDR_REG_SFP_STATUS_ADDR 0X62 //reg addr +R/W# //1031 +#define ADDR_REG_SFP_STATUS_TX 0X63 // write data +#define ADDR_REG_SFP_STATUS_RX 0X64 //read data +#define ADDR_REG_SFP_STATUS_COMMAND 0X65 //cmd bit7=1,go +#define ADDR_REG_SFP_STATUS_STATUS 0X66 //status + + + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t show_present(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count); +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, const char *buf, size_t count);; +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, char *buf); +static ssize_t sfp_eeprom_read(struct i2c_client *, u8, u8 *,int); +static ssize_t sfp_eeprom_write(struct i2c_client *, u8 , const char *,int); +extern int cig_cpld_read_register(u8 reg_off, u8 *val); +extern int cig_cpld_write_register(u8 reg_off, u8 val); + + +enum sfp_sysfs_attributes { + PRESENT, + PRESENT_ALL, + PORT_NUMBER, + PORT_TYPE, + DDM_IMPLEMENTED, + TX_FAULT, + TX_FAULT1, + TX_FAULT2, + TX_FAULT3, + TX_FAULT4, + TX_DISABLE, + TX_DISABLE1, + TX_DISABLE2, + TX_DISABLE3, + TX_DISABLE4, + RX_LOS, + RX_LOS1, + RX_LOS2, + RX_LOS3, + RX_LOS4, + RX_LOS_ALL +}; + +/* SFP/QSFP common attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_port_number, S_IRUGO, show_port_number, NULL, PORT_NUMBER); +static SENSOR_DEVICE_ATTR(sfp_port_type, S_IRUGO, show_port_type, NULL, PORT_TYPE); +static SENSOR_DEVICE_ATTR(sfp_is_present, S_IRUGO, show_present, NULL, PRESENT); +static SENSOR_DEVICE_ATTR(sfp_is_present_all, S_IRUGO, show_present, NULL, PRESENT_ALL); +static SENSOR_DEVICE_ATTR(sfp_rx_los, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS); +static SENSOR_DEVICE_ATTR(sfp_tx_disable, S_IWUSR | S_IRUGO, sfp_show_tx_rx_status, sfp_set_tx_disable, TX_DISABLE); +static SENSOR_DEVICE_ATTR(sfp_tx_fault, S_IRUGO, sfp_show_tx_rx_status, NULL, TX_FAULT); + +/* QSFP attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_rx_los1, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS1); +static SENSOR_DEVICE_ATTR(sfp_rx_los2, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS2); +static SENSOR_DEVICE_ATTR(sfp_rx_los3, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS3); +static SENSOR_DEVICE_ATTR(sfp_rx_los4, S_IRUGO, qsfp_show_tx_rx_status, NULL, RX_LOS4); +static SENSOR_DEVICE_ATTR(sfp_tx_disable1, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE1); +static SENSOR_DEVICE_ATTR(sfp_tx_disable2, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE2); +static SENSOR_DEVICE_ATTR(sfp_tx_disable3, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE3); +static SENSOR_DEVICE_ATTR(sfp_tx_disable4, S_IWUSR | S_IRUGO, qsfp_show_tx_rx_status, qsfp_set_tx_disable, TX_DISABLE4); +static SENSOR_DEVICE_ATTR(sfp_tx_fault1, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT1); +static SENSOR_DEVICE_ATTR(sfp_tx_fault2, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT2); +static SENSOR_DEVICE_ATTR(sfp_tx_fault3, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT3); +static SENSOR_DEVICE_ATTR(sfp_tx_fault4, S_IRUGO, qsfp_show_tx_rx_status, NULL, TX_FAULT4); +static struct attribute *qsfp_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los1.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los2.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los3.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable4.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault1.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault2.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault3.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault4.dev_attr.attr, + NULL +}; + +/* SFP msa attributes for sysfs */ +static SENSOR_DEVICE_ATTR(sfp_ddm_implemented, S_IRUGO, sfp_show_ddm_implemented, NULL, DDM_IMPLEMENTED); +static SENSOR_DEVICE_ATTR(sfp_rx_los_all, S_IRUGO, sfp_show_tx_rx_status, NULL, RX_LOS_ALL); +static struct attribute *sfp_msa_attributes[] = { + &sensor_dev_attr_sfp_port_number.dev_attr.attr, + &sensor_dev_attr_sfp_port_type.dev_attr.attr, + &sensor_dev_attr_sfp_is_present.dev_attr.attr, + &sensor_dev_attr_sfp_is_present_all.dev_attr.attr, + &sensor_dev_attr_sfp_ddm_implemented.dev_attr.attr, + &sensor_dev_attr_sfp_tx_fault.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los.dev_attr.attr, + &sensor_dev_attr_sfp_rx_los_all.dev_attr.attr, + &sensor_dev_attr_sfp_tx_disable.dev_attr.attr, + NULL +}; + +/* SFP ddm attributes for sysfs */ +static struct attribute *sfp_ddm_attributes[] = { + NULL +}; + +/* Platform dependent +++ */ +#define CPLD_PORT_TO_FRONT_PORT(port) (port+1) + +enum port_numbers { +cs6436_56p_sfp1, cs6436_56p_sfp2, cs6436_56p_sfp3, cs6436_56p_sfp4, +cs6436_56p_sfp5, cs6436_56p_sfp6, cs6436_56p_sfp7, cs6436_56p_sfp8, +cs6436_56p_sfp9, cs6436_56p_sfp10, cs6436_56p_sfp11, cs6436_56p_sfp12, +cs6436_56p_sfp13, cs6436_56p_sfp14, cs6436_56p_sfp15, cs6436_56p_sfp16, +cs6436_56p_sfp17, cs6436_56p_sfp18, cs6436_56p_sfp19, cs6436_56p_sfp20, +cs6436_56p_sfp21, cs6436_56p_sfp22, cs6436_56p_sfp23, cs6436_56p_sfp24, +cs6436_56p_sfp25, cs6436_56p_sfp26, cs6436_56p_sfp27, cs6436_56p_sfp28, +cs6436_56p_sfp29, cs6436_56p_sfp30, cs6436_56p_sfp31, cs6436_56p_sfp32, +cs6436_56p_sfp33, cs6436_56p_sfp34, cs6436_56p_sfp35, cs6436_56p_sfp36, +cs6436_56p_sfp37, cs6436_56p_sfp38, cs6436_56p_sfp39, cs6436_56p_sfp40, +cs6436_56p_sfp41, cs6436_56p_sfp42, cs6436_56p_sfp43, cs6436_56p_sfp44, +cs6436_56p_sfp45, cs6436_56p_sfp46, cs6436_56p_sfp47, cs6436_56p_sfp48, +cs6436_56p_sfp49, cs6436_56p_sfp50, cs6436_56p_sfp51, cs6436_56p_sfp52, +cs6436_56p_sfp53, cs6436_56p_sfp54, cs6436_56p_sfp55, cs6436_56p_sfp56 +}; + +#define I2C_DEV_ID(x) { #x, x} + +static const struct i2c_device_id sfp_device_id[] = { +I2C_DEV_ID(cs6436_56p_sfp1), +I2C_DEV_ID(cs6436_56p_sfp2), +I2C_DEV_ID(cs6436_56p_sfp3), +I2C_DEV_ID(cs6436_56p_sfp4), +I2C_DEV_ID(cs6436_56p_sfp5), +I2C_DEV_ID(cs6436_56p_sfp6), +I2C_DEV_ID(cs6436_56p_sfp7), +I2C_DEV_ID(cs6436_56p_sfp8), +I2C_DEV_ID(cs6436_56p_sfp9), +I2C_DEV_ID(cs6436_56p_sfp10), +I2C_DEV_ID(cs6436_56p_sfp11), +I2C_DEV_ID(cs6436_56p_sfp12), +I2C_DEV_ID(cs6436_56p_sfp13), +I2C_DEV_ID(cs6436_56p_sfp14), +I2C_DEV_ID(cs6436_56p_sfp15), +I2C_DEV_ID(cs6436_56p_sfp16), +I2C_DEV_ID(cs6436_56p_sfp17), +I2C_DEV_ID(cs6436_56p_sfp18), +I2C_DEV_ID(cs6436_56p_sfp19), +I2C_DEV_ID(cs6436_56p_sfp20), +I2C_DEV_ID(cs6436_56p_sfp21), +I2C_DEV_ID(cs6436_56p_sfp22), +I2C_DEV_ID(cs6436_56p_sfp23), +I2C_DEV_ID(cs6436_56p_sfp24), +I2C_DEV_ID(cs6436_56p_sfp25), +I2C_DEV_ID(cs6436_56p_sfp26), +I2C_DEV_ID(cs6436_56p_sfp27), +I2C_DEV_ID(cs6436_56p_sfp28), +I2C_DEV_ID(cs6436_56p_sfp29), +I2C_DEV_ID(cs6436_56p_sfp30), +I2C_DEV_ID(cs6436_56p_sfp31), +I2C_DEV_ID(cs6436_56p_sfp32), +I2C_DEV_ID(cs6436_56p_sfp33), +I2C_DEV_ID(cs6436_56p_sfp34), +I2C_DEV_ID(cs6436_56p_sfp35), +I2C_DEV_ID(cs6436_56p_sfp36), +I2C_DEV_ID(cs6436_56p_sfp37), +I2C_DEV_ID(cs6436_56p_sfp38), +I2C_DEV_ID(cs6436_56p_sfp39), +I2C_DEV_ID(cs6436_56p_sfp40), +I2C_DEV_ID(cs6436_56p_sfp41), +I2C_DEV_ID(cs6436_56p_sfp42), +I2C_DEV_ID(cs6436_56p_sfp43), +I2C_DEV_ID(cs6436_56p_sfp44), +I2C_DEV_ID(cs6436_56p_sfp45), +I2C_DEV_ID(cs6436_56p_sfp46), +I2C_DEV_ID(cs6436_56p_sfp47), +I2C_DEV_ID(cs6436_56p_sfp48), +I2C_DEV_ID(cs6436_56p_sfp49), +I2C_DEV_ID(cs6436_56p_sfp50), +I2C_DEV_ID(cs6436_56p_sfp51), +I2C_DEV_ID(cs6436_56p_sfp52), +I2C_DEV_ID(cs6436_56p_sfp53), +I2C_DEV_ID(cs6436_56p_sfp54), +I2C_DEV_ID(cs6436_56p_sfp55), +I2C_DEV_ID(cs6436_56p_sfp56), +{ /* LIST END */ } +}; +MODULE_DEVICE_TABLE(i2c, sfp_device_id); + +/* + * list of valid port types + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ +typedef enum oom_driver_port_type_e { + OOM_DRIVER_PORT_TYPE_INVALID, + OOM_DRIVER_PORT_TYPE_NOT_PRESENT, + OOM_DRIVER_PORT_TYPE_SFP, + OOM_DRIVER_PORT_TYPE_SFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP, + OOM_DRIVER_PORT_TYPE_QSFP_PLUS, + OOM_DRIVER_PORT_TYPE_QSFP28 +} oom_driver_port_type_t; + +enum driver_type_e { + DRIVER_TYPE_SFP_MSA, + DRIVER_TYPE_SFP_DDM, + DRIVER_TYPE_QSFP +}; + +/* Each client has this additional data + */ +struct eeprom_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + struct bin_attribute bin; /* eeprom data */ +}; + +struct sfp_msa_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u64 status[6]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss + 3 => device id + 4 => 10G Ethernet Compliance Codes + to distinguish SFP or SFP+ + 5 => DIAGNOSTIC MONITORING TYPE */ + struct eeprom_data eeprom; +}; + +struct sfp_ddm_data { + struct eeprom_data eeprom; +}; + +struct qsfp_data { + char valid; /* !=0 if registers are valid */ + unsigned long last_updated; /* In jiffies */ + u8 status[3]; /* bit0:port0, bit1:port1 and so on */ + /* index 0 => tx_fail + 1 => tx_disable + 2 => rx_loss */ + + u8 device_id; + struct eeprom_data eeprom; +}; + +struct sfp_port_data { + struct mutex update_lock; + enum driver_type_e driver_type; + int port; /* CPLD port index */ + oom_driver_port_type_t port_type; + u64 present; /* present status, bit0:port0, bit1:port1 and so on */ + + struct sfp_msa_data *msa; + struct sfp_ddm_data *ddm; + struct qsfp_data *qsfp; + + struct i2c_client *client; +}; + +static ssize_t show_port_number(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + return sprintf(buf, "%d\n", CPLD_PORT_TO_FRONT_PORT(data->port)); +} + +#define WAIT_TIME_OUT_COUNT 100 + +static int cig_cpld_write_sfp_register(u8 sfp_reg_addr, u8 sfp_write_reg_data) +{ + u8 sfp_read_status = 0; + u8 wait_time_out = WAIT_TIME_OUT_COUNT; + + cig_cpld_write_register(ADDR_REG_SFP_STATUS_ADDR, sfp_reg_addr << 1); + cig_cpld_write_register(ADDR_REG_SFP_STATUS_TX, sfp_write_reg_data); + cig_cpld_write_register(ADDR_REG_SFP_STATUS_COMMAND, 0x80); + do{ + cig_cpld_read_register(ADDR_REG_SFP_STATUS_STATUS, &sfp_read_status); + udelay(60); + wait_time_out--; + if(wait_time_out == 0) + break; + }while(sfp_read_status != 0x02); + + if(wait_time_out == 0) + return -1; + + return 1; +} + + +static int cig_cpld_read_sfp_register(u8 sfp_reg_addr, u8 *sfp_read_reg_data) +{ + u8 sfp_read_status = 0; + u8 wait_time_out = WAIT_TIME_OUT_COUNT; + + cig_cpld_write_register(ADDR_REG_SFP_STATUS_ADDR, sfp_reg_addr << 1 | 1); + cig_cpld_write_register(ADDR_REG_SFP_STATUS_COMMAND, 0x80); + do{ + udelay(60); + cig_cpld_read_register(ADDR_REG_SFP_STATUS_STATUS, &sfp_read_status); + wait_time_out--; + if(wait_time_out == 0) + break; + }while(sfp_read_status != 0x01); + + cig_cpld_read_register(ADDR_REG_SFP_STATUS_RX,sfp_read_reg_data); + + if(wait_time_out == 0) + return -1; + + return 1; +} + + + + + + +/* Platform dependent +++ */ +static struct sfp_port_data *sfp_update_present(struct i2c_client *client) +{ + int i = 0, j = 0, status = -1; + unsigned char cpld_reg_data = 0,cpld_reg_addr = 0; + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT("Starting sfp present status update"); + mutex_lock(&data->update_lock); + data->present = 0; + + udelay(6000); + + /* Read present status of port 1~48(SFP port) */ + for (i = 0; i < 6; i++) { + cpld_reg_addr = 1 + i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->present |= (u64)cpld_reg_data << (i*8); + + DEBUG_PRINT("Present status = 0x%lx\r\n", data->present); + } + + /* Read present status of port 49-56(QSFP port) */ + cpld_reg_addr = 25; + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + else { + data->present |= (u64)cpld_reg_data << 48; + } + + DEBUG_PRINT("Present status = 0x%lx", data->present); +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static struct sfp_port_data *sfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i = 0, j = 0; + int status = -1; + unsigned char cpld_reg_data = 0,cpld_reg_addr = 0; + + if (time_before(jiffies, data->msa->last_updated + HZ + HZ / 2) && data->msa->valid) { + return data; + } + + DEBUG_PRINT("Starting cs6436_56p sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->msa->valid = 0; + memset(data->msa->status, 0, sizeof(data->msa->status)); + + udelay(6000); + + /* Read status of port 1~48(SFP port) */ + for (i = 0; i < 6; i++) { + cpld_reg_addr = 13+i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->msa->status[0] |= (u64)cpld_reg_data << (i * 8); + + DEBUG_PRINT("tx rx status[0] = 0x%lx\r\n", data->msa->status[0]); + } + + + for (i = 0; i < 6; i++) { + cpld_reg_addr = 19+i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->msa->status[1] |= (u64)cpld_reg_data << (i * 8); + + DEBUG_PRINT("tx rx status[1] = 0x%lx\r\n", data->msa->status[1]); + } + + for (i = 0; i < 6; i++) { + cpld_reg_addr = 7+i; + + status = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "cpld(0x%x) reg(0x%x) err %d\n", cpld_reg_addr, cpld_reg_data, status); + goto exit; + } + + data->msa->status[2] |= (u64)cpld_reg_data << (i * 8); + + DEBUG_PRINT("tx rx status[2] = 0x%lx\r\n", data->msa->status[2]); + } + + data->msa->valid = 1; + data->msa->last_updated = jiffies; + +exit: + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t sfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + unsigned char cpld_reg_data = 0,cpld_reg_addr = 0,cpld_reg_bit = 0,cpld_reg_val = 0; + long disable; + int error; + + if (data->driver_type == DRIVER_TYPE_QSFP) { + return qsfp_set_tx_disable(dev, da, buf, count); + } + + error = kstrtol(buf, 10, &disable); + if (error) { + return error; + } + + mutex_lock(&data->update_lock); + + udelay(6000); + + if(data->port <= 48) { + cpld_reg_addr = 19 + data->port / 8; + cpld_reg_bit = 1 << (data->port); + } + + /* Read current status */ + error = cig_cpld_read_sfp_register(cpld_reg_addr, &cpld_reg_data); + + /* Update tx_disable status */ + if (disable) { + data->msa->status[1] |= BIT_INDEX(data->port); + cpld_reg_data |= cpld_reg_bit; + } + else { + data->msa->status[1] &= ~BIT_INDEX(data->port); + cpld_reg_data &= ~cpld_reg_bit; + } + + error = cig_cpld_write_sfp_register(cpld_reg_addr,cpld_reg_data); + + mutex_unlock(&data->update_lock); + return count; +} +/* Platform dependent --- */ + +static int sfp_is_port_present(struct i2c_client *client, int port) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + data = sfp_update_present(client); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + return !(data->present & BIT_INDEX(data->port)); /* Platform dependent */ +} + +/* Platform dependent +++ */ +static ssize_t show_present(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + + if (PRESENT_ALL == attr->index) { + int i; + u8 values[7] = {0}; + struct sfp_port_data *data = sfp_update_present(client); + + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = ~(u8)(data->present >> (i * 8)); + } + + /* Return values 1 -> 56 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5], + values[6]); + } + else { + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + /* PRESENT */ + return sprintf(buf, "%d\n", present); + } +} +/* Platform dependent --- */ + +static struct sfp_port_data *sfp_update_port_type(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + u8 buf = 0; + int status; + + mutex_lock(&data->update_lock); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + { + status = sfp_eeprom_read(client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + if (buf != SFF8024_DEVICE_ID_SFP) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + status = sfp_eeprom_read(client, SFF8472_10G_ETH_COMPLIANCE_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("sfp port type (0x3) data = (0x%x)", buf); + data->port_type = buf & SFF8472_10G_BASE_MASK ? OOM_DRIVER_PORT_TYPE_SFP_PLUS : OOM_DRIVER_PORT_TYPE_SFP; + break; + } + case DRIVER_TYPE_QSFP: + { + status = sfp_eeprom_read(client, SFF8024_PHYSICAL_DEVICE_ID_ADDR, &buf, sizeof(buf)); + if (unlikely(status < 0)) { + data->port_type = OOM_DRIVER_PORT_TYPE_INVALID; + break; + } + + DEBUG_PRINT("qsfp port type (0x0) buf = (0x%x)", buf); + switch (buf) { + case SFF8024_DEVICE_ID_QSFP: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP; + break; + case SFF8024_DEVICE_ID_QSFP_PLUS: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + case SFF8024_DEVICE_ID_QSFP28: + data->port_type = OOM_DRIVER_PORT_TYPE_QSFP_PLUS; + break; + default: + data->port_type = buf; + break; + } + + break; + } + default: + break; + } + + mutex_unlock(&data->update_lock); + return data; +} + +static ssize_t show_port_type(struct device *dev, struct device_attribute *da, + char *buf) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int present = sfp_is_port_present(client, data->port); + + if (IS_ERR_VALUE(present)) { + return present; + } + + if (!present) { + /* port is not present */ + return sprintf(buf, "%d\n", OOM_DRIVER_PORT_TYPE_NOT_PRESENT); + } + + sfp_update_port_type(dev); + return sprintf(buf, "%d\n", data->port_type); +} + +static struct sfp_port_data *qsfp_update_tx_rx_status(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + int i, status = -1; + u8 buf = 0; + u8 reg[] = {SFF8436_TX_FAULT_ADDR, SFF8436_TX_DISABLE_ADDR, SFF8436_RX_LOS_ADDR}; + + DEBUG_PRINT(""); + if (time_before(jiffies, data->qsfp->last_updated + HZ + HZ / 2) && data->qsfp->valid) { + return data; + } + + DEBUG_PRINT("Starting sfp tx rx status update"); + mutex_lock(&data->update_lock); + data->qsfp->valid = 0; + memset(data->qsfp->status, 0, sizeof(data->qsfp->status)); + + DEBUG_PRINT(""); + /* Notify device to update tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + DEBUG_PRINT(""); + goto exit; + } + } + msleep(200); + DEBUG_PRINT(""); + + /* Read actual tx fault/ tx disable/ rx los status */ + for (i = 0; i < ARRAY_SIZE(reg); i++) { + status = sfp_eeprom_read(client, reg[i], &buf, sizeof(buf)); + if (unlikely(status < 0)) { + DEBUG_PRINT(""); + goto exit; + } + + DEBUG_PRINT("qsfp reg(0x%x) status = (0x%x)", reg[i], data->qsfp->status[i]); + data->qsfp->status[i] = (buf & 0xF); + } + + DEBUG_PRINT(""); + data->qsfp->valid = 1; + data->qsfp->last_updated = jiffies; + +exit: + DEBUG_PRINT(""); + mutex_unlock(&data->update_lock); + return (status < 0) ? ERR_PTR(status) : data; +} + +static ssize_t qsfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + int present; + u8 val = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT(""); + present = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + DEBUG_PRINT(""); + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + DEBUG_PRINT(""); + data = qsfp_update_tx_rx_status(dev); + DEBUG_PRINT(""); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + DEBUG_PRINT(""); + switch (attr->index) { + case TX_FAULT: + val = !!(data->qsfp->status[2] & 0xF); + break; + case TX_FAULT1: + case TX_FAULT2: + case TX_FAULT3: + case TX_FAULT4: + val = !!(data->qsfp->status[2] & BIT_INDEX(attr->index - TX_FAULT1)); + break; + case TX_DISABLE: + val = data->qsfp->status[1] & 0xF; + break; + case TX_DISABLE1: + case TX_DISABLE2: + case TX_DISABLE3: + case TX_DISABLE4: + val = !!(data->qsfp->status[1] & BIT_INDEX(attr->index - TX_DISABLE1)); + break; + case RX_LOS: + val = !!(data->qsfp->status[0] & 0xF); + break; + case RX_LOS1: + case RX_LOS2: + case RX_LOS3: + case RX_LOS4: + val = !!(data->qsfp->status[0] & BIT_INDEX(attr->index - RX_LOS1)); + break; + default: + break; + } + + DEBUG_PRINT(""); + return sprintf(buf, "%d\n", val); +} + +static ssize_t qsfp_set_tx_disable(struct device *dev, struct device_attribute *da, + const char *buf, size_t count) +{ + long disable; + int status; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (!status) { + /* port is not present */ + return -ENXIO; + } + + status = kstrtol(buf, 10, &disable); + if (status) { + return status; + } + + data = qsfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + mutex_lock(&data->update_lock); + + if (attr->index == TX_DISABLE) { + data->qsfp->status[1] = disable & 0xF; + } + else {/* TX_DISABLE1 ~ TX_DISABLE4*/ + if (disable) { + data->qsfp->status[1] |= (1 << (attr->index - TX_DISABLE1)); + } + else { + data->qsfp->status[1] &= ~(1 << (attr->index - TX_DISABLE1)); + } + } + + DEBUG_PRINT("index = (%d), status = (0x%x)", attr->index, data->qsfp->status[1]); + status = sfp_eeprom_write(data->client, SFF8436_TX_DISABLE_ADDR, &data->qsfp->status[1], sizeof(data->qsfp->status[1])); + if (unlikely(status < 0)) { + count = status; + } + + mutex_unlock(&data->update_lock); + return count; +} + +static ssize_t sfp_show_ddm_implemented(struct device *dev, struct device_attribute *da, + char *buf) +{ + int status; + char ddm; + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + status = sfp_is_port_present(client, data->port); + if (IS_ERR_VALUE(status)) { + return status; + } + + if (status == 0) { + /* port is not present */ + return -ENODEV; + } + + status = sfp_eeprom_read(client, SFF8472_DIAG_MON_TYPE_ADDR, &ddm, sizeof(ddm)); + if (unlikely(status < 0)) { + return status; + } + + return sprintf(buf, "%d\n", !!(ddm & SFF8472_DIAG_MON_TYPE_DDM_MASK)); +} + +/* Platform dependent +++ */ +static ssize_t sfp_show_tx_rx_status(struct device *dev, struct device_attribute *da, + char *buf) +{ + u8 val = 0, index = 0; + struct sensor_device_attribute *attr = to_sensor_dev_attr(da); + struct i2c_client *client = to_i2c_client(dev); + struct sfp_port_data *data = i2c_get_clientdata(client); + + DEBUG_PRINT("driver type = (%d)", data->driver_type); + if (data->driver_type == DRIVER_TYPE_QSFP) { + DEBUG_PRINT(""); + return qsfp_show_tx_rx_status(dev, da, buf); + } + + DEBUG_PRINT(""); + data = sfp_update_tx_rx_status(dev); + if (IS_ERR(data)) { + return PTR_ERR(data); + } + + if(attr->index == RX_LOS_ALL) { + int i = 0; + u8 values[6] = {0}; + + for (i = 0; i < ARRAY_SIZE(values); i++) { + values[i] = (u8)(data->msa->status[2] >> (i * 8)); + } + + /** Return values 1 -> 48 in order */ + return sprintf(buf, "%.2x %.2x %.2x %.2x %.2x %.2x\n", + values[0], values[1], values[2], + values[3], values[4], values[5]); + } + + switch (attr->index) { + case TX_FAULT: + index = 0; + break; + case TX_DISABLE: + index = 1; + break; + case RX_LOS: + index = 2; + break; + default: + break; + } + + val = !!(data->msa->status[index] & BIT_INDEX(data->port)); + return sprintf(buf, "%d\n", val); +} +/* Platform dependent --- */ +static ssize_t sfp_eeprom_write(struct i2c_client *client, u8 command, const char *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_write_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return data_len; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_write_byte_data(client, command, *data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + return status; + } + + return 1; +#endif + + +} + +static ssize_t sfp_port_write(struct sfp_port_data *data, + const char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + return count; + } + + /* + * Write data to chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_write(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; +} + + +static ssize_t sfp_bin_write(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("%s(%d) offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + return sfp_port_write(data, buf, off, count); +} + +static ssize_t sfp_eeprom_read(struct i2c_client *client, u8 command, u8 *data, + int data_len) +{ +#if USE_I2C_BLOCK_READ + int status, retry = I2C_RW_RETRY_COUNT; + + if (data_len > I2C_SMBUS_BLOCK_MAX) { + data_len = I2C_SMBUS_BLOCK_MAX; + } + + while (retry) { + status = i2c_smbus_read_i2c_block_data(client, command, data_len, data); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + goto abort; + } + if (unlikely(status != data_len)) { + status = -EIO; + goto abort; + } + + //result = data_len; + +abort: + return status; +#else + int status, retry = I2C_RW_RETRY_COUNT; + + while (retry) { + status = i2c_smbus_read_byte_data(client, command); + if (unlikely(status < 0)) { + msleep(I2C_RW_RETRY_INTERVAL); + retry--; + continue; + } + + break; + } + + if (unlikely(status < 0)) { + dev_dbg(&client->dev, "sfp read byte data failed, command(0x%2x), data(0x%2x)\r\n", command, status); + goto abort; + } + + *data = (u8)status; + status = 1; + +abort: + return status; +#endif +} + +static ssize_t sfp_port_read(struct sfp_port_data *data, + char *buf, loff_t off, size_t count) +{ + ssize_t retval = 0; + + if (unlikely(!count)) { + DEBUG_PRINT("Count = 0, return"); + return count; + } + + /* + * Read data from chip, protecting against concurrent updates + * from this host, but not from other I2C masters. + */ + mutex_lock(&data->update_lock); + + while (count) { + ssize_t status; + + status = sfp_eeprom_read(data->client, off, buf, count); + if (status <= 0) { + if (retval == 0) { + retval = status; + } + break; + } + + buf += status; + off += status; + count -= status; + retval += status; + } + + mutex_unlock(&data->update_lock); + return retval; + +} + +static ssize_t sfp_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, + char *buf, loff_t off, size_t count) +{ + int present; + struct sfp_port_data *data; + DEBUG_PRINT("offset = (%d), count = (%d)", off, count); + data = dev_get_drvdata(container_of(kobj, struct device, kobj)); + + present = sfp_is_port_present(data->client, data->port); + if (IS_ERR_VALUE(present)) { + return present; + } + + if (present == 0) { + /* port is not present */ + return -ENODEV; + } + + return sfp_port_read(data, buf, off, count); +} + +static int sfp_sysfs_eeprom_init(struct kobject *kobj, struct bin_attribute *eeprom) +{ + int err; + + sysfs_bin_attr_init(eeprom); + eeprom->attr.name = EEPROM_NAME; + eeprom->attr.mode = S_IWUSR | S_IRUGO; + eeprom->read = sfp_bin_read; + eeprom->write = sfp_bin_write; + eeprom->size = EEPROM_SIZE; + + /* Create eeprom file */ + err = sysfs_create_bin_file(kobj, eeprom); + if (err) { + return err; + } + + return 0; +} + +static int sfp_sysfs_eeprom_cleanup(struct kobject *kobj, struct bin_attribute *eeprom) +{ + sysfs_remove_bin_file(kobj, eeprom); + return 0; +} + +static const struct attribute_group sfp_msa_group = { + .attrs = sfp_msa_attributes, +}; + +static int sfp_i2c_check_functionality(struct i2c_client *client) +{ +#if USE_I2C_BLOCK_READ + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK); +#else + return i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA); +#endif +} + +static int sfp_msa_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_msa_data **data) +{ + int status; + struct sfp_msa_data *msa; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + msa = kzalloc(sizeof(struct sfp_msa_data), GFP_KERNEL); + if (!msa) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_msa_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &msa->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = msa; + dev_info(&client->dev, "sfp msa '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); +exit_free: + kfree(msa); +exit: + + return status; +} + +static const struct attribute_group sfp_ddm_group = { + .attrs = sfp_ddm_attributes, +}; + +static int sfp_ddm_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct sfp_ddm_data **data) +{ + int status; + struct sfp_ddm_data *ddm; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + ddm = kzalloc(sizeof(struct sfp_ddm_data), GFP_KERNEL); + if (!ddm) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &sfp_ddm_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &ddm->eeprom.bin); + if (status) { + goto exit_remove; + } + + *data = ddm; + dev_info(&client->dev, "sfp ddm '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); +exit_free: + kfree(ddm); +exit: + + return status; +} + +static const struct attribute_group qsfp_group = { + .attrs = qsfp_attributes, +}; + +static int qsfp_probe(struct i2c_client *client, const struct i2c_device_id *dev_id, + struct qsfp_data **data) +{ + int status; + struct qsfp_data *qsfp; + + if (!sfp_i2c_check_functionality(client)) { + status = -EIO; + goto exit; + } + + qsfp = kzalloc(sizeof(struct qsfp_data), GFP_KERNEL); + if (!qsfp) { + status = -ENOMEM; + goto exit; + } + + /* Register sysfs hooks */ + status = sysfs_create_group(&client->dev.kobj, &qsfp_group); + if (status) { + goto exit_free; + } + + /* init eeprom */ + status = sfp_sysfs_eeprom_init(&client->dev.kobj, &qsfp->eeprom.bin); + if (status) { + goto exit_remove; + } + + /* Bring QSFPs out of reset */ + //cig_lpc_write(0x62, 0x15, 0x3F); + + *data = qsfp; + dev_info(&client->dev, "qsfp '%s'\n", client->name); + + return 0; + +exit_remove: + sysfs_remove_group(&client->dev.kobj, &qsfp_group); +exit_free: + kfree(qsfp); +exit: + + return status; +} + +/* Platform dependent +++ */ +static int sfp_device_probe(struct i2c_client *client, + const struct i2c_device_id *dev_id) +{ + struct sfp_port_data *data = NULL; + + data = kzalloc(sizeof(struct sfp_port_data), GFP_KERNEL); + if (!data) { + return -ENOMEM; + } + + i2c_set_clientdata(client, data); + mutex_init(&data->update_lock); + data->port = dev_id->driver_data; + data->client = client; + + if (dev_id->driver_data >= cs6436_56p_sfp1 && dev_id->driver_data <= cs6436_56p_sfp48) { + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_SFP_MSA; + return sfp_msa_probe(client, dev_id, &data->msa); + } + else if (client->addr == SFP_EEPROM_A2_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_SFP_DDM; + return sfp_ddm_probe(client, dev_id, &data->ddm); + } + } + else { /* cs6436_56p_sfp49 ~ cs6436_56p_sfp56 */ + if (client->addr == SFP_EEPROM_A0_I2C_ADDR) { + data->driver_type = DRIVER_TYPE_QSFP; + return qsfp_probe(client, dev_id, &data->qsfp); + } + } + + return -ENODEV; +} +/* Platform dependent --- */ + +static int sfp_msa_remove(struct i2c_client *client, struct sfp_msa_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_msa_group); + kfree(data); + return 0; +} + +static int sfp_ddm_remove(struct i2c_client *client, struct sfp_ddm_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &sfp_ddm_group); + kfree(data); + return 0; +} + +static int qfp_remove(struct i2c_client *client, struct qsfp_data *data) +{ + sfp_sysfs_eeprom_cleanup(&client->dev.kobj, &data->eeprom.bin); + sysfs_remove_group(&client->dev.kobj, &qsfp_group); + kfree(data); + return 0; +} + +static int sfp_device_remove(struct i2c_client *client) +{ + struct sfp_port_data *data = i2c_get_clientdata(client); + + switch (data->driver_type) { + case DRIVER_TYPE_SFP_MSA: + return sfp_msa_remove(client, data->msa); + case DRIVER_TYPE_SFP_DDM: + return sfp_ddm_remove(client, data->ddm); + case DRIVER_TYPE_QSFP: + return qfp_remove(client, data->qsfp); + } + + return 0; +} + +/* Addresses scanned + */ +static const unsigned short normal_i2c[] = { I2C_CLIENT_END }; + +static struct i2c_driver cs6436_56p_sfp_driver = { + .driver = { + .name = DRIVER_NAME, + }, + .probe = sfp_device_probe, + .remove = sfp_device_remove, + .id_table = sfp_device_id, + .address_list = normal_i2c, +}; + +module_i2c_driver(cs6436_56p_sfp_driver); + + +MODULE_AUTHOR("Zhang Peng "); +MODULE_DESCRIPTION("cs6436_56p_sfp driver"); +MODULE_LICENSE("GPL"); + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-init.service b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-init.service new file mode 100755 index 000000000000..3936b54dee2f --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-init.service @@ -0,0 +1,13 @@ +[Unit] +Description=Cig CS6436-56P Platform initialization service +Before=pmon.service +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/cig_cs6436_util.py install +ExecStop=/usr/local/bin/cig_cs6436_util.py clean +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-misc.service b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-misc.service new file mode 100755 index 000000000000..7ff410cbb3c1 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/service/cs6436-platform-misc.service @@ -0,0 +1,15 @@ +[Unit] +Description=Cig CS6436-56P Platform miscellaneous service +After=cs6436-platform-init.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/local/bin/cig_cs6436_misc.py +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/setup.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/setup.py new file mode 100755 index 000000000000..c17c10c83190 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/setup.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import sys +from setuptools import setup +os.listdir + +setup( + name='cs6436-56p', + version='1.0.0', + description='Module to initialize Cig CS6436-56P platforms', + + packages=['cs6436-56p'], + package_dir={'cs6436-56p': 'cs6436-56p/classes'}, + ) diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py new file mode 100755 index 000000000000..a82a9cea5e26 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Cambridge, Inc. +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple +from threading import Thread + +DEBUG = False +i2c_prefix = '/sys/bus/i2c/devices/' +cs6436__prefix = '/sys/devices/platform/cs6436_56p_led/leds/' + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"4-005a", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"4-005b", 0) + ret3, log = log_os_system("ls "+cs6436__prefix+"cs6436_56p_led*", 0) + return not(ret1 or ret2 or ret3) + + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + + +def system_misc_polling(threadName,delay): + for count in range(1,5): + if device_exist() == False: + time.sleep(delay+3) + print "%s: %s, count=%d" % ( threadName, time.ctime(time.time()), count) + else: + break + + if count == 4: + return + + status, output = log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::sys/brightness", 1) + status, output = log_os_system("hwconfig -cfp 1", 1) + + while 1: + status, output = log_os_system("cat /sys/bus/i2c/devices/4-005a/psu_present", 1) + if status: + print "failed to check status for 4-005a/psu_present" + continue + + if output=='1': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu1/brightness", 1) + else: + log_os_system("echo 0 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu1/brightness", 1) + + status, output = log_os_system("cat /sys/bus/i2c/devices/4-005b/psu_present", 1) + if status: + print "failed to check status for 4-005b/psu_present" + continue + + if output=='1': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu2/brightness", 1) + else: + log_os_system("echo 0 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::psu2/brightness", 1) + + status, fan1 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan1_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan1_fault" + continue + + if fan1=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan1/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan1/brightness", 1) + + status, fan2 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan2_fault",1) + + if status: + print "failed to check status for cs6436_56p_fan/fan2_fault" + continue + + if fan2=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan2/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan2/brightness", 1) + + status, fan3 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan3_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan3_fault" + continue + + if fan3=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan3/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan3/brightness", 1) + + status, fan4 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan4_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan4_fault" + continue + + if fan4=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan4/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan4/brightness", 1) + + status, fan5 = log_os_system(" cat /sys/devices/platform/cs6436_56p_fan/fan5_fault",1) + if status: + print "failed to check status for cs6436_56p_fan/fan5_fault" + continue + + if fan5=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan5/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan5/brightness", 1) + + if fan1=='0' or fan2=='0' or fan3=='0' or fan4=='0' or fan5=='0': + log_os_system("echo 1 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan/brightness", 1) + else: + log_os_system("echo 3 > /sys/devices/platform/cs6436_56p_led/leds/cs6436_56p_led::fan/brightness", 1) + time.sleep(delay) + print "%s: %s" % ( threadName, time.ctime(time.time())) + return + +if __name__ == '__main__': + target=system_misc_polling("Thread-misc",3) + + + + diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_util.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_util.py new file mode 100755 index 000000000000..b36f44b557c3 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_util.py @@ -0,0 +1,536 @@ +#!/usr/bin/env python +# +# Copyright (C) 2018 Cambridge, Inc. +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +Usage: %(scriptName)s [options] command object + +options: + -h | --help : this help message + -d | --debug : run with debug mode + -f | --force : ignore error during installation or clean +command: + install : install drivers and generate related sysfs nodes + clean : uninstall drivers and remove related sysfs nodes + show : show all systen status + sff : dump SFP eeprom + set : change board setting with fan|led|sfp +""" + +import os +import commands +import sys, getopt +import logging +import re +import time +from collections import namedtuple + + + + +PROJECT_NAME = 'cs6436_56p' +version = '0.1.0' +verbose = False +DEBUG = False +args = [] +ALL_DEVICE = {} +DEVICE_NO = {'led':9, 'fan':5, 'thermal':4, 'psu':2, 'sfp':56} +FORCE = 0 + +if DEBUG == True: + print sys.argv[0] + print 'ARGV :', sys.argv[1:] + + +def main(): + global DEBUG + global args + global FORCE + + if len(sys.argv)<2: + show_help() + + options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help', + 'debug', + 'force', + ]) + if DEBUG == True: + print options + print args + print len(sys.argv) + + for opt, arg in options: + if opt in ('-h', '--help'): + show_help() + elif opt in ('-d', '--debug'): + DEBUG = True + logging.basicConfig(level=logging.INFO) + elif opt in ('-f', '--force'): + FORCE = 1 + else: + logging.info('no option') + for arg in args: + if arg == 'install': + do_install() + elif arg == 'clean': + do_uninstall() + elif arg == 'show': + device_traversal() + elif arg == 'sff': + if len(args)!=2: + show_eeprom_help() + elif int(args[1]) ==0 or int(args[1]) > DEVICE_NO['sfp']: + show_eeprom_help() + else: + show_eeprom(args[1]) + return + elif arg == 'set': + if len(args)<3: + show_set_help() + else: + set_device(args[1:]) + return + else: + show_help() + + + return 0 + +def show_help(): + print __doc__ % {'scriptName' : sys.argv[0].split("/")[-1]} + sys.exit(0) + +def show_set_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print cmd +" [led|sfp|fan]" + print " use \""+ cmd + " led 0-4 \" to set led color" + print " use \""+ cmd + " fan 0-100\" to set fan duty percetage" + print " use \""+ cmd + " sfp 1-56 {0|1}\" to set sfp# tx_disable" + sys.exit(0) + +def show_eeprom_help(): + cmd = sys.argv[0].split("/")[-1]+ " " + args[0] + print " use \""+ cmd + " 1-56 \" to dump sfp# eeprom" + sys.exit(0) + +def my_log(txt): + if DEBUG == True: + print "[ROY]"+txt + return + +def log_os_system(cmd, show): + logging.info('Run :'+cmd) + status, output = commands.getstatusoutput(cmd) + my_log (cmd +"with result:" + str(status)) + my_log (" output:"+output) + if status: + logging.info('Failed :'+cmd) + if show: + print('Failed :'+cmd) + return status, output + +def driver_check(): + for count in range(1,5): + time.sleep(1) + ret, lsmod = log_os_system("lsmod| grep i2c_i801", 0) + if len(lsmod) > 2: + log_os_system("rmmod i2c_i801", 0) + break + + ret, lsmod = log_os_system("lsmod| grep i2c_designware_platform", 0) + if len(lsmod) > 2: + log_os_system("rmmod i2c_designware_platform", 0) + log_os_system("modprobe i2c-designware-platform", 0) + + ret, lsmod = log_os_system("lsmod| grep cig", 0) + logging.info('mods:'+lsmod) + if len(lsmod) ==0: + return False + return True + + + +kos = [ + 'depmod', + 'modprobe i2c_dev', + 'modprobe i2c_mux_pca954x force_deselect_on_exit=1', + 'modprobe x86-64-cig-cs6436-56p-cpld ' , + 'modprobe x86-64-cig-cs6436-56p-fan' , + 'modprobe x86-64-cig-cs6436-56p-psu' , + 'modprobe x86-64-cig-cs6436-56p-sfp' , + 'modprobe x86-64-cig-cs6436-56p-led' ] + +def driver_install(): + global FORCE + + for i in range(0,len(kos)): + if i == 3: + ret, board_type = log_os_system("cat /proc/cpuinfo | grep \"model name\" | cut -b 32-39 | head -n 1", 0) + if board_type=='i3-6100U': + kos[i] =kos[i] + 'board_id=1' + + status, output = log_os_system(kos[i], 1) + if status: + if FORCE == 0: + return status + return 0 + +def driver_uninstall(): + global FORCE + for i in range(0,len(kos)): + rm = kos[-(i+1)].replace("modprobe", "modprobe -rq") + rm = rm.replace("insmod", "rmmod") + status, output = log_os_system(rm, 1) + if status: + if FORCE == 0: + return status + return 0 + +led_prefix ='/sys/class/leds/'+PROJECT_NAME+'_led::' +hwmon_types = {'led': ['sys','fan','fan1','fan2','fan3','fan4','fan5','psu1','psu2']} +hwmon_nodes = {'led': ['brightness'] } +hwmon_prefix ={'led': led_prefix} + +i2c_prefix = '/sys/bus/i2c/devices/' +i2c_bus = {'thermal': ['3-0048','3-0049', '4-004a', '4-004b'] , + 'psu': ['4-005a','4-005b'], + 'sfp': ['-0050']} +i2c_nodes = {'thermal': ['hwmon/hwmon*/temp1_input'] , + 'psu': ['psu_present ', 'psu_power_good'] , + 'sfp': ['sfp_is_present ', 'sfp_tx_disable']} + +fan_prefix ='/sys/bus/platform/devices/'+PROJECT_NAME+'_fan' +fan_types = {'fan': ['fan1','fan2', 'fan3', 'fan4', 'fan5']} +fan_nodes = {'fan': ['state', 'front_speed_rpm', 'rear_speed_rpm', 'fault']} + + +sfp_map = [7,8,9,10,11,12,13,14,15,16, + 17,18,19,20,21,22,23,24,25,26, + 27,28,29,30,31,32,33,34,35,36, + 37,38,39,40,41,42,43,44,45,46, + 47,48,49,50,51,52,53,54,55,56, + 57,58,59,60,61,62] + +mknod =[ + 'echo pca9548 0x71 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x72 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x73 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x74 > /sys/bus/i2c/devices/i2c-1/new_device', + 'echo pca9548 0x75 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x76 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo pca9548 0x77 > /sys/bus/i2c/devices/i2c-2/new_device', + 'echo lm75 0x48 > /sys/bus/i2c/devices/i2c-3/new_device', + 'echo lm75 0x49 > /sys/bus/i2c/devices/i2c-3/new_device', + 'echo lm75 0x4a > /sys/bus/i2c/devices/i2c-4/new_device', + 'echo lm75 0x4b > /sys/bus/i2c/devices/i2c-4/new_device', + 'echo cs6436_56p_psu1 0x5a > /sys/bus/i2c/devices/i2c-4/new_device', + 'echo cs6436_56p_psu2 0x5b > /sys/bus/i2c/devices/i2c-4/new_device', + 'echo 24c128 0x57 > /sys/bus/i2c/devices/i2c-6/new_device'] + + +def device_install(): + global FORCE + + for i in range(0,len(mknod)): + #for pca954x need times to built new i2c buses + if mknod[i].find('pca954') != -1: + time.sleep(1) + + status, output = log_os_system(mknod[i], 1) + if status: + print output + if FORCE == 0: + return status + + for i in range(0,len(sfp_map)): + status, output =log_os_system("echo cs6436_56p_sfp"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + if i <= 47: + status, output =log_os_system("echo cs6436_56p_sfp"+str(i+1)+" 0x51 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1) + if status: + print output + if FORCE == 0: + return status + + return + +def device_uninstall(): + global FORCE + + for i in range(0,len(sfp_map)): + target = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/delete_device" + status, output =log_os_system("echo 0x50 > "+ target, 1) + if status: + print output + if FORCE == 0: + return status + + nodelist = mknod + + for i in range(len(nodelist)): + target = nodelist[-(i+1)] + temp = target.split() + del temp[1] + temp[-1] = temp[-1].replace('new_device', 'delete_device') + status, output = log_os_system(" ".join(temp), 1) + if status: + print output + if FORCE == 0: + return status + + return + +def system_ready(): + if driver_check() == False: + return False + if not device_exist(): + return False + return True + +def do_install(): + print "Checking system...." + if driver_check() == False: + print "No driver, installing...." + status = driver_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" drivers detected...." + if not device_exist(): + print "No device, installing...." + status = device_install() + if status: + if FORCE == 0: + return status + else: + print PROJECT_NAME.upper()+" devices detected...." + return + +def do_uninstall(): + print "Checking system...." + if not device_exist(): + print PROJECT_NAME.upper() +" has no device installed...." + else: + print "Removing device...." + status = device_uninstall() + if status: + if FORCE == 0: + return status + + if driver_check()== False : + print PROJECT_NAME.upper() +" has no driver installed...." + else: + print "Removing installed driver...." + status = driver_uninstall() + if status: + if FORCE == 0: + return status + + return + +def devices_info(): + global DEVICE_NO + global ALL_DEVICE + global i2c_bus, hwmon_types, fan_types + for key in DEVICE_NO: + ALL_DEVICE[key]= {} + for i in range(0,DEVICE_NO[key]): + ALL_DEVICE[key][key+str(i+1)] = [] + + for key in i2c_bus: + buses = i2c_bus[key] + nodes = i2c_nodes[key] + for i in range(0,len(buses)): + for j in range(0,len(nodes)): + if 'sfp' == key: + for k in range(0,DEVICE_NO[key]): + node = key+str(k+1) + path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + else: + node = key+str(i+1) + path = i2c_prefix+ buses[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][node].append(path) + + for key in hwmon_types: + itypes = hwmon_types[key] + nodes = hwmon_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = hwmon_prefix[key]+ itypes[i]+"/"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + for key in fan_types: + itypes = fan_types[key] + nodes = fan_nodes[key] + for i in range(0,len(itypes)): + for j in range(0,len(nodes)): + node = key+"_"+itypes[i] + path = fan_prefix+"/"+ itypes[i]+"_"+ nodes[j] + my_log(node+": "+ path) + ALL_DEVICE[key][ key+str(i+1)].append(path) + + #show dict all in the order + if DEBUG == True: + for i in sorted(ALL_DEVICE.keys()): + print(i+": ") + for j in sorted(ALL_DEVICE[i].keys()): + print(" "+j) + for k in (ALL_DEVICE[i][j]): + print(" "+" "+k) + return + +def show_eeprom(index): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0] + node = node.replace(node.split("/")[-1], 'sfp_eeprom') + # check if got hexdump command in current environment + ret, log = log_os_system("which hexdump", 0) + ret, log2 = log_os_system("which busybox hexdump", 0) + if len(log): + hex_cmd = 'hexdump' + elif len(log2): + hex_cmd = ' busybox hexdump' + else: + log = 'Failed : no hexdump cmd!!' + logging.info(log) + print log + return 1 + + print node + ":" + ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1) + if ret==0: + print log + else: + print "**********device no found**********" + return + +def set_device(args): + global DEVICE_NO + global ALL_DEVICE + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + + if args[0]=='led': + if int(args[1])>4: + show_set_help() + return + #print ALL_DEVICE['led'] + for i in range(0,len(ALL_DEVICE['led'])): + for k in (ALL_DEVICE['led']['led'+str(i+1)]): + ret, log = log_os_system("echo "+args[1]+" >"+k, 1) + if ret: + return ret + elif args[0]=='fan': + if int(args[1])>100: + show_set_help() + return + #print ALL_DEVICE['fan'] + #fan1~6 is all fine, all fan share same setting + node = ALL_DEVICE['fan'] ['fan1'][0] + node = node.replace(node.split("/")[-1], 'fan_duty_cycle_percentage') + ret, log = log_os_system("cat "+ node, 1) + if ret==0: + print ("Previous fan duty: " + log.strip() +"%") + ret, log = log_os_system("echo "+args[1]+" >"+node, 1) + if ret==0: + print ("Current fan duty: " + args[1] +"%") + return ret + elif args[0]=='sfp': + if int(args[1])> DEVICE_NO[args[0]] or int(args[1])==0: + show_set_help() + return + if len(args)<2: + show_set_help() + return + + if int(args[2])>1: + show_set_help() + return + + #print ALL_DEVICE[args[0]] + for i in range(0,len(ALL_DEVICE[args[0]])): + for j in ALL_DEVICE[args[0]][args[0]+str(args[1])]: + if j.find('tx_disable')!= -1: + ret, log = log_os_system("echo "+args[2]+" >"+ j, 1) + if ret: + return ret + + return + +def get_value(input): + digit = re.findall('\d+', input) + return int(digit[0]) + +def device_traversal(): + if system_ready()==False: + print("System's not ready.") + print("Please install first!") + return + + if len(ALL_DEVICE)==0: + devices_info() + for i in sorted(ALL_DEVICE.keys()): + print("============================================") + print(i.upper()+": ") + print("============================================") + + for j in sorted(ALL_DEVICE[i].keys(), key=get_value): + print " "+j+":", + for k in (ALL_DEVICE[i][j]): + ret, log = log_os_system("cat "+k, 0) + func = k.split("/")[-1].strip() + func = re.sub(j+'_','',func,1) + func = re.sub(i.lower()+'_','',func,1) + if ret==0: + print func+"="+log+" ", + else: + print func+"="+"X"+" ", + print + print("----------------------------------------------------------------") + + + print + return + +def device_exist(): + ret1, log = log_os_system("ls "+i2c_prefix+"*0077", 0) + ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0) + return not(ret1 or ret2) + + +if __name__ == "__main__": + main() diff --git a/platform/nephos/sonic-platform-modules-cig/debian/changelog b/platform/nephos/sonic-platform-modules-cig/debian/changelog new file mode 100755 index 000000000000..7a4aa7996fdc --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/changelog @@ -0,0 +1,5 @@ +sonic-cig-platform-modules (1.0.0) unstable; urgency=low + + * Add support for CS6436-56P series + + -- developer Wed, 12 Sep 2018 10:00:00 +0800 diff --git a/platform/nephos/sonic-platform-modules-cig/debian/compat b/platform/nephos/sonic-platform-modules-cig/debian/compat new file mode 100755 index 000000000000..ec635144f600 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/compat @@ -0,0 +1 @@ +9 diff --git a/platform/nephos/sonic-platform-modules-cig/debian/control b/platform/nephos/sonic-platform-modules-cig/debian/control new file mode 100755 index 000000000000..c617c76bbba3 --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/control @@ -0,0 +1,11 @@ +Source: sonic-cig-platform-modules +Section: main +Priority: extra +Maintainer: yanglijie@cigtech.com +Build-Depends: debhelper (>= 8.0.0), bzip2 +Standards-Version: 3.9.3 + +Package: sonic-platform-cig-cs6436-56p +Architecture: amd64 +Depends: linux-image-4.9.0-8-amd64 +Description: kernel modules for platform devices such as fan, led, sfp diff --git a/platform/nephos/sonic-platform-modules-cig/debian/rules b/platform/nephos/sonic-platform-modules-cig/debian/rules new file mode 100755 index 000000000000..3192948cc08d --- /dev/null +++ b/platform/nephos/sonic-platform-modules-cig/debian/rules @@ -0,0 +1,86 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +include /usr/share/dpkg/pkg-info.mk + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +export INSTALL_MOD_DIR:=extra + +PYTHON ?= python2 + +PACKAGE_PRE_NAME := sonic-platform-cig +KVERSION ?= $(shell uname -r) +KERNEL_SRC := /lib/modules/$(KVERSION) +MOD_SRC_DIR:= $(shell pwd) +MODULE_DIRS:= cs6436-56p +MODULE_DIR := modules +UTILS_DIR := utils +SERVICE_DIR := service +CLASSES_DIR := classes +CONF_DIR := conf + +%: + dh $@ --with systemd,python2,python3 --buildsystem=pybuild + +clean: + dh_testdir + dh_testroot + dh_clean + +build: + #make modules -C $(KERNEL_SRC)/build M=$(MODULE_SRC) + (for mod in $(MODULE_DIRS); do \ + make modules -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \ + $(PYTHON) $${mod}/setup.py build; \ + done) + +binary: binary-arch binary-indep + # Nothing to do + +binary-arch: + # Nothing to do + +#install: build + #dh_testdir + #dh_testroot + #dh_clean -k + #dh_installdirs + +binary-indep: + dh_testdir + dh_installdirs + + # Custom package commands + (for mod in $(MODULE_DIRS); do \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin; \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ + cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/* debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/local/bin/; \ + cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system/; \ + $(PYTHON) $${mod}/setup.py install --root=$(MOD_SRC_DIR)/debian/$(PACKAGE_PRE_NAME)-$${mod} --install-layout=deb; \ + done) + # Resuming debhelper scripts + dh_testroot + dh_install + dh_installchangelogs + dh_installdocs + dh_systemd_enable + dh_installinit + dh_systemd_start + dh_link + dh_fixperms + dh_compress + dh_strip + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb +.PHONY: build binary binary-arch binary-indep clean