1 | Changes since v2: | ||
---|---|---|---|
2 | |||
3 | 1. Update doc to include npcm845-evb description | ||
4 | 2. Add g_assert for register size in CLK and GCR enter_reset function | ||
5 | 3. Fix various 8xx SoC and board file issues. | ||
6 | |||
1 | Changes since v1: | 7 | Changes since v1: |
2 | 8 | ||
3 | 1. Updated vbootrom and pc-bios | 9 | 1. Updated vbootrom and pc-bios |
4 | 2. Split out CLK/GCR patches into refactoring and adding new features | 10 | 2. Split out CLK/GCR patches into refactoring and adding new features |
5 | 3. Fixed a few misc items from the patches. | 11 | 3. Fixed a few misc items from the patches. |
... | ... | ||
24 | 30 | ||
25 | The patch set can boot the evaluation board image built from the source | 31 | The patch set can boot the evaluation board image built from the source |
26 | above to login prompt. | 32 | above to login prompt. |
27 | 33 | ||
28 | Hao Wu (17): | 34 | Hao Wu (17): |
29 | docs/system/arm: Add Description for NPCM8XX SoC | ||
30 | roms: Update vbootrom to 1287b6e | 35 | roms: Update vbootrom to 1287b6e |
31 | pc-bios: Add NPCM8XX vBootrom | 36 | pc-bios: Add NPCM8XX vBootrom |
32 | hw/ssi: Make flash size a property in NPCM7XX FIU | 37 | hw/ssi: Make flash size a property in NPCM7XX FIU |
33 | hw/misc: Rename npcm7xx_gcr to npcm_gcr | 38 | hw/misc: Rename npcm7xx_gcr to npcm_gcr |
34 | hw/misc: Move NPCM7XX GCR to NPCM GCR | 39 | hw/misc: Move NPCM7XX GCR to NPCM GCR |
... | ... | ||
41 | hw/misc: Add nr_regs and cold_reset_values to NPCM CLK | 46 | hw/misc: Add nr_regs and cold_reset_values to NPCM CLK |
42 | hw/misc: Support NPCM8XX CLK Module Registers | 47 | hw/misc: Support NPCM8XX CLK Module Registers |
43 | hw/net: Add NPCM8XX PCS Module | 48 | hw/net: Add NPCM8XX PCS Module |
44 | hw/arm: Add NPCM8XX SoC | 49 | hw/arm: Add NPCM8XX SoC |
45 | hw/arm: Add NPCM845 Evaluation board | 50 | hw/arm: Add NPCM845 Evaluation board |
51 | docs/system/arm: Add Description for NPCM8XX SoC | ||
46 | 52 | ||
47 | MAINTAINERS | 1 + | 53 | MAINTAINERS | 1 + |
48 | configs/devices/aarch64-softmmu/default.mak | 1 + | 54 | configs/devices/aarch64-softmmu/default.mak | 1 + |
49 | docs/system/arm/nuvoton.rst | 20 +- | 55 | docs/system/arm/nuvoton.rst | 27 +- |
50 | hw/arm/Kconfig | 11 + | 56 | hw/arm/Kconfig | 13 + |
51 | hw/arm/meson.build | 1 + | 57 | hw/arm/meson.build | 1 + |
52 | hw/arm/npcm7xx.c | 6 + | 58 | hw/arm/npcm7xx.c | 6 + |
53 | hw/arm/npcm8xx.c | 810 ++++++++++++++++++ | 59 | hw/arm/npcm8xx.c | 804 ++++++++++++++++++ |
54 | hw/arm/npcm8xx_boards.c | 256 ++++++ | 60 | hw/arm/npcm8xx_boards.c | 253 ++++++ |
55 | hw/misc/meson.build | 4 +- | 61 | hw/misc/meson.build | 4 +- |
56 | hw/misc/npcm7xx_gcr.c | 264 ------ | 62 | hw/misc/npcm7xx_gcr.c | 264 ------ |
57 | hw/misc/{npcm7xx_clk.c => npcm_clk.c} | 238 +++-- | 63 | hw/misc/{npcm7xx_clk.c => npcm_clk.c} | 240 ++++-- |
58 | hw/misc/npcm_gcr.c | 483 +++++++++++ | 64 | hw/misc/npcm_gcr.c | 485 +++++++++++ |
59 | hw/misc/trace-events | 12 +- | 65 | hw/misc/trace-events | 12 +- |
60 | hw/net/meson.build | 1 + | 66 | hw/net/meson.build | 1 + |
61 | hw/net/npcm_pcs.c | 410 +++++++++ | 67 | hw/net/npcm_pcs.c | 410 +++++++++ |
62 | hw/net/trace-events | 4 +- | 68 | hw/net/trace-events | 4 +- |
63 | hw/ssi/npcm7xx_fiu.c | 11 +- | 69 | hw/ssi/npcm7xx_fiu.c | 11 +- |
... | ... | ||
71 | pc-bios/meson.build | 1 + | 77 | pc-bios/meson.build | 1 + |
72 | pc-bios/npcm7xx_bootrom.bin | Bin 768 -> 768 bytes | 78 | pc-bios/npcm7xx_bootrom.bin | Bin 768 -> 768 bytes |
73 | pc-bios/npcm8xx_bootrom.bin | Bin 0 -> 608 bytes | 79 | pc-bios/npcm8xx_bootrom.bin | Bin 0 -> 608 bytes |
74 | roms/Makefile | 6 + | 80 | roms/Makefile | 6 + |
75 | roms/vbootrom | 2 +- | 81 | roms/vbootrom | 2 +- |
76 | 29 files changed, 2432 insertions(+), 368 deletions(-) | 82 | 29 files changed, 2434 insertions(+), 370 deletions(-) |
77 | create mode 100644 hw/arm/npcm8xx.c | 83 | create mode 100644 hw/arm/npcm8xx.c |
78 | create mode 100644 hw/arm/npcm8xx_boards.c | 84 | create mode 100644 hw/arm/npcm8xx_boards.c |
79 | delete mode 100644 hw/misc/npcm7xx_gcr.c | 85 | delete mode 100644 hw/misc/npcm7xx_gcr.c |
80 | rename hw/misc/{npcm7xx_clk.c => npcm_clk.c} (81%) | 86 | rename hw/misc/{npcm7xx_clk.c => npcm_clk.c} (81%) |
81 | create mode 100644 hw/misc/npcm_gcr.c | 87 | create mode 100644 hw/misc/npcm_gcr.c |
... | ... | ||
85 | rename include/hw/misc/{npcm7xx_gcr.h => npcm_gcr.h} (76%) | 91 | rename include/hw/misc/{npcm7xx_gcr.h => npcm_gcr.h} (76%) |
86 | create mode 100644 include/hw/net/npcm_pcs.h | 92 | create mode 100644 include/hw/net/npcm_pcs.h |
87 | create mode 100644 pc-bios/npcm8xx_bootrom.bin | 93 | create mode 100644 pc-bios/npcm8xx_bootrom.bin |
88 | 94 | ||
89 | -- | 95 | -- |
90 | 2.47.1.613.gc27f4b7a9f-goog | 96 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | This newer vbootrom supports NPCM8xx. Similar to the NPCM7XX one | 1 | This newer vbootrom supports NPCM8xx. Similar to the NPCM7XX one |
---|---|---|---|
2 | it supports loading the UBoot from the SPI device and not more. | 2 | it supports loading the UBoot from the SPI device and not more. |
3 | 3 | ||
4 | We updated the npcm7xx bootrom to be compiled from this version. | 4 | We updated the npcm7xx bootrom to be compiled from this version. |
5 | 5 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 7 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
7 | --- | 8 | --- |
8 | pc-bios/npcm7xx_bootrom.bin | Bin 768 -> 768 bytes | 9 | pc-bios/npcm7xx_bootrom.bin | Bin 768 -> 768 bytes |
9 | roms/vbootrom | 2 +- | 10 | roms/vbootrom | 2 +- |
10 | 2 files changed, 1 insertion(+), 1 deletion(-) | 11 | 2 files changed, 1 insertion(+), 1 deletion(-) |
... | ... | ||
26 | +++ b/roms/vbootrom | 27 | +++ b/roms/vbootrom |
27 | @@ -1 +1 @@ | 28 | @@ -1 +1 @@ |
28 | -Subproject commit 0c37a43527f0ee2b9584e7fb2fdc805e902635ac | 29 | -Subproject commit 0c37a43527f0ee2b9584e7fb2fdc805e902635ac |
29 | +Subproject commit 1287b6e42e839ba2ab0f06268c5b53ae60df3537 | 30 | +Subproject commit 1287b6e42e839ba2ab0f06268c5b53ae60df3537 |
30 | -- | 31 | -- |
31 | 2.47.1.613.gc27f4b7a9f-goog | 32 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | The bootrom is a minimal bootrom used to load an NPCM8XX image. | 1 | The bootrom is a minimal bootrom used to load an NPCM8XX image. |
---|---|---|---|
2 | The source code is located in the same repo as the NPCM7XX one: | 2 | The source code is located in the same repo as the NPCM7XX one: |
3 | github.com/google/vbootrom/tree/master/npcm8xx. | 3 | github.com/google/vbootrom/tree/master/npcm8xx. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
6 | --- | 7 | --- |
7 | MAINTAINERS | 1 + | 8 | MAINTAINERS | 1 + |
8 | pc-bios/README | 8 ++++---- | 9 | pc-bios/README | 8 ++++---- |
9 | pc-bios/meson.build | 1 + | 10 | pc-bios/meson.build | 1 + |
... | ... | ||
101 | + | 102 | + |
102 | hppa-firmware: | 103 | hppa-firmware: |
103 | $(MAKE) -C seabios-hppa parisc | 104 | $(MAKE) -C seabios-hppa parisc |
104 | cp seabios-hppa/out/hppa-firmware.img ../pc-bios/ | 105 | cp seabios-hppa/out/hppa-firmware.img ../pc-bios/ |
105 | -- | 106 | -- |
106 | 2.47.1.613.gc27f4b7a9f-goog | 107 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | This allows different FIUs to have different flash sizes, useful | 1 | This allows different FIUs to have different flash sizes, useful |
---|---|---|---|
2 | in NPCM8XX which has multiple different sized FIU modules. | 2 | in NPCM8XX which has multiple different sized FIU modules. |
3 | 3 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
5 | --- | 6 | --- |
6 | hw/arm/npcm7xx.c | 6 ++++++ | 7 | hw/arm/npcm7xx.c | 6 ++++++ |
7 | hw/ssi/npcm7xx_fiu.c | 11 +++++++---- | 8 | hw/ssi/npcm7xx_fiu.c | 11 +++++++---- |
8 | include/hw/ssi/npcm7xx_fiu.h | 1 + | 9 | include/hw/ssi/npcm7xx_fiu.h | 1 + |
... | ... | ||
97 | + size_t flash_size; | 98 | + size_t flash_size; |
98 | NPCM7xxFIUFlash *flash; | 99 | NPCM7xxFIUFlash *flash; |
99 | 100 | ||
100 | SSIBus *spi; | 101 | SSIBus *spi; |
101 | -- | 102 | -- |
102 | 2.47.1.613.gc27f4b7a9f-goog | 103 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | NPCM7XX and NPCM8XX have a different set of GCRs and the GCR module | 1 | NPCM7XX and NPCM8XX have a different set of GCRs and the GCR module |
---|---|---|---|
2 | needs to fit both. This commit changes the name of the GCR module. | 2 | needs to fit both. This commit changes the name of the GCR module. |
3 | Future commits will add the support for NPCM8XX GCRs. | 3 | Future commits will add the support for NPCM8XX GCRs. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
6 | --- | 7 | --- |
7 | hw/misc/meson.build | 2 +- | 8 | hw/misc/meson.build | 2 +- |
8 | hw/misc/{npcm7xx_gcr.c => npcm_gcr.c} | 2 +- | 9 | hw/misc/{npcm7xx_gcr.c => npcm_gcr.c} | 2 +- |
9 | include/hw/arm/npcm7xx.h | 2 +- | 10 | include/hw/arm/npcm7xx.h | 2 +- |
... | ... | ||
77 | OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxGCRState, NPCM7XX_GCR) | 78 | OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxGCRState, NPCM7XX_GCR) |
78 | 79 | ||
79 | -#endif /* NPCM7XX_GCR_H */ | 80 | -#endif /* NPCM7XX_GCR_H */ |
80 | +#endif /* NPCM_GCR_H */ | 81 | +#endif /* NPCM_GCR_H */ |
81 | -- | 82 | -- |
82 | 2.47.1.613.gc27f4b7a9f-goog | 83 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | A lot of NPCM7XX and NPCM8XX GCR modules share the same code, | 1 | A lot of NPCM7XX and NPCM8XX GCR modules share the same code, |
---|---|---|---|
2 | this commit moves the NPCM7XX GCR to NPCM GCR for these | 2 | this commit moves the NPCM7XX GCR to NPCM GCR for these |
3 | properties. | 3 | properties. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
6 | --- | 7 | --- |
7 | hw/misc/npcm_gcr.c | 92 +++++++++++++++++++++----------------- | 8 | hw/misc/npcm_gcr.c | 92 +++++++++++++++++++++----------------- |
8 | hw/misc/trace-events | 6 +-- | 9 | hw/misc/trace-events | 6 +-- |
9 | include/hw/arm/npcm7xx.h | 2 +- | 10 | include/hw/arm/npcm7xx.h | 2 +- |
... | ... | ||
236 | -OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxGCRState, NPCM7XX_GCR) | 237 | -OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxGCRState, NPCM7XX_GCR) |
237 | +OBJECT_DECLARE_SIMPLE_TYPE(NPCMGCRState, NPCM_GCR) | 238 | +OBJECT_DECLARE_SIMPLE_TYPE(NPCMGCRState, NPCM_GCR) |
238 | 239 | ||
239 | #endif /* NPCM_GCR_H */ | 240 | #endif /* NPCM_GCR_H */ |
240 | -- | 241 | -- |
241 | 2.47.1.613.gc27f4b7a9f-goog | 242 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | These 2 values are different between NPCM7XX and NPCM8XX | 1 | These 2 values are different between NPCM7XX and NPCM8XX |
---|---|---|---|
2 | GCRs. So we add them to the class and assign different values | 2 | GCRs. So we add them to the class and assign different values |
3 | to them. | 3 | to them. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
6 | --- | 7 | --- |
7 | hw/misc/npcm_gcr.c | 24 +++++++++++++++--------- | 8 | hw/misc/npcm_gcr.c | 26 +++++++++++++++++--------- |
8 | include/hw/misc/npcm_gcr.h | 13 +++++++++++-- | 9 | include/hw/misc/npcm_gcr.h | 13 +++++++++++-- |
9 | 2 files changed, 26 insertions(+), 11 deletions(-) | 10 | 2 files changed, 28 insertions(+), 11 deletions(-) |
10 | 11 | ||
11 | diff --git a/hw/misc/npcm_gcr.c b/hw/misc/npcm_gcr.c | 12 | diff --git a/hw/misc/npcm_gcr.c b/hw/misc/npcm_gcr.c |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/misc/npcm_gcr.c | 14 | --- a/hw/misc/npcm_gcr.c |
14 | +++ b/hw/misc/npcm_gcr.c | 15 | +++ b/hw/misc/npcm_gcr.c |
... | ... | ||
54 | + NPCMGCRClass *c = NPCM_GCR_GET_CLASS(obj); | 55 | + NPCMGCRClass *c = NPCM_GCR_GET_CLASS(obj); |
55 | 56 | ||
56 | - QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values)); | 57 | - QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values)); |
57 | - | 58 | - |
58 | - memcpy(s->regs, cold_reset_values, sizeof(s->regs)); | 59 | - memcpy(s->regs, cold_reset_values, sizeof(s->regs)); |
60 | + g_assert(sizeof(s->regs) >= sizeof(c->cold_reset_values)); | ||
61 | + g_assert(sizeof(s->regs) >= c->nr_regs * sizeof(uint32_t)); | ||
59 | + memcpy(s->regs, c->cold_reset_values, c->nr_regs * sizeof(uint32_t)); | 62 | + memcpy(s->regs, c->cold_reset_values, c->nr_regs * sizeof(uint32_t)); |
60 | + /* These 3 registers are at the same location in both 7xx and 8xx. */ | 63 | + /* These 3 registers are at the same location in both 7xx and 8xx. */ |
61 | s->regs[NPCM7XX_GCR_PWRON] = s->reset_pwron; | 64 | s->regs[NPCM7XX_GCR_PWRON] = s->reset_pwron; |
62 | s->regs[NPCM7XX_GCR_MDLR] = s->reset_mdlr; | 65 | s->regs[NPCM7XX_GCR_MDLR] = s->reset_mdlr; |
63 | s->regs[NPCM7XX_GCR_INTCR3] = s->reset_intcr3; | 66 | s->regs[NPCM7XX_GCR_INTCR3] = s->reset_intcr3; |
... | ... | ||
148 | -OBJECT_DECLARE_SIMPLE_TYPE(NPCMGCRState, NPCM_GCR) | 151 | -OBJECT_DECLARE_SIMPLE_TYPE(NPCMGCRState, NPCM_GCR) |
149 | +OBJECT_DECLARE_TYPE(NPCMGCRState, NPCMGCRClass, NPCM_GCR) | 152 | +OBJECT_DECLARE_TYPE(NPCMGCRState, NPCMGCRClass, NPCM_GCR) |
150 | 153 | ||
151 | #endif /* NPCM_GCR_H */ | 154 | #endif /* NPCM_GCR_H */ |
152 | -- | 155 | -- |
153 | 2.47.1.613.gc27f4b7a9f-goog | 156 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
---|---|---|---|
1 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 2 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
2 | --- | 3 | --- |
3 | hw/misc/npcm_gcr.c | 131 ++++++++++++++++++++++++++++++++++++- | 4 | hw/misc/npcm_gcr.c | 131 ++++++++++++++++++++++++++++++++++++- |
4 | include/hw/misc/npcm_gcr.h | 6 +- | 5 | include/hw/misc/npcm_gcr.h | 6 +- |
5 | 2 files changed, 134 insertions(+), 3 deletions(-) | 6 | 2 files changed, 134 insertions(+), 3 deletions(-) |
... | ... | ||
193 | +#define TYPE_NPCM8XX_GCR "npcm8xx-gcr" | 194 | +#define TYPE_NPCM8XX_GCR "npcm8xx-gcr" |
194 | OBJECT_DECLARE_TYPE(NPCMGCRState, NPCMGCRClass, NPCM_GCR) | 195 | OBJECT_DECLARE_TYPE(NPCMGCRState, NPCMGCRClass, NPCM_GCR) |
195 | 196 | ||
196 | #endif /* NPCM_GCR_H */ | 197 | #endif /* NPCM_GCR_H */ |
197 | -- | 198 | -- |
198 | 2.47.1.613.gc27f4b7a9f-goog | 199 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | NPCM8XX boot block stores the DRAM size in SCRPAD_B register in GCR | 1 | NPCM8XX boot block stores the DRAM size in SCRPAD_B register in GCR |
---|---|---|---|
2 | module. Since we don't simulate a detailed memory controller, we | 2 | module. Since we don't simulate a detailed memory controller, we |
3 | need to store this information directly similar to the NPCM7XX's | 3 | need to store this information directly similar to the NPCM7XX's |
4 | INCTR3 register. | 4 | INCTR3 register. |
5 | 5 | ||
6 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 7 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
7 | --- | 8 | --- |
8 | hw/misc/npcm_gcr.c | 24 ++++++++++++++++++++++++ | 9 | hw/misc/npcm_gcr.c | 24 ++++++++++++++++++++++++ |
9 | include/hw/misc/npcm_gcr.h | 1 + | 10 | include/hw/misc/npcm_gcr.h | 1 + |
10 | 2 files changed, 25 insertions(+) | 11 | 2 files changed, 25 insertions(+) |
... | ... | ||
81 | + uint32_t reset_scrpad_b; | 82 | + uint32_t reset_scrpad_b; |
82 | } NPCMGCRState; | 83 | } NPCMGCRState; |
83 | 84 | ||
84 | typedef struct NPCMGCRClass { | 85 | typedef struct NPCMGCRClass { |
85 | -- | 86 | -- |
86 | 2.47.1.613.gc27f4b7a9f-goog | 87 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | The NPCM8xx GCR device can be accessed with 64-bit memory operations. | 1 | The NPCM8xx GCR device can be accessed with 64-bit memory operations. |
---|---|---|---|
2 | This patch supports that. | 2 | This patch supports that. |
3 | 3 | ||
4 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
4 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
5 | --- | 6 | --- |
6 | hw/misc/npcm_gcr.c | 94 +++++++++++++++++++++++++++++++++----------- | 7 | hw/misc/npcm_gcr.c | 94 +++++++++++++++++++++++++++++++++----------- |
7 | hw/misc/trace-events | 4 +- | 8 | hw/misc/trace-events | 4 +- |
8 | 2 files changed, 74 insertions(+), 24 deletions(-) | 9 | 2 files changed, 74 insertions(+), 24 deletions(-) |
... | ... | ||
28 | + case 4: | 29 | + case 4: |
29 | + value = s->regs[reg]; | 30 | + value = s->regs[reg]; |
30 | + break; | 31 | + break; |
31 | + | 32 | + |
32 | + case 8: | 33 | + case 8: |
33 | + value = s->regs[reg] + (((uint64_t)s->regs[reg + 1]) << 32); | 34 | + value = deposit64(s->regs[reg], 32, 32, s->regs[reg + 1]); |
34 | + break; | 35 | + break; |
35 | + | 36 | + |
36 | + default: | 37 | + default: |
37 | + g_assert_not_reached(); | 38 | + g_assert_not_reached(); |
38 | + } | 39 | + } |
... | ... | ||
90 | - case NPCM7XX_GCR_MDLR: | 91 | - case NPCM7XX_GCR_MDLR: |
91 | - /* Write 1 to set */ | 92 | - /* Write 1 to set */ |
92 | - value |= s->regs[reg]; | 93 | - value |= s->regs[reg]; |
93 | + case 8: | 94 | + case 8: |
94 | + s->regs[reg] = value; | 95 | + s->regs[reg] = value; |
95 | + s->regs[reg + 1] = v >> 32; | 96 | + s->regs[reg + 1] = extract64(v, 32, 32); |
96 | break; | 97 | break; |
97 | - }; | 98 | - }; |
98 | 99 | ||
99 | - s->regs[reg] = value; | 100 | - s->regs[reg] = value; |
100 | + default: | 101 | + default: |
... | ... | ||
152 | +npcm_gcr_write(uint64_t offset, uint64_t value) "offset: 0x%04" PRIx64 " value: 0x%08" PRIx64 | 153 | +npcm_gcr_write(uint64_t offset, uint64_t value) "offset: 0x%04" PRIx64 " value: 0x%08" PRIx64 |
153 | 154 | ||
154 | # npcm7xx_mft.c | 155 | # npcm7xx_mft.c |
155 | npcm7xx_mft_read(const char *name, uint64_t offset, uint16_t value) "%s: offset: 0x%04" PRIx64 " value: 0x%04" PRIx16 | 156 | npcm7xx_mft_read(const char *name, uint64_t offset, uint16_t value) "%s: offset: 0x%04" PRIx64 " value: 0x%04" PRIx16 |
156 | -- | 157 | -- |
157 | 2.47.1.613.gc27f4b7a9f-goog | 158 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | NPCM7XX and NPCM8XX have a different set of CLK registers. This | 1 | NPCM7XX and NPCM8XX have a different set of CLK registers. This |
---|---|---|---|
2 | commit changes the name of the clk files to be used by both | 2 | commit changes the name of the clk files to be used by both |
3 | NPCM7XX and NPCM8XX CLK modules. | 3 | NPCM7XX and NPCM8XX CLK modules. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
6 | --- | 7 | --- |
7 | hw/misc/meson.build | 2 +- | 8 | hw/misc/meson.build | 2 +- |
8 | hw/misc/{npcm7xx_clk.c => npcm_clk.c} | 2 +- | 9 | hw/misc/{npcm7xx_clk.c => npcm_clk.c} | 2 +- |
9 | include/hw/arm/npcm7xx.h | 2 +- | 10 | include/hw/arm/npcm7xx.h | 2 +- |
... | ... | ||
77 | OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxCLKState, NPCM7XX_CLK) | 78 | OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxCLKState, NPCM7XX_CLK) |
78 | 79 | ||
79 | -#endif /* NPCM7XX_CLK_H */ | 80 | -#endif /* NPCM7XX_CLK_H */ |
80 | +#endif /* NPCM_CLK_H */ | 81 | +#endif /* NPCM_CLK_H */ |
81 | -- | 82 | -- |
82 | 2.47.1.613.gc27f4b7a9f-goog | 83 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | A lot of NPCM7XX and NPCM8XX CLK modules share the same code, | 1 | A lot of NPCM7XX and NPCM8XX CLK modules share the same code, |
---|---|---|---|
2 | this commit moves the NPCM7XX CLK to NPCM CLK for these | 2 | this commit moves the NPCM7XX CLK to NPCM CLK for these |
3 | properties. | 3 | properties. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
6 | --- | 7 | --- |
7 | hw/misc/npcm_clk.c | 106 +++++++++++++++++++++---------------- | 8 | hw/misc/npcm_clk.c | 106 +++++++++++++++++++++---------------- |
8 | hw/misc/trace-events | 6 +-- | 9 | hw/misc/trace-events | 6 +-- |
9 | include/hw/arm/npcm7xx.h | 2 +- | 10 | include/hw/arm/npcm7xx.h | 2 +- |
... | ... | ||
410 | #define TYPE_NPCM7XX_CLK "npcm7xx-clk" | 411 | #define TYPE_NPCM7XX_CLK "npcm7xx-clk" |
411 | -OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxCLKState, NPCM7XX_CLK) | 412 | -OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxCLKState, NPCM7XX_CLK) |
412 | 413 | ||
413 | #endif /* NPCM_CLK_H */ | 414 | #endif /* NPCM_CLK_H */ |
414 | -- | 415 | -- |
415 | 2.47.1.613.gc27f4b7a9f-goog | 416 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | These 2 values are different between NPCM7XX and NPCM8XX | 1 | These 2 values are different between NPCM7XX and NPCM8XX |
---|---|---|---|
2 | CLKs. So we add them to the class and assign different values | 2 | CLKs. So we add them to the class and assign different values |
3 | to them. | 3 | to them. |
4 | 4 | ||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
5 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
6 | --- | 7 | --- |
7 | hw/misc/npcm_clk.c | 17 +++++++++++------ | 8 | hw/misc/npcm_clk.c | 19 +++++++++++++------ |
8 | include/hw/misc/npcm_clk.h | 9 ++++++++- | 9 | include/hw/misc/npcm_clk.h | 9 ++++++++- |
9 | 2 files changed, 19 insertions(+), 7 deletions(-) | 10 | 2 files changed, 21 insertions(+), 7 deletions(-) |
10 | 11 | ||
11 | diff --git a/hw/misc/npcm_clk.c b/hw/misc/npcm_clk.c | 12 | diff --git a/hw/misc/npcm_clk.c b/hw/misc/npcm_clk.c |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/hw/misc/npcm_clk.c | 14 | --- a/hw/misc/npcm_clk.c |
14 | +++ b/hw/misc/npcm_clk.c | 15 | +++ b/hw/misc/npcm_clk.c |
... | ... | ||
55 | + NPCMCLKClass *c = NPCM_CLK_GET_CLASS(s); | 56 | + NPCMCLKClass *c = NPCM_CLK_GET_CLASS(s); |
56 | 57 | ||
57 | - QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values)); | 58 | - QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values)); |
58 | - | 59 | - |
59 | - memcpy(s->regs, cold_reset_values, sizeof(cold_reset_values)); | 60 | - memcpy(s->regs, cold_reset_values, sizeof(cold_reset_values)); |
61 | + g_assert(sizeof(s->regs) >= sizeof(c->cold_reset_values)); | ||
62 | + g_assert(sizeof(s->regs) >= c->nr_regs * sizeof(uint32_t)); | ||
60 | + memcpy(s->regs, c->cold_reset_values, sizeof(s->regs)); | 63 | + memcpy(s->regs, c->cold_reset_values, sizeof(s->regs)); |
61 | s->ref_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); | 64 | s->ref_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); |
62 | npcm7xx_clk_update_all_clocks(s); | 65 | npcm7xx_clk_update_all_clocks(s); |
63 | /* | 66 | /* |
64 | @@ -XXX,XX +XXX,XX @@ static void npcm_clk_class_init(ObjectClass *klass, void *data) | 67 | @@ -XXX,XX +XXX,XX @@ static void npcm_clk_class_init(ObjectClass *klass, void *data) |
... | ... | ||
104 | +OBJECT_DECLARE_TYPE(NPCMCLKState, NPCMCLKClass, NPCM_CLK) | 107 | +OBJECT_DECLARE_TYPE(NPCMCLKState, NPCMCLKClass, NPCM_CLK) |
105 | #define TYPE_NPCM7XX_CLK "npcm7xx-clk" | 108 | #define TYPE_NPCM7XX_CLK "npcm7xx-clk" |
106 | 109 | ||
107 | #endif /* NPCM_CLK_H */ | 110 | #endif /* NPCM_CLK_H */ |
108 | -- | 111 | -- |
109 | 2.47.1.613.gc27f4b7a9f-goog | 112 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
5 | registers. Currently no modules use these new clock values so they | 5 | registers. Currently no modules use these new clock values so they |
6 | are not necessary at this point. | 6 | are not necessary at this point. |
7 | Implementation of these clocks might be required when implementing | 7 | Implementation of these clocks might be required when implementing |
8 | these modules. | 8 | these modules. |
9 | 9 | ||
10 | Reviewed-by: Titus Rwantare <titusr@google.com> | ||
11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 12 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
11 | Reviewed-by: Titus Rwantare<titusr@google.com> | ||
12 | --- | 13 | --- |
13 | hw/misc/npcm_clk.c | 113 ++++++++++++++++++++++++++++++++++++- | 14 | hw/misc/npcm_clk.c | 113 ++++++++++++++++++++++++++++++++++++- |
14 | include/hw/misc/npcm_clk.h | 10 +++- | 15 | include/hw/misc/npcm_clk.h | 10 +++- |
15 | 2 files changed, 120 insertions(+), 3 deletions(-) | 16 | 2 files changed, 120 insertions(+), 3 deletions(-) |
16 | 17 | ||
... | ... | ||
212 | #define TYPE_NPCM7XX_CLK "npcm7xx-clk" | 213 | #define TYPE_NPCM7XX_CLK "npcm7xx-clk" |
213 | +#define TYPE_NPCM8XX_CLK "npcm8xx-clk" | 214 | +#define TYPE_NPCM8XX_CLK "npcm8xx-clk" |
214 | 215 | ||
215 | #endif /* NPCM_CLK_H */ | 216 | #endif /* NPCM_CLK_H */ |
216 | -- | 217 | -- |
217 | 2.47.1.613.gc27f4b7a9f-goog | 218 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | The PCS exists in NPCM8XX's GMAC1 and is used to control the SGMII | 1 | The PCS exists in NPCM8XX's GMAC1 and is used to control the SGMII |
---|---|---|---|
2 | PHY. This implementation contains all the default registers and | 2 | PHY. This implementation contains all the default registers and |
3 | the soft reset feature that are required to load the Linux kernel | 3 | the soft reset feature that are required to load the Linux kernel |
4 | driver. Further features have not been implemented yet. | 4 | driver. Further features have not been implemented yet. |
5 | 5 | ||
6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 6 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | --- | 8 | --- |
8 | hw/net/meson.build | 1 + | 9 | hw/net/meson.build | 1 + |
9 | hw/net/npcm_pcs.c | 410 ++++++++++++++++++++++++++++++++++++++ | 10 | hw/net/npcm_pcs.c | 410 ++++++++++++++++++++++++++++++++++++++ |
10 | hw/net/trace-events | 4 +- | 11 | hw/net/trace-events | 4 +- |
11 | include/hw/net/npcm_pcs.h | 42 ++++ | 12 | include/hw/net/npcm_pcs.h | 42 ++++ |
... | ... | ||
496 | + uint16_t indirect_access_base; | 497 | + uint16_t indirect_access_base; |
497 | + uint16_t sr_ctl[NPCM_PCS_NR_SR_CTLS]; | 498 | + uint16_t sr_ctl[NPCM_PCS_NR_SR_CTLS]; |
498 | + uint16_t sr_mii[NPCM_PCS_NR_SR_MIIS]; | 499 | + uint16_t sr_mii[NPCM_PCS_NR_SR_MIIS]; |
499 | + uint16_t sr_tim[NPCM_PCS_NR_SR_TIMS]; | 500 | + uint16_t sr_tim[NPCM_PCS_NR_SR_TIMS]; |
500 | + uint16_t vr_mii[NPCM_PCS_NR_VR_MIIS]; | 501 | + uint16_t vr_mii[NPCM_PCS_NR_VR_MIIS]; |
501 | +} NPCMPCSState; | 502 | +}; |
502 | + | 503 | + |
503 | +#define TYPE_NPCM_PCS "npcm-pcs" | 504 | +#define TYPE_NPCM_PCS "npcm-pcs" |
504 | +OBJECT_DECLARE_SIMPLE_TYPE(NPCMPCSState, NPCM_PCS) | 505 | +OBJECT_DECLARE_SIMPLE_TYPE(NPCMPCSState, NPCM_PCS) |
505 | + | 506 | + |
506 | +#endif /* NPCM_PCS_H */ | 507 | +#endif /* NPCM_PCS_H */ |
507 | -- | 508 | -- |
508 | 2.47.1.613.gc27f4b7a9f-goog | 509 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 1 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
---|---|---|---|
2 | --- | 2 | --- |
3 | configs/devices/aarch64-softmmu/default.mak | 1 + | 3 | configs/devices/aarch64-softmmu/default.mak | 1 + |
4 | hw/arm/Kconfig | 11 + | 4 | hw/arm/Kconfig | 13 + |
5 | hw/arm/meson.build | 1 + | 5 | hw/arm/meson.build | 1 + |
6 | hw/arm/npcm8xx.c | 810 ++++++++++++++++++++ | 6 | hw/arm/npcm8xx.c | 804 ++++++++++++++++++++ |
7 | include/hw/arm/npcm8xx.h | 107 +++ | 7 | include/hw/arm/npcm8xx.h | 107 +++ |
8 | 5 files changed, 930 insertions(+) | 8 | 5 files changed, 926 insertions(+) |
9 | create mode 100644 hw/arm/npcm8xx.c | 9 | create mode 100644 hw/arm/npcm8xx.c |
10 | create mode 100644 include/hw/arm/npcm8xx.h | 10 | create mode 100644 include/hw/arm/npcm8xx.h |
11 | 11 | ||
12 | diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak | 12 | diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak |
13 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/configs/devices/aarch64-softmmu/default.mak | 14 | --- a/configs/devices/aarch64-softmmu/default.mak |
15 | +++ b/configs/devices/aarch64-softmmu/default.mak | 15 | +++ b/configs/devices/aarch64-softmmu/default.mak |
16 | @@ -XXX,XX +XXX,XX @@ include ../arm-softmmu/default.mak | 16 | @@ -XXX,XX +XXX,XX @@ include ../arm-softmmu/default.mak |
17 | # CONFIG_XLNX_ZYNQMP_ARM=n | 17 | # CONFIG_XLNX_ZYNQMP_ARM=n |
18 | # CONFIG_XLNX_VERSAL=n | 18 | # CONFIG_XLNX_VERSAL=n |
19 | # CONFIG_SBSA_REF=n | 19 | # CONFIG_SBSA_REF=n |
20 | +CONFIG_NPCM8XX=y | 20 | +# CONFIG_NPCM8XX=n |
21 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 21 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
22 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/hw/arm/Kconfig | 23 | --- a/hw/arm/Kconfig |
24 | +++ b/hw/arm/Kconfig | 24 | +++ b/hw/arm/Kconfig |
25 | @@ -XXX,XX +XXX,XX @@ config NPCM7XX | 25 | @@ -XXX,XX +XXX,XX @@ config NPCM7XX |
26 | select PCA954X | 26 | select PCA954X |
27 | select USB_OHCI_SYSBUS | 27 | select USB_OHCI_SYSBUS |
28 | 28 | ||
29 | +config NPCM8XX | 29 | +config NPCM8XX |
30 | + bool | 30 | + bool |
31 | + default y | ||
32 | + depends on TCG && AARCH64 | ||
31 | + select ARM_GIC | 33 | + select ARM_GIC |
32 | + select SMBUS | 34 | + select SMBUS |
33 | + select PL310 # cache controller | 35 | + select PL310 # cache controller |
34 | + select NPCM7XX | 36 | + select NPCM7XX |
35 | + select SERIAL | 37 | + select SERIAL |
... | ... | ||
75 | + */ | 77 | + */ |
76 | + | 78 | + |
77 | +#include "qemu/osdep.h" | 79 | +#include "qemu/osdep.h" |
78 | + | 80 | + |
79 | +#include "hw/arm/boot.h" | 81 | +#include "hw/arm/boot.h" |
82 | +#include "hw/arm/bsa.h" | ||
80 | +#include "hw/arm/npcm8xx.h" | 83 | +#include "hw/arm/npcm8xx.h" |
81 | +#include "hw/char/serial-mm.h" | 84 | +#include "hw/char/serial-mm.h" |
82 | +#include "hw/intc/arm_gic.h" | 85 | +#include "hw/intc/arm_gic.h" |
83 | +#include "hw/loader.h" | 86 | +#include "hw/loader.h" |
84 | +#include "hw/misc/unimp.h" | 87 | +#include "hw/misc/unimp.h" |
85 | +#include "hw/qdev-clock.h" | 88 | +#include "hw/qdev-clock.h" |
86 | +#include "hw/qdev-properties.h" | 89 | +#include "hw/qdev-properties.h" |
87 | +#include "qapi/error.h" | 90 | +#include "qapi/error.h" |
88 | +#include "qemu/units.h" | 91 | +#include "qemu/units.h" |
89 | +#include "system/system.h" | 92 | +#include "system/system.h" |
90 | + | 93 | + |
91 | +#define ARM_PHYS_TIMER_PPI 30 | ||
92 | +#define ARM_VIRT_TIMER_PPI 27 | ||
93 | +#define ARM_HYP_TIMER_PPI 26 | ||
94 | +#define ARM_SEC_TIMER_PPI 29 | ||
95 | + | ||
96 | +/* | 94 | +/* |
97 | + * This covers the whole MMIO space. We'll use this to catch any MMIO accesses | 95 | + * This covers the whole MMIO space. We'll use this to catch any MMIO accesses |
98 | + * that aren't handled by a device. | 96 | + * that aren't handled by a device. |
99 | + */ | 97 | + */ |
100 | +#define NPCM8XX_MMIO_BA (0x80000000) | 98 | +#define NPCM8XX_MMIO_BA 0x80000000 |
101 | +#define NPCM8XX_MMIO_SZ (0x7ffd0000) | 99 | +#define NPCM8XX_MMIO_SZ 0x7ffd0000 |
102 | + | 100 | + |
103 | +/* OTP fuse array */ | 101 | +/* OTP fuse array */ |
104 | +#define NPCM8XX_OTP_BA (0xf0189000) | 102 | +#define NPCM8XX_OTP_BA 0xf0189000 |
105 | + | 103 | + |
106 | +/* GIC Distributor */ | 104 | +/* GIC Distributor */ |
107 | +#define NPCM8XX_GICD_BA (0xdfff9000) | 105 | +#define NPCM8XX_GICD_BA 0xdfff9000 |
108 | +#define NPCM8XX_GICC_BA (0xdfffa000) | 106 | +#define NPCM8XX_GICC_BA 0xdfffa000 |
109 | + | 107 | + |
110 | +/* Core system modules. */ | 108 | +/* Core system modules. */ |
111 | +#define NPCM8XX_CPUP_BA (0xf03fe000) | 109 | +#define NPCM8XX_CPUP_BA 0xf03fe000 |
112 | +#define NPCM8XX_GCR_BA (0xf0800000) | 110 | +#define NPCM8XX_GCR_BA 0xf0800000 |
113 | +#define NPCM8XX_CLK_BA (0xf0801000) | 111 | +#define NPCM8XX_CLK_BA 0xf0801000 |
114 | +#define NPCM8XX_MC_BA (0xf0824000) | 112 | +#define NPCM8XX_MC_BA 0xf0824000 |
115 | +#define NPCM8XX_RNG_BA (0xf000b000) | 113 | +#define NPCM8XX_RNG_BA 0xf000b000 |
116 | + | 114 | + |
117 | +/* ADC Module */ | 115 | +/* ADC Module */ |
118 | +#define NPCM8XX_ADC_BA (0xf000c000) | 116 | +#define NPCM8XX_ADC_BA 0xf000c000 |
119 | + | 117 | + |
120 | +/* Internal AHB SRAM */ | 118 | +/* Internal AHB SRAM */ |
121 | +#define NPCM8XX_RAM3_BA (0xc0008000) | 119 | +#define NPCM8XX_RAM3_BA 0xc0008000 |
122 | +#define NPCM8XX_RAM3_SZ (4 * KiB) | 120 | +#define NPCM8XX_RAM3_SZ (4 * KiB) |
123 | + | 121 | + |
124 | +/* Memory blocks at the end of the address space */ | 122 | +/* Memory blocks at the end of the address space */ |
125 | +#define NPCM8XX_RAM2_BA (0xfffb0000) | 123 | +#define NPCM8XX_RAM2_BA 0xfffb0000 |
126 | +#define NPCM8XX_RAM2_SZ (256 * KiB) | 124 | +#define NPCM8XX_RAM2_SZ (256 * KiB) |
127 | +#define NPCM8XX_ROM_BA (0xffff0100) | 125 | +#define NPCM8XX_ROM_BA 0xffff0100 |
128 | +#define NPCM8XX_ROM_SZ (64 * KiB) | 126 | +#define NPCM8XX_ROM_SZ (64 * KiB) |
129 | + | 127 | + |
130 | +/* SDHCI Modules */ | 128 | +/* SDHCI Modules */ |
131 | +#define NPCM8XX_MMC_BA (0xf0842000) | 129 | +#define NPCM8XX_MMC_BA 0xf0842000 |
132 | + | 130 | + |
133 | +/* Run PLL1 at 1600 MHz */ | 131 | +/* Run PLL1 at 1600 MHz */ |
134 | +#define NPCM8XX_PLLCON1_FIXUP_VAL (0x00402101) | 132 | +#define NPCM8XX_PLLCON1_FIXUP_VAL 0x00402101 |
135 | +/* Run the CPU from PLL1 and UART from PLL2 */ | 133 | +/* Run the CPU from PLL1 and UART from PLL2 */ |
136 | +#define NPCM8XX_CLKSEL_FIXUP_VAL (0x004aaba9) | 134 | +#define NPCM8XX_CLKSEL_FIXUP_VAL 0x004aaba9 |
137 | + | 135 | + |
138 | +/* Clock configuration values to be fixed up when bypassing bootloader */ | 136 | +/* Clock configuration values to be fixed up when bypassing bootloader */ |
139 | + | 137 | + |
140 | +/* | 138 | +/* |
141 | + * Interrupt lines going into the GIC. This does not include internal Cortex-A9 | 139 | + * Interrupt lines going into the GIC. This does not include internal Cortex-A35 |
142 | + * interrupts. | 140 | + * interrupts. |
143 | + */ | 141 | + */ |
144 | +enum NPCM8xxInterrupt { | 142 | +enum NPCM8xxInterrupt { |
145 | + NPCM8XX_ADC_IRQ = 0, | 143 | + NPCM8XX_ADC_IRQ = 0, |
146 | + NPCM8XX_PECI_IRQ = 6, | 144 | + NPCM8XX_PECI_IRQ = 6, |
... | ... | ||
224 | + NPCM8XX_UART6_IRQ, | 222 | + NPCM8XX_UART6_IRQ, |
225 | +}; | 223 | +}; |
226 | + | 224 | + |
227 | +/* Total number of GIC interrupts, including internal Cortex-A35 interrupts. */ | 225 | +/* Total number of GIC interrupts, including internal Cortex-A35 interrupts. */ |
228 | +#define NPCM8XX_NUM_IRQ (288) | 226 | +#define NPCM8XX_NUM_IRQ (288) |
229 | +#define NPCM8XX_PPI_BASE(cpu) ((NPCM8XX_NUM_IRQ - 32) + (cpu) * 32) | 227 | +#define NPCM8XX_PPI_BASE(cpu) \ |
228 | + ((NPCM8XX_NUM_IRQ - GIC_INTERNAL) + (cpu) * GIC_INTERNAL) | ||
230 | + | 229 | + |
231 | +/* Register base address for each Timer Module */ | 230 | +/* Register base address for each Timer Module */ |
232 | +static const hwaddr npcm8xx_tim_addr[] = { | 231 | +static const hwaddr npcm8xx_tim_addr[] = { |
233 | + 0xf0008000, | 232 | + 0xf0008000, |
234 | + 0xf0009000, | 233 | + 0xf0009000, |
... | ... | ||
451 | + | 450 | + |
452 | + object_initialize_child(obj, "cpu-cluster", &s->cpu_cluster, | 451 | + object_initialize_child(obj, "cpu-cluster", &s->cpu_cluster, |
453 | + TYPE_CPU_CLUSTER); | 452 | + TYPE_CPU_CLUSTER); |
454 | + for (i = 0; i < NPCM8XX_MAX_NUM_CPUS; i++) { | 453 | + for (i = 0; i < NPCM8XX_MAX_NUM_CPUS; i++) { |
455 | + object_initialize_child(OBJECT(&s->cpu_cluster), "cpu[*]", &s->cpu[i], | 454 | + object_initialize_child(OBJECT(&s->cpu_cluster), "cpu[*]", &s->cpu[i], |
456 | + ARM_CPU_TYPE_NAME("cortex-a53")); | 455 | + ARM_CPU_TYPE_NAME("cortex-a35")); |
457 | + } | 456 | + } |
458 | + object_initialize_child(obj, "gic", &s->gic, TYPE_ARM_GIC); | 457 | + object_initialize_child(obj, "gic", &s->gic, TYPE_ARM_GIC); |
459 | + object_initialize_child(obj, "gcr", &s->gcr, TYPE_NPCM8XX_GCR); | 458 | + object_initialize_child(obj, "gcr", &s->gcr, TYPE_NPCM8XX_GCR); |
460 | + object_property_add_alias(obj, "power-on-straps", OBJECT(&s->gcr), | 459 | + object_property_add_alias(obj, "power-on-straps", OBJECT(&s->gcr), |
461 | + "power-on-straps"); | 460 | + "power-on-straps"); |
... | ... | ||
540 | + object_property_set_uint(OBJECT(&s->gic), "num-cpu", nc->num_cpus, errp); | 539 | + object_property_set_uint(OBJECT(&s->gic), "num-cpu", nc->num_cpus, errp); |
541 | + object_property_set_uint(OBJECT(&s->gic), "num-irq", NPCM8XX_NUM_IRQ, errp); | 540 | + object_property_set_uint(OBJECT(&s->gic), "num-irq", NPCM8XX_NUM_IRQ, errp); |
542 | + object_property_set_uint(OBJECT(&s->gic), "revision", 2, errp); | 541 | + object_property_set_uint(OBJECT(&s->gic), "revision", 2, errp); |
543 | + object_property_set_bool(OBJECT(&s->gic), "has-security-extensions", true, | 542 | + object_property_set_bool(OBJECT(&s->gic), "has-security-extensions", true, |
544 | + errp); | 543 | + errp); |
545 | + object_property_set_bool(OBJECT(&s->gic), "irq-reset-nonsecure", true, | ||
546 | + errp); | ||
547 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->gic), errp)) { | 544 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->gic), errp)) { |
548 | + return; | 545 | + return; |
549 | + } | 546 | + } |
550 | + for (i = 0; i < nc->num_cpus; i++) { | 547 | + for (i = 0; i < nc->num_cpus; i++) { |
551 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), i, | 548 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), i, |
... | ... | ||
557 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), i + nc->num_cpus * 3, | 554 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gic), i + nc->num_cpus * 3, |
558 | + qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_VFIQ)); | 555 | + qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_VFIQ)); |
559 | + | 556 | + |
560 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_PHYS, | 557 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_PHYS, |
561 | + qdev_get_gpio_in(DEVICE(&s->gic), | 558 | + qdev_get_gpio_in(DEVICE(&s->gic), |
562 | + NPCM8XX_PPI_BASE(i) + ARM_PHYS_TIMER_PPI)); | 559 | + NPCM8XX_PPI_BASE(i) + ARCH_TIMER_NS_EL1_IRQ)); |
563 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_VIRT, | 560 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_VIRT, |
564 | + qdev_get_gpio_in(DEVICE(&s->gic), | 561 | + qdev_get_gpio_in(DEVICE(&s->gic), |
565 | + NPCM8XX_PPI_BASE(i) + ARM_VIRT_TIMER_PPI)); | 562 | + NPCM8XX_PPI_BASE(i) + ARCH_TIMER_VIRT_IRQ)); |
566 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_HYP, | 563 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_HYP, |
567 | + qdev_get_gpio_in(DEVICE(&s->gic), | 564 | + qdev_get_gpio_in(DEVICE(&s->gic), |
568 | + NPCM8XX_PPI_BASE(i) + ARM_HYP_TIMER_PPI)); | 565 | + NPCM8XX_PPI_BASE(i) + ARCH_TIMER_NS_EL2_IRQ)); |
569 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_SEC, | 566 | + qdev_connect_gpio_out(DEVICE(&s->cpu[i]), GTIMER_SEC, |
570 | + qdev_get_gpio_in(DEVICE(&s->gic), | 567 | + qdev_get_gpio_in(DEVICE(&s->gic), |
571 | + NPCM8XX_PPI_BASE(i) + ARM_SEC_TIMER_PPI)); | 568 | + NPCM8XX_PPI_BASE(i) + ARCH_TIMER_S_EL1_IRQ)); |
572 | + } | 569 | + } |
573 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 0, NPCM8XX_GICD_BA); | 570 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 0, NPCM8XX_GICD_BA); |
574 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 1, NPCM8XX_GICC_BA); | 571 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gic), 1, NPCM8XX_GICC_BA); |
575 | + | 572 | + |
576 | + /* CPU cluster */ | 573 | + /* CPU cluster */ |
... | ... | ||
630 | + | 627 | + |
631 | + /* IRQ for watchdogs */ | 628 | + /* IRQ for watchdogs */ |
632 | + sysbus_connect_irq(sbd, NPCM7XX_TIMERS_PER_CTRL, | 629 | + sysbus_connect_irq(sbd, NPCM7XX_TIMERS_PER_CTRL, |
633 | + npcm8xx_irq(s, NPCM8XX_WDG0_IRQ + i)); | 630 | + npcm8xx_irq(s, NPCM8XX_WDG0_IRQ + i)); |
634 | + /* GPIO that connects clk module with watchdog */ | 631 | + /* GPIO that connects clk module with watchdog */ |
635 | + /* TODO: Check this.*/ | ||
636 | + qdev_connect_gpio_out_named(DEVICE(&s->tim[i]), | 632 | + qdev_connect_gpio_out_named(DEVICE(&s->tim[i]), |
637 | + NPCM7XX_WATCHDOG_RESET_GPIO_OUT, 0, | 633 | + NPCM7XX_WATCHDOG_RESET_GPIO_OUT, 0, |
638 | + qdev_get_gpio_in_named(DEVICE(&s->clk), | 634 | + qdev_get_gpio_in_named(DEVICE(&s->clk), |
639 | + NPCM7XX_WATCHDOG_RESET_GPIO_IN, i)); | 635 | + NPCM7XX_WATCHDOG_RESET_GPIO_IN, i)); |
640 | + } | 636 | + } |
... | ... | ||
980 | + */ | 976 | + */ |
981 | +void npcm8xx_load_kernel(MachineState *machine, NPCM8xxState *soc); | 977 | +void npcm8xx_load_kernel(MachineState *machine, NPCM8xxState *soc); |
982 | + | 978 | + |
983 | +#endif /* NPCM8XX_H */ | 979 | +#endif /* NPCM8XX_H */ |
984 | -- | 980 | -- |
985 | 2.47.1.613.gc27f4b7a9f-goog | 981 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
---|---|---|---|
1 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 2 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
2 | --- | 3 | --- |
3 | hw/arm/meson.build | 2 +- | 4 | hw/arm/meson.build | 2 +- |
4 | hw/arm/npcm8xx_boards.c | 256 +++++++++++++++++++++++++++++++++++++++ | 5 | hw/arm/npcm8xx_boards.c | 253 +++++++++++++++++++++++++++++++++++++++ |
5 | include/hw/arm/npcm8xx.h | 20 +++ | 6 | include/hw/arm/npcm8xx.h | 20 ++++ |
6 | 3 files changed, 277 insertions(+), 1 deletion(-) | 7 | 3 files changed, 274 insertions(+), 1 deletion(-) |
7 | create mode 100644 hw/arm/npcm8xx_boards.c | 8 | create mode 100644 hw/arm/npcm8xx_boards.c |
8 | 9 | ||
9 | diff --git a/hw/arm/meson.build b/hw/arm/meson.build | 10 | diff --git a/hw/arm/meson.build b/hw/arm/meson.build |
10 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/hw/arm/meson.build | 12 | --- a/hw/arm/meson.build |
... | ... | ||
106 | + | 107 | + |
107 | +static NPCM8xxState *npcm8xx_create_soc(MachineState *machine, | 108 | +static NPCM8xxState *npcm8xx_create_soc(MachineState *machine, |
108 | + uint32_t hw_straps) | 109 | + uint32_t hw_straps) |
109 | +{ | 110 | +{ |
110 | + NPCM8xxMachineClass *nmc = NPCM8XX_MACHINE_GET_CLASS(machine); | 111 | + NPCM8xxMachineClass *nmc = NPCM8XX_MACHINE_GET_CLASS(machine); |
111 | + MachineClass *mc = MACHINE_CLASS(nmc); | ||
112 | + Object *obj; | 112 | + Object *obj; |
113 | + | ||
114 | + if (strcmp(machine->cpu_type, mc->default_cpu_type) != 0) { | ||
115 | + error_report("This board can only be used with %s", | ||
116 | + mc->default_cpu_type); | ||
117 | + exit(1); | ||
118 | + } | ||
119 | + | 113 | + |
120 | + obj = object_new_with_props(nmc->soc_type, OBJECT(machine), "soc", | 114 | + obj = object_new_with_props(nmc->soc_type, OBJECT(machine), "soc", |
121 | + &error_abort, NULL); | 115 | + &error_abort, NULL); |
122 | + object_property_set_uint(obj, "power-on-straps", hw_straps, &error_abort); | 116 | + object_property_set_uint(obj, "power-on-straps", hw_straps, &error_abort); |
123 | + | 117 | + |
... | ... | ||
243 | +} | 237 | +} |
244 | + | 238 | + |
245 | +static void npcm8xx_machine_class_init(ObjectClass *oc, void *data) | 239 | +static void npcm8xx_machine_class_init(ObjectClass *oc, void *data) |
246 | +{ | 240 | +{ |
247 | + MachineClass *mc = MACHINE_CLASS(oc); | 241 | + MachineClass *mc = MACHINE_CLASS(oc); |
242 | + static const char * const valid_cpu_types[] = { | ||
243 | + ARM_CPU_TYPE_NAME("cortex-a9"), | ||
244 | + NULL | ||
245 | + }; | ||
248 | + | 246 | + |
249 | + mc->no_floppy = 1; | 247 | + mc->no_floppy = 1; |
250 | + mc->no_cdrom = 1; | 248 | + mc->no_cdrom = 1; |
251 | + mc->no_parallel = 1; | 249 | + mc->no_parallel = 1; |
252 | + mc->default_ram_id = "ram"; | 250 | + mc->default_ram_id = "ram"; |
253 | + mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"); | 251 | + mc->valid_cpu_types = valid_cpu_types; |
254 | +} | 252 | +} |
255 | + | 253 | + |
256 | +static void npcm845_evb_machine_class_init(ObjectClass *oc, void *data) | 254 | +static void npcm845_evb_machine_class_init(ObjectClass *oc, void *data) |
257 | +{ | 255 | +{ |
258 | + NPCM8xxMachineClass *nmc = NPCM8XX_MACHINE_CLASS(oc); | 256 | + NPCM8xxMachineClass *nmc = NPCM8XX_MACHINE_CLASS(oc); |
... | ... | ||
311 | + | 309 | + |
312 | typedef struct NPCM8xxState { | 310 | typedef struct NPCM8xxState { |
313 | DeviceState parent; | 311 | DeviceState parent; |
314 | 312 | ||
315 | -- | 313 | -- |
316 | 2.47.1.613.gc27f4b7a9f-goog | 314 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |
1 | NPCM8XX SoC is the successor of the NPCM7XX. It features quad-core | 1 | NPCM8XX SoC is the successor of the NPCM7XX. It features quad-core |
---|---|---|---|
2 | Cortex-A35 (Armv8, 64-bit) CPUs and some additional peripherals. | 2 | Cortex-A35 (Armv8, 64-bit) CPUs and some additional peripherals. |
3 | 3 | ||
4 | This document describes the NPCM8XX SoC and an evaluation board | ||
5 | (NPCM 845 EVB). | ||
6 | |||
4 | Signed-off-by: Hao Wu <wuhaotsh@google.com> | 7 | Signed-off-by: Hao Wu <wuhaotsh@google.com> |
5 | --- | 8 | --- |
6 | docs/system/arm/nuvoton.rst | 20 +++++++++++++++----- | 9 | docs/system/arm/nuvoton.rst | 27 ++++++++++++++++++++------- |
7 | 1 file changed, 15 insertions(+), 5 deletions(-) | 10 | 1 file changed, 20 insertions(+), 7 deletions(-) |
8 | 11 | ||
9 | diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst | 12 | diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst |
10 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/docs/system/arm/nuvoton.rst | 14 | --- a/docs/system/arm/nuvoton.rst |
12 | +++ b/docs/system/arm/nuvoton.rst | 15 | +++ b/docs/system/arm/nuvoton.rst |
13 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ |
14 | Nuvoton iBMC boards (``kudo-bmc``, ``mori-bmc``, ``npcm750-evb``, ``quanta-gbs-bmc``, ``quanta-gsj``) | 17 | -Nuvoton iBMC boards (``kudo-bmc``, ``mori-bmc``, ``npcm750-evb``, ``quanta-gbs-bmc``, ``quanta-gsj``) |
15 | ===================================================================================================== | 18 | -===================================================================================================== |
19 | +Nuvoton iBMC boards (``kudo-bmc``, ``mori-bmc``, ``npcm750-evb``, ``quanta-gbs-bmc``, ``quanta-gsj``, ``npcm845-evb``) | ||
20 | +====================================================================================================================== | ||
16 | 21 | ||
17 | -The `Nuvoton iBMC`_ chips (NPCM7xx) are a family of ARM-based SoCs that are | 22 | -The `Nuvoton iBMC`_ chips (NPCM7xx) are a family of ARM-based SoCs that are |
18 | +The `Nuvoton iBMC`_ chips are a family of ARM-based SoCs that are | 23 | +The `Nuvoton iBMC`_ chips are a family of Arm-based SoCs that are |
19 | designed to be used as Baseboard Management Controllers (BMCs) in various | 24 | designed to be used as Baseboard Management Controllers (BMCs) in various |
20 | -servers. They all feature one or two ARM Cortex-A9 CPU cores, as well as an | 25 | -servers. They all feature one or two ARM Cortex-A9 CPU cores, as well as an |
21 | -assortment of peripherals targeted for either Enterprise or Data Center / | 26 | -assortment of peripherals targeted for either Enterprise or Data Center / |
22 | -Hyperscale applications. The former is a superset of the latter, so NPCM750 has | 27 | -Hyperscale applications. The former is a superset of the latter, so NPCM750 has |
23 | -all the peripherals of NPCM730 and more. | 28 | -all the peripherals of NPCM730 and more. |
24 | +servers. Currently there are two families: NPCM7XX series and | 29 | +servers. Currently there are two families: NPCM7XX series and |
25 | +NPCM8XX series. NPCM7XX series feature one or two ARM Cortex-A9 CPU cores, | 30 | +NPCM8XX series. NPCM7XX series feature one or two Arm Cortex-A9 CPU cores, |
26 | +while NPCM8XX feature 4 ARM Cortex-A35 CPU cores. Both series contain a | 31 | +while NPCM8XX feature 4 Arm Cortex-A35 CPU cores. Both series contain a |
27 | +different assortment of peripherals targeted for either Enterprise or Data | 32 | +different assortment of peripherals targeted for either Enterprise or Data |
28 | +Center / Hyperscale applications. | 33 | +Center / Hyperscale applications. |
29 | 34 | ||
30 | .. _Nuvoton iBMC: https://www.nuvoton.com/products/cloud-computing/ibmc/ | 35 | .. _Nuvoton iBMC: https://www.nuvoton.com/products/cloud-computing/ibmc/ |
31 | 36 | ||
32 | @@ -XXX,XX +XXX,XX @@ There are also two more SoCs, NPCM710 and NPCM705, which are single-core | 37 | @@ -XXX,XX +XXX,XX @@ There are also two more SoCs, NPCM710 and NPCM705, which are single-core |
33 | variants of NPCM750 and NPCM730, respectively. These are currently not | 38 | variants of NPCM750 and NPCM730, respectively. These are currently not |
34 | supported by QEMU. | 39 | supported by QEMU. |
35 | 40 | ||
36 | +The NPCM8xx SoC is the successor of the NPCM7xx SoC. | 41 | +The NPCM8xx SoC is the successor of the NPCM7xx SoC. It has 4 Cortex-A35 cores. |
42 | +The following machines are based on this chip : | ||
43 | + | ||
44 | +- ``npcm845-evb`` Nuvoton NPCM845 Evaluation board | ||
37 | + | 45 | + |
38 | Supported devices | 46 | Supported devices |
39 | ----------------- | 47 | ----------------- |
40 | 48 | ||
41 | @@ -XXX,XX +XXX,XX @@ Missing devices | 49 | @@ -XXX,XX +XXX,XX @@ Missing devices |
42 | * System Wake-up Control (SWC) | 50 | * System Wake-up Control (SWC) |
43 | * Shared memory (SHM) | 51 | * Shared memory (SHM) |
44 | * eSPI slave interface | 52 | * eSPI slave interface |
45 | + * Block-tranfer interface (8XX only) | 53 | + * Block-transfer interface (8XX only) |
46 | + * Virtual UART (8XX only) | 54 | + * Virtual UART (8XX only) |
47 | 55 | ||
48 | * Ethernet controller (GMAC) | 56 | * Ethernet controller (GMAC) |
49 | * USB device (USBD) | 57 | * USB device (USBD) |
50 | @@ -XXX,XX +XXX,XX @@ Missing devices | 58 | @@ -XXX,XX +XXX,XX @@ Missing devices |
51 | * Video capture | 59 | * Video capture |
52 | * Encoding compression engine | 60 | * Encoding compression engine |
53 | * Security features | 61 | * Security features |
54 | + * I3C buses (8XX only) | 62 | + * I3C buses (8XX only) |
55 | + * Temperator sensor interface (8XX only) | 63 | + * Temperature sensor interface (8XX only) |
56 | + * Virtual UART (8XX only) | 64 | + * Virtual UART (8XX only) |
57 | + * Flash monitor (8XX only) | 65 | + * Flash monitor (8XX only) |
58 | + * JTAG master (8XX only) | 66 | + * JTAG master (8XX only) |
59 | 67 | ||
60 | Boot options | 68 | Boot options |
61 | ------------ | 69 | ------------ |
62 | -- | 70 | -- |
63 | 2.47.1.613.gc27f4b7a9f-goog | 71 | 2.48.1.362.g079036d154-goog | diff view generated by jsdifflib |