mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 17:27:01 +00:00
Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#define SFP_HWMON_NODE(node) SFP_HWMON_PREFIX#node
|
||||
#define SFP_HWMON_DOM_PREFIX "/sys/bus/i2c/devices/3-0051/"
|
||||
#define SFP_HWMON_DOM_NODE(node) SFP_HWMON_DOM_PREFIX#node
|
||||
#define SFP_BUS 3
|
||||
|
||||
int deviceNodeWriteInt(char *filename, int value, int data_len);
|
||||
int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len);
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <onlplib/i2c.h>
|
||||
#include "platform_lib.h"
|
||||
|
||||
static int
|
||||
@@ -333,6 +333,75 @@ onlp_sfpi_dom_read(int port, uint8_t data[256])
|
||||
return ONLP_STATUS_OK;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dev_readb(int port, uint8_t devaddr, uint8_t addr)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (set_active_port(port+1) != 0) {
|
||||
AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
rc= onlp_i2c_readb(SFP_BUS, devaddr, addr, ONLP_I2C_F_FORCE);
|
||||
|
||||
set_active_port(0);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (set_active_port(port+1) != 0) {
|
||||
AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
rc = onlp_i2c_writeb(SFP_BUS, devaddr, addr, value, ONLP_I2C_F_FORCE);
|
||||
|
||||
set_active_port(0);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (set_active_port(port+1) != 0) {
|
||||
AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
rc= onlp_i2c_readw(SFP_BUS, devaddr, addr, ONLP_I2C_F_FORCE);
|
||||
|
||||
set_active_port(0);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (set_active_port(port+1) != 0) {
|
||||
AIM_LOG_ERROR("Unable to set active port(%d)\r\n", port);
|
||||
return ONLP_STATUS_E_INTERNAL;
|
||||
}
|
||||
|
||||
rc = onlp_i2c_writew(SFP_BUS, devaddr, addr, value, ONLP_I2C_F_FORCE);
|
||||
|
||||
set_active_port(0);
|
||||
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user