2012-02-16 13:56:04 +04:00
|
|
|
/*
|
|
|
|
* Samsung exynos4210 SoC emulation
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
|
|
|
|
* Maksim Kozlov <m.kozlov@samsung.com>
|
|
|
|
* Evgeny Voevodin <e.voevodin@samsung.com>
|
|
|
|
* Igor Mitsyanko <i.mitsyanko@samsung.com>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-06-29 14:47:03 +03:00
|
|
|
#ifndef EXYNOS4210_H
|
|
|
|
#define EXYNOS4210_H
|
2012-02-16 13:56:04 +04:00
|
|
|
|
2020-01-23 18:22:41 +03:00
|
|
|
#include "hw/or-irq.h"
|
2019-08-12 08:23:31 +03:00
|
|
|
#include "hw/sysbus.h"
|
2022-04-04 18:46:43 +03:00
|
|
|
#include "hw/cpu/a9mpcore.h"
|
2022-04-04 18:46:48 +03:00
|
|
|
#include "hw/intc/exynos4210_gic.h"
|
2022-04-04 18:46:57 +03:00
|
|
|
#include "hw/intc/exynos4210_combiner.h"
|
2022-04-04 18:46:52 +03:00
|
|
|
#include "hw/core/split-irq.h"
|
2023-10-13 16:02:14 +03:00
|
|
|
#include "hw/arm/boot.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2012-02-16 13:56:04 +04:00
|
|
|
|
|
|
|
#define EXYNOS4210_NCPUS 2
|
|
|
|
|
2012-02-16 13:56:05 +04:00
|
|
|
#define EXYNOS4210_DRAM0_BASE_ADDR 0x40000000
|
|
|
|
#define EXYNOS4210_DRAM1_BASE_ADDR 0xa0000000
|
|
|
|
#define EXYNOS4210_DRAM_MAX_SIZE 0x60000000 /* 1.5 GB */
|
|
|
|
|
|
|
|
#define EXYNOS4210_IROM_BASE_ADDR 0x00000000
|
|
|
|
#define EXYNOS4210_IROM_SIZE 0x00010000 /* 64 KB */
|
|
|
|
#define EXYNOS4210_IROM_MIRROR_BASE_ADDR 0x02000000
|
|
|
|
#define EXYNOS4210_IROM_MIRROR_SIZE 0x00010000 /* 64 KB */
|
|
|
|
|
|
|
|
#define EXYNOS4210_IRAM_BASE_ADDR 0x02020000
|
|
|
|
#define EXYNOS4210_IRAM_SIZE 0x00020000 /* 128 KB */
|
|
|
|
|
|
|
|
/* Secondary CPU startup code is in IROM memory */
|
|
|
|
#define EXYNOS4210_SMP_BOOT_ADDR EXYNOS4210_IROM_BASE_ADDR
|
|
|
|
#define EXYNOS4210_SMP_BOOT_SIZE 0x1000
|
|
|
|
#define EXYNOS4210_BASE_BOOT_ADDR EXYNOS4210_DRAM0_BASE_ADDR
|
|
|
|
/* Secondary CPU polling address to get loader start from */
|
|
|
|
#define EXYNOS4210_SECOND_CPU_BOOTREG 0x10020814
|
|
|
|
|
|
|
|
#define EXYNOS4210_SMP_PRIVATE_BASE_ADDR 0x10500000
|
|
|
|
#define EXYNOS4210_L2X0_BASE_ADDR 0x10502000
|
|
|
|
|
2012-02-16 13:56:04 +04:00
|
|
|
/*
|
|
|
|
* exynos4210 IRQ subsystem stub definitions.
|
|
|
|
*/
|
2012-05-28 08:11:49 +04:00
|
|
|
#define EXYNOS4210_IRQ_GATE_NINPUTS 2 /* Internal and External GIC */
|
2012-02-16 13:56:04 +04:00
|
|
|
|
|
|
|
#define EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ 64
|
|
|
|
#define EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ 16
|
|
|
|
#define EXYNOS4210_MAX_INT_COMBINER_IN_IRQ \
|
|
|
|
(EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ * 8)
|
|
|
|
#define EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ \
|
|
|
|
(EXYNOS4210_MAX_EXT_COMBINER_OUT_IRQ * 8)
|
|
|
|
|
2012-07-18 12:18:34 +04:00
|
|
|
#define EXYNOS4210_I2C_NUMBER 9
|
|
|
|
|
2020-01-23 18:22:41 +03:00
|
|
|
#define EXYNOS4210_NUM_DMA 3
|
|
|
|
|
2022-04-04 18:46:52 +03:00
|
|
|
/*
|
|
|
|
* We need one splitter for every external combiner input, plus
|
hw/arm/exynos4210: Fold combiner splits into exynos4210_init_board_irqs()
At this point, the function exynos4210_init_board_irqs() splits input
IRQ lines to connect them to the input combiner, output combiner and
external GIC. The function exynos4210_combiner_get_gpioin() splits
some of the combiner input lines further to connect them to multiple
different inputs on the combiner.
Because (unlike qemu_irq_split()) the TYPE_SPLIT_IRQ device has a
configurable number of outputs, we can do all this in one place, by
making exynos4210_init_board_irqs() add extra outputs to the splitter
device when it must be connected to more than one input on each
combiner.
We do this with a new data structure, the combinermap, which is an
array each of whose elements is a list of the interrupt IDs on the
combiner which must be tied together. As we loop through each
interrupt ID, if we find that it is the first one in one of these
lists, we configure the splitter device with eonugh extra outputs and
wire them up to the other interrupt IDs in the list.
Conveniently, for all the cases where this is necessary, the
lowest-numbered interrupt ID in each group is in the range of the
external combiner, so we only need to code for this in the first of
the two loops in exynos4210_init_board_irqs().
The old code in exynos4210_combiner_get_gpioin() which is being
deleted here had several problems which don't exist in the new code
in its handling of the multi-core timer interrupts:
(1) the case labels specified bits 4 ... 8, but bit '8' doesn't
exist; these should have been 4 ... 7
(2) it used the input irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]
multiple times as the input of several different splitters,
which isn't allowed
(3) in an apparent cut-and-paste error, the cases for all the
multi-core timer inputs used "bit + 4" even though the
bit range for the case was (intended to be) 4 ... 7, which
meant it was looking at non-existent bits 8 ... 11.
None of these exist in the new code.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220404154658.565020-17-peter.maydell@linaro.org
2022-04-04 18:46:56 +03:00
|
|
|
* one for every non-zero entry in combiner_grp_to_gic_id[],
|
|
|
|
* minus one for every external combiner ID in second or later
|
|
|
|
* places in a combinermap[] line.
|
2022-04-04 18:46:52 +03:00
|
|
|
* We'll assert in exynos4210_init_board_irqs() if this is wrong.
|
|
|
|
*/
|
hw/arm/exynos4210: Fold combiner splits into exynos4210_init_board_irqs()
At this point, the function exynos4210_init_board_irqs() splits input
IRQ lines to connect them to the input combiner, output combiner and
external GIC. The function exynos4210_combiner_get_gpioin() splits
some of the combiner input lines further to connect them to multiple
different inputs on the combiner.
Because (unlike qemu_irq_split()) the TYPE_SPLIT_IRQ device has a
configurable number of outputs, we can do all this in one place, by
making exynos4210_init_board_irqs() add extra outputs to the splitter
device when it must be connected to more than one input on each
combiner.
We do this with a new data structure, the combinermap, which is an
array each of whose elements is a list of the interrupt IDs on the
combiner which must be tied together. As we loop through each
interrupt ID, if we find that it is the first one in one of these
lists, we configure the splitter device with eonugh extra outputs and
wire them up to the other interrupt IDs in the list.
Conveniently, for all the cases where this is necessary, the
lowest-numbered interrupt ID in each group is in the range of the
external combiner, so we only need to code for this in the first of
the two loops in exynos4210_init_board_irqs().
The old code in exynos4210_combiner_get_gpioin() which is being
deleted here had several problems which don't exist in the new code
in its handling of the multi-core timer interrupts:
(1) the case labels specified bits 4 ... 8, but bit '8' doesn't
exist; these should have been 4 ... 7
(2) it used the input irq[EXYNOS4210_COMBINER_GET_IRQ_NUM(1, bit + 4)]
multiple times as the input of several different splitters,
which isn't allowed
(3) in an apparent cut-and-paste error, the cases for all the
multi-core timer inputs used "bit + 4" even though the
bit range for the case was (intended to be) 4 ... 7, which
meant it was looking at non-existent bits 8 ... 11.
None of these exist in the new code.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220404154658.565020-17-peter.maydell@linaro.org
2022-04-04 18:46:56 +03:00
|
|
|
#define EXYNOS4210_NUM_SPLITTERS (EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ + 38)
|
2022-04-04 18:46:52 +03:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct Exynos4210State {
|
2019-05-23 16:47:44 +03:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
2012-05-14 06:09:55 +04:00
|
|
|
ARMCPU *cpu[EXYNOS4210_NCPUS];
|
2022-04-04 18:46:45 +03:00
|
|
|
qemu_irq irq_table[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
|
2012-02-16 13:56:05 +04:00
|
|
|
|
|
|
|
MemoryRegion chipid_mem;
|
|
|
|
MemoryRegion iram_mem;
|
|
|
|
MemoryRegion irom_mem;
|
|
|
|
MemoryRegion irom_alias_mem;
|
|
|
|
MemoryRegion boot_secondary;
|
|
|
|
MemoryRegion bootreg_mem;
|
2013-08-03 02:18:51 +04:00
|
|
|
I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER];
|
2023-01-13 23:01:38 +03:00
|
|
|
OrIRQState pl330_irq_orgate[EXYNOS4210_NUM_DMA];
|
|
|
|
OrIRQState cpu_irq_orgate[EXYNOS4210_NCPUS];
|
2022-04-04 18:46:43 +03:00
|
|
|
A9MPPrivState a9mpcore;
|
2022-04-04 18:46:48 +03:00
|
|
|
Exynos4210GicState ext_gic;
|
2022-04-04 18:46:57 +03:00
|
|
|
Exynos4210CombinerState int_combiner;
|
|
|
|
Exynos4210CombinerState ext_combiner;
|
2022-04-04 18:46:52 +03:00
|
|
|
SplitIRQ splitter[EXYNOS4210_NUM_SPLITTERS];
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2012-02-16 13:56:05 +04:00
|
|
|
|
2019-05-23 16:47:44 +03:00
|
|
|
#define TYPE_EXYNOS4210_SOC "exynos4210"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210State, EXYNOS4210_SOC)
|
2019-05-23 16:47:44 +03:00
|
|
|
|
2012-05-14 02:08:10 +04:00
|
|
|
void exynos4210_write_secondary(ARMCPU *cpu,
|
2012-04-13 15:39:06 +04:00
|
|
|
const struct arm_boot_info *info);
|
|
|
|
|
2012-02-16 13:56:04 +04:00
|
|
|
/* Get IRQ number from exynos4210 IRQ subsystem stub.
|
|
|
|
* To identify IRQ source use internal combiner group and bit number
|
|
|
|
* grp - group number
|
|
|
|
* bit - bit number inside group */
|
|
|
|
uint32_t exynos4210_get_irq(uint32_t grp, uint32_t bit);
|
|
|
|
|
2012-02-16 13:56:05 +04:00
|
|
|
/*
|
|
|
|
* exynos4210 UART
|
|
|
|
*/
|
2012-10-23 14:30:10 +04:00
|
|
|
DeviceState *exynos4210_uart_create(hwaddr addr,
|
2012-02-16 13:56:05 +04:00
|
|
|
int fifo_size,
|
|
|
|
int channel,
|
2016-12-07 16:20:22 +03:00
|
|
|
Chardev *chr,
|
2012-02-16 13:56:05 +04:00
|
|
|
qemu_irq irq);
|
|
|
|
|
2016-06-29 14:47:03 +03:00
|
|
|
#endif /* EXYNOS4210_H */
|