All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] drivers: net: stmmac: add blackfin support
@ 2012-05-22  7:38 Bob Liu
  2012-05-22  7:38 ` [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test Bob Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Bob Liu @ 2012-05-22  7:38 UTC (permalink / raw)
  To: davem
  Cc: peppe.cavallaro, francesco.virlinzi, rayagond, sr, netdev,
	uclinux-dist-devel, Bob Liu

Blackfin arch use stmmac on its reference board bf609-ezkit, the stmmac ip
version is 3.61a.

But the spec seems a little different, some register addr and define are not
the same with current code.

This patch add the support for blackfin arch following the spec.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |   29 ++++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |    6 +++-
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |    3 ++
 drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |    5 +++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |    2 +
 5 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
index 7c6d857..cc3ac4f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
@@ -29,6 +29,18 @@
  *	 			MAC BLOCK defines
  *---------------------------------------------------------------------------*/
 /* MAC CSR offset */
+#ifdef CONFIG_BLACKFIN
+#define MAC_CONTROL		0x00000000	/* MAC Control */
+#define MAC_FRAME_FILTER	0x0000004	/* Frame filter */
+#define MAC_HASH_HIGH		0x00000008	/* Multicast Hash Table High */
+#define MAC_HASH_LOW		0x0000000c	/* Multicast Hash Table Low */
+#define MAC_MII_ADDR		0x00000010	/* MII Address */
+#define MAC_MII_DATA		0x00000014	/* MII Data */
+#define MAC_FLOW_CTRL		0x00000018	/* Flow Control */
+#define MAC_VLAN1		0x0000001c	/* VLAN1 Tag */
+#define MAC_ADDR_HIGH		0x00000040	/* MAC Address High */
+#define MAC_ADDR_LOW		0x00000044	/* MAC Address Low */
+#else
 #define MAC_CONTROL	0x00000000	/* MAC Control */
 #define MAC_ADDR_HIGH	0x00000004	/* MAC Address High */
 #define MAC_ADDR_LOW	0x00000008	/* MAC Address Low */
@@ -39,6 +51,18 @@
 #define MAC_FLOW_CTRL	0x0000001c	/* Flow Control */
 #define MAC_VLAN1	0x00000020	/* VLAN1 Tag */
 #define MAC_VLAN2	0x00000024	/* VLAN2 Tag */
+#endif
+
+#ifdef CONFIG_BLACKFIN
+/* MAC_FRAME_FILTER defines */
+#define MAC_FRAME_FILTER_RA  0x80000000
+#define MAC_FRAME_FILTER_PR  0x00000001
+#define MAC_FRAME_FILTER_HMC 0x00000004
+#define MAC_FRAME_FILTER_PM  0x00000010
+
+#define MAC_FRAME_FILTER_INIT (MAC_FRAME_FILTER_RA | MAC_FRAME_FILTER_PR | \
+		MAC_FRAME_FILTER_HMC | MAC_FRAME_FILTER_PM)
+#endif
 
 /* MAC CTRL defines */
 #define MAC_CONTROL_RA	0x80000000	/* Receive All Mode */
@@ -54,6 +78,7 @@
 #define MAC_CONTROL_IF	0x00020000	/* Inverse Filtering */
 #define MAC_CONTROL_PB	0x00010000	/* Pass Bad Frames */
 #define MAC_CONTROL_HO	0x00008000	/* Hash Only Filtering Mode */
+#define MAC_CONTROL_FES	0x00004000	/* Speed in Fast Ethernet Mode */
 #define MAC_CONTROL_HP	0x00002000	/* Hash/Perfect Filtering Mode */
 #define MAC_CONTROL_LCC	0x00001000	/* Late Collision Control */
 #define MAC_CONTROL_DBF	0x00000800	/* Disable Broadcast Frames */
@@ -67,7 +92,11 @@
 #define MAC_CONTROL_TE		0x00000008	/* Transmitter Enable */
 #define MAC_CONTROL_RE		0x00000004	/* Receiver Enable */
 
+#ifdef CONFIG_BLACKFIN
+#define MAC_CORE_INIT (MAC_CONTROL_FES | MAC_CONTROL_DBF)
+#else
 #define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP)
+#endif
 
 /* MAC FLOW CTRL defines */
 #define MAC_FLOW_CTRL_PT_MASK	0xffff0000	/* Pause Time Mask */
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
index 138fb8d..1c49d96 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
@@ -35,7 +35,9 @@
 static void dwmac100_core_init(void __iomem *ioaddr)
 {
 	u32 value = readl(ioaddr + MAC_CONTROL);
-
+#ifdef CONFIG_BLACKFIN
+	writel(MAC_FRAME_FILTER_INIT, ioaddr + MAC_FRAME_FILTER);
+#endif
 	writel((value | MAC_CORE_INIT), ioaddr + MAC_CONTROL);
 
 #ifdef STMMAC_VLAN_TAG_USED
@@ -68,8 +70,10 @@ static void dwmac100_dump_mac_regs(void __iomem *ioaddr)
 		MAC_FLOW_CTRL, readl(ioaddr + MAC_FLOW_CTRL));
 	pr_info("\tVLAN1 tag (offset 0x%x): 0x%08x\n", MAC_VLAN1,
 		readl(ioaddr + MAC_VLAN1));
+#ifndef CONFIG_BLACKFIN
 	pr_info("\tVLAN2 tag (offset 0x%x): 0x%08x\n", MAC_VLAN2,
 		readl(ioaddr + MAC_VLAN2));
+#endif
 }
 
 static void dwmac100_irq_status(void __iomem *ioaddr)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
index bc17fd0..d682a0b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
@@ -50,6 +50,9 @@ static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx,
 	if (limit < 0)
 		return -EBUSY;
 
+#ifdef CONFIG_BLACKFIN
+	writel(DMA_AXI_BUS_BLEN4 | DMA_AXI_BUS_UNDEF, ioaddr + DMA_AXI_BUS);
+#endif
 	/* Enable Application Access by writing to DMA CSR0 */
 	writel(DMA_BUS_MODE_DEFAULT | (pbl << DMA_BUS_MODE_PBL_SHIFT),
 	       ioaddr + DMA_BUS_MODE);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
index 437edac..e75269a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
@@ -32,6 +32,7 @@
 #define DMA_CONTROL		0x00001018	/* Ctrl (Operational Mode) */
 #define DMA_INTR_ENA		0x0000101c	/* Interrupt Enable */
 #define DMA_MISSED_FRAME_CTR	0x00001020	/* Missed Frame Counter */
+#define DMA_AXI_BUS		0x00001028	/* Axi Bus */
 #define DMA_CUR_TX_BUF_ADDR	0x00001050	/* Current Host Tx Buffer */
 #define DMA_CUR_RX_BUF_ADDR	0x00001054	/* Current Host Rx Buffer */
 #define DMA_HW_FEATURE		0x00001058	/* HW Feature Register */
@@ -40,6 +41,10 @@
 #define DMA_CONTROL_ST		0x00002000	/* Start/Stop Transmission */
 #define DMA_CONTROL_SR		0x00000002	/* Start/Stop Receive */
 
+/* DMA Axi bus register defines */
+#define DMA_AXI_BUS_UNDEF	0x00000001
+#define DMA_AXI_BUS_BLEN4	0x00000002
+
 /* DMA Normal interrupt */
 #define DMA_INTR_ENA_NIE 0x00010000	/* Normal Summary */
 #define DMA_INTR_ENA_TIE 0x00000001	/* Transmit Interrupt */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 48d56da..714faa2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1279,8 +1279,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
 			frame_len = priv->hw->desc->get_rx_frame_len(p);
 			/* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
 			 * Type frames (LLC/LLC-SNAP) */
+#ifndef CONFIG_BLACKFIN
 			if (unlikely(status != llc_snap))
 				frame_len -= ETH_FCS_LEN;
+#endif
 #ifdef STMMAC_RX_DEBUG
 			if (frame_len > ETH_FRAME_LEN)
 				pr_debug("\tRX frame size %d, COE status: %d\n",
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test
  2012-05-22  7:38 [PATCH 1/3] drivers: net: stmmac: add blackfin support Bob Liu
@ 2012-05-22  7:38 ` Bob Liu
  2012-05-22 11:56   ` Ben Hutchings
                     ` (2 more replies)
  2012-05-22  7:38 ` [PATCH 3/3] drivers: net: ethernet: stmmac: fix resume function Bob Liu
  2012-05-22 12:36 ` [PATCH 1/3] drivers: net: stmmac: add blackfin support Giuseppe CAVALLARO
  2 siblings, 3 replies; 14+ messages in thread
From: Bob Liu @ 2012-05-22  7:38 UTC (permalink / raw)
  To: davem
  Cc: peppe.cavallaro, francesco.virlinzi, rayagond, sr, netdev,
	uclinux-dist-devel, Bob Liu

Module can't be compiled and installed in current Makefile.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/Makefile |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
index bc965ac..4b50922 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
@@ -1,10 +1,10 @@
 obj-$(CONFIG_STMMAC_ETH) += stmmac.o
-stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
-stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
-stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
-stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
-stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
+stmmac-$(CONFIG_STMMAC_TIMER:m=y) += stmmac_timer.o
+stmmac-$(CONFIG_STMMAC_RING:m=y) += ring_mode.o
+stmmac-$(CONFIG_STMMAC_CHAINED:m=y) += chain_mode.o
+stmmac-$(CONFIG_STMMAC_PLATFORM:m=y) += stmmac_platform.o
+stmmac-$(CONFIG_STMMAC_PCI:m=y) += stmmac_pci.o
 stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o	\
 	      dwmac_lib.o dwmac1000_core.o  dwmac1000_dma.o	\
 	      dwmac100_core.o dwmac100_dma.o enh_desc.o  norm_desc.o \
-	      mmc_core.o $(stmmac-y)
+	      mmc_core.o
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] drivers: net: ethernet: stmmac: fix resume function
  2012-05-22  7:38 [PATCH 1/3] drivers: net: stmmac: add blackfin support Bob Liu
  2012-05-22  7:38 ` [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test Bob Liu
@ 2012-05-22  7:38 ` Bob Liu
  2012-05-22 12:36 ` [PATCH 1/3] drivers: net: stmmac: add blackfin support Giuseppe CAVALLARO
  2 siblings, 0 replies; 14+ messages in thread
From: Bob Liu @ 2012-05-22  7:38 UTC (permalink / raw)
  To: davem
  Cc: peppe.cavallaro, francesco.virlinzi, rayagond, sr, netdev,
	uclinux-dist-devel, Bob Liu

After wake up from mem, ping fails to work.
This patch fix the resume function in stmmac driver.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 714faa2..22243a5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1952,6 +1952,15 @@ int stmmac_resume(struct net_device *ndev)
 		priv->hw->mac->pmt(priv->ioaddr, 0);
 
 	netif_device_attach(ndev);
+	priv->dirty_tx = 0;
+	priv->cur_tx = 0;
+	priv->cur_rx = 0;
+	priv->dirty_rx = 0;
+
+	/* DMA initialization and SW reset */
+	priv->hw->dma->init(priv->ioaddr, priv->plat->pbl,
+			priv->dma_tx_phy, priv->dma_rx_phy);
+	priv->hw->mac->core_init(priv->ioaddr);
 
 	/* Enable the MAC and DMA */
 	stmmac_set_mac(priv->ioaddr, true);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test
  2012-05-22  7:38 ` [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test Bob Liu
@ 2012-05-22 11:56   ` Ben Hutchings
  2012-05-22 12:51   ` Giuseppe CAVALLARO
  2012-05-23  6:05   ` [net] stmmac: fix driver Kconfig when built as module Giuseppe CAVALLARO
  2 siblings, 0 replies; 14+ messages in thread
From: Ben Hutchings @ 2012-05-22 11:56 UTC (permalink / raw)
  To: Bob Liu
  Cc: davem, peppe.cavallaro, francesco.virlinzi, rayagond, sr, netdev,
	uclinux-dist-devel

On Tue, 2012-05-22 at 15:38 +0800, Bob Liu wrote:
> Module can't be compiled and installed in current Makefile.
[...]

That's because CONFIG_STMMAC_PLATFORM and CONFIG_STMMAC_PCI are wrongly
declared as tristate in Kconfig.  Change them to bool and it should work
again.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] drivers: net: stmmac: add blackfin support
  2012-05-22  7:38 [PATCH 1/3] drivers: net: stmmac: add blackfin support Bob Liu
  2012-05-22  7:38 ` [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test Bob Liu
  2012-05-22  7:38 ` [PATCH 3/3] drivers: net: ethernet: stmmac: fix resume function Bob Liu
@ 2012-05-22 12:36 ` Giuseppe CAVALLARO
  2012-05-23  7:58   ` Bob Liu
  2 siblings, 1 reply; 14+ messages in thread
From: Giuseppe CAVALLARO @ 2012-05-22 12:36 UTC (permalink / raw)
  To: Bob Liu
  Cc: davem, francesco.virlinzi, rayagond, sr, netdev, uclinux-dist-devel

Hello Bob Liu

On 5/22/2012 9:38 AM, Bob Liu wrote:
> Blackfin arch use stmmac on its reference board bf609-ezkit, the stmmac ip
> version is 3.61a.
> 
> But the spec seems a little different, some register addr and define are not
> the same with current code.
> 
> This patch add the support for blackfin arch following the spec.

The 3.61a is supported and you have to point to the dw1000.h header file.

To support this GMAC generation you only need to pass from the platform
the field has_gmac (see stmmac.txt).
Also the 3.61a has the HW cap registers so many internal fields (e.g. rx
coe, enhanced descr ...) will be fixed at run-time (although you can
pass them from the platform).

Your patch adds the GMAC SPEC in the old MAC 10/100.

Also I am reluctant to have specific ifdef <ARCH> within the code.
I do think the driver already has all the platform fields to run on your
board. If you need extra conf pls feel free to enhance the
plat_stmmacenet_data.

Peppe
> 
> Signed-off-by: Bob Liu <lliubbo@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac100.h     |   29 ++++++++++++++++++++
>  .../net/ethernet/stmicro/stmmac/dwmac100_core.c    |    6 +++-
>  drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |    3 ++
>  drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h    |    5 +++
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |    2 +
>  5 files changed, 44 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
> index 7c6d857..cc3ac4f 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
> @@ -29,6 +29,18 @@
>   *	 			MAC BLOCK defines
>   *---------------------------------------------------------------------------*/
>  /* MAC CSR offset */
> +#ifdef CONFIG_BLACKFIN
> +#define MAC_CONTROL		0x00000000	/* MAC Control */
> +#define MAC_FRAME_FILTER	0x0000004	/* Frame filter */
> +#define MAC_HASH_HIGH		0x00000008	/* Multicast Hash Table High */
> +#define MAC_HASH_LOW		0x0000000c	/* Multicast Hash Table Low */
> +#define MAC_MII_ADDR		0x00000010	/* MII Address */
> +#define MAC_MII_DATA		0x00000014	/* MII Data */
> +#define MAC_FLOW_CTRL		0x00000018	/* Flow Control */
> +#define MAC_VLAN1		0x0000001c	/* VLAN1 Tag */
> +#define MAC_ADDR_HIGH		0x00000040	/* MAC Address High */
> +#define MAC_ADDR_LOW		0x00000044	/* MAC Address Low */
> +#else
>  #define MAC_CONTROL	0x00000000	/* MAC Control */
>  #define MAC_ADDR_HIGH	0x00000004	/* MAC Address High */
>  #define MAC_ADDR_LOW	0x00000008	/* MAC Address Low */
> @@ -39,6 +51,18 @@
>  #define MAC_FLOW_CTRL	0x0000001c	/* Flow Control */
>  #define MAC_VLAN1	0x00000020	/* VLAN1 Tag */
>  #define MAC_VLAN2	0x00000024	/* VLAN2 Tag */
> +#endif
> +
> +#ifdef CONFIG_BLACKFIN
> +/* MAC_FRAME_FILTER defines */
> +#define MAC_FRAME_FILTER_RA  0x80000000
> +#define MAC_FRAME_FILTER_PR  0x00000001
> +#define MAC_FRAME_FILTER_HMC 0x00000004
> +#define MAC_FRAME_FILTER_PM  0x00000010
> +
> +#define MAC_FRAME_FILTER_INIT (MAC_FRAME_FILTER_RA | MAC_FRAME_FILTER_PR | \
> +		MAC_FRAME_FILTER_HMC | MAC_FRAME_FILTER_PM)
> +#endif
>  
>  /* MAC CTRL defines */
>  #define MAC_CONTROL_RA	0x80000000	/* Receive All Mode */
> @@ -54,6 +78,7 @@
>  #define MAC_CONTROL_IF	0x00020000	/* Inverse Filtering */
>  #define MAC_CONTROL_PB	0x00010000	/* Pass Bad Frames */
>  #define MAC_CONTROL_HO	0x00008000	/* Hash Only Filtering Mode */
> +#define MAC_CONTROL_FES	0x00004000	/* Speed in Fast Ethernet Mode */
>  #define MAC_CONTROL_HP	0x00002000	/* Hash/Perfect Filtering Mode */
>  #define MAC_CONTROL_LCC	0x00001000	/* Late Collision Control */
>  #define MAC_CONTROL_DBF	0x00000800	/* Disable Broadcast Frames */
> @@ -67,7 +92,11 @@
>  #define MAC_CONTROL_TE		0x00000008	/* Transmitter Enable */
>  #define MAC_CONTROL_RE		0x00000004	/* Receiver Enable */
>  
> +#ifdef CONFIG_BLACKFIN
> +#define MAC_CORE_INIT (MAC_CONTROL_FES | MAC_CONTROL_DBF)
> +#else
>  #define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP)
> +#endif
>  
>  /* MAC FLOW CTRL defines */
>  #define MAC_FLOW_CTRL_PT_MASK	0xffff0000	/* Pause Time Mask */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
> index 138fb8d..1c49d96 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
> @@ -35,7 +35,9 @@
>  static void dwmac100_core_init(void __iomem *ioaddr)
>  {
>  	u32 value = readl(ioaddr + MAC_CONTROL);
> -
> +#ifdef CONFIG_BLACKFIN
> +	writel(MAC_FRAME_FILTER_INIT, ioaddr + MAC_FRAME_FILTER);
> +#endif
>  	writel((value | MAC_CORE_INIT), ioaddr + MAC_CONTROL);
>  
>  #ifdef STMMAC_VLAN_TAG_USED
> @@ -68,8 +70,10 @@ static void dwmac100_dump_mac_regs(void __iomem *ioaddr)
>  		MAC_FLOW_CTRL, readl(ioaddr + MAC_FLOW_CTRL));
>  	pr_info("\tVLAN1 tag (offset 0x%x): 0x%08x\n", MAC_VLAN1,
>  		readl(ioaddr + MAC_VLAN1));
> +#ifndef CONFIG_BLACKFIN
>  	pr_info("\tVLAN2 tag (offset 0x%x): 0x%08x\n", MAC_VLAN2,
>  		readl(ioaddr + MAC_VLAN2));
> +#endif
>  }
>  
>  static void dwmac100_irq_status(void __iomem *ioaddr)
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
> index bc17fd0..d682a0b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
> @@ -50,6 +50,9 @@ static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx,
>  	if (limit < 0)
>  		return -EBUSY;
>  
> +#ifdef CONFIG_BLACKFIN
> +	writel(DMA_AXI_BUS_BLEN4 | DMA_AXI_BUS_UNDEF, ioaddr + DMA_AXI_BUS);
> +#endif
>  	/* Enable Application Access by writing to DMA CSR0 */
>  	writel(DMA_BUS_MODE_DEFAULT | (pbl << DMA_BUS_MODE_PBL_SHIFT),
>  	       ioaddr + DMA_BUS_MODE);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
> index 437edac..e75269a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_dma.h
> @@ -32,6 +32,7 @@
>  #define DMA_CONTROL		0x00001018	/* Ctrl (Operational Mode) */
>  #define DMA_INTR_ENA		0x0000101c	/* Interrupt Enable */
>  #define DMA_MISSED_FRAME_CTR	0x00001020	/* Missed Frame Counter */
> +#define DMA_AXI_BUS		0x00001028	/* Axi Bus */
>  #define DMA_CUR_TX_BUF_ADDR	0x00001050	/* Current Host Tx Buffer */
>  #define DMA_CUR_RX_BUF_ADDR	0x00001054	/* Current Host Rx Buffer */
>  #define DMA_HW_FEATURE		0x00001058	/* HW Feature Register */
> @@ -40,6 +41,10 @@
>  #define DMA_CONTROL_ST		0x00002000	/* Start/Stop Transmission */
>  #define DMA_CONTROL_SR		0x00000002	/* Start/Stop Receive */
>  
> +/* DMA Axi bus register defines */
> +#define DMA_AXI_BUS_UNDEF	0x00000001
> +#define DMA_AXI_BUS_BLEN4	0x00000002
> +
>  /* DMA Normal interrupt */
>  #define DMA_INTR_ENA_NIE 0x00010000	/* Normal Summary */
>  #define DMA_INTR_ENA_TIE 0x00000001	/* Transmit Interrupt */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 48d56da..714faa2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1279,8 +1279,10 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
>  			frame_len = priv->hw->desc->get_rx_frame_len(p);
>  			/* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
>  			 * Type frames (LLC/LLC-SNAP) */
> +#ifndef CONFIG_BLACKFIN
>  			if (unlikely(status != llc_snap))
>  				frame_len -= ETH_FCS_LEN;
> +#endif
>  #ifdef STMMAC_RX_DEBUG
>  			if (frame_len > ETH_FRAME_LEN)
>  				pr_debug("\tRX frame size %d, COE status: %d\n",

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test
  2012-05-22  7:38 ` [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test Bob Liu
  2012-05-22 11:56   ` Ben Hutchings
@ 2012-05-22 12:51   ` Giuseppe CAVALLARO
  2012-05-23  5:09     ` Bob Liu
  2012-05-23  6:05   ` [net] stmmac: fix driver Kconfig when built as module Giuseppe CAVALLARO
  2 siblings, 1 reply; 14+ messages in thread
From: Giuseppe CAVALLARO @ 2012-05-22 12:51 UTC (permalink / raw)
  To: Bob Liu
  Cc: davem, francesco.virlinzi, rayagond, sr, netdev, uclinux-dist-devel

On 5/22/2012 9:38 AM, Bob Liu wrote:
> Module can't be compiled and installed in current Makefile.

I've just seen that I can generate the stmmac.ko on ARM and also on x86
with my configuration.

Can you post here you build failure?

In the meantime I'll test the module on ARM soon.

peppe

> 
> Signed-off-by: Bob Liu <lliubbo@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/Makefile |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
> index bc965ac..4b50922 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
> @@ -1,10 +1,10 @@
>  obj-$(CONFIG_STMMAC_ETH) += stmmac.o
> -stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
> -stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
> -stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
> -stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
> -stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
> +stmmac-$(CONFIG_STMMAC_TIMER:m=y) += stmmac_timer.o
> +stmmac-$(CONFIG_STMMAC_RING:m=y) += ring_mode.o
> +stmmac-$(CONFIG_STMMAC_CHAINED:m=y) += chain_mode.o
> +stmmac-$(CONFIG_STMMAC_PLATFORM:m=y) += stmmac_platform.o
> +stmmac-$(CONFIG_STMMAC_PCI:m=y) += stmmac_pci.o
>  stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o	\
>  	      dwmac_lib.o dwmac1000_core.o  dwmac1000_dma.o	\
>  	      dwmac100_core.o dwmac100_dma.o enh_desc.o  norm_desc.o \
> -	      mmc_core.o $(stmmac-y)
> +	      mmc_core.o

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test
  2012-05-22 12:51   ` Giuseppe CAVALLARO
@ 2012-05-23  5:09     ` Bob Liu
  2012-05-23  6:08       ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 14+ messages in thread
From: Bob Liu @ 2012-05-23  5:09 UTC (permalink / raw)
  To: Giuseppe CAVALLARO
  Cc: davem, francesco.virlinzi, rayagond, sr, netdev, uclinux-dist-devel

Hi Peppe,

On Tue, May 22, 2012 at 8:51 PM, Giuseppe CAVALLARO
<peppe.cavallaro@st.com> wrote:
> On 5/22/2012 9:38 AM, Bob Liu wrote:
>> Module can't be compiled and installed in current Makefile.
>
> I've just seen that I can generate the stmmac.ko on ARM and also on x86
> with my configuration.
>
> Can you post here you build failure?
>
> In the meantime I'll test the module on ARM soon.

Yes, stmmac.ko can be generated, but  stmmac_platform.c won't be built.
which cause net device can't be probed.

>
> peppe
>
>>
>> Signed-off-by: Bob Liu <lliubbo@gmail.com>
>> ---
>>  drivers/net/ethernet/stmicro/stmmac/Makefile |   12 ++++++------
>>  1 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
>> index bc965ac..4b50922 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
>> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
>> @@ -1,10 +1,10 @@
>>  obj-$(CONFIG_STMMAC_ETH) += stmmac.o
>> -stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
>> -stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
>> -stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
>> -stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
>> -stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
>> +stmmac-$(CONFIG_STMMAC_TIMER:m=y) += stmmac_timer.o
>> +stmmac-$(CONFIG_STMMAC_RING:m=y) += ring_mode.o
>> +stmmac-$(CONFIG_STMMAC_CHAINED:m=y) += chain_mode.o
>> +stmmac-$(CONFIG_STMMAC_PLATFORM:m=y) += stmmac_platform.o
>> +stmmac-$(CONFIG_STMMAC_PCI:m=y) += stmmac_pci.o
>>  stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o   \
>>             dwmac_lib.o dwmac1000_core.o  dwmac1000_dma.o     \
>>             dwmac100_core.o dwmac100_dma.o enh_desc.o  norm_desc.o \
>> -           mmc_core.o $(stmmac-y)
>> +           mmc_core.o
>

-- 
Thanks,
--Bob

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [net] stmmac: fix driver Kconfig when built as module
  2012-05-22  7:38 ` [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test Bob Liu
  2012-05-22 11:56   ` Ben Hutchings
  2012-05-22 12:51   ` Giuseppe CAVALLARO
@ 2012-05-23  6:05   ` Giuseppe CAVALLARO
  2012-05-23 18:01     ` David Miller
  2 siblings, 1 reply; 14+ messages in thread
From: Giuseppe CAVALLARO @ 2012-05-23  6:05 UTC (permalink / raw)
  To: netdev; +Cc: bhutchings, lliubbo, Giuseppe Cavallaro, Rayagond Kokatanur

This patches fixes the driver when built as dyn module.
In fact the platform part cannot be built and the probe fails
(thanks to Bob Liu that reported this bug).
The patch also makes the selection of Platform and PCI parts
mutually exclusive.

Reported-by: Bob Liu <lliubbo@gmail.com>
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
cc: Rayagond Kokatanur <rayagond@vayavyalabs.com>
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index 0364283..3318b32 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -12,10 +12,12 @@ config STMMAC_ETH
 
 if STMMAC_ETH
 
+choice
+        prompt "STMMAC bus support"
+
 config STMMAC_PLATFORM
-	tristate "STMMAC platform bus support"
+	bool "Platform bus support"
 	depends on STMMAC_ETH
-	default y
 	---help---
 	  This selects the platform specific bus support for
 	  the stmmac device driver. This is the driver used
@@ -26,7 +28,7 @@ config STMMAC_PLATFORM
 	  If unsure, say N.
 
 config STMMAC_PCI
-	tristate "STMMAC support on PCI bus (EXPERIMENTAL)"
+	bool "PCI bus support (EXPERIMENTAL)"
 	depends on STMMAC_ETH && PCI && EXPERIMENTAL
 	---help---
 	  This is to select the Synopsys DWMAC available on PCI devices,
@@ -36,6 +38,7 @@ config STMMAC_PCI
 	  D1215994A VIRTEX FPGA board.
 
 	  If unsure, say N.
+endchoice
 
 config STMMAC_DEBUG_FS
 	bool "Enable monitoring via sysFS "
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test
  2012-05-23  5:09     ` Bob Liu
@ 2012-05-23  6:08       ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 14+ messages in thread
From: Giuseppe CAVALLARO @ 2012-05-23  6:08 UTC (permalink / raw)
  To: Bob Liu
  Cc: davem, francesco.virlinzi, rayagond, sr, netdev, uclinux-dist-devel

On 5/23/2012 7:09 AM, Bob Liu wrote:
> Hi Peppe,
> 
> On Tue, May 22, 2012 at 8:51 PM, Giuseppe CAVALLARO
> <peppe.cavallaro@st.com> wrote:
>> On 5/22/2012 9:38 AM, Bob Liu wrote:
>>> Module can't be compiled and installed in current Makefile.
>>
>> I've just seen that I can generate the stmmac.ko on ARM and also on x86
>> with my configuration.
>>
>> Can you post here you build failure?
>>
>> In the meantime I'll test the module on ARM soon.
> 
> Yes, stmmac.ko can be generated, but  stmmac_platform.c won't be built.
> which cause net device can't be probed.

Yes you are perfectly right!

I've just sent a patch following Ben's advice.

Also not clear if/how to build this as a system which supports both PCI
and platform versions of the driver. So the patch makes them mutually
exclusive.

Thanks a lot
peppe

> 
>>
>> peppe
>>
>>>
>>> Signed-off-by: Bob Liu <lliubbo@gmail.com>
>>> ---
>>>  drivers/net/ethernet/stmicro/stmmac/Makefile |   12 ++++++------
>>>  1 files changed, 6 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
>>> index bc965ac..4b50922 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/Makefile
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
>>> @@ -1,10 +1,10 @@
>>>  obj-$(CONFIG_STMMAC_ETH) += stmmac.o
>>> -stmmac-$(CONFIG_STMMAC_TIMER) += stmmac_timer.o
>>> -stmmac-$(CONFIG_STMMAC_RING) += ring_mode.o
>>> -stmmac-$(CONFIG_STMMAC_CHAINED) += chain_mode.o
>>> -stmmac-$(CONFIG_STMMAC_PLATFORM) += stmmac_platform.o
>>> -stmmac-$(CONFIG_STMMAC_PCI) += stmmac_pci.o
>>> +stmmac-$(CONFIG_STMMAC_TIMER:m=y) += stmmac_timer.o
>>> +stmmac-$(CONFIG_STMMAC_RING:m=y) += ring_mode.o
>>> +stmmac-$(CONFIG_STMMAC_CHAINED:m=y) += chain_mode.o
>>> +stmmac-$(CONFIG_STMMAC_PLATFORM:m=y) += stmmac_platform.o
>>> +stmmac-$(CONFIG_STMMAC_PCI:m=y) += stmmac_pci.o
>>>  stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o   \
>>>             dwmac_lib.o dwmac1000_core.o  dwmac1000_dma.o     \
>>>             dwmac100_core.o dwmac100_dma.o enh_desc.o  norm_desc.o \
>>> -           mmc_core.o $(stmmac-y)
>>> +           mmc_core.o
>>
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] drivers: net: stmmac: add blackfin support
  2012-05-22 12:36 ` [PATCH 1/3] drivers: net: stmmac: add blackfin support Giuseppe CAVALLARO
@ 2012-05-23  7:58   ` Bob Liu
  2012-05-23  8:21     ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 14+ messages in thread
From: Bob Liu @ 2012-05-23  7:58 UTC (permalink / raw)
  To: Giuseppe CAVALLARO
  Cc: davem, francesco.virlinzi, rayagond, sr, netdev, uclinux-dist-devel

Hi Peppe,

On 5/22/12, Giuseppe CAVALLARO <peppe.cavallaro@st.com> wrote:
> Hello Bob Liu
>
> On 5/22/2012 9:38 AM, Bob Liu wrote:
>> Blackfin arch use stmmac on its reference board bf609-ezkit, the stmmac
>> ip
>> version is 3.61a.
>>
>> But the spec seems a little different, some register addr and define are
>> not
>> the same with current code.
>>
>> This patch add the support for blackfin arch following the spec.
>
> The 3.61a is supported and you have to point to the dw1000.h header file.
>
> To support this GMAC generation you only need to pass from the platform
> the field has_gmac (see stmmac.txt).
> Also the 3.61a has the HW cap registers so many internal fields (e.g. rx
> coe, enhanced descr ...) will be fixed at run-time (although you can
> pass them from the platform).
>
> Your patch adds the GMAC SPEC in the old MAC 10/100.
>
> Also I am reluctant to have specific ifdef <ARCH> within the code.
> I do think the driver already has all the platform fields to run on your
> board. If you need extra conf pls feel free to enhance the
> plat_stmmacenet_data.
>

Thank you for your reply.
I tried to use driver dwmac1000 by setting .has_gmac = 1 today.
Ping can finish with no error but when rcp a file or telnet it will hang.

Using below patch without setting .has_gmac, everything works fine.
Any ideas?  Thank you.

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
index 7c6d857..00499b8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
@@ -29,6 +29,18 @@
  *                             MAC BLOCK defines
  *---------------------------------------------------------------------------*/
 /* MAC CSR offset */
+#if defined(CONFIG_BLACKFIN)
+#define MAC_CONTROL    0x00000000      /* MAC Control */
+#define MAC_FRAME_FILTER       0x0000004       /* Frame filter */
+#define MAC_HASH_HIGH  0x00000008      /* Multicast Hash Table High */
+#define MAC_HASH_LOW   0x0000000c      /* Multicast Hash Table Low */
+#define MAC_MII_ADDR   0x00000010      /* MII Address */
+#define MAC_MII_DATA   0x00000014      /* MII Data */
+#define MAC_FLOW_CTRL  0x00000018      /* Flow Control */
+#define MAC_VLAN1      0x0000001c      /* VLAN1 Tag */
+#define MAC_ADDR_HIGH  0x00000040      /* MAC Address High */
+#define MAC_ADDR_LOW   0x00000044      /* MAC Address Low */
+#else
 #define MAC_CONTROL    0x00000000      /* MAC Control */
 #define MAC_ADDR_HIGH  0x00000004      /* MAC Address High */
 #define MAC_ADDR_LOW   0x00000008      /* MAC Address Low */
@@ -39,6 +51,7 @@
 #define MAC_FLOW_CTRL  0x0000001c      /* Flow Control */
 #define MAC_VLAN1      0x00000020      /* VLAN1 Tag */
 #define MAC_VLAN2      0x00000024      /* VLAN2 Tag */
+#endif

 /* MAC CTRL defines */
 #define MAC_CONTROL_RA 0x80000000      /* Receive All Mode */
@@ -67,7 +80,11 @@
 #define MAC_CONTROL_TE         0x00000008      /* Transmitter Enable */
 #define MAC_CONTROL_RE         0x00000004      /* Receiver Enable */

+#ifdef CONFIG_BLACKFIN
+#define MAC_CORE_INIT ((1 << 14) | MAC_CONTROL_DBF)
+#else
 #define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP)
+#endif

 /* MAC FLOW CTRL defines */
 #define MAC_FLOW_CTRL_PT_MASK  0xffff0000      /* Pause Time Mask */

-- 
Regards,
--Bob

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] drivers: net: stmmac: add blackfin support
  2012-05-23  7:58   ` Bob Liu
@ 2012-05-23  8:21     ` Giuseppe CAVALLARO
  2012-05-23  8:27       ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 14+ messages in thread
From: Giuseppe CAVALLARO @ 2012-05-23  8:21 UTC (permalink / raw)
  To: Bob Liu
  Cc: davem, francesco.virlinzi, rayagond, sr, netdev, uclinux-dist-devel

Hello Bob Liu

On 5/23/2012 9:58 AM, Bob Liu wrote:
> Hi Peppe,
> 
> On 5/22/12, Giuseppe CAVALLARO <peppe.cavallaro@st.com> wrote:
>> Hello Bob Liu
>>
>> On 5/22/2012 9:38 AM, Bob Liu wrote:
>>> Blackfin arch use stmmac on its reference board bf609-ezkit, the stmmac
>>> ip
>>> version is 3.61a.
>>>
>>> But the spec seems a little different, some register addr and define are
>>> not
>>> the same with current code.
>>>
>>> This patch add the support for blackfin arch following the spec.
>>
>> The 3.61a is supported and you have to point to the dw1000.h header file.
>>
>> To support this GMAC generation you only need to pass from the platform
>> the field has_gmac (see stmmac.txt).
>> Also the 3.61a has the HW cap registers so many internal fields (e.g. rx
>> coe, enhanced descr ...) will be fixed at run-time (although you can
>> pass them from the platform).
>>
>> Your patch adds the GMAC SPEC in the old MAC 10/100.
>>
>> Also I am reluctant to have specific ifdef <ARCH> within the code.
>> I do think the driver already has all the platform fields to run on your
>> board. If you need extra conf pls feel free to enhance the
>> plat_stmmacenet_data.
>>
> 
> Thank you for your reply.
> I tried to use driver dwmac1000 by setting .has_gmac = 1 today.
> Ping can finish with no error but when rcp a file or telnet it will hang.

Hmm this should be debugged ... maybe you can verify the tx / rx
checksum. I mean if your IP has these modules or if, for somereason, the
HW cap register is not present and there are not properly fixed

> 
> Using below patch without setting .has_gmac, everything works fine.

With your patch (that added the dwmac1000 into the dwmac100) you are
indeed using the MAC100 setting where by default there is no HW
checksumming ;-)

> Any ideas?  Thank you.

you are welcome

Peppe

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
> b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
> index 7c6d857..00499b8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
> @@ -29,6 +29,18 @@
>   *                             MAC BLOCK defines
>   *---------------------------------------------------------------------------*/
>  /* MAC CSR offset */
> +#if defined(CONFIG_BLACKFIN)
> +#define MAC_CONTROL    0x00000000      /* MAC Control */
> +#define MAC_FRAME_FILTER       0x0000004       /* Frame filter */
> +#define MAC_HASH_HIGH  0x00000008      /* Multicast Hash Table High */
> +#define MAC_HASH_LOW   0x0000000c      /* Multicast Hash Table Low */
> +#define MAC_MII_ADDR   0x00000010      /* MII Address */
> +#define MAC_MII_DATA   0x00000014      /* MII Data */
> +#define MAC_FLOW_CTRL  0x00000018      /* Flow Control */
> +#define MAC_VLAN1      0x0000001c      /* VLAN1 Tag */
> +#define MAC_ADDR_HIGH  0x00000040      /* MAC Address High */
> +#define MAC_ADDR_LOW   0x00000044      /* MAC Address Low */
> +#else
>  #define MAC_CONTROL    0x00000000      /* MAC Control */
>  #define MAC_ADDR_HIGH  0x00000004      /* MAC Address High */
>  #define MAC_ADDR_LOW   0x00000008      /* MAC Address Low */
> @@ -39,6 +51,7 @@
>  #define MAC_FLOW_CTRL  0x0000001c      /* Flow Control */
>  #define MAC_VLAN1      0x00000020      /* VLAN1 Tag */
>  #define MAC_VLAN2      0x00000024      /* VLAN2 Tag */
> +#endif
> 
>  /* MAC CTRL defines */
>  #define MAC_CONTROL_RA 0x80000000      /* Receive All Mode */
> @@ -67,7 +80,11 @@
>  #define MAC_CONTROL_TE         0x00000008      /* Transmitter Enable */
>  #define MAC_CONTROL_RE         0x00000004      /* Receiver Enable */
> 
> +#ifdef CONFIG_BLACKFIN
> +#define MAC_CORE_INIT ((1 << 14) | MAC_CONTROL_DBF)
> +#else
>  #define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP)
> +#endif
> 
>  /* MAC FLOW CTRL defines */
>  #define MAC_FLOW_CTRL_PT_MASK  0xffff0000      /* Pause Time Mask */
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] drivers: net: stmmac: add blackfin support
  2012-05-23  8:21     ` Giuseppe CAVALLARO
@ 2012-05-23  8:27       ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 14+ messages in thread
From: Giuseppe CAVALLARO @ 2012-05-23  8:27 UTC (permalink / raw)
  To: Giuseppe CAVALLARO
  Cc: Bob Liu, davem, francesco.virlinzi, rayagond, sr, netdev,
	uclinux-dist-devel

On 5/23/2012 10:21 AM, Giuseppe CAVALLARO wrote:
> Hello Bob Liu
> 
> On 5/23/2012 9:58 AM, Bob Liu wrote:
>> Hi Peppe,
>>
>> On 5/22/12, Giuseppe CAVALLARO <peppe.cavallaro@st.com> wrote:
>>> Hello Bob Liu
>>>
>>> On 5/22/2012 9:38 AM, Bob Liu wrote:
>>>> Blackfin arch use stmmac on its reference board bf609-ezkit, the stmmac
>>>> ip
>>>> version is 3.61a.
>>>>
>>>> But the spec seems a little different, some register addr and define are
>>>> not
>>>> the same with current code.
>>>>
>>>> This patch add the support for blackfin arch following the spec.
>>>
>>> The 3.61a is supported and you have to point to the dw1000.h header file.
>>>
>>> To support this GMAC generation you only need to pass from the platform
>>> the field has_gmac (see stmmac.txt).
>>> Also the 3.61a has the HW cap registers so many internal fields (e.g. rx
>>> coe, enhanced descr ...) will be fixed at run-time (although you can
>>> pass them from the platform).
>>>
>>> Your patch adds the GMAC SPEC in the old MAC 10/100.
>>>
>>> Also I am reluctant to have specific ifdef <ARCH> within the code.
>>> I do think the driver already has all the platform fields to run on your
>>> board. If you need extra conf pls feel free to enhance the
>>> plat_stmmacenet_data.
>>>
>>
>> Thank you for your reply.
>> I tried to use driver dwmac1000 by setting .has_gmac = 1 today.
>> Ping can finish with no error but when rcp a file or telnet it will hang.
> 
> Hmm this should be debugged ... maybe you can verify the tx / rx
> checksum. I mean if your IP has these modules or if, for somereason, the
> HW cap register is not present and there are not properly fixed
> 
>>
>> Using below patch without setting .has_gmac, everything works fine.
> 
> With your patch (that added the dwmac1000 into the dwmac100) you are
> indeed using the MAC100 setting where by default there is no HW
> checksumming ;-)

 platform fields to use are: tx_coe and rx_coe.

Peppe

>> Any ideas?  Thank you.
> 
> you are welcome
> 
> Peppe
> 
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
>> b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
>> index 7c6d857..00499b8 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100.h
>> @@ -29,6 +29,18 @@
>>   *                             MAC BLOCK defines
>>   *---------------------------------------------------------------------------*/
>>  /* MAC CSR offset */
>> +#if defined(CONFIG_BLACKFIN)
>> +#define MAC_CONTROL    0x00000000      /* MAC Control */
>> +#define MAC_FRAME_FILTER       0x0000004       /* Frame filter */
>> +#define MAC_HASH_HIGH  0x00000008      /* Multicast Hash Table High */
>> +#define MAC_HASH_LOW   0x0000000c      /* Multicast Hash Table Low */
>> +#define MAC_MII_ADDR   0x00000010      /* MII Address */
>> +#define MAC_MII_DATA   0x00000014      /* MII Data */
>> +#define MAC_FLOW_CTRL  0x00000018      /* Flow Control */
>> +#define MAC_VLAN1      0x0000001c      /* VLAN1 Tag */
>> +#define MAC_ADDR_HIGH  0x00000040      /* MAC Address High */
>> +#define MAC_ADDR_LOW   0x00000044      /* MAC Address Low */
>> +#else
>>  #define MAC_CONTROL    0x00000000      /* MAC Control */
>>  #define MAC_ADDR_HIGH  0x00000004      /* MAC Address High */
>>  #define MAC_ADDR_LOW   0x00000008      /* MAC Address Low */
>> @@ -39,6 +51,7 @@
>>  #define MAC_FLOW_CTRL  0x0000001c      /* Flow Control */
>>  #define MAC_VLAN1      0x00000020      /* VLAN1 Tag */
>>  #define MAC_VLAN2      0x00000024      /* VLAN2 Tag */
>> +#endif
>>
>>  /* MAC CTRL defines */
>>  #define MAC_CONTROL_RA 0x80000000      /* Receive All Mode */
>> @@ -67,7 +80,11 @@
>>  #define MAC_CONTROL_TE         0x00000008      /* Transmitter Enable */
>>  #define MAC_CONTROL_RE         0x00000004      /* Receiver Enable */
>>
>> +#ifdef CONFIG_BLACKFIN
>> +#define MAC_CORE_INIT ((1 << 14) | MAC_CONTROL_DBF)
>> +#else
>>  #define MAC_CORE_INIT (MAC_CONTROL_HBD | MAC_CONTROL_ASTP)
>> +#endif
>>
>>  /* MAC FLOW CTRL defines */
>>  #define MAC_FLOW_CTRL_PT_MASK  0xffff0000      /* Pause Time Mask */
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [net] stmmac: fix driver Kconfig when built as module
  2012-05-23  6:05   ` [net] stmmac: fix driver Kconfig when built as module Giuseppe CAVALLARO
@ 2012-05-23 18:01     ` David Miller
  2012-05-28  5:44       ` Giuseppe CAVALLARO
  0 siblings, 1 reply; 14+ messages in thread
From: David Miller @ 2012-05-23 18:01 UTC (permalink / raw)
  To: peppe.cavallaro; +Cc: netdev, bhutchings, lliubbo, rayagond

From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Wed, 23 May 2012 08:05:42 +0200

> This patches fixes the driver when built as dyn module.
> In fact the platform part cannot be built and the probe fails
> (thanks to Bob Liu that reported this bug).
> The patch also makes the selection of Platform and PCI parts
> mutually exclusive.
> 
> Reported-by: Bob Liu <lliubbo@gmail.com>
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>

We have drivers which support both OF (which is implemented as
platform bus) and PCI at the same time.  For example,
drivers/net/ethernet/sun/niu.c

I do not see why stmmac cannot support both at the same time as well.

I absolutely do not want such segregation unless it is absolutely
necessary.  Because it means that no matter what is choosen, a piece
of code is disabled and therefore not getting build and/or runtime
validation.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [net] stmmac: fix driver Kconfig when built as module
  2012-05-23 18:01     ` David Miller
@ 2012-05-28  5:44       ` Giuseppe CAVALLARO
  0 siblings, 0 replies; 14+ messages in thread
From: Giuseppe CAVALLARO @ 2012-05-28  5:44 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, bhutchings, lliubbo, rayagond

On 5/23/2012 8:01 PM, David Miller wrote:
> From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
> Date: Wed, 23 May 2012 08:05:42 +0200
> 
>> This patches fixes the driver when built as dyn module.
>> In fact the platform part cannot be built and the probe fails
>> (thanks to Bob Liu that reported this bug).
>> The patch also makes the selection of Platform and PCI parts
>> mutually exclusive.
>>
>> Reported-by: Bob Liu <lliubbo@gmail.com>
>> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com>
> 
> We have drivers which support both OF (which is implemented as
> platform bus) and PCI at the same time.  For example,
> drivers/net/ethernet/sun/niu.c
> 
> I do not see why stmmac cannot support both at the same time as well.
> 
> I absolutely do not want such segregation unless it is absolutely
> necessary.  Because it means that no matter what is choosen, a piece
> of code is disabled and therefore not getting build and/or runtime
> validation.

Ok, I'll review it and resend all the patches asap.

Regards
Peppe

> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-05-28  5:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-22  7:38 [PATCH 1/3] drivers: net: stmmac: add blackfin support Bob Liu
2012-05-22  7:38 ` [PATCH 2/3] drivers: net: ethernet: stmmac: fix failure in module test Bob Liu
2012-05-22 11:56   ` Ben Hutchings
2012-05-22 12:51   ` Giuseppe CAVALLARO
2012-05-23  5:09     ` Bob Liu
2012-05-23  6:08       ` Giuseppe CAVALLARO
2012-05-23  6:05   ` [net] stmmac: fix driver Kconfig when built as module Giuseppe CAVALLARO
2012-05-23 18:01     ` David Miller
2012-05-28  5:44       ` Giuseppe CAVALLARO
2012-05-22  7:38 ` [PATCH 3/3] drivers: net: ethernet: stmmac: fix resume function Bob Liu
2012-05-22 12:36 ` [PATCH 1/3] drivers: net: stmmac: add blackfin support Giuseppe CAVALLARO
2012-05-23  7:58   ` Bob Liu
2012-05-23  8:21     ` Giuseppe CAVALLARO
2012-05-23  8:27       ` Giuseppe CAVALLARO

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.