Gigabit Ethernet driver of Topcliff PCH
Subsystems (2)
PATCH v6 1/1 Gigabit Ethernet driver of Topcliff PCH
Gigabit Ethernet driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has Gigabit Ethernet I/F. Using this I/F, it is able to access system devices connected to Gigabit Ethernet.
--- drivers/net/Kconfig | 12 + drivers/net/Makefile | 1 + drivers/net/pch_gbe/Makefile | 4 + drivers/net/pch_gbe/pch_gbe.h | 659 +++++++++ drivers/net/pch_gbe/pch_gbe_api.c | 245 ++++ drivers/net/pch_gbe/pch_gbe_api.h | 36 + drivers/net/pch_gbe/pch_gbe_ethtool.c | 584 ++++++++ drivers/net/pch_gbe/pch_gbe_main.c | 2473 +++++++++++++++++++++++++++++++++ drivers/net/pch_gbe/pch_gbe_param.c | 501 +++++++ drivers/net/pch_gbe/pch_gbe_phy.c | 274 ++++ drivers/net/pch_gbe/pch_gbe_phy.h | 37 + 11 files changed, 4826 insertions(+), 0 deletions(-) create mode 100644 drivers/net/pch_gbe/Makefile create mode 100644 drivers/net/pch_gbe/pch_gbe.h create mode 100644 drivers/net/pch_gbe/pch_gbe_api.c create mode 100644 drivers/net/pch_gbe/pch_gbe_api.h create mode 100644 drivers/net/pch_gbe/pch_gbe_ethtool.c create mode 100644 drivers/net/pch_gbe/pch_gbe_main.c create mode 100644 drivers/net/pch_gbe/pch_gbe_param.c create mode 100644 drivers/net/pch_gbe/pch_gbe_phy.c create mode 100644 drivers/net/pch_gbe/pch_gbe_phy.h
drivers/net/Kconfig +12 -0
@@ -2502,6 +2502,18 @@ config S6GMAC source "drivers/net/stmmac/Kconfig" +config PCH_GBE + tristate "PCH Gigabit Ethernet" + depends on PCI + ---help--- + This is a gigabit ethernet driver for Topcliff PCH. + Topcliff PCH is the platform controller hub that is used in Intel's + general embedded platform. + Topcliff PCH has Gigabit Ethernet interface. + Using this interface, it is able to access system devices connected + to Gigabit Ethernet. + This driver enables Gigabit Ethernet function. + endif # NETDEV_1000 #
drivers/net/Makefile +1 -0
@@ -295,3 +295,4 @@ obj-$(CONFIG_WIMAX) += wimax/ obj-$(CONFIG_CAIF) += caif/ obj-$(CONFIG_OCTEON_MGMT_ETHERNET) += octeon/ +obj-$(CONFIG_PCH_GBE) += pch_gbe/
drivers/net/pch_gbe/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +obj-$(CONFIG_PCH_GBE) += pch_gbe.o + +pch_gbe-y := pch_gbe_phy.o pch_gbe_ethtool.o pch_gbe_param.o +pch_gbe-y += pch_gbe_api.o pch_gbe_main.o
drivers/net/pch_gbe/pch_gbe.h new file +659 -0
659 lines not on this page · raw message
drivers/net/pch_gbe/pch_gbe_api.c new file +245 -0
245 lines not on this page · raw message
drivers/net/pch_gbe/pch_gbe_api.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Copyright (C) 1999 - 2010 Intel Corporation. +* Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. +* +* This code was derived from the Intel e1000e Linux driver. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; version 2 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +*/ +#ifndef _PCH_GBE_API_H_ +#define _PCH_GBE_API_H_ + +#include "pch_gbe_phy.h" + +s32 pch_gbe_hal_setup_init_funcs (struct pch_gbe_hw *hw); +void pch_gbe_hal_get_bus_info (struct pch_gbe_hw *hw); +s32 pch_gbe_hal_init_hw (struct pch_gbe_hw *hw); +s32 pch_gbe_hal_read_phy_reg (struct pch_gbe_hw *hw,u32 offset,u16 *data); +s32 pch_gbe_hal_write_phy_reg (struct pch_gbe_hw *hw,u32 offset,u16 data); +void pch_gbe_hal_phy_hw_reset (struct pch_gbe_hw *hw); +void pch_gbe_hal_phy_sw_reset (struct pch_gbe_hw *hw); +s32 pch_gbe_hal_read_mac_addr (struct pch_gbe_hw *hw); +void pch_gbe_hal_power_up_phy (struct pch_gbe_hw *hw); +void pch_gbe_hal_power_down_phy (struct pch_gbe_hw *hw); + +#endif
drivers/net/pch_gbe/pch_gbe_ethtool.c new file +584 -0
584 lines not on this page · raw message
drivers/net/pch_gbe/pch_gbe_main.c new file +2473 -0
1,450 lines not on this page · raw message
drivers/net/pch_gbe/pch_gbe_param.c new file +501 -0
501 lines not on this page · raw message
drivers/net/pch_gbe/pch_gbe_phy.c new file +274 -0
274 lines not on this page · raw message
drivers/net/pch_gbe/pch_gbe_phy.h new file +37 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.6.2.5
Part of the diff is not shown here. View the raw message.
Quoted 10 lines · Masayuki Ohtake
Gigabit Ethernet driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has Gigabit Ethernet I/F. Using this I/F, it is able to access system devices connected to Gigabit Ethernet.
Signed-off-by Masayuki Ohtake <[email protected]>---
Hmm, what is going on ?
David already put your driver in net-next-2.6
If you want to make changes, you have to send diffs now, not the full version.
Thanks
Hi Eric
Thank you for information.
I did not know "net-next-2.6." This driver is not changed.
Thanks, Ohtake
-----
Date: Mon, 27 Sep 2010 08:10:00 +0200
From: "Eric Dumazet" <[email protected]>
Quoted 20 lines
Le lundi 27 septembre 2010 a 14:54 +0900, Masayuki Ohtake a ecrit :
Quoted 10 lines
Gigabit Ethernet driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has Gigabit Ethernet I/F. Using this I/F, it is able to access system devices connected to Gigabit Ethernet.
Signed-off-by Masayuki Ohtake <[email protected]>---
Hmm, what is going on ?
David already put your driver in net-next-2.6
If you want to make changes, you have to send diffs now, not the full version.
David Miller
maintainerFrom: Masayuki Ohtake <[email protected]>
Date: Mon, 27 Sep 2010 14:54:32 +0900
Quoted 9 lines
Gigabit Ethernet driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has Gigabit Ethernet I/F. Using this I/F, it is able to access system devices connected to Gigabit Ethernet.
Signed-off-by Masayuki Ohtake <[email protected]>
I already added your driver to my net-next-2.6 tree, why are you sending this again? :-(
David Miller
maintainerFrom: "Masayuki Ohtake" <[email protected]>
Date: Mon, 27 Sep 2010 15:39:57 +0900
Quoted 3 lines
Thank you for information.
I did not know "net-next-2.6."
This driver is not changed.
Regardless of whether you know about the net-next-2.6 tree or not, what do you think it means what I say to you "Applied"?
It means I've added your patch, there is no possible confusion.
Date: Sun, 26 Sep 2010 23:47:03 -0700 (PDT)
From: "David Miller" <[email protected]>
Quoted 9 lines
Quoted 4 lines
Thank you for information.
I did not know "net-next-2.6."
This driver is not changed.Regardless of whether you know about the net-next-2.6 tree or not, what do you think it means what I say to you "Applied"?
It means I've added your patch, there is no possible confusion.
Thanks
Best regards,
Masayuki Ohtake
Hi seedshope,
Quoted 3 lines
why it is need to compare the
INT_ENbit?
As general, thepch_gbe_intrfunction was call,the interrupt is enable.
In addition to the interrupt generate, what other conditions would call the interrupt function?
PCI devices in Topcliff IOH are connected with external PCI Express through logical PCI bus. In Topcliff IOH, more PCI devices are sharing interruption.
Gigabit Ethernet device and USB Host are sharing interruption.
The pch_gbe_intr function is called on condition of others.
So, the comparison with INT_EN bit is necessary.
Quoted 4 lines
resently , I fail to test the kgdboe on the gbe driver. The
pch_gbe_netpollwill call thepch_gbe_intrfunction. The interruption will be disable before enter thepch_gbe_intr. So thepch_gbe_netpollis fail for ever. Is it a bug?
I think it is not a bug.
The INT_EN bit is a value of Gigabit Ethernet device's register.
The interruption disable processing before pch_gbe_intr() in pch_gbe_netpoll() function is a disable_irq() function. The disable_irq() function does not change the register of a Gigabit Ethernet device.
Best regards.
Masayuki Otake.
-----
Date: Mon, 18 Oct 2010 16:48:50 +0800
From: seedshope
Hi Masayuki,
Quoted 5 lines
/**
*pch_gbe_intr- Interrupt Handler
* @irq: Interrupt number
* @data: Pointer to a network interface device structure
* Returns
Quoted 14 lines
* - IRQ_HANDLED: Our interrupt
* - IRQ_NONE: Not our interrupt
*/
static irqreturn_t pch_gbe_intr(int irq, void *data)
{
struct net_device *netdev = data;
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
struct pch_gbe_hw *hw = &adapter->hw;
u32 int_st;
u32 int_en;
/* Check request status */
int_st = ioread32(&hw->reg->INT_ST);
int_st = int_st & ioread32(&hw->reg->INT_EN);why it is need to compare the INT_EN bit? As general, the pch_gbe_intr function was call,the interrupt is enable. In addition to the interrupt generate, what other conditions would call the interrupt function?
resently , I fail to test the kgdboe on the gbe driver. The pch_gbe_netpoll will call the pch_gbe_intr function. The interruption will be disable before enter the pch_gbe_intr.
So the pch_gbe_netpoll is fail for ever. Is it a bug?
Quoted 41 lines
/* When request status is no interruption factor */
if (unlikely(!int_st))
return IRQ_NONE; /* Not our interrupt. End processing. */
pr_debug("%s occur int_st = 0x%08x\n", __func__, int_st);
if (int_st & PCH_GBE_INT_RX_FRAME_ERR)
adapter->stats.intr_rx_frame_err_count++;
if (int_st & PCH_GBE_INT_RX_FIFO_ERR)
adapter->stats.intr_rx_fifo_err_count++;
if (int_st & PCH_GBE_INT_RX_DMA_ERR)
adapter->stats.intr_rx_dma_err_count++;
if (int_st & PCH_GBE_INT_TX_FIFO_ERR)
adapter->stats.intr_tx_fifo_err_count++;
if (int_st & PCH_GBE_INT_TX_DMA_ERR)
adapter->stats.intr_tx_dma_err_count++;
if (int_st & PCH_GBE_INT_TCPIP_ERR)
adapter->stats.intr_tcpip_err_count++;
/* When Rx descriptor is empty */
if ((int_st & PCH_GBE_INT_RX_DSC_EMP)) {
adapter->stats.intr_rx_dsc_empty_count++;
pr_err("Rx descriptor is empty\n");
int_en = ioread32(&hw->reg->INT_EN);
iowrite32((int_en & ~PCH_GBE_INT_RX_DSC_EMP), &hw->reg->INT_EN);
if (hw->mac.tx_fc_enable) {
/* Set Pause packet */
pch_gbe_mac_set_pause_packet(hw);
}
if ((int_en & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT))
== 0) {
return IRQ_HANDLED;
}
}
/* When request status is Receive interruption */
if ((int_st & (PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT))) {
if (likely(napi_schedule_prep(&adapter->napi))) {
/* Enable only Rx Descriptor empty */
atomic_inc(&adapter->irq_sem);
int_en = ioread32(&hw->reg->INT_EN);
int_en &=
~(PCH_GBE_INT_RX_DMA_CMPLT | PCH_GBE_INT_TX_CMPLT);
iowrite32(int_en, &hw->reg->INT_EN);Quoted 8 lines
/* Start polling for NAPI */
__napi_schedule(&adapter->napi);
}
}
pr_debug("return = 0x%08x INT_EN reg = 0x%08x\n",
IRQ_HANDLED, ioread32(&hw->reg->INT_EN));
return IRQ_HANDLED;
}--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/