Skip to contentSkip to conversation

tricore: added triboard with tc27x_soc

PATCH Superseded David Brenken 2 participants 3 messages Jun 22, 2020 – Jun 24, 2020

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover tricore: added triboard with tc27x_soc

From: Andreas Konopik <[email protected]>

Hello everyone,

this patch adds the AURIX TC277 D-Step TriBoard as QEMU machine (-M AURIX_TriBoard_TC277D). Memory maps are implemented according to the "AURIX TC27x D-Step User's Manual V2.2 2014-12". AURIX memory layouts are specified by the processor, that is why this patch has been reworked as a SoC-implementation for v2. Patch v3 added sizes to memory mappings.

Andreas Konopik (1):
tricore: added triboard with tc27x_soc

 hw/tricore/Kconfig             |   8 ++
 hw/tricore/Makefile.objs       |   2 +
 hw/tricore/tc27x_soc.c         | 246 +++++++++++++++++++++++++++++++++
 hw/tricore/triboard.c          | 102 ++++++++++++++
 include/hw/tricore/tc27x_soc.h | 139 +++++++++++++++++++
 include/hw/tricore/triboard.h  |  53 +++++++
 6 files changed, 550 insertions(+)
 create mode 100644 hw/tricore/tc27x_soc.c
 create mode 100644 hw/tricore/triboard.c
 create mode 100644 include/hw/tricore/tc27x_soc.h
 create mode 100644 include/hw/tricore/triboard.h
Signature · 1 line
2.27.0
#1 lore raw

PATCH v3 1/1 tricore: added triboard with tc27x_soc

From: Andreas Konopik <[email protected]>

---
 hw/tricore/Kconfig             |   8 ++
 hw/tricore/Makefile.objs       |   2 +
 hw/tricore/tc27x_soc.c         | 246 +++++++++++++++++++++++++++++++++
 hw/tricore/triboard.c          | 102 ++++++++++++++
 include/hw/tricore/tc27x_soc.h | 139 +++++++++++++++++++
 include/hw/tricore/triboard.h  |  53 +++++++
 6 files changed, 550 insertions(+)
 create mode 100644 hw/tricore/tc27x_soc.c
 create mode 100644 hw/tricore/triboard.c
 create mode 100644 include/hw/tricore/tc27x_soc.h
 create mode 100644 include/hw/tricore/triboard.h
hw/tricore/Kconfig +8 -0
index 9313409309..44d3e906a1 100644
@@ -1,2 +1,10 @@
 config TRICORE
     bool
+    select TRIBOARD
+
+config TRIBOARD
+    bool
+    select TC27X_SOC
+
+config TC27X_SOC
+    bool
hw/tricore/Makefile.objs +2 -0
index 5501f6c1a8..91bcef4402 100644
@@ -1 +1,3 @@
 obj-$(CONFIG_TRICORE) += tricore_testboard.o
+obj-$(CONFIG_TRIBOARD) += triboard.o
+obj-$(CONFIG_TC27X_SOC) += tc27x_soc.o
hw/tricore/tc27x_soc.c new file +246 -0

246 lines not on this page · raw message

hw/tricore/triboard.c new file +102 -0

102 lines not on this page · raw message

include/hw/tricore/tc27x_soc.h new file +139 -0

139 lines not on this page · raw message

include/hw/tricore/triboard.h new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw

Review

Quoted 5 lines · David Brenken

From: Andreas Konopik <[email protected]>

(quoted diff) +4 -0
+const MemmapEntry tc27x_soc_memmap[] = {
+    [TC27XD_DSPR2]     = { 0x50000000,   0x1E000 },
+    [TC27XD_DCACHE2]   = { 0x5001E000,    0x2000 },
+    [TC27XD_DTAG2]     = { 0x500C0000,     0xC00 },

The size changed from 0xa00 to 0xc00 from v2. The manual states that it has no size. I guess you inferred the size from the address range. How does real hw behave if you access DTAG2?

Quoted 20 lines
(quoted diff) +20 -0
+    [TC27XD_PSPR2]     = { 0x50100000,    0x8000 },
+    [TC27XD_PCACHE2]   = { 0x50108000,    0x4000 },
+    [TC27XD_PTAG2]     = { 0x501C0000,    0x1800 },
+    [TC27XD_DSPR1]     = { 0x60000000,   0x1E000 },
+    [TC27XD_DCACHE1]   = { 0x6001E000,    0x2000 },
+    [TC27XD_DTAG1]     = { 0x600C0000,     0xC00 },
+    [TC27XD_PSPR1]     = { 0x60100000,    0x8000 },
+    [TC27XD_PCACHE1]   = { 0x60108000,    0x4000 },
+    [TC27XD_PTAG1]     = { 0x601C0000,    0x1800 },
+    [TC27XD_DSPR0]     = { 0x70000000,   0x1C000 },
+    [TC27XD_PSPR0]     = { 0x70100000,    0x6000 },
+    [TC27XD_PCACHE0]   = { 0x70106000,    0x2000 },
+    [TC27XD_PTAG0]     = { 0x701C0000,     0xC00 },
+    [TC27XD_PFLASH0_C] = { 0x80000000,  0x200000 },
+    [TC27XD_PFLASH1_C] = { 0x80200000,  0x200000 },
+    [TC27XD_OLDA_C]    = { 0x8FE70000,    0x8000 },
+    [TC27XD_BROM_C]    = { 0x8FFF8000,    0x8000 },
+    [TC27XD_LMURAM_C]  = { 0x90000000,    0x8000 },
+    [TC27XD_EMEM_C]    = { 0x9F000000,  0x100000 },
+    [TC27XD_PFLASH0_U] = { 0xA0000000,       0x0 },

Review

Quoted 10 lines
(quoted diff) +10 -0
+    [TC27XD_PFLASH1_U] = { 0xA0200000,       0x0 },
+    [TC27XD_DFLASH0]   = { 0xAF000000,  0x104000 },
+    [TC27XD_DFLASH1]   = { 0xAF110000,   0x10000 },
+    [TC27XD_OLDA_U]    = { 0xAFE70000,       0x0 },
+    [TC27XD_BROM_U]    = { 0xAFFF8000,       0x0 },
+    [TC27XD_LMURAM_U]  = { 0xB0000000,       0x0 },
+    [TC27XD_EMEM_U]    = { 0xBF000000,       0x0 },
+    [TC27XD_PSPRX]     = { 0xC0000000,       0x0 },
+    [TC27XD_DSPRX]     = { 0xD0000000,       0x0 },
+};

Why not use KiB/MiB sizes as before? I created a patch for that. Can you check that I didn't skrew up the sizes?

hw/tricore/tc27x_soc.c +33 -32
@@ -26,44 +26,45 @@
 #include "hw/misc/unimp.h"
 #include "exec/address-spaces.h"
 #include "qemu/log.h"
+#include "qemu/units.h"
 #include "cpu.h"
 
 #include "hw/tricore/tc27x_soc.h"
 #include "hw/tricore/triboard.h"
 
 const MemmapEntry tc27x_soc_memmap[] = {
-    [TC27XD_DSPR2]     = { 0x50000000,   0x1E000 },
-    [TC27XD_DCACHE2]   = { 0x5001E000,    0x2000 },
-    [TC27XD_DTAG2]     = { 0x500C0000,     0xC00 },
-    [TC27XD_PSPR2]     = { 0x50100000,    0x8000 },
-    [TC27XD_PCACHE2]   = { 0x50108000,    0x4000 },
-    [TC27XD_PTAG2]     = { 0x501C0000,    0x1800 },
-    [TC27XD_DSPR1]     = { 0x60000000,   0x1E000 },
-    [TC27XD_DCACHE1]   = { 0x6001E000,    0x2000 },
-    [TC27XD_DTAG1]     = { 0x600C0000,     0xC00 },
-    [TC27XD_PSPR1]     = { 0x60100000,    0x8000 },
-    [TC27XD_PCACHE1]   = { 0x60108000,    0x4000 },
-    [TC27XD_PTAG1]     = { 0x601C0000,    0x1800 },
-    [TC27XD_DSPR0]     = { 0x70000000,   0x1C000 },
-    [TC27XD_PSPR0]     = { 0x70100000,    0x6000 },
-    [TC27XD_PCACHE0]   = { 0x70106000,    0x2000 },
-    [TC27XD_PTAG0]     = { 0x701C0000,     0xC00 },
-    [TC27XD_PFLASH0_C] = { 0x80000000,  0x200000 },
-    [TC27XD_PFLASH1_C] = { 0x80200000,  0x200000 },
-    [TC27XD_OLDA_C]    = { 0x8FE70000,    0x8000 },
-    [TC27XD_BROM_C]    = { 0x8FFF8000,    0x8000 },
-    [TC27XD_LMURAM_C]  = { 0x90000000,    0x8000 },
-    [TC27XD_EMEM_C]    = { 0x9F000000,  0x100000 },
-    [TC27XD_PFLASH0_U] = { 0xA0000000,       0x0 },
-    [TC27XD_PFLASH1_U] = { 0xA0200000,       0x0 },
-    [TC27XD_DFLASH0]   = { 0xAF000000,  0x104000 },
-    [TC27XD_DFLASH1]   = { 0xAF110000,   0x10000 },
-    [TC27XD_OLDA_U]    = { 0xAFE70000,       0x0 },
-    [TC27XD_BROM_U]    = { 0xAFFF8000,       0x0 },
-    [TC27XD_LMURAM_U]  = { 0xB0000000,       0x0 },
-    [TC27XD_EMEM_U]    = { 0xBF000000,       0x0 },
-    [TC27XD_PSPRX]     = { 0xC0000000,       0x0 },
-    [TC27XD_DSPRX]     = { 0xD0000000,       0x0 },
+    [TC27XD_DSPR2]     = { 0x50000000,            120 * KiB },
+    [TC27XD_DCACHE2]   = { 0x5001E000,              8 * KiB },
+    [TC27XD_DTAG2]     = { 0x500C0000,                0xC00 },
+    [TC27XD_PSPR2]     = { 0x50100000,             32 * KiB },
+    [TC27XD_PCACHE2]   = { 0x50108000,             16 * KiB },
+    [TC27XD_PTAG2]     = { 0x501C0000,               0x1800 },
+    [TC27XD_DSPR1]     = { 0x60000000,            120 * KiB },
+    [TC27XD_DCACHE1]   = { 0x6001E000,              8 * KiB },
+    [TC27XD_DTAG1]     = { 0x600C0000,                0xC00 },
+    [TC27XD_PSPR1]     = { 0x60100000,             32 * KiB },
+    [TC27XD_PCACHE1]   = { 0x60108000,             16 * KiB },
+    [TC27XD_PTAG1]     = { 0x601C0000,               0x1800 },
+    [TC27XD_DSPR0]     = { 0x70000000,            112 * KiB },
+    [TC27XD_PSPR0]     = { 0x70100000,             24 * KiB },
+    [TC27XD_PCACHE0]   = { 0x70106000,              8 * KiB },
+    [TC27XD_PTAG0]     = { 0x701C0000,                0xC00 },
+    [TC27XD_PFLASH0_C] = { 0x80000000,              2 * MiB },
+    [TC27XD_PFLASH1_C] = { 0x80200000,              2 * MiB },
+    [TC27XD_OLDA_C]    = { 0x8FE70000,             32 * KiB },
+    [TC27XD_BROM_C]    = { 0x8FFF8000,             32 * KiB },
+    [TC27XD_LMURAM_C]  = { 0x90000000,             32 * KiB },
+    [TC27XD_EMEM_C]    = { 0x9F000000,              1 * MiB },
+    [TC27XD_PFLASH0_U] = { 0xA0000000,                  0x0 },
+    [TC27XD_PFLASH1_U] = { 0xA0200000,                  0x0 },
+    [TC27XD_DFLASH0]   = { 0xAF000000,   1 * MiB + 16 * KiB },
+    [TC27XD_DFLASH1]   = { 0xAF110000,             64 * KiB },
+    [TC27XD_OLDA_U]    = { 0xAFE70000,                  0x0 },
+    [TC27XD_BROM_U]    = { 0xAFFF8000,                  0x0 },
+    [TC27XD_LMURAM_U]  = { 0xB0000000,                  0x0 },
+    [TC27XD_EMEM_U]    = { 0xBF000000,                  0x0 },
+    [TC27XD_PSPRX]     = { 0xC0000000,                  0x0 },
+    [TC27XD_DSPRX]     = { 0xD0000000,                  0x0 },
 

The remainder looks good to me.

Cheers,
Bastian