From patchwork Wed Jul 31 12:12:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mugunthan V N X-Patchwork-Id: 2836216 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6622E9F4D4 for ; Wed, 31 Jul 2013 12:13:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3229E200FE for ; Wed, 31 Jul 2013 12:12:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A5D2201D5 for ; Wed, 31 Jul 2013 12:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757993Ab3GaMMw (ORCPT ); Wed, 31 Jul 2013 08:12:52 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:42904 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752493Ab3GaMMw (ORCPT ); Wed, 31 Jul 2013 08:12:52 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6VCCom2031495; Wed, 31 Jul 2013 07:12:50 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6VCCoiN000679; Wed, 31 Jul 2013 07:12:50 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Wed, 31 Jul 2013 07:12:50 -0500 Received: from mugunthan-VirtualBox.india.ti.com ([172.24.190.65]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r6VCCmBg009295; Wed, 31 Jul 2013 07:12:49 -0500 From: Mugunthan V N To: CC: , , , Mugunthan V N Subject: [net-next PATCH 1/1] drivers: net: cpsw: Add support for new CPSW IP version Date: Wed, 31 Jul 2013 17:42:26 +0530 Message-ID: <1375272746-24446-1-git-send-email-mugunthanvnm@ti.com> X-Mailer: git-send-email 1.8.4.rc0.11.g35f5eaa MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The new IP version has a minor changes and the offsets are same as the previous version, so instead of adding CPSW version number in the driver, make the driver to fall through to the latest versions so that the new version of CPSW which has the same register offsets will work directly without patching the driver. Signed-off-by: Mugunthan V N Reviewed-by: Felipe Balbi --- drivers/net/ethernet/ti/cpsw.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 05a1674..a6b9700 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -799,6 +799,7 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv) slave_write(slave, TX_PRIORITY_MAPPING, CPSW1_TX_PRI_MAP); break; case CPSW_VERSION_2: + default: slave_write(slave, TX_PRIORITY_MAPPING, CPSW2_TX_PRI_MAP); break; } @@ -1180,10 +1181,9 @@ static int cpsw_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) cpsw_hwtstamp_v1(priv); break; case CPSW_VERSION_2: + default: cpsw_hwtstamp_v2(priv); break; - default: - return -ENOTSUPP; } return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; @@ -1790,6 +1790,7 @@ static int cpsw_probe(struct platform_device *pdev) dma_params.desc_mem_phys = 0; break; case CPSW_VERSION_2: + default: priv->host_port_regs = ss_regs + CPSW2_HOST_PORT_OFFSET; priv->cpts->reg = ss_regs + CPSW2_CPTS_OFFSET; dma_params.dmaregs = ss_regs + CPSW2_CPDMA_OFFSET; @@ -1801,10 +1802,6 @@ static int cpsw_probe(struct platform_device *pdev) dma_params.desc_mem_phys = (u32 __force) priv->cpsw_res->start + CPSW2_BD_OFFSET; break; - default: - dev_err(priv->dev, "unknown version 0x%08x\n", priv->version); - ret = -ENODEV; - goto clean_cpsw_wr_iores_ret; } for (i = 0; i < priv->data.slaves; i++) { struct cpsw_slave *slave = &priv->slaves[i];