[ar71xx] use platform data to setup the MAC_CFG register in the spi_vsc7385 driver
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16780 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
be1b8cc75c
commit
98a02e113b
|
@ -169,6 +169,11 @@ static void ap83_vsc7385_reset(void)
|
||||||
static struct vsc7385_platform_data ap83_vsc7385_data = {
|
static struct vsc7385_platform_data ap83_vsc7385_data = {
|
||||||
.reset = ap83_vsc7385_reset,
|
.reset = ap83_vsc7385_reset,
|
||||||
.ucode_name = "vsc7385_ucode_ap83.bin",
|
.ucode_name = "vsc7385_ucode_ap83.bin",
|
||||||
|
.mac_cfg = {
|
||||||
|
.tx_ipg = 6,
|
||||||
|
.bit2 = 0,
|
||||||
|
.clk_sel = 3,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct spi_board_info ap83_spi_info[] = {
|
static struct spi_board_info ap83_spi_info[] = {
|
||||||
|
|
|
@ -63,10 +63,11 @@
|
||||||
#define VSC73XX_MAC_CFG_VLAN_DBLAWR (1 << 15)
|
#define VSC73XX_MAC_CFG_VLAN_DBLAWR (1 << 15)
|
||||||
#define VSC73XX_MAC_CFG_VLAN_AWR (1 << 14)
|
#define VSC73XX_MAC_CFG_VLAN_AWR (1 << 14)
|
||||||
#define VSC73XX_MAC_CFG_100_BASE_T (1 << 13)
|
#define VSC73XX_MAC_CFG_100_BASE_T (1 << 13)
|
||||||
#define VSC73XX_MAC_CFG_TX_IPG(x) ((x & 0x1f) << 6)
|
#define VSC73XX_MAC_CFG_TX_IPG(x) (((x) & 0x1f) << 6)
|
||||||
#define VSC73XX_MAC_CFG_MAC_RX_RST (1 << 5)
|
#define VSC73XX_MAC_CFG_MAC_RX_RST (1 << 5)
|
||||||
#define VSC73XX_MAC_CFG_MAC_TX_RST (1 << 4)
|
#define VSC73XX_MAC_CFG_MAC_TX_RST (1 << 4)
|
||||||
#define VSC73XX_MAC_CFG_CLK_SEL(x) ((x & 0x3) << 0)
|
#define VSC73XX_MAC_CFG_BIT2 (1 << 2)
|
||||||
|
#define VSC73XX_MAC_CFG_CLK_SEL(x) ((x) & 0x3)
|
||||||
|
|
||||||
/* ADVPORTM register bits */
|
/* ADVPORTM register bits */
|
||||||
#define VSC73XX_ADVPORTM_IFG_PPM (1 << 7)
|
#define VSC73XX_ADVPORTM_IFG_PPM (1 << 7)
|
||||||
|
@ -145,12 +146,10 @@
|
||||||
VSC73XX_MAC_CFG_MAC_RX_RST | \
|
VSC73XX_MAC_CFG_MAC_RX_RST | \
|
||||||
VSC73XX_MAC_CFG_MAC_TX_RST)
|
VSC73XX_MAC_CFG_MAC_TX_RST)
|
||||||
|
|
||||||
#define VSC7385_MAC_CFG_INIT (VSC73XX_MAC_CFG_TX_EN | \
|
#define VSC73XX_MAC_CFG_INIT (VSC73XX_MAC_CFG_TX_EN | \
|
||||||
VSC73XX_MAC_CFG_FDX | \
|
VSC73XX_MAC_CFG_FDX | \
|
||||||
VSC73XX_MAC_CFG_GIGE | \
|
VSC73XX_MAC_CFG_GIGE | \
|
||||||
VSC73XX_MAC_CFG_RX_EN | \
|
VSC73XX_MAC_CFG_RX_EN)
|
||||||
VSC73XX_MAC_CFG_TX_IPG(6) | \
|
|
||||||
4)
|
|
||||||
|
|
||||||
#define VSC73XX_RESET_DELAY 100
|
#define VSC73XX_RESET_DELAY 100
|
||||||
|
|
||||||
|
@ -438,6 +437,8 @@ static int vsc7385_upload_ucode(struct vsc7385 *vsc)
|
||||||
|
|
||||||
static int vsc7385_setup(struct vsc7385 *vsc)
|
static int vsc7385_setup(struct vsc7385 *vsc)
|
||||||
{
|
{
|
||||||
|
struct vsc7385_platform_data *pdata = vsc->pdata;
|
||||||
|
u32 t;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = vsc7385_write_verify(vsc, VSC73XX_BLOCK_SYSTEM, 0,
|
err = vsc7385_write_verify(vsc, VSC73XX_BLOCK_SYSTEM, 0,
|
||||||
|
@ -461,8 +462,14 @@ static int vsc7385_setup(struct vsc7385 *vsc)
|
||||||
if (err)
|
if (err)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
t = VSC73XX_MAC_CFG_INIT;
|
||||||
|
t |= VSC73XX_MAC_CFG_TX_IPG(pdata->mac_cfg.tx_ipg);
|
||||||
|
t |= VSC73XX_MAC_CFG_CLK_SEL(pdata->mac_cfg.clk_sel);
|
||||||
|
if (pdata->mac_cfg.bit2)
|
||||||
|
t |= VSC73XX_MAC_CFG_BIT2;
|
||||||
|
|
||||||
err = vsc7385_write(vsc, VSC73XX_BLOCK_MAC, VSC73XX_SUBBLOCK_PORT_MAC,
|
err = vsc7385_write(vsc, VSC73XX_BLOCK_MAC, VSC73XX_SUBBLOCK_PORT_MAC,
|
||||||
VSC73XX_MAC_CFG, VSC7385_MAC_CFG_INIT);
|
VSC73XX_MAC_CFG, t);
|
||||||
if (err)
|
if (err)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
|
|
|
@ -11,4 +11,9 @@
|
||||||
struct vsc7385_platform_data {
|
struct vsc7385_platform_data {
|
||||||
void (* reset)(void);
|
void (* reset)(void);
|
||||||
char *ucode_name;
|
char *ucode_name;
|
||||||
|
struct {
|
||||||
|
u32 tx_ipg:5;
|
||||||
|
u32 bit2:1;
|
||||||
|
u32 clk_sel:3;
|
||||||
|
} mac_cfg;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue