2019-06-04 20:16:15 +02:00
|
|
|
#ifndef HW_ARM_ALLWINNER_A10_H
|
|
|
|
#define HW_ARM_ALLWINNER_A10_H
|
2013-12-17 20:42:38 +01:00
|
|
|
|
2019-05-23 15:47:43 +02:00
|
|
|
#include "hw/arm/boot.h"
|
2013-12-17 20:42:38 +01:00
|
|
|
#include "hw/timer/allwinner-a10-pit.h"
|
|
|
|
#include "hw/intc/allwinner-a10-pic.h"
|
2014-01-30 23:02:07 +01:00
|
|
|
#include "hw/net/allwinner_emac.h"
|
2020-03-11 23:18:44 +01:00
|
|
|
#include "hw/sd/allwinner-sdhost.h"
|
2015-11-06 20:09:01 +01:00
|
|
|
#include "hw/ide/ahci.h"
|
arm: allwinner: Wire up USB ports
Instantiate EHCI and OHCI controllers on Allwinner A10. OHCI ports are
modeled as companions of the respective EHCI ports.
With this patch applied, USB controllers are discovered and instantiated
when booting the cubieboard machine with a recent Linux kernel.
ehci-platform 1c14000.usb: EHCI Host Controller
ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1
ehci-platform 1c14000.usb: irq 26, io mem 0x01c14000
ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00
ehci-platform 1c1c000.usb: EHCI Host Controller
ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 2
ehci-platform 1c1c000.usb: irq 31, io mem 0x01c1c000
ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00
ohci-platform 1c14400.usb: Generic Platform OHCI controller
ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 3
ohci-platform 1c14400.usb: irq 27, io mem 0x01c14400
ohci-platform 1c1c400.usb: Generic Platform OHCI controller
ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 4
ohci-platform 1c1c400.usb: irq 32, io mem 0x01c1c400
usb 2-1: new high-speed USB device number 2 using ehci-platform
usb-storage 2-1:1.0: USB Mass Storage device detected
scsi host1: usb-storage 2-1:1.0
usb 3-1: new full-speed USB device number 2 using ohci-platform
input: QEMU QEMU USB Mouse as /devices/platform/soc/1c14400.usb/usb3/3-1/3-1:1.0/0003:0627:0001.0001/input/input0
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20200217204812.9857-4-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-02-17 21:48:12 +01:00
|
|
|
#include "hw/usb/hcd-ohci.h"
|
|
|
|
#include "hw/usb/hcd-ehci.h"
|
2020-03-11 23:18:48 +01:00
|
|
|
#include "hw/rtc/allwinner-rtc.h"
|
2022-12-26 23:02:57 +01:00
|
|
|
#include "hw/misc/allwinner-a10-ccm.h"
|
2022-12-26 23:02:58 +01:00
|
|
|
#include "hw/misc/allwinner-a10-dramc.h"
|
2022-12-26 23:02:59 +01:00
|
|
|
#include "hw/i2c/allwinner-i2c.h"
|
2023-04-20 11:21:13 +02:00
|
|
|
#include "hw/watchdog/allwinner-wdt.h"
|
2022-12-26 23:03:02 +01:00
|
|
|
#include "sysemu/block-backend.h"
|
2013-12-17 20:42:38 +01:00
|
|
|
|
2019-08-12 07:23:31 +02:00
|
|
|
#include "target/arm/cpu.h"
|
2020-09-03 22:43:22 +02:00
|
|
|
#include "qom/object.h"
|
2013-12-17 20:42:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
#define AW_A10_SDRAM_BASE 0x40000000
|
|
|
|
|
arm: allwinner: Wire up USB ports
Instantiate EHCI and OHCI controllers on Allwinner A10. OHCI ports are
modeled as companions of the respective EHCI ports.
With this patch applied, USB controllers are discovered and instantiated
when booting the cubieboard machine with a recent Linux kernel.
ehci-platform 1c14000.usb: EHCI Host Controller
ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1
ehci-platform 1c14000.usb: irq 26, io mem 0x01c14000
ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00
ehci-platform 1c1c000.usb: EHCI Host Controller
ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 2
ehci-platform 1c1c000.usb: irq 31, io mem 0x01c1c000
ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00
ohci-platform 1c14400.usb: Generic Platform OHCI controller
ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 3
ohci-platform 1c14400.usb: irq 27, io mem 0x01c14400
ohci-platform 1c1c400.usb: Generic Platform OHCI controller
ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 4
ohci-platform 1c1c400.usb: irq 32, io mem 0x01c1c400
usb 2-1: new high-speed USB device number 2 using ehci-platform
usb-storage 2-1:1.0: USB Mass Storage device detected
scsi host1: usb-storage 2-1:1.0
usb 3-1: new full-speed USB device number 2 using ohci-platform
input: QEMU QEMU USB Mouse as /devices/platform/soc/1c14400.usb/usb3/3-1/3-1:1.0/0003:0627:0001.0001/input/input0
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20200217204812.9857-4-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-02-17 21:48:12 +01:00
|
|
|
#define AW_A10_NUM_USB 2
|
|
|
|
|
2013-12-17 20:42:38 +01:00
|
|
|
#define TYPE_AW_A10 "allwinner-a10"
|
2020-09-16 20:25:19 +02:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(AwA10State, AW_A10)
|
2013-12-17 20:42:38 +01:00
|
|
|
|
2020-09-03 22:43:22 +02:00
|
|
|
struct AwA10State {
|
2013-12-17 20:42:38 +01:00
|
|
|
/*< private >*/
|
|
|
|
DeviceState parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
|
|
|
ARMCPU cpu;
|
2022-12-26 23:02:57 +01:00
|
|
|
AwA10ClockCtlState ccm;
|
2022-12-26 23:02:58 +01:00
|
|
|
AwA10DramControllerState dramc;
|
2013-12-17 20:42:38 +01:00
|
|
|
AwA10PITState timer;
|
|
|
|
AwA10PICState intc;
|
2014-01-30 23:02:07 +01:00
|
|
|
AwEmacState emac;
|
2015-11-06 20:09:01 +01:00
|
|
|
AllwinnerAHCIState sata;
|
2020-03-11 23:18:44 +01:00
|
|
|
AwSdHostState mmc0;
|
2022-12-26 23:02:59 +01:00
|
|
|
AWI2CState i2c0;
|
2020-03-11 23:18:48 +01:00
|
|
|
AwRtcState rtc;
|
2023-04-20 11:21:13 +02:00
|
|
|
AwWdtState wdt;
|
hw/arm/allwinner-a10: Add the 'A' SRAM and the SRAM controller
From the "A10 User Manual V1.20" p.29: "3.2. Memory Mapping" and:
7. System Control
7.1. Overview
A10 embeds a high-speed SRAM which has been split into five segments.
See detailed memory mapping in following table:
Area Address Size (Bytes)
A1 0x00000000-0x00003FFF 16K
A2 0x00004000-0x00007FFF 16K
A3 0x00008000-0x0000B3FF 13K
A4 0x0000B400-0x0000BFFF 3K
Since for emulation purpose we don't need the segmentations, we simply define
the 'A' area as a single 48KB SRAM.
We don't implement the following others areas:
- 'B': 'Secure RAM' (64K),
- 'C': Debug/ISP SRAM
- 'D': USB SRAM
(qemu) info mtree
address-space: memory
0000000000000000-ffffffffffffffff (prio 0, i/o): system
0000000000000000-000000000000bfff (prio 0, ram): sram A
0000000001c00000-0000000001c00fff (prio -1000, i/o): a10-sram-ctrl
0000000001c0b000-0000000001c0bfff (prio 0, i/o): aw_emac
0000000001c18000-0000000001c18fff (prio 0, i/o): ahci
0000000001c18080-0000000001c180ff (prio 0, i/o): allwinner-ahci
0000000001c20400-0000000001c207ff (prio 0, i/o): allwinner-a10-pic
0000000001c20c00-0000000001c20fff (prio 0, i/o): allwinner-A10-timer
0000000001c28000-0000000001c2801f (prio 0, i/o): serial
0000000040000000-0000000047ffffff (prio 0, ram): cubieboard.ram
Reported-by: Charlie Smurthwaite <charlie@atech.media>
Tested-by: Charlie Smurthwaite <charlie@atech.media>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20190104142921.878-1-f4bug@amsat.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-01-07 16:23:47 +01:00
|
|
|
MemoryRegion sram_a;
|
arm: allwinner: Wire up USB ports
Instantiate EHCI and OHCI controllers on Allwinner A10. OHCI ports are
modeled as companions of the respective EHCI ports.
With this patch applied, USB controllers are discovered and instantiated
when booting the cubieboard machine with a recent Linux kernel.
ehci-platform 1c14000.usb: EHCI Host Controller
ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1
ehci-platform 1c14000.usb: irq 26, io mem 0x01c14000
ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00
ehci-platform 1c1c000.usb: EHCI Host Controller
ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 2
ehci-platform 1c1c000.usb: irq 31, io mem 0x01c1c000
ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00
ohci-platform 1c14400.usb: Generic Platform OHCI controller
ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 3
ohci-platform 1c14400.usb: irq 27, io mem 0x01c14400
ohci-platform 1c1c400.usb: Generic Platform OHCI controller
ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 4
ohci-platform 1c1c400.usb: irq 32, io mem 0x01c1c400
usb 2-1: new high-speed USB device number 2 using ehci-platform
usb-storage 2-1:1.0: USB Mass Storage device detected
scsi host1: usb-storage 2-1:1.0
usb 3-1: new full-speed USB device number 2 using ohci-platform
input: QEMU QEMU USB Mouse as /devices/platform/soc/1c14400.usb/usb3/3-1/3-1:1.0/0003:0627:0001.0001/input/input0
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Message-id: 20200217204812.9857-4-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-02-17 21:48:12 +01:00
|
|
|
EHCISysBusState ehci[AW_A10_NUM_USB];
|
|
|
|
OHCISysBusState ohci[AW_A10_NUM_USB];
|
2020-09-03 22:43:22 +02:00
|
|
|
};
|
2013-12-17 20:42:38 +01:00
|
|
|
|
2022-12-26 23:03:02 +01:00
|
|
|
/**
|
|
|
|
* Emulate Boot ROM firmware setup functionality.
|
|
|
|
*
|
|
|
|
* A real Allwinner A10 SoC contains a Boot ROM
|
|
|
|
* which is the first code that runs right after
|
|
|
|
* the SoC is powered on. The Boot ROM is responsible
|
|
|
|
* for loading user code (e.g. a bootloader) from any
|
|
|
|
* of the supported external devices and writing the
|
|
|
|
* downloaded code to internal SRAM. After loading the SoC
|
|
|
|
* begins executing the code written to SRAM.
|
|
|
|
*
|
|
|
|
* This function emulates the Boot ROM by copying 32 KiB
|
|
|
|
* of data at offset 8 KiB from the given block device and writes it to
|
|
|
|
* the start of the first internal SRAM memory.
|
|
|
|
*
|
|
|
|
* @s: Allwinner A10 state object pointer
|
|
|
|
* @blk: Block backend device object pointer
|
|
|
|
*/
|
|
|
|
void allwinner_a10_bootrom_setup(AwA10State *s, BlockBackend *blk);
|
|
|
|
|
2013-12-17 20:42:38 +01:00
|
|
|
#endif
|