if (netif_msg_intr(gp))
printk(KERN_DEBUG "%s: pcs interrupt, pcs_istat: 0x%x\n",
gp->dev->name, pcs_istat);
if (!(pcs_istat & PCS_ISTAT_LSC)) {
netdev_err(dev, "PCS irq but no link status change???\n"); return0;
}
/* The link status bit latches on zero, so you must *readittwiceinsuchacasetoseeatransition *tothelinkbeingup.
*/
pcs_miistat = readl(gp->regs + PCS_MIISTAT); if (!(pcs_miistat & PCS_MIISTAT_LS))
pcs_miistat |=
(readl(gp->regs + PCS_MIISTAT) &
PCS_MIISTAT_LS);
if (pcs_miistat & PCS_MIISTAT_ANC) { /* The remote-fault indication is only valid *whenautoneghascompleted.
*/ if (pcs_miistat & PCS_MIISTAT_RF)
netdev_info(dev, "PCS AutoNEG complete, RemoteFault\n"); else
netdev_info(dev, "PCS AutoNEG complete\n");
}
if (pcs_miistat & PCS_MIISTAT_LS) {
netdev_info(dev, "PCS link is now up\n");
netif_carrier_on(gp->dev);
} else {
netdev_info(dev, "PCS link is now down\n");
netif_carrier_off(gp->dev); /* If this happens and the link timer is not running, *resetsowere-negotiate.
*/ if (!timer_pending(&gp->link_timer)) return1;
}
/* We do not keep track of MAC_TXSTAT_FCE and *MAC_TXSTAT_PCEevents.
*/ return0;
}
/* When we get a RX fifo overflow, the RX unit in GEM is probably hung *sowedothefollowing. * *Ifanypartoftheresetgoeswrong,wereturn1andthatcausesthe *wholechiptobereset.
*/ staticint gem_rxmac_reset(struct gem *gp)
{ struct net_device *dev = gp->dev; int limit, i;
u64 desc_dma;
u32 val;
/* First, reset & disable MAC RX. */
writel(MAC_RXRST_CMD, gp->regs + MAC_RXRST); for (limit = 0; limit < 5000; limit++) { if (!(readl(gp->regs + MAC_RXRST) & MAC_RXRST_CMD)) break;
udelay(10);
} if (limit == 5000) {
netdev_err(dev, "RX MAC will not reset, resetting whole chip\n"); return1;
}
writel(gp->mac_rx_cfg & ~MAC_RXCFG_ENAB,
gp->regs + MAC_RXCFG); for (limit = 0; limit < 5000; limit++) { if (!(readl(gp->regs + MAC_RXCFG) & MAC_RXCFG_ENAB)) break;
udelay(10);
} if (limit == 5000) {
netdev_err(dev, "RX MAC will not disable, resetting whole chip\n"); return1;
}
/* Second, disable RX DMA. */
writel(0, gp->regs + RXDMA_CFG); for (limit = 0; limit < 5000; limit++) { if (!(readl(gp->regs + RXDMA_CFG) & RXDMA_CFG_ENABLE)) break;
udelay(10);
} if (limit == 5000) {
netdev_err(dev, "RX DMA will not disable, resetting whole chip\n"); return1;
}
mdelay(5);
/* Execute RX reset command. */
writel(gp->swrst_base | GREG_SWRST_RXRST,
gp->regs + GREG_SWRST); for (limit = 0; limit < 5000; limit++) { if (!(readl(gp->regs + GREG_SWRST) & GREG_SWRST_RXRST)) break;
udelay(10);
} if (limit == 5000) {
netdev_err(dev, "RX reset command will not execute, resetting whole chip\n"); return1;
}
/* Refresh the RX ring. */ for (i = 0; i < RX_RING_SIZE; i++) { struct gem_rxd *rxd = &gp->init_block->rxd[i];
if (gp->rx_skbs[i] == NULL) {
netdev_err(dev, "Parts of RX ring empty, resetting whole chip\n"); return1;
}
if (netif_msg_intr(gp))
printk(KERN_DEBUG "%s: mac interrupt, mac_cstat: 0x%x\n",
gp->dev->name, mac_cstat);
/* This interrupt is just for pause frame and pause *tracking.Itisusefulfordiagnosticsanddebug *butprobablybydefaultwewillmasktheseevents.
*/ if (mac_cstat & MAC_CSTAT_PS)
gp->pause_entered++;
if (mac_cstat & MAC_CSTAT_PRCV)
gp->pause_last_time_recvd = (mac_cstat >> 16);
if (netif_msg_tx_done(gp))
printk(KERN_DEBUG "%s: tx done, slot %d\n",
gp->dev->name, entry);
skb = gp->tx_skbs[entry]; if (skb_shinfo(skb)->nr_frags) { int last = entry + skb_shinfo(skb)->nr_frags; int walk = entry; int incomplete = 0;
last &= (TX_RING_SIZE - 1); for (;;) {
walk = NEXT_TX(walk); if (walk == limit)
incomplete = 1; if (walk == last) break;
} if (incomplete) break;
}
gp->tx_skbs[entry] = NULL;
dev->stats.tx_bytes += skb->len;
/* Need to make the tx_old update visible to gem_start_xmit() *beforecheckingfornetif_queue_stopped().Withoutthe *memorybarrier,thereisasmallpossibilitythatgem_start_xmit() *willmissitandcausethequeuetobestoppedforever.
*/
smp_mb();
work_done = 0; do { /* Handle anomalies */ if (unlikely(gp->status & GREG_STAT_ABNORMAL)) { struct netdev_queue *txq = netdev_get_tx_queue(dev, 0); int reset;
/* We run the abnormal interrupt handling code with *theTxlock.ItonlyresetstheRxportionofthe *chip,butweneedtoguarditagainstDMAbeing *restartedbythelinkpolltimer
*/
__netif_tx_lock(txq, smp_processor_id());
reset = gem_abnormal_irq(dev, gp, gp->status);
__netif_tx_unlock(txq); if (reset) {
gem_schedule_reset(gp);
napi_complete(napi); return work_done;
}
}
/* Run TX completion thread */
gem_tx(dev, gp, gp->status);
/* Run RX thread. We don't use any locking here, *codewillingtodobadthings-likecleaningthe *rxring-mustcallnapi_disable(),which *schedule_timeout()'sifpollingisalreadydisabled.
*/
work_done += gem_rx(gp, budget - work_done);
if (work_done >= budget) return work_done;
gp->status = readl(gp->regs + GREG_STAT);
} while (gp->status & GREG_STAT_NAPI);
/* If polling was disabled at the time we received that *interrupt,wemayreturnIRQ_HANDLEDherewhilewe *shouldreturnIRQ_NONE.Nobigdeal...
*/ return IRQ_HANDLED;
}
if (unlikely(TX_BUFFS_AVAIL(gp) <= (skb_shinfo(skb)->nr_frags + 1))) { /* This is a hard error, log it. */ if (!netif_queue_stopped(dev)) {
netif_stop_queue(dev);
netdev_err(dev, "BUG! Tx Ring full when queue awake!\n");
} return NETDEV_TX_BUSY;
}
intme = 0; if (gem_intme(entry))
intme |= TXDCTRL_INTME;
/* We must give this initial chunk to the device last. *Otherwisewecouldracewiththedevice.
*/
first_len = skb_headlen(skb);
first_mapping = dma_map_page(&gp->pdev->dev,
virt_to_page(skb->data),
offset_in_page(skb->data),
first_len, DMA_TO_DEVICE);
entry = NEXT_TX(entry);
/* netif_stop_queue() must be done before checking *txindexinTX_BUFFS_AVAIL()below,because *ingem_tx(),weupdatetx_oldbeforecheckingfor *netif_queue_stopped().
*/
smp_mb(); if (TX_BUFFS_AVAIL(gp) > (MAX_SKB_FRAGS + 1))
netif_wake_queue(dev);
} if (netif_msg_tx_queued(gp))
printk(KERN_DEBUG "%s: tx queued, slot %d, skblen %d\n",
dev->name, entry, skb->len);
mb();
writel(gp->tx_new, gp->regs + TXDMA_KICK);
return NETDEV_TX_OK;
}
staticvoid gem_pcs_reset(struct gem *gp)
{ int limit;
u32 val;
/* Reset PCS unit. */
val = readl(gp->regs + PCS_MIICTRL);
val |= PCS_MIICTRL_RST;
writel(val, gp->regs + PCS_MIICTRL);
limit = 32; while (readl(gp->regs + PCS_MIICTRL) & PCS_MIICTRL_RST) {
udelay(100); if (limit-- <= 0) break;
} if (limit < 0)
netdev_warn(gp->dev, "PCS reset bit would not clear\n");
}
/* Make sure PCS is disabled while changing advertisement *configuration.
*/
val = readl(gp->regs + PCS_CFG);
val &= ~(PCS_CFG_ENABLE | PCS_CFG_TO);
writel(val, gp->regs + PCS_CFG);
/* Advertise all capabilities except asymmetric *pause.
*/
val = readl(gp->regs + PCS_MIIADV);
val |= (PCS_MIIADV_FD | PCS_MIIADV_HD |
PCS_MIIADV_SP | PCS_MIIADV_AP);
writel(val, gp->regs + PCS_MIIADV);
/* Enable and restart auto-negotiation, disable wrapback/loopback, *andre-enablePCS.
*/
val = readl(gp->regs + PCS_MIICTRL);
val |= (PCS_MIICTRL_RAN | PCS_MIICTRL_ANE);
val &= ~PCS_MIICTRL_WB;
writel(val, gp->regs + PCS_MIICTRL);
val = readl(gp->regs + PCS_CFG);
val |= PCS_CFG_ENABLE;
writel(val, gp->regs + PCS_CFG);
/* Make sure serialink loopback is off. The meaning *ofthisbitislogicallyinvertedbaseduponwhether *youareinSerialinkorSERDESmode.
*/
val = readl(gp->regs + PCS_SCTRL); if (gp->phy_type == phy_serialink)
val &= ~PCS_SCTRL_LOOP; else
val |= PCS_SCTRL_LOOP;
writel(val, gp->regs + PCS_SCTRL);
}
#define STOP_TRIES 32
staticvoid gem_reset(struct gem *gp)
{ int limit;
u32 val;
/* Make sure we won't get any more interrupts */
writel(0xffffffff, gp->regs + GREG_IMASK);
/* DMA won't be actually stopped before about 4ms tho ...
*/ staticvoid gem_stop_dma(struct gem *gp)
{
u32 val;
/* We are done rocking, turn everything off. */
val = readl(gp->regs + TXDMA_CFG);
writel(val & ~TXDMA_CFG_ENABLE, gp->regs + TXDMA_CFG);
val = readl(gp->regs + RXDMA_CFG);
writel(val & ~RXDMA_CFG_ENABLE, gp->regs + RXDMA_CFG);
val = readl(gp->regs + MAC_TXCFG);
writel(val & ~MAC_TXCFG_ENAB, gp->regs + MAC_TXCFG);
val = readl(gp->regs + MAC_RXCFG);
writel(val & ~MAC_RXCFG_ENAB, gp->regs + MAC_RXCFG);
(void) readl(gp->regs + MAC_RXCFG);
/* Need to wait a bit ... done by the caller */
}
// XXX dbl check what that function should do when called on PCS PHY staticvoid gem_begin_auto_negotiation(struct gem *gp, conststruct ethtool_link_ksettings *ep)
{
u32 advertise, features; int autoneg; int speed; int duplex;
u32 advertising;
if (ep)
ethtool_convert_link_mode_to_legacy_u32(
&advertising, ep->link_modes.advertising);
if (gp->phy_type != phy_mii_mdio0 &&
gp->phy_type != phy_mii_mdio1) goto non_mii;
/* Setup advertise */ if (found_mii_phy(gp))
features = gp->phy_mii.def->features; else
features = 0;
advertise = features & ADVERTISE_MASK; if (gp->phy_mii.advertising != 0)
advertise &= gp->phy_mii.advertising;
start_aneg: /* Sanitize settings based on PHY capabilities */ if ((features & SUPPORTED_Autoneg) == 0)
autoneg = 0; if (speed == SPEED_1000 &&
!(features & (SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full)))
speed = SPEED_100; if (speed == SPEED_100 &&
!(features & (SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full)))
speed = SPEED_10; if (duplex == DUPLEX_FULL &&
!(features & (SUPPORTED_1000baseT_Full |
SUPPORTED_100baseT_Full |
SUPPORTED_10baseT_Full)))
duplex = DUPLEX_HALF; if (speed == 0)
speed = SPEED_10;
/* If we are asleep, we don't try to actually setup the PHY, we *juststorethesettings
*/ if (!netif_device_present(gp->dev)) {
gp->phy_mii.autoneg = gp->want_autoneg = autoneg;
gp->phy_mii.speed = speed;
gp->phy_mii.duplex = duplex; return;
}
if (gp->pdev->vendor == PCI_VENDOR_ID_APPLE) { int i;
/* Those delays sucks, the HW seems to love them though, I'll *seriouslyconsiderbreakingsomelocksheretobeable *toscheduleinstead
*/ for (i = 0; i < 3; i++) { #ifdef CONFIG_PPC_PMAC
pmac_call_feature(PMAC_FTR_GMAC_PHY_RESET, gp->of_node, 0, 0);
msleep(20); #endif /* Some PHYs used by apple have problem getting back to us, *wedoanadditionalresethere
*/
sungem_phy_write(gp, MII_BMCR, BMCR_RESET);
msleep(20); if (sungem_phy_read(gp, MII_BMCR) != 0xffff) break; if (i == 2)
netdev_warn(gp->dev, "GMAC PHY not responding !\n");
}
}
/* Clear RX/TX/MAC/XIF config, we will set these up and enable *themoncealinkisestablished.
*/
writel(0, gp->regs + MAC_TXCFG);
writel(gp->mac_rx_cfg, gp->regs + MAC_RXCFG);
writel(0, gp->regs + MAC_MCCFG);
writel(0, gp->regs + MAC_XIFCFG);
/* Setup MAC interrupts. We want to get all of the interesting *counterexpirationevents,butwedonotwanttohearabout *normalrx/txastheDMAenginetellsusthat.
*/
writel(MAC_TXSTAT_XMIT, gp->regs + MAC_TXMASK);
writel(MAC_RXSTAT_RCV, gp->regs + MAC_RXMASK);
/* Don't enable even the PAUSE interrupts for now, we *makenouseofthoseeventsotherthantorecordthem.
*/
writel(0xffffffff, gp->regs + MAC_MCMASK);
/* Don't enable GEM's WOL in normal operations
*/ if (gp->has_wol)
writel(0, gp->regs + WOL_WAKECSR);
}
/* Calculate pause thresholds. Setting the OFF threshold to the *fullRXfifosizeeffectivelydisablesPAUSEgenerationwhich *iswhatwedofor10/100onlyGEMswhichhaveFIFOstoosmall *tomakerealgainsfromPAUSE.
*/ if (gp->rx_fifo_sz <= (2 * 1024)) {
gp->rx_pause_off = gp->rx_pause_on = gp->rx_fifo_sz;
} else { int max_frame = (gp->rx_buf_sz + 4 + 64) & ~63; int off = (gp->rx_fifo_sz - (max_frame * 2)); int on = off - max_frame;
/* We hard-code the PHY address so we can properly bring it out of *resetlateron,wecan'treallyprobeitatthispoint,though *thatisn'tanissue.
*/ if (gp->pdev->device == PCI_DEVICE_ID_APPLE_K2_GMAC)
gp->mii_phy_addr = 1; else
gp->mii_phy_addr = 0;
return0;
}
mif_cfg = readl(gp->regs + MIF_CFG);
if (pdev->vendor == PCI_VENDOR_ID_SUN &&
pdev->device == PCI_DEVICE_ID_SUN_RIO_GEM) { /* One of the MII PHYs _must_ be present *asthischiphasnogigabitPHY.
*/ if ((mif_cfg & (MIF_CFG_MDI0 | MIF_CFG_MDI1)) == 0) {
pr_err("RIO GEM lacks MII phy, mif_cfg[%08x]\n",
mif_cfg); return -1;
}
}
/* Determine initial PHY interface type guess. MDIO1 is the *externalPHYandthustakesprecedenceoverMDIO0.
*/
p = of_get_property(gp->of_node, "shared-pins", NULL); if (p && !strcmp(p, "serdes"))
gp->phy_type = phy_serdes; else #endif
gp->phy_type = phy_serialink;
} if (gp->phy_type == phy_mii_mdio1 ||
gp->phy_type == phy_mii_mdio0) { int i;
for (i = 0; i < 32; i++) {
gp->mii_phy_addr = i; if (sungem_phy_read(gp, MII_BMCR) != 0xffff) break;
} if (i == 32) { if (pdev->device != PCI_DEVICE_ID_SUN_GEM) {
pr_err("RIO MII phy will not respond\n"); return -1;
}
gp->phy_type = phy_serdes;
}
}
/* An interrupt might come in handy */
rc = request_irq(gp->pdev->irq, gem_interrupt,
IRQF_SHARED, dev->name, (void *)dev); if (rc) {
netdev_err(dev, "failed to request irq !\n");
/* Stop NAPI and stop tx queue */
gem_netif_stop(gp);
/* Make sure ints are disabled. We don't care about *synchronizingasNAPIisdisabled,thusastray *interruptwilldonothingbad(ourirqhandler *justschedulesNAPI)
*/
gem_disable_ints(gp);
/* Stop the link timer */
timer_delete_sync(&gp->link_timer);
/* We cannot cancel the reset task while holding the *rtnllock,we'dgetanA->B/B->Adeadlockstituation *ifwedid.Thisisnotanissuehoweverasthereset *taskissynchronizedvs.us(rtnl_lock)andwilldo *nothingifthedeviceisdownorsuspended.Wedo *stillclearreset_task_pendingtoavoidaspurrious *resetlateronincasewedoresumebeforeitgets *scheduled.
*/
gp->reset_task_pending = 0;
/* If we are going to sleep with WOL */
gem_stop_dma(gp);
msleep(10); if (!wol)
gem_reset(gp);
msleep(10);
/* Get rid of rings */
gem_clean_rings(gp);
/* No irq needed anymore */
free_irq(gp->pdev->irq, (void *) dev);
/* Shut the PHY down eventually and setup WOL */
gem_stop_phy(gp, wol);
}
/* Lock out the network stack (essentially shield ourselves *againstaracingopen,close,controlcall,orsuspend
*/
rtnl_lock();
/* Skip the reset task if suspended or closed, or if it's *beencancelledbygem_do_stop(seecommentthere)
*/ if (!netif_device_present(gp->dev) ||
!netif_running(gp->dev) ||
!gp->reset_task_pending) {
rtnl_unlock(); return;
}
/* Stop the link timer */
timer_delete_sync(&gp->link_timer);
/* Stop NAPI and tx */
gem_netif_stop(gp);
/* Reset the chip & rings */
gem_reinit_chip(gp); if (gp->lstate == link_up)
gem_set_link_modes(gp);
/* Restart NAPI and Tx */
gem_netif_start(gp);
/* We are back ! */
gp->reset_task_pending = 0;
/* If the link is not up, restart autoneg, else restart the *pollingtimer
*/ if (gp->lstate != link_up)
gem_begin_auto_negotiation(gp, NULL); else
mod_timer(&gp->link_timer, jiffies + ((12 * HZ) / 10));
/* We allow open while suspended, we just do nothing, *thechipwillbeinitializedinresume()
*/ if (netif_device_present(dev)) { /* Enable the cell */
gem_get_cell(gp);
/* Make sure PCI access and bus master are enabled */
rc = pci_enable_device(gp->pdev); if (rc) {
netdev_err(dev, "Failed to enable chip on PCI bus !\n");
/* Put cell and forget it for now, it will be considered *asstillasleep,anewsleepcyclemaybringitback
*/
gem_put_cell(gp); return -ENXIO;
} return gem_do_start(dev);
}
/* Lock the network stack first to avoid racing with open/close, *resettaskandsettingcalls
*/
rtnl_lock();
/* Not running, mark ourselves non-present, no need for *alockhere
*/ if (!netif_running(dev)) {
netif_device_detach(dev);
rtnl_unlock(); return0;
}
netdev_info(dev, "suspending, WakeOnLan %s\n",
(gp->wake_on_lan && netif_running(dev)) ? "enabled" : "disabled");
/* Tell the network stack we're gone. gem_do_stop() below will *synchronizewithTX,stopNAPIetc...
*/
netif_device_detach(dev);
/* Switch off chip, remember WOL setting */
gp->asleep_wol = !!gp->wake_on_lan;
gem_do_stop(dev, gp->asleep_wol);
/* Cell not needed neither if no WOL */ if (!gp->asleep_wol)
gem_put_cell(gp);
/* See locking comment in gem_suspend */
rtnl_lock();
/* Not running, mark ourselves present, no need for *alockhere
*/ if (!netif_running(dev)) {
netif_device_attach(dev);
rtnl_unlock(); return0;
}
/* Enable the cell */
gem_get_cell(gp);
/* Restart chip. If that fails there isn't much we can do, we *leavethingsstopped.
*/
gem_do_start(dev);
/* If we had WOL enabled, the cell clock was never turned off during *sleep,soweendupbeeingunbalanced.Fixthathere
*/ if (gp->asleep_wol)
gem_put_cell(gp);
/* I have seen this being called while the PM was in progress, *soweshieldagainstthis.Let'salsonotpokeatregisters *whiletheresettaskisgoingon. * *TODO:Movestatscollectionelsewhere(linktimer?)and *makethisanoptoavoidallthosesynchroissues
*/ if (!netif_device_present(dev) || !netif_running(dev)) goto bail;
/* Better safe than sorry... */ if (WARN_ON(!gp->cell_enabled)) goto bail;
/* Apply settings and restart link process. */ if (netif_device_present(gp->dev)) {
timer_delete_sync(&gp->link_timer);
gem_begin_auto_negotiation(gp, cmd);
}
/* Add more when I understand how to program the chip */ if (gp->has_wol) {
wol->supported = WOL_SUPPORTED_MASK;
wol->wolopts = gp->wake_on_lan;
} else {
wol->supported = 0;
wol->wolopts = 0;
}
}
#if (!defined(CONFIG_SPARC) && !defined(CONFIG_PPC_PMAC)) /* Fetch MAC address from vital product data of PCI ROM. */ staticint find_eth_addr_in_vpd(void __iomem *rom_base, int len, unsignedchar *dev_addr)
{ int this_offset;
for (this_offset = 0x20; this_offset < len; this_offset++) { void __iomem *p = rom_base + this_offset; int i;
/* Sun MAC prefix then 3 random bytes. */
dev_addr[0] = 0x08;
dev_addr[1] = 0x00;
dev_addr[2] = 0x20;
get_random_bytes(dev_addr + 3, 3);
} #endif/* not Sparc and not PPC */
/* Apple gmac note: during probe, the chip is powered up by *thearchcodetoallowthecodebelowtowork(andtolet *thechipbeprobedontheconfigspace.Itwon'tstaypowered *upuntiltheinterfaceisbroughtuphowever,sowecan'trely *onregisterconfigurationdoneatthispoint.
*/
err = pci_enable_device(pdev); if (err) {
pr_err("Cannot enable MMIO operation, aborting\n"); return err;
}
pci_set_master(pdev);
/* Configure DMA attributes. */
/* All of the GEM documentation states that 64-bit DMA addressing *isfullysupportedandshouldworkjustfine.Howeverthe *frontendforRIObasedGEMsisdifferentandonlysupports *32-bitaddressing. * *FornowweassumethevariousPPCGEMsare32-bitonlyaswell.
*/ if (pdev->vendor == PCI_VENDOR_ID_SUN &&
pdev->device == PCI_DEVICE_ID_SUN_GEM &&
!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) {
pci_using_dac = 1;
} else {
err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); if (err) {
pr_err("No usable DMA configuration, aborting\n"); goto err_disable_device;
}
pci_using_dac = 0;
}
/* On Apple, we want a reference to the Open Firmware device-tree *node.Weuseitforclockcontrol.
*/ #ifdefined(CONFIG_PPC_PMAC) || defined(CONFIG_SPARC)
gp->of_node = pci_device_to_OF_node(pdev); #endif
/* Only Apple version supports WOL afaik */ if (pdev->vendor == PCI_VENDOR_ID_APPLE)
gp->has_wol = 1;
/* Make sure cell is enabled */
gem_get_cell(gp);
/* Make sure everything is stopped and in init state */
gem_reset(gp);
/* Fill up the mii_phy structure (even if we won't use it) */
gp->phy_mii.dev = dev;
gp->phy_mii.mdio_read = _sungem_phy_read;
gp->phy_mii.mdio_write = _sungem_phy_write; #ifdef CONFIG_PPC_PMAC
gp->phy_mii.platform_data = gp->of_node; #endif /* By default, we start with autoneg */
gp->want_autoneg = 1;
/* It is guaranteed that the returned buffer will be at least *PAGE_SIZEaligned.
*/
gp->init_block = dma_alloc_coherent(&pdev->dev, sizeof(struct gem_init_block),
&gp->gblock_dvma, GFP_KERNEL); if (!gp->init_block) {
pr_err("Cannot allocate init block, aborting\n");
err = -ENOMEM; goto err_out_iounmap;
}
err = gem_get_device_address(gp); if (err) goto err_out_free_consistent;
/* Set that now, in case PM kicks in now */
pci_set_drvdata(pdev, dev);
/* We can do scatter/gather and HW checksum */
dev->hw_features = NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
dev->features = dev->hw_features; if (pci_using_dac)
dev->features |= NETIF_F_HIGHDMA;
/* MTU range: 68 - 1500 (Jumbo mode is broken) */
dev->min_mtu = GEM_MIN_MTU;
dev->max_mtu = GEM_MAX_MTU;
/* Register with kernel */ if (register_netdev(dev)) {
pr_err("Cannot register net device, aborting\n");
err = -ENOMEM; goto err_out_free_consistent;
}
/* Undo the get_cell with appropriate locking (we could use *ndo_init/uninitbutthatwouldbeevenmoreclumsyimho)
*/
rtnl_lock();
gem_put_cell(gp);
rtnl_unlock();
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.