Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux

This commit is contained in:
Jeffrey Townsend
2017-02-22 02:17:46 +00:00
15 changed files with 739 additions and 68 deletions

View File

@@ -25,6 +25,13 @@ default:
=: kernel-3.9.6-powerpc-e500v.bin.gz
<<: *e500v-kernel-package
e500v-3-16-package: &e500v-3-16-package
package: onl-kernel-3.16-lts-powerpc-e500v-all:powerpc
e500v-3.16: &e500v-3-16
=: kernel-3.16-lts-powerpc-e500v-all.bin.gz
<<: *e500v-3-16-package
e500mc-kernel-package: &e500mc-kernel-package
package: onl-kernel-3.8.13-powerpc-e500mc:powerpc

View File

@@ -257,17 +257,21 @@ _sff8436_qsfp_40g_pre(const uint8_t* idprom)
return 0;
}
static inline int
_sff8436_qsfp_40g_lm4(const uint8_t* idprom)
{
if(!SFF8436_MODULE_QSFP_PLUS_V2(idprom)) {
return 0;
}
/* Restrict to Finisar FTL4C3QE1C at this point. */
if(strncmp("FTL4C3QE1C ", (char*)idprom+168, 16)) {
if (idprom[130] != SFF8436_CONN_LC) return 0;
if (!SFF8436_MEDIA_NONE(idprom)) return 0;
if ((idprom[142] != 1) && idprom[143] != 70) {
return 0;
}
return SFF8436_MEDIA_NONE(idprom);
return 1;
}
static inline int

View File

@@ -10,7 +10,7 @@ powerpc-accton-as5610-52x-r0:
flat_image_tree:
kernel:
<<: *e500v-kernel
<<: *e500v-3-16
dtb:
=: powerpc-accton-as5610-52x-r0.dtb
package: onl-platform-build-powerpc-accton-as5610-52x-r0:powerpc

View File

@@ -210,11 +210,11 @@ extern aim_map_si_t thermal_oid_desc_map[];
/* This is the fan controller in F2B mode */
#define SYS_CONTROLLER_PREFIX_F2B \
"/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-5/5-002c"
"/sys/bus/i2c/devices/5-002c"
/* This is the fan controller in B2F mode */
#define SYS_CONTROLLER_PREFIX_B2F \
"/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-6/6-002f"
"/sys/bus/i2c/devices/6-002f"
/* The temperature controller for both modes */
#define SYS_CONTROLLER_PREFIX_TEMPERATURE SYS_CONTROLLER_PREFIX_F2B
@@ -223,10 +223,10 @@ extern aim_map_si_t thermal_oid_desc_map[];
* PSU1 and PSU2 sys paths
*/
#define SYS_PSU1_PREFIX \
"/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-7/7-0058"
"/sys/bus/i2c/devices/7-0058/hwmon/hwmon1"
#define SYS_PSU2_PREFIX \
"/sys/devices/e0000000.soc8541/e0003000.i2c/i2c-0/i2c-8/8-0059"
"/sys/bus/i2c/devices/8-0059/hwmon/hwmon2"
#include "system.h"

View File

@@ -11,7 +11,7 @@ powerpc-quanta-lb9-r0:
flat_image_tree:
kernel:
<<: *e500v-kernel
<<: *e500v-3-16
dtb:
=: powerpc-quanta-lb9-r0.dtb
package: onl-platform-build-powerpc-quanta-lb9-r0:powerpc

View File

@@ -1 +1 @@
!include $ONL_TEMPLATES/no-platform-modules.yml ARCH=powerpc VENDOR=quanta BASENAME=powerpc-quanta-ly2
!include $ONL_TEMPLATES/platform-modules.yml ARCH=powerpc VENDOR=quanta BASENAME=powerpc-quanta-ly2 KERNELS="onl-kernel-3.16-lts-powerpc-e500v-all:powerpc"

View File

@@ -0,0 +1,6 @@
KERNELS := onl-kernel-3.16-lts-powerpc-e500v-all:powerpc
KMODULES := $(wildcard *.c)
VENDOR := quanta
BASENAME := powerpc-quanta-ly2
ARCH := powerpc
include $(ONL)/make/kmodule.mk

View File

@@ -0,0 +1,297 @@
/*
* <bsn.cl fy=2013 v=gpl>
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
* This program is free software; you can redistribute it
* and/or modify it under the terms ofthe GNU General Public License as
* published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
*
* </bsn.cl>
*
* A hwmon driver for the Quanta LYx
*/
#include <linux/module.h>
#include <linux/jiffies.h>
#include <linux/i2c.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/log2.h>
#include <linux/kthread.h>
#include <linux/slab.h>
static const unsigned short normal_i2c[] = { 0x2C, 0x2E, 0x2F, I2C_CLIENT_END };
#define QUANTA_LY_HWMON_REG_TEMP_INPUT_BASE 0x30
#define QUANTA_LY_HWMON_REG_FAN_MODE 0x55
#define QUANTA_LY_HWMON_REG_FAN_DIR 0x56
#define QUANTA_LY_HWMON_REG_FAN_PWM_BASE 0x60
#define QUANTA_LY_HWMON_REG_FAN_INPUT_BASE 0x80
#define QUANTA_LY_HWMON_FAN_MANUAL_MODE 1
#define QUANTA_LY_HWMON_FAN_AUTO_MODE 2
#define QUANTA_LY_HWMON_NUM_FANS 8
struct quanta_ly_hwmon_data {
struct device *hwmon_dev;
struct attribute_group attrs;
struct mutex lock;
};
static int quanta_ly_hwmon_probe(struct i2c_client *client,
const struct i2c_device_id *id);
static int quanta_ly_hwmon_remove(struct i2c_client *client);
static const struct i2c_device_id quanta_ly_hwmon_id[] = {
{ "quanta_ly_hwmon", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, quanta_ly_hwmon_id);
static struct i2c_driver quanta_ly_hwmon_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "quanta_ly_hwmon",
},
.probe = quanta_ly_hwmon_probe,
.remove = quanta_ly_hwmon_remove,
.id_table = quanta_ly_hwmon_id,
.address_list = normal_i2c,
};
static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev);
struct quanta_ly_hwmon_data *data = i2c_get_clientdata(client);
int temp;
mutex_lock(&data->lock);
temp = i2c_smbus_read_byte_data(client,
QUANTA_LY_HWMON_REG_TEMP_INPUT_BASE
+ attr->index);
mutex_unlock(&data->lock);
return sprintf(buf, "%d\n", 1000 * temp);
}
static ssize_t show_fan(struct device *dev, struct device_attribute *devattr,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev);
struct quanta_ly_hwmon_data *data = i2c_get_clientdata(client);
int fan;
mutex_lock(&data->lock);
fan = i2c_smbus_read_word_swapped(client,
QUANTA_LY_HWMON_REG_FAN_INPUT_BASE
+ 2 * attr->index);
mutex_unlock(&data->lock);
return sprintf(buf, "%d\n", fan);
}
static ssize_t show_pwm(struct device *dev, struct device_attribute *devattr,
char *buf)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev);
struct quanta_ly_hwmon_data *data = i2c_get_clientdata(client);
int pwm;
mutex_lock(&data->lock);
pwm = i2c_smbus_read_word_swapped(client,
QUANTA_LY_HWMON_REG_FAN_PWM_BASE
+ 2 * attr->index);
mutex_unlock(&data->lock);
return sprintf(buf, "%d\n", pwm * 255 / 10000);
}
static ssize_t set_pwm(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count)
{
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct i2c_client *client = to_i2c_client(dev);
struct quanta_ly_hwmon_data *data = i2c_get_clientdata(client);
long val;
int ret;
ret = kstrtol(buf, 10, &val);
if (ret)
return ret;
mutex_lock(&data->lock);
i2c_smbus_write_word_swapped(client,
QUANTA_LY_HWMON_REG_FAN_PWM_BASE
+ 2 * attr->index, val * 10000 / 255);
mutex_unlock(&data->lock);
return count;
}
static ssize_t show_fan_dir(struct device *dev,
struct device_attribute *devattr, char *buf)
{
struct i2c_client *client = to_i2c_client(dev);
struct quanta_ly_hwmon_data *data = i2c_get_clientdata(client);
int f2b = 0;
int b2f = 0;
int i;
mutex_lock(&data->lock);
for(i = 0; i < 4; i++) {
f2b += i2c_smbus_read_word_swapped(client,
QUANTA_LY_HWMON_REG_FAN_INPUT_BASE
+ 2 * i);
}
for(i = 4; i < 8; i++) {
b2f += i2c_smbus_read_word_swapped(client,
QUANTA_LY_HWMON_REG_FAN_INPUT_BASE
+ 2 * i);
}
mutex_unlock(&data->lock);
if(f2b) {
return sprintf(buf, "front-to-back");
}
if(b2f) {
return sprintf(buf, "back-to-front");
}
return sprintf(buf, "unknown");
}
static ssize_t set_fan_dir(struct device *dev,
struct device_attribute *devattr, const char *buf,
size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
struct quanta_ly_hwmon_data *data = i2c_get_clientdata(client);
int dir;
if (!strncmp(buf, "normal", 6))
dir = 0;
else if (!strncmp(buf, "reverse", 7))
dir = 1;
else
return -EINVAL;
mutex_lock(&data->lock);
i2c_smbus_write_byte_data(client,
QUANTA_LY_HWMON_REG_FAN_DIR, dir);
mutex_unlock(&data->lock);
return count;
}
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1);
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_temp, NULL, 2);
static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_temp, NULL, 3);
static SENSOR_DEVICE_ATTR(temp5_input, S_IRUGO, show_temp, NULL, 4);
static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan, NULL, 0);
static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan, NULL, 1);
static SENSOR_DEVICE_ATTR(fan3_input, S_IRUGO, show_fan, NULL, 2);
static SENSOR_DEVICE_ATTR(fan4_input, S_IRUGO, show_fan, NULL, 3);
static SENSOR_DEVICE_ATTR(fan5_input, S_IRUGO, show_fan, NULL, 4);
static SENSOR_DEVICE_ATTR(fan6_input, S_IRUGO, show_fan, NULL, 5);
static SENSOR_DEVICE_ATTR(fan7_input, S_IRUGO, show_fan, NULL, 6);
static SENSOR_DEVICE_ATTR(fan8_input, S_IRUGO, show_fan, NULL, 7);
static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0);
static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1);
static SENSOR_DEVICE_ATTR(pwm3, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 2);
static SENSOR_DEVICE_ATTR(pwm4, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 3);
static SENSOR_DEVICE_ATTR(pwm5, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 4);
static SENSOR_DEVICE_ATTR(pwm6, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 5);
static SENSOR_DEVICE_ATTR(pwm7, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 6);
static SENSOR_DEVICE_ATTR(pwm8, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 7);
static SENSOR_DEVICE_ATTR(fan_dir, S_IWUSR | S_IRUGO, show_fan_dir,
set_fan_dir, 0);
static struct attribute *quanta_ly_hwmon_attr[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr,
&sensor_dev_attr_temp2_input.dev_attr.attr,
&sensor_dev_attr_temp3_input.dev_attr.attr,
&sensor_dev_attr_temp4_input.dev_attr.attr,
&sensor_dev_attr_temp5_input.dev_attr.attr,
&sensor_dev_attr_fan1_input.dev_attr.attr,
&sensor_dev_attr_fan2_input.dev_attr.attr,
&sensor_dev_attr_fan3_input.dev_attr.attr,
&sensor_dev_attr_fan4_input.dev_attr.attr,
&sensor_dev_attr_fan5_input.dev_attr.attr,
&sensor_dev_attr_fan6_input.dev_attr.attr,
&sensor_dev_attr_fan7_input.dev_attr.attr,
&sensor_dev_attr_fan8_input.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm2.dev_attr.attr,
&sensor_dev_attr_pwm3.dev_attr.attr,
&sensor_dev_attr_pwm4.dev_attr.attr,
&sensor_dev_attr_pwm5.dev_attr.attr,
&sensor_dev_attr_pwm6.dev_attr.attr,
&sensor_dev_attr_pwm7.dev_attr.attr,
&sensor_dev_attr_pwm8.dev_attr.attr,
&sensor_dev_attr_fan_dir.dev_attr.attr,
NULL
};
static int quanta_ly_hwmon_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct quanta_ly_hwmon_data *data;
int err;
int i;
data = devm_kzalloc(&client->dev, sizeof(struct quanta_ly_hwmon_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
mutex_init(&data->lock);
dev_info(&client->dev, "%s chip found\n", client->name);
data->attrs.attrs = quanta_ly_hwmon_attr;
err = sysfs_create_group(&client->dev.kobj, &data->attrs);
if (err)
return err;
data->hwmon_dev = hwmon_device_register(&client->dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
goto exit_remove;
}
i2c_smbus_write_byte_data(client,
QUANTA_LY_HWMON_REG_FAN_MODE,
QUANTA_LY_HWMON_FAN_MANUAL_MODE);
for (i = 0; i < QUANTA_LY_HWMON_NUM_FANS; i++) {
u8 cmd = QUANTA_LY_HWMON_REG_FAN_PWM_BASE + i * 2;
i2c_smbus_write_word_swapped(client, cmd, 10000);
}
return 0;
exit_remove:
sysfs_remove_group(&client->dev.kobj, &data->attrs);
return err;
}
static int quanta_ly_hwmon_remove(struct i2c_client *client)
{
struct quanta_ly_hwmon_data *data = i2c_get_clientdata(client);
hwmon_device_unregister(data->hwmon_dev);
sysfs_remove_group(&client->dev.kobj, &data->attrs);
return 0;
}
module_i2c_driver(quanta_ly_hwmon_driver);
MODULE_AUTHOR("Big Switch Networks <support@bigswitch.com>");
MODULE_DESCRIPTION("Quanta LYx hardware monitor driver");
MODULE_LICENSE("GPL");

View File

@@ -0,0 +1,355 @@
/*
* <bsn.cl fy=2013 v=gpl>
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
* This program is free software; you can redistribute it
* and/or modify it under the terms ofthe GNU General Public License as
* published by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
*
*
* </bsn.cl>
*
* An I2C multiplexer driver for the Quanta LY2
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/gpio.h>
#define QUANTA_LY2_I2C_MUX_CHANNEL_FIRST 1
#define QUANTA_LY2_I2C_MUX_NUM_CHANNELS 16
/*
* 16 read GPIOs, 8 write GPIOs,
* treat them as a single GPIO chip,
* with the read GPIOs occurring first
*/
#define QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS 16
#define QUANTA_LY2_I2C_MUX_NUM_WRITE_GPIOS 8
#define QUANTA_LY2_I2C_MUX_CMD_GET_GPIO 0
#define QUANTA_LY2_I2C_MUX_CMD_SET_GPIO 1
#define QUANTA_LY2_I2C_MUX_CMD_SET_CHANNEL 2
struct quanta_ly2_i2c_mux {
struct i2c_client *client;
struct i2c_adapter *chan_adap[QUANTA_LY2_I2C_MUX_NUM_CHANNELS];
struct gpio_chip gpio_chip;
u8 last_chan;
u8 gpio_write_val;
};
static const struct i2c_device_id quanta_ly2_i2c_mux_id[] = {
{"quanta_ly_i2c_mux", 0},
{"quanta_ly2_i2c_mux", 0},
{}
};
MODULE_DEVICE_TABLE(i2c, quanta_ly2_i2c_mux_id);
/*
* pld.c does 3-byte transactions, but none of the GPIO
* definitions require more than 16 bits
*/
static int quanta_ly2_i2c_mux_reg_read(struct i2c_adapter *adap,
struct i2c_client *client,
u8 command, u16 *val)
{
int ret = -ENODEV;
if (adap->algo->master_xfer) {
struct i2c_msg msg[2];
char buf[4];
msg[0].addr = client->addr;
msg[0].flags = 0;
msg[0].len = 1;
buf[0] = command;
msg[0].buf = &buf[0];
/* always receive 3 bytes, else the PLD freaks out */
msg[1].addr = client->addr;
msg[1].flags = I2C_M_RD;
msg[1].len = 3;
msg[1].buf = &buf[1];
ret = adap->algo->master_xfer(adap, msg, 2);
if (val != NULL && ret > -1)
*val = ((buf[2] << 8) | buf[1]);
} else {
union i2c_smbus_data data;
data.block[0] = 3; /* block transfer length */
ret = adap->algo->smbus_xfer(adap, client->addr,
client->flags,
I2C_SMBUS_READ,
command,
I2C_SMBUS_I2C_BLOCK_DATA, &data);
if (val != NULL)
*val = ((data.block[2] << 8) | data.block[1]);
}
return ret;
}
/*
* pld.c shows 3-byte output transactions;
* in our case we only need 8 bits to
* (1) select one of the 16 muxed i2c devices,
* (2) drive one of the 8 defined GPIO outputs
*/
static int quanta_ly2_i2c_mux_reg_write(struct i2c_adapter *adap,
struct i2c_client *client,
u8 command, u8 val)
{
int ret = -ENODEV;
if (adap->algo->master_xfer) {
struct i2c_msg msg;
char buf[4];
msg.addr = client->addr;
msg.flags = 0;
msg.len = 3;
buf[0] = command;
buf[1] = val;
buf[2] = 0;
buf[3] = 0;
msg.buf = buf;
ret = adap->algo->master_xfer(adap, &msg, 1);
} else {
union i2c_smbus_data data;
data.block[0] = 3;
data.block[1] = val;
data.block[2] = 0;
data.block[3] = 0;
ret = adap->algo->smbus_xfer(adap, client->addr,
client->flags,
I2C_SMBUS_WRITE,
command,
I2C_SMBUS_I2C_BLOCK_DATA, &data);
}
return ret;
}
static void quanta_ly2_i2c_mux_gpio_set(struct gpio_chip *gc, unsigned offset,
int val)
{
struct quanta_ly2_i2c_mux *data = container_of(
gc, struct quanta_ly2_i2c_mux, gpio_chip);
/* ignore write attempts to input GPIOs */
if (offset < QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS) {
dev_warn(&data->client->dev,
"ignoring GPIO write for input for pin %d\n",
offset);
return;
}
offset -= QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS;
if (val)
data->gpio_write_val |= (1 << offset);
else
data->gpio_write_val &= ~(1 << offset);
quanta_ly2_i2c_mux_reg_write(
data->client->adapter, data->client,
QUANTA_LY2_I2C_MUX_CMD_SET_GPIO,
data->gpio_write_val);
}
/*
* "read" one of the GPIOs.
* The first 16 (QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS)
* are actual input GPIOs.
* the last 8 (QUANTA_LY2_I2C_MUX_NUM_WRITE_GPIOS)
* are output GPIOs, so readback just returns the cached value.
*/
static int quanta_ly2_i2c_mux_gpio_get(struct gpio_chip *gc, unsigned offset)
{
int ret;
u16 buf;
struct quanta_ly2_i2c_mux *data = container_of(
gc, struct quanta_ly2_i2c_mux, gpio_chip);
if (offset >= QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS) {
offset -= QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS;
return (data->gpio_write_val & (1 << offset)) ? 1 : 0;
}
/* else, do a proper gpio read */
buf = 0;
ret = quanta_ly2_i2c_mux_reg_read(data->client->adapter,
data->client,
QUANTA_LY2_I2C_MUX_CMD_GET_GPIO,
&buf);
if (ret < 0) {
dev_err(&data->client->dev,
"quanta_ly2_i2c_mux_reg_read failed\n");
return 0;
}
return (buf & (1 << offset)) ? 1 : 0;
}
static int quanta_ly2_i2c_mux_select_chan(struct i2c_adapter *adap,
void *client, u32 chan)
{
struct quanta_ly2_i2c_mux *data = i2c_get_clientdata(client);
int ret = 0;
u32 c = QUANTA_LY2_I2C_MUX_CHANNEL_FIRST + chan;
if (data->last_chan != c) {
ret = quanta_ly2_i2c_mux_reg_write(
adap, client,
QUANTA_LY2_I2C_MUX_CMD_SET_CHANNEL, c);
data->last_chan = c;
}
return ret;
}
static int quanta_ly2_i2c_mux_release_chan(struct i2c_adapter *adap,
void *client, u32 chan)
{
struct quanta_ly2_i2c_mux *data = i2c_get_clientdata(client);
int ret = 0;
ret = quanta_ly2_i2c_mux_reg_write(
adap, client,
QUANTA_LY2_I2C_MUX_CMD_SET_CHANNEL, 0);
data->last_chan = 0;
return ret;
}
static struct gpio_chip quanta_ly2_i2c_mux_gpio_chip = {
.label = "quanta_ly2_i2c_mux_gpio_chip",
.owner = THIS_MODULE,
.ngpio = QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS + QUANTA_LY2_I2C_MUX_NUM_WRITE_GPIOS,
.base = -1,
.set = quanta_ly2_i2c_mux_gpio_set,
.get = quanta_ly2_i2c_mux_gpio_get,
};
static int quanta_ly2_i2c_mux_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct i2c_adapter *adap = client->adapter;
int chan;
struct quanta_ly2_i2c_mux *data;
int ret = -ENODEV;
if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA))
goto err;
data = kzalloc(sizeof(struct quanta_ly2_i2c_mux), GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto err;
}
i2c_set_clientdata(client, data);
data->client = client;
if (i2c_smbus_write_byte(client, 0) < 0) {
dev_warn(&client->dev, "probe failed\n");
goto exit_free;
}
i2c_lock_adapter(adap);
quanta_ly2_i2c_mux_release_chan(adap, client, 0);
i2c_unlock_adapter(adap);
for (chan = 0; chan < QUANTA_LY2_I2C_MUX_NUM_CHANNELS; chan++) {
data->chan_adap[chan] =
i2c_add_mux_adapter(adap, &client->dev, client,
0, chan, 0,
quanta_ly2_i2c_mux_select_chan,
quanta_ly2_i2c_mux_release_chan);
if (data->chan_adap[chan] == NULL) {
ret = -ENODEV;
dev_err(&client->dev,
"failed to register multiplexed adapter %d\n",
chan);
goto adap_reg_failed;
}
}
dev_info(&client->dev,
"registered %d multiplexed buses for I2C mux %s\n",
chan, client->name);
data->gpio_chip = quanta_ly2_i2c_mux_gpio_chip;
data->gpio_chip.dev = &client->dev;
data->gpio_write_val = 0xff;
ret = gpiochip_add(&data->gpio_chip);
if (ret) {
dev_err(&client->dev, "failed to register GPIOs\n");
goto adap_reg_failed;
}
dev_info(&client->dev,
"registered GPIOs for I2C mux %s (%d read, %d write)\n",
client->name,
QUANTA_LY2_I2C_MUX_NUM_READ_GPIOS,
QUANTA_LY2_I2C_MUX_NUM_WRITE_GPIOS);
return 0;
adap_reg_failed:
for (chan--; chan >= 0; chan--)
i2c_del_mux_adapter(data->chan_adap[chan]);
exit_free:
kfree(data);
err:
return ret;
}
static int quanta_ly2_i2c_mux_remove(struct i2c_client *client)
{
struct quanta_ly2_i2c_mux *data = i2c_get_clientdata(client);
int chan, ret;
for (chan = 0; chan < QUANTA_LY2_I2C_MUX_NUM_CHANNELS; chan++)
if (data->chan_adap[chan]) {
i2c_del_mux_adapter(data->chan_adap[chan]);
data->chan_adap[chan] = NULL;
}
ret = gpiochip_remove(&data->gpio_chip);
if (ret)
return ret;
kfree(data);
return 0;
}
static struct i2c_driver quanta_ly2_i2c_mux_driver = {
.driver = {
.name = "quanta_ly2_i2c_mux",
.owner = THIS_MODULE,
},
.probe = quanta_ly2_i2c_mux_probe,
.remove = quanta_ly2_i2c_mux_remove,
.id_table = quanta_ly2_i2c_mux_id,
};
module_i2c_driver(quanta_ly2_i2c_mux_driver);
MODULE_AUTHOR("Big Switch Networks <support@bigswitch.com>");
MODULE_DESCRIPTION("Quanta LY2 I2C multiplexer driver");
MODULE_LICENSE("GPL");

View File

@@ -199,6 +199,6 @@ extern aim_map_si_t fan_oid_desc_map[];
/* <auto.end.enum(ALL).header> */
#define SYS_HWMON_PREFIX "/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-4/4-002e"
#define SYS_HWMON_PREFIX "/sys/devices/soc@ffe00000/ffe03000.i2c/i2c-0/i2c-4/4-002e"
#endif /* __POWERPC_QUANTA_LY2_R0_INT_H__ */

View File

@@ -50,8 +50,8 @@ static onlp_psu_info_t psus__[] = {
char* psu_paths[] = {
NULL, /* Not used */
"/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-6/6-0058",
"/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-7/7-0059",
"/sys/bus/i2c/devices/6-0058/hwmon/hwmon0",
"/sys/bus/i2c/devices/7-0059/hwmon/hwmon1",
};
int

View File

@@ -44,58 +44,58 @@ typedef struct sfpmap_s {
static sfpmap_t sfpmap__[] =
{
{ 1, "/sys/class/gpio/gpio168/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-14/14-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-14/14-0051/eeprom" },
{ 2, "/sys/class/gpio/gpio169/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-15/15-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-15/15-0051/eeprom" },
{ 3, "/sys/class/gpio/gpio170/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-16/16-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-16/16-0051/eeprom" },
{ 4, "/sys/class/gpio/gpio171/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-17/17-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-17/17-0051/eeprom" },
{ 5, "/sys/class/gpio/gpio172/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-18/18-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-18/18-0051/eeprom" },
{ 6, "/sys/class/gpio/gpio173/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-19/19-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-19/19-0051/eeprom" },
{ 7, "/sys/class/gpio/gpio174/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-20/20-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-20/20-0051/eeprom" },
{ 8, "/sys/class/gpio/gpio175/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-21/21-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-21/21-0051/eeprom" },
{ 9, "/sys/class/gpio/gpio176/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-22/22-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-22/22-0051/eeprom" },
{ 10, "/sys/class/gpio/gpio177/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-23/23-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-23/23-0051/eeprom" },
{ 11, "/sys/class/gpio/gpio178/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-24/24-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-24/24-0051/eeprom" },
{ 12, "/sys/class/gpio/gpio179/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-25/25-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-25/25-0051/eeprom" },
{ 13, "/sys/class/gpio/gpio180/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-26/26-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-26/26-0051/eeprom" },
{ 14, "/sys/class/gpio/gpio181/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-27/27-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-27/27-0051/eeprom" },
{ 15, "/sys/class/gpio/gpio182/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-28/28-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-28/28-0051/eeprom" },
{ 16, "/sys/class/gpio/gpio183/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-29/29-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-29/29-0051/eeprom" },
{ 17, "/sys/class/gpio/gpio144/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-30/30-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-30/30-0051/eeprom" },
{ 18, "/sys/class/gpio/gpio145/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-31/31-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-31/31-0051/eeprom" },
{ 19, "/sys/class/gpio/gpio146/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-32/32-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-32/32-0051/eeprom" },
{ 20, "/sys/class/gpio/gpio147/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-33/33-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-33/33-0051/eeprom" },
{ 21, "/sys/class/gpio/gpio148/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-34/34-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-34/34-0051/eeprom" },
{ 22, "/sys/class/gpio/gpio149/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-35/35-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-35/35-0051/eeprom" },
{ 23, "/sys/class/gpio/gpio150/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-36/36-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-35/35-0051/eeprom" },
{ 24, "/sys/class/gpio/gpio151/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-37/37-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-37/37-0051/eeprom" },
{ 25, "/sys/class/gpio/gpio152/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-38/38-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-38/38-0051/eeprom" },
{ 26, "/sys/class/gpio/gpio153/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-39/39-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-39/39-0051/eeprom" },
{ 27, "/sys/class/gpio/gpio154/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-40/40-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-40/40-0051/eeprom" },
{ 28, "/sys/class/gpio/gpio155/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-41/41-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-41/41-0051/eeprom" },
{ 29, "/sys/class/gpio/gpio156/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-42/42-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-42/42-0051/eeprom" },
{ 30, "/sys/class/gpio/gpio157/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-43/43-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-43/43-0051/eeprom" },
{ 31, "/sys/class/gpio/gpio158/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-44/44-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-44/44-0051/eeprom" },
{ 32, "/sys/class/gpio/gpio159/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-45/45-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-45/45-0051/eeprom" },
{ 33, "/sys/class/gpio/gpio120/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-46/46-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-46/46-0051/eeprom" },
{ 34, "/sys/class/gpio/gpio121/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-47/47-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-47/47-0051/eeprom" },
{ 35, "/sys/class/gpio/gpio122/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-48/48-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-48/48-0051/eeprom" },
{ 36, "/sys/class/gpio/gpio123/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-49/49-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-49/49-0051/eeprom" },
{ 37, "/sys/class/gpio/gpio124/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-50/50-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-50/50-0051/eeprom" },
{ 38, "/sys/class/gpio/gpio125/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-51/51-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-51/51-0051/eeprom" },
{ 39, "/sys/class/gpio/gpio126/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-52/52-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-52/52-0051/eeprom" },
{ 40, "/sys/class/gpio/gpio127/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-53/53-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-53/53-0051/eeprom" },
{ 41, "/sys/class/gpio/gpio128/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-54/54-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-54/54-0051/eeprom" },
{ 42, "/sys/class/gpio/gpio129/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-55/55-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-55/55-0051/eeprom" },
{ 43, "/sys/class/gpio/gpio130/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-56/56-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-56/56-0051/eeprom" },
{ 44, "/sys/class/gpio/gpio131/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-57/57-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-57/57-0051/eeprom" },
{ 45, "/sys/class/gpio/gpio132/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-58/58-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-58/58-0051/eeprom" },
{ 46, "/sys/class/gpio/gpio133/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-59/59-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-59/59-0051/eeprom" },
{ 47, "/sys/class/gpio/gpio134/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-60/60-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-60/60-0051/eeprom" },
{ 48, "/sys/class/gpio/gpio135/value", NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-61/61-0050/eeprom", "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-61/61-0051/eeprom" },
{ 49, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-10/10-0050/eeprom", NULL },
{ 50, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-11/11-0050/eeprom", NULL },
{ 51, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-12/12-0050/eeprom", NULL },
{ 52, NULL, NULL, "/sys/devices/soc.0/ffe03100.i2c/i2c-1/i2c-13/13-0050/eeprom", NULL },
{ 1, "/sys/class/gpio/gpio168/value", NULL, "/sys/bus/i2c/devices/14-0050/eeprom", "/sys/bus/i2c/devices/14-0051/eeprom" },
{ 2, "/sys/class/gpio/gpio169/value", NULL, "/sys/bus/i2c/devices/15-0050/eeprom", "/sys/bus/i2c/devices/15-0051/eeprom" },
{ 3, "/sys/class/gpio/gpio170/value", NULL, "/sys/bus/i2c/devices/16-0050/eeprom", "/sys/bus/i2c/devices/16-0051/eeprom" },
{ 4, "/sys/class/gpio/gpio171/value", NULL, "/sys/bus/i2c/devices/17-0050/eeprom", "/sys/bus/i2c/devices/17-0051/eeprom" },
{ 5, "/sys/class/gpio/gpio172/value", NULL, "/sys/bus/i2c/devices/18-0050/eeprom", "/sys/bus/i2c/devices/18-0051/eeprom" },
{ 6, "/sys/class/gpio/gpio173/value", NULL, "/sys/bus/i2c/devices/19-0050/eeprom", "/sys/bus/i2c/devices/19-0051/eeprom" },
{ 7, "/sys/class/gpio/gpio174/value", NULL, "/sys/bus/i2c/devices/20-0050/eeprom", "/sys/bus/i2c/devices/20-0051/eeprom" },
{ 8, "/sys/class/gpio/gpio175/value", NULL, "/sys/bus/i2c/devices/21-0050/eeprom", "/sys/bus/i2c/devices/21-0051/eeprom" },
{ 9, "/sys/class/gpio/gpio176/value", NULL, "/sys/bus/i2c/devices/22-0050/eeprom", "/sys/bus/i2c/devices/22-0051/eeprom" },
{ 10, "/sys/class/gpio/gpio177/value", NULL, "/sys/bus/i2c/devices/23-0050/eeprom", "/sys/bus/i2c/devices/23-0051/eeprom" },
{ 11, "/sys/class/gpio/gpio178/value", NULL, "/sys/bus/i2c/devices/24-0050/eeprom", "/sys/bus/i2c/devices/24-0051/eeprom" },
{ 12, "/sys/class/gpio/gpio179/value", NULL, "/sys/bus/i2c/devices/25-0050/eeprom", "/sys/bus/i2c/devices/25-0051/eeprom" },
{ 13, "/sys/class/gpio/gpio180/value", NULL, "/sys/bus/i2c/devices/26-0050/eeprom", "/sys/bus/i2c/devices/26-0051/eeprom" },
{ 14, "/sys/class/gpio/gpio181/value", NULL, "/sys/bus/i2c/devices/27-0050/eeprom", "/sys/bus/i2c/devices/27-0051/eeprom" },
{ 15, "/sys/class/gpio/gpio182/value", NULL, "/sys/bus/i2c/devices/28-0050/eeprom", "/sys/bus/i2c/devices/28-0051/eeprom" },
{ 16, "/sys/class/gpio/gpio183/value", NULL, "/sys/bus/i2c/devices/29-0050/eeprom", "/sys/bus/i2c/devices/29-0051/eeprom" },
{ 17, "/sys/class/gpio/gpio144/value", NULL, "/sys/bus/i2c/devices/30-0050/eeprom", "/sys/bus/i2c/devices/30-0051/eeprom" },
{ 18, "/sys/class/gpio/gpio145/value", NULL, "/sys/bus/i2c/devices/31-0050/eeprom", "/sys/bus/i2c/devices/31-0051/eeprom" },
{ 19, "/sys/class/gpio/gpio146/value", NULL, "/sys/bus/i2c/devices/32-0050/eeprom", "/sys/bus/i2c/devices/32-0051/eeprom" },
{ 20, "/sys/class/gpio/gpio147/value", NULL, "/sys/bus/i2c/devices/33-0050/eeprom", "/sys/bus/i2c/devices/33-0051/eeprom" },
{ 21, "/sys/class/gpio/gpio148/value", NULL, "/sys/bus/i2c/devices/34-0050/eeprom", "/sys/bus/i2c/devices/34-0051/eeprom" },
{ 22, "/sys/class/gpio/gpio149/value", NULL, "/sys/bus/i2c/devices/35-0050/eeprom", "/sys/bus/i2c/devices/35-0051/eeprom" },
{ 23, "/sys/class/gpio/gpio150/value", NULL, "/sys/bus/i2c/devices/36-0050/eeprom", "/sys/bus/i2c/devices/35-0051/eeprom" },
{ 24, "/sys/class/gpio/gpio151/value", NULL, "/sys/bus/i2c/devices/37-0050/eeprom", "/sys/bus/i2c/devices/37-0051/eeprom" },
{ 25, "/sys/class/gpio/gpio152/value", NULL, "/sys/bus/i2c/devices/38-0050/eeprom", "/sys/bus/i2c/devices/38-0051/eeprom" },
{ 26, "/sys/class/gpio/gpio153/value", NULL, "/sys/bus/i2c/devices/39-0050/eeprom", "/sys/bus/i2c/devices/39-0051/eeprom" },
{ 27, "/sys/class/gpio/gpio154/value", NULL, "/sys/bus/i2c/devices/40-0050/eeprom", "/sys/bus/i2c/devices/40-0051/eeprom" },
{ 28, "/sys/class/gpio/gpio155/value", NULL, "/sys/bus/i2c/devices/41-0050/eeprom", "/sys/bus/i2c/devices/41-0051/eeprom" },
{ 29, "/sys/class/gpio/gpio156/value", NULL, "/sys/bus/i2c/devices/42-0050/eeprom", "/sys/bus/i2c/devices/42-0051/eeprom" },
{ 30, "/sys/class/gpio/gpio157/value", NULL, "/sys/bus/i2c/devices/43-0050/eeprom", "/sys/bus/i2c/devices/43-0051/eeprom" },
{ 31, "/sys/class/gpio/gpio158/value", NULL, "/sys/bus/i2c/devices/44-0050/eeprom", "/sys/bus/i2c/devices/44-0051/eeprom" },
{ 32, "/sys/class/gpio/gpio159/value", NULL, "/sys/bus/i2c/devices/45-0050/eeprom", "/sys/bus/i2c/devices/45-0051/eeprom" },
{ 33, "/sys/class/gpio/gpio120/value", NULL, "/sys/bus/i2c/devices/46-0050/eeprom", "/sys/bus/i2c/devices/46-0051/eeprom" },
{ 34, "/sys/class/gpio/gpio121/value", NULL, "/sys/bus/i2c/devices/47-0050/eeprom", "/sys/bus/i2c/devices/47-0051/eeprom" },
{ 35, "/sys/class/gpio/gpio122/value", NULL, "/sys/bus/i2c/devices/48-0050/eeprom", "/sys/bus/i2c/devices/48-0051/eeprom" },
{ 36, "/sys/class/gpio/gpio123/value", NULL, "/sys/bus/i2c/devices/49-0050/eeprom", "/sys/bus/i2c/devices/49-0051/eeprom" },
{ 37, "/sys/class/gpio/gpio124/value", NULL, "/sys/bus/i2c/devices/50-0050/eeprom", "/sys/bus/i2c/devices/50-0051/eeprom" },
{ 38, "/sys/class/gpio/gpio125/value", NULL, "/sys/bus/i2c/devices/51-0050/eeprom", "/sys/bus/i2c/devices/51-0051/eeprom" },
{ 39, "/sys/class/gpio/gpio126/value", NULL, "/sys/bus/i2c/devices/52-0050/eeprom", "/sys/bus/i2c/devices/52-0051/eeprom" },
{ 40, "/sys/class/gpio/gpio127/value", NULL, "/sys/bus/i2c/devices/53-0050/eeprom", "/sys/bus/i2c/devices/53-0051/eeprom" },
{ 41, "/sys/class/gpio/gpio128/value", NULL, "/sys/bus/i2c/devices/54-0050/eeprom", "/sys/bus/i2c/devices/54-0051/eeprom" },
{ 42, "/sys/class/gpio/gpio129/value", NULL, "/sys/bus/i2c/devices/55-0050/eeprom", "/sys/bus/i2c/devices/55-0051/eeprom" },
{ 43, "/sys/class/gpio/gpio130/value", NULL, "/sys/bus/i2c/devices/56-0050/eeprom", "/sys/bus/i2c/devices/56-0051/eeprom" },
{ 44, "/sys/class/gpio/gpio131/value", NULL, "/sys/bus/i2c/devices/57-0050/eeprom", "/sys/bus/i2c/devices/57-0051/eeprom" },
{ 45, "/sys/class/gpio/gpio132/value", NULL, "/sys/bus/i2c/devices/58-0050/eeprom", "/sys/bus/i2c/devices/58-0051/eeprom" },
{ 46, "/sys/class/gpio/gpio133/value", NULL, "/sys/bus/i2c/devices/59-0050/eeprom", "/sys/bus/i2c/devices/59-0051/eeprom" },
{ 47, "/sys/class/gpio/gpio134/value", NULL, "/sys/bus/i2c/devices/60-0050/eeprom", "/sys/bus/i2c/devices/60-0051/eeprom" },
{ 48, "/sys/class/gpio/gpio135/value", NULL, "/sys/bus/i2c/devices/61-0050/eeprom", "/sys/bus/i2c/devices/61-0051/eeprom" },
{ 49, NULL, NULL, "/sys/bus/i2c/devices/i2c-10/10-0050/eeprom", NULL },
{ 50, NULL, NULL, "/sys/bus/i2c/devices/i2c-11/11-0050/eeprom", NULL },
{ 51, NULL, NULL, "/sys/bus/i2c/devices/i2c-12/12-0050/eeprom", NULL },
{ 52, NULL, NULL, "/sys/bus/i2c/devices/i2c-13/13-0050/eeprom", NULL },
};

View File

@@ -24,7 +24,7 @@ onlp_sysi_init(void)
}
#define QUANTA_SYS_EEPROM_PATH \
"/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-2/2-0054/eeprom"
"/sys/bus/i2c/devices/2-0054/eeprom"
int
onlp_sysi_onie_info_get(onlp_onie_info_t* onie)

View File

@@ -10,7 +10,7 @@ powerpc-quanta-ly2-r0:
flat_image_tree:
kernel:
<<: *e500v-kernel
<<: *e500v-3-16
dtb:
=: powerpc-quanta-ly2-r0.dtb
package: onl-platform-build-powerpc-quanta-ly2-r0:powerpc

View File

@@ -11,9 +11,11 @@ class OnlPlatform_powerpc_quanta_ly2_r0(OnlPlatformQuanta,
SYS_OBJECT_ID=".3048.1"
def baseconfig(self):
self.insmod("quanta-ly2-i2c-mux.ko")
self.insmod("quanta-ly-hwmon.ko")
subprocess.check_call("%s/sbin/gpio_init" % self.basedir_onl())
fan_dir='/sys/devices/soc.0/ffe03000.i2c/i2c-0/i2c-4/4-002e/fan_dir'
fan_dir='/sys/bus/i2c/devices/4-002e/fan_dir'
if os.path.exists(fan_dir):
with open(fan_dir) as f:
data = f.read()