diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-03-27 14:51:39 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@marvell.com> | 2008-03-27 14:51:39 -0400 |
commit | 15a32632d94011911497052a96cdbf3b905b325d (patch) | |
tree | 75d5d0c378157f19ccd12a1615a83c6aa2226689 /drivers/ata/sata_mv.c | |
parent | 92aecfa95523384923b52c8ddaf948fc02a53e82 (diff) |
sata_mv: mbus decode window support
Make it possible to pass mbus_dram_target_info to the sata_mv
driver via the platform data, make the sata_mv driver program
the window registers based on this data if it is passed in, and
make the Orion platform setup code use this method instead of
programming the SATA mbus window registers by hand.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Reviewed-by: Tzachi Perelstein <tzachi@marvell.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-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 6ebebde8454a..83584b6e1ba5 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -74,6 +74,7 @@ | |||
74 | #include <linux/device.h> | 74 | #include <linux/device.h> |
75 | #include <linux/platform_device.h> | 75 | #include <linux/platform_device.h> |
76 | #include <linux/ata_platform.h> | 76 | #include <linux/ata_platform.h> |
77 | #include <linux/mbus.h> | ||
77 | #include <scsi/scsi_host.h> | 78 | #include <scsi/scsi_host.h> |
78 | #include <scsi/scsi_cmnd.h> | 79 | #include <scsi/scsi_cmnd.h> |
79 | #include <scsi/scsi_device.h> | 80 | #include <scsi/scsi_device.h> |
@@ -352,6 +353,9 @@ enum { | |||
352 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) | 353 | #define IS_GEN_IIE(hpriv) ((hpriv)->hp_flags & MV_HP_GEN_IIE) |
353 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) | 354 | #define HAS_PCI(host) (!((host)->ports[0]->flags & MV_FLAG_SOC)) |
354 | 355 | ||
356 | #define WINDOW_CTRL(i) (0x20030 + ((i) << 4)) | ||
357 | #define WINDOW_BASE(i) (0x20034 + ((i) << 4)) | ||
358 | |||
355 | enum { | 359 | enum { |
356 | /* DMA boundary 0xffff is required by the s/g splitting | 360 | /* DMA boundary 0xffff is required by the s/g splitting |
357 | * we need on /length/ in mv_fill-sg(). | 361 | * we need on /length/ in mv_fill-sg(). |
@@ -2897,6 +2901,27 @@ static int mv_create_dma_pools(struct mv_host_priv *hpriv, struct device *dev) | |||
2897 | return 0; | 2901 | return 0; |
2898 | } | 2902 | } |
2899 | 2903 | ||
2904 | static void mv_conf_mbus_windows(struct mv_host_priv *hpriv, | ||
2905 | struct mbus_dram_target_info *dram) | ||
2906 | { | ||
2907 | int i; | ||
2908 | |||
2909 | for (i = 0; i < 4; i++) { | ||
2910 | writel(0, hpriv->base + WINDOW_CTRL(i)); | ||
2911 | writel(0, hpriv->base + WINDOW_BASE(i)); | ||
2912 | } | ||
2913 | |||
2914 | for (i = 0; i < dram->num_cs; i++) { | ||
2915 | struct mbus_dram_window *cs = dram->cs + i; | ||
2916 | |||
2917 | writel(((cs->size - 1) & 0xffff0000) | | ||
2918 | (cs->mbus_attr << 8) | | ||
2919 | (dram->mbus_dram_target_id << 4) | 1, | ||
2920 | hpriv->base + WINDOW_CTRL(i)); | ||
2921 | writel(cs->base, hpriv->base + WINDOW_BASE(i)); | ||
2922 | } | ||
2923 | } | ||
2924 | |||
2900 | /** | 2925 | /** |
2901 | * mv_platform_probe - handle a positive probe of an soc Marvell | 2926 | * mv_platform_probe - handle a positive probe of an soc Marvell |
2902 | * host | 2927 | * host |
@@ -2951,6 +2976,12 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
2951 | res->end - res->start + 1); | 2976 | res->end - res->start + 1); |
2952 | hpriv->base -= MV_SATAHC0_REG_BASE; | 2977 | hpriv->base -= MV_SATAHC0_REG_BASE; |
2953 | 2978 | ||
2979 | /* | ||
2980 | * (Re-)program MBUS remapping windows if we are asked to. | ||
2981 | */ | ||
2982 | if (mv_platform_data->dram != NULL) | ||
2983 | mv_conf_mbus_windows(hpriv, mv_platform_data->dram); | ||
2984 | |||
2954 | rc = mv_create_dma_pools(hpriv, &pdev->dev); | 2985 | rc = mv_create_dma_pools(hpriv, &pdev->dev); |
2955 | if (rc) | 2986 | if (rc) |
2956 | return rc; | 2987 | return rc; |