-/* $OpenBSD: dwpcie.c,v 1.26 2021/02/28 21:06:58 patrick Exp $ */
+/* $OpenBSD: dwpcie.c,v 1.27 2021/03/01 21:03:24 patrick Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
#define PCIE_AXUSER_DOMAIN_MASK (0x3 << 4)
#define PCIE_AXUSER_DOMAIN_INNER_SHARABLE (0x1 << 4)
#define PCIE_AXUSER_DOMAIN_OUTER_SHARABLE (0x2 << 4)
+#define PCIE_STREAMID 0x8064
+#define PCIE_STREAMID_FUNC_BITS(x) ((x) << 0)
+#define PCIE_STREAMID_DEV_BITS(x) ((x) << 4)
+#define PCIE_STREAMID_BUS_BITS(x) ((x) << 8)
+#define PCIE_STREAMID_ROOTPORT(x) ((x) << 12)
+#define PCIE_STREAMID_8040 \
+ (PCIE_STREAMID_ROOTPORT(0x80) | PCIE_STREAMID_BUS_BITS(2) | \
+ PCIE_STREAMID_DEV_BITS(2) | PCIE_STREAMID_FUNC_BITS(3))
/* Amlogic G12A registers */
#define PCIE_CFG0 0x0000
HWRITE4(sc, PCIE_GLOBAL_CTRL, reg);
}
+ /*
+ * Setup Requester-ID to Stream-ID mapping
+ * XXX: TF-A is supposed to set this up, but doesn't!
+ */
+ HWRITE4(sc, PCIE_STREAMID, PCIE_STREAMID_8040);
+
/* Enable Root Complex mode. */
reg = HREAD4(sc, PCIE_GLOBAL_CTRL);
reg &= ~PCIE_GLOBAL_CTRL_DEVICE_TYPE_MASK;