2020-09-11 08:20:51 +03:00
|
|
|
/*
|
|
|
|
* Nuvoton NPCM7xx SoC family.
|
|
|
|
*
|
|
|
|
* Copyright 2020 Google LLC
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
#ifndef NPCM7XX_H
|
|
|
|
#define NPCM7XX_H
|
|
|
|
|
|
|
|
#include "hw/boards.h"
|
2021-01-08 22:09:42 +03:00
|
|
|
#include "hw/adc/npcm7xx_adc.h"
|
2021-03-11 21:08:54 +03:00
|
|
|
#include "hw/core/split-irq.h"
|
2020-09-11 08:20:51 +03:00
|
|
|
#include "hw/cpu/a9mpcore.h"
|
2020-10-24 00:06:37 +03:00
|
|
|
#include "hw/gpio/npcm7xx_gpio.h"
|
2021-02-11 01:04:22 +03:00
|
|
|
#include "hw/i2c/npcm7xx_smbus.h"
|
2020-09-11 08:20:56 +03:00
|
|
|
#include "hw/mem/npcm7xx_mc.h"
|
2020-09-11 08:20:51 +03:00
|
|
|
#include "hw/misc/npcm7xx_clk.h"
|
|
|
|
#include "hw/misc/npcm7xx_gcr.h"
|
2021-03-11 21:08:53 +03:00
|
|
|
#include "hw/misc/npcm7xx_mft.h"
|
2021-01-08 22:09:43 +03:00
|
|
|
#include "hw/misc/npcm7xx_pwm.h"
|
2020-10-24 00:06:35 +03:00
|
|
|
#include "hw/misc/npcm7xx_rng.h"
|
2021-02-19 00:24:52 +03:00
|
|
|
#include "hw/net/npcm7xx_emc.h"
|
2020-09-11 08:20:55 +03:00
|
|
|
#include "hw/nvram/npcm7xx_otp.h"
|
2020-09-11 08:20:51 +03:00
|
|
|
#include "hw/timer/npcm7xx_timer.h"
|
2020-09-11 08:20:57 +03:00
|
|
|
#include "hw/ssi/npcm7xx_fiu.h"
|
2023-02-09 02:54:33 +03:00
|
|
|
#include "hw/ssi/npcm_pspi.h"
|
hw/arm/npcm7xx: Add EHCI and OHCI controllers
The NPCM730 and NPCM750 chips have a single USB host port shared between
a USB 2.0 EHCI host controller and a USB 1.1 OHCI host controller. This
adds support for both of them.
Testing notes:
* With -device usb-kbd, qemu will automatically insert a full-speed
hub, and the keyboard becomes controlled by the OHCI controller.
* With -device usb-kbd,bus=usb-bus.0,port=1, the keyboard is directly
attached to the port without any hubs, and the device becomes
controlled by the EHCI controller since it's high speed capable.
* With -device usb-kbd,bus=usb-bus.0,port=1,usb_version=1, the
keyboard is directly attached to the port, but it only advertises
itself as full-speed capable, so it becomes controlled by the OHCI
controller.
In all cases, the keyboard device enumerates correctly.
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-24 00:06:36 +03:00
|
|
|
#include "hw/usb/hcd-ehci.h"
|
|
|
|
#include "hw/usb/hcd-ohci.h"
|
2020-09-11 08:20:51 +03:00
|
|
|
#include "target/arm/cpu.h"
|
2021-10-08 03:26:25 +03:00
|
|
|
#include "hw/sd/npcm7xx_sdhci.h"
|
2020-09-11 08:20:51 +03:00
|
|
|
|
|
|
|
#define NPCM7XX_MAX_NUM_CPUS (2)
|
|
|
|
|
|
|
|
/* The first half of the address space is reserved for DDR4 DRAM. */
|
|
|
|
#define NPCM7XX_DRAM_BA (0x00000000)
|
|
|
|
#define NPCM7XX_DRAM_SZ (2 * GiB)
|
|
|
|
|
|
|
|
/* Magic addresses for setting up direct kernel booting and SMP boot stubs. */
|
|
|
|
#define NPCM7XX_LOADER_START (0x00000000) /* Start of SDRAM */
|
|
|
|
#define NPCM7XX_SMP_LOADER_START (0xffff0000) /* Boot ROM */
|
|
|
|
#define NPCM7XX_SMP_BOOTREG_ADDR (0xf080013c) /* GCR.SCRPAD */
|
|
|
|
#define NPCM7XX_GIC_CPU_IF_ADDR (0xf03fe100) /* GIC within A9 */
|
2020-09-11 08:20:59 +03:00
|
|
|
#define NPCM7XX_BOARD_SETUP_ADDR (0xffff1000) /* Boot ROM */
|
2020-09-11 08:20:51 +03:00
|
|
|
|
2021-03-11 21:08:54 +03:00
|
|
|
#define NPCM7XX_NR_PWM_MODULES 2
|
|
|
|
|
2023-01-09 17:03:02 +03:00
|
|
|
struct NPCM7xxMachine {
|
2020-09-11 08:20:52 +03:00
|
|
|
MachineState parent;
|
2021-03-11 21:08:54 +03:00
|
|
|
/*
|
|
|
|
* PWM fan splitter. each splitter connects to one PWM output and
|
|
|
|
* multiple MFT inputs.
|
|
|
|
*/
|
|
|
|
SplitIRQ fan_splitter[NPCM7XX_NR_PWM_MODULES *
|
|
|
|
NPCM7XX_PWM_PER_MODULE];
|
2023-01-09 17:03:02 +03:00
|
|
|
};
|
2020-09-11 08:20:52 +03:00
|
|
|
|
|
|
|
#define TYPE_NPCM7XX_MACHINE MACHINE_TYPE_NAME("npcm7xx")
|
2023-01-09 17:03:02 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(NPCM7xxMachine, NPCM7XX_MACHINE)
|
2020-09-11 08:20:52 +03:00
|
|
|
|
|
|
|
typedef struct NPCM7xxMachineClass {
|
|
|
|
MachineClass parent;
|
|
|
|
|
|
|
|
const char *soc_type;
|
|
|
|
} NPCM7xxMachineClass;
|
|
|
|
|
|
|
|
#define NPCM7XX_MACHINE_CLASS(klass) \
|
|
|
|
OBJECT_CLASS_CHECK(NPCM7xxMachineClass, (klass), TYPE_NPCM7XX_MACHINE)
|
|
|
|
#define NPCM7XX_MACHINE_GET_CLASS(obj) \
|
|
|
|
OBJECT_GET_CLASS(NPCM7xxMachineClass, (obj), TYPE_NPCM7XX_MACHINE)
|
|
|
|
|
2023-01-09 17:03:02 +03:00
|
|
|
struct NPCM7xxState {
|
2020-09-11 08:20:51 +03:00
|
|
|
DeviceState parent;
|
|
|
|
|
|
|
|
ARMCPU cpu[NPCM7XX_MAX_NUM_CPUS];
|
|
|
|
A9MPPrivState a9mpcore;
|
|
|
|
|
|
|
|
MemoryRegion sram;
|
|
|
|
MemoryRegion irom;
|
|
|
|
MemoryRegion ram3;
|
|
|
|
MemoryRegion *dram;
|
|
|
|
|
|
|
|
NPCM7xxGCRState gcr;
|
|
|
|
NPCM7xxCLKState clk;
|
|
|
|
NPCM7xxTimerCtrlState tim[3];
|
2021-01-08 22:09:42 +03:00
|
|
|
NPCM7xxADCState adc;
|
2021-03-11 21:08:54 +03:00
|
|
|
NPCM7xxPWMState pwm[NPCM7XX_NR_PWM_MODULES];
|
2021-03-11 21:08:53 +03:00
|
|
|
NPCM7xxMFTState mft[8];
|
2020-09-11 08:20:55 +03:00
|
|
|
NPCM7xxOTPState key_storage;
|
|
|
|
NPCM7xxOTPState fuse_array;
|
2020-09-11 08:20:56 +03:00
|
|
|
NPCM7xxMCState mc;
|
2020-10-24 00:06:35 +03:00
|
|
|
NPCM7xxRNGState rng;
|
2020-10-24 00:06:37 +03:00
|
|
|
NPCM7xxGPIOState gpio[8];
|
2021-02-11 01:04:22 +03:00
|
|
|
NPCM7xxSMBusState smbus[16];
|
hw/arm/npcm7xx: Add EHCI and OHCI controllers
The NPCM730 and NPCM750 chips have a single USB host port shared between
a USB 2.0 EHCI host controller and a USB 1.1 OHCI host controller. This
adds support for both of them.
Testing notes:
* With -device usb-kbd, qemu will automatically insert a full-speed
hub, and the keyboard becomes controlled by the OHCI controller.
* With -device usb-kbd,bus=usb-bus.0,port=1, the keyboard is directly
attached to the port without any hubs, and the device becomes
controlled by the EHCI controller since it's high speed capable.
* With -device usb-kbd,bus=usb-bus.0,port=1,usb_version=1, the
keyboard is directly attached to the port, but it only advertises
itself as full-speed capable, so it becomes controlled by the OHCI
controller.
In all cases, the keyboard device enumerates correctly.
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-24 00:06:36 +03:00
|
|
|
EHCISysBusState ehci;
|
|
|
|
OHCISysBusState ohci;
|
2020-09-11 08:20:57 +03:00
|
|
|
NPCM7xxFIUState fiu[2];
|
2021-02-19 00:24:52 +03:00
|
|
|
NPCM7xxEMCState emc[2];
|
2021-10-08 03:26:25 +03:00
|
|
|
NPCM7xxSDHCIState mmc;
|
2023-02-09 02:54:33 +03:00
|
|
|
NPCMPSPIState pspi[2];
|
2023-01-09 17:03:02 +03:00
|
|
|
};
|
2020-09-11 08:20:51 +03:00
|
|
|
|
|
|
|
#define TYPE_NPCM7XX "npcm7xx"
|
2023-01-09 17:03:02 +03:00
|
|
|
OBJECT_DECLARE_TYPE(NPCM7xxState, NPCM7xxClass, NPCM7XX)
|
2020-09-11 08:20:51 +03:00
|
|
|
|
|
|
|
#define TYPE_NPCM730 "npcm730"
|
|
|
|
#define TYPE_NPCM750 "npcm750"
|
|
|
|
|
|
|
|
typedef struct NPCM7xxClass {
|
|
|
|
DeviceClass parent;
|
|
|
|
|
|
|
|
/* Bitmask of modules that are permanently disabled on this chip. */
|
|
|
|
uint32_t disabled_modules;
|
|
|
|
/* Number of CPU cores enabled in this SoC class (may be 1 or 2). */
|
|
|
|
uint32_t num_cpus;
|
|
|
|
} NPCM7xxClass;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* npcm7xx_load_kernel - Loads memory with everything needed to boot
|
|
|
|
* @machine - The machine containing the SoC to be booted.
|
|
|
|
* @soc - The SoC containing the CPU to be booted.
|
|
|
|
*
|
|
|
|
* This will set up the ARM boot info structure for the specific NPCM7xx
|
|
|
|
* derivative and call arm_load_kernel() to set up loading of the kernel, etc.
|
|
|
|
* into memory, if requested by the user.
|
|
|
|
*/
|
|
|
|
void npcm7xx_load_kernel(MachineState *machine, NPCM7xxState *soc);
|
|
|
|
|
|
|
|
#endif /* NPCM7XX_H */
|