Skip to content

Commit 923fad7

Browse files
[Accton AS9737-32DB] Upgradge Linux kernel version to 6.1
- The PKG.yml and Makefile under modules, change to onl-kernel-6.1-lts-x86-64-all. - The x86-64-accton-as9737-32db-r0.yml file under platform-config, change to kernel-6-1. - Modify driver that uses struct i2c_driver, the return type of the remove function of struct i2c_driver is changed from int to void. - Modify driver that uses hwmon_device_register_with_info(), the fourth parameter (hwmon_chip_info) of hwmon_device_register_with_info() can’t be NULL after changed to kernel 6.1. - Add to check the main I2C bus ID in the __init__.py because the iSMT driver is enabled, and update the I2C bus ID of CPLD.
1 parent fe0203a commit 923fad7

File tree

9 files changed

+77
-30
lines changed

9 files changed

+77
-30
lines changed
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-as9737-32db ARCH=amd64 KERNELS="onl-kernel-5.4-lts-x86-64-all:amd64"
1+
!include $ONL_TEMPLATES/platform-modules.yml VENDOR=accton BASENAME=x86-64-accton-as9737-32db ARCH=amd64 KERNELS="onl-kernel-6.1-lts-x86-64-all:amd64"

packages/platforms/accton/x86-64/as9737-32db/modules/builds/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KERNELS := onl-kernel-5.4-lts-x86-64-all:amd64
1+
KERNELS := onl-kernel-6.1-lts-x86-64-all:amd64
22
KMODULES := src
33
VENDOR := accton
44
BASENAME := x86-64-accton-as9737-32db

packages/platforms/accton/x86-64/as9737-32db/modules/builds/src/x86-64-accton-as9737-32db-cpld.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ static int as9737_32db_cpld_probe(struct i2c_client *client,
664664
return ret;
665665
}
666666

667-
static int as9737_32db_cpld_remove(struct i2c_client *client)
667+
static void as9737_32db_cpld_remove(struct i2c_client *client)
668668
{
669669
struct as9737_32db_cpld_data *data = i2c_get_clientdata(client);
670670
const struct attribute_group *group = NULL;
@@ -690,8 +690,6 @@ static int as9737_32db_cpld_remove(struct i2c_client *client)
690690
sysfs_remove_group(&client->dev.kobj, group);
691691

692692
kfree(data);
693-
694-
return 0;
695693
}
696694

697695
static int as9737_32db_cpld_read_internal(struct i2c_client *client, u8 reg)

packages/platforms/accton/x86-64/as9737-32db/modules/builds/src/x86-64-accton-as9737-32db-mux.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,10 @@ static int as9737_32db_mux_probe(struct i2c_client *client,
175175
return ret;
176176
}
177177

178-
static int as9737_32db_mux_remove(struct i2c_client *client)
178+
static void as9737_32db_mux_remove(struct i2c_client *client)
179179
{
180180
struct i2c_mux_core *muxc = i2c_get_clientdata(client);
181181
as9737_32db_mux_cleanup(muxc);
182-
return 0;
183182
}
184183

185184
static struct i2c_driver as9737_32db_mux_driver = {

packages/platforms/accton/x86-64/as9737-32db/modules/builds/src/x86-64-accton-as9737-32db-psu.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,27 @@ static ssize_t show_string(struct device *dev, struct device_attribute *da,
809809
return error;
810810
}
811811

812+
static umode_t as9737_32db_psu_is_visible(const void *drvdata,
813+
enum hwmon_sensor_types type,
814+
u32 attr, int channel)
815+
{
816+
return 0;
817+
}
818+
819+
static const struct hwmon_channel_info *as9737_32db_psu_info[] = {
820+
HWMON_CHANNEL_INFO(power, HWMON_P_ENABLE),
821+
NULL,
822+
};
823+
824+
static const struct hwmon_ops as9737_32db_psu_hwmon_ops = {
825+
.is_visible = as9737_32db_psu_is_visible,
826+
};
827+
828+
static const struct hwmon_chip_info as9737_32db_psu_chip_info = {
829+
.ops = &as9737_32db_psu_hwmon_ops,
830+
.info = as9737_32db_psu_info,
831+
};
832+
812833
static int as9737_32db_psu_probe(struct platform_device *pdev)
813834
{
814835
int status = 0;
@@ -817,7 +838,7 @@ static int as9737_32db_psu_probe(struct platform_device *pdev)
817838

818839
for(i = 0; i < 2; i++) {
819840
hwmon_dev = hwmon_device_register_with_info(&pdev->dev, DRVNAME,
820-
NULL, NULL, as9737_32db_psu_groups[i]);
841+
NULL, &as9737_32db_psu_chip_info, as9737_32db_psu_groups[i]);
821842

822843
if (IS_ERR(hwmon_dev)) {
823844
status = PTR_ERR(hwmon_dev);

packages/platforms/accton/x86-64/as9737-32db/modules/builds/src/x86-64-accton-as9737-32db-thermal.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,34 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da,
240240
return status;
241241
}
242242

243+
static umode_t as9737_32db_thermal_is_visible(const void *drvdata,
244+
enum hwmon_sensor_types type,
245+
u32 attr, int channel)
246+
{
247+
return 0;
248+
}
249+
250+
static const struct hwmon_channel_info *as9737_32db_thermal_info[] = {
251+
HWMON_CHANNEL_INFO(temp, HWMON_T_ENABLE),
252+
NULL,
253+
};
254+
255+
static const struct hwmon_ops as9737_32db_thermal_hwmon_ops = {
256+
.is_visible = as9737_32db_thermal_is_visible,
257+
};
258+
259+
static const struct hwmon_chip_info as9737_32db_thermal_chip_info = {
260+
.ops = &as9737_32db_thermal_hwmon_ops,
261+
.info = as9737_32db_thermal_info,
262+
};
263+
243264
static int as9737_32db_thermal_probe(struct platform_device *pdev)
244265
{
245266
int status = 0;
246267
struct device *hwmon_dev;
247268

248269
hwmon_dev = hwmon_device_register_with_info(&pdev->dev, DRVNAME,
249-
NULL, NULL, as9737_32db_thermal_groups);
270+
NULL, &as9737_32db_thermal_chip_info, as9737_32db_thermal_groups);
250271
if (IS_ERR(data->hwmon_dev)) {
251272
status = PTR_ERR(data->hwmon_dev);
252273
return status;

packages/platforms/accton/x86-64/as9737-32db/onlp/builds/x86_64_accton_as9737_32db/module/src/sfpi.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@
4242
} while(0)
4343

4444
#define MODULE_EEPROM_FORMAT "/sys/bus/i2c/devices/%d-0050/eeprom"
45-
#define MODULE_PRESENT_CPLD2_FORMAT "/sys/bus/i2c/devices/35-0061/module_present_%d"
46-
#define MODULE_PRESENT_CPLD3_FORMAT "/sys/bus/i2c/devices/36-0062/module_present_%d"
47-
#define MODULE_RXLOS_FORMAT "/sys/bus/i2c/devices/36-0062/module_rx_los_%d"
48-
#define MODULE_TXFAULT_FORMAT "/sys/bus/i2c/devices/36-0062/module_tx_fault_%d"
49-
#define MODULE_TXDISABLE_FORMAT "/sys/bus/i2c/devices/36-0062/module_tx_disable_%d"
50-
#define MODULE_RESET_CPLD2_FORMAT "/sys/bus/i2c/devices/35-0061/module_reset_%d"
51-
#define MODULE_RESET_CPLD3_FORMAT "/sys/bus/i2c/devices/36-0062/module_reset_%d"
52-
#define MODULE_LPMODE_CPLD2_FORMAT "/sys/bus/i2c/devices/35-0061/module_lpmode_%d"
53-
#define MODULE_LPMODE_CPLD3_FORMAT "/sys/bus/i2c/devices/36-0062/module_lpmode_%d"
45+
#define MODULE_PRESENT_CPLD2_FORMAT "/sys/bus/i2c/devices/36-0061/module_present_%d"
46+
#define MODULE_PRESENT_CPLD3_FORMAT "/sys/bus/i2c/devices/37-0062/module_present_%d"
47+
#define MODULE_RXLOS_FORMAT "/sys/bus/i2c/devices/37-0062/module_rx_los_%d"
48+
#define MODULE_TXFAULT_FORMAT "/sys/bus/i2c/devices/37-0062/module_tx_fault_%d"
49+
#define MODULE_TXDISABLE_FORMAT "/sys/bus/i2c/devices/37-0062/module_tx_disable_%d"
50+
#define MODULE_RESET_CPLD2_FORMAT "/sys/bus/i2c/devices/36-0061/module_reset_%d"
51+
#define MODULE_RESET_CPLD3_FORMAT "/sys/bus/i2c/devices/37-0062/module_reset_%d"
52+
#define MODULE_LPMODE_CPLD2_FORMAT "/sys/bus/i2c/devices/36-0061/module_lpmode_%d"
53+
#define MODULE_LPMODE_CPLD3_FORMAT "/sys/bus/i2c/devices/37-0062/module_lpmode_%d"
5454

5555
#define NUM_OF_SFP_PORT 34
5656
static const int port_bus_index[NUM_OF_SFP_PORT] = {
57-
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
58-
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
59-
33, 34
57+
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
58+
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
59+
34, 35
6060
};
6161

6262
#define PORT_BUS_INDEX(port) (port_bus_index[port-1])

packages/platforms/accton/x86-64/as9737-32db/platform-config/r0/src/lib/x86-64-accton-as9737-32db-r0.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ x86-64-accton-as9737-32db-r0:
1818
--stop=1
1919
2020
kernel:
21-
<<: *kernel-5-4
21+
<<: *kernel-6-1
2222

2323
args: >-
2424
console=ttyS0,115200n8

packages/platforms/accton/x86-64/as9737-32db/platform-config/r0/src/python/x86_64_accton_as9737_32db_r0/__init__.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def init_ipmi():
7070
print('Failed to initialize IPMI dev interface')
7171
return False
7272

73+
def get_i2c_bus_num_offset():
74+
cmd = 'cat /sys/bus/i2c/devices/i2c-0/name'
75+
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
76+
stdout, stderr = process.communicate()
77+
return 1 if b'iSMT' in stdout else 0
78+
7379
class OnlPlatform_x86_64_accton_as9737_32db_r0(OnlPlatformAccton,
7480
OnlPlatformPortConfig_32x400_1x10_1x1):
7581
PLATFORM='x86-64-accton-as9737-32db-r0'
@@ -91,15 +97,17 @@ def baseconfig(self):
9197
for m in [ 'i2c-ocores', 'fpga', 'mux', 'cpld', 'fan', 'psu', 'thermal', 'sys', 'leds' ]:
9298
self.insmod("x86-64-accton-as9737-32db-%s.ko" % m)
9399

100+
bus_offset = get_i2c_bus_num_offset()
101+
94102
########### initialize I2C bus 0 ###########
95103
self.new_i2c_devices(
96104
[
97105
# initialize multiplexer (PCA9548)
98-
('as9737_32db_mux', 0x77, 0),
106+
('as9737_32db_mux', 0x77, 0+bus_offset),
99107

100108
# initialize CPLDs
101-
('as9737_32db_cpld2', 0x61, 35),
102-
('as9737_32db_cpld3', 0x62, 36),
109+
('as9737_32db_cpld2', 0x61, 36),
110+
('as9737_32db_cpld3', 0x62, 37),
103111

104112
# EEPROM
105113
#('24c02', 0x56, 0),
@@ -108,15 +116,15 @@ def baseconfig(self):
108116

109117
# initialize SFP devices
110118
for port in range(1, 17):
111-
subprocess.call('echo 0 > /sys/bus/i2c/devices/35-0061/module_reset_%d' % (port), shell=True)
119+
subprocess.call('echo 0 > /sys/bus/i2c/devices/36-0061/module_reset_%d' % (port), shell=True)
112120

113121
for port in range(17, 33):
114-
subprocess.call('echo 0 > /sys/bus/i2c/devices/36-0062/module_reset_%d' % (port), shell=True)
122+
subprocess.call('echo 0 > /sys/bus/i2c/devices/37-0062/module_reset_%d' % (port), shell=True)
115123

116124
sfp_bus = [
117-
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
118-
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
119-
33, 34
125+
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
126+
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
127+
34, 35
120128
]
121129

122130
for port in range(1, len(sfp_bus)+1):

0 commit comments

Comments
 (0)