Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298527 > unrolled thread

[RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036

Started byXing Zheng <zhengxing@rock-chips.com>
First post2015-12-28 08:30 +0100
Last post2016-01-02 03:40 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036 Xing Zheng <zhengxing@rock-chips.com> - 2015-12-28 08:30 +0100
    Re: [RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036 Florian Fainelli <f.fainelli@gmail.com> - 2015-12-30 00:10 +0100
      Re: [RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036 Heiko Stübner <heiko@sntech.de> - 2015-12-30 00:40 +0100
      Re: [RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036 Arnd Bergmann <arnd@arndb.de> - 2016-01-01 14:00 +0100
        Re: [RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036 Xing Zheng <zhengxing@rock-chips.com> - 2016-01-02 03:40 +0100

#1298527 — [RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036

FromXing Zheng <zhengxing@rock-chips.com>
Date2015-12-28 08:30 +0100
Subject[RESEND PATCH v1 3/4] net: ethernet: arc: Add support emac for RK3036
Message-ID<qKApH-79E-1@gated-at.bofh.it>
The RK3036's GRFs offset are different with RK3066/RK3188, and need to set
mac TX/RX clock before probe emac.

Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
---

 drivers/net/ethernet/arc/Kconfig         |    4 ++--
 drivers/net/ethernet/arc/emac_rockchip.c |    9 +++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/arc/Kconfig b/drivers/net/ethernet/arc/Kconfig
index 52a6b16..6890451 100644
--- a/drivers/net/ethernet/arc/Kconfig
+++ b/drivers/net/ethernet/arc/Kconfig
@@ -34,9 +34,9 @@ config EMAC_ROCKCHIP
 	select ARC_EMAC_CORE
 	depends on OF_IRQ && OF_NET && REGULATOR && HAS_DMA
 	---help---
-	  Support for Rockchip RK3066/RK3188 EMAC ethernet controllers.
+	  Support for Rockchip RK3036/RK3066/RK3188 EMAC ethernet controllers.
 	  This selects Rockchip SoC glue layer support for the
-	  emac device driver. This driver is used for RK3066/RK3188
+	  emac device driver. This driver is used for RK3036/RK3066/RK3188
 	  EMAC ethernet controller.
 
 endif # NET_VENDOR_ARC
diff --git a/drivers/net/ethernet/arc/emac_rockchip.c b/drivers/net/ethernet/arc/emac_rockchip.c
index d1a9c28..2433eeb 100644
--- a/drivers/net/ethernet/arc/emac_rockchip.c
+++ b/drivers/net/ethernet/arc/emac_rockchip.c
@@ -69,6 +69,10 @@ static void emac_rockchip_set_mac_speed(void *priv, unsigned int speed)
 
 static const struct emac_rockchip_soc_data emac_rockchip_dt_data[] = {
 	{
+	  .grf_offset = 0x140,   .grf_mode_offset = 8,
+	  .grf_speed_offset = 9, .need_div_macclk = 1
+	}, /* rk3036 */
+	{
 	  .grf_offset = 0x154,   .grf_mode_offset = 0,
 	  .grf_speed_offset = 1, .need_div_macclk = 0
 	}, /* rk3066 */
@@ -79,8 +83,9 @@ static const struct emac_rockchip_soc_data emac_rockchip_dt_data[] = {
 };
 
 static const struct of_device_id emac_rockchip_dt_ids[] = {
-	{ .compatible = "rockchip,rk3066-emac", .data = &emac_rockchip_dt_data[0] },
-	{ .compatible = "rockchip,rk3188-emac", .data = &emac_rockchip_dt_data[1] },
+	{ .compatible = "rockchip,rk3036-emac", .data = &emac_rockchip_dt_data[0] },
+	{ .compatible = "rockchip,rk3066-emac", .data = &emac_rockchip_dt_data[1] },
+	{ .compatible = "rockchip,rk3188-emac", .data = &emac_rockchip_dt_data[2] },
 	{ /* Sentinel */ }
 };
 
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1299160

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2015-12-30 00:10 +0100
Message-ID<qLbyV-6Wl-5@gated-at.bofh.it>
In reply to#1298527
On December 27, 2015 11:22:20 PM PST, Xing Zheng <zhengxing@rock-chips.com> wrote:
>The RK3036's GRFs offset are different with RK3066/RK3188, and need to
>set
>mac TX/RX clock before probe emac.
>
>Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
>---
<snip>
> };
> 
> static const struct of_device_id emac_rockchip_dt_ids[] = {
>-	{ .compatible = "rockchip,rk3066-emac", .data =
>&emac_rockchip_dt_data[0] },
>-	{ .compatible = "rockchip,rk3188-emac", .data =
>&emac_rockchip_dt_data[1] },
>+	{ .compatible = "rockchip,rk3036-emac", .data =
>&emac_rockchip_dt_data[0] },
>+	{ .compatible = "rockchip,rk3066-emac", .data =
>&emac_rockchip_dt_data[1] },
>+	{ .compatible = "rockchip,rk3188-emac", .data =
>&emac_rockchip_dt_data[2] },
> 	{ /* Sentinel */ }

Food for thought, you might want to use an enum here to index emac_rockchip_dt_data which would be less error prone if you add/remove entries in this structure.

-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299166

FromHeiko Stübner <heiko@sntech.de>
Date2015-12-30 00:40 +0100
Message-ID<qLc1Y-76R-17@gated-at.bofh.it>
In reply to#1299160
Am Dienstag, 29. Dezember 2015, 14:59:59 schrieb Florian Fainelli:
> On December 27, 2015 11:22:20 PM PST, Xing Zheng <zhengxing@rock-chips.com> 
wrote:
> >The RK3036's GRFs offset are different with RK3066/RK3188, and need to
> >set
> >mac TX/RX clock before probe emac.
> >
> >Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
> >---
> 
> <snip>
> 
> > };
> > 
> > static const struct of_device_id emac_rockchip_dt_ids[] = {
> >
> >-	{ .compatible = "rockchip,rk3066-emac", .data =
> >&emac_rockchip_dt_data[0] },
> >-	{ .compatible = "rockchip,rk3188-emac", .data =
> >&emac_rockchip_dt_data[1] },
> >+	{ .compatible = "rockchip,rk3036-emac", .data =
> >&emac_rockchip_dt_data[0] },
> >+	{ .compatible = "rockchip,rk3066-emac", .data =
> >&emac_rockchip_dt_data[1] },
> >+	{ .compatible = "rockchip,rk3188-emac", .data =
> >&emac_rockchip_dt_data[2] },
> >
> > 	{ /* Sentinel */ }
> 
> Food for thought, you might want to use an enum here to index
> emac_rockchip_dt_data which would be less error prone if you add/remove
> entries in this structure.

Or just have the structs separately and not in array-form at all, aka
rk3066_emac_dt_data, rk3036_emac_dt_data.

I don't think the original array really improves anything.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299902

FromArnd Bergmann <arnd@arndb.de>
Date2016-01-01 14:00 +0100
Message-ID<qM7tg-2y5-13@gated-at.bofh.it>
In reply to#1299160
On Tuesday 29 December 2015 14:59:59 Florian Fainelli wrote:
> On December 27, 2015 11:22:20 PM PST, Xing Zheng <zhengxing@rock-chips.com> wrote:
> >The RK3036's GRFs offset are different with RK3066/RK3188, and need to
> >set
> >mac TX/RX clock before probe emac.
> >
> >Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
> >---
> <snip>
> > };
> > 
> > static const struct of_device_id emac_rockchip_dt_ids[] = {
> >-      { .compatible = "rockchip,rk3066-emac", .data =
> >&emac_rockchip_dt_data[0] },
> >-      { .compatible = "rockchip,rk3188-emac", .data =
> >&emac_rockchip_dt_data[1] },
> >+      { .compatible = "rockchip,rk3036-emac", .data =
> >&emac_rockchip_dt_data[0] },
> >+      { .compatible = "rockchip,rk3066-emac", .data =
> >&emac_rockchip_dt_data[1] },
> >+      { .compatible = "rockchip,rk3188-emac", .data =
> >&emac_rockchip_dt_data[2] },
> >       { /* Sentinel */ }
> 
> Food for thought, you might want to use an enum here to index emac_rockchip_dt_data which would be less error prone if you add/remove entries in this structure.
> 

I would use named structures instead:

static const struct emac_rockchip_soc_data emac_rk3066_emac_data = {
	.grf_offset = 0x154,
};

static const struct of_device_id emac_rockchip_dt_ids[] = {
	{ .compatible = "rockchip,rk3066-emac", .data = &emac_rk3066_emac_data,
	...
};

	Armd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300024

FromXing Zheng <zhengxing@rock-chips.com>
Date2016-01-02 03:40 +0100
Message-ID<qMkgN-2c4-5@gated-at.bofh.it>
In reply to#1299902

OK, I think I will use named structures.

Thanks.

> 在 2016年1月1日,20:55,Arnd Bergmann <arnd@arndb.de> 写道:
> 
>> On Tuesday 29 December 2015 14:59:59 Florian Fainelli wrote:
>>> On December 27, 2015 11:22:20 PM PST, Xing Zheng <zhengxing@rock-chips.com> wrote:
>>> The RK3036's GRFs offset are different with RK3066/RK3188, and need to
>>> set
>>> mac TX/RX clock before probe emac.
>>> 
>>> Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
>>> ---
>> <snip>
>>> };
>>> 
>>> static const struct of_device_id emac_rockchip_dt_ids[] = {
>>> -      { .compatible = "rockchip,rk3066-emac", .data =
>>> &emac_rockchip_dt_data[0] },
>>> -      { .compatible = "rockchip,rk3188-emac", .data =
>>> &emac_rockchip_dt_data[1] },
>>> +      { .compatible = "rockchip,rk3036-emac", .data =
>>> &emac_rockchip_dt_data[0] },
>>> +      { .compatible = "rockchip,rk3066-emac", .data =
>>> &emac_rockchip_dt_data[1] },
>>> +      { .compatible = "rockchip,rk3188-emac", .data =
>>> &emac_rockchip_dt_data[2] },
>>>      { /* Sentinel */ }
>> 
>> Food for thought, you might want to use an enum here to index emac_rockchip_dt_data which would be less error prone if you add/remove entries in this structure.
> 
> I would use named structures instead:
> 
> static const struct emac_rockchip_soc_data emac_rk3066_emac_data = {
>    .grf_offset = 0x154,
> };
> 
> static const struct of_device_id emac_rockchip_dt_ids[] = {
>    { .compatible = "rockchip,rk3066-emac", .data = &emac_rk3066_emac_data,
>    ...
> };
> 
>    Armd
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web