aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2015-06-01 11:34:25 -0400
committerArnd Bergmann <arnd@arndb.de>2015-06-01 11:34:57 -0400
commit72275b4c08e7536ed5fe21c8899d99fc9f1fce7b (patch)
treea88352a67ee7aaac2bba4ae7ba3075638337af3f
parent9ff3d178ab9e926b3194b266b4a28dc63226552d (diff)
parentbfa1ce5f38938cc9e6c7f2d1011f88eba2b9e2b2 (diff)
Merge tag 'mvebu-drivers-4.2' of git://git.infradead.org/linux-mvebu into next/drivers
Merge "mvebu drivers change for 4.2" from Gregory CLEMENT: mvebu-mbus: add mv_mbus_dram_info_nooverlap() needed for the new Marvell crypto driver * tag 'mvebu-drivers-4.2' of git://git.infradead.org/linux-mvebu: bus: mvebu-mbus: add mv_mbus_dram_info_nooverlap() Based on the earlier bug fixes branch, which contains six other patches already merged into 4.1.
-rw-r--r--MAINTAINERS10
-rw-r--r--arch/arm/boot/dts/armada-375.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-38x.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-39x.dtsi2
-rw-r--r--arch/arm/boot/dts/armada-xp-linksys-mamba.dts5
-rw-r--r--arch/arm/boot/dts/dove-cubox.dts1
-rw-r--r--drivers/bus/mvebu-mbus.c120
-rw-r--r--include/linux/mbus.h5
8 files changed, 106 insertions, 41 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 590304b96b03..89e02439db89 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1193,7 +1193,7 @@ ARM/MAGICIAN MACHINE SUPPORT
1193M: Philipp Zabel <philipp.zabel@gmail.com> 1193M: Philipp Zabel <philipp.zabel@gmail.com>
1194S: Maintained 1194S: Maintained
1195 1195
1196ARM/Marvell Armada 370 and Armada XP SOC support 1196ARM/Marvell Kirkwood and Armada 370, 375, 38x, XP SOC support
1197M: Jason Cooper <jason@lakedaemon.net> 1197M: Jason Cooper <jason@lakedaemon.net>
1198M: Andrew Lunn <andrew@lunn.ch> 1198M: Andrew Lunn <andrew@lunn.ch>
1199M: Gregory Clement <gregory.clement@free-electrons.com> 1199M: Gregory Clement <gregory.clement@free-electrons.com>
@@ -1202,12 +1202,17 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1202S: Maintained 1202S: Maintained
1203F: arch/arm/mach-mvebu/ 1203F: arch/arm/mach-mvebu/
1204F: drivers/rtc/rtc-armada38x.c 1204F: drivers/rtc/rtc-armada38x.c
1205F: arch/arm/boot/dts/armada*
1206F: arch/arm/boot/dts/kirkwood*
1207
1205 1208
1206ARM/Marvell Berlin SoC support 1209ARM/Marvell Berlin SoC support
1207M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> 1210M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
1208L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1211L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1209S: Maintained 1212S: Maintained
1210F: arch/arm/mach-berlin/ 1213F: arch/arm/mach-berlin/
1214F: arch/arm/boot/dts/berlin*
1215
1211 1216
1212ARM/Marvell Dove/MV78xx0/Orion SOC support 1217ARM/Marvell Dove/MV78xx0/Orion SOC support
1213M: Jason Cooper <jason@lakedaemon.net> 1218M: Jason Cooper <jason@lakedaemon.net>
@@ -1220,6 +1225,9 @@ F: arch/arm/mach-dove/
1220F: arch/arm/mach-mv78xx0/ 1225F: arch/arm/mach-mv78xx0/
1221F: arch/arm/mach-orion5x/ 1226F: arch/arm/mach-orion5x/
1222F: arch/arm/plat-orion/ 1227F: arch/arm/plat-orion/
1228F: arch/arm/boot/dts/dove*
1229F: arch/arm/boot/dts/orion5x*
1230
1223 1231
1224ARM/Orion SoC/Technologic Systems TS-78xx platform support 1232ARM/Orion SoC/Technologic Systems TS-78xx platform support
1225M: Alexander Clouter <alex@digriz.org.uk> 1233M: Alexander Clouter <alex@digriz.org.uk>
diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index c675257f2377..f076ff856d8b 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -69,7 +69,7 @@
69 mainpll: mainpll { 69 mainpll: mainpll {
70 compatible = "fixed-clock"; 70 compatible = "fixed-clock";
71 #clock-cells = <0>; 71 #clock-cells = <0>;
72 clock-frequency = <2000000000>; 72 clock-frequency = <1000000000>;
73 }; 73 };
74 /* 25 MHz reference crystal */ 74 /* 25 MHz reference crystal */
75 refclk: oscillator { 75 refclk: oscillator {
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index ed2dd8ba4080..218a2acd36e5 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -585,7 +585,7 @@
585 mainpll: mainpll { 585 mainpll: mainpll {
586 compatible = "fixed-clock"; 586 compatible = "fixed-clock";
587 #clock-cells = <0>; 587 #clock-cells = <0>;
588 clock-frequency = <2000000000>; 588 clock-frequency = <1000000000>;
589 }; 589 };
590 590
591 /* 25 MHz reference crystal */ 591 /* 25 MHz reference crystal */
diff --git a/arch/arm/boot/dts/armada-39x.dtsi b/arch/arm/boot/dts/armada-39x.dtsi
index 0e85fc15ceda..ecd1318109ba 100644
--- a/arch/arm/boot/dts/armada-39x.dtsi
+++ b/arch/arm/boot/dts/armada-39x.dtsi
@@ -502,7 +502,7 @@
502 mainpll: mainpll { 502 mainpll: mainpll {
503 compatible = "fixed-clock"; 503 compatible = "fixed-clock";
504 #clock-cells = <0>; 504 #clock-cells = <0>;
505 clock-frequency = <2000000000>; 505 clock-frequency = <1000000000>;
506 }; 506 };
507 }; 507 };
508}; 508};
diff --git a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
index a2cf2154dcdb..fdd187c55aa5 100644
--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
@@ -95,6 +95,11 @@
95 95
96 internal-regs { 96 internal-regs {
97 97
98 rtc@10300 {
99 /* No crystal connected to the internal RTC */
100 status = "disabled";
101 };
102
98 /* J10: VCC, NC, RX, NC, TX, GND */ 103 /* J10: VCC, NC, RX, NC, TX, GND */
99 serial@12000 { 104 serial@12000 {
100 status = "okay"; 105 status = "okay";
diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
index aae7efc09b0b..e6fa251e17b9 100644
--- a/arch/arm/boot/dts/dove-cubox.dts
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -87,6 +87,7 @@
87 87
88 /* connect xtal input to 25MHz reference */ 88 /* connect xtal input to 25MHz reference */
89 clocks = <&ref25>; 89 clocks = <&ref25>;
90 clock-names = "xtal";
90 91
91 /* connect xtal input as source of pll0 and pll1 */ 92 /* connect xtal input as source of pll0 and pll1 */
92 silabs,pll-source = <0 0>, <1 0>; 93 silabs,pll-source = <0 0>, <1 0>;
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index fb9ec6221730..c43c3d2baf73 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -57,8 +57,8 @@
57#include <linux/of_address.h> 57#include <linux/of_address.h>
58#include <linux/debugfs.h> 58#include <linux/debugfs.h>
59#include <linux/log2.h> 59#include <linux/log2.h>
60#include <linux/syscore_ops.h>
61#include <linux/memblock.h> 60#include <linux/memblock.h>
61#include <linux/syscore_ops.h>
62 62
63/* 63/*
64 * DDR target is the same on all platforms. 64 * DDR target is the same on all platforms.
@@ -70,6 +70,7 @@
70 */ 70 */
71#define WIN_CTRL_OFF 0x0000 71#define WIN_CTRL_OFF 0x0000
72#define WIN_CTRL_ENABLE BIT(0) 72#define WIN_CTRL_ENABLE BIT(0)
73/* Only on HW I/O coherency capable platforms */
73#define WIN_CTRL_SYNCBARRIER BIT(1) 74#define WIN_CTRL_SYNCBARRIER BIT(1)
74#define WIN_CTRL_TGT_MASK 0xf0 75#define WIN_CTRL_TGT_MASK 0xf0
75#define WIN_CTRL_TGT_SHIFT 4 76#define WIN_CTRL_TGT_SHIFT 4
@@ -102,9 +103,7 @@
102 103
103/* Relative to mbusbridge_base */ 104/* Relative to mbusbridge_base */
104#define MBUS_BRIDGE_CTRL_OFF 0x0 105#define MBUS_BRIDGE_CTRL_OFF 0x0
105#define MBUS_BRIDGE_SIZE_MASK 0xffff0000
106#define MBUS_BRIDGE_BASE_OFF 0x4 106#define MBUS_BRIDGE_BASE_OFF 0x4
107#define MBUS_BRIDGE_BASE_MASK 0xffff0000
108 107
109/* Maximum number of windows, for all known platforms */ 108/* Maximum number of windows, for all known platforms */
110#define MBUS_WINS_MAX 20 109#define MBUS_WINS_MAX 20
@@ -154,13 +153,39 @@ struct mvebu_mbus_state {
154 153
155static struct mvebu_mbus_state mbus_state; 154static struct mvebu_mbus_state mbus_state;
156 155
156/*
157 * We provide two variants of the mv_mbus_dram_info() function:
158 *
159 * - The normal one, where the described DRAM ranges may overlap with
160 * the I/O windows, but for which the DRAM ranges are guaranteed to
161 * have a power of two size. Such ranges are suitable for the DMA
162 * masters that only DMA between the RAM and the device, which is
163 * actually all devices except the crypto engines.
164 *
165 * - The 'nooverlap' one, where the described DRAM ranges are
166 * guaranteed to not overlap with the I/O windows, but for which the
167 * DRAM ranges will not have power of two sizes. They will only be
168 * aligned on a 64 KB boundary, and have a size multiple of 64
169 * KB. Such ranges are suitable for the DMA masters that DMA between
170 * the crypto SRAM (which is mapped through an I/O window) and a
171 * device. This is the case for the crypto engines.
172 */
173
157static struct mbus_dram_target_info mvebu_mbus_dram_info; 174static struct mbus_dram_target_info mvebu_mbus_dram_info;
175static struct mbus_dram_target_info mvebu_mbus_dram_info_nooverlap;
176
158const struct mbus_dram_target_info *mv_mbus_dram_info(void) 177const struct mbus_dram_target_info *mv_mbus_dram_info(void)
159{ 178{
160 return &mvebu_mbus_dram_info; 179 return &mvebu_mbus_dram_info;
161} 180}
162EXPORT_SYMBOL_GPL(mv_mbus_dram_info); 181EXPORT_SYMBOL_GPL(mv_mbus_dram_info);
163 182
183const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void)
184{
185 return &mvebu_mbus_dram_info_nooverlap;
186}
187EXPORT_SYMBOL_GPL(mv_mbus_dram_info_nooverlap);
188
164/* Checks whether the given window has remap capability */ 189/* Checks whether the given window has remap capability */
165static bool mvebu_mbus_window_is_remappable(struct mvebu_mbus_state *mbus, 190static bool mvebu_mbus_window_is_remappable(struct mvebu_mbus_state *mbus,
166 const int win) 191 const int win)
@@ -323,8 +348,9 @@ static int mvebu_mbus_setup_window(struct mvebu_mbus_state *mbus,
323 ctrl = ((size - 1) & WIN_CTRL_SIZE_MASK) | 348 ctrl = ((size - 1) & WIN_CTRL_SIZE_MASK) |
324 (attr << WIN_CTRL_ATTR_SHIFT) | 349 (attr << WIN_CTRL_ATTR_SHIFT) |
325 (target << WIN_CTRL_TGT_SHIFT) | 350 (target << WIN_CTRL_TGT_SHIFT) |
326 WIN_CTRL_SYNCBARRIER |
327 WIN_CTRL_ENABLE; 351 WIN_CTRL_ENABLE;
352 if (mbus->hw_io_coherency)
353 ctrl |= WIN_CTRL_SYNCBARRIER;
328 354
329 writel(base & WIN_BASE_LOW, addr + WIN_BASE_OFF); 355 writel(base & WIN_BASE_LOW, addr + WIN_BASE_OFF);
330 writel(ctrl, addr + WIN_CTRL_OFF); 356 writel(ctrl, addr + WIN_CTRL_OFF);
@@ -592,7 +618,7 @@ mvebu_mbus_find_bridge_hole(uint64_t *start, uint64_t *end)
592 * This part of the memory is above 4 GB, so we don't 618 * This part of the memory is above 4 GB, so we don't
593 * care for the MBus bridge hole. 619 * care for the MBus bridge hole.
594 */ 620 */
595 if (r->base >= 0x100000000) 621 if (r->base >= 0x100000000ULL)
596 continue; 622 continue;
597 623
598 /* 624 /*
@@ -604,50 +630,33 @@ mvebu_mbus_find_bridge_hole(uint64_t *start, uint64_t *end)
604 } 630 }
605 631
606 *start = s; 632 *start = s;
607 *end = 0x100000000; 633 *end = 0x100000000ULL;
608} 634}
609 635
636/*
637 * This function fills in the mvebu_mbus_dram_info_nooverlap data
638 * structure, by looking at the mvebu_mbus_dram_info data, and
639 * removing the parts of it that overlap with I/O windows.
640 */
610static void __init 641static void __init
611mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus) 642mvebu_mbus_setup_cpu_target_nooverlap(struct mvebu_mbus_state *mbus)
612{ 643{
613 int i;
614 int cs;
615 uint64_t mbus_bridge_base, mbus_bridge_end; 644 uint64_t mbus_bridge_base, mbus_bridge_end;
616 645 int cs_nooverlap = 0;
617 mvebu_mbus_dram_info.mbus_dram_target_id = TARGET_DDR; 646 int i;
618 647
619 mvebu_mbus_find_bridge_hole(&mbus_bridge_base, &mbus_bridge_end); 648 mvebu_mbus_find_bridge_hole(&mbus_bridge_base, &mbus_bridge_end);
620 649
621 for (i = 0, cs = 0; i < 4; i++) { 650 for (i = 0; i < mvebu_mbus_dram_info.num_cs; i++) {
622 u64 base = readl(mbus->sdramwins_base + DDR_BASE_CS_OFF(i));
623 u64 size = readl(mbus->sdramwins_base + DDR_SIZE_CS_OFF(i));
624 u64 end;
625 struct mbus_dram_window *w; 651 struct mbus_dram_window *w;
652 u64 base, size, end;
626 653
627 /* Ignore entries that are not enabled */ 654 w = &mvebu_mbus_dram_info.cs[i];
628 if (!(size & DDR_SIZE_ENABLED)) 655 base = w->base;
629 continue; 656 size = w->size;
630
631 /*
632 * Ignore entries whose base address is above 2^32,
633 * since devices cannot DMA to such high addresses
634 */
635 if (base & DDR_BASE_CS_HIGH_MASK)
636 continue;
637
638 base = base & DDR_BASE_CS_LOW_MASK;
639 size = (size | ~DDR_SIZE_MASK) + 1;
640 end = base + size; 657 end = base + size;
641 658
642 /* 659 /*
643 * Adjust base/size of the current CS to make sure it
644 * doesn't overlap with the MBus bridge hole. This is
645 * particularly important for devices that do DMA from
646 * DRAM to a SRAM mapped in a MBus window, such as the
647 * CESA cryptographic engine.
648 */
649
650 /*
651 * The CS is fully enclosed inside the MBus bridge 660 * The CS is fully enclosed inside the MBus bridge
652 * area, so ignore it. 661 * area, so ignore it.
653 */ 662 */
@@ -670,7 +679,7 @@ mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus)
670 if (base < mbus_bridge_base && end > mbus_bridge_base) 679 if (base < mbus_bridge_base && end > mbus_bridge_base)
671 size -= end - mbus_bridge_base; 680 size -= end - mbus_bridge_base;
672 681
673 w = &mvebu_mbus_dram_info.cs[cs++]; 682 w = &mvebu_mbus_dram_info_nooverlap.cs[cs_nooverlap++];
674 w->cs_index = i; 683 w->cs_index = i;
675 w->mbus_attr = 0xf & ~(1 << i); 684 w->mbus_attr = 0xf & ~(1 << i);
676 if (mbus->hw_io_coherency) 685 if (mbus->hw_io_coherency)
@@ -678,6 +687,42 @@ mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus)
678 w->base = base; 687 w->base = base;
679 w->size = size; 688 w->size = size;
680 } 689 }
690
691 mvebu_mbus_dram_info_nooverlap.mbus_dram_target_id = TARGET_DDR;
692 mvebu_mbus_dram_info_nooverlap.num_cs = cs_nooverlap;
693}
694
695static void __init
696mvebu_mbus_default_setup_cpu_target(struct mvebu_mbus_state *mbus)
697{
698 int i;
699 int cs;
700
701 mvebu_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
702
703 for (i = 0, cs = 0; i < 4; i++) {
704 u32 base = readl(mbus->sdramwins_base + DDR_BASE_CS_OFF(i));
705 u32 size = readl(mbus->sdramwins_base + DDR_SIZE_CS_OFF(i));
706
707 /*
708 * We only take care of entries for which the chip
709 * select is enabled, and that don't have high base
710 * address bits set (devices can only access the first
711 * 32 bits of the memory).
712 */
713 if ((size & DDR_SIZE_ENABLED) &&
714 !(base & DDR_BASE_CS_HIGH_MASK)) {
715 struct mbus_dram_window *w;
716
717 w = &mvebu_mbus_dram_info.cs[cs++];
718 w->cs_index = i;
719 w->mbus_attr = 0xf & ~(1 << i);
720 if (mbus->hw_io_coherency)
721 w->mbus_attr |= ATTR_HW_COHERENCY;
722 w->base = base & DDR_BASE_CS_LOW_MASK;
723 w->size = (size | ~DDR_SIZE_MASK) + 1;
724 }
725 }
681 mvebu_mbus_dram_info.num_cs = cs; 726 mvebu_mbus_dram_info.num_cs = cs;
682} 727}
683 728
@@ -1035,6 +1080,7 @@ static int __init mvebu_mbus_common_init(struct mvebu_mbus_state *mbus,
1035 mvebu_mbus_disable_window(mbus, win); 1080 mvebu_mbus_disable_window(mbus, win);
1036 1081
1037 mbus->soc->setup_cpu_target(mbus); 1082 mbus->soc->setup_cpu_target(mbus);
1083 mvebu_mbus_setup_cpu_target_nooverlap(mbus);
1038 1084
1039 if (is_coherent) 1085 if (is_coherent)
1040 writel(UNIT_SYNC_BARRIER_ALL, 1086 writel(UNIT_SYNC_BARRIER_ALL,
diff --git a/include/linux/mbus.h b/include/linux/mbus.h
index 611b69fa8594..1f7bc630d225 100644
--- a/include/linux/mbus.h
+++ b/include/linux/mbus.h
@@ -54,11 +54,16 @@ struct mbus_dram_target_info
54 */ 54 */
55#ifdef CONFIG_PLAT_ORION 55#ifdef CONFIG_PLAT_ORION
56extern const struct mbus_dram_target_info *mv_mbus_dram_info(void); 56extern const struct mbus_dram_target_info *mv_mbus_dram_info(void);
57extern const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void);
57#else 58#else
58static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void) 59static inline const struct mbus_dram_target_info *mv_mbus_dram_info(void)
59{ 60{
60 return NULL; 61 return NULL;
61} 62}
63static inline const struct mbus_dram_target_info *mv_mbus_dram_info_nooverlap(void)
64{
65 return NULL;
66}
62#endif 67#endif
63 68
64int mvebu_mbus_save_cpu_target(u32 *store_addr); 69int mvebu_mbus_save_cpu_target(u32 *store_addr);