From patchwork Sat Aug 24 15:10:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 269646 X-Patchwork-Delegate: trini@ti.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 4B5B32C0097 for ; Sun, 25 Aug 2013 01:17:35 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BFA8D4A0AA; Sat, 24 Aug 2013 17:17:33 +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 h56O2tpl12We; Sat, 24 Aug 2013 17:17:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1BD744A0AB; Sat, 24 Aug 2013 17:17:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 784F64A09B for ; Sat, 24 Aug 2013 17:17:25 +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 QTrZcfzjdCcF for ; Sat, 24 Aug 2013 17:17:19 +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 mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by theia.denx.de (Postfix) with ESMTPS id 68E764A097 for ; Sat, 24 Aug 2013 17:17:13 +0200 (CEST) Received: by mail-oa0-f54.google.com with SMTP id o6so1998640oag.13 for ; Sat, 24 Aug 2013 08:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=K8HurwG2ySlnJpbDgOHtqn4WoO5aWYnKOsIHO/ufe5Y=; b=K4WypT3JAOrSMJW3sg+poYXFTc8el5+M0y9GcRrPhwCycLibI49tiogzMXhVio/MVX +H9xeTwMRgZmtzKBAX3m1sTD8PVLgLNfTmGLt836q1eNH1tH31wHQROIo1kexn4vJtO7 EMJA+bXNTd8UMWJHkm6BKP/dHmikZrpAwI5hWGXsFTeV2sprJdNn18dd59Yn9WTumuBb zFTFKiRfKj/z4KyRV7qcD/W5XejFcp6uR83UrxDw4uZfzxHA3rskbcD98eWRjMtfA1+h jy+KCo27qiud+SiH6UqoUq8kVhzc97N3bSsPl4QalAKqJtkD9RTBCBelJzkpPqaxVWH6 tu7g== X-Received: by 10.60.45.65 with SMTP id k1mr239729oem.48.1377357076556; Sat, 24 Aug 2013 08:11:16 -0700 (PDT) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPSA id g1sm5223049oeq.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 24 Aug 2013 08:11:15 -0700 (PDT) From: Rob Herring To: u-boot@lists.denx.de Date: Sat, 24 Aug 2013 10:10:47 -0500 Message-Id: <1377357054-27408-1-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 Cc: Tom Rini , Richard Gibbs Subject: [U-Boot] [PATCH v2 1/8] ahci: use ports implemented map instead of num_ports 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 From: Richard Gibbs The AHCI driver was incorrectly using the Capabilities register NP (number of ports) field to determine which ports to activate. This commit changes it to correctly use the PORTS_IMPL register as a port map. Signed-off-by: Richard Gibbs Reviewed-by: Tom Rini --- v2: rebase to v2013.10-rc1 drivers/block/ahci.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index e455ba5..02ba02f 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -119,6 +119,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) u32 tmp, cap_save, cmd; int i, j; volatile u8 *port_mmio; + u32 port_map; debug("ahci_host_init: start\n"); @@ -160,6 +161,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) #endif probe_ent->cap = readl(mmio + HOST_CAP); probe_ent->port_map = readl(mmio + HOST_PORTS_IMPL); + port_map = probe_ent->port_map; probe_ent->n_ports = (probe_ent->cap & 0x1f) + 1; debug("cap 0x%x port_map 0x%x n_ports %d\n", @@ -169,6 +171,8 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent) probe_ent->n_ports = CONFIG_SYS_SCSI_MAX_SCSI_ID; for (i = 0; i < probe_ent->n_ports; i++) { + if (!(port_map & (1 << i))) + continue; probe_ent->port[i].port_mmio = ahci_port_base((u32) mmio, i); port_mmio = (u8 *) probe_ent->port[i].port_mmio; ahci_setup_port(&probe_ent->port[i], (unsigned long)mmio, i);