Gigabit Ethernet driver of Topcliff PCH
Subsystems (2)
PATCH v4 1/1 Gigabit Ethernet driver of Topcliff PCH
This patch was modified by the comments of the following reviewer.
-David
-Joe
-Jiri
About power management (Jiri and Rafael's comment), it has not modified yet.
--- 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 | 2469 +++++++++++++++++++++++++++++++++ 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, 4821 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 +2469 -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: Wed, 15 Sep 2010 22:36:09 +0900
Quoted 4 lines
drivers/net/pch_gbe/pch_gbe.h new file +4
-0+struct pch_gbe_regs_mac_adr { +u32 high; +u32 low; +} __attribute__ ((packed));;
...
Quoted 1 line
+struct
pch_gbe_regs{
...
Quoted 1 line
+}
__attribute__((packed));
...
Quoted 1 line
+struct
pch_gbe_rx_desc{
...
Quoted 1 line
+}
__attribute__((packed));;
...
Quoted 1 line
+struct
pch_gbe_tx_desc{
...
Quoted 1 line
+}
__attribute__((packed));;
The packed attribute should not be necessary for any of these datastructures, so unless you can prove they are needed please remove the attribute tag.
Besides being unnecessary, it will make cpu access to these descriptors extremely slow on risc cpus, as the compiler will emit byte-at-a-time accesses for all members of the structure larger than one byte.