Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Devices] Dell Reset I2C MUX in S6000 while invoking platform reboot #2567

Merged
merged 1 commit into from
Feb 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions device/dell/x86_64-dell_s6000_s1220-r0/installer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ echo "Replace ONIE reboot with Dell reset commands"
# set I2C GPIO mux
[ -d /sys/class/gpio/gpio1 ] || echo 1 > /sys/class/gpio/export
[ -d /sys/class/gpio/gpio2 ] || echo 2 > /sys/class/gpio/export
[ -d /sys/class/gpio/gpio10 ] || echo 10 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1/direction
echo out > /sys/class/gpio/gpio2/direction
echo out > /sys/class/gpio/gpio10/direction
echo 0 > /sys/class/gpio/gpio1/value
echo 0 > /sys/class/gpio/gpio2/value

Expand Down
10 changes: 10 additions & 0 deletions device/dell/x86_64-dell_s6000_s1220-r0/platform_reboot
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#!/bin/sh

# Export GPIO10 if needed
[ -d /sys/class/gpio/gpio10 ] || echo 10 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio10/direction

#Toggle GPIO10 pin (to reset MUX)
echo 1 > /sys/class/gpio/gpio10/value
echo 0 > /sys/class/gpio/gpio10/value


#Power Reset
echo 1 > /sys/devices/platform/dell-s6000-cpld.0/power_reset
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,14 @@ static ssize_t set_power_reset(struct device *dev, struct device_attribute *deva

static ssize_t get_power_reset(struct device *dev, struct device_attribute *devattr, char *buf)
{
return sprintf(buf, "0\n");
uint8_t ret = 0;
struct cpld_platform_data *pdata = dev->platform_data;

ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, 0x1);
if (ret < 0)
return sprintf(buf, "read error");

return sprintf(buf, "0x%x\n", ret);
}

static ssize_t get_fan_prs(struct device *dev, struct device_attribute *devattr, char *buf)
Expand Down Expand Up @@ -1006,6 +1013,55 @@ static ssize_t set_fan2_led(struct device *dev, struct device_attribute *devattr
return count;
}

static ssize_t get_system_cpld_ver(struct device *dev,
struct device_attribute *devattr, char *buf)
{
uint8_t ret;
u32 data = 0;
struct cpld_platform_data *pdata = dev->platform_data;

ret = i2c_smbus_read_byte_data(pdata[system_cpld].client, 0x0);
if (ret < 0)
return sprintf(buf, "read error");

data = ret & (0x0f);

return sprintf(buf, "0x%x\n", data);
}

static ssize_t get_master_cpld_ver(struct device *dev,
struct device_attribute *devattr, char *buf)
{
uint8_t ret;
u32 data = 0;
struct cpld_platform_data *pdata = dev->platform_data;

ret = i2c_smbus_read_byte_data(pdata[master_cpld].client, 0x1);
if (ret < 0)
return sprintf(buf, "read error");

data = ret & (0x0f);

return sprintf(buf, "0x%x\n", data);
}

static ssize_t get_slave_cpld_ver(struct device *dev,
struct device_attribute *devattr, char *buf)
{
uint8_t ret;
u32 data = 0;
struct cpld_platform_data *pdata = dev->platform_data;

ret = i2c_smbus_read_byte_data(pdata[slave_cpld].client, 0xa);
if (ret < 0)
return sprintf(buf, "read error");

data = ret & (0x0f);

return sprintf(buf, "0x%x\n", data);
}


static DEVICE_ATTR(qsfp_modsel, S_IRUGO, get_modsel, NULL);
static DEVICE_ATTR(qsfp_modprs, S_IRUGO, get_modprs, NULL);
static DEVICE_ATTR(qsfp_lpmode, S_IRUGO | S_IWUSR, get_lpmode, set_lpmode);
Expand All @@ -1024,6 +1080,9 @@ static DEVICE_ATTR(fan_led, S_IRUGO | S_IWUSR, get_fan_led, set_fan_led);
static DEVICE_ATTR(fan0_led, S_IRUGO | S_IWUSR, get_fan0_led, set_fan0_led);
static DEVICE_ATTR(fan1_led, S_IRUGO | S_IWUSR, get_fan1_led, set_fan1_led);
static DEVICE_ATTR(fan2_led, S_IRUGO | S_IWUSR, get_fan2_led, set_fan2_led);
static DEVICE_ATTR(system_cpld_ver, S_IRUGO, get_system_cpld_ver, NULL);
static DEVICE_ATTR(master_cpld_ver, S_IRUGO, get_master_cpld_ver, NULL);
static DEVICE_ATTR(slave_cpld_ver, S_IRUGO, get_slave_cpld_ver, NULL);

static struct attribute *s6000_cpld_attrs[] = {
&dev_attr_qsfp_modsel.attr,
Expand All @@ -1044,6 +1103,9 @@ static struct attribute *s6000_cpld_attrs[] = {
&dev_attr_fan0_led.attr,
&dev_attr_fan1_led.attr,
&dev_attr_fan2_led.attr,
&dev_attr_system_cpld_ver.attr,
&dev_attr_master_cpld_ver.attr,
&dev_attr_slave_cpld_ver.attr,
NULL,
};

Expand Down