Skip to content

Commit 01b8d76

Browse files
committed
[Edgecore] Upgrade AS5835-54X to kernel 6.1
This commit upgrade AS5835-54X kernel version from 4.14 to 6.1 and includes a kernel patch for ismt bus to solve i2c hang issue.
1 parent f63f1f8 commit 01b8d76

12 files changed

Lines changed: 128 additions & 19 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
Add 'delay' module param to the driver.
2+
3+
From: Cumulus Networks <support@cumulusnetworks.com>
4+
5+
This is needed on S6000 for safe PMBUS access.
6+
Without setting the 'delay', the ismt driver throws 'completion wait
7+
timed out' error message.
8+
---
9+
drivers/i2c/busses/i2c-ismt.c | 13 ++++++++++---
10+
1 file changed, 10 insertions(+), 3 deletions(-)
11+
12+
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c
13+
index a35a27c32..b89fbb60d 100644
14+
--- a/drivers/i2c/busses/i2c-ismt.c
15+
+++ b/drivers/i2c/busses/i2c-ismt.c
16+
@@ -66,6 +66,7 @@
17+
#include <linux/i2c.h>
18+
#include <linux/acpi.h>
19+
#include <linux/interrupt.h>
20+
+#include <linux/delay.h>
21+
22+
#include <linux/io-64-nonatomic-lo-hi.h>
23+
24+
@@ -190,9 +191,12 @@ static const struct pci_device_id ismt_ids[] = {
25+
MODULE_DEVICE_TABLE(pci, ismt_ids);
26+
27+
/* Bus speed control bits for slow debuggers - refer to the docs for usage */
28+
-static unsigned int bus_speed;
29+
+static unsigned int bus_speed = 100;
30+
+static unsigned int delay = 1000;
31+
module_param(bus_speed, uint, S_IRUGO);
32+
-MODULE_PARM_DESC(bus_speed, "Bus Speed in kHz (0 = BIOS default)");
33+
+MODULE_PARM_DESC(bus_speed, "Bus Speed in kHz (1000 by default)");
34+
+module_param(delay, uint, S_IRUGO);
35+
+MODULE_PARM_DESC(delay, "Delay in microsecs before access (1000 by default)");
36+
37+
/**
38+
* __ismt_desc_dump() - dump the contents of a specific descriptor
39+
@@ -400,6 +404,9 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr,
40+
struct device *dev = &priv->pci_dev->dev;
41+
u8 *dma_buffer = PTR_ALIGN(&priv->buffer[0], 16);
42+
43+
+ if (delay > 0)
44+
+ udelay(delay);
45+
+
46+
desc = &priv->hw[priv->head];
47+
48+
/* Initialize the DMA buffer */
49+
@@ -759,7 +766,7 @@ static void ismt_hw_init(struct ismt_priv *priv)
50+
bus_speed = 1000;
51+
break;
52+
}
53+
- dev_dbg(dev, "SMBus clock is running at %d kHz\n", bus_speed);
54+
+ dev_info(dev, "SMBus clock is running at %d kHz with delay %d us\n", bus_speed, delay);
55+
}
56+
57+
/**
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
driver-i2c-bus-intel-ismt-add-delay-param.patch
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +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"
1+
!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"

packages/platforms/accton/x86-64/as5835-54x/modules/builds/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
KERNELS := onl-kernel-4.14-lts-x86-64-all:amd64
2-
KMODULES := $(wildcard *.c)
1+
#KERNELS := onl-kernel-4.14-lts-x86-64-all:amd64
2+
KERNELS := onl-kernel-6.1-lts-x86-64-all:amd64
3+
KMODULES := src
34
VENDOR := accton
45
BASENAME := x86-64-accton-as5835-54x
56
ARCH := x86_64

packages/platforms/accton/x86-64/as5835-54x/modules/builds/x86-64-accton-as5835-54x-cpld.c renamed to packages/platforms/accton/x86-64/as5835-54x/modules/builds/src/x86-64-accton-as5835-54x-cpld.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ static int as5835_54x_cpld_probe(struct i2c_client *client,
10561056
return ret;
10571057
}
10581058

1059-
static int as5835_54x_cpld_remove(struct i2c_client *client)
1059+
static void as5835_54x_cpld_remove(struct i2c_client *client)
10601060
{
10611061
struct as5835_54x_cpld_data *data = i2c_get_clientdata(client);
10621062
const struct attribute_group *group = NULL;
@@ -1083,8 +1083,6 @@ static int as5835_54x_cpld_remove(struct i2c_client *client)
10831083
}
10841084

10851085
kfree(data);
1086-
1087-
return 0;
10881086
}
10891087

10901088
static int as5835_54x_cpld_read_internal(struct i2c_client *client, u8 reg)

packages/platforms/accton/x86-64/as5835-54x/modules/builds/x86-64-accton-as5835-54x-fan.c renamed to packages/platforms/accton/x86-64/as5835-54x/modules/builds/src/x86-64-accton-as5835-54x-fan.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,27 @@ static ssize_t show_version(struct device *dev, struct device_attribute *attr, c
407407
return sprintf(buf, "%d\n", val);
408408
}
409409

410+
static umode_t as5835_54x_fan_is_visible(const void *drvdata,
411+
enum hwmon_sensor_types type,
412+
u32 attr, int channel)
413+
{
414+
return 0;
415+
}
416+
417+
static const struct hwmon_channel_info *as5835_54x_fan_info[] = {
418+
HWMON_CHANNEL_INFO(fan, HWMON_F_ENABLE),
419+
NULL,
420+
};
421+
422+
static const struct hwmon_ops as5835_54x_fan_hwmon_ops = {
423+
.is_visible = as5835_54x_fan_is_visible,
424+
};
425+
426+
static const struct hwmon_chip_info as5835_54x_fan_chip_info = {
427+
.ops = &as5835_54x_fan_hwmon_ops,
428+
.info = as5835_54x_fan_info,
429+
};
430+
410431
static int as5835_54x_fan_probe(struct i2c_client *client,
411432
const struct i2c_device_id *dev_id)
412433
{
@@ -437,7 +458,7 @@ static int as5835_54x_fan_probe(struct i2c_client *client,
437458
}
438459

439460
data->hwmon_dev = hwmon_device_register_with_info(&client->dev, "as5835_54x_fan",
440-
NULL, NULL, NULL);
461+
NULL, &as5835_54x_fan_chip_info, NULL);
441462
if (IS_ERR(data->hwmon_dev)) {
442463
status = PTR_ERR(data->hwmon_dev);
443464
goto exit_remove;
@@ -456,13 +477,11 @@ static int as5835_54x_fan_probe(struct i2c_client *client,
456477
return status;
457478
}
458479

459-
static int as5835_54x_fan_remove(struct i2c_client *client)
480+
static void as5835_54x_fan_remove(struct i2c_client *client)
460481
{
461482
struct as5835_54x_fan_data *data = i2c_get_clientdata(client);
462483
hwmon_device_unregister(data->hwmon_dev);
463484
sysfs_remove_group(&client->dev.kobj, &as5835_54x_fan_group);
464-
465-
return 0;
466485
}
467486

468487
/* Addresses to scan */

packages/platforms/accton/x86-64/as5835-54x/modules/builds/x86-64-accton-as5835-54x-leds.c renamed to packages/platforms/accton/x86-64/as5835-54x/modules/builds/src/x86-64-accton-as5835-54x-leds.c

File renamed without changes.

packages/platforms/accton/x86-64/as5835-54x/modules/builds/x86-64-accton-as5835-54x-psu.c renamed to packages/platforms/accton/x86-64/as5835-54x/modules/builds/src/x86-64-accton-as5835-54x-psu.c

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,27 @@ static const struct attribute_group as5835_54x_psu_group = {
150150
.attrs = as5835_54x_psu_attributes,
151151
};
152152

153+
static umode_t as5835_54x_psu_is_visible(const void *drvdata,
154+
enum hwmon_sensor_types type,
155+
u32 attr, int channel)
156+
{
157+
return 0;
158+
}
159+
160+
static const struct hwmon_channel_info *as5835_54x_psu_info[] = {
161+
HWMON_CHANNEL_INFO(power, HWMON_P_ENABLE),
162+
NULL,
163+
};
164+
165+
static const struct hwmon_ops as5835_54x_psu_hwmon_ops = {
166+
.is_visible = as5835_54x_psu_is_visible,
167+
};
168+
169+
static const struct hwmon_chip_info as5835_54x_psu_chip_info = {
170+
.ops = &as5835_54x_psu_hwmon_ops,
171+
.info = as5835_54x_psu_info,
172+
};
173+
153174
static int as5835_54x_psu_probe(struct i2c_client *client,
154175
const struct i2c_device_id *dev_id)
155176
{
@@ -181,7 +202,7 @@ static int as5835_54x_psu_probe(struct i2c_client *client,
181202
}
182203

183204
data->hwmon_dev = hwmon_device_register_with_info(&client->dev, "as5835_54x_psu",
184-
NULL, NULL, NULL);
205+
NULL, &as5835_54x_psu_chip_info, NULL);
185206
if (IS_ERR(data->hwmon_dev)) {
186207
status = PTR_ERR(data->hwmon_dev);
187208
goto exit_remove;
@@ -201,15 +222,13 @@ static int as5835_54x_psu_probe(struct i2c_client *client,
201222
return status;
202223
}
203224

204-
static int as5835_54x_psu_remove(struct i2c_client *client)
225+
static void as5835_54x_psu_remove(struct i2c_client *client)
205226
{
206227
struct as5835_54x_psu_data *data = i2c_get_clientdata(client);
207228

208229
hwmon_device_unregister(data->hwmon_dev);
209230
sysfs_remove_group(&client->dev.kobj, &as5835_54x_psu_group);
210231
kfree(data);
211-
212-
return 0;
213232
}
214233

215234
enum psu_index

packages/platforms/accton/x86-64/as5835-54x/onlp/builds/x86_64_accton_as5835_54x/module/src/platform_lib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
#define FAN_BOARD_PATH "/sys/bus/i2c/devices/3-0063/"
5050
#define FAN_NODE(node) FAN_BOARD_PATH#node
5151

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

5455
int psu_ym1401_pmbus_info_get(int id, char *node, int *value);
5556
int psu_ym1401_pmbus_info_set(int id, char *node, int value);

packages/platforms/accton/x86-64/as5835-54x/onlp/builds/x86_64_accton_as5835_54x/module/src/sysi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ int
5858
onlp_sysi_onie_data_get(uint8_t** data, int* size)
5959
{
6060
uint8_t* rdata = aim_zmalloc(256);
61-
if(onlp_file_read(rdata, 256, size, IDPROM_PATH) == ONLP_STATUS_OK) {
61+
if (onlp_file_read(rdata, 256, size, IDPROM_PATH_1) == ONLP_STATUS_OK) {
62+
if(*size == 256) {
63+
*data = rdata;
64+
return ONLP_STATUS_OK;
65+
}
66+
} else if (onlp_file_read(rdata, 256, size, IDPROM_PATH_2) == ONLP_STATUS_OK) {
6267
if(*size == 256) {
6368
*data = rdata;
6469
return ONLP_STATUS_OK;

0 commit comments

Comments
 (0)