Skip to content

Commit

Permalink
Merge pull request #27 from marian-pritsak/2740-master
Browse files Browse the repository at this point in the history
[SN2740]: Add new platform
  • Loading branch information
dvirl1 authored Jun 24, 2017
2 parents 1705157 + e55384f commit 8d91481
Show file tree
Hide file tree
Showing 5 changed files with 951 additions and 6 deletions.
4 changes: 3 additions & 1 deletion include/mlnx-sys-type.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@
*
*/

#define SYS_TYPE 2
#define SYS_TYPE 3

enum mlnx_system_types
{
mlnx_dflt_sys_type,
msn2100_sys_type,
msn2740_sys_type,
};

const char* mlnx_product_names[] = {
"DFLT",
"MSN2100",
"MSN2740",
NULL
};

Expand Down
58 changes: 54 additions & 4 deletions mlnx-a2d-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#define VOLT_SENS_SW_NUM_DFLT 1
#define VOLT_SENS_SW_NUM_MSN2100 5
#define CURR_SENS_SW_NUM_MSN2100 2
#define VOLT_SENS_SW_NUM_MSN2740 4
#define CURR_SENS_MAIN_NUM_MSN2100 0

#define CURR_SENS_NUM 2
Expand Down Expand Up @@ -82,116 +83,141 @@ static unsigned short sw_board_read_size = 7;

static unsigned short mnb_expect_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 675, 870, 3300, 1800, 1050, 1050, 1350, 5000, 1500, 0, 0, 0, 0 },
{ 1000, 1000, 675, 1000, 1350, 1800, 3300, 12000, 1350, 1070, 1500, \
{ 1000, 1000, 675, 1000, 1350, 1800, 3300, 12000, 1350, 1070, 1500,
5000, 3300 },
{ 1000, 1000, 675, 1000, 1350, 1800, 3300, 12000, 1350, 1070, 1500,
5000, 3300 },
};

static unsigned short mnb_expect_volt_dev[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 10, 15, 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0 },
{ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
{ 20, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10 },
};

static unsigned short mnb_scale_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 8, 8, 16, 8, 8, 8, 8, 24, 8, 0, 0, 0, 0 },
{ 8, 8, 8, 8, 8, 8, 16, 88, 8, 8, 8, 25, 16 },
{ 8, 8, 8, 8, 8, 8, 16, 88, 8, 8, 8, 25, 16 },
};

static unsigned short mnb_offset_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 },
};

static unsigned short mnb_rail_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 0, 1, 3, 4, 5, 6, 7, 3, 5, 0, 0, 0, 0 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 3, 4, 5, 6, 7 },
};

static char *mnb_label_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ "ddr3_0.675", "cpu_0.9", "sys", "cpu_1.8", "cpu_pch_1.05", \
{ "ddr3_0.675", "cpu_0.9", "sys", "cpu_1.8", "cpu_pch_1.05",
"cpu_1.05", "ddr3_1.35", "usb_5", "lan_1.05", "", "", "", "" },
{ "soc_core", "soc_vnn", "cpu_0.675v", "1v", "vddq", "1.8v", \
{ "soc_core", "soc_vnn", "cpu_0.675v", "1v", "vddq", "1.8v",
"sys_3.3v", "12v", "1.35v", "vccsram", "1.5v", "5v", "3.3v_aux" },
{ "soc_core", "soc_vnn", "cpu_0.675v", "1v", "vddq", "1.8v",
"sys_3.3v", "12v", "1.35v", "vccsram", "1.5v", "5v", "3.3v_aux" },
};

static unsigned short mnb_expect_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 2, 2 },
{ 0, 0 },
{ 0, 0 },
};

static unsigned short mnb_scale_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 8, 8 },
{ 0, 0 },
{ 0, 0 },
};

static unsigned short mnb_offset_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 0, 1 },
{ 0, 0 },
{ 0, 0 },
};

static unsigned short mnb_rail_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 2, 2 },
{ 0, 0 },
{ 0, 0 },
};

static char *mnb_label_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ "ps2_12_aux", "ps1_12_aux" },
{ "", "" },
{ "", "" },
};

static unsigned short swb_expect_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 1800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 12000, 12000, 3300,12000, 5000, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 12000, 12000, 3300, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};

static unsigned short swb_expect_volt_dev[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 10, 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 10, 10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};

static unsigned short swb_scale_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 59, 59, 16, 59, 33, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 59, 59, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};

static unsigned short swb_offset_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};

static unsigned short swb_rail_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};

static char *swb_label_volt[SYS_TYPE][VOLT_SENS_NUM_MAX] = {
{ "1.8V_sw_spc", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "12v_1", "12v_2", "3.3v", "12v_aux", "5v_usb", "", "", "", "", "", \
{ "12v_1", "12v_2", "3.3v", "12v_aux", "5v_usb", "", "", "", "", "",
"", "", "" },
{ "12v", "12v_aux", "3.3v_aux", "", "", "", "", "", "", "", "", "", ""
},
};

static unsigned short swb_expect_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
};

static unsigned short swb_scale_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 0, 0 },
{ 80, 80 },
{ 0, 0 },
};

static unsigned short swb_offset_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
};

static unsigned short swb_rail_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ 0, 0 },
{ 5, 6 },
{ 0, 0 },
};

static char *swb_label_curr[SYS_TYPE][CURR_SENS_NUM] = {
{ "", "" },
{ "12v_1_curr", "12v_2_curr" },
{ "", "" },
};

enum a2d_types {
Expand Down Expand Up @@ -619,14 +645,32 @@ static struct attribute *mlnx_swb_msn2100_a2d_attributes[] = {
NULL
};

static struct attribute *mlnx_swb_msn2740_a2d_attributes[] = {
&sensor_dev_attr_in1_input.dev_attr.attr,
&sensor_dev_attr_in1_min.dev_attr.attr,
&sensor_dev_attr_in1_max.dev_attr.attr,
&sensor_dev_attr_in1_label.dev_attr.attr,
&sensor_dev_attr_in2_input.dev_attr.attr,
&sensor_dev_attr_in2_min.dev_attr.attr,
&sensor_dev_attr_in2_max.dev_attr.attr,
&sensor_dev_attr_in2_label.dev_attr.attr,
&sensor_dev_attr_in3_input.dev_attr.attr,
&sensor_dev_attr_in3_min.dev_attr.attr,
&sensor_dev_attr_in3_max.dev_attr.attr,
&sensor_dev_attr_in3_label.dev_attr.attr,
NULL
};

static const struct attribute_group mlnx_mnb_a2d_group[SYS_TYPE] = {
{.attrs = mlnx_mnb_a2d_attributes},
{.attrs = mlnx_mnb_sff_a2d_attributes},
{.attrs = mlnx_mnb_sff_a2d_attributes},
};

static const struct attribute_group mlnx_swb_a2d_group[SYS_TYPE] = {
{.attrs = mlnx_swb_a2d_attributes},
{.attrs = mlnx_swb_msn2100_a2d_attributes},
{.attrs = mlnx_swb_msn2740_a2d_attributes},
};

static int a2d_config(struct a2d_data *a2d_data)
Expand Down Expand Up @@ -720,6 +764,12 @@ static int a2d_probe(struct i2c_client *client, const struct i2c_device_id *devi
num_main_board_curr_sensors = CURR_SENS_MAIN_NUM_MSN2100;
break;

case msn2740_sys_type:
data->mlnx_system_type = msn2740_sys_type;
num_main_board_volt_sensors = VOLT_SENS_NUM_SFF;
num_sw_board_volt_sensors = VOLT_SENS_SW_NUM_MSN2740;
break;

case mlnx_dflt_sys_type:
default:
data->mlnx_system_type = mlnx_dflt_sys_type;
Expand Down
27 changes: 26 additions & 1 deletion mlnx-cpld-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ struct cpld_container {
struct list_head list;
struct device *cpld_hwmon_dev;
struct mux_config_params cfg_mux;
enum mlnx_system_types mlnx_system_type;
enum mlnx_system_types mlnx_system_type;
};
static struct cpld_container cpld_db;

Expand Down Expand Up @@ -2154,6 +2154,7 @@ static struct attribute *mlnx_cpld_msn2100_attributes[] = {
static const struct attribute_group mlnx_cpld_group[] = {
{.attrs = mlnx_cpld_attributes},
{.attrs = mlnx_cpld_msn2100_attributes},
{.attrs = mlnx_cpld_attributes},
};

#define CPLD_CREATE(id) \
Expand Down Expand Up @@ -3033,6 +3034,30 @@ static int __init mlnx_cpld_init(void)
psu_module_power_event_offset[i];
break;

case msn2740_sys_type:
cpld_db.mlnx_system_type = msn2740_sys_type;
num_psu_modules = 2;
num_fixed_psu_modules = 0;
num_fan_modules = 4;
num_cpld = 2;
num_reset = 3;
num_mux = 2;
leds_profile.profile = led_default_profile;
num_led = ARRAY_SIZE(led_default_profile);
leds_profile.fan_led_offset = 0;
leds_profile.psu_led_offset = 4;
leds_profile.status_led_offset = 5;
leds_profile.uid_led_offset = NOT_USED_LED_OFFSET;
leds_profile.bp_led_offset = NOT_USED_LED_OFFSET;
leds_profile.uid_led_offset = NOT_USED_LED_OFFSET;
irq_line = DEF_IRQ_LINE;
psu_module_mux[0] = 4;
psu_module_mux[1] = 4;
psu_mux[0] = 4;
psu_mux[1] = 4;
mux_driver = "cpld_mux_mgmt";
break;

case mlnx_dflt_sys_type:
default:
cpld_db.mlnx_system_type = mlnx_dflt_sys_type;
Expand Down
Loading

0 comments on commit 8d91481

Please sign in to comment.