From patchwork Tue Jul 6 04:32:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 110357 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o664VjRk024453 for ; Tue, 6 Jul 2010 04:32:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751334Ab0GFEcx (ORCPT ); Tue, 6 Jul 2010 00:32:53 -0400 Received: from mail.renesas.com ([202.234.163.13]:38681 "EHLO mail07.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751038Ab0GFEcw (ORCPT ); Tue, 6 Jul 2010 00:32:52 -0400 X-AuditID: ac14038b-0000000400000202-73-4c32b1f34512 Received: from guardian02.idc.renesas.com ([172.20.8.201]) by mail07.idc.renesas.com (sendmail) with ESMTP id o664WpAD021308; Tue, 6 Jul 2010 13:32:51 +0900 (JST) Received: (from root@localhost) by guardian02.idc.renesas.com with id o664WpL1029483; Tue, 6 Jul 2010 13:32:51 +0900 (JST) Received: from mta04.idc.renesas.com (localhost [127.0.0.1]) by mta04.idc.renesas.com with ESMTP id o664Wpkc006039; Tue, 6 Jul 2010 13:32:51 +0900 (JST) Received: from [172.30.8.157] by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0L5400DY3CMQ7T@ims05.idc.renesas.com>; Tue, 06 Jul 2010 13:32:50 +0900 (JST) Date: Tue, 06 Jul 2010 13:32:50 +0900 From: Yoshihiro Shimoda Subject: [PATCH] net: sh_eth: add support for SH7757's ETHER To: netdev@vger.kernel.org Cc: SH-Linux Message-id: <4C32B1F2.4040106@renesas.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 06 Jul 2010 04:33:12 +0000 (UTC) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index ce2fcdd..663f863 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -530,14 +530,15 @@ config SH_ETH depends on SUPERH && \ (CPU_SUBTYPE_SH7710 || CPU_SUBTYPE_SH7712 || \ CPU_SUBTYPE_SH7763 || CPU_SUBTYPE_SH7619 || \ - CPU_SUBTYPE_SH7724) + CPU_SUBTYPE_SH7724 || CPU_SUBTYPE_SH7757) select CRC32 select MII select MDIO_BITBANG select PHYLIB help Renesas SuperH Ethernet device driver. - This driver support SH7710, SH7712, SH7763, SH7619, and SH7724. + This driver supporting CPUs are: + - SH7710, SH7712, SH7763, SH7619, SH7724, and SH7757. config SUNLANCE tristate "Sun LANCE support" diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 501a55f..7ac814d 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -88,6 +88,55 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { .rpadir = 1, .rpadir_value = 0x00020000, /* NET_IP_ALIGN assumed to be 2 */ }; +#elif defined(CONFIG_CPU_SUBTYPE_SH7757) +#define SH_ETH_RESET_DEFAULT 1 +static void sh_eth_set_duplex(struct net_device *ndev) +{ + struct sh_eth_private *mdp = netdev_priv(ndev); + u32 ioaddr = ndev->base_addr; + + if (mdp->duplex) /* Full */ + ctrl_outl(ctrl_inl(ioaddr + ECMR) | ECMR_DM, ioaddr + ECMR); + else /* Half */ + ctrl_outl(ctrl_inl(ioaddr + ECMR) & ~ECMR_DM, ioaddr + ECMR); +} + +static void sh_eth_set_rate(struct net_device *ndev) +{ + struct sh_eth_private *mdp = netdev_priv(ndev); + u32 ioaddr = ndev->base_addr; + + switch (mdp->speed) { + case 10: /* 10BASE */ + ctrl_outl(0, ioaddr + RTRATE); + break; + case 100:/* 100BASE */ + ctrl_outl(1, ioaddr + RTRATE); + break; + default: + break; + } +} + +/* SH7757 */ +static struct sh_eth_cpu_data sh_eth_my_cpu_data = { + .set_duplex = sh_eth_set_duplex, + .set_rate = sh_eth_set_rate, + + .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, + .rmcr_value = 0x00000001, + + .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO, + .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE | + EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI, + .tx_error_check = EESR_TWB | EESR_TABT | EESR_TDE | EESR_TFE, + + .apr = 1, + .mpr = 1, + .tpauser = 1, + .hw_swap = 1, + .no_ade = 1, +}; #elif defined(CONFIG_CPU_SUBTYPE_SH7763) #define SH_ETH_HAS_TSU 1 @@ -1023,7 +1072,9 @@ static int sh_eth_open(struct net_device *ndev) pm_runtime_get_sync(&mdp->pdev->dev); ret = request_irq(ndev->irq, sh_eth_interrupt, -#if defined(CONFIG_CPU_SUBTYPE_SH7763) || defined(CONFIG_CPU_SUBTYPE_SH7764) +#if defined(CONFIG_CPU_SUBTYPE_SH7763) || \ + defined(CONFIG_CPU_SUBTYPE_SH7764) || \ + defined(CONFIG_CPU_SUBTYPE_SH7757) IRQF_SHARED, #else 0,