#include "rtl8366_smi.h"
#define RTL8366_SMI_ACK_RETRY_COUNT 5
-#define RTL8366_SMI_CLK_DELAY 10 /* nsec */
static inline void rtl8366_smi_clk_delay(struct rtl8366_smi *smi)
{
- ndelay(RTL8366_SMI_CLK_DELAY);
+ ndelay(smi->clk_delay);
}
static void rtl8366_smi_start(struct rtl8366_smi *smi)
rtl8366_smi_start(smi);
/* send READ command */
- ret = rtl8366_smi_write_byte(smi, 0x0a << 4 | 0x04 << 1 | 0x01);
+ ret = rtl8366_smi_write_byte(smi, smi->cmd_read);
if (ret)
goto out;
rtl8366_smi_start(smi);
/* send WRITE command */
- ret = rtl8366_smi_write_byte(smi, 0x0a << 4 | 0x04 << 1 | 0x00);
+ ret = rtl8366_smi_write_byte(smi, smi->cmd_write);
if (ret)
goto out;
smi->gpio_sda = pdata->gpio_sda;
smi->gpio_sck = pdata->gpio_sck;
+ smi->clk_delay = 10;
+ smi->cmd_read = 0xa9;
+ smi->cmd_write = 0xa8;
smi->ops = &rtl8366rb_smi_ops;
smi->cpu_port = RTL8366RB_PORT_NUM_CPU;
smi->num_ports = RTL8366RB_NUM_PORTS;
smi->gpio_sda = pdata->gpio_sda;
smi->gpio_sck = pdata->gpio_sck;
+ smi->clk_delay = 10;
+ smi->cmd_read = 0xa9;
+ smi->cmd_write = 0xa8;
smi->ops = &rtl8366s_smi_ops;
smi->cpu_port = RTL8366S_PORT_NUM_CPU;
smi->num_ports = RTL8366S_NUM_PORTS;