1
Last handful of arm patches before softfreeze...
1
Handful of bugfixes for rc2. None of these are particularly critical
2
or exciting.
2
3
3
The following changes since commit a98135f727595382e200d04c2996e868b7925a01:
4
-- PMM
4
5
5
Merge remote-tracking branch 'remotes/kraxel/tags/vga-20200316-pull-request' into staging (2020-03-16 14:55:59 +0000)
6
The following changes since commit 45a150aa2b3492acf6691c7bdbeb25a8545d8345:
7
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-08-03' into staging (2020-08-03 15:13:49 +0100)
6
9
7
are available in the Git repository at:
10
are available in the Git repository at:
8
11
9
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200317
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200803
10
13
11
for you to fetch changes up to e88d3671e3bbd59d385838a4101ea19cdcf47309:
14
for you to fetch changes up to 13557fd392890cbd985bceba7f717e01efd674b8:
12
15
13
hw/arm/pxa2xx: Do not wire up OHCI for PXA255 (2020-03-17 11:36:48 +0000)
16
hw/timer/imx_epit: Avoid assertion when CR.SWR is written (2020-08-03 17:56:11 +0100)
14
17
15
----------------------------------------------------------------
18
----------------------------------------------------------------
16
target-arm:
19
target-arm queue:
17
* hw/arm/pxa2xx: Do not wire up OHCI for PXA255
20
* hw/timer/imx_epit: Avoid assertion when CR.SWR is written
18
* aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command
21
* netduino2, netduinoplus2, microbit: set system_clock_scale so that
19
* m25p80: Improve command handling for Jedec and unsupported commands
22
SysTick running on the CPU clock works
20
* hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write()
23
* target/arm: Avoid maybe-uninitialized warning with gcc 4.9
21
* hw/arm/fsl-imx6, imx6ul: Wire up USB controllers
24
* target/arm: Fix AddPAC error indication
22
* hw/arm/fsl-imx6ul: Instantiate unimplemented pwm and can devices
25
* Make AIRCR.SYSRESETREQ actually reset the system for the
26
microbit, mps2-*, musca-*, netduino* boards
23
27
24
----------------------------------------------------------------
28
----------------------------------------------------------------
25
Chen Qun (1):
29
Kaige Li (1):
26
hw/net/imx_fec: write TGSR and TCSR3 in imx_enet_write()
30
target/arm: Avoid maybe-uninitialized warning with gcc 4.9
27
31
28
Guenter Roeck (10):
32
Peter Maydell (6):
29
hw/usb: Add basic i.MX USB Phy support
33
hw/arm/netduino2, netduinoplus2: Set system_clock_scale
30
hw/arm/fsl-imx6ul: Fix USB interrupt numbers
34
include/hw/irq.h: New function qemu_irq_is_connected()
31
hw/arm/fsl-imx6ul: Instantiate unimplemented pwm and can devices
35
hw/intc/armv7m_nvic: Provide default "reset the system" behaviour for SYSRESETREQ
32
hw/arm/fsl-imx6ul: Wire up USB controllers
36
msf2-soc, stellaris: Don't wire up SYSRESETREQ
33
hw/arm/fsl-imx6: Wire up USB controllers
37
hw/arm/nrf51_soc: Set system_clock_scale
34
m25p80: Convert to support tracing
38
hw/timer/imx_epit: Avoid assertion when CR.SWR is written
35
m25p80: Improve command handling for Jedec commands
36
m25p80: Improve command handling for unsupported commands
37
aspeed/smc: Fix number of dummy cycles for FAST_READ_4 command
38
hw/arm/pxa2xx: Do not wire up OHCI for PXA255
39
39
40
hw/usb/Makefile.objs | 2 +
40
Richard Henderson (1):
41
include/hw/arm/fsl-imx6.h | 6 ++
41
target/arm: Fix AddPAC error indication
42
include/hw/arm/fsl-imx6ul.h | 16 ++-
43
include/hw/usb/imx-usb-phy.h | 53 ++++++++++
44
hw/arm/fsl-imx6.c | 36 +++++++
45
hw/arm/fsl-imx6ul.c | 49 ++++++++++
46
hw/arm/pxa2xx.c | 3 -
47
hw/block/m25p80.c | 58 +++++------
48
hw/net/imx_fec.c | 6 +-
49
hw/ssi/aspeed_smc.c | 2 +-
50
hw/usb/imx-usb-phy.c | 225 +++++++++++++++++++++++++++++++++++++++++++
51
MAINTAINERS | 2 +
52
hw/arm/Kconfig | 1 +
53
hw/block/trace-events | 16 +++
54
hw/usb/Kconfig | 5 +
55
15 files changed, 444 insertions(+), 36 deletions(-)
56
create mode 100644 include/hw/usb/imx-usb-phy.h
57
create mode 100644 hw/usb/imx-usb-phy.c
58
42
43
include/hw/arm/armv7m.h | 4 +++-
44
include/hw/irq.h | 18 ++++++++++++++++++
45
hw/arm/msf2-soc.c | 11 -----------
46
hw/arm/netduino2.c | 10 ++++++++++
47
hw/arm/netduinoplus2.c | 10 ++++++++++
48
hw/arm/nrf51_soc.c | 5 +++++
49
hw/arm/stellaris.c | 12 ------------
50
hw/intc/armv7m_nvic.c | 17 ++++++++++++++++-
51
hw/timer/imx_epit.c | 13 ++++++++++---
52
target/arm/pauth_helper.c | 6 +++++-
53
target/arm/translate-a64.c | 2 +-
54
tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++++
55
tests/tcg/aarch64/Makefile.target | 2 +-
56
13 files changed, 112 insertions(+), 31 deletions(-)
57
create mode 100644 tests/tcg/aarch64/pauth-5.c
58
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The netduino2 and netduinoplus2 boards forgot to set the system_clock_scale
2
global, which meant that if guest code used the systick timer in "use
3
the processor clock" mode it would hang because time never advances.
2
4
3
Recent Linux kernels (post v4.20) crash due to accesses to flexcan
5
Set the global to match the documented CPU clock speed of these boards.
4
and pwm controllers. Instantiate as unimplemented devices to work
6
Judging by the data sheet this is slightly simplistic because the
5
around the problem.
7
SoC allows configuration of the SYSCLK source and frequency via the
8
RCC (reset and clock control) module, but we don't model that.
6
9
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
10
Fixes: https://bugs.launchpad.net/qemu/+bug/1876187
8
Message-id: 20200313014551.12554-4-linux@roeck-us.net
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
13
Message-id: 20200727162617.26227-1-peter.maydell@linaro.org
11
---
14
---
12
hw/arm/fsl-imx6ul.c | 14 ++++++++++++++
15
hw/arm/netduino2.c | 10 ++++++++++
13
1 file changed, 14 insertions(+)
16
hw/arm/netduinoplus2.c | 10 ++++++++++
17
2 files changed, 20 insertions(+)
14
18
15
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
19
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/fsl-imx6ul.c
21
--- a/hw/arm/netduino2.c
18
+++ b/hw/arm/fsl-imx6ul.c
22
+++ b/hw/arm/netduino2.c
19
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
23
@@ -XXX,XX +XXX,XX @@
20
*/
24
#include "hw/arm/stm32f205_soc.h"
21
create_unimplemented_device("sdma", FSL_IMX6UL_SDMA_ADDR, 0x4000);
25
#include "hw/arm/boot.h"
26
27
+/* Main SYSCLK frequency in Hz (120MHz) */
28
+#define SYSCLK_FRQ 120000000ULL
29
+
30
static void netduino2_init(MachineState *machine)
31
{
32
DeviceState *dev;
22
33
23
+ /*
34
+ /*
24
+ * PWM
35
+ * TODO: ideally we would model the SoC RCC and let it handle
36
+ * system_clock_scale, including its ability to define different
37
+ * possible SYSCLK sources.
25
+ */
38
+ */
26
+ create_unimplemented_device("pwm1", FSL_IMX6UL_PWM1_ADDR, 0x4000);
39
+ system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ;
27
+ create_unimplemented_device("pwm2", FSL_IMX6UL_PWM2_ADDR, 0x4000);
28
+ create_unimplemented_device("pwm3", FSL_IMX6UL_PWM3_ADDR, 0x4000);
29
+ create_unimplemented_device("pwm4", FSL_IMX6UL_PWM4_ADDR, 0x4000);
30
+
40
+
41
dev = qdev_new(TYPE_STM32F205_SOC);
42
qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"));
43
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
44
diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/netduinoplus2.c
47
+++ b/hw/arm/netduinoplus2.c
48
@@ -XXX,XX +XXX,XX @@
49
#include "hw/arm/stm32f405_soc.h"
50
#include "hw/arm/boot.h"
51
52
+/* Main SYSCLK frequency in Hz (168MHz) */
53
+#define SYSCLK_FRQ 168000000ULL
54
+
55
static void netduinoplus2_init(MachineState *machine)
56
{
57
DeviceState *dev;
58
31
+ /*
59
+ /*
32
+ * CAN
60
+ * TODO: ideally we would model the SoC RCC and let it handle
61
+ * system_clock_scale, including its ability to define different
62
+ * possible SYSCLK sources.
33
+ */
63
+ */
34
+ create_unimplemented_device("can1", FSL_IMX6UL_CAN1_ADDR, 0x4000);
64
+ system_clock_scale = NANOSECONDS_PER_SECOND / SYSCLK_FRQ;
35
+ create_unimplemented_device("can2", FSL_IMX6UL_CAN2_ADDR, 0x4000);
36
+
65
+
37
/*
66
dev = qdev_new(TYPE_STM32F405_SOC);
38
* APHB_DMA
67
qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4"));
39
*/
68
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
40
--
69
--
41
2.20.1
70
2.20.1
42
71
43
72
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
Mostly devices don't need to care whether one of their output
2
qemu_irq lines is connected, because functions like qemu_set_irq()
3
silently do nothing if there is nothing on the other end. However
4
sometimes a device might want to implement default behaviour for the
5
case where the machine hasn't wired the line up to anywhere.
2
6
3
Whenever an unsupported command is encountered, the current code
7
Provide a function qemu_irq_is_connected() that devices can use for
4
interprets each transferred byte as new command. Most of the time, those
8
this purpose. (The test is trivial but encapsulating it in a
5
'commands' are interpreted as new unknown commands. However, in rare
9
function makes it easier to see where we're doing it in case we need
6
cases, it may be that for example address or length information
10
to change the implementation later.)
7
passed with the original command is by itself a valid command.
8
If that happens, the state machine may get completely confused and,
9
worst case, start writing data into the flash or even erase it.
10
11
11
To avoid the problem, transition into STATE_READING_DATA and keep
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
sending a value of 0 until the chip is deselected after encountering
13
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
an unsupported command.
14
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
15
Message-id: 20200728103744.6909-2-peter.maydell@linaro.org
16
---
17
include/hw/irq.h | 18 ++++++++++++++++++
18
1 file changed, 18 insertions(+)
14
19
15
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
20
diff --git a/include/hw/irq.h b/include/hw/irq.h
16
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
Reviewed-by: Cédric Le Goater <clg@kaod.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/block/m25p80.c | 5 +++++
21
1 file changed, 5 insertions(+)
22
23
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
24
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/block/m25p80.c
22
--- a/include/hw/irq.h
26
+++ b/hw/block/m25p80.c
23
+++ b/include/hw/irq.h
27
@@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value)
24
@@ -XXX,XX +XXX,XX @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
28
s->quad_enable = false;
25
on an existing vector of qemu_irq. */
29
break;
26
void qemu_irq_intercept_in(qemu_irq *gpio_in, qemu_irq_handler handler, int n);
30
default:
27
31
+ s->pos = 0;
28
+/**
32
+ s->len = 1;
29
+ * qemu_irq_is_connected: Return true if IRQ line is wired up
33
+ s->state = STATE_READING_DATA;
30
+ *
34
+ s->data_read_loop = true;
31
+ * If a qemu_irq has a device on the other (receiving) end of it,
35
+ s->data[0] = 0;
32
+ * return true; otherwise return false.
36
qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Unknown cmd %x\n", value);
33
+ *
37
break;
34
+ * Usually device models don't need to care whether the machine model
38
}
35
+ * has wired up their outbound qemu_irq lines, because functions like
36
+ * qemu_set_irq() silently do nothing if there is nothing on the other
37
+ * end of the line. However occasionally a device model will want to
38
+ * provide default behaviour if its output is left floating, and
39
+ * it can use this function to identify when that is the case.
40
+ */
41
+static inline bool qemu_irq_is_connected(qemu_irq irq)
42
+{
43
+ return irq != NULL;
44
+}
45
+
46
#endif
39
--
47
--
40
2.20.1
48
2.20.1
41
49
42
50
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The NVIC provides an outbound qemu_irq "SYSRESETREQ" which it signals
2
when the guest sets the SYSRESETREQ bit in the AIRCR register. This
3
matches the hardware design (where the CPU has a signal of this name
4
and it is up to the SoC to connect that up to an actual reset
5
mechanism), but in QEMU it mostly results in duplicated code in SoC
6
objects and bugs where SoC model implementors forget to wire up the
7
SYSRESETREQ line.
2
8
3
IMX6UL USB controllers are quite similar to IMX7 USB controllers.
9
Provide a default behaviour for the case where SYSRESETREQ is not
4
Wire them up the same way.
10
actually connected to anything: use qemu_system_reset_request() to
11
perform a system reset. This will allow us to remove the
12
implementations of SYSRESETREQ handling from the boards where that's
13
exactly what it does, and also fixes the bugs in the board models
14
which forgot to wire up the signal:
5
15
6
The only real difference is that wiring up phy devices is necessary
16
* microbit
7
to avoid phy reset timeouts in the Linux kernel.
17
* mps2-an385
18
* mps2-an505
19
* mps2-an511
20
* mps2-an521
21
* musca-a
22
* musca-b1
23
* netduino
24
* netduinoplus2
8
25
9
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
26
We still allow the board to wire up the signal if it needs to, in case
10
Message-id: 20200313014551.12554-5-linux@roeck-us.net
27
we need to model more complicated reset controller logic or to model
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
28
buggy SoC hardware which forgot to wire up the line itself. But
29
defaulting to "reset the system" is more often going to be correct
30
than defaulting to "do nothing".
31
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
34
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
35
Message-id: 20200728103744.6909-3-peter.maydell@linaro.org
13
---
36
---
14
include/hw/arm/fsl-imx6ul.h | 10 ++++++++++
37
include/hw/arm/armv7m.h | 4 +++-
15
hw/arm/fsl-imx6ul.c | 35 +++++++++++++++++++++++++++++++++++
38
hw/intc/armv7m_nvic.c | 17 ++++++++++++++++-
16
2 files changed, 45 insertions(+)
39
2 files changed, 19 insertions(+), 2 deletions(-)
17
40
18
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
41
diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h
19
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/arm/fsl-imx6ul.h
43
--- a/include/hw/arm/armv7m.h
21
+++ b/include/hw/arm/fsl-imx6ul.h
44
+++ b/include/hw/arm/armv7m.h
45
@@ -XXX,XX +XXX,XX @@ typedef struct {
46
47
/* ARMv7M container object.
48
* + Unnamed GPIO input lines: external IRQ lines for the NVIC
49
- * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ
50
+ * + Named GPIO output SYSRESETREQ: signalled for guest AIRCR.SYSRESETREQ.
51
+ * If this GPIO is not wired up then the NVIC will default to performing
52
+ * a qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET).
53
* + Property "cpu-type": CPU type to instantiate
54
* + Property "num-irq": number of external IRQ lines
55
* + Property "memory": MemoryRegion defining the physical address space
56
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/hw/intc/armv7m_nvic.c
59
+++ b/hw/intc/armv7m_nvic.c
22
@@ -XXX,XX +XXX,XX @@
60
@@ -XXX,XX +XXX,XX @@
23
#include "hw/sd/sdhci.h"
61
#include "hw/intc/armv7m_nvic.h"
24
#include "hw/ssi/imx_spi.h"
62
#include "hw/irq.h"
25
#include "hw/net/imx_fec.h"
63
#include "hw/qdev-properties.h"
26
+#include "hw/usb/chipidea.h"
64
+#include "sysemu/runstate.h"
27
+#include "hw/usb/imx-usb-phy.h"
65
#include "target/arm/cpu.h"
28
#include "exec/memory.h"
66
#include "exec/exec-all.h"
29
#include "cpu.h"
67
#include "exec/memop.h"
30
68
@@ -XXX,XX +XXX,XX @@ static const uint8_t nvic_id[] = {
31
@@ -XXX,XX +XXX,XX @@ enum FslIMX6ULConfiguration {
69
0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1
32
FSL_IMX6UL_NUM_I2CS = 4,
33
FSL_IMX6UL_NUM_ECSPIS = 4,
34
FSL_IMX6UL_NUM_ADCS = 2,
35
+ FSL_IMX6UL_NUM_USB_PHYS = 2,
36
+ FSL_IMX6UL_NUM_USBS = 2,
37
};
70
};
38
71
39
typedef struct FslIMX6ULState {
72
+static void signal_sysresetreq(NVICState *s)
40
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6ULState {
73
+{
41
IMXFECState eth[FSL_IMX6UL_NUM_ETHS];
74
+ if (qemu_irq_is_connected(s->sysresetreq)) {
42
SDHCIState usdhc[FSL_IMX6UL_NUM_USDHCS];
75
+ qemu_irq_pulse(s->sysresetreq);
43
IMX2WdtState wdt[FSL_IMX6UL_NUM_WDTS];
76
+ } else {
44
+ IMXUSBPHYState usbphy[FSL_IMX6UL_NUM_USB_PHYS];
77
+ /*
45
+ ChipideaState usb[FSL_IMX6UL_NUM_USBS];
78
+ * Default behaviour if the SoC doesn't need to wire up
46
MemoryRegion rom;
79
+ * SYSRESETREQ (eg to a system reset controller of some kind):
47
MemoryRegion caam;
80
+ * perform a system reset via the usual QEMU API.
48
MemoryRegion ocram;
81
+ */
49
@@ -XXX,XX +XXX,XX @@ enum FslIMX6ULMemoryMap {
82
+ qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
50
FSL_IMX6UL_EPIT2_ADDR = 0x020D4000,
51
FSL_IMX6UL_EPIT1_ADDR = 0x020D0000,
52
FSL_IMX6UL_SNVS_HP_ADDR = 0x020CC000,
53
+ FSL_IMX6UL_USBPHY2_ADDR = 0x020CA000,
54
+ FSL_IMX6UL_USBPHY2_SIZE = (4 * 1024),
55
+ FSL_IMX6UL_USBPHY1_ADDR = 0x020C9000,
56
+ FSL_IMX6UL_USBPHY1_SIZE = (4 * 1024),
57
FSL_IMX6UL_ANALOG_ADDR = 0x020C8000,
58
FSL_IMX6UL_CCM_ADDR = 0x020C4000,
59
FSL_IMX6UL_WDOG2_ADDR = 0x020C0000,
60
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
61
index XXXXXXX..XXXXXXX 100644
62
--- a/hw/arm/fsl-imx6ul.c
63
+++ b/hw/arm/fsl-imx6ul.c
64
@@ -XXX,XX +XXX,XX @@
65
#include "qapi/error.h"
66
#include "hw/arm/fsl-imx6ul.h"
67
#include "hw/misc/unimp.h"
68
+#include "hw/usb/imx-usb-phy.h"
69
#include "hw/boards.h"
70
#include "sysemu/sysemu.h"
71
#include "qemu/error-report.h"
72
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_init(Object *obj)
73
TYPE_IMX_ENET);
74
}
75
76
+ /* USB */
77
+ for (i = 0; i < FSL_IMX6UL_NUM_USB_PHYS; i++) {
78
+ snprintf(name, NAME_SIZE, "usbphy%d", i);
79
+ sysbus_init_child_obj(obj, name, &s->usbphy[i], sizeof(s->usbphy[i]),
80
+ TYPE_IMX_USBPHY);
81
+ }
83
+ }
82
+ for (i = 0; i < FSL_IMX6UL_NUM_USBS; i++) {
84
+}
83
+ snprintf(name, NAME_SIZE, "usb%d", i);
84
+ sysbus_init_child_obj(obj, name, &s->usb[i], sizeof(s->usb[i]),
85
+ TYPE_CHIPIDEA);
86
+ }
87
+
85
+
88
/*
86
static int nvic_pending_prio(NVICState *s)
89
* SDHCI
87
{
90
*/
88
/* return the group priority of the current pending interrupt,
91
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
89
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
92
FSL_IMX6UL_ENETn_TIMER_IRQ[i]));
90
if (value & R_V7M_AIRCR_SYSRESETREQ_MASK) {
93
}
91
if (attrs.secure ||
94
92
!(cpu->env.v7m.aircr & R_V7M_AIRCR_SYSRESETREQS_MASK)) {
95
+ /* USB */
93
- qemu_irq_pulse(s->sysresetreq);
96
+ for (i = 0; i < FSL_IMX6UL_NUM_USB_PHYS; i++) {
94
+ signal_sysresetreq(s);
97
+ object_property_set_bool(OBJECT(&s->usbphy[i]), true, "realized",
95
}
98
+ &error_abort);
96
}
99
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->usbphy[i]), 0,
97
if (value & R_V7M_AIRCR_VECTCLRACTIVE_MASK) {
100
+ FSL_IMX6UL_USBPHY1_ADDR + i * 0x1000);
101
+ }
102
+
103
+ for (i = 0; i < FSL_IMX6UL_NUM_USBS; i++) {
104
+ static const int FSL_IMX6UL_USBn_IRQ[] = {
105
+ FSL_IMX6UL_USB1_IRQ,
106
+ FSL_IMX6UL_USB2_IRQ,
107
+ };
108
+ object_property_set_bool(OBJECT(&s->usb[i]), true, "realized",
109
+ &error_abort);
110
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0,
111
+ FSL_IMX6UL_USBO2_USB_ADDR + i * 0x200);
112
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
113
+ qdev_get_gpio_in(DEVICE(&s->a7mpcore),
114
+ FSL_IMX6UL_USBn_IRQ[i]));
115
+ }
116
+
117
/*
118
* USDHC
119
*/
120
--
98
--
121
2.20.1
99
2.20.1
122
100
123
101
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The MSF2 SoC model and the Stellaris board code both wire
2
SYSRESETREQ up to a function that just invokes
3
qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
4
This is now the default action that the NVIC does if the line is
5
not connected, so we can delete the handling code.
2
6
3
While at it, add some trace messages to help debug problems
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
seen when running the latest Linux kernel.
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-id: 20200728103744.6909-4-peter.maydell@linaro.org
11
---
12
hw/arm/msf2-soc.c | 11 -----------
13
hw/arm/stellaris.c | 12 ------------
14
2 files changed, 23 deletions(-)
5
15
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
16
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Reviewed-by: Cédric Le Goater <clg@kaod.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
hw/block/m25p80.c | 48 ++++++++++++++++++++-----------------------
13
hw/block/trace-events | 16 +++++++++++++++
14
2 files changed, 38 insertions(+), 26 deletions(-)
15
16
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/block/m25p80.c
18
--- a/hw/arm/msf2-soc.c
19
+++ b/hw/block/m25p80.c
19
+++ b/hw/arm/msf2-soc.c
20
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@
21
#include "qemu/module.h"
21
#include "hw/irq.h"
22
#include "qemu/error-report.h"
22
#include "hw/arm/msf2-soc.h"
23
#include "qapi/error.h"
23
#include "hw/misc/unimp.h"
24
-#include "sysemu/runstate.h"
25
#include "sysemu/sysemu.h"
26
27
#define MSF2_TIMER_BASE 0x40004000
28
@@ -XXX,XX +XXX,XX @@ static const int spi_irq[MSF2_NUM_SPIS] = { 2, 3 };
29
static const int uart_irq[MSF2_NUM_UARTS] = { 10, 11 };
30
static const int timer_irq[MSF2_NUM_TIMERS] = { 14, 15 };
31
32
-static void do_sys_reset(void *opaque, int n, int level)
33
-{
34
- if (level) {
35
- qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
36
- }
37
-}
24
-
38
-
25
-#ifndef M25P80_ERR_DEBUG
39
static void m2sxxx_soc_initfn(Object *obj)
26
-#define M25P80_ERR_DEBUG 0
40
{
27
-#endif
41
MSF2State *s = MSF2_SOC(obj);
42
@@ -XXX,XX +XXX,XX @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
43
return;
44
}
45
46
- qdev_connect_gpio_out_named(DEVICE(&s->armv7m.nvic), "SYSRESETREQ", 0,
47
- qemu_allocate_irq(&do_sys_reset, NULL, 0));
28
-
48
-
29
-#define DB_PRINT_L(level, ...) do { \
49
system_clock_scale = NANOSECONDS_PER_SECOND / s->m3clk;
30
- if (M25P80_ERR_DEBUG > (level)) { \
50
31
- fprintf(stderr, ": %s: ", __func__); \
51
for (i = 0; i < MSF2_NUM_UARTS; i++) {
32
- fprintf(stderr, ## __VA_ARGS__); \
52
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
33
- } \
53
index XXXXXXX..XXXXXXX 100644
34
-} while (0)
54
--- a/hw/arm/stellaris.c
35
+#include "trace.h"
55
+++ b/hw/arm/stellaris.c
36
56
@@ -XXX,XX +XXX,XX @@
37
/* Fields for FlashPartInfo->flags */
57
#include "hw/boards.h"
38
58
#include "qemu/log.h"
39
@@ -XXX,XX +XXX,XX @@ static void flash_erase(Flash *s, int offset, FlashCMD cmd)
59
#include "exec/address-spaces.h"
40
abort();
60
-#include "sysemu/runstate.h"
41
}
61
#include "sysemu/sysemu.h"
42
62
#include "hw/arm/armv7m.h"
43
- DB_PRINT_L(0, "offset = %#x, len = %d\n", offset, len);
63
#include "hw/char/pl011.h"
44
+ trace_m25p80_flash_erase(s, offset, len);
64
@@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj)
45
+
65
qdev_init_gpio_in(dev, stellaris_adc_trigger, 1);
46
if ((s->pi->flags & capa_to_assert) != capa_to_assert) {
47
qemu_log_mask(LOG_GUEST_ERROR, "M25P80: %d erase size not supported by"
48
" device\n", len);
49
@@ -XXX,XX +XXX,XX @@ void flash_write8(Flash *s, uint32_t addr, uint8_t data)
50
}
51
52
if ((prev ^ data) & data) {
53
- DB_PRINT_L(1, "programming zero to one! addr=%" PRIx32 " %" PRIx8
54
- " -> %" PRIx8 "\n", addr, prev, data);
55
+ trace_m25p80_programming_zero_to_one(s, addr, prev, data);
56
}
57
58
if (s->pi->flags & EEPROM) {
59
@@ -XXX,XX +XXX,XX @@ static void complete_collecting_data(Flash *s)
60
61
s->state = STATE_IDLE;
62
63
+ trace_m25p80_complete_collecting(s, s->cmd_in_progress, n, s->ear,
64
+ s->cur_addr);
65
+
66
switch (s->cmd_in_progress) {
67
case DPP:
68
case QPP:
69
@@ -XXX,XX +XXX,XX @@ static void reset_memory(Flash *s)
70
break;
71
}
72
73
- DB_PRINT_L(0, "Reset done.\n");
74
+ trace_m25p80_reset_done(s);
75
}
66
}
76
67
77
static void decode_fast_read_cmd(Flash *s)
68
-static
78
@@ -XXX,XX +XXX,XX @@ static void decode_qio_read_cmd(Flash *s)
69
-void do_sys_reset(void *opaque, int n, int level)
79
70
-{
80
static void decode_new_cmd(Flash *s, uint32_t value)
71
- if (level) {
81
{
72
- qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
82
- s->cmd_in_progress = value;
73
- }
83
int i;
74
-}
84
- DB_PRINT_L(0, "decoded new command:%x\n", value);
75
-
85
+
76
/* Board init. */
86
+ s->cmd_in_progress = value;
77
static stellaris_board_info stellaris_boards[] = {
87
+ trace_m25p80_command_decoded(s, value);
78
{ "LM3S811EVB",
88
79
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
89
if (value != RESET_MEMORY) {
80
/* This will exit with an error if the user passed us a bad cpu_type */
90
s->reset_enable = false;
81
sysbus_realize_and_unref(SYS_BUS_DEVICE(nvic), &error_fatal);
91
@@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value)
82
92
break;
83
- qdev_connect_gpio_out_named(nvic, "SYSRESETREQ", 0,
93
84
- qemu_allocate_irq(&do_sys_reset, NULL, 0));
94
case JEDEC_READ:
85
-
95
- DB_PRINT_L(0, "populated jedec code\n");
86
if (board->dc1 & (1 << 16)) {
96
+ trace_m25p80_populated_jedec(s);
87
dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000,
97
for (i = 0; i < s->pi->id_len; i++) {
88
qdev_get_gpio_in(nvic, 14),
98
s->data[i] = s->pi->id[i];
99
}
100
@@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value)
101
case BULK_ERASE_60:
102
case BULK_ERASE:
103
if (s->write_enable) {
104
- DB_PRINT_L(0, "chip erase\n");
105
+ trace_m25p80_chip_erase(s);
106
flash_erase(s, 0, BULK_ERASE);
107
} else {
108
qemu_log_mask(LOG_GUEST_ERROR, "M25P80: chip erase with write "
109
@@ -XXX,XX +XXX,XX @@ static int m25p80_cs(SSISlave *ss, bool select)
110
s->data_read_loop = false;
111
}
112
113
- DB_PRINT_L(0, "%sselect\n", select ? "de" : "");
114
+ trace_m25p80_select(s, select ? "de" : "");
115
116
return 0;
117
}
118
@@ -XXX,XX +XXX,XX @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
119
Flash *s = M25P80(ss);
120
uint32_t r = 0;
121
122
+ trace_m25p80_transfer(s, s->state, s->len, s->needed_bytes, s->pos,
123
+ s->cur_addr, (uint8_t)tx);
124
+
125
switch (s->state) {
126
127
case STATE_PAGE_PROGRAM:
128
- DB_PRINT_L(1, "page program cur_addr=%#" PRIx32 " data=%" PRIx8 "\n",
129
- s->cur_addr, (uint8_t)tx);
130
+ trace_m25p80_page_program(s, s->cur_addr, (uint8_t)tx);
131
flash_write8(s, s->cur_addr, (uint8_t)tx);
132
s->cur_addr = (s->cur_addr + 1) & (s->size - 1);
133
break;
134
135
case STATE_READ:
136
r = s->storage[s->cur_addr];
137
- DB_PRINT_L(1, "READ 0x%" PRIx32 "=%" PRIx8 "\n", s->cur_addr,
138
- (uint8_t)r);
139
+ trace_m25p80_read_byte(s, s->cur_addr, (uint8_t)r);
140
s->cur_addr = (s->cur_addr + 1) & (s->size - 1);
141
break;
142
143
@@ -XXX,XX +XXX,XX @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
144
}
145
146
r = s->data[s->pos];
147
+ trace_m25p80_read_data(s, s->pos, (uint8_t)r);
148
s->pos++;
149
if (s->pos == s->len) {
150
s->pos = 0;
151
@@ -XXX,XX +XXX,XX @@ static void m25p80_realize(SSISlave *ss, Error **errp)
152
return;
153
}
154
155
- DB_PRINT_L(0, "Binding to IF_MTD drive\n");
156
+ trace_m25p80_binding(s);
157
s->storage = blk_blockalign(s->blk, s->size);
158
159
if (blk_pread(s->blk, 0, s->storage, s->size) != s->size) {
160
@@ -XXX,XX +XXX,XX @@ static void m25p80_realize(SSISlave *ss, Error **errp)
161
return;
162
}
163
} else {
164
- DB_PRINT_L(0, "No BDRV - binding to RAM\n");
165
+ trace_m25p80_binding_no_bdrv(s);
166
s->storage = blk_blockalign(NULL, s->size);
167
memset(s->storage, 0xFF, s->size);
168
}
169
diff --git a/hw/block/trace-events b/hw/block/trace-events
170
index XXXXXXX..XXXXXXX 100644
171
--- a/hw/block/trace-events
172
+++ b/hw/block/trace-events
173
@@ -XXX,XX +XXX,XX @@ xen_block_blockdev_add(char *str) "%s"
174
xen_block_blockdev_del(const char *node_name) "%s"
175
xen_block_device_create(unsigned int number) "%u"
176
xen_block_device_destroy(unsigned int number) "%u"
177
+
178
+# m25p80.c
179
+m25p80_flash_erase(void *s, int offset, uint32_t len) "[%p] offset = 0x%"PRIx32", len = %u"
180
+m25p80_programming_zero_to_one(void *s, uint32_t addr, uint8_t prev, uint8_t data) "[%p] programming zero to one! addr=0x%"PRIx32" 0x%"PRIx8" -> 0x%"PRIx8
181
+m25p80_reset_done(void *s) "[%p] Reset done."
182
+m25p80_command_decoded(void *s, uint32_t cmd) "[%p] new command:0x%"PRIx32
183
+m25p80_complete_collecting(void *s, uint32_t cmd, int n, uint8_t ear, uint32_t cur_addr) "[%p] decode cmd: 0x%"PRIx32" len %d ear 0x%"PRIx8" addr 0x%"PRIx32
184
+m25p80_populated_jedec(void *s) "[%p] populated jedec code"
185
+m25p80_chip_erase(void *s) "[%p] chip erase"
186
+m25p80_select(void *s, const char *what) "[%p] %sselect"
187
+m25p80_page_program(void *s, uint32_t addr, uint8_t tx) "[%p] page program cur_addr=0x%"PRIx32" data=0x%"PRIx8
188
+m25p80_transfer(void *s, uint8_t state, uint32_t len, uint8_t needed, uint32_t pos, uint32_t cur_addr, uint8_t t) "[%p] Transfer state 0x%"PRIx8" len 0x%"PRIx32" needed 0x%"PRIx8" pos 0x%"PRIx32" addr 0x%"PRIx32" tx 0x%"PRIx8
189
+m25p80_read_byte(void *s, uint32_t addr, uint8_t v) "[%p] Read byte 0x%"PRIx32"=0x%"PRIx8
190
+m25p80_read_data(void *s, uint32_t pos, uint8_t v) "[%p] Read data 0x%"PRIx32"=0x%"PRIx8
191
+m25p80_binding(void *s) "[%p] Binding to IF_MTD drive"
192
+m25p80_binding_no_bdrv(void *s) "[%p] No BDRV - binding to RAM"
193
--
89
--
194
2.20.1
90
2.20.1
195
91
196
92
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Add basic USB PHY support as implemented in i.MX23, i.MX28, i.MX6,
3
The definition of top_bit used in this function is one higher
4
and i.MX7 SoCs.
4
than that used in the Arm ARM psuedo-code, which put the error
5
indication at top_bit - 1 at the wrong place, which meant that
6
it wasn't visible to Auth.
5
7
6
The only support really needed - at least to boot Linux - is support
8
Fixing the definition of top_bit requires more changes, because
7
for soft reset, which needs to reset various registers to their initial
9
its most common use is for the count of bits in top_bit:bot_bit,
8
value. Otherwise, just record register values.
10
which would then need to be computed as top_bit - bot_bit + 1.
9
11
12
For now, prefer the minimal fix to the error indication alone.
13
14
Fixes: 63ff0ca94cb
15
Reported-by: Derrick McKee <derrick.mckee@gmail.com>
16
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20200728195706.11087-1-richard.henderson@linaro.org
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
19
[PMM: added comment about the divergence from the pseudocode]
12
Message-id: 20200313014551.12554-2-linux@roeck-us.net
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
21
---
15
hw/usb/Makefile.objs | 2 +
22
target/arm/pauth_helper.c | 6 +++++-
16
include/hw/usb/imx-usb-phy.h | 53 +++++++++
23
tests/tcg/aarch64/pauth-5.c | 33 +++++++++++++++++++++++++++++++
17
hw/usb/imx-usb-phy.c | 225 +++++++++++++++++++++++++++++++++++
24
tests/tcg/aarch64/Makefile.target | 2 +-
18
MAINTAINERS | 2 +
25
3 files changed, 39 insertions(+), 2 deletions(-)
19
hw/arm/Kconfig | 1 +
26
create mode 100644 tests/tcg/aarch64/pauth-5.c
20
hw/usb/Kconfig | 5 +
21
6 files changed, 288 insertions(+)
22
create mode 100644 include/hw/usb/imx-usb-phy.h
23
create mode 100644 hw/usb/imx-usb-phy.c
24
27
25
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
28
diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
26
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
27
--- a/hw/usb/Makefile.objs
30
--- a/target/arm/pauth_helper.c
28
+++ b/hw/usb/Makefile.objs
31
+++ b/target/arm/pauth_helper.c
29
@@ -XXX,XX +XXX,XX @@ common-obj-$(CONFIG_XEN) += xen-usb.o
32
@@ -XXX,XX +XXX,XX @@ static uint64_t pauth_addpac(CPUARMState *env, uint64_t ptr, uint64_t modifier,
30
xen-usb.o-cflags := $(LIBUSB_CFLAGS)
33
*/
31
xen-usb.o-libs := $(LIBUSB_LIBS)
34
test = sextract64(ptr, bot_bit, top_bit - bot_bit);
32
endif
35
if (test != 0 && test != -1) {
33
+
36
- pac ^= MAKE_64BIT_MASK(top_bit - 1, 1);
34
+common-obj-$(CONFIG_IMX_USBPHY) += imx-usb-phy.o
37
+ /*
35
diff --git a/include/hw/usb/imx-usb-phy.h b/include/hw/usb/imx-usb-phy.h
38
+ * Note that our top_bit is one greater than the pseudocode's
39
+ * version, hence "- 2" here.
40
+ */
41
+ pac ^= MAKE_64BIT_MASK(top_bit - 2, 1);
42
}
43
44
/*
45
diff --git a/tests/tcg/aarch64/pauth-5.c b/tests/tcg/aarch64/pauth-5.c
36
new file mode 100644
46
new file mode 100644
37
index XXXXXXX..XXXXXXX
47
index XXXXXXX..XXXXXXX
38
--- /dev/null
48
--- /dev/null
39
+++ b/include/hw/usb/imx-usb-phy.h
49
+++ b/tests/tcg/aarch64/pauth-5.c
40
@@ -XXX,XX +XXX,XX @@
50
@@ -XXX,XX +XXX,XX @@
41
+#ifndef IMX_USB_PHY_H
51
+#include <assert.h>
42
+#define IMX_USB_PHY_H
43
+
52
+
44
+#include "hw/sysbus.h"
53
+static int x;
45
+#include "qemu/bitops.h"
46
+
54
+
47
+enum IMXUsbPhyRegisters {
55
+int main()
48
+ USBPHY_PWD,
56
+{
49
+ USBPHY_PWD_SET,
57
+ int *p0 = &x, *p1, *p2, *p3;
50
+ USBPHY_PWD_CLR,
58
+ unsigned long salt = 0;
51
+ USBPHY_PWD_TOG,
52
+ USBPHY_TX,
53
+ USBPHY_TX_SET,
54
+ USBPHY_TX_CLR,
55
+ USBPHY_TX_TOG,
56
+ USBPHY_RX,
57
+ USBPHY_RX_SET,
58
+ USBPHY_RX_CLR,
59
+ USBPHY_RX_TOG,
60
+ USBPHY_CTRL,
61
+ USBPHY_CTRL_SET,
62
+ USBPHY_CTRL_CLR,
63
+ USBPHY_CTRL_TOG,
64
+ USBPHY_STATUS,
65
+ USBPHY_DEBUG = 0x14,
66
+ USBPHY_DEBUG_SET,
67
+ USBPHY_DEBUG_CLR,
68
+ USBPHY_DEBUG_TOG,
69
+ USBPHY_DEBUG0_STATUS,
70
+ USBPHY_DEBUG1 = 0x1c,
71
+ USBPHY_DEBUG1_SET,
72
+ USBPHY_DEBUG1_CLR,
73
+ USBPHY_DEBUG1_TOG,
74
+ USBPHY_VERSION,
75
+ USBPHY_MAX
76
+};
77
+
59
+
78
+#define USBPHY_CTRL_SFTRST BIT(31)
60
+ /*
61
+ * With TBI enabled and a 48-bit VA, there are 7 bits of auth, and so
62
+ * a 1/128 chance of auth = pac(ptr,key,salt) producing zero.
63
+ * Find a salt that creates auth != 0.
64
+ */
65
+ do {
66
+ salt++;
67
+ asm("pacda %0, %1" : "=r"(p1) : "r"(salt), "0"(p0));
68
+ } while (p0 == p1);
79
+
69
+
80
+#define TYPE_IMX_USBPHY "imx.usbphy"
70
+ /*
81
+#define IMX_USBPHY(obj) OBJECT_CHECK(IMXUSBPHYState, (obj), TYPE_IMX_USBPHY)
71
+ * This pac must fail, because the input pointer bears an encryption,
72
+ * and so is not properly extended within bits [55:47]. This will
73
+ * toggle bit 54 in the output...
74
+ */
75
+ asm("pacda %0, %1" : "=r"(p2) : "r"(salt), "0"(p1));
82
+
76
+
83
+typedef struct IMXUSBPHYState {
77
+ /* ... so that the aut must fail, setting bit 53 in the output ... */
84
+ /* <private> */
78
+ asm("autda %0, %1" : "=r"(p3) : "r"(salt), "0"(p2));
85
+ SysBusDevice parent_obj;
86
+
79
+
87
+ /* <public> */
80
+ /* ... which means this equality must not hold. */
88
+ MemoryRegion iomem;
81
+ assert(p3 != p0);
89
+
82
+ return 0;
90
+ uint32_t usbphy[USBPHY_MAX];
91
+} IMXUSBPHYState;
92
+
93
+#endif /* IMX_USB_PHY_H */
94
diff --git a/hw/usb/imx-usb-phy.c b/hw/usb/imx-usb-phy.c
95
new file mode 100644
96
index XXXXXXX..XXXXXXX
97
--- /dev/null
98
+++ b/hw/usb/imx-usb-phy.c
99
@@ -XXX,XX +XXX,XX @@
100
+/*
101
+ * i.MX USB PHY
102
+ *
103
+ * Copyright (c) 2020 Guenter Roeck <linux@roeck-us.net>
104
+ *
105
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
106
+ * See the COPYING file in the top-level directory.
107
+ *
108
+ * We need to implement basic reset control in the PHY control register.
109
+ * For everything else, it is sufficient to set whatever is written.
110
+ */
111
+
112
+#include "qemu/osdep.h"
113
+#include "hw/usb/imx-usb-phy.h"
114
+#include "migration/vmstate.h"
115
+#include "qemu/log.h"
116
+#include "qemu/module.h"
117
+
118
+static const VMStateDescription vmstate_imx_usbphy = {
119
+ .name = TYPE_IMX_USBPHY,
120
+ .version_id = 1,
121
+ .minimum_version_id = 1,
122
+ .fields = (VMStateField[]) {
123
+ VMSTATE_UINT32_ARRAY(usbphy, IMXUSBPHYState, USBPHY_MAX),
124
+ VMSTATE_END_OF_LIST()
125
+ },
126
+};
127
+
128
+static void imx_usbphy_softreset(IMXUSBPHYState *s)
129
+{
130
+ s->usbphy[USBPHY_PWD] = 0x001e1c00;
131
+ s->usbphy[USBPHY_TX] = 0x10060607;
132
+ s->usbphy[USBPHY_RX] = 0x00000000;
133
+ s->usbphy[USBPHY_CTRL] = 0xc0200000;
134
+}
83
+}
135
+
84
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
136
+static void imx_usbphy_reset(DeviceState *dev)
137
+{
138
+ IMXUSBPHYState *s = IMX_USBPHY(dev);
139
+
140
+ s->usbphy[USBPHY_STATUS] = 0x00000000;
141
+ s->usbphy[USBPHY_DEBUG] = 0x7f180000;
142
+ s->usbphy[USBPHY_DEBUG0_STATUS] = 0x00000000;
143
+ s->usbphy[USBPHY_DEBUG1] = 0x00001000;
144
+ s->usbphy[USBPHY_VERSION] = 0x04020000;
145
+
146
+ imx_usbphy_softreset(s);
147
+}
148
+
149
+static uint64_t imx_usbphy_read(void *opaque, hwaddr offset, unsigned size)
150
+{
151
+ IMXUSBPHYState *s = (IMXUSBPHYState *)opaque;
152
+ uint32_t index = offset >> 2;
153
+ uint32_t value;
154
+
155
+ switch (index) {
156
+ case USBPHY_PWD_SET:
157
+ case USBPHY_TX_SET:
158
+ case USBPHY_RX_SET:
159
+ case USBPHY_CTRL_SET:
160
+ case USBPHY_DEBUG_SET:
161
+ case USBPHY_DEBUG1_SET:
162
+ /*
163
+ * All REG_NAME_SET register access are in fact targeting the
164
+ * REG_NAME register.
165
+ */
166
+ value = s->usbphy[index - 1];
167
+ break;
168
+ case USBPHY_PWD_CLR:
169
+ case USBPHY_TX_CLR:
170
+ case USBPHY_RX_CLR:
171
+ case USBPHY_CTRL_CLR:
172
+ case USBPHY_DEBUG_CLR:
173
+ case USBPHY_DEBUG1_CLR:
174
+ /*
175
+ * All REG_NAME_CLR register access are in fact targeting the
176
+ * REG_NAME register.
177
+ */
178
+ value = s->usbphy[index - 2];
179
+ break;
180
+ case USBPHY_PWD_TOG:
181
+ case USBPHY_TX_TOG:
182
+ case USBPHY_RX_TOG:
183
+ case USBPHY_CTRL_TOG:
184
+ case USBPHY_DEBUG_TOG:
185
+ case USBPHY_DEBUG1_TOG:
186
+ /*
187
+ * All REG_NAME_TOG register access are in fact targeting the
188
+ * REG_NAME register.
189
+ */
190
+ value = s->usbphy[index - 3];
191
+ break;
192
+ default:
193
+ value = s->usbphy[index];
194
+ break;
195
+ }
196
+ return (uint64_t)value;
197
+}
198
+
199
+static void imx_usbphy_write(void *opaque, hwaddr offset, uint64_t value,
200
+ unsigned size)
201
+{
202
+ IMXUSBPHYState *s = (IMXUSBPHYState *)opaque;
203
+ uint32_t index = offset >> 2;
204
+
205
+ switch (index) {
206
+ case USBPHY_CTRL:
207
+ s->usbphy[index] = value;
208
+ if (value & USBPHY_CTRL_SFTRST) {
209
+ imx_usbphy_softreset(s);
210
+ }
211
+ break;
212
+ case USBPHY_PWD:
213
+ case USBPHY_TX:
214
+ case USBPHY_RX:
215
+ case USBPHY_STATUS:
216
+ case USBPHY_DEBUG:
217
+ case USBPHY_DEBUG1:
218
+ s->usbphy[index] = value;
219
+ break;
220
+ case USBPHY_CTRL_SET:
221
+ s->usbphy[index - 1] |= value;
222
+ if (value & USBPHY_CTRL_SFTRST) {
223
+ imx_usbphy_softreset(s);
224
+ }
225
+ break;
226
+ case USBPHY_PWD_SET:
227
+ case USBPHY_TX_SET:
228
+ case USBPHY_RX_SET:
229
+ case USBPHY_DEBUG_SET:
230
+ case USBPHY_DEBUG1_SET:
231
+ /*
232
+ * All REG_NAME_SET register access are in fact targeting the
233
+ * REG_NAME register. So we change the value of the REG_NAME
234
+ * register, setting bits passed in the value.
235
+ */
236
+ s->usbphy[index - 1] |= value;
237
+ break;
238
+ case USBPHY_PWD_CLR:
239
+ case USBPHY_TX_CLR:
240
+ case USBPHY_RX_CLR:
241
+ case USBPHY_CTRL_CLR:
242
+ case USBPHY_DEBUG_CLR:
243
+ case USBPHY_DEBUG1_CLR:
244
+ /*
245
+ * All REG_NAME_CLR register access are in fact targeting the
246
+ * REG_NAME register. So we change the value of the REG_NAME
247
+ * register, unsetting bits passed in the value.
248
+ */
249
+ s->usbphy[index - 2] &= ~value;
250
+ break;
251
+ case USBPHY_CTRL_TOG:
252
+ s->usbphy[index - 3] ^= value;
253
+ if ((value & USBPHY_CTRL_SFTRST) &&
254
+ (s->usbphy[index - 3] & USBPHY_CTRL_SFTRST)) {
255
+ imx_usbphy_softreset(s);
256
+ }
257
+ break;
258
+ case USBPHY_PWD_TOG:
259
+ case USBPHY_TX_TOG:
260
+ case USBPHY_RX_TOG:
261
+ case USBPHY_DEBUG_TOG:
262
+ case USBPHY_DEBUG1_TOG:
263
+ /*
264
+ * All REG_NAME_TOG register access are in fact targeting the
265
+ * REG_NAME register. So we change the value of the REG_NAME
266
+ * register, toggling bits passed in the value.
267
+ */
268
+ s->usbphy[index - 3] ^= value;
269
+ break;
270
+ default:
271
+ /* Other registers are read-only */
272
+ break;
273
+ }
274
+}
275
+
276
+static const struct MemoryRegionOps imx_usbphy_ops = {
277
+ .read = imx_usbphy_read,
278
+ .write = imx_usbphy_write,
279
+ .endianness = DEVICE_NATIVE_ENDIAN,
280
+ .valid = {
281
+ /*
282
+ * Our device would not work correctly if the guest was doing
283
+ * unaligned access. This might not be a limitation on the real
284
+ * device but in practice there is no reason for a guest to access
285
+ * this device unaligned.
286
+ */
287
+ .min_access_size = 4,
288
+ .max_access_size = 4,
289
+ .unaligned = false,
290
+ },
291
+};
292
+
293
+static void imx_usbphy_realize(DeviceState *dev, Error **errp)
294
+{
295
+ IMXUSBPHYState *s = IMX_USBPHY(dev);
296
+
297
+ memory_region_init_io(&s->iomem, OBJECT(s), &imx_usbphy_ops, s,
298
+ "imx-usbphy", 0x1000);
299
+ sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
300
+}
301
+
302
+static void imx_usbphy_class_init(ObjectClass *klass, void *data)
303
+{
304
+ DeviceClass *dc = DEVICE_CLASS(klass);
305
+
306
+ dc->reset = imx_usbphy_reset;
307
+ dc->vmsd = &vmstate_imx_usbphy;
308
+ dc->desc = "i.MX USB PHY Module";
309
+ dc->realize = imx_usbphy_realize;
310
+}
311
+
312
+static const TypeInfo imx_usbphy_info = {
313
+ .name = TYPE_IMX_USBPHY,
314
+ .parent = TYPE_SYS_BUS_DEVICE,
315
+ .instance_size = sizeof(IMXUSBPHYState),
316
+ .class_init = imx_usbphy_class_init,
317
+};
318
+
319
+static void imx_usbphy_register_types(void)
320
+{
321
+ type_register_static(&imx_usbphy_info);
322
+}
323
+
324
+type_init(imx_usbphy_register_types)
325
diff --git a/MAINTAINERS b/MAINTAINERS
326
index XXXXXXX..XXXXXXX 100644
85
index XXXXXXX..XXXXXXX 100644
327
--- a/MAINTAINERS
86
--- a/tests/tcg/aarch64/Makefile.target
328
+++ b/MAINTAINERS
87
+++ b/tests/tcg/aarch64/Makefile.target
329
@@ -XXX,XX +XXX,XX @@ F: hw/arm/sabrelite.c
88
@@ -XXX,XX +XXX,XX @@ run-fcvt: fcvt
330
F: hw/arm/fsl-imx6.c
89
331
F: hw/misc/imx6_*.c
90
# Pauth Tests
332
F: hw/ssi/imx_spi.c
91
ifneq ($(DOCKER_IMAGE)$(CROSS_CC_HAS_ARMV8_3),)
333
+F: hw/usb/imx-usb-phy.c
92
-AARCH64_TESTS += pauth-1 pauth-2 pauth-4
334
+F: include/hw/usb/imx-usb-phy.h
93
+AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5
335
F: include/hw/arm/fsl-imx6.h
94
pauth-%: CFLAGS += -march=armv8.3-a
336
F: include/hw/misc/imx6_*.h
95
run-pauth-%: QEMU_OPTS += -cpu max
337
F: include/hw/ssi/imx_spi.h
96
run-plugin-pauth-%: QEMU_OPTS += -cpu max
338
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
339
index XXXXXXX..XXXXXXX 100644
340
--- a/hw/arm/Kconfig
341
+++ b/hw/arm/Kconfig
342
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
343
select IMX
344
select IMX_FEC
345
select IMX_I2C
346
+ select IMX_USBPHY
347
select SDHCI
348
349
config ASPEED_SOC
350
diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
351
index XXXXXXX..XXXXXXX 100644
352
--- a/hw/usb/Kconfig
353
+++ b/hw/usb/Kconfig
354
@@ -XXX,XX +XXX,XX @@ config USB_STORAGE_MTP
355
bool
356
default y
357
depends on USB
358
+
359
+config IMX_USBPHY
360
+ bool
361
+ default y
362
+ depends on USB
363
--
97
--
364
2.20.1
98
2.20.1
365
99
366
100
diff view generated by jsdifflib
Deleted patch
1
From: Guenter Roeck <linux@roeck-us.net>
2
1
3
USB1 and USB2 interrupt numbers were swapped. USB_PHY2 interrupt number
4
is 45. That didn't really matter up to now since the interrupts were not
5
used, but it needs to be fixed to be able to wire up the USB controllers.
6
7
Fixes: 31cbf933f0e ("i.MX6UL: Add i.MX6UL SOC")
8
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
Message-id: 20200313014551.12554-3-linux@roeck-us.net
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/fsl-imx6ul.h | 6 +++---
14
1 file changed, 3 insertions(+), 3 deletions(-)
15
16
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/hw/arm/fsl-imx6ul.h
19
+++ b/include/hw/arm/fsl-imx6ul.h
20
@@ -XXX,XX +XXX,XX @@ enum FslIMX6ULIRQs {
21
FSL_IMX6UL_UART7_IRQ = 39,
22
FSL_IMX6UL_UART8_IRQ = 40,
23
24
- FSL_IMX6UL_USB1_IRQ = 42,
25
- FSL_IMX6UL_USB2_IRQ = 43,
26
+ FSL_IMX6UL_USB1_IRQ = 43,
27
+ FSL_IMX6UL_USB2_IRQ = 42,
28
FSL_IMX6UL_USB_PHY1_IRQ = 44,
29
- FSL_IMX6UL_USB_PHY2_IRQ = 44,
30
+ FSL_IMX6UL_USB_PHY2_IRQ = 45,
31
32
FSL_IMX6UL_CAAM_JQ2_IRQ = 46,
33
FSL_IMX6UL_CAAM_ERR_IRQ = 47,
34
--
35
2.20.1
36
37
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Kaige Li <likaige@loongson.cn>
2
2
3
The Linux kernel recently started using FAST_READ_4 commands.
3
GCC version 4.9.4 isn't clever enough to figure out that all
4
This results in flash read failures. At the same time, the m25p80
4
execution paths in disas_ldst() that use 'fn' will have initialized
5
emulation is seen to read 8 more bytes than expected. Adjusting the
5
it first, and so it warns:
6
expected number of dummy cycles to match FAST_READ fixes the problem.
7
6
8
Fixes: f95c4bffdc4c ("aspeed/smc: snoop SPI transfers to fake dummy cycles")
7
/home/LiKaige/qemu/target/arm/translate-a64.c: In function ‘disas_ldst’:
9
Reviewed-by: Cédric Le Goater <clg@kaod.org>
8
/home/LiKaige/qemu/target/arm/translate-a64.c:3392:5: error: ‘fn’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
10
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
fn(cpu_reg(s, rt), clean_addr, tcg_rs, get_mem_index(s),
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
^
11
/home/LiKaige/qemu/target/arm/translate-a64.c:3318:22: note: ‘fn’ was declared here
12
AtomicThreeOpFn *fn;
13
^
14
15
Make it happy by initializing the variable to NULL.
16
17
Signed-off-by: Kaige Li <likaige@loongson.cn>
18
Message-id: 1596110248-7366-2-git-send-email-likaige@loongson.cn
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
[PMM: Clean up commit message and note which gcc version this was]
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
22
---
14
hw/ssi/aspeed_smc.c | 2 +-
23
target/arm/translate-a64.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
24
1 file changed, 1 insertion(+), 1 deletion(-)
16
25
17
diff --git a/hw/ssi/aspeed_smc.c b/hw/ssi/aspeed_smc.c
26
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
18
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/ssi/aspeed_smc.c
28
--- a/target/arm/translate-a64.c
20
+++ b/hw/ssi/aspeed_smc.c
29
+++ b/target/arm/translate-a64.c
21
@@ -XXX,XX +XXX,XX @@ static int aspeed_smc_num_dummies(uint8_t command)
30
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
22
case FAST_READ:
31
bool r = extract32(insn, 22, 1);
23
case DOR:
32
bool a = extract32(insn, 23, 1);
24
case QOR:
33
TCGv_i64 tcg_rs, clean_addr;
25
+ case FAST_READ_4:
34
- AtomicThreeOpFn *fn;
26
case DOR_4:
35
+ AtomicThreeOpFn *fn = NULL;
27
case QOR_4:
36
28
return 1;
37
if (is_vector || !dc_isar_feature(aa64_atomics, s)) {
29
case DIOR:
38
unallocated_encoding(s);
30
- case FAST_READ_4:
31
case DIOR_4:
32
return 2;
33
case QIOR:
34
--
39
--
35
2.20.1
40
2.20.1
36
41
37
42
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The nrf51 SoC model wasn't setting the system_clock_scale
2
global.which meant that if guest code used the systick timer in "use
3
the processor clock" mode it would hang because time never advances.
2
4
3
With this patch, the USB controllers on 'sabrelite' are detected
5
Set the global to match the documented CPU clock speed for this SoC.
4
and can be used to boot the system.
5
6
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
7
This SoC in fact doesn't have a SysTick timer (which is the only thing
7
Message-id: 20200313014551.12554-6-linux@roeck-us.net
8
currently that cares about the system_clock_scale), because it's
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
a configurable option in the Cortex-M0. However our Cortex-M0 and
10
thus our nrf51 and our micro:bit board do provide a SysTick, so
11
we ought to provide a functional one rather than a broken one.
12
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Message-id: 20200727193458.31250-1-peter.maydell@linaro.org
10
---
16
---
11
include/hw/arm/fsl-imx6.h | 6 ++++++
17
hw/arm/nrf51_soc.c | 5 +++++
12
hw/arm/fsl-imx6.c | 36 ++++++++++++++++++++++++++++++++++++
18
1 file changed, 5 insertions(+)
13
2 files changed, 42 insertions(+)
14
19
15
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
20
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
16
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
17
--- a/include/hw/arm/fsl-imx6.h
22
--- a/hw/arm/nrf51_soc.c
18
+++ b/include/hw/arm/fsl-imx6.h
23
+++ b/hw/arm/nrf51_soc.c
19
@@ -XXX,XX +XXX,XX @@
24
@@ -XXX,XX +XXX,XX @@
20
#include "hw/sd/sdhci.h"
25
21
#include "hw/ssi/imx_spi.h"
26
#define BASE_TO_IRQ(base) ((base >> 12) & 0x1F)
22
#include "hw/net/imx_fec.h"
27
23
+#include "hw/usb/chipidea.h"
28
+/* HCLK (the main CPU clock) on this SoC is always 16MHz */
24
+#include "hw/usb/imx-usb-phy.h"
29
+#define HCLK_FRQ 16000000
25
#include "exec/memory.h"
30
+
26
#include "cpu.h"
31
static uint64_t clock_read(void *opaque, hwaddr addr, unsigned int size)
27
32
{
28
@@ -XXX,XX +XXX,XX @@
33
qemu_log_mask(LOG_UNIMP, "%s: 0x%" HWADDR_PRIx " [%u]\n",
29
#define FSL_IMX6_NUM_ESDHCS 4
34
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
30
#define FSL_IMX6_NUM_ECSPIS 5
35
return;
31
#define FSL_IMX6_NUM_WDTS 2
32
+#define FSL_IMX6_NUM_USB_PHYS 2
33
+#define FSL_IMX6_NUM_USBS 4
34
35
typedef struct FslIMX6State {
36
/*< private >*/
37
@@ -XXX,XX +XXX,XX @@ typedef struct FslIMX6State {
38
SDHCIState esdhc[FSL_IMX6_NUM_ESDHCS];
39
IMXSPIState spi[FSL_IMX6_NUM_ECSPIS];
40
IMX2WdtState wdt[FSL_IMX6_NUM_WDTS];
41
+ IMXUSBPHYState usbphy[FSL_IMX6_NUM_USB_PHYS];
42
+ ChipideaState usb[FSL_IMX6_NUM_USBS];
43
IMXFECState eth;
44
MemoryRegion rom;
45
MemoryRegion caam;
46
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/arm/fsl-imx6.c
49
+++ b/hw/arm/fsl-imx6.c
50
@@ -XXX,XX +XXX,XX @@
51
#include "qemu/osdep.h"
52
#include "qapi/error.h"
53
#include "hw/arm/fsl-imx6.h"
54
+#include "hw/usb/imx-usb-phy.h"
55
#include "hw/boards.h"
56
#include "hw/qdev-properties.h"
57
#include "sysemu/sysemu.h"
58
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
59
TYPE_IMX_USDHC);
60
}
36
}
61
37
62
+ for (i = 0; i < FSL_IMX6_NUM_USB_PHYS; i++) {
38
+ system_clock_scale = NANOSECONDS_PER_SECOND / HCLK_FRQ;
63
+ snprintf(name, NAME_SIZE, "usbphy%d", i);
64
+ sysbus_init_child_obj(obj, name, &s->usbphy[i], sizeof(s->usbphy[i]),
65
+ TYPE_IMX_USBPHY);
66
+ }
67
+ for (i = 0; i < FSL_IMX6_NUM_USBS; i++) {
68
+ snprintf(name, NAME_SIZE, "usb%d", i);
69
+ sysbus_init_child_obj(obj, name, &s->usb[i], sizeof(s->usb[i]),
70
+ TYPE_CHIPIDEA);
71
+ }
72
+
39
+
73
for (i = 0; i < FSL_IMX6_NUM_ECSPIS; i++) {
40
object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container),
74
snprintf(name, NAME_SIZE, "spi%d", i + 1);
41
&error_abort);
75
sysbus_init_child_obj(obj, name, &s->spi[i], sizeof(s->spi[i]),
42
if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) {
76
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
77
esdhc_table[i].irq));
78
}
79
80
+ /* USB */
81
+ for (i = 0; i < FSL_IMX6_NUM_USB_PHYS; i++) {
82
+ object_property_set_bool(OBJECT(&s->usbphy[i]), true, "realized",
83
+ &error_abort);
84
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->usbphy[i]), 0,
85
+ FSL_IMX6_USBPHY1_ADDR + i * 0x1000);
86
+ }
87
+ for (i = 0; i < FSL_IMX6_NUM_USBS; i++) {
88
+ static const int FSL_IMX6_USBn_IRQ[] = {
89
+ FSL_IMX6_USB_OTG_IRQ,
90
+ FSL_IMX6_USB_HOST1_IRQ,
91
+ FSL_IMX6_USB_HOST2_IRQ,
92
+ FSL_IMX6_USB_HOST3_IRQ,
93
+ };
94
+
95
+ object_property_set_bool(OBJECT(&s->usb[i]), true, "realized",
96
+ &error_abort);
97
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->usb[i]), 0,
98
+ FSL_IMX6_USBOH3_USB_ADDR + i * 0x200);
99
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->usb[i]), 0,
100
+ qdev_get_gpio_in(DEVICE(&s->a9mpcore),
101
+ FSL_IMX6_USBn_IRQ[i]));
102
+ }
103
+
104
/* Initialize all ECSPI */
105
for (i = 0; i < FSL_IMX6_NUM_ECSPIS; i++) {
106
static const struct {
107
--
43
--
108
2.20.1
44
2.20.1
109
45
110
46
diff view generated by jsdifflib
Deleted patch
1
From: Chen Qun <kuhn.chenqun@huawei.com>
2
1
3
The current code causes clang static code analyzer generate warning:
4
hw/net/imx_fec.c:858:9: warning: Value stored to 'value' is never read
5
value = value & 0x0000000f;
6
^ ~~~~~~~~~~~~~~~~~~
7
hw/net/imx_fec.c:864:9: warning: Value stored to 'value' is never read
8
value = value & 0x000000fd;
9
^ ~~~~~~~~~~~~~~~~~~
10
11
According to the definition of the function, the two “value” assignments
12
should be written to registers.
13
14
Reported-by: Euler Robot <euler.robot@huawei.com>
15
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
16
Message-id: 20200313123242.13236-1-kuhn.chenqun@huawei.com
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/net/imx_fec.c | 6 ++++--
21
1 file changed, 4 insertions(+), 2 deletions(-)
22
23
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
24
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/net/imx_fec.c
26
+++ b/hw/net/imx_fec.c
27
@@ -XXX,XX +XXX,XX @@ static void imx_enet_write(IMXFECState *s, uint32_t index, uint32_t value)
28
break;
29
case ENET_TGSR:
30
/* implement clear timer flag */
31
- value = value & 0x0000000f;
32
+ s->regs[index] &= ~(value & 0x0000000f); /* all bits W1C */
33
break;
34
case ENET_TCSR0:
35
case ENET_TCSR1:
36
case ENET_TCSR2:
37
case ENET_TCSR3:
38
- value = value & 0x000000fd;
39
+ s->regs[index] &= ~(value & 0x00000080); /* W1C bits */
40
+ s->regs[index] &= ~0x0000007d; /* writable fields */
41
+ s->regs[index] |= (value & 0x0000007d);
42
break;
43
case ENET_TCCR0:
44
case ENET_TCCR1:
45
--
46
2.20.1
47
48
diff view generated by jsdifflib
Deleted patch
1
From: Guenter Roeck <linux@roeck-us.net>
2
1
3
When requesting JEDEC data using the JEDEC_READ command, the Linux kernel
4
always requests 6 bytes. The current implementation only returns three
5
bytes, and interprets the remaining three bytes as new commands.
6
While this does not matter most of the time, it is at the very least
7
confusing. To avoid the problem, always report up to 6 bytes of JEDEC
8
data. Fill remaining data with 0.
9
10
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
12
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
13
Reviewed-by: Cédric Le Goater <clg@kaod.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
16
hw/block/m25p80.c | 5 ++++-
17
1 file changed, 4 insertions(+), 1 deletion(-)
18
19
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/hw/block/m25p80.c
22
+++ b/hw/block/m25p80.c
23
@@ -XXX,XX +XXX,XX @@ static void decode_new_cmd(Flash *s, uint32_t value)
24
for (i = 0; i < s->pi->id_len; i++) {
25
s->data[i] = s->pi->id[i];
26
}
27
+ for (; i < SPI_NOR_MAX_ID_LEN; i++) {
28
+ s->data[i] = 0;
29
+ }
30
31
- s->len = s->pi->id_len;
32
+ s->len = SPI_NOR_MAX_ID_LEN;
33
s->pos = 0;
34
s->state = STATE_READING_DATA;
35
break;
36
--
37
2.20.1
38
39
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The imx_epit device has a software-controllable reset triggered by
2
setting the SWR bit in the CR register. An error in commit cc2722ec83ad9
3
means that we will end up assert()ing if the guest does this, because
4
the code in imx_epit_write() starts ptimer transactions, and then
5
imx_epit_reset() also starts ptimer transactions, triggering
6
"ptimer_transaction_begin: Assertion `!s->in_transaction' failed".
2
7
3
PXA255 does not support a USB OHCI controller, so don't wire it up.
8
The cleanest way to avoid this double-transaction is to move the
9
start-transaction for the CR write handling down below the check of
10
the SWR bit.
4
11
5
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
12
Fixes: https://bugs.launchpad.net/qemu/+bug/1880424
6
Message-id: 20200313160215.28155-1-linux@roeck-us.net
13
Fixes: cc2722ec83ad944505fe
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Message-id: 20200727154550.3409-1-peter.maydell@linaro.org
9
---
17
---
10
hw/arm/pxa2xx.c | 3 ---
18
hw/timer/imx_epit.c | 13 ++++++++++---
11
1 file changed, 3 deletions(-)
19
1 file changed, 10 insertions(+), 3 deletions(-)
12
20
13
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
21
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c
14
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
15
--- a/hw/arm/pxa2xx.c
23
--- a/hw/timer/imx_epit.c
16
+++ b/hw/arm/pxa2xx.c
24
+++ b/hw/timer/imx_epit.c
17
@@ -XXX,XX +XXX,XX @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
25
@@ -XXX,XX +XXX,XX @@ static void imx_epit_write(void *opaque, hwaddr offset, uint64_t value,
18
s->ssp[i] = (SSIBus *)qdev_get_child_bus(dev, "ssi");
26
19
}
27
switch (offset >> 2) {
20
28
case 0: /* CR */
21
- sysbus_create_simple("sysbus-ohci", 0x4c000000,
29
- ptimer_transaction_begin(s->timer_cmp);
22
- qdev_get_gpio_in(s->pic, PXA2XX_PIC_USBH1));
30
- ptimer_transaction_begin(s->timer_reload);
23
-
31
24
s->pcmcia[0] = pxa2xx_pcmcia_init(address_space, 0x20000000);
32
oldcr = s->cr;
25
s->pcmcia[1] = pxa2xx_pcmcia_init(address_space, 0x30000000);
33
s->cr = value & 0x03ffffff;
34
if (s->cr & CR_SWR) {
35
/* handle the reset */
36
imx_epit_reset(DEVICE(s));
37
- } else {
38
+ /*
39
+ * TODO: could we 'break' here? following operations appear
40
+ * to duplicate the work imx_epit_reset() already did.
41
+ */
42
+ }
43
+
44
+ ptimer_transaction_begin(s->timer_cmp);
45
+ ptimer_transaction_begin(s->timer_reload);
46
+
47
+ if (!(s->cr & CR_SWR)) {
48
imx_epit_set_freq(s);
49
}
26
50
27
--
51
--
28
2.20.1
52
2.20.1
29
53
30
54
diff view generated by jsdifflib