• Vadim Pasternak's avatar
    mlxsw: core: Add validation of hardware device types for MGPIR register · 36844c85
    Vadim Pasternak authored
    When reading the number of gearboxes from the hardware, the driver does
    not validate the returned 'device type' field. The driver can therefore
    wrongly assume that the queried devices are gearboxes.
    
    On Spectrum-3 systems that support different types of devices, this can
    prevent the driver from loading, as it will try to query the
    temperature sensors from devices which it assumes are gearboxes and in
    fact are not.
    
    For example:
    [  218.129230] mlxsw_minimal 2-0048: Reg cmd access status failed (status=7(bad parameter))
    [  218.138282] mlxsw_minimal 2-0048: Reg cmd access failed (reg_id=900a(mtmp),type=write)
    [  218.147131] mlxsw_minimal 2-0048: Failed to setup temp sensor number 256
    [  218.534480] mlxsw_minimal 2-0048: Fail to register core bus
    [  218.540714] mlxsw_minimal: probe of 2-0048 failed with error -5
    
    Fix this by validating the 'device type' field.
    
    Fixes: 2e265a8b ("mlxsw: core: Extend hwmon interface with inter-connect temperature attributes")
    Fixes: f14f4e62
    
     ("mlxsw: core: Extend thermal core with per inter-connect device thermal zones")
    Signed-off-by: default avatarVadim Pasternak <vadimp@mellanox.com>
    Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    36844c85