pch_gbe: Add MinnowBoard support
Subsystems (2)
v4 cover pch_gbe: Add MinnowBoard support
Andy caught a couple more nits which I should have caught (and one I am surprised that checkpatch did not catch). I have read over this patch series one more time carefully and did not find anything additional in need of correction. So here is V4.
Add support for the MinnowBoard in the pch_gbe driver. This was originally sent to LKML as part of the MinnowBoard support series. That is now partially merged and this version of the patch has been isolated from those changes and is now completely self-contained.
Thanks to everyone on Cc for their time in reviewing, the patch series is better for it.
V2:
Whitespace cleanup
Remove trailing period in messages
Comment formatting (added a colon)
Use devm_gpio_request_one
Fix missing adapter->pdata NULL check in PHY
Use netdev style comment blocks
Use kernel_ulong_t for driver_data cast
Use unsigned for gpio and unsigned long for flags
V3:
Restore /** comment start for file consistency per Joe Perches
following his checkpatch.pl patch
Make pch_gbe_phy_tx_clk_delay() static per David Miller
V4:
Add space in function pointer declaration per Andy Shevchenko Remove unnecessary inclusion of mod_devicetable.h per Andy Shevchenko
The following changes since commit 18afa4b028b46f8b45ca64f94aefe717c297b07d:
net: Make devnet_rename_seq static (2013-07-24 17:57:26 -0700)
are available in the git repository at:
git://git.infradead.org/users/dvhart/linux-2.6.git minnow/net-next ssh://git.infradead.org/srv/git/users/dvhart/linux-2.6.git minnow/net-next
and browsable here:
http://git.infradead.org/users/dvhart/linux-2.6.git/shortlog/refs/heads/minnow/net-next
Darren Hart (2):
pch_gbe: Use PCH_GBE_PHY_REGS_LEN instead of 32
pch_gbe: Add MinnowBoard support
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h | 15 ++++ .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 51 ++++++++++- .../net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.c | 98 ++++++++++++++++++++++ .../net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.h | 1 + 4 files changed, 164 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
PATCH v4 1/2 pch_gbe: Use PCH_GBE_PHY_REGS_LEN instead of 32
Avoid using magic numbers when we have perfectly good defines just lying around.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +1 -1
@@ -682,7 +682,7 @@ static int pch_gbe_init_phy(struct pch_gbe_adapter *adapter) } adapter->hw.phy.addr = adapter->mii.phy_id;netdev_dbg (netdev,"phy_addr = %d\n" , adapter->mii.phy_id); -if (addr ==32 ) +if (addr ==PCH_GBE_PHY_REGS_LEN )return -EAGAIN ;/* Selected the phy and isolate the rest */ for (addr =0 ; addr <PCH_GBE_PHY_REGS_LEN ; addr++) {
Signature · 1 line
1.8.3.1
PATCH v4 2/2 pch_gbe: Add MinnowBoard support
The MinnowBoard uses an AR803x PHY with the PCH GBE which requires special handling. Use the MinnowBoard PCI Subsystem ID to detect this and add a pci_device_id.driver_data structure and functions to handle platform setup.
The AR803x does not implement the RGMII 2ns TX clock delay in the trace routing nor via strapping. Add a detection method for the board and the PHY and enable the TX clock delay via the registers.
This PHY will hibernate without link for 10 seconds. Ensure the PHY is awake for probe and then disable hibernation. A future improvement would be to convert pch_gbe to using PHYLIB and making sure we can wake the PHY at the necessary times rather than permanently disabling it.
--- drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h | 15 ++++ .../net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c | 49 +++++++++++ .../net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.c | 98 ++++++++++++++++++++++ .../net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.h | 1 + 4 files changed, 163 insertions(+)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe.h +15 -0
@@ -582,6 +582,19 @@ struct pch_gbe_hw_stats { };/** +* struct pch_gbe_privdata - PCI Device ID driver data +* @phy_tx_clk_delay: Bool, configure the PHY TX delay in software +* @phy_disable_hibernate: Bool, disable PHY hibernation +* @platform_init: Platform initialization callback, called from +* probe, prior to PHY initialization. +*/ +struct pch_gbe_privdata { +bool phy_tx_clk_delay; +bool phy_disable_hibernate; +int (*platform_init)(struct pci_dev *pdev); +}; + +/** * struct pch_gbe_adapter - board specific private data structure * @stats_lock: Spinlock structure for status * @ethtool_lock: Spinlock structure for ethtool
@@ -604,6 +617,7 @@ struct pch_gbe_hw_stats {* @rx_buffer_len: Receive buffer length * @tx_queue_len: Transmit queue length * @have_msi: PCI MSI mode flag +* @pch_gbe_privdata: PCI Device ID driver_data */ struct pch_gbe_adapter {
@@ -631,6 +645,7 @@ struct pch_gbe_adapter {int hwts_tx_en;int hwts_rx_en;struct pci_dev *ptp_pdev; +struct pch_gbe_privdata *pdata; };#define pch_gbe_hw_to_adapter (hw) container_of(hw, struct pch_gbe_adapter, hw)
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c +49 -0
82 lines not on this page · raw message
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.c +98 -0
114 lines not on this page · raw message
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_phy.h +1 -0
@@ -33,5 +33,6 @@ void pch_gbe_phy_power_up(struct pch_gbe_hw *hw);void pch_gbe_phy_power_down (struct pch_gbe_hw *hw);void pch_gbe_phy_set_rgmii (struct pch_gbe_hw *hw);void pch_gbe_phy_init_setting (struct pch_gbe_hw *hw); +int pch_gbe_phy_disable_hibernate (struct pch_gbe_hw *hw);#endif /* _PCH_GBE_PHY_H_ */
Signature · 1 line
1.8.3.1