summaryrefslogtreecommitdiffstats
path: root/sys/arm/mv/discovery/discovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arm/mv/discovery/discovery.c')
-rw-r--r--sys/arm/mv/discovery/discovery.c82
1 files changed, 75 insertions, 7 deletions
diff --git a/sys/arm/mv/discovery/discovery.c b/sys/arm/mv/discovery/discovery.c
index 33f0bf5..c245fa9 100644
--- a/sys/arm/mv/discovery/discovery.c
+++ b/sys/arm/mv/discovery/discovery.c
@@ -41,6 +41,24 @@ __FBSDID("$FreeBSD$");
#include <arm/mv/mvreg.h>
#include <arm/mv/mvvar.h>
+#define _MV_PCIE_MAX_PORT 8
+
+#define _MV_PCIE_IO_SIZE (MV_PCIE_IO_SIZE / _MV_PCIE_MAX_PORT)
+#define _MV_PCIE_MEM_SIZE (MV_PCIE_MEM_SIZE / _MV_PCIE_MAX_PORT)
+
+#define _MV_PCIE_IO(n) (MV_PCIE_IO_BASE + ((n) * _MV_PCIE_IO_SIZE))
+#define _MV_PCIE_MEM(n) (MV_PCIE_MEM_BASE + ((n) * _MV_PCIE_MEM_SIZE))
+
+#define _MV_PCIE_IO_PHYS(n) (MV_PCIE_IO_PHYS_BASE + ((n) * _MV_PCIE_IO_SIZE))
+#define _MV_PCIE_MEM_PHYS(n) (MV_PCIE_MEM_PHYS_BASE + ((n) * _MV_PCIE_MEM_SIZE))
+
+/*
+ * Note the 'pcib' devices are not declared in the obio_devices[]: due to the
+ * much more complex configuration schemes allowed, specifically of the
+ * PCI-Express (multiple lanes width per port configured dynamically etc.) it
+ * is better and flexible to instantiate the number of PCI bridge devices
+ * (known in run-time) in the pcib_mbus_identify() method.
+ */
struct obio_device obio_devices[] = {
{ "ic", MV_IC_BASE, MV_IC_SIZE,
{ -1 },
@@ -104,6 +122,61 @@ struct obio_device obio_devices[] = {
{ NULL, 0, 0, { 0 }, { 0 }, 0 }
};
+const struct obio_pci mv_pci_info[] = {
+ { MV_TYPE_PCIE,
+ MV_PCIE00_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(0), _MV_PCIE_IO_SIZE, 4, 0xE0,
+ _MV_PCIE_MEM(0), _MV_PCIE_MEM_SIZE, 4, 0xE8,
+ NULL, MV_INT_PEX00 },
+
+ { MV_TYPE_PCIE_AGGR_LANE,
+ MV_PCIE01_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(1), _MV_PCIE_IO_SIZE, 4, 0xD0,
+ _MV_PCIE_MEM(1), _MV_PCIE_MEM_SIZE, 4, 0xD8,
+ NULL, MV_INT_PEX01 },
+#if 0
+ /*
+ * XXX Access to devices on this interface (PCIE 0.2) crashes the
+ * system. Could be a silicon defect as Marvell U-Boot has a 'Do not
+ * touch' precaution comment...
+ */
+ { MV_TYPE_PCIE_AGGR_LANE,
+ MV_PCIE02_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(2), _MV_PCIE_IO_SIZE(2), 4, 0xB0,
+ _MV_PCIE_MEM(2), _MV_PCIE_MEM_SIZE(2), 4, 0xB8,
+ NULL, MV_INT_PEX02 },
+#endif
+ { MV_TYPE_PCIE_AGGR_LANE,
+ MV_PCIE03_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(3), _MV_PCIE_IO_SIZE, 4, 0x70,
+ _MV_PCIE_MEM(3), _MV_PCIE_MEM_SIZE, 4, 0x78,
+ NULL, MV_INT_PEX03 },
+
+ { MV_TYPE_PCIE,
+ MV_PCIE10_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(4), _MV_PCIE_IO_SIZE, 8, 0xE0,
+ _MV_PCIE_MEM(4), _MV_PCIE_MEM_SIZE, 8, 0xE8,
+ NULL, MV_INT_PEX10 },
+
+ { MV_TYPE_PCIE_AGGR_LANE,
+ MV_PCIE11_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(5), _MV_PCIE_IO_SIZE, 8, 0xD0,
+ _MV_PCIE_MEM(5), _MV_PCIE_MEM_SIZE, 8, 0xD8,
+ NULL, MV_INT_PEX11 },
+ { MV_TYPE_PCIE_AGGR_LANE,
+ MV_PCIE12_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(6), _MV_PCIE_IO_SIZE, 8, 0xB0,
+ _MV_PCIE_MEM(6), _MV_PCIE_MEM_SIZE, 8, 0xB8,
+ NULL, MV_INT_PEX12 },
+ { MV_TYPE_PCIE_AGGR_LANE,
+ MV_PCIE13_BASE, MV_PCIE_SIZE,
+ _MV_PCIE_IO(7), _MV_PCIE_IO_SIZE, 8, 0x70,
+ _MV_PCIE_MEM(7), _MV_PCIE_MEM_SIZE, 8, 0x78,
+ NULL, MV_INT_PEX13 },
+
+ { 0, 0, 0 }
+};
+
struct resource_spec mv_gpio_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ SYS_RES_IRQ, 0, RF_ACTIVE },
@@ -122,12 +195,6 @@ struct resource_spec mv_xor_spec[] = {
};
const struct decode_win cpu_win_tbl[] = {
- /* PCIE IO */
- { 4, 0x51, MV_PCIE_IO_PHYS_BASE, MV_PCIE_IO_SIZE, -1 },
-
- /* PCIE MEM */
- { 4, 0x59, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, -1 },
-
/* Device bus BOOT */
{ 1, 0x2f, MV_DEV_BOOT_PHYS_BASE, MV_DEV_BOOT_SIZE, -1 },
@@ -154,7 +221,8 @@ int cpu_wins_no = sizeof(cpu_win_tbl) / sizeof(struct decode_win);
*/
const struct decode_win idma_win_tbl[] = {
/* PCIE MEM */
- { 4, 0x59, MV_PCIE_MEM_PHYS_BASE, MV_PCIE_MEM_SIZE, -1 },
+ { 4, 0xE8, _MV_PCIE_MEM_PHYS(0), _MV_PCIE_MEM_SIZE, -1 },
+ { 4, 0xD8, _MV_PCIE_MEM_PHYS(1), _MV_PCIE_MEM_SIZE, -1 },
};
const struct decode_win *idma_wins = idma_win_tbl;
int idma_wins_no = sizeof(idma_win_tbl) / sizeof(struct decode_win);
OpenPOWER on IntegriCloud