9
0
Fork 0

Merge branch 'for-next/net'

This commit is contained in:
Sascha Hauer 2015-12-08 08:28:35 +01:00
commit 31860b4831
5 changed files with 49 additions and 20 deletions

View File

@ -213,12 +213,34 @@ static void descs_init(struct eth_device *dev)
rx_descs_init(dev);
}
/* Get PHY out of power saving mode. If this is needed elsewhere then
* consider making it part of phy-core and adding a resume method to
* the phy device ops. */
static int phy_resume(struct phy_device *phydev)
{
int bmcr;
bmcr = phy_read(phydev, MII_BMCR);
if (bmcr < 0)
return bmcr;
if (bmcr & BMCR_PDOWN) {
bmcr &= ~BMCR_PDOWN;
return phy_write(phydev, MII_BMCR, bmcr);
}
return 0;
}
static int dwc_ether_init(struct eth_device *dev)
{
struct dw_eth_dev *priv = dev->priv;
struct eth_mac_regs *mac_p = priv->mac_regs_p;
struct eth_dma_regs *dma_p = priv->dma_regs_p;
/* Before we reset the mac, we must insure the PHY is not powered down
* as the dw controller needs all clock domains to be running, including
* the PHY clock, to come out of a mac reset. */
phy_resume(dev->phydev);
if (mac_reset(dev) < 0)
return -1;
@ -275,6 +297,8 @@ static int dwc_ether_open(struct eth_device *dev)
if (ret)
return ret;
dwc_ether_init(dev);
descs_init(dev);
/*
@ -468,7 +492,6 @@ static int dwc_ether_probe(struct device_d *dev)
edev->priv = priv;
edev->parent = dev;
edev->init = dwc_ether_init;
edev->open = dwc_ether_open;
edev->send = dwc_ether_send;
edev->recv = dwc_ether_rx;

View File

@ -259,7 +259,7 @@ static int fec_set_hwaddr(struct eth_device *dev, const unsigned char *mac)
writel((mac[0] << 24) + (mac[1] << 16) + (mac[2] << 8) + mac[3], fec->regs + FEC_PADDR1);
writel((mac[4] << 24) + (mac[5] << 16) + 0x8808, fec->regs + FEC_PADDR2);
return 0;
return 0;
}
static int fec_init(struct eth_device *dev)
@ -647,13 +647,14 @@ static int fec_probe_dt(struct device_d *dev, struct fec_priv *fec)
#endif
static int fec_probe(struct device_d *dev)
{
struct fec_platform_data *pdata = (struct fec_platform_data *)dev->platform_data;
struct eth_device *edev;
struct fec_platform_data *pdata = (struct fec_platform_data *)dev->platform_data;
struct eth_device *edev;
struct fec_priv *fec;
void *base;
int ret;
enum fec_type type;
int phy_reset;
u32 msec = 1;
ret = dev_get_drvdata(dev, (const void **)&type);
if (ret)
@ -684,6 +685,8 @@ static int fec_probe(struct device_d *dev)
phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);
if (gpio_is_valid(phy_reset)) {
of_property_read_u32(dev->device_node, "phy-reset-duration", &msec);
ret = gpio_request(phy_reset, "phy-reset");
if (ret)
goto err_free;
@ -692,7 +695,7 @@ static int fec_probe(struct device_d *dev)
if (ret)
goto err_free;
udelay(10);
mdelay(msec);
gpio_set_value(phy_reset, 1);
}
@ -775,7 +778,7 @@ static __maybe_unused struct of_device_id imx_fec_dt_ids[] = {
}, {
.compatible = "fsl,imx6q-fec",
.data = (void *)FEC_TYPE_IMX6,
}, {
}, {
.compatible = "fsl,imx6sx-fec",
.data = (void *)FEC_TYPE_IMX6,
}, {

View File

@ -51,10 +51,12 @@ struct rtl8169_priv {
int chipset;
volatile struct bufdesc *tx_desc;
dma_addr_t tx_desc_phys;
void *tx_buf;
unsigned int cur_tx;
volatile struct bufdesc *rx_desc;
dma_addr_t rx_desc_phys;
void *rx_buf;
unsigned int cur_rx;
@ -228,10 +230,10 @@ static void rtl8169_init_ring(struct rtl8169_priv *priv)
priv->cur_rx = priv->cur_tx = 0;
priv->tx_desc = dma_alloc_coherent(NUM_TX_DESC *
sizeof(struct bufdesc), DMA_ADDRESS_BROKEN);
sizeof(struct bufdesc), &priv->tx_desc_phys);
priv->tx_buf = malloc(NUM_TX_DESC * PKT_BUF_SIZE);
priv->rx_desc = dma_alloc_coherent(NUM_RX_DESC *
sizeof(struct bufdesc), DMA_ADDRESS_BROKEN);
sizeof(struct bufdesc), &priv->rx_desc_phys);
priv->rx_buf = malloc(NUM_RX_DESC * PKT_BUF_SIZE);
dma_sync_single_for_device((unsigned long)priv->rx_buf,
NUM_RX_DESC * PKT_BUF_SIZE, DMA_FROM_DEVICE);
@ -275,9 +277,9 @@ static void rtl8169_hw_start(struct rtl8169_priv *priv)
/* Set DMA burst size and Interframe Gap Time */
RTL_W32(priv, TxConfig, (6 << TxDMAShift) | (3 << TxInterFrameGapShift));
RTL_W32(priv, TxDescStartAddrLow, virt_to_phys(priv->tx_desc));
RTL_W32(priv, TxDescStartAddrLow, priv->tx_desc_phys);
RTL_W32(priv, TxDescStartAddrHigh, 0);
RTL_W32(priv, RxDescStartAddrLow, virt_to_phys(priv->rx_desc));
RTL_W32(priv, RxDescStartAddrLow, priv->rx_desc_phys);
RTL_W32(priv, RxDescStartAddrHigh, 0);
/* RTL-8169sc/8110sc or later version */

View File

@ -29,7 +29,7 @@ struct tap_priv {
char *name;
};
int tap_eth_send (struct eth_device *edev, void *packet, int length)
static int tap_eth_send(struct eth_device *edev, void *packet, int length)
{
struct tap_priv *priv = edev->priv;
@ -37,7 +37,7 @@ int tap_eth_send (struct eth_device *edev, void *packet, int length)
return 0;
}
int tap_eth_rx (struct eth_device *edev)
static int tap_eth_rx(struct eth_device *edev)
{
struct tap_priv *priv = edev->priv;
int length;
@ -50,12 +50,12 @@ int tap_eth_rx (struct eth_device *edev)
return 0;
}
int tap_eth_open(struct eth_device *edev)
static int tap_eth_open(struct eth_device *edev)
{
return 0;
}
void tap_eth_halt (struct eth_device *edev)
static void tap_eth_halt(struct eth_device *edev)
{
/* nothing to do here */
}
@ -70,7 +70,7 @@ static int tap_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
return 0;
}
int tap_probe(struct device_d *dev)
static int tap_probe(struct device_d *dev)
{
struct eth_device *edev;
struct tap_priv *priv;
@ -99,14 +99,15 @@ int tap_probe(struct device_d *dev)
eth_register(edev);
return 0;
return 0;
out:
free(priv);
return ret;
}
static struct driver_d tap_driver = {
.name = "tap",
.probe = tap_probe,
.name = "tap",
.probe = tap_probe,
};
device_platform_driver(tap_driver);

View File

@ -158,7 +158,7 @@ struct asix_rx_fixup_info {
u16 size;
u16 offset;
bool split_head;
unsigned char ax_skb[RX_FIXUP_SIZE];
unsigned char ax_skb[RX_FIXUP_SIZE] __aligned(2);
};
struct asix_common_private {
@ -424,7 +424,7 @@ static int ax88172_get_ethaddr(struct eth_device *edev, unsigned char *adr)
return 0;
}
int asix_rx_fixup_internal(struct usbnet *dev, void *buf, int len,
static int asix_rx_fixup_internal(struct usbnet *dev, void *buf, int len,
struct asix_rx_fixup_info *rx)
{
int offset = 0;