public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/7] ahci: use ports implemented map instead of num_ports
@ 2013-05-21 22:44 Rob Herring
  2013-05-21 22:44 ` [U-Boot] [PATCH 2/7] ahci: fix unaligned access Rob Herring
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Rob Herring @ 2013-05-21 22:44 UTC (permalink / raw)
  To: u-boot

From: Richard Gibbs <richard.gibbs@calxeda.com>

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 <richard.gibbs@calxeda.com>
---
 drivers/block/ahci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c
index cab7f8c..b89be06 100644
--- a/drivers/block/ahci.c
+++ b/drivers/block/ahci.c
@@ -136,6 +136,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");
 
@@ -177,6 +178,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",
@@ -186,6 +188,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);
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-05-24 18:35 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-21 22:44 [U-Boot] [PATCH 1/7] ahci: use ports implemented map instead of num_ports Rob Herring
2013-05-21 22:44 ` [U-Boot] [PATCH 2/7] ahci: fix unaligned access Rob Herring
2013-05-24 13:45   ` Tom Rini
2013-05-24 18:35   ` Wolfgang Denk
2013-05-21 22:44 ` [U-Boot] [PATCH 3/7] ahci: fix memory leak in ata_scsiop_inquiry Rob Herring
2013-05-24 13:46   ` Tom Rini
2013-05-21 22:44 ` [U-Boot] [PATCH 4/7] ahci: move link bring-up handling to separate function Rob Herring
2013-05-24 13:44   ` Tom Rini
2013-05-21 22:44 ` [U-Boot] [PATCH 5/7] ahci: handle COMINIT received during spin-up Rob Herring
2013-05-24 13:47   ` Tom Rini
2013-05-21 22:44 ` [U-Boot] [PATCH 6/7] ahci: increase spin-up timeout to 20 sec Rob Herring
2013-05-24 13:51   ` Tom Rini
2013-05-21 22:44 ` [U-Boot] [PATCH 7/7] ahci: convert to use libata functions and definitions Rob Herring
2013-05-24 13:53   ` Tom Rini
2013-05-24 13:45 ` [U-Boot] [PATCH 1/7] ahci: use ports implemented map instead of num_ports Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox