diff options
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/sata_mv.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 05ff8c776497..d52ce1188327 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -76,6 +76,7 @@ | |||
76 | #include <linux/device.h> | 76 | #include <linux/device.h> |
77 | #include <linux/platform_device.h> | 77 | #include <linux/platform_device.h> |
78 | #include <linux/ata_platform.h> | 78 | #include <linux/ata_platform.h> |
79 | #include <linux/mbus.h> | ||
79 | #include <scsi/scsi_host.h> | 80 | #include <scsi/scsi_host.h> |
80 | #include <scsi/scsi_cmnd.h> | 81 | #include <scsi/scsi_cmnd.h> |
81 | #include <scsi/scsi_device.h> | 82 | #include <scsi/scsi_device.h> |
@@ -370,6 +371,9 @@ enum { | |||
370 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) | 371 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) |
371 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) | 372 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) |
372 | 373 | ||
374 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) | ||
375 | #define WINDOW_BASE(i) (0x20034 + ((i) << 4)) | ||
376 | |||
373 | enum { | 377 | enum { |
374 | /* DMA boundary 0xffff is required by the s/g splitting | 378 | /* DMA boundary 0xffff is required by the s/g splitting |
375 | * we need on /length/ in mv_fill-sg(). | 379 | * we need on /length/ in mv_fill-sg(). |
@@ -2769,6 +2773,27 @@ static int mv_create_dma_pools(struct mv_host_priv *hpriv, struct device *dev) | |||
2769 | return 0; | 2773 | return 0; |
2770 | } | 2774 | } |
2771 | 2775 | ||
2776 | static void mv_conf_mbus_windows(struct mv_host_priv *hpriv, | ||
2777 | struct mbus_dram_target_info *dram) | ||
2778 | { | ||
2779 | int i; | ||
2780 | |||
2781 | for (i = 0; i < 4; i++) { | ||
2782 | writel(0, hpriv->base + WINDOW_CTRL(i)); | ||
2783 | writel(0, hpriv->base + WINDOW_BASE(i)); | ||
2784 | } | ||
2785 | |||
2786 | for (i = 0; i < dram->num_cs; i++) { | ||
2787 | struct mbus_dram_window *cs = dram->cs + i; | ||
2788 | |||
2789 | writel(((cs->size - 1) & 0xffff0000) | | ||
2790 | (cs->mbus_attr << 8) | | ||
2791 | (dram->mbus_dram_target_id << 4) | 1, | ||
2792 | hpriv->base + WINDOW_CTRL(i)); | ||
2793 | writel(cs->base, hpriv->base + WINDOW_BASE(i)); | ||
2794 | } | ||
2795 | } | ||
2796 | |||
2772 | /** | 2797 | /** |
2773 | * mv_platform_probe - handle a positive probe of an soc Marvell | 2798 | * mv_platform_probe - handle a positive probe of an soc Marvell |
2774 | * host | 2799 | * host |
@@ -2823,6 +2848,12 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
2823 | res->end - res->start + 1); | 2848 | res->end - res->start + 1); |
2824 | hpriv->base -= MV_SATAHC0_REG_BASE; | 2849 | hpriv->base -= MV_SATAHC0_REG_BASE; |
2825 | 2850 | ||
2851 | /* | ||
2852 | * (Re-)program MBUS remapping windows if we are asked to. | ||
2853 | */ | ||
2854 | if (mv_platform_data->dram != NULL) | ||
2855 | mv_conf_mbus_windows(hpriv, mv_platform_data->dram); | ||
2856 | |||
2826 | rc = mv_create_dma_pools(hpriv, &pdev->dev); | 2857 | rc = mv_create_dma_pools(hpriv, &pdev->dev); |
2827 | if (rc) | 2858 | if (rc) |
2828 | return rc; | 2859 | return rc; |