From patchwork Fri Sep 5 05:52:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Wang X-Patchwork-Id: 386124 X-Patchwork-Delegate: yorksun@freescale.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 33B031400B7 for ; Fri, 5 Sep 2014 16:45:08 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BB8B6A769B; Fri, 5 Sep 2014 08:45:06 +0200 (CEST) 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 PBnGJhneAXGA; Fri, 5 Sep 2014 08:45:06 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DD746A769C; Fri, 5 Sep 2014 08:44:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BEE1AA74C7 for ; Fri, 5 Sep 2014 08:44:38 +0200 (CEST) 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 siRWEDShXM7Z for ; Fri, 5 Sep 2014 08:44:35 +0200 (CEST) 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 na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0140.outbound.protection.outlook.com [157.56.111.140]) by theia.denx.de (Postfix) with ESMTPS id 043D1A73EF for ; Fri, 5 Sep 2014 08:44:30 +0200 (CEST) Received: from BN3PR0301CA0013.namprd03.prod.outlook.com (25.160.180.151) by BY2PR03MB157.namprd03.prod.outlook.com (10.242.36.12) with Microsoft SMTP Server (TLS) id 15.0.1019.16; Fri, 5 Sep 2014 06:44:27 +0000 Received: from BN1BFFO11FD008.protection.gbl (2a01:111:f400:7c10::1:135) by BN3PR0301CA0013.outlook.office365.com (2a01:111:e400:4000::23) with Microsoft SMTP Server (TLS) id 15.0.1019.16 via Frontend Transport; Fri, 5 Sep 2014 06:44:27 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD008.mail.protection.outlook.com (10.58.144.71) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Fri, 5 Sep 2014 06:44:27 +0000 Received: from rock.ap.freescale.net (rock.ap.freescale.net [10.193.20.106]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s856iFDT018534; Thu, 4 Sep 2014 23:44:25 -0700 From: Alison Wang To: , Date: Fri, 5 Sep 2014 13:52:37 +0800 Message-ID: <1409896370-22207-5-git-send-email-b18965@freescale.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1409896370-22207-1-git-send-email-b18965@freescale.com> References: <1409896370-22207-1-git-send-email-b18965@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:CAL; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019016)(6009001)(54534003)(189002)(199003)(92726001)(106466001)(99396002)(81342001)(92566001)(97736001)(19580395003)(81542001)(68736004)(104166001)(44976005)(19580405001)(83322001)(46102001)(85306004)(48376002)(50226001)(95666004)(79102001)(77982001)(90102001)(4396001)(76482001)(105606002)(107046002)(50466002)(76176999)(229853001)(33646002)(50986999)(6806004)(74502001)(31966008)(74662001)(36756003)(104016003)(102836001)(89996001)(26826002)(88136002)(64706001)(77156001)(87286001)(87936001)(62966002)(21056001)(20776003)(84676001)(80022001)(85852003)(83072002)(47776003)(93916002)(42262002)(19627235001); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR03MB157; H:tx30smr01.am.freescale.net; FPR:; MLV:ovrnspm; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 0325F6C77B Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=alison.wang@freescale.com; X-OriginatorOrg: freescale.com Subject: [U-Boot] [PATCH v6 04/17] net: mdio: Use mb() to be compatible for both ARM and PowerPC 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Use mb() instead of sync assembly instruction to be compatible for both ARM and PowerPC. Signed-off-by: Alison Wang --- Change log: v6: Fix checkpatch error. v5: No change. v4: No change. v3: Use mb() to be compatible for both ARM and PowerPC. Split from the 0004-arm-ls102xa-Add-etsec-support-for-LS102xA patch. v2: Add private mdio read and write support. drivers/net/fsl_mdio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c index 8d09f5d..d6b181b 100644 --- a/drivers/net/fsl_mdio.c +++ b/drivers/net/fsl_mdio.c @@ -19,7 +19,8 @@ void tsec_local_mdio_write(struct tsec_mii_mng __iomem *phyregs, int port_addr, out_be32(&phyregs->miimadd, (port_addr << 8) | (regnum & 0x1f)); out_be32(&phyregs->miimcon, value); - asm("sync"); + /* Memory barrier */ + mb(); while ((in_be32(&phyregs->miimind) & MIIMIND_BUSY) && timeout--) ; @@ -37,11 +38,13 @@ int tsec_local_mdio_read(struct tsec_mii_mng __iomem *phyregs, int port_addr, /* Clear the command register, and wait */ out_be32(&phyregs->miimcom, 0); - asm("sync"); + /* Memory barrier */ + mb(); /* Initiate a read command, and wait */ out_be32(&phyregs->miimcom, MIIMCOM_READ_CYCLE); - asm("sync"); + /* Memory barrier */ + mb(); /* Wait for the the indication that the read is done */ while ((in_be32(&phyregs->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY))