* [PATCH] Stmmac: fix a bug when clk_csr == 0x0
@ 2013-10-09 2:37 Wan ZongShun
2013-10-09 14:43 ` Giuseppe CAVALLARO
0 siblings, 1 reply; 4+ messages in thread
From: Wan ZongShun @ 2013-10-09 2:37 UTC (permalink / raw)
To: Giuseppe CAVALLARO; +Cc: netdev, Wan ZongShun
Hi Giuseppe,
According to spec, if csr clock freq is 60-100Mhz, we have to set CR[5:2] = 0000
but when I set the 'plat_dat.clk_csr = 0',acctually, this value is not used
since the driver code judge 'if (!priv->plat->clk_csr)' then go to dynamic tune
the MDC clock. So I add other judge condition.
Signed-off-by: Wan Zongshun <mcuos.com@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
include/linux/stmmac.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8d4ccd3..a849092c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2741,7 +2741,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct
device *device,
* set the MDC clock dynamically according to the csr actual
* clock input.
*/
- if (!priv->plat->clk_csr)
+ if (priv->plat->dynamic_mdc_clk_en)
stmmac_clk_csr_set(priv);
else
priv->clk_csr = priv->plat->clk_csr;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index bb5deb0..e2552ce 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -101,6 +101,7 @@ struct plat_stmmacenet_data {
struct stmmac_mdio_bus_data *mdio_bus_data;
struct stmmac_dma_cfg *dma_cfg;
int clk_csr;
+ int dynamic_mdc_clk_en;
int has_gmac;
int enh_desc;
int tx_coe;
--
1.8.1.2
--
Wan ZongShun.
www.mcuos.com
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Stmmac: fix a bug when clk_csr == 0x0
2013-10-09 2:37 [PATCH] Stmmac: fix a bug when clk_csr == 0x0 Wan ZongShun
@ 2013-10-09 14:43 ` Giuseppe CAVALLARO
2013-10-09 15:02 ` Wan ZongShun
0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2013-10-09 14:43 UTC (permalink / raw)
To: Wan ZongShun; +Cc: netdev
hello
On 10/9/2013 4:37 AM, Wan ZongShun wrote:
> Hi Giuseppe,
>
> According to spec, if csr clock freq is 60-100Mhz, we have to set CR[5:2] = 0000
> but when I set the 'plat_dat.clk_csr = 0',acctually, this value is not used
> since the driver code judge 'if (!priv->plat->clk_csr)' then go to dynamic tune
> the MDC clock. So I add other judge condition.
yes, and true in case of 60-100Mhz... I don't know if this was actually
tested on SPEAr long time ago.
Pls document the new platform field in the stmmac.txt or find a way
to reuse the clk_csr (maybe not the case)
peppe
>
> Signed-off-by: Wan Zongshun <mcuos.com@gmail.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
> include/linux/stmmac.h | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 8d4ccd3..a849092c 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2741,7 +2741,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct
> device *device,
> * set the MDC clock dynamically according to the csr actual
> * clock input.
> */
> - if (!priv->plat->clk_csr)
> + if (priv->plat->dynamic_mdc_clk_en)
> stmmac_clk_csr_set(priv);
> else
> priv->clk_csr = priv->plat->clk_csr;
> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
> index bb5deb0..e2552ce 100644
> --- a/include/linux/stmmac.h
> +++ b/include/linux/stmmac.h
> @@ -101,6 +101,7 @@ struct plat_stmmacenet_data {
> struct stmmac_mdio_bus_data *mdio_bus_data;
> struct stmmac_dma_cfg *dma_cfg;
> int clk_csr;
> + int dynamic_mdc_clk_en;
> int has_gmac;
> int enh_desc;
> int tx_coe;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Stmmac: fix a bug when clk_csr == 0x0
2013-10-09 14:43 ` Giuseppe CAVALLARO
@ 2013-10-09 15:02 ` Wan ZongShun
2013-10-09 15:16 ` Giuseppe CAVALLARO
0 siblings, 1 reply; 4+ messages in thread
From: Wan ZongShun @ 2013-10-09 15:02 UTC (permalink / raw)
To: Giuseppe CAVALLARO; +Cc: netdev
2013/10/9 Giuseppe CAVALLARO <peppe.cavallaro@st.com>:
> hello
>
>
> On 10/9/2013 4:37 AM, Wan ZongShun wrote:
>>
>> Hi Giuseppe,
>>
>> According to spec, if csr clock freq is 60-100Mhz, we have to set CR[5:2]
>> = 0000
>> but when I set the 'plat_dat.clk_csr = 0',acctually, this value is not
>> used
>> since the driver code judge 'if (!priv->plat->clk_csr)' then go to dynamic
>> tune
>> the MDC clock. So I add other judge condition.
>
>
> yes, and true in case of 60-100Mhz... I don't know if this was actually
> tested on SPEAr long time ago.
>
Hmmm, I am using other GBE chip based on synopsis IP, so I am testing
it on other platform.
> Pls document the new platform field in the stmmac.txt or find a way
> to reuse the clk_csr (maybe not the case)
Do you mean I need submit the other patch to add some comments for
this new field?
I can not find better way to fix this issue and make it more
compatible to another platform.
Wan.
>
> peppe
>
>
>>
>> Signed-off-by: Wan Zongshun <mcuos.com@gmail.com>
>> ---
>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>> include/linux/stmmac.h | 1 +
>> 2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> index 8d4ccd3..a849092c 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>> @@ -2741,7 +2741,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct
>> device *device,
>> * set the MDC clock dynamically according to the csr actual
>> * clock input.
>> */
>> - if (!priv->plat->clk_csr)
>> + if (priv->plat->dynamic_mdc_clk_en)
>> stmmac_clk_csr_set(priv);
>> else
>> priv->clk_csr = priv->plat->clk_csr;
>> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
>> index bb5deb0..e2552ce 100644
>> --- a/include/linux/stmmac.h
>> +++ b/include/linux/stmmac.h
>> @@ -101,6 +101,7 @@ struct plat_stmmacenet_data {
>> struct stmmac_mdio_bus_data *mdio_bus_data;
>> struct stmmac_dma_cfg *dma_cfg;
>> int clk_csr;
>> + int dynamic_mdc_clk_en;
>> int has_gmac;
>> int enh_desc;
>> int tx_coe;
>>
>
--
Wan ZongShun.
www.mcuos.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Stmmac: fix a bug when clk_csr == 0x0
2013-10-09 15:02 ` Wan ZongShun
@ 2013-10-09 15:16 ` Giuseppe CAVALLARO
0 siblings, 0 replies; 4+ messages in thread
From: Giuseppe CAVALLARO @ 2013-10-09 15:16 UTC (permalink / raw)
To: Wan ZongShun; +Cc: netdev
On 10/9/2013 5:02 PM, Wan ZongShun wrote:
> 2013/10/9 Giuseppe CAVALLARO <peppe.cavallaro@st.com>:
>> hello
>>
>>
>> On 10/9/2013 4:37 AM, Wan ZongShun wrote:
>>>
>>> Hi Giuseppe,
>>>
>>> According to spec, if csr clock freq is 60-100Mhz, we have to set CR[5:2]
>>> = 0000
>>> but when I set the 'plat_dat.clk_csr = 0',acctually, this value is not
>>> used
>>> since the driver code judge 'if (!priv->plat->clk_csr)' then go to dynamic
>>> tune
>>> the MDC clock. So I add other judge condition.
>>
>>
>> yes, and true in case of 60-100Mhz... I don't know if this was actually
>> tested on SPEAr long time ago.
>>
>
> Hmmm, I am using other GBE chip based on synopsis IP, so I am testing
> it on other platform.
>
>> Pls document the new platform field in the stmmac.txt or find a way
>> to reuse the clk_csr (maybe not the case)
>
> Do you mean I need submit the other patch to add some comments for
> this new field?
yes in the Documentation/networking/stmmac.txt
peppe
> I can not find better way to fix this issue and make it more
> compatible to another platform.
>
> Wan.
>
>>
>> peppe
>>
>>
>>>
>>> Signed-off-by: Wan Zongshun <mcuos.com@gmail.com>
>>> ---
>>> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
>>> include/linux/stmmac.h | 1 +
>>> 2 files changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> index 8d4ccd3..a849092c 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
>>> @@ -2741,7 +2741,7 @@ struct stmmac_priv *stmmac_dvr_probe(struct
>>> device *device,
>>> * set the MDC clock dynamically according to the csr actual
>>> * clock input.
>>> */
>>> - if (!priv->plat->clk_csr)
>>> + if (priv->plat->dynamic_mdc_clk_en)
>>> stmmac_clk_csr_set(priv);
>>> else
>>> priv->clk_csr = priv->plat->clk_csr;
>>> diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
>>> index bb5deb0..e2552ce 100644
>>> --- a/include/linux/stmmac.h
>>> +++ b/include/linux/stmmac.h
>>> @@ -101,6 +101,7 @@ struct plat_stmmacenet_data {
>>> struct stmmac_mdio_bus_data *mdio_bus_data;
>>> struct stmmac_dma_cfg *dma_cfg;
>>> int clk_csr;
>>> + int dynamic_mdc_clk_en;
>>> int has_gmac;
>>> int enh_desc;
>>> int tx_coe;
>>>
>>
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-09 15:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-09 2:37 [PATCH] Stmmac: fix a bug when clk_csr == 0x0 Wan ZongShun
2013-10-09 14:43 ` Giuseppe CAVALLARO
2013-10-09 15:02 ` Wan ZongShun
2013-10-09 15:16 ` 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.