]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/block/dwc_ahsata.c
dm: Drop the block_dev_desc_t typedef
[people/ms/u-boot.git] / drivers / block / dwc_ahsata.c
index 9a2b547af2d3f0bf80d2ee0a6c0f88ddae061904..6ec52a9114b468ced0fffc0f70b7aea2bf29f9b5 100644 (file)
@@ -80,7 +80,7 @@ struct sata_host_regs {
 
 static int is_ready;
 
-static inline u32 ahci_port_base(u32 base, u32 port)
+static inline void __iomem *ahci_port_base(void __iomem *base, u32 port)
 {
        return base + 0x100 + (port * 0x80);
 }
@@ -167,7 +167,7 @@ static int ahci_host_init(struct ahci_probe_ent *probe_ent)
 
        for (i = 0; i < probe_ent->n_ports; i++) {
                probe_ent->port[i].port_mmio =
-                       ahci_port_base((u32)host_mmio, i);
+                       ahci_port_base(host_mmio, i);
                port_mmio =
                        (struct sata_port_regs *)probe_ent->port[i].port_mmio;
 
@@ -343,7 +343,7 @@ static int ahci_init_one(int pdev)
                                | ATA_FLAG_PIO_DMA
                                | ATA_FLAG_NO_ATAPI;
 
-       probe_ent->mmio_base = CONFIG_DWC_AHSATA_BASE_ADDR;
+       probe_ent->mmio_base = (void __iomem *)CONFIG_DWC_AHSATA_BASE_ADDR;
 
        /* initialize adapter */
        rc = ahci_host_init(probe_ent);
@@ -399,8 +399,11 @@ static void ahci_fill_cmd_slot(struct ahci_ioports *pp, u32 cmd_slot, u32 opts)
        memset(cmd_hdr, 0, AHCI_CMD_SLOT_SZ);
        cmd_hdr->opts = cpu_to_le32(opts);
        cmd_hdr->status = 0;
-       cmd_hdr->tbl_addr = cpu_to_le32(pp->cmd_tbl & 0xffffffff);
-       cmd_hdr->tbl_addr_hi = 0;
+       pp->cmd_slot->tbl_addr = cpu_to_le32((u32)pp->cmd_tbl & 0xffffffff);
+#ifdef CONFIG_PHYS_64BIT
+       pp->cmd_slot->tbl_addr_hi =
+           cpu_to_le32((u32)(((pp->cmd_tbl) >> 16) >> 16));
+#endif
 }
 
 #define AHCI_GET_CMD_SLOT(c) ((c) ? ffs(c) : 0)
@@ -520,7 +523,7 @@ static int ahci_port_start(struct ahci_probe_ent *probe_ent,
         * and its scatter-gather table
         */
        pp->cmd_tbl = mem;
-       debug("cmd_tbl_dma = 0x%x\n", pp->cmd_tbl);
+       debug("cmd_tbl_dma = 0x%lx\n", pp->cmd_tbl);
 
        mem += AHCI_CMD_TBL_HDR;
 
@@ -594,28 +597,30 @@ int init_sata(int dev)
 
 int reset_sata(int dev)
 {
-       struct ahci_probe_ent *probe_ent =
-                       (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
-       struct sata_host_regs *host_mmio =
-                       (struct sata_host_regs *)probe_ent->mmio_base;
+       struct ahci_probe_ent *probe_ent;
+       struct sata_host_regs *host_mmio;
 
        if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1)) {
                printf("The sata index %d is out of ranges\n\r", dev);
                return -1;
        }
 
+       probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
+       if (NULL == probe_ent)
+               /* not initialized, so nothing to reset */
+               return 0;
+
+       host_mmio = (struct sata_host_regs *)probe_ent->mmio_base;
        setbits_le32(&host_mmio->ghc, SATA_HOST_GHC_HR);
        while (readl(&host_mmio->ghc) & SATA_HOST_GHC_HR)
                udelay(100);
 
-       disable_sata_clock();
-
        return 0;
 }
 
 static void dwc_ahsata_print_info(int dev)
 {
-       block_dev_desc_t *pdev = &(sata_dev_desc[dev]);
+       struct blk_desc *pdev = &(sata_dev_desc[dev]);
 
        printf("SATA Device Info:\n\r");
 #ifdef CONFIG_SYS_64BIT_LBA
@@ -951,7 +956,7 @@ int scan_sata(int dev)
        struct ahci_probe_ent *probe_ent =
                (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
        u8 port = probe_ent->hard_port_no;
-       block_dev_desc_t *pdev = &(sata_dev_desc[dev]);
+       struct blk_desc *pdev = &(sata_dev_desc[dev]);
 
        id = (u16 *)memalign(ARCH_DMA_MINALIGN,
                                roundup(ARCH_DMA_MINALIGN,