Gigabit Ethernet driver of Topcliff PCH
Subsystems (2)
PATCH v5 1/1 Gigabit Ethernet driver of Topcliff PCH
The dev_pm_ops was used.
Unnecessary "__attribute__ ((packed))" was deleted.
--- drivers/net/Kconfig | 12 + drivers/net/Makefile | 1 + drivers/net/pch_gbe/Makefile | 4 + drivers/net/pch_gbe/pch_gbe.h | 658 +++++++++ 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, 4825 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 +658 -0
658 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,451 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.
David Miller
maintainerFrom: Masayuki Ohtake <[email protected]>
Date: Tue, 21 Sep 2010 20:44:11 +0900
Quoted 4 lines
The
dev_pm_opswas used.
Unnecessary "__attribute__((packed))" was deleted.Signed-off-by Masayuki Ohtake <[email protected]>
Applied, but the driver didn't even build on my machine (sparc64, problem is lack of vmalloc.h include) and once that problem was fixed it emitted several warnings when building (casting pointers to "u32").
I therefore added the following fixes when commiting your driver:
drivers/net/pch_gbe/pch_gbe.h +1 -0
@@ -29,6 +29,7 @@#include <linux/netdevice.h> #include <linux/etherdevice.h> #include <linux/ethtool.h> +#include <linux/vmalloc.h> #include <net/ip.h> /**
drivers/net/pch_gbe/pch_gbe_main.c +9 -9
@@ -1401,9 +1401,9 @@ pch_gbe_clean_rx(struct pch_gbe_adapter *adapter,prefetch (skb->data);pr_debug ("RxDecNo = 0x%04x Status[DMA:0x%02x GBE:0x%04x " -"TCP:0x%08x] BufInf = 0x%08x\n" , +"TCP:0x%08x] BufInf = 0x%p\n" , i, dma_status, gbec_status, tcp_ip_status, - (u32) (buffer_info)); + buffer_info);/* Error check */ if (unlikely (gbec_status &PCH_GBE_RXD_GMAC_STAT_NOTOCTAL )) { adapter->stats.rx_frame_errors++;
@@ -1545,9 +1545,9 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter, tx_desc =PCH_GBE_TX_DESC (*tx_ring, desNo); tx_desc->gbec_status =DSC_INIT16 ; } -pr_debug ("tx_ring->desc = 0x%08x tx_ring->dma = 0x%08llx\n" +pr_debug ("tx_ring->desc = 0x%p tx_ring->dma = 0x%08llx\n" "next_to_clean = 0x%08x next_to_use = 0x%08x\n" , - (u32 ) tx_ring->desc, (unsigned long long )tx_ring->dma, + tx_ring->desc, (unsigned long long )tx_ring->dma, tx_ring->next_to_clean, tx_ring->next_to_use);return 0 ; }
@@ -1591,9 +1591,9 @@ int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter, rx_desc =PCH_GBE_RX_DESC (*rx_ring, desNo); rx_desc->gbec_status =DSC_INIT16 ; } -pr_debug ("rx_ring->desc = 0x%08x rx_ring->dma = 0x%08llx " +pr_debug ("rx_ring->desc = 0x%p rx_ring->dma = 0x%08llx " "next_to_clean = 0x%08x next_to_use = 0x%08x\n" , - (u32 ) rx_ring->desc, (unsigned long long )rx_ring->dma, + rx_ring->desc, (unsigned long long )rx_ring->dma, rx_ring->next_to_clean, rx_ring->next_to_use);return 0 ; }
@@ -2102,8 +2102,6 @@ static void pch_gbe_netpoll(struct net_device *netdev)pch_gbe_intr (adapter->pdev->irq, netdev);enable_irq (adapter->pdev->irq); } -#else -#define pch_gbe_netpoll NULL#endif static const struct net_device_ops pch_gbe_netdev_ops = {
@@ -2116,7 +2114,9 @@ static const struct net_device_ops pch_gbe_netdev_ops = { .ndo_change_mtu = pch_gbe_change_mtu, .ndo_do_ioctl = pch_gbe_ioctl, .ndo_set_multicast_list = &pch_gbe_set_multi, +#ifdef CONFIG_NET_POLL_CONTROLLER .ndo_poll_controller = pch_gbe_netpoll, +#endif }; static pci_ers_result_t pch_gbe_io_error_detected(struct pci_dev *pdev,
@@ -2196,6 +2196,7 @@ static int __pch_gbe_suspend(struct pci_dev *pdev)return retval; } +#ifdef CONFIG_PM static int pch_gbe_suspend (struct device *device) {struct pci_dev *pdev =to_pci_dev (device);
@@ -2203,7 +2204,6 @@ static int pch_gbe_suspend(struct device *device)return __pch_gbe_suspend (pdev); } -#ifdef CONFIG_PM static int pch_gbe_resume (struct device *device) {struct pci_dev *pdev =to_pci_dev (device);