Skip to content

Commit f0e81fe

Browse files
Nobuhiro Iwamatsudavem330
authored andcommitted
net: sh_eth: Add support SH7734
Add define of SH7734 register and sh_eth_reset_hw_crc function. V3: Rebase net/HEAD. V2: Do not split line of #if defined. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b744089 commit f0e81fe

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

‎drivers/net/ethernet/renesas/Kconfig‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ config SH_ETH
77
depends on SUPERH && \
88
(CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \
99
CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \
10-
CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757)
10+
CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7734 || \
11+
CPU_SUBTYPE_SH7757)
1112
select CRC32
1213
select NET_CORE
1314
select MII
@@ -16,4 +17,4 @@ config SH_ETH
1617
---help---
1718
Renesas SuperH Ethernet device driver.
1819
This driver supporting CPUs are:
19-
- SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757.
20+
- SH7619, SH7710, SH7712, SH7724, SH7734, SH7763 and SH7757.

‎drivers/net/ethernet/renesas/sh_eth.c‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* SuperH Ethernet device driver
33
*
4-
* Copyright (C) 2006-2008 Nobuhiro Iwamatsu
5-
* Copyright (C) 2008-2009 Renesas Solutions Corp.
4+
* Copyright (C) 2006-2012 Nobuhiro Iwamatsu
5+
* Copyright (C) 2008-2012 Renesas Solutions Corp.
66
*
77
* This program is free software; you can redistribute it and/or modify it
88
* under the terms and conditions of the GNU General Public License,
@@ -38,6 +38,7 @@
3838
#include <linux/slab.h>
3939
#include <linux/ethtool.h>
4040
#include <linux/if_vlan.h>
41+
#include <linux/clk.h>
4142
#include <linux/sh_eth.h>
4243

4344
#include "sh_eth.h"
@@ -279,8 +280,9 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
279280
return &sh_eth_my_cpu_data;
280281
}
281282

282-
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
283+
#elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
283284
#define SH_ETH_HAS_TSU 1
285+
static void sh_eth_reset_hw_crc(struct net_device *ndev);
284286
static void sh_eth_chip_reset(struct net_device *ndev)
285287
{
286288
struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -314,6 +316,9 @@ static void sh_eth_reset(struct net_device *ndev)
314316
sh_eth_write(ndev, 0x0, RDFAR);
315317
sh_eth_write(ndev, 0x0, RDFXR);
316318
sh_eth_write(ndev, 0x0, RDFFR);
319+
320+
/* Reset HW CRC register */
321+
sh_eth_reset_hw_crc(ndev);
317322
}
318323

319324
static void sh_eth_set_duplex(struct net_device *ndev)
@@ -370,8 +375,17 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
370375
.no_trimd = 1,
371376
.no_ade = 1,
372377
.tsu = 1,
378+
#if defined(CONFIG_CPU_SUBTYPE_SH7734)
379+
.hw_crc = 1,
380+
#endif
373381
};
374382

383+
static void sh_eth_reset_hw_crc(struct net_device *ndev)
384+
{
385+
if (sh_eth_my_cpu_data.hw_crc)
386+
sh_eth_write(ndev, 0x0, CSMR);
387+
}
388+
375389
#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
376390
#define SH_ETH_RESET_DEFAULT 1
377391
static struct sh_eth_cpu_data sh_eth_my_cpu_data = {

‎drivers/net/ethernet/renesas/sh_eth.h‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* SuperH Ethernet device driver
33
*
4-
* Copyright (C) 2006-2008 Nobuhiro Iwamatsu
5-
* Copyright (C) 2008-2011 Renesas Solutions Corp.
4+
* Copyright (C) 2006-2012 Nobuhiro Iwamatsu
5+
* Copyright (C) 2008-2012 Renesas Solutions Corp.
66
*
77
* This program is free software; you can redistribute it and/or modify it
88
* under the terms and conditions of the GNU General Public License,
@@ -98,6 +98,8 @@ enum {
9898
CEECR,
9999
MAFCR,
100100
RTRATE,
101+
CSMR,
102+
RMII_MII,
101103

102104
/* TSU Absolute address */
103105
ARSTR,
@@ -172,6 +174,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
172174
[RMCR] = 0x0458,
173175
[RPADIR] = 0x0460,
174176
[FCFTR] = 0x0468,
177+
[CSMR] = 0x04E4,
175178

176179
[ECMR] = 0x0500,
177180
[ECSR] = 0x0510,
@@ -200,6 +203,7 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
200203
[CERCR] = 0x0768,
201204
[CEECR] = 0x0770,
202205
[MAFCR] = 0x0778,
206+
[RMII_MII] = 0x0790,
203207

204208
[ARSTR] = 0x0000,
205209
[TSU_CTRST] = 0x0004,
@@ -377,7 +381,7 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
377381
/*
378382
* Register's bits
379383
*/
380-
#ifdef CONFIG_CPU_SUBTYPE_SH7763
384+
#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
381385
/* EDSR */
382386
enum EDSR_BIT {
383387
EDSR_ENT = 0x01, EDSR_ENR = 0x02,
@@ -751,6 +755,7 @@ struct sh_eth_cpu_data {
751755
unsigned rpadir:1; /* E-DMAC have RPADIR */
752756
unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */
753757
unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */
758+
unsigned hw_crc:1; /* E-DMAC have CSMR */
754759
};
755760

756761
struct sh_eth_private {

0 commit comments

Comments
 (0)