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
@@ -1,34 +1,34 @@
# name lanes alias index speed
Ethernet0 1,2,3,4 hundredGigE1/1 1 100000
Ethernet4 5,6,7,8 hundredGigE1/2 2 100000
Ethernet8 9,10,11,12 hundredGigE1/3 3 100000
Ethernet12 13,14,15,16 hundredGigE1/4 4 100000
Ethernet16 17,18,19,20 hundredGigE1/5 5 100000
Ethernet20 21,22,23,24 hundredGigE1/6 6 100000
Ethernet24 25,26,27,28 hundredGigE1/7 7 100000
Ethernet28 29,30,31,32 hundredGigE1/8 8 100000
Ethernet32 33,34,35,36 hundredGigE1/9 9 100000
Ethernet36 37,38,39,40 hundredGigE1/10 10 100000
Ethernet40 41,42,43,44 hundredGigE1/11 11 100000
Ethernet44 45,46,47,48 hundredGigE1/12 12 100000
Ethernet48 49,50,51,52 hundredGigE1/13 13 100000
Ethernet52 53,54,55,56 hundredGigE1/14 14 100000
Ethernet56 57,58,59,60 hundredGigE1/15 15 100000
Ethernet60 61,62,63,64 hundredGigE1/16 16 100000
Ethernet64 65,66,67,68 hundredGigE1/17 17 100000
Ethernet68 69,70,71,72 hundredGigE1/18 18 100000
Ethernet72 73,74,75,76 hundredGigE1/19 19 100000
Ethernet76 77,78,79,80 hundredGigE1/20 20 100000
Ethernet80 81,82,83,84 hundredGigE1/21 21 100000
Ethernet84 85,86,87,88 hundredGigE1/22 22 100000
Ethernet88 89,90,91,92 hundredGigE1/23 23 100000
Ethernet92 93,94,95,96 hundredGigE1/24 24 100000
Ethernet96 97,98,99,100 hundredGigE1/25 25 100000
Ethernet100 101,102,103,104 hundredGigE1/26 26 100000
Ethernet104 105,106,107,108 hundredGigE1/27 27 100000
Ethernet108 109,110,111,112 hundredGigE1/28 28 100000
Ethernet112 113,114,115,116 hundredGigE1/29 29 100000
Ethernet116 117,118,119,120 hundredGigE1/30 30 100000
Ethernet120 121,122,123,124 hundredGigE1/31 31 100000
Ethernet124 125,126,127,128 hundredGigE1/32 32 100000
Ethernet128 129 tenGigE1/33 33 10000
Ethernet0 1,2,3,4 hundredGigE1/1 0 100000
Ethernet4 5,6,7,8 hundredGigE1/2 1 100000
Ethernet8 9,10,11,12 hundredGigE1/3 2 100000
Ethernet12 13,14,15,16 hundredGigE1/4 3 100000
Ethernet16 17,18,19,20 hundredGigE1/5 4 100000
Ethernet20 21,22,23,24 hundredGigE1/6 5 100000
Ethernet24 25,26,27,28 hundredGigE1/7 6 100000
Ethernet28 29,30,31,32 hundredGigE1/8 7 100000
Ethernet32 33,34,35,36 hundredGigE1/9 8 100000
Ethernet36 37,38,39,40 hundredGigE1/10 9 100000
Ethernet40 41,42,43,44 hundredGigE1/11 10 100000
Ethernet44 45,46,47,48 hundredGigE1/12 11 100000
Ethernet48 49,50,51,52 hundredGigE1/13 12 100000
Ethernet52 53,54,55,56 hundredGigE1/14 13 100000
Ethernet56 57,58,59,60 hundredGigE1/15 14 100000
Ethernet60 61,62,63,64 hundredGigE1/16 15 100000
Ethernet64 65,66,67,68 hundredGigE1/17 16 100000
Ethernet68 69,70,71,72 hundredGigE1/18 17 100000
Ethernet72 73,74,75,76 hundredGigE1/19 18 100000
Ethernet76 77,78,79,80 hundredGigE1/20 19 100000
Ethernet80 81,82,83,84 hundredGigE1/21 20 100000
Ethernet84 85,86,87,88 hundredGigE1/22 21 100000
Ethernet88 89,90,91,92 hundredGigE1/23 22 100000
Ethernet92 93,94,95,96 hundredGigE1/24 23 100000
Ethernet96 97,98,99,100 hundredGigE1/25 24 100000
Ethernet100 101,102,103,104 hundredGigE1/26 25 100000
Ethernet104 105,106,107,108 hundredGigE1/27 26 100000
Ethernet108 109,110,111,112 hundredGigE1/28 27 100000
Ethernet112 113,114,115,116 hundredGigE1/29 28 100000
Ethernet116 117,118,119,120 hundredGigE1/30 29 100000
Ethernet120 121,122,123,124 hundredGigE1/31 30 100000
Ethernet124 125,126,127,128 hundredGigE1/32 31 100000
Ethernet128 129 tenGigE1/33 32 10000
8 changes: 4 additions & 4 deletions device/delta/x86_64-delta_ag9032v2a-r0/plugins/sfputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_presence(self, port_num):
reg_value = int(content, 16)

# Mask off the bit corresponding to our port
mask = (1 << port_num)
mask = (1 << (self.port_end - port_num + 7))

# ModPrsL is active low
if reg_value & mask == 0:
Expand All @@ -86,7 +86,7 @@ def get_low_power_mode(self, port_num):
reg_value = int(content, 16)

# Mask off the bit corresponding to our port
mask = (1 << port_num)
mask = (1 << (self.port_end - port_num) - 1)

# LPMode is active high
if reg_value & mask == 0:
Expand All @@ -111,7 +111,7 @@ def set_low_power_mode(self, port_num, lpmode):
reg_value = int(content, 16)

# Mask off the bit corresponding to our port
mask = (1 << port_num)
mask = (1 << (self.port_end - port_num) - 1)

# LPMode is active high; set or clear the bit accordingly
if lpmode is True:
Expand Down Expand Up @@ -147,7 +147,7 @@ def reset(self, port_num):
reg_value = int(content, 16)

# Mask off the bit corresponding to our port
mask = (1 << port_num)
mask = (1 << (self.port_end - port_num) - 1)

# ResetL is active low
reg_value = reg_value & ~mask
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,53 +566,53 @@ static ssize_t for_status(struct device *dev, struct device_attribute *dev_attr,
mutex_lock(&dni_lock);
switch (attr->index) {
case SFP_IS_PRESENT:
/*QSFP1~8*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_1);
data = (u32)(reverse_8bits(ret) & 0xff);
/*QSFP9~16*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_2);
data |= (u32)(reverse_8bits(ret) & 0xff) << 8;
/*QSFP17~24*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_3);
data |= (u32)(reverse_8bits(ret) & 0xff) << 16;
/*QSFP25~32*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_4);
data |= (u32)(reverse_8bits(ret) & 0xff) << 24;
data = (u32)ret & 0xff;
/*QSFP17~24*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_3);
data |= ((u32)ret & 0xff) << 8;
/*QSFP9~16*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_2);
data |= (u32)(ret & 0xff) << 16;
/*QSFP1~8*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_1);
data |= (u32)(ret & 0xff) << 24;
Comment on lines -569 to +580
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about reading from _1 to _4 but shift the data position first and | with return value for each reading, something like below?
data = (data<<8)|((u32)(ret&0xff))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attribute is show all present result like 0xFFFF from port1 to port 32.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of moving ret value with different shifting value, shifting the data 8bit to the left each time before or-ing the ret value will give same shifting for each ret value. then only 8bit shifter not three different shifter (8bit, 16bit, and 24bit).
'''
data=0;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_1);
data <<8;
data |= (u32)ret&0xff;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_2);
data <<8;
data |= (u32)ret&0xff;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_3);
data <<8;
data |= (u32)ret&0xff;
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_PRESENCE_4);
data <<8;
data |= (u32)ret&0xff;
'''
you can make it more simpler with macro definition too.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this is recommendation not blocking


ret = i2c_smbus_read_byte_data(pdata2[swpld2].client, SFP_PRESENCE_5);
ret_sfp = (ret & (0x80)) >> 7;
ret_sfp = (ret & (0x80));
mutex_unlock(&dni_lock);
return sprintf(buf, "0x%x%x\n", ret_sfp, data);
return sprintf(buf, "0x%x%02x\n", data, ret_sfp);

case QSFP_LPMODE:
/*QSFP1~8*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_LPMODE_1);
data = (u32)(reverse_8bits(ret) & 0xff);
/*QSFP9~16*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_LPMODE_2);
data |= (u32)(reverse_8bits(ret) & 0xff) << 8;
/*QSFP17~24*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_LPMODE_3);
data |= (u32)(reverse_8bits(ret) & 0xff) << 16;
/*QSFP25~32*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_LPMODE_4);
data |= (u32)(reverse_8bits(ret) & 0xff) << 24;
data = (u32)(ret & 0xff);
/*QSFP17~24*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_LPMODE_3);
data |= (u32)(ret & 0xff) << 8;
/*QSFP9~16*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_LPMODE_2);
data |= (u32)(ret & 0xff) << 16;
/*QSFP1~8*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_LPMODE_1);
data |= (u32)(ret & 0xff) << 24;
mutex_unlock(&dni_lock);
return sprintf(buf, "0x%x\n", data);

case QSFP_RESET:
/*QSFP1~8*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_RESET_1);
data = (u32)(reverse_8bits(ret) & 0xff);
/*QSFP9~16*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_RESET_2);
data |= (u32)(reverse_8bits(ret) & 0xff) << 8;
/*QSFP17~24*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_RESET_3);
data |= (u32)(reverse_8bits(ret) & 0xff) << 16;
/*QSFP25~32*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_RESET_4);
data |= (u32)(reverse_8bits(ret) & 0xff) << 24;
data = (u32)(ret & 0xff);
/*QSFP17~24*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_RESET_3);
data |= (u32)(ret & 0xff) << 8;
/*QSFP9~16*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_RESET_2);
data |= (u32)(ret & 0xff) << 16;
/*QSFP1~8*/
ret = i2c_smbus_read_byte_data(pdata1[swpld1].client, QSFP_RESET_1);
data |= (u32)(ret & 0xff) << 24;
mutex_unlock(&dni_lock);
return sprintf(buf, "0x%x\n", data);

Expand All @@ -628,6 +628,7 @@ static ssize_t set_lpmode_data(struct device *dev, struct device_attribute *dev_
struct cpld_platform_data *pdata = i2cdev->platform_data;
unsigned long long set_data;
int err;
int status = 0;
unsigned char set_bytes;


Expand All @@ -636,24 +637,45 @@ static ssize_t set_lpmode_data(struct device *dev, struct device_attribute *dev_
return err;
}
mutex_lock(&dni_lock);
/*QSFP1~8*/
set_bytes = reverse_8bits(set_data & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_1, set_bytes);
/*QSFP25~32*/
set_bytes = set_data & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_4, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP17~24*/
set_bytes = (set_data >> 8 ) & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_3, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP9~16*/
set_bytes = reverse_8bits((set_data >> 8 ) & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_2, set_bytes);
set_bytes = (set_data >> 16 ) & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_2, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP17~24*/
set_bytes = reverse_8bits((set_data >> 16 ) & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_3, set_bytes);
/*QSFP1~8*/
set_bytes = (set_data >> 24 ) & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_1, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP25~32*/
set_bytes = reverse_8bits((set_data >> 24 ) & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_LPMODE_4, set_bytes);
mutex_unlock(&dni_lock);
return count;

ERROR:
mutex_unlock(&dni_lock);
return status;

}

static ssize_t set_reset_data(struct device *dev, struct device_attribute *dev_attr, const char *buf, size_t count)
Expand All @@ -662,6 +684,7 @@ static ssize_t set_reset_data(struct device *dev, struct device_attribute *dev_a
struct cpld_platform_data *pdata = i2cdev->platform_data;
unsigned long long set_data;
int err;
int status = 0;
unsigned char set_bytes;

err = kstrtoull(buf, 16, &set_data);
Expand All @@ -670,23 +693,43 @@ static ssize_t set_reset_data(struct device *dev, struct device_attribute *dev_a
}

mutex_lock(&dni_lock);
/*QSFP1~8*/
set_bytes = reverse_8bits(set_data & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_1, set_bytes);
/*QSFP25~32*/
set_bytes = set_data & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_4, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP17~24*/
set_bytes = (set_data >> 8 ) & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_3, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP9~16*/
set_bytes = reverse_8bits((set_data >> 8 ) & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_2, set_bytes);
set_bytes = (set_data >> 16 ) & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_2, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP17~24*/
set_bytes = reverse_8bits((set_data >> 16 ) & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_3, set_bytes);
/*QSFP1~8*/
set_bytes = (set_data >> 24 ) & 0xff;
status = i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_1, set_bytes);
if(status < 0)
{
goto ERROR;
}

/*QSFP25~32*/
set_bytes = reverse_8bits((set_data >> 24 ) & 0xff);
i2c_smbus_write_byte_data(pdata[swpld1].client, QSFP_RESET_4, set_bytes);
mutex_unlock(&dni_lock);
return count;
ERROR:
mutex_unlock(&dni_lock);
return status;
}


Expand Down