Re: [BUG] net: stmmac: socfpga ethernet no longer working on linux-next

2018-06-15 Thread Jose Abreu
On 14-06-2018 17:18, Dinh Nguyen wrote:
> On Thu, Jun 14, 2018 at 10:23 AM Jose Abreu  wrote:
>> On 14-06-2018 15:21, Dinh Nguyen wrote:
>>> [0.835537] socfpga-dwmac ff702000.ethernet: PTP uses main clock
>>> [0.841794] socfpga-dwmac ff702000.ethernet: Version ID not available
>>> [0.848223] socfpga-dwmac ff702000.ethernet: DWMAC1000
>>> [0.853454] socfpga-dwmac ff702000.ethernet: Normal descriptors
>>> [0.859357] socfpga-dwmac ff702000.ethernet: Ring mode enabled
>>> [0.865184] socfpga-dwmac ff702000.ethernet: DMA HW capability register 
>>> suppo
>>> rted
>>> [0.872654] socfpga-dwmac ff702000.ethernet: RX Checksum Offload Engine 
>>> suppo
>>> rted
>>> [0.880113] socfpga-dwmac ff702000.ethernet: COE Type 2
>>> [0.885329] socfpga-dwmac ff702000.ethernet: TX Checksum insertion 
>>> supported
>>>
>> Interesting ... Please check if bellow patch makes thing work
>> again (if not please send me the resultant dmesg log and also the
>> log without the problematic patch that you identified):
>>
>> >8--
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c
>> b/drivers/net/ethernet/stmicro/stmmac/hwif.c
>> index 14770fc..1961819 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
>> @@ -252,12 +252,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
>>  return ret;
>>  }
>>
>> -/* Run quirks, if needed */
>> -if (entry->quirks) {
>> -ret = entry->quirks(priv);
>> -if (ret)
>> -return ret;
>> -}
>> +/* Save quirks, if needed for posterior use */
>> +priv->hwif_quirks = entry->quirks;
>>
>>  return 0;
>>  }
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> index 025efbf..be7da43 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
>> @@ -193,6 +193,9 @@ struct stmmac_priv {
>>
>>  /* Pulse Per Second output */
>>  struct stmmac_pps_cfg pps[STMMAC_PPS_MAX];
>> +
>> +/* DEBUG */
>> +int (*hwif_quirks)(struct stmmac_priv *priv);
>>  };
>>
>>  enum stmmac_state {
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 11fb7c7..fbe74f2 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -4130,6 +4130,12 @@ static int stmmac_hw_init(struct
>> stmmac_priv *priv)
>>  if (priv->dma_cap.tsoen)
>>  dev_info(priv->device, "TSO supported\n");
>>
>> +if (priv->hwif_quirks) {
>> +ret = priv->hwif_quirks(priv);
>> +if (ret)
>> +return ret;
>> +}
>> +
>>  return 0;
>>  }
>>
>> >8--
>>
> The above patch fixed it!

Thanks for testing. I will send a proper patch next week.

Thanks and Best Regards,
Jose Miguel Abreu

>
> Dinh



Re: [BUG] net: stmmac: socfpga ethernet no longer working on linux-next

2018-06-14 Thread Dinh Nguyen
On Thu, Jun 14, 2018 at 10:23 AM Jose Abreu  wrote:
>
> On 14-06-2018 15:21, Dinh Nguyen wrote:
> >
> > [0.835537] socfpga-dwmac ff702000.ethernet: PTP uses main clock
> > [0.841794] socfpga-dwmac ff702000.ethernet: Version ID not available
> > [0.848223] socfpga-dwmac ff702000.ethernet: DWMAC1000
> > [0.853454] socfpga-dwmac ff702000.ethernet: Normal descriptors
> > [0.859357] socfpga-dwmac ff702000.ethernet: Ring mode enabled
> > [0.865184] socfpga-dwmac ff702000.ethernet: DMA HW capability register 
> > suppo
> > rted
> > [0.872654] socfpga-dwmac ff702000.ethernet: RX Checksum Offload Engine 
> > suppo
> > rted
> > [0.880113] socfpga-dwmac ff702000.ethernet: COE Type 2
> > [0.885329] socfpga-dwmac ff702000.ethernet: TX Checksum insertion 
> > supported
> >
>
> Interesting ... Please check if bellow patch makes thing work
> again (if not please send me the resultant dmesg log and also the
> log without the problematic patch that you identified):
>
> >8--
> diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c
> b/drivers/net/ethernet/stmicro/stmmac/hwif.c
> index 14770fc..1961819 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
> @@ -252,12 +252,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
>  return ret;
>  }
>
> -/* Run quirks, if needed */
> -if (entry->quirks) {
> -ret = entry->quirks(priv);
> -if (ret)
> -return ret;
> -}
> +/* Save quirks, if needed for posterior use */
> +priv->hwif_quirks = entry->quirks;
>
>  return 0;
>  }
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index 025efbf..be7da43 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -193,6 +193,9 @@ struct stmmac_priv {
>
>  /* Pulse Per Second output */
>  struct stmmac_pps_cfg pps[STMMAC_PPS_MAX];
> +
> +/* DEBUG */
> +int (*hwif_quirks)(struct stmmac_priv *priv);
>  };
>
>  enum stmmac_state {
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 11fb7c7..fbe74f2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4130,6 +4130,12 @@ static int stmmac_hw_init(struct
> stmmac_priv *priv)
>  if (priv->dma_cap.tsoen)
>  dev_info(priv->device, "TSO supported\n");
>
> +if (priv->hwif_quirks) {
> +ret = priv->hwif_quirks(priv);
> +if (ret)
> +return ret;
> +}
> +
>  return 0;
>  }
>
> >8--
>

The above patch fixed it!

Dinh


Re: [BUG] net: stmmac: socfpga ethernet no longer working on linux-next

2018-06-14 Thread Jose Abreu
On 14-06-2018 15:21, Dinh Nguyen wrote:
>
> [0.835537] socfpga-dwmac ff702000.ethernet: PTP uses main clock
> [0.841794] socfpga-dwmac ff702000.ethernet: Version ID not available
> [0.848223] socfpga-dwmac ff702000.ethernet: DWMAC1000
> [0.853454] socfpga-dwmac ff702000.ethernet: Normal descriptors
> [0.859357] socfpga-dwmac ff702000.ethernet: Ring mode enabled
> [0.865184] socfpga-dwmac ff702000.ethernet: DMA HW capability register 
> suppo
> rted
> [0.872654] socfpga-dwmac ff702000.ethernet: RX Checksum Offload Engine 
> suppo
> rted
> [0.880113] socfpga-dwmac ff702000.ethernet: COE Type 2
> [0.885329] socfpga-dwmac ff702000.ethernet: TX Checksum insertion 
> supported
>

Interesting ... Please check if bellow patch makes thing work
again (if not please send me the resultant dmesg log and also the
log without the problematic patch that you identified):

>8--
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c
b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index 14770fc..1961819 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -252,12 +252,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
 return ret;
 }
 
-/* Run quirks, if needed */
-if (entry->quirks) {
-ret = entry->quirks(priv);
-if (ret)
-return ret;
-}
+/* Save quirks, if needed for posterior use */
+priv->hwif_quirks = entry->quirks;
 
 return 0;
 }
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 025efbf..be7da43 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -193,6 +193,9 @@ struct stmmac_priv {
 
 /* Pulse Per Second output */
 struct stmmac_pps_cfg pps[STMMAC_PPS_MAX];
+
+/* DEBUG */
+int (*hwif_quirks)(struct stmmac_priv *priv);
 };
 
 enum stmmac_state {
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 11fb7c7..fbe74f2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4130,6 +4130,12 @@ static int stmmac_hw_init(struct
stmmac_priv *priv)
 if (priv->dma_cap.tsoen)
 dev_info(priv->device, "TSO supported\n");
 
+if (priv->hwif_quirks) {
+ret = priv->hwif_quirks(priv);
+if (ret)
+return ret;
+}
+
 return 0;
 }
 
>8--

Thanks and Best Regards,
Jose Miguel Abreu


Re: [BUG] net: stmmac: socfpga ethernet no longer working on linux-next

2018-06-14 Thread Dinh Nguyen
On Thu, Jun 14, 2018 at 6:14 AM Marek Vasut  wrote:
>
> On 06/14/2018 10:18 AM, Jose Abreu wrote:
> > On 14-06-2018 08:38, Jose Abreu wrote:
> >> Hello,
> >>
> >> On 13-06-2018 21:46, Dinh Nguyen wrote:
> >>> Hi,
> >>>
> >>> The stmmac ethernet has stopped working in linux-next and linus/master
> >>> branch(v4.17-11782-gbe779f03d563)
> >>>
> >>> It appears that the stmmac ethernet has stopped working after these 2 
> >>> commits:
> >>>
> >>> 4dbbe8dde848 net: stmmac: Add support for U32 TC filter using Flexible RX 
> >>> Parser
> >>> 5f0456b43140 net: stmmac: Implement logic to automatically select HW 
> >>> Interface
> >>>
> >>> If I move to this commit "565020aaeebf net: stmmac: Disable ACS
> >>> Feature for GMAC >= 4", then the stmmac works again on SoCFPGA.
> >>>
> >>> I was following this thread:
> >>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.spinics.net_lists_netdev_msg502858.html&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=yaVFU4TjGY0gVF8El1uKcisy6TPsyCl9uN7Wsis-qhY&m=fvPkLp2xlWolmIYwoFLmALhxlycg1w0UmxiYdT7qojc&s=aC4a2U3X_siDxSNz3c5OeadhEJWll31yP-oi5nNar94&e=
> >>>
> >>> Was wondering if there was a patch to fix dwmac-sun8i that the socfpga
> >>> platform needs as well?
> >> Probably. I will check and get back to you ASAP.
> >
> > This seems to be a different problem. Can you send me your dmesg
> > log and DT bindings you are using?
>
> arch/arm/boot/dts/socfpga_arria10_socdk_sdmmc.dts
> for example fails for me in next/master. Worked on 4.17-rc7.
>

I'm using "arch/arm/boot/dts/socfpga_arria5_socdk.dts". Here's my boot log:

It appears to just get stuck in "eth0: link becomes ready", times out
and reinits:

[0.00] Linux version 4.17.0-11782-gbe779f03d563-dirty (dinguyen@linux-bu
ilds1) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #26 SMP Thu Jun 14
09:01:38 CDT 2018
[0.00] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[0.00] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instructio
n cache
[0.00] OF: fdt: Machine model: Altera SOCFPGA Arria V SoC Development Ki
t
[0.00] debug: ignoring loglevel setting.
[0.00] Memory policy: Data cache writealloc
[0.00] On node 0 totalpages: 262144
[0.00]   Normal zone: 1536 pages used for memmap
[0.00]   Normal zone: 0 pages reserved
[0.00]   Normal zone: 196608 pages, LIFO batch:31
[0.00]   HighMem zone: 65536 pages, LIFO batch:15
[0.00] random: get_random_bytes called from start_kernel+0xac/0x488 with
 crng_init=0
[0.00] percpu: Embedded 16 pages/cpu @(ptrval) s36044 r8192 d21300 u6553
6
[0.00] pcpu-alloc: s36044 r8192 d21300 u65536 alloc=16*4096
[0.00] pcpu-alloc: [0] 0 [0] 1
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 260608
[0.00] Kernel command line: root=/dev/nfs rw nfsroot=10.122.105.139:/hom
e/dinguyen/rootfs_yocto ip=dhcp debug ignore_loglevel
[0.00] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Memory: 1027460K/1048576K available (7168K kernel code, 508K rwda
ta, 1540K rodata, 1024K init, 133K bss, 21116K reserved, 0K cma-reserved, 262144
K highmem)
[0.00] Virtual kernel memory layout:
[0.00] vector  : 0x - 0x1000   (   4 kB)
[0.00] fixmap  : 0xffc0 - 0xfff0   (3072 kB)
[0.00] vmalloc : 0xf080 - 0xff80   ( 240 MB)
[0.00] lowmem  : 0xc000 - 0xf000   ( 768 MB)
[0.00] pkmap   : 0xbfe0 - 0xc000   (   2 MB)
[0.00] modules : 0xbf00 - 0xbfe0   (  14 MB)
[0.00]   .text : 0x(ptrval) - 0x(ptrval)   (8160 kB)
[0.00]   .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[0.00]   .data : 0x(ptrval) - 0x(ptrval)   ( 509 kB)
[0.00].bss : 0x(ptrval) - 0x(ptrval)   ( 134 kB)
[0.00] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[0.00] ftrace: allocating 25769 entries in 76 pages
[0.00] Hierarchical RCU implementation.
[0.00]  RCU event tracing is enabled.
[0.00] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[0.00] L2C-310 enabling early BRESP for Cortex-A9
[0.00] L2C-310 full line of zeros enabled for Cortex-A9
[0.00] L2C-310 ID prefetch enabled, offset 8 lines
[0.00] L2C-310 dynamic clock gating enabled, standby mode enabled
[0.00] L2C-310 cache controller enabled, 8 ways, 512 kB
[0.00] L2C-310: CACHE_ID 0x410030c9, AUX_CTRL 0x76460001
[0.00] clocksource: timer1: mask: 0x max_cycles: 0x, max
_idle_ns: 19112604467 ns
[0.04] sched_clock: 32 bits at 100MHz, resolution 10ns, wraps every 2147
4836475ns
[0.14] Switching to timer-based delay loop, resolution 10ns
[0.000150] Console: colour dummy device 80x30
[0.000528] console [tty0] enabled
[  

Re: [BUG] net: stmmac: socfpga ethernet no longer working on linux-next

2018-06-14 Thread Marek Vasut
On 06/14/2018 10:18 AM, Jose Abreu wrote:
> On 14-06-2018 08:38, Jose Abreu wrote:
>> Hello,
>>
>> On 13-06-2018 21:46, Dinh Nguyen wrote:
>>> Hi,
>>>
>>> The stmmac ethernet has stopped working in linux-next and linus/master
>>> branch(v4.17-11782-gbe779f03d563)
>>>
>>> It appears that the stmmac ethernet has stopped working after these 2 
>>> commits:
>>>
>>> 4dbbe8dde848 net: stmmac: Add support for U32 TC filter using Flexible RX 
>>> Parser
>>> 5f0456b43140 net: stmmac: Implement logic to automatically select HW 
>>> Interface
>>>
>>> If I move to this commit "565020aaeebf net: stmmac: Disable ACS
>>> Feature for GMAC >= 4", then the stmmac works again on SoCFPGA.
>>>
>>> I was following this thread:
>>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.spinics.net_lists_netdev_msg502858.html&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=yaVFU4TjGY0gVF8El1uKcisy6TPsyCl9uN7Wsis-qhY&m=fvPkLp2xlWolmIYwoFLmALhxlycg1w0UmxiYdT7qojc&s=aC4a2U3X_siDxSNz3c5OeadhEJWll31yP-oi5nNar94&e=
>>>
>>> Was wondering if there was a patch to fix dwmac-sun8i that the socfpga
>>> platform needs as well?
>> Probably. I will check and get back to you ASAP.
> 
> This seems to be a different problem. Can you send me your dmesg
> log and DT bindings you are using?

arch/arm/boot/dts/socfpga_arria10_socdk_sdmmc.dts
for example fails for me in next/master. Worked on 4.17-rc7.

-- 
Best regards,
Marek Vasut


Re: [BUG] net: stmmac: socfpga ethernet no longer working on linux-next

2018-06-14 Thread Jose Abreu
On 14-06-2018 08:38, Jose Abreu wrote:
> Hello,
>
> On 13-06-2018 21:46, Dinh Nguyen wrote:
>> Hi,
>>
>> The stmmac ethernet has stopped working in linux-next and linus/master
>> branch(v4.17-11782-gbe779f03d563)
>>
>> It appears that the stmmac ethernet has stopped working after these 2 
>> commits:
>>
>> 4dbbe8dde848 net: stmmac: Add support for U32 TC filter using Flexible RX 
>> Parser
>> 5f0456b43140 net: stmmac: Implement logic to automatically select HW 
>> Interface
>>
>> If I move to this commit "565020aaeebf net: stmmac: Disable ACS
>> Feature for GMAC >= 4", then the stmmac works again on SoCFPGA.
>>
>> I was following this thread:
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.spinics.net_lists_netdev_msg502858.html&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=yaVFU4TjGY0gVF8El1uKcisy6TPsyCl9uN7Wsis-qhY&m=fvPkLp2xlWolmIYwoFLmALhxlycg1w0UmxiYdT7qojc&s=aC4a2U3X_siDxSNz3c5OeadhEJWll31yP-oi5nNar94&e=
>>
>> Was wondering if there was a patch to fix dwmac-sun8i that the socfpga
>> platform needs as well?
> Probably. I will check and get back to you ASAP.

This seems to be a different problem. Can you send me your dmesg
log and DT bindings you are using?

>
> Thanks and Best Regards,
> Jose Miguel Abreu
>
>> Thanks,
>> Dinh



Re: [BUG] net: stmmac: socfpga ethernet no longer working on linux-next

2018-06-14 Thread Jose Abreu
Hello,

On 13-06-2018 21:46, Dinh Nguyen wrote:
> Hi,
>
> The stmmac ethernet has stopped working in linux-next and linus/master
> branch(v4.17-11782-gbe779f03d563)
>
> It appears that the stmmac ethernet has stopped working after these 2 commits:
>
> 4dbbe8dde848 net: stmmac: Add support for U32 TC filter using Flexible RX 
> Parser
> 5f0456b43140 net: stmmac: Implement logic to automatically select HW Interface
>
> If I move to this commit "565020aaeebf net: stmmac: Disable ACS
> Feature for GMAC >= 4", then the stmmac works again on SoCFPGA.
>
> I was following this thread:
> https://urldefense.proofpoint.com/v2/url?u=https-3A__www.spinics.net_lists_netdev_msg502858.html&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=yaVFU4TjGY0gVF8El1uKcisy6TPsyCl9uN7Wsis-qhY&m=fvPkLp2xlWolmIYwoFLmALhxlycg1w0UmxiYdT7qojc&s=aC4a2U3X_siDxSNz3c5OeadhEJWll31yP-oi5nNar94&e=
>
> Was wondering if there was a patch to fix dwmac-sun8i that the socfpga
> platform needs as well?

Probably. I will check and get back to you ASAP.

Thanks and Best Regards,
Jose Miguel Abreu

>
> Thanks,
> Dinh