]> git.sur5r.net Git - u-boot/commitdiff
ahci: use ports implemented map instead of num_ports
authorRichard Gibbs <richard.gibbs@calxeda.com>
Sat, 24 Aug 2013 15:10:47 +0000 (10:10 -0500)
committerTom Rini <trini@ti.com>
Fri, 6 Sep 2013 17:09:07 +0000 (13:09 -0400)
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>
Reviewed-by: Tom Rini <trini@ti.com>
drivers/block/ahci.c

index e455ba5fb6507f1b1f435804fdf84836a27e8096..02ba02f427a07f908dae0496ed167060cea27b70 100644 (file)
@@ -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);