Commit ff43da86 authored by Frank Li's avatar Frank Li Committed by David S. Miller

NET: FEC: dynamtic check DMA desc buff type

MX6 and mx28 support enhanced DMA descriptor buff to support 1588
ptp. But MX25, MX3x, MX5x can't support enhanced DMA descriptor buff.
Check fec type and choose correct DMA descriptor buff type.

Remove static config CONFIG_FEC_PTP.
ptp function will be auto detected.
Signed-off-by: default avatarFrank Li <Frank.Li@freescale.com>
Acked-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 579e1d81
...@@ -26,6 +26,7 @@ config FEC ...@@ -26,6 +26,7 @@ config FEC
ARCH_MXC || SOC_IMX28) ARCH_MXC || SOC_IMX28)
default ARCH_MXC || SOC_IMX28 if ARM default ARCH_MXC || SOC_IMX28 if ARM
select PHYLIB select PHYLIB
select PTP_1588_CLOCK
---help--- ---help---
Say Y here if you want to use the built-in 10/100 Fast ethernet Say Y here if you want to use the built-in 10/100 Fast ethernet
controller on some Motorola ColdFire and Freescale i.MX processors. controller on some Motorola ColdFire and Freescale i.MX processors.
...@@ -92,12 +93,4 @@ config GIANFAR ...@@ -92,12 +93,4 @@ config GIANFAR
This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx, This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
and MPC86xx family of chips, and the FEC on the 8540. and MPC86xx family of chips, and the FEC on the 8540.
config FEC_PTP
bool "PTP Hardware Clock (PHC)"
depends on FEC && ARCH_MXC && !SOC_IMX25 && !SOC_IMX27 && !SOC_IMX35 && !SOC_IMX5
select PTP_1588_CLOCK
--help---
Say Y here if you want to use PTP Hardware Clock (PHC) in the
driver. Only the basic clock operations have been implemented.
endif # NET_VENDOR_FREESCALE endif # NET_VENDOR_FREESCALE
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
# Makefile for the Freescale network device drivers. # Makefile for the Freescale network device drivers.
# #
obj-$(CONFIG_FEC) += fec.o obj-$(CONFIG_FEC) += fec.o fec_ptp.o
obj-$(CONFIG_FEC_PTP) += fec_ptp.o
obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx.o obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx.o
ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y) ifeq ($(CONFIG_FEC_MPC52xx_MDIO),y)
obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx_phy.o obj-$(CONFIG_FEC_MPC52xx) += fec_mpc52xx_phy.o
......
This diff is collapsed.
...@@ -13,11 +13,9 @@ ...@@ -13,11 +13,9 @@
#define FEC_H #define FEC_H
/****************************************************************************/ /****************************************************************************/
#ifdef CONFIG_FEC_PTP
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/net_tstamp.h> #include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h> #include <linux/ptp_clock_kernel.h>
#endif
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \ #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
defined(CONFIG_M520x) || defined(CONFIG_M532x) || \ defined(CONFIG_M520x) || defined(CONFIG_M532x) || \
...@@ -94,14 +92,17 @@ struct bufdesc { ...@@ -94,14 +92,17 @@ struct bufdesc {
unsigned short cbd_datlen; /* Data length */ unsigned short cbd_datlen; /* Data length */
unsigned short cbd_sc; /* Control and status info */ unsigned short cbd_sc; /* Control and status info */
unsigned long cbd_bufaddr; /* Buffer address */ unsigned long cbd_bufaddr; /* Buffer address */
#ifdef CONFIG_FEC_PTP };
struct bufdesc_ex {
struct bufdesc desc;
unsigned long cbd_esc; unsigned long cbd_esc;
unsigned long cbd_prot; unsigned long cbd_prot;
unsigned long cbd_bdu; unsigned long cbd_bdu;
unsigned long ts; unsigned long ts;
unsigned short res0[4]; unsigned short res0[4];
#endif
}; };
#else #else
struct bufdesc { struct bufdesc {
unsigned short cbd_sc; /* Control and status info */ unsigned short cbd_sc; /* Control and status info */
...@@ -203,9 +204,7 @@ struct fec_enet_private { ...@@ -203,9 +204,7 @@ struct fec_enet_private {
struct clk *clk_ipg; struct clk *clk_ipg;
struct clk *clk_ahb; struct clk *clk_ahb;
#ifdef CONFIG_FEC_PTP
struct clk *clk_ptp; struct clk *clk_ptp;
#endif
/* The saved address of a sent-in-place packet/buffer, for skfree(). */ /* The saved address of a sent-in-place packet/buffer, for skfree(). */
unsigned char *tx_bounce[TX_RING_SIZE]; unsigned char *tx_bounce[TX_RING_SIZE];
...@@ -243,8 +242,8 @@ struct fec_enet_private { ...@@ -243,8 +242,8 @@ struct fec_enet_private {
int full_duplex; int full_duplex;
struct completion mdio_done; struct completion mdio_done;
int irq[FEC_IRQ_NUM]; int irq[FEC_IRQ_NUM];
int bufdesc_ex;
#ifdef CONFIG_FEC_PTP
struct ptp_clock *ptp_clock; struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_caps; struct ptp_clock_info ptp_caps;
unsigned long last_overflow_check; unsigned long last_overflow_check;
...@@ -257,15 +256,12 @@ struct fec_enet_private { ...@@ -257,15 +256,12 @@ struct fec_enet_private {
int hwts_rx_en; int hwts_rx_en;
int hwts_tx_en; int hwts_tx_en;
struct timer_list time_keep; struct timer_list time_keep;
#endif
}; };
#ifdef CONFIG_FEC_PTP
void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev); void fec_ptp_init(struct net_device *ndev, struct platform_device *pdev);
void fec_ptp_start_cyclecounter(struct net_device *ndev); void fec_ptp_start_cyclecounter(struct net_device *ndev);
int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd); int fec_ptp_ioctl(struct net_device *ndev, struct ifreq *ifr, int cmd);
#endif
/****************************************************************************/ /****************************************************************************/
#endif /* FEC_H */ #endif /* FEC_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment