From patchwork Thu Feb 13 14:13:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshinori Sato X-Patchwork-Id: 320060 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 0DD142C00B3 for ; Fri, 14 Feb 2014 01:15:11 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D82654B5D2; Thu, 13 Feb 2014 15:14:56 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yeH0BuCd9gXw; Thu, 13 Feb 2014 15:14:56 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BC2CC4B5EB; Thu, 13 Feb 2014 15:14:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 49D144B576 for ; Thu, 13 Feb 2014 15:14:42 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hQ34EI4EJaXt for ; Thu, 13 Feb 2014 15:14:39 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail2.asahi-net.or.jp (mail2.asahi-net.or.jp [202.224.39.198]) by theia.denx.de (Postfix) with ESMTP id 32AC44B62F for ; Thu, 13 Feb 2014 15:14:20 +0100 (CET) Received: from sa76r4 (y081184.ppp.asahi-net.or.jp [118.243.81.184]) by mail2.asahi-net.or.jp (Postfix) with ESMTP id 7D7E07A087; Thu, 13 Feb 2014 23:14:18 +0900 (JST) Received: by sa76r4 (Postfix, from userid 1000) id 6B26C486A; Thu, 13 Feb 2014 23:14:18 +0900 (JST) From: Yoshinori Sato To: u-boot@lists.denx.de Date: Thu, 13 Feb 2014 23:13:41 +0900 Message-Id: <1392300825-18782-3-git-send-email-ysato@users.sourceforge.jp> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1392300825-18782-1-git-send-email-ysato@users.sourceforge.jp> References: <1392300825-18782-1-git-send-email-ysato@users.sourceforge.jp> Cc: Yoshinori Sato Subject: [U-Boot] [PATCH v2 2/6] Add MS7206SE ethernet support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Yoshinori Sato --- drivers/net/smc91111.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/net/smc91111.h b/drivers/net/smc91111.h index 9deee9b..24b2b51 100644 --- a/drivers/net/smc91111.h +++ b/drivers/net/smc91111.h @@ -236,7 +236,36 @@ struct smc91111_priv{ *(__b2 + __i) = SMC_inb((a),(r)); \ }; \ }while(0) - +#elif defined(CONFIG_MS7206SE) +#define SWAB7206(x) ({ word __x = x; ((__x << 8)|(__x >> 8)); }) +#define SMC_inw(a, r) *((volatile word*)((a)->iobase + (r))) +#define SMC_inb(a, r) (*((volatile byte*)((a)->iobase + ((r) ^ 0x01)))) +#define SMC_insw(a, r, b, l) \ + do { \ + int __i; \ + word *__b2 = (word *)(b); \ + for (__i = 0; __i < (l); __i++) { \ + *__b2++ = SWAB7206(SMC_inw(a, r)); \ + } \ + } while (0) +#define SMC_outw(a, d, r) (*((volatile word *)((a)->iobase+(r))) = d) +#define SMC_outb(a, d, r) ({ word __d = (byte)(d); \ + word __w = SMC_inw((a), ((r)&(~1))); \ + if (((r) & 1)) \ + __w = (__w & 0x00ff) | (__d << 8); \ + else \ + __w = (__w & 0xff00) | (__d); \ + SMC_outw((a), __w, ((r)&(~1))); \ + }) +#define SMC_outsw(a, r, b, l) \ + do { \ + int __i; \ + word *__b2 = (word *)(b); \ + for (__i = 0; __i < (l); __i++) { \ + SMC_outw(a, SWAB7206(*__b2), r); \ + __b2++; \ + } \ + } while (0) #else /* if not CONFIG_CPU_PXA25X and not CONFIG_LEON */ #ifndef CONFIG_SMC_USE_IOFUNCS /* these macros don't work on some boards */