From patchwork Mon Oct 18 14:03:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bounine, Alexandre" X-Patchwork-Id: 68198 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id E17CB100D0E for ; Tue, 19 Oct 2010 01:09:56 +1100 (EST) Received: from mxout1.idt.com (mxout1.idt.com [157.165.5.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mxout1.idt.com", Issuer "idt.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 667E6B710D for ; Tue, 19 Oct 2010 01:09:40 +1100 (EST) Received: from mail.idt.com (localhost [127.0.0.1]) by mxout1.idt.com (8.13.1/8.13.1) with ESMTP id o9IE9O5n007575; Mon, 18 Oct 2010 07:09:24 -0700 Received: from corpml1.corp.idt.com (corpml1.corp.idt.com [157.165.140.20]) by mail.idt.com (8.13.8/8.13.8) with ESMTP id o9IE9M47001803; Mon, 18 Oct 2010 07:09:22 -0700 (PDT) Received: from corpvpnfw (localhost [127.0.0.1]) by corpml1.corp.idt.com (8.11.7p1+Sun/8.11.7) with SMTP id o9IE9K512604; Mon, 18 Oct 2010 07:09:21 -0700 (PDT) Received: from atanerk.tundra.com ([10.1.0.17]) by corpvpnfw; Mon, 18 Oct 2010 14:09:17 +0000 (GMT) Received: from tomkin.tundra.com (tomkin [10.1.0.2]) by atanerk.tundra.com (8.13.6/8.13.6) with ESMTP id o9IE54Vj008009; Mon, 18 Oct 2010 10:05:30 -0400 (EDT) Received: from tomkin.tundra.com (localhost.localdomain [127.0.0.1]) by tomkin.tundra.com (8.13.1/8.13.1) with ESMTP id o9IE4xdW024868; Mon, 18 Oct 2010 10:04:59 -0400 Received: (from abounine@localhost) by tomkin.tundra.com (8.13.1/8.13.1/Submit) id o9IE4s1s024866; Mon, 18 Oct 2010 10:04:54 -0400 From: Alexandre Bounine To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH -mm 2/2] RapidIO: Fix destructive port EM initialization for Tsi568 Date: Mon, 18 Oct 2010 10:03:20 -0400 Message-Id: <1287410600-24783-2-git-send-email-alexandre.bounine@idt.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1287410600-24783-1-git-send-email-alexandre.bounine@idt.com> References: <1287410600-24783-1-git-send-email-alexandre.bounine@idt.com> X-Scanned-By: MIMEDefang 2.43 Cc: Alexandre Bounine , Thomas Moll X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Replaces possibly damaging broadcast writes into the per-port SP_MODE registers with individual writes for each port. This will preserve individual port configurations in case if ports are configured differently. Signed-off-by: Alexandre Bounine Cc: Kumar Gala Cc: Matt Porter Cc: Li Yang Cc: Thomas Moll Cc: Micha Nelissen --- drivers/rapidio/switches/tsi568.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/rapidio/switches/tsi568.c b/drivers/rapidio/switches/tsi568.c index f7fd789..b9a389b 100644 --- a/drivers/rapidio/switches/tsi568.c +++ b/drivers/rapidio/switches/tsi568.c @@ -29,7 +29,7 @@ #define SPP_ROUTE_CFG_DESTID(n) (0x11070 + 0x100*n) #define SPP_ROUTE_CFG_PORT(n) (0x11074 + 0x100*n) -#define TSI568_SP_MODE_BC 0x10004 +#define TSI568_SP_MODE(n) (0x11004 + 0x100*n) #define TSI568_SP_MODE_PW_DIS 0x08000000 static int @@ -117,14 +117,19 @@ tsi568_em_init(struct rio_dev *rdev) u16 destid = rdev->rswitch->destid; u8 hopcount = rdev->rswitch->hopcount; u32 regval; + int portnum; pr_debug("TSI568 %s [%d:%d]\n", __func__, destid, hopcount); /* Make sure that Port-Writes are disabled (for all ports) */ - rio_mport_read_config_32(mport, destid, hopcount, - TSI568_SP_MODE_BC, ®val); - rio_mport_write_config_32(mport, destid, hopcount, - TSI568_SP_MODE_BC, regval | TSI568_SP_MODE_PW_DIS); + for (portnum = 0; + portnum < RIO_GET_TOTAL_PORTS(rdev->swpinfo); portnum++) { + rio_mport_read_config_32(mport, destid, hopcount, + TSI568_SP_MODE(portnum), ®val); + rio_mport_write_config_32(mport, destid, hopcount, + TSI568_SP_MODE(portnum), + regval | TSI568_SP_MODE_PW_DIS); + } return 0; }