From patchwork Wed Apr 22 14:55:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 26317 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 5F29EB6F44 for ; Thu, 23 Apr 2009 00:59:46 +1000 (EST) Received: by ozlabs.org (Postfix) id 59DC3DE0CB; Thu, 23 Apr 2009 00:58:49 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id ECDC0DDF94 for ; Thu, 23 Apr 2009 00:58:48 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754707AbZDVO6l (ORCPT ); Wed, 22 Apr 2009 10:58:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754009AbZDVO6k (ORCPT ); Wed, 22 Apr 2009 10:58:40 -0400 Received: from wa-out-1112.google.com ([209.85.146.178]:33336 "EHLO wa-out-1112.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754739AbZDVO6j (ORCPT ); Wed, 22 Apr 2009 10:58:39 -0400 Received: by wa-out-1112.google.com with SMTP id j5so2395wah.21 for ; Wed, 22 Apr 2009 07:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=ya8EFGdjHUiYWmJEsMsnLsWr+zqSa5XHqS0DPb9VGyA=; b=yHgSp+RFGpVMVI0VhPrNxuDWJXvxIfdXpDr9bx3602kwnSMOtSks0RLhWzSxz5ivKG /lBPy/DhuJh/bfAwg/N4Ex9kUR1C/V1R/Dxy+3bHDQ0c6hm90i9zLhwCo8et3HHfIyUy QBuk+FhjQAL72DFmX1JE4iLKQ2zdG9E3+1GR0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=OTq+4M6nUcwNrqlTdl3cAC8fdJwgJ7t8xBbw9iq0drZ0ilRD1NuqjF2jDSyLDRcQIe AQkvj3skEwASmYJyVNUsadl+w6FyzCOfJzOLMJH3vDMlA+tQvWCc9UTTiG2rP4ctR6HJ 6vtodnVrE56CUQT2bEUafAOARt8Vu853JSaWM= Received: by 10.114.195.19 with SMTP id s19mr4648957waf.10.1240412318555; Wed, 22 Apr 2009 07:58:38 -0700 (PDT) Received: from rx1.opensource.se (210-227-008-067.jp.fiberbit.net [210.227.8.67]) by mx.google.com with ESMTPS id j39sm40174waf.45.2009.04.22.07.58.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 22 Apr 2009 07:58:37 -0700 (PDT) From: Magnus Damm To: netdev@vger.kernel.org Cc: steve.glendinning@smsc.com, Magnus Damm , lethal@linux-sh.org, davem@davemloft.net, iwamatsu@nigauri.org Date: Wed, 22 Apr 2009 23:55:53 +0900 Message-Id: <20090422145553.25073.99410.sendpatchset@rx1.opensource.se> Subject: [PATCH] smsc911x: add fifo byteswap support Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Magnus Damm This patch adds fifo byteswap support to the smsc911x driver. The smsc911x hardware supports both big and little and endian hardware configurations, and the linux smsc911x driver currently detects word order. For correct operation on big endian platforms lacking swapped byte lanes the following patch is needed. Only fifo data is swapped, register data does not require any swapping. Signed-off-by: Magnus Damm Acked-by: Steve Glendinning --- Platform data for the rsk7203 board will be posted separately to the linux-sh in the near future. drivers/net/smsc911x.c | 13 +++++++++++++ include/linux/smsc911x.h | 1 + 2 files changed, 14 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/drivers/net/smsc911x.c +++ work/drivers/net/smsc911x.c 2009-04-21 20:06:35.000000000 +0900 @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include "smsc911x.h" @@ -175,6 +176,12 @@ static inline void smsc911x_tx_writefifo(struct smsc911x_data *pdata, unsigned int *buf, unsigned int wordcount) { + if (pdata->config.flags & SMSC911X_SWAP_FIFO) { + while (wordcount--) + smsc911x_reg_write(pdata, TX_DATA_FIFO, swab32(*buf++)); + return; + } + if (pdata->config.flags & SMSC911X_USE_32BIT) { writesl(pdata->ioaddr + TX_DATA_FIFO, buf, wordcount); return; @@ -194,6 +201,12 @@ static inline void smsc911x_rx_readfifo(struct smsc911x_data *pdata, unsigned int *buf, unsigned int wordcount) { + if (pdata->config.flags & SMSC911X_SWAP_FIFO) { + while (wordcount--) + *buf++ = swab32(smsc911x_reg_read(pdata, RX_DATA_FIFO)); + return; + } + if (pdata->config.flags & SMSC911X_USE_32BIT) { readsl(pdata->ioaddr + RX_DATA_FIFO, buf, wordcount); return; --- 0001/include/linux/smsc911x.h +++ work/include/linux/smsc911x.h 2009-04-21 20:07:57.000000000 +0900 @@ -46,5 +46,6 @@ struct smsc911x_platform_config { #define SMSC911X_FORCE_INTERNAL_PHY (BIT(2)) #define SMSC911X_FORCE_EXTERNAL_PHY (BIT(3)) #define SMSC911X_SAVE_MAC_ADDRESS (BIT(4)) +#define SMSC911X_SWAP_FIFO (BIT(5)) #endif /* __LINUX_SMSC911X_H__ */