Skip to content
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Add 'delay' module param to the driver.

From: Cumulus Networks <support@cumulusnetworks.com>

This is needed on S6000 for safe PMBUS access.
Without setting the 'delay', the ismt driver throws 'completion wait
timed out' error message.
---
drivers/i2c/busses/i2c-ismt.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
index a35a27c32..b89fbb60d 100644
--- a/drivers/i2c/busses/i2c-ismt.c
+++ b/drivers/i2c/busses/i2c-ismt.c
@@ -66,6 +66,7 @@
#include <linux/i2c.h>
#include <linux/acpi.h>
#include <linux/interrupt.h>
+#include <linux/delay.h>

#include <linux/io-64-nonatomic-lo-hi.h>

@@ -190,9 +191,12 @@ static const struct pci_device_id ismt_ids[] = {
MODULE_DEVICE_TABLE(pci, ismt_ids);

/* Bus speed control bits for slow debuggers - refer to the docs for usage */
-static unsigned int bus_speed;
+static unsigned int bus_speed = 100;
+static unsigned int delay = 1000;
module_param(bus_speed, uint, S_IRUGO);
-MODULE_PARM_DESC(bus_speed, "Bus Speed in kHz (0 = BIOS default)");
+MODULE_PARM_DESC(bus_speed, "Bus Speed in kHz (1000 by default)");
+module_param(delay, uint, S_IRUGO);
+MODULE_PARM_DESC(delay, "Delay in microsecs before access (1000 by default)");

/**
* __ismt_desc_dump() - dump the contents of a specific descriptor
@@ -400,6 +404,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
struct device *dev = &priv->pci_dev->dev;
u8 *dma_buffer = PTR_ALIGN(&priv->buffer[0], 16);

+ if (delay > 0)
+ udelay(delay);
+
desc = &priv->hw[priv->head];

/* Initialize the DMA buffer */
@@ -759,7 +766,7 @@ static void ismt_hw_init(struct ismt_priv *priv)
bus_speed = 1000;
break;
}
- dev_dbg(dev, "SMBus clock is running at %d kHz\n", bus_speed);
+ dev_info(dev, "SMBus clock is running at %d kHz with delay %d us\n", bus_speed, delay);
}

/**
1 change: 1 addition & 0 deletions packages/base/any/kernels/6.1-lts/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
driver-i2c-bus-intel-ismt-add-delay-param.patch
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as5835-54x ARCH=amd64 KERNELS="onl-kernel-4.14-lts-x86-64-all:amd64"
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as5835-54x ARCH=amd64 KERNELS="onl-kernel-6.1-lts-x86-64-all:amd64"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
KERNELS := onl-kernel-4.14-lts-x86-64-all:amd64
KMODULES := $(wildcard *.c)
KERNELS := onl-kernel-6.1-lts-x86-64-all:amd64
KMODULES := src
VENDOR := accton
BASENAME := x86-64-accton-as5835-54x
ARCH := x86_64
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
obj-m += x86-64-accton-as5835-54x-cpld.o
obj-m += x86-64-accton-as5835-54x-fan.o
obj-m += x86-64-accton-as5835-54x-leds.o
obj-m += x86-64-accton-as5835-54x-psu.o
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ static int as5835_54x_cpld_probe(struct i2c_client *client,
return ret;
}

static int as5835_54x_cpld_remove(struct i2c_client *client)
static void as5835_54x_cpld_remove(struct i2c_client *client)
{
struct as5835_54x_cpld_data *data = i2c_get_clientdata(client);
const struct attribute_group *group = NULL;
Expand All @@ -1083,8 +1083,6 @@ static int as5835_54x_cpld_remove(struct i2c_client *client)
}

kfree(data);

return 0;
}

static int as5835_54x_cpld_read_internal(struct i2c_client *client, u8 reg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,27 @@ static ssize_t show_version(struct device *dev, struct device_attribute *attr, c
return sprintf(buf, "%d\n", val);
}

static umode_t as5835_54x_fan_is_visible(const void *drvdata,
enum hwmon_sensor_types type,
u32 attr, int channel)
{
return 0;
}

static const struct hwmon_channel_info *as5835_54x_fan_info[] = {
HWMON_CHANNEL_INFO(fan, HWMON_F_ENABLE),
NULL,
};

static const struct hwmon_ops as5835_54x_fan_hwmon_ops = {
.is_visible = as5835_54x_fan_is_visible,
};

static const struct hwmon_chip_info as5835_54x_fan_chip_info = {
.ops = &as5835_54x_fan_hwmon_ops,
.info = as5835_54x_fan_info,
};

static int as5835_54x_fan_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
Expand Down Expand Up @@ -437,7 +458,7 @@ static int as5835_54x_fan_probe(struct i2c_client *client,
}

data->hwmon_dev = hwmon_device_register_with_info(&client->dev, "as5835_54x_fan",
NULL, NULL, NULL);
NULL, &as5835_54x_fan_chip_info, NULL);
if (IS_ERR(data->hwmon_dev)) {
status = PTR_ERR(data->hwmon_dev);
goto exit_remove;
Expand All @@ -456,13 +477,11 @@ static int as5835_54x_fan_probe(struct i2c_client *client,
return status;
}

static int as5835_54x_fan_remove(struct i2c_client *client)
static void as5835_54x_fan_remove(struct i2c_client *client)
{
struct as5835_54x_fan_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as5835_54x_fan_group);

return 0;
}

/* Addresses to scan */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,27 @@ static const struct attribute_group as5835_54x_psu_group = {
.attrs = as5835_54x_psu_attributes,
};

static umode_t as5835_54x_psu_is_visible(const void *drvdata,
enum hwmon_sensor_types type,
u32 attr, int channel)
{
return 0;
}

static const struct hwmon_channel_info *as5835_54x_psu_info[] = {
HWMON_CHANNEL_INFO(power, HWMON_P_ENABLE),
NULL,
};

static const struct hwmon_ops as5835_54x_psu_hwmon_ops = {
.is_visible = as5835_54x_psu_is_visible,
};

static const struct hwmon_chip_info as5835_54x_psu_chip_info = {
.ops = &as5835_54x_psu_hwmon_ops,
.info = as5835_54x_psu_info,
};

static int as5835_54x_psu_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
Expand Down Expand Up @@ -181,7 +202,7 @@ static int as5835_54x_psu_probe(struct i2c_client *client,
}

data->hwmon_dev = hwmon_device_register_with_info(&client->dev, "as5835_54x_psu",
NULL, NULL, NULL);
NULL, &as5835_54x_psu_chip_info, NULL);
if (IS_ERR(data->hwmon_dev)) {
status = PTR_ERR(data->hwmon_dev);
goto exit_remove;
Expand All @@ -201,15 +222,13 @@ static int as5835_54x_psu_probe(struct i2c_client *client,
return status;
}

static int as5835_54x_psu_remove(struct i2c_client *client)
static void as5835_54x_psu_remove(struct i2c_client *client)
{
struct as5835_54x_psu_data *data = i2c_get_clientdata(client);

hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &as5835_54x_psu_group);
kfree(data);

return 0;
}

enum psu_index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
#define FAN_BOARD_PATH "/sys/bus/i2c/devices/3-0063/"
#define FAN_NODE(node) FAN_BOARD_PATH#node

#define IDPROM_PATH "/sys/class/i2c-adapter/i2c-1/1-0057/eeprom"
#define IDPROM_PATH_1 "/sys/bus/i2c/devices/0-0057/eeprom"
#define IDPROM_PATH_2 "/sys/bus/i2c/devices/1-0057/eeprom"

int psu_ym1401_pmbus_info_get(int id, char *node, int *value);
int psu_ym1401_pmbus_info_set(int id, char *node, int value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ int
onlp_sysi_onie_data_get(uint8_t** data, int* size)
{
uint8_t* rdata = aim_zmalloc(256);
if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) {
if (onlp_file_read(rdata, 256, size, IDPROM_PATH_1) == ONLP_STATUS_OK) {
if(*size == 256) {
*data = rdata;
return ONLP_STATUS_OK;
}
} else if (onlp_file_read(rdata, 256, size, IDPROM_PATH_2) == ONLP_STATUS_OK) {
if(*size == 256) {
*data = rdata;
return ONLP_STATUS_OK;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ x86-64-accton-as5835-54x-r0:
--stop=1

kernel:
<<: *kernel-4-14
<<: *kernel-6-1

args: >-
nopat
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from onl.platform.base import *
from onl.platform.accton import *

def get_i2c_bus_num_offset():
cmd = 'cat /sys/bus/i2c/devices/i2c-0/name'
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
return -1 if b'iSMT' in stdout else 0 # the iSMT adapter may get i2c bus 0, hence the offset -1

class OnlPlatform_x86_64_accton_as5835_54x_r0(OnlPlatformAccton,
OnlPlatformPortConfig_48x10_6x40):
PLATFORM='x86-64-accton-as5835-54x-r0'
Expand All @@ -13,11 +19,13 @@ def baseconfig(self):
for m in [ 'cpld', 'fan', 'psu', 'leds' ]:
self.insmod("x86-64-accton-as5835-54x-%s" % m)

bus_offset = get_i2c_bus_num_offset()

########### initialize I2C bus 0 ###########
self.new_i2c_devices(
[
# initialize multiplexer (PCA9548)
('pca9548', 0x77, 1),
('pca9548', 0x77, 1 + bus_offset),
('pca9548', 0x70, 2),
('pca9548', 0x71, 2),
('pca9548', 0x72, 2),
Expand Down Expand Up @@ -52,7 +60,7 @@ def baseconfig(self):
('pca9548', 0x76, 39),

# initiate IDPROM
('24c02', 0x57, 1),
('24c02', 0x57, 1 + bus_offset),
]
)

Expand Down