aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bus
diff options
context:
space:
mode:
authorMichal Mazur <arg@semihalf.com>2014-12-30 07:43:43 -0500
committerAndrew Lunn <andrew@lunn.ch>2015-01-19 17:08:13 -0500
commit7fdf3d8a0316ce31f87513f903addcb8f3b0dfb2 (patch)
tree728a0f5c8d06d8659eba79e5c69798cbf2a8d177 /drivers/bus
parent1bd4d8a6de5cda605e8b99fbf081be2ea2959380 (diff)
bus: mvebu-mbus: fix support of MBus window 13 on Armada XP/375/38x
On Armada XP, 375 and 38x the MBus window 13 has the remap capability, like windows 0 to 7. However, the mvebu-mbus driver isn't currently taking into account this special case, which means that when window 13 is actually used, the remap registers are left to 0, making the device using this MBus window unavailable. To make things even more fun, the hardware designers have chosen to put the window 13 remap registers in a completely custom location, using a logic that differs from the one used for all other remappable windows. To solve this problem, this commit: * Adds a SoC specific function to calculate offset of remap registers to the mvebu_mbus_soc_data structure. This function, ->win_remap_offset(), returns the offset of the remap registers, or MVEBU_MBUS_NO_REMAP if the window does not have the remap capability. This new function replaces the previous integer field num_remappable_wins, which was insufficient to encode the special case of window 13. * Adds an implementation of the ->win_remap_offset() function for the various SoC families. Some have 2 first windows that are remapable, some the 4 first, some the 8 first, and then the Armada XP/375/38x case where the 8 first are remapable plus the special window 13. This is implemented in functions generic_mbus_win_remap_2_offset(), generic_mbus_win_remap_4_offset(), generic_mbus_win_remap_8_offset() and armada_xp_mbus_win_remap_offset() respectively. * Change the code to use the ->win_remap_offset() function when accessing the remap registers, and also to use a newly introduced mvebu_mbus_window_is_remappable() helper function that tells whether a given window is remapable or not. * Separate Armada 370 from XP/375/38X because the window 13 of Armada 370 does not support the remap capability. [Thomas: adapted for the mainline kernel, minor clarifications in the code, reword the commit log.] Signed-off-by: Michal Mazur <arg@semihalf.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> [Andrew Lunn <andrew@lunn.ch>: Undo the simple fix for stable] Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Diffstat (limited to 'drivers/bus')
-rw-r--r--drivers/bus/mvebu-mbus.c164
1 files changed, 116 insertions, 48 deletions
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 061b5cf1d451..a62c8ae253c3 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -110,9 +110,9 @@ struct mvebu_mbus_state;
110 110
111struct mvebu_mbus_soc_data { 111struct mvebu_mbus_soc_data {
112 unsigned int num_wins; 112 unsigned int num_wins;
113 unsigned int num_remappable_wins;
114 bool has_mbus_bridge; 113 bool has_mbus_bridge;
115 unsigned int (*win_cfg_offset)(const int win); 114 unsigned int (*win_cfg_offset)(const int win);
115 unsigned int (*win_remap_offset)(const int win);
116 void (*setup_cpu_target)(struct mvebu_mbus_state *s); 116 void (*setup_cpu_target)(struct mvebu_mbus_state *s);
117 int (*save_cpu_target)(struct mvebu_mbus_state *s, 117 int (*save_cpu_target)(struct mvebu_mbus_state *s,
118 u32 *store_addr); 118 u32 *store_addr);
@@ -158,6 +158,13 @@ const struct mbus_dram_target_info *mv_mbus_dram_info(void)
158} 158}
159EXPORT_SYMBOL_GPL(mv_mbus_dram_info); 159EXPORT_SYMBOL_GPL(mv_mbus_dram_info);
160 160
161/* Checks whether the given window has remap capability */
162static bool mvebu_mbus_window_is_remappable(struct mvebu_mbus_state *mbus,
163 const int win)
164{
165 return mbus->soc->win_remap_offset(win) != MVEBU_MBUS_NO_REMAP;
166}
167
161/* 168/*
162 * Functions to manipulate the address decoding windows 169 * Functions to manipulate the address decoding windows
163 */ 170 */
@@ -189,9 +196,12 @@ static void mvebu_mbus_read_window(struct mvebu_mbus_state *mbus,
189 *attr = (ctrlreg & WIN_CTRL_ATTR_MASK) >> WIN_CTRL_ATTR_SHIFT; 196 *attr = (ctrlreg & WIN_CTRL_ATTR_MASK) >> WIN_CTRL_ATTR_SHIFT;
190 197
191 if (remap) { 198 if (remap) {
192 if (win < mbus->soc->num_remappable_wins) { 199 if (mvebu_mbus_window_is_remappable(mbus, win)) {
193 u32 remap_low = readl(addr + WIN_REMAP_LO_OFF); 200 u32 remap_low, remap_hi;
194 u32 remap_hi = readl(addr + WIN_REMAP_HI_OFF); 201 void __iomem *addr_rmp = mbus->mbuswins_base +
202 mbus->soc->win_remap_offset(win);
203 remap_low = readl(addr_rmp + WIN_REMAP_LO_OFF);
204 remap_hi = readl(addr_rmp + WIN_REMAP_HI_OFF);
195 *remap = ((u64)remap_hi << 32) | remap_low; 205 *remap = ((u64)remap_hi << 32) | remap_low;
196 } else 206 } else
197 *remap = 0; 207 *remap = 0;
@@ -204,10 +214,11 @@ static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus,
204 void __iomem *addr; 214 void __iomem *addr;
205 215
206 addr = mbus->mbuswins_base + mbus->soc->win_cfg_offset(win); 216 addr = mbus->mbuswins_base + mbus->soc->win_cfg_offset(win);
207
208 writel(0, addr + WIN_BASE_OFF); 217 writel(0, addr + WIN_BASE_OFF);
209 writel(0, addr + WIN_CTRL_OFF); 218 writel(0, addr + WIN_CTRL_OFF);
210 if (win < mbus->soc->num_remappable_wins) { 219
220 if (mvebu_mbus_window_is_remappable(mbus, win)) {
221 addr = mbus->mbuswins_base + mbus->soc->win_remap_offset(win);
211 writel(0, addr + WIN_REMAP_LO_OFF); 222 writel(0, addr + WIN_REMAP_LO_OFF);
212 writel(0, addr + WIN_REMAP_HI_OFF); 223 writel(0, addr + WIN_REMAP_HI_OFF);
213 } 224 }
@@ -215,14 +226,6 @@ static void mvebu_mbus_disable_window(struct mvebu_mbus_state *mbus,
215 226
216/* Checks whether the given window number is available */ 227/* Checks whether the given window number is available */
217 228
218/* On Armada XP, 375 and 38x the MBus window 13 has the remap
219 * capability, like windows 0 to 7. However, the mvebu-mbus driver
220 * isn't currently taking into account this special case, which means
221 * that when window 13 is actually used, the remap registers are left
222 * to 0, making the device using this MBus window unavailable. The
223 * quick fix for stable is to not use window 13. A follow up patch
224 * will correctly handle this window.
225*/
226static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus, 229static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus,
227 const int win) 230 const int win)
228{ 231{
@@ -230,9 +233,6 @@ static int mvebu_mbus_window_is_free(struct mvebu_mbus_state *mbus,
230 mbus->soc->win_cfg_offset(win); 233 mbus->soc->win_cfg_offset(win);
231 u32 ctrl = readl(addr + WIN_CTRL_OFF); 234 u32 ctrl = readl(addr + WIN_CTRL_OFF);
232 235
233 if (win == 13)
234 return false;
235
236 return !(ctrl & WIN_CTRL_ENABLE); 236 return !(ctrl & WIN_CTRL_ENABLE);
237} 237}
238 238
@@ -325,13 +325,17 @@ static int mvebu_mbus_setup_window(struct mvebu_mbus_state *mbus,
325 325
326 writel(base & WIN_BASE_LOW, addr + WIN_BASE_OFF); 326 writel(base & WIN_BASE_LOW, addr + WIN_BASE_OFF);
327 writel(ctrl, addr + WIN_CTRL_OFF); 327 writel(ctrl, addr + WIN_CTRL_OFF);
328 if (win < mbus->soc->num_remappable_wins) { 328
329 if (mvebu_mbus_window_is_remappable(mbus, win)) {
330 void __iomem *addr_rmp = mbus->mbuswins_base +
331 mbus->soc->win_remap_offset(win);
332
329 if (remap == MVEBU_MBUS_NO_REMAP) 333 if (remap == MVEBU_MBUS_NO_REMAP)
330 remap_addr = base; 334 remap_addr = base;
331 else 335 else
332 remap_addr = remap; 336 remap_addr = remap;
333 writel(remap_addr & WIN_REMAP_LOW, addr + WIN_REMAP_LO_OFF); 337 writel(remap_addr & WIN_REMAP_LOW, addr_rmp + WIN_REMAP_LO_OFF);
334 writel(0, addr + WIN_REMAP_HI_OFF); 338 writel(0, addr_rmp + WIN_REMAP_HI_OFF);
335 } 339 }
336 340
337 return 0; 341 return 0;
@@ -345,19 +349,27 @@ static int mvebu_mbus_alloc_window(struct mvebu_mbus_state *mbus,
345 int win; 349 int win;
346 350
347 if (remap == MVEBU_MBUS_NO_REMAP) { 351 if (remap == MVEBU_MBUS_NO_REMAP) {
348 for (win = mbus->soc->num_remappable_wins; 352 for (win = 0; win < mbus->soc->num_wins; win++) {
349 win < mbus->soc->num_wins; win++) 353 if (mvebu_mbus_window_is_remappable(mbus, win))
354 continue;
355
350 if (mvebu_mbus_window_is_free(mbus, win)) 356 if (mvebu_mbus_window_is_free(mbus, win))
351 return mvebu_mbus_setup_window(mbus, win, base, 357 return mvebu_mbus_setup_window(mbus, win, base,
352 size, remap, 358 size, remap,
353 target, attr); 359 target, attr);
360 }
354 } 361 }
355 362
363 for (win = 0; win < mbus->soc->num_wins; win++) {
364 /* Skip window if need remap but is not supported */
365 if ((remap != MVEBU_MBUS_NO_REMAP) &&
366 !mvebu_mbus_window_is_remappable(mbus, win))
367 continue;
356 368
357 for (win = 0; win < mbus->soc->num_wins; win++)
358 if (mvebu_mbus_window_is_free(mbus, win)) 369 if (mvebu_mbus_window_is_free(mbus, win))
359 return mvebu_mbus_setup_window(mbus, win, base, size, 370 return mvebu_mbus_setup_window(mbus, win, base, size,
360 remap, target, attr); 371 remap, target, attr);
372 }
361 373
362 return -ENOMEM; 374 return -ENOMEM;
363} 375}
@@ -469,7 +481,7 @@ static int mvebu_devs_debug_show(struct seq_file *seq, void *v)
469 ((wbase & (u64)(wsize - 1)) != 0)) 481 ((wbase & (u64)(wsize - 1)) != 0))
470 seq_puts(seq, " (Invalid base/size!!)"); 482 seq_puts(seq, " (Invalid base/size!!)");
471 483
472 if (win < mbus->soc->num_remappable_wins) { 484 if (mvebu_mbus_window_is_remappable(mbus, win)) {
473 seq_printf(seq, " (remap %016llx)\n", 485 seq_printf(seq, " (remap %016llx)\n",
474 (unsigned long long)wremap); 486 (unsigned long long)wremap);
475 } else 487 } else
@@ -495,12 +507,12 @@ static const struct file_operations mvebu_devs_debug_fops = {
495 * SoC-specific functions and definitions 507 * SoC-specific functions and definitions
496 */ 508 */
497 509
498static unsigned int orion_mbus_win_offset(int win) 510static unsigned int generic_mbus_win_cfg_offset(int win)
499{ 511{
500 return win << 4; 512 return win << 4;
501} 513}
502 514
503static unsigned int armada_370_xp_mbus_win_offset(int win) 515static unsigned int armada_370_xp_mbus_win_cfg_offset(int win)
504{ 516{
505 /* The register layout is a bit annoying and the below code 517 /* The register layout is a bit annoying and the below code
506 * tries to cope with it. 518 * tries to cope with it.
@@ -520,7 +532,7 @@ static unsigned int armada_370_xp_mbus_win_offset(int win)
520 return 0x90 + ((win - 8) << 3); 532 return 0x90 + ((win - 8) << 3);
521} 533}
522 534
523static unsigned int mv78xx0_mbus_win_offset(int win) 535static unsigned int mv78xx0_mbus_win_cfg_offset(int win)
524{ 536{
525 if (win < 8) 537 if (win < 8)
526 return win << 4; 538 return win << 4;
@@ -528,6 +540,40 @@ static unsigned int mv78xx0_mbus_win_offset(int win)
528 return 0x900 + ((win - 8) << 4); 540 return 0x900 + ((win - 8) << 4);
529} 541}
530 542
543static unsigned int generic_mbus_win_remap_2_offset(int win)
544{
545 if (win < 2)
546 return generic_mbus_win_cfg_offset(win);
547 else
548 return MVEBU_MBUS_NO_REMAP;
549}
550
551static unsigned int generic_mbus_win_remap_4_offset(int win)
552{
553 if (win < 4)
554 return generic_mbus_win_cfg_offset(win);
555 else
556 return MVEBU_MBUS_NO_REMAP;
557}
558
559static unsigned int generic_mbus_win_remap_8_offset(int win)
560{
561 if (win < 8)
562 return generic_mbus_win_cfg_offset(win);
563 else
564 return MVEBU_MBUS_NO_REMAP;
565}
566
567static unsigned int armada_xp_mbus_win_remap_offset(int win)
568{
569 if (win < 8)
570 return generic_mbus_win_cfg_offset(win);
571 else if (win == 13)
572 return 0xF0 - WIN_REMAP_LO_OFF;
573 else
574 return MVEBU_MBUS_NO_REMAP;
575}
576
531static void __init 577static void __init
532mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus) 578mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus)
533{ 579{
@@ -637,30 +683,40 @@ int mvebu_mbus_save_cpu_target(u32 *store_addr)
637 return mbus_state.soc->save_cpu_target(&mbus_state, store_addr); 683 return mbus_state.soc->save_cpu_target(&mbus_state, store_addr);
638} 684}
639 685
640static const struct mvebu_mbus_soc_data armada_370_xp_mbus_data = { 686static const struct mvebu_mbus_soc_data armada_370_mbus_data = {
641 .num_wins = 20, 687 .num_wins = 20,
642 .num_remappable_wins = 8,
643 .has_mbus_bridge = true, 688 .has_mbus_bridge = true,
644 .win_cfg_offset = armada_370_xp_mbus_win_offset, 689 .win_cfg_offset = armada_370_xp_mbus_win_cfg_offset,
690 .win_remap_offset = generic_mbus_win_remap_8_offset,
691 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target,
692 .show_cpu_target = mvebu_sdram_debug_show_orion,
645 .save_cpu_target = mvebu_mbus_default_save_cpu_target, 693 .save_cpu_target = mvebu_mbus_default_save_cpu_target,
694};
695
696static const struct mvebu_mbus_soc_data armada_xp_mbus_data = {
697 .num_wins = 20,
698 .has_mbus_bridge = true,
699 .win_cfg_offset = armada_370_xp_mbus_win_cfg_offset,
700 .win_remap_offset = armada_xp_mbus_win_remap_offset,
646 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, 701 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target,
647 .show_cpu_target = mvebu_sdram_debug_show_orion, 702 .show_cpu_target = mvebu_sdram_debug_show_orion,
703 .save_cpu_target = mvebu_mbus_default_save_cpu_target,
648}; 704};
649 705
650static const struct mvebu_mbus_soc_data kirkwood_mbus_data = { 706static const struct mvebu_mbus_soc_data kirkwood_mbus_data = {
651 .num_wins = 8, 707 .num_wins = 8,
652 .num_remappable_wins = 4, 708 .win_cfg_offset = generic_mbus_win_cfg_offset,
653 .win_cfg_offset = orion_mbus_win_offset,
654 .save_cpu_target = mvebu_mbus_default_save_cpu_target, 709 .save_cpu_target = mvebu_mbus_default_save_cpu_target,
710 .win_remap_offset = generic_mbus_win_remap_4_offset,
655 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, 711 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target,
656 .show_cpu_target = mvebu_sdram_debug_show_orion, 712 .show_cpu_target = mvebu_sdram_debug_show_orion,
657}; 713};
658 714
659static const struct mvebu_mbus_soc_data dove_mbus_data = { 715static const struct mvebu_mbus_soc_data dove_mbus_data = {
660 .num_wins = 8, 716 .num_wins = 8,
661 .num_remappable_wins = 4, 717 .win_cfg_offset = generic_mbus_win_cfg_offset,
662 .win_cfg_offset = orion_mbus_win_offset,
663 .save_cpu_target = mvebu_mbus_dove_save_cpu_target, 718 .save_cpu_target = mvebu_mbus_dove_save_cpu_target,
719 .win_remap_offset = generic_mbus_win_remap_4_offset,
664 .setup_cpu_target = mvebu_mbus_dove_setup_cpu_target, 720 .setup_cpu_target = mvebu_mbus_dove_setup_cpu_target,
665 .show_cpu_target = mvebu_sdram_debug_show_dove, 721 .show_cpu_target = mvebu_sdram_debug_show_dove,
666}; 722};
@@ -671,36 +727,40 @@ static const struct mvebu_mbus_soc_data dove_mbus_data = {
671 */ 727 */
672static const struct mvebu_mbus_soc_data orion5x_4win_mbus_data = { 728static const struct mvebu_mbus_soc_data orion5x_4win_mbus_data = {
673 .num_wins = 8, 729 .num_wins = 8,
674 .num_remappable_wins = 4, 730 .win_cfg_offset = generic_mbus_win_cfg_offset,
675 .win_cfg_offset = orion_mbus_win_offset,
676 .save_cpu_target = mvebu_mbus_default_save_cpu_target, 731 .save_cpu_target = mvebu_mbus_default_save_cpu_target,
732 .win_remap_offset = generic_mbus_win_remap_4_offset,
677 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, 733 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target,
678 .show_cpu_target = mvebu_sdram_debug_show_orion, 734 .show_cpu_target = mvebu_sdram_debug_show_orion,
679}; 735};
680 736
681static const struct mvebu_mbus_soc_data orion5x_2win_mbus_data = { 737static const struct mvebu_mbus_soc_data orion5x_2win_mbus_data = {
682 .num_wins = 8, 738 .num_wins = 8,
683 .num_remappable_wins = 2, 739 .win_cfg_offset = generic_mbus_win_cfg_offset,
684 .win_cfg_offset = orion_mbus_win_offset,
685 .save_cpu_target = mvebu_mbus_default_save_cpu_target, 740 .save_cpu_target = mvebu_mbus_default_save_cpu_target,
741 .win_remap_offset = generic_mbus_win_remap_2_offset,
686 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, 742 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target,
687 .show_cpu_target = mvebu_sdram_debug_show_orion, 743 .show_cpu_target = mvebu_sdram_debug_show_orion,
688}; 744};
689 745
690static const struct mvebu_mbus_soc_data mv78xx0_mbus_data = { 746static const struct mvebu_mbus_soc_data mv78xx0_mbus_data = {
691 .num_wins = 14, 747 .num_wins = 14,
692 .num_remappable_wins = 8, 748 .win_cfg_offset = mv78xx0_mbus_win_cfg_offset,
693 .win_cfg_offset = mv78xx0_mbus_win_offset,
694 .save_cpu_target = mvebu_mbus_default_save_cpu_target, 749 .save_cpu_target = mvebu_mbus_default_save_cpu_target,
750 .win_remap_offset = generic_mbus_win_remap_8_offset,
695 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target, 751 .setup_cpu_target = mvebu_mbus_default_setup_cpu_target,
696 .show_cpu_target = mvebu_sdram_debug_show_orion, 752 .show_cpu_target = mvebu_sdram_debug_show_orion,
697}; 753};
698 754
699static const struct of_device_id of_mvebu_mbus_ids[] = { 755static const struct of_device_id of_mvebu_mbus_ids[] = {
700 { .compatible = "marvell,armada370-mbus", 756 { .compatible = "marvell,armada370-mbus",
701 .data = &armada_370_xp_mbus_data, }, 757 .data = &armada_370_mbus_data, },
758 { .compatible = "marvell,armada375-mbus",
759 .data = &armada_xp_mbus_data, },
760 { .compatible = "marvell,armada380-mbus",
761 .data = &armada_xp_mbus_data, },
702 { .compatible = "marvell,armadaxp-mbus", 762 { .compatible = "marvell,armadaxp-mbus",
703 .data = &armada_370_xp_mbus_data, }, 763 .data = &armada_xp_mbus_data, },
704 { .compatible = "marvell,kirkwood-mbus", 764 { .compatible = "marvell,kirkwood-mbus",
705 .data = &kirkwood_mbus_data, }, 765 .data = &kirkwood_mbus_data, },
706 { .compatible = "marvell,dove-mbus", 766 { .compatible = "marvell,dove-mbus",
@@ -807,15 +867,19 @@ static int mvebu_mbus_suspend(void)
807 for (win = 0; win < s->soc->num_wins; win++) { 867 for (win = 0; win < s->soc->num_wins; win++) {
808 void __iomem *addr = s->mbuswins_base + 868 void __iomem *addr = s->mbuswins_base +
809 s->soc->win_cfg_offset(win); 869 s->soc->win_cfg_offset(win);
870 void __iomem *addr_rmp;
810 871
811 s->wins[win].base = readl(addr + WIN_BASE_OFF); 872 s->wins[win].base = readl(addr + WIN_BASE_OFF);
812 s->wins[win].ctrl = readl(addr + WIN_CTRL_OFF); 873 s->wins[win].ctrl = readl(addr + WIN_CTRL_OFF);
813 874
814 if (win >= s->soc->num_remappable_wins) 875 if (!mvebu_mbus_window_is_remappable(s, win))
815 continue; 876 continue;
816 877
817 s->wins[win].remap_lo = readl(addr + WIN_REMAP_LO_OFF); 878 addr_rmp = s->mbuswins_base +
818 s->wins[win].remap_hi = readl(addr + WIN_REMAP_HI_OFF); 879 s->soc->win_remap_offset(win);
880
881 s->wins[win].remap_lo = readl(addr_rmp + WIN_REMAP_LO_OFF);
882 s->wins[win].remap_hi = readl(addr_rmp + WIN_REMAP_HI_OFF);
819 } 883 }
820 884
821 s->mbus_bridge_ctrl = readl(s->mbusbridge_base + 885 s->mbus_bridge_ctrl = readl(s->mbusbridge_base +
@@ -839,15 +903,19 @@ static void mvebu_mbus_resume(void)
839 for (win = 0; win < s->soc->num_wins; win++) { 903 for (win = 0; win < s->soc->num_wins; win++) {
840 void __iomem *addr = s->mbuswins_base + 904 void __iomem *addr = s->mbuswins_base +
841 s->soc->win_cfg_offset(win); 905 s->soc->win_cfg_offset(win);
906 void __iomem *addr_rmp;
842 907
843 writel(s->wins[win].base, addr + WIN_BASE_OFF); 908 writel(s->wins[win].base, addr + WIN_BASE_OFF);
844 writel(s->wins[win].ctrl, addr + WIN_CTRL_OFF); 909 writel(s->wins[win].ctrl, addr + WIN_CTRL_OFF);
845 910
846 if (win >= s->soc->num_remappable_wins) 911 if (!mvebu_mbus_window_is_remappable(s, win))
847 continue; 912 continue;
848 913
849 writel(s->wins[win].remap_lo, addr + WIN_REMAP_LO_OFF); 914 addr_rmp = s->mbuswins_base +
850 writel(s->wins[win].remap_hi, addr + WIN_REMAP_HI_OFF); 915 s->soc->win_remap_offset(win);
916
917 writel(s->wins[win].remap_lo, addr_rmp + WIN_REMAP_LO_OFF);
918 writel(s->wins[win].remap_hi, addr_rmp + WIN_REMAP_HI_OFF);
851 } 919 }
852} 920}
853 921