Hi,
inspired by the patch in Ticket #7977 I wanted an option to set speed/duplex instead of auto neogation.
In realtek.info/pdf/rtl8366_8369_datasheet_1-1.pdf on page 85 I saw a solution:
"10.3.6. 0x0011 - 0x0015: Port Advertising Ability Control Register 0-4 (PAACR0-4)"
I just wanted to test it with a little snippet, but it doesn't work like I want to (explanation after Code):
static int rtl8366rb_sw_get_port_ability(struct switch_dev *dev,
const struct switch_attr *attr,
struct switch_val *val)
{
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data = 0;
rtl8366_smi_read_reg(smi, RTL8366RB_PAACR0, &data);
val->value.i = data;
return 0;
}
static int rtl8366rb_sw_set_port_ability(struct switch_dev *dev,
const struct switch_attr *attr,
struct switch_val *val)
{
struct rtl8366_smi *smi = sw_to_rtl8366_smi(dev);
u32 data;
u32 mask;
u32 reg;
reg = RTL8366RB_PAACR0;
mask = 0xFF << (0 * 4),
data = 0b11010000 << (0 * 4);
return rtl8366_smi_rmwr(smi, reg, mask, data);
}
//...
static struct switch_attr rtl8366rb_port[] = {
//...
}, {
.type = SWITCH_TYPE_INT,
.name = "port_ability",
.description = "Get/Set port_ability",
.max = 7,
.set = rtl8366rb_sw_set_port_ability,
.get = rtl8366rb_sw_get_port_ability,
},
};(I know ... that isn't nice, I just want to get it to work before extending features.)
As you can see I set the port_ability of Port 0 (WAN) to 0b11010000 (ignoring the port number and state I set in swconfig).
It seems it is set correctly:
root@OpenWrt:/# swconfig dev rtl8366rb port 0 set port_ability 0
root@OpenWrt:/# swconfig dev rtl8366rb port 0 get port_ability
65488But no matter what I try - i always have 1000FDx:
root@OpenWrt:/# swconfig dev rtl8366rb port 0 get link
port:0 link:up speed:1000baseT full-duplex txflow rxflowDo you have any idea how I can get this working? Thanks, Florian.
