Skip to contentSkip to conversation

hw/arm: Implement i.MX watchdog support

PATCH Superseded Guenter Roeck 2 participants 16 messages Mar 14, 2020 Arm i.MX and Layerscape

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover hw/arm: Implement i.MX watchdog support

The current i.MX watchdog implementation only supports resets. This patch series implements the full watchdog, including optional pretimeout support.

Notable changes:
- The existing i.MX watchdog emulation (which only emulates syste resets) is moved from hw/misc to hw/watchdog and renamed to match the naming convention in hw/watchdog (patch 1/8).
- Full watchdog support is implemented in patch 2/8.
- The watchdog is wired up for i.MX25 and i.MX31 emulations (patch 3/8 and 4/8).
- The watchdog interrupt (for pretimeout support) is connected for i.MX6, i.MX6UL, and i.MX7 emulations (patch 5/8, 6/8, and 8/8).
- For i.MX7, various devices are wired up as unimplemented devices (patch 7/8). This was necessary to avoid crashes when booting recent Linux kernels.

The code was tested with all available emulations.

----------------------------------------------------------------
Guenter Roeck (8):
hw: Move i.MX watchdog driver to hw/watchdog hw/watchdog: Implement full i.MX watchdog support hw/arm/fsl-imx25: Wire up watchdog hw/arm/fsl-imx31: Wire up watchdog hw/arm/fsl-imx6: Connect watchdog interrupts hw/arm/fsl-imx6ul: Connect watchdog interrupts hw/arm/fsl-imx7: Instantiate various unimplemented devices hw/arm/fsl-imx7: Connect watchdog interrupts

 MAINTAINERS                    |   2 +
 hw/arm/fsl-imx25.c             |  10 ++
 hw/arm/fsl-imx31.c             |   6 +
 hw/arm/fsl-imx6.c              |   9 ++
 hw/arm/fsl-imx6ul.c            |  10 ++
 hw/arm/fsl-imx7.c              |  35 ++++++
 hw/misc/Makefile.objs          |   1 -
 hw/misc/imx2_wdt.c             |  90 --------------
 hw/watchdog/Kconfig            |   5 +
 hw/watchdog/Makefile.objs      |   1 +
 hw/watchdog/wdt_imx2.c         | 262 +++++++++++++++++++++++++++++++++++++++++
 include/hw/arm/fsl-imx25.h     |   5 +
 include/hw/arm/fsl-imx31.h     |   4 +
 include/hw/arm/fsl-imx6.h      |   2 +-
 include/hw/arm/fsl-imx6ul.h    |   2 +-
 include/hw/arm/fsl-imx7.h      |  23 +++-
 include/hw/misc/imx2_wdt.h     |  33 ------
 include/hw/watchdog/wdt_imx2.h |  78 ++++++++++++
 18 files changed, 451 insertions(+), 127 deletions(-)
 delete mode 100644 hw/misc/imx2_wdt.c
 create mode 100644 hw/watchdog/wdt_imx2.c
 delete mode 100644 include/hw/misc/imx2_wdt.h
 create mode 100644 include/hw/watchdog/wdt_imx2.h
#1 lore raw

PATCH 1/8 hw: Move i.MX watchdog driver to hw/watchdog

In preparation for a full implementation, move i.MX watchdog driver from hw/misc to hw/watchdog. While at it, add the watchdog files to MAINTAINERS.

---
 MAINTAINERS                                         | 2 ++
 hw/misc/Makefile.objs                               | 1 -
 hw/watchdog/Kconfig                                 | 5 +++++
 hw/watchdog/Makefile.objs                           | 1 +
 hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c}         | 2 +-
 include/hw/arm/fsl-imx6.h                           | 2 +-
 include/hw/arm/fsl-imx6ul.h                         | 2 +-
 include/hw/arm/fsl-imx7.h                           | 2 +-
 include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} | 0
 9 files changed, 12 insertions(+), 5 deletions(-)
 rename hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} (98%)
 rename include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} (100%)
MAINTAINERS +2 -0
index 32867bc636..d1197014e8 100644
@@ -603,8 +603,10 @@ S: Odd Fixes
 F: hw/arm/fsl-imx25.c
 F: hw/arm/imx25_pdk.c
 F: hw/misc/imx25_ccm.c
+F: hw/watchdog/wdt_imx2.c
 F: include/hw/arm/fsl-imx25.h
 F: include/hw/misc/imx25_ccm.h
+F: include/hw/watchdog/wdt_imx2.h
 
 i.MX31 (kzm)
 M: Peter Chubb <[email protected]>
hw/misc/Makefile.objs +0 -1
index 68aae2eabb..b25181b711 100644
@@ -44,7 +44,6 @@ common-obj-$(CONFIG_IMX) += imx6_ccm.o
 common-obj-$(CONFIG_IMX) += imx6ul_ccm.o
 obj-$(CONFIG_IMX) += imx6_src.o
 common-obj-$(CONFIG_IMX) += imx7_ccm.o
-common-obj-$(CONFIG_IMX) += imx2_wdt.o
 common-obj-$(CONFIG_IMX) += imx7_snvs.o
 common-obj-$(CONFIG_IMX) += imx7_gpr.o
 common-obj-$(CONFIG_IMX) += imx_rngc.o
hw/watchdog/Kconfig +5 -0
index 2118d897c9..2c225b4b17 100644
@@ -14,3 +14,8 @@ config WDT_IB700
 
 config WDT_DIAG288
     bool
+
+config WDT_IMX2
+    bool
+    default y
+    depends on IMX
hw/watchdog/Makefile.objs +1 -0
index 3f536d1cad..dd9b37f642 100644
@@ -4,3 +4,4 @@ common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
 common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
 common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o
 common-obj-$(CONFIG_ASPEED_SOC) += wdt_aspeed.o
+common-obj-$(CONFIG_WDT_IMX) += wdt_imx2.o
hw/watchdog/wdt_imx2.c renamed from hw/misc/imx2_wdt.c +1 -1
similarity index 98%
rename from hw/misc/imx2_wdt.c
rename to hw/watchdog/wdt_imx2.c
index 2aedfe803a..ad1ef02e9e 100644
@@ -14,7 +14,7 @@
 #include "qemu/module.h"
 #include "sysemu/watchdog.h"
 
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
 
 #define IMX2_WDT_WCR_WDA    BIT(5)      /* -> External Reset WDOG_B */
 #define IMX2_WDT_WCR_SRS    BIT(4)      /* -> Software Reset Signal */
include/hw/arm/fsl-imx6.h +1 -1
index 60eadccb42..5b02dc1f4b 100644
@@ -21,7 +21,7 @@
 #include "hw/cpu/a9mpcore.h"
 #include "hw/misc/imx6_ccm.h"
 #include "hw/misc/imx6_src.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
 #include "hw/char/imx_serial.h"
 #include "hw/timer/imx_gpt.h"
 #include "hw/timer/imx_epit.h"
include/hw/arm/fsl-imx6ul.h +1 -1
index eda389aec7..91c746918a 100644
@@ -24,7 +24,7 @@
 #include "hw/misc/imx7_snvs.h"
 #include "hw/misc/imx7_gpr.h"
 #include "hw/intc/imx_gpcv2.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
 #include "hw/gpio/imx_gpio.h"
 #include "hw/char/imx_serial.h"
 #include "hw/timer/imx_gpt.h"
include/hw/arm/fsl-imx7.h +1 -1
index 706aef2e7e..3a0041c4c2 100644
@@ -26,7 +26,7 @@
 #include "hw/misc/imx7_snvs.h"
 #include "hw/misc/imx7_gpr.h"
 #include "hw/misc/imx6_src.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
 #include "hw/gpio/imx_gpio.h"
 #include "hw/char/imx_serial.h"
 #include "hw/timer/imx_gpt.h"
include/hw/watchdog/wdt_imx2.h renamed from include/hw/misc/imx2_wdt.h +0 -0
similarity index 100%
rename from include/hw/misc/imx2_wdt.h
rename to include/hw/watchdog/wdt_imx2.h
Signature · 1 line
2.17.1
Reviewed-by on v1 1/8
#2 lore raw

Re: [PATCH 1/8] hw: Move i.MX watchdog driver to hw/watchdog

Hi Guenter,

Quoted 51 lines · Guenter Roeck

In preparation for a full implementation, move i.MX watchdog driver from hw/misc to hw/watchdog. While at it, add the watchdog files to MAINTAINERS.

---
  MAINTAINERS                                         | 2 ++
  hw/misc/Makefile.objs                               | 1 -
  hw/watchdog/Kconfig                                 | 5 +++++
  hw/watchdog/Makefile.objs                           | 1 +
  hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c}         | 2 +-
  include/hw/arm/fsl-imx6.h                           | 2 +-
  include/hw/arm/fsl-imx6ul.h                         | 2 +-
  include/hw/arm/fsl-imx7.h                           | 2 +-
  include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} | 0
  9 files changed, 12 insertions(+), 5 deletions(-)

rename hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} (98%) rename include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} (100%)

MAINTAINERS +2 -0
index 32867bc636..d1197014e8 100644
@@ -603,8 +603,10 @@ S: Odd Fixes
  F: hw/arm/fsl-imx25.c
  F: hw/arm/imx25_pdk.c
  F: hw/misc/imx25_ccm.c
+F: hw/watchdog/wdt_imx2.c
  F: include/hw/arm/fsl-imx25.h
  F: include/hw/misc/imx25_ccm.h
+F: include/hw/watchdog/wdt_imx2.h
 
  i.MX31 (kzm)
  M: Peter Chubb <[email protected]>
hw/misc/Makefile.objs +0 -1
index 68aae2eabb..b25181b711 100644
@@ -44,7 +44,6 @@ common-obj-$(CONFIG_IMX) += imx6_ccm.o
  common-obj-$(CONFIG_IMX) += imx6ul_ccm.o
  obj-$(CONFIG_IMX) += imx6_src.o
  common-obj-$(CONFIG_IMX) += imx7_ccm.o
-common-obj-$(CONFIG_IMX) += imx2_wdt.o
  common-obj-$(CONFIG_IMX) += imx7_snvs.o
  common-obj-$(CONFIG_IMX) += imx7_gpr.o
  common-obj-$(CONFIG_IMX) += imx_rngc.o
hw/watchdog/Kconfig +0 -0
index 2118d897c9..2c225b4b17 100644

hw/watchdog/Kconfig config WDT_IB700 · line 21

Quoted 8 lines
hw/watchdog/Kconfig +5 -0
@@ -14,3 +14,8 @@ config WDT_IB700
 
  config WDT_DIAG288
      bool
+
+config WDT_IMX2
+    bool
+    default y
+    depends on IMX

- it does not depend of IMX (you could use it in another SoC)
- since it is not user-creatable, it is pointless as a default device.

Instead, select it in each iMX SoC:

-- >8 --

hw/arm/Kconfig +3 -1
index e5a876c8d1..cdb01c4e03 100644
@@ -358,6 +358,7 @@ config FSL_IMX25
     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select DS1338
 
 config FSL_IMX31
@@ -365,6 +366,7 @@ config FSL_IMX31
     select SERIAL
     select IMX
     select IMX_I2C
+    select WDT_IMX2
     select LAN9118
 
 config FSL_IMX6
@@ -373,6 +375,7 @@ config FSL_IMX6
     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select SDHCI
 
---

With this hunk amended (and removing "default y" and "depends on IMX"):

Quoted 69 lines
hw/watchdog/Makefile.objs +1 -0
index 3f536d1cad..dd9b37f642 100644
@@ -4,3 +4,4 @@ common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
  common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
  common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o
  common-obj-$(CONFIG_ASPEED_SOC) += wdt_aspeed.o
+common-obj-$(CONFIG_WDT_IMX) += wdt_imx2.o
hw/watchdog/wdt_imx2.c renamed from hw/misc/imx2_wdt.c +1 -1
similarity index 98%
rename from hw/misc/imx2_wdt.c
rename to hw/watchdog/wdt_imx2.c
index 2aedfe803a..ad1ef02e9e 100644
@@ -14,7 +14,7 @@
  #include "qemu/module.h"
  #include "sysemu/watchdog.h"
 
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
 
  #define IMX2_WDT_WCR_WDA    BIT(5)      /* -> External Reset WDOG_B */
  #define IMX2_WDT_WCR_SRS    BIT(4)      /* -> Software Reset Signal */
include/hw/arm/fsl-imx6.h +1 -1
index 60eadccb42..5b02dc1f4b 100644
@@ -21,7 +21,7 @@
  #include "hw/cpu/a9mpcore.h"
  #include "hw/misc/imx6_ccm.h"
  #include "hw/misc/imx6_src.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
  #include "hw/char/imx_serial.h"
  #include "hw/timer/imx_gpt.h"
  #include "hw/timer/imx_epit.h"
include/hw/arm/fsl-imx6ul.h +1 -1
index eda389aec7..91c746918a 100644
@@ -24,7 +24,7 @@
  #include "hw/misc/imx7_snvs.h"
  #include "hw/misc/imx7_gpr.h"
  #include "hw/intc/imx_gpcv2.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
  #include "hw/gpio/imx_gpio.h"
  #include "hw/char/imx_serial.h"
  #include "hw/timer/imx_gpt.h"
include/hw/arm/fsl-imx7.h +1 -1
index 706aef2e7e..3a0041c4c2 100644
@@ -26,7 +26,7 @@
  #include "hw/misc/imx7_snvs.h"
  #include "hw/misc/imx7_gpr.h"
  #include "hw/misc/imx6_src.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
  #include "hw/gpio/imx_gpio.h"
  #include "hw/char/imx_serial.h"
  #include "hw/timer/imx_gpt.h"
include/hw/watchdog/wdt_imx2.h renamed from include/hw/misc/imx2_wdt.h +0 -0
similarity index 100%
rename from include/hw/misc/imx2_wdt.h
rename to include/hw/watchdog/wdt_imx2.h
#3 lore raw

Re: [PATCH 1/8] hw: Move i.MX watchdog driver to hw/watchdog

Quoted 88 lines · Philippe Mathieu-Daudé

Hi Guenter,

Quoted 52 lines · Guenter Roeck

In preparation for a full implementation, move i.MX watchdog driver from hw/misc to hw/watchdog. While at it, add the watchdog files to MAINTAINERS.

---
  MAINTAINERS                                         | 2 ++ hw/misc/Makefile.objs                               | 1 - hw/watchdog/Kconfig                                 | 5 +++++ hw/watchdog/Makefile.objs                           | 1 + hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c}         | 2 +- include/hw/arm/fsl-imx6.h                           | 2 +- include/hw/arm/fsl-imx6ul.h                         | 2 +- include/hw/arm/fsl-imx7.h                           | 2 +- include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} | 0

  9 files changed, 12 insertions(+), 5 deletions(-)

  rename hw/{misc/imx2_wdt.c => watchdog/wdt_imx2.c} (98%) rename include/hw/{misc/imx2_wdt.h => watchdog/wdt_imx2.h} (100%)

MAINTAINERS +0 -0
index 32867bc636..d1197014e8 100644
@@ -603,8 +603,10 @@ S: Odd Fixes

  F: hw/arm/fsl-imx25.c
  F: hw/arm/imx25_pdk.c
  F: hw/misc/imx25_ccm.c
+F: hw/watchdog/wdt_imx2.c
  F: include/hw/arm/fsl-imx25.h
  F: include/hw/misc/imx25_ccm.h
+F: include/hw/watchdog/wdt_imx2.h
  i.MX31 (kzm)
  M: Peter Chubb <[email protected]>

hw/misc/Makefile.objs +0 -0
index 68aae2eabb..b25181b711 100644
@@ -44,7 +44,6 @@ common-obj-$(CONFIG_IMX) += imx6_ccm.o

  common-obj-$(CONFIG_IMX) += imx6ul_ccm.o
  obj-$(CONFIG_IMX) += imx6_src.o
  common-obj-$(CONFIG_IMX) += imx7_ccm.o
-common-obj-$(CONFIG_IMX) += imx2_wdt.o
  common-obj-$(CONFIG_IMX) += imx7_snvs.o
  common-obj-$(CONFIG_IMX) += imx7_gpr.o
  common-obj-$(CONFIG_IMX) += imx_rngc.o

hw/watchdog/Kconfig +0 -0
index 2118d897c9..2c225b4b17 100644
@@ -14,3 +14,8 @@ config WDT_IB700

  config WDT_DIAG288
      bool

hw/watchdog/Kconfig

Quoted 5 lines
hw/watchdog/Kconfig +5 -0
+
+config WDT_IMX2
+    bool
+    default y
+    depends on IMX

- it does not depend of IMX (you could use it in another SoC)
- since it is not user-creatable, it is pointless as a default device.

Instead, select it in each iMX SoC:

-- >8 --

hw/arm/Kconfig +2 -0
index e5a876c8d1..cdb01c4e03 100644
@@ -358,6 +358,7 @@ config FSL_IMX25
      select IMX
      select IMX_FEC
      select IMX_I2C
+    select WDT_IMX2
      select DS1338
 
  config FSL_IMX31
@@ -365,6 +366,7 @@ config FSL_IMX31
      select SERIAL
      select IMX
      select IMX_I2C
+    select WDT_IMX2
      select LAN9118
 
  config FSL_IMX6

hw/arm/Kconfig config FSL_IMX6 · line 378

Quoted 7 lines
hw/arm/Kconfig +1 -1
@@ -373,6 +375,7 @@ config FSL_IMX6
      select IMX
      select IMX_FEC
      select IMX_I2C
+    select WDT_IMX2
      select SDHCI
 
---

Corrected hunk:

-- >8 --

hw/arm/Kconfig +3 -0
index e5a876c8d1..c662d5f1e0 100644
@@ -373,6 +373,7 @@ config FSL_IMX6
     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select SDHCI
 
 config ASPEED_SOC
@@ -410,6 +411,7 @@ config FSL_IMX7
     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select PCI_EXPRESS_DESIGNWARE
     select SDHCI
     select UNIMP
@@ -423,6 +425,7 @@ config FSL_IMX6UL
     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select SDHCI
     select UNIMP
 

---

Quoted 71 lines

With this hunk amended (and removing "default y" and "depends on IMX"):

Quoted 67 lines
hw/watchdog/Makefile.objs +0 -0
index 3f536d1cad..dd9b37f642 100644
@@ -4,3 +4,4 @@ common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o

  common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o common-obj-$(CONFIG_ASPEED_SOC) += wdt_aspeed.o

hw/watchdog/Makefile.objs +1 -0
+common-obj-$(CONFIG_WDT_IMX) += wdt_imx2.o
hw/watchdog/wdt_imx2.c renamed from hw/misc/imx2_wdt.c +1 -1
similarity index 98%
rename from hw/misc/imx2_wdt.c
rename to hw/watchdog/wdt_imx2.c
index 2aedfe803a..ad1ef02e9e 100644
@@ -14,7 +14,7 @@
   #include "qemu/module.h"
   #include "sysemu/watchdog.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
   #define IMX2_WDT_WCR_WDA    BIT(5)      /* -> External Reset WDOG_B */
   #define IMX2_WDT_WCR_SRS    BIT(4)      /* -> Software Reset Signal */
include/hw/arm/fsl-imx6.h +1 -1
index 60eadccb42..5b02dc1f4b 100644
@@ -21,7 +21,7 @@
   #include "hw/cpu/a9mpcore.h"
   #include "hw/misc/imx6_ccm.h"
   #include "hw/misc/imx6_src.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
   #include "hw/char/imx_serial.h"
   #include "hw/timer/imx_gpt.h"
   #include "hw/timer/imx_epit.h"
include/hw/arm/fsl-imx6ul.h +1 -1
index eda389aec7..91c746918a 100644
@@ -24,7 +24,7 @@
   #include "hw/misc/imx7_snvs.h"
   #include "hw/misc/imx7_gpr.h"
   #include "hw/intc/imx_gpcv2.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
   #include "hw/gpio/imx_gpio.h"
   #include "hw/char/imx_serial.h"
   #include "hw/timer/imx_gpt.h"
include/hw/arm/fsl-imx7.h +1 -1
index 706aef2e7e..3a0041c4c2 100644
@@ -26,7 +26,7 @@
   #include "hw/misc/imx7_snvs.h"
   #include "hw/misc/imx7_gpr.h"
   #include "hw/misc/imx6_src.h"
-#include "hw/misc/imx2_wdt.h"
+#include "hw/watchdog/wdt_imx2.h"
   #include "hw/gpio/imx_gpio.h"
   #include "hw/char/imx_serial.h"
   #include "hw/timer/imx_gpt.h"
include/hw/watchdog/wdt_imx2.h renamed from include/hw/misc/imx2_wdt.h +0 -0
similarity index 100%
rename from include/hw/misc/imx2_wdt.h
rename to include/hw/watchdog/wdt_imx2.h
#4 lore raw

Re: [PATCH 1/8] hw: Move i.MX watchdog driver to hw/watchdog

Hi Philippe,

On 3/14/20 2:46 PM, Philippe Mathieu-Daudé wrote:

[ ... ]

Quoted 24 lines

Corrected hunk:

-- >8 --

hw/arm/Kconfig +0 -0
index e5a876c8d1..c662d5f1e0 100644
@@ -373,6 +373,7 @@ config FSL_IMX6

     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select SDHCI

 config ASPEED_SOC

hw/arm/Kconfig +0 -0
@@ -410,6 +411,7 @@ config FSL_IMX7

     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select PCI_EXPRESS_DESIGNWARE
     select SDHCI
     select UNIMP

hw/arm/Kconfig +0 -0
@@ -423,6 +425,7 @@ config FSL_IMX6UL
Quoted 7 lines

     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select SDHCI
     select UNIMP

Done. I also fixed

Quoted 1 line
Quoted 1 line

+common-obj-$(CONFIG_WDT_IMX) += wdt_imx2.o

to

Quoted 1 line
Quoted 1 line

+common-obj-$(CONFIG_WDT_IMX2) += wdt_imx2.o

in patch 1/8 (that had slipped to patch 2/8).

Thanks a lot for the feedback,

Guenter

#5 lore raw

PATCH 2/8 hw/watchdog: Implement full i.MX watchdog support

In reply to Guenter Roeck

Implement full support for the watchdog in i.MX systems. Pretimeout support is optional because the watchdog hardware on i.MX31 does not support pretimeouts.

---
 hw/watchdog/Makefile.objs      |   2 +-
 hw/watchdog/wdt_imx2.c         | 196 +++++++++++++++++++++++++++++++--
 include/hw/watchdog/wdt_imx2.h |  49 ++++++++-
 3 files changed, 232 insertions(+), 15 deletions(-)
hw/watchdog/Makefile.objs +1 -1
index dd9b37f642..631b711d86 100644
@@ -4,4 +4,4 @@ common-obj-$(CONFIG_WDT_IB6300ESB) += wdt_i6300esb.o
 common-obj-$(CONFIG_WDT_IB700) += wdt_ib700.o
 common-obj-$(CONFIG_WDT_DIAG288) += wdt_diag288.o
 common-obj-$(CONFIG_ASPEED_SOC) += wdt_aspeed.o
-common-obj-$(CONFIG_WDT_IMX) += wdt_imx2.o
+common-obj-$(CONFIG_WDT_IMX2) += wdt_imx2.o
hw/watchdog/wdt_imx2.c +184 -12

236 lines not on this page · raw message

include/hw/watchdog/wdt_imx2.h +47 -2

69 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

PATCH 3/8 hw/arm/fsl-imx25: Wire up watchdog

In reply to Guenter Roeck

With this commit, the watchdog on imx25-pdk is fully operational, including pretimeout support.

---
 hw/arm/fsl-imx25.c         | 10 ++++++++++
 include/hw/arm/fsl-imx25.h |  5 +++++
 2 files changed, 15 insertions(+)
hw/arm/fsl-imx25.c +10 -0
index a3f829f436..7d5aab562d 100644
@@ -87,6 +87,7 @@ static void fsl_imx25_init(Object *obj)
                               TYPE_CHIPIDEA);
     }
 
+    sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
 }
 
 static void fsl_imx25_realize(DeviceState *dev, Error **errp)
@@ -302,6 +303,15 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
                                             usb_table[i].irq));
     }
 
+    /* Watchdog */
+    object_property_set_bool(OBJECT(&s->wdt), true, "pretimeout-support",
+                             &error_abort);
+    object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX25_WDT_ADDR);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt), 0,
+                                      qdev_get_gpio_in(DEVICE(&s->avic),
+                                                       FSL_IMX25_WDT_IRQ));
+
     /* initialize 2 x 16 KB ROM */
     memory_region_init_rom(&s->rom[0], NULL,
                            "imx25.rom0", FSL_IMX25_ROM0_SIZE, &err);
include/hw/arm/fsl-imx25.h +5 -0
index 5e196bbf05..9e228dacea 100644
@@ -29,6 +29,7 @@
 #include "hw/gpio/imx_gpio.h"
 #include "hw/sd/sdhci.h"
 #include "hw/usb/chipidea.h"
+#include "hw/watchdog/wdt_imx2.h"
 #include "exec/memory.h"
 #include "target/arm/cpu.h"
 
@@ -60,6 +61,7 @@ typedef struct FslIMX25State {
     IMXGPIOState   gpio[FSL_IMX25_NUM_GPIOS];
     SDHCIState     esdhc[FSL_IMX25_NUM_ESDHCS];
     ChipideaState  usb[FSL_IMX25_NUM_USBS];
+    IMX2WdtState   wdt;
     MemoryRegion   rom[2];
     MemoryRegion   iram;
     MemoryRegion   iram_alias;
@@ -229,6 +231,8 @@ typedef struct FslIMX25State {
 #define FSL_IMX25_GPIO1_SIZE    0x4000
 #define FSL_IMX25_GPIO2_ADDR    0x53FD0000
 #define FSL_IMX25_GPIO2_SIZE    0x4000
+#define FSL_IMX25_WDT_ADDR      0x53FDC000
+#define FSL_IMX25_WDT_SIZE      0x4000
 #define FSL_IMX25_USB1_ADDR     0x53FF4000
 #define FSL_IMX25_USB1_SIZE     0x0200
 #define FSL_IMX25_USB2_ADDR     0x53FF4400
@@ -268,5 +272,6 @@ typedef struct FslIMX25State {
 #define FSL_IMX25_ESDHC2_IRQ    8
 #define FSL_IMX25_USB1_IRQ      37
 #define FSL_IMX25_USB2_IRQ      35
+#define FSL_IMX25_WDT_IRQ       55
 
 #endif /* FSL_IMX25_H */
Signature · 1 line
2.17.1
Reviewed-by on v1 3/8
#7 lore raw

Re: [PATCH 3/8] hw/arm/fsl-imx25: Wire up watchdog

Quoted 68 lines · Guenter Roeck

With this commit, the watchdog on imx25-pdk is fully operational, including pretimeout support.

---
  hw/arm/fsl-imx25.c         | 10 ++++++++++
  include/hw/arm/fsl-imx25.h |  5 +++++
  2 files changed, 15 insertions(+)
hw/arm/fsl-imx25.c +10 -0
index a3f829f436..7d5aab562d 100644
@@ -87,6 +87,7 @@ static void fsl_imx25_init(Object *obj)
                                TYPE_CHIPIDEA);
      }
 
+    sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
  }
 
  static void fsl_imx25_realize(DeviceState *dev, Error **errp)
@@ -302,6 +303,15 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
                                              usb_table[i].irq));
      }
 
+    /* Watchdog */
+    object_property_set_bool(OBJECT(&s->wdt), true, "pretimeout-support",
+                             &error_abort);
+    object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX25_WDT_ADDR);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt), 0,
+                                      qdev_get_gpio_in(DEVICE(&s->avic),
+                                                       FSL_IMX25_WDT_IRQ));
+
      /* initialize 2 x 16 KB ROM */
      memory_region_init_rom(&s->rom[0], NULL,
                             "imx25.rom0", FSL_IMX25_ROM0_SIZE, &err);
include/hw/arm/fsl-imx25.h +4 -0
index 5e196bbf05..9e228dacea 100644
@@ -29,6 +29,7 @@
  #include "hw/gpio/imx_gpio.h"
  #include "hw/sd/sdhci.h"
  #include "hw/usb/chipidea.h"
+#include "hw/watchdog/wdt_imx2.h"
  #include "exec/memory.h"
  #include "target/arm/cpu.h"
 
@@ -60,6 +61,7 @@ typedef struct FslIMX25State {
      IMXGPIOState   gpio[FSL_IMX25_NUM_GPIOS];
      SDHCIState     esdhc[FSL_IMX25_NUM_ESDHCS];
      ChipideaState  usb[FSL_IMX25_NUM_USBS];
+    IMX2WdtState   wdt;
      MemoryRegion   rom[2];
      MemoryRegion   iram;
      MemoryRegion   iram_alias;
@@ -229,6 +231,8 @@ typedef struct FslIMX25State {
  #define FSL_IMX25_GPIO1_SIZE    0x4000
  #define FSL_IMX25_GPIO2_ADDR    0x53FD0000
  #define FSL_IMX25_GPIO2_SIZE    0x4000
+#define FSL_IMX25_WDT_ADDR      0x53FDC000
+#define FSL_IMX25_WDT_SIZE      0x4000
  #define FSL_IMX25_USB1_ADDR     0x53FF4000
  #define FSL_IMX25_USB1_SIZE     0x0200
  #define FSL_IMX25_USB2_ADDR     0x53FF4400

include/hw/arm/fsl-imx25.h typedef struct FslIMX25State { · line 277

Quoted 6 lines
include/hw/arm/fsl-imx25.h +1 -0
@@ -268,5 +272,6 @@ typedef struct FslIMX25State {
  #define FSL_IMX25_ESDHC2_IRQ    8
  #define FSL_IMX25_USB1_IRQ      37
  #define FSL_IMX25_USB2_IRQ      35
+#define FSL_IMX25_WDT_IRQ       55
 
  #endif /* FSL_IMX25_H */

Here you also need:

-- >8 --

hw/arm/Kconfig +1 -0
index c662d5f1e0..4cf8fa4967 100644
@@ -358,6 +358,7 @@ config FSL_IMX25
     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select DS1338
 
 config FSL_IMX31

---

With it:

#8 lore raw

Re: [PATCH 3/8] hw/arm/fsl-imx25: Wire up watchdog

On 3/14/20 2:48 PM, Philippe Mathieu-Daudé wrote:
[ ... ]

Quoted 14 lines

Here you also need:

-- >8 --

hw/arm/Kconfig +0 -0
index c662d5f1e0..4cf8fa4967 100644
@@ -358,6 +358,7 @@ config FSL_IMX25

     select IMX
     select IMX_FEC
     select IMX_I2C
+    select WDT_IMX2
     select DS1338

Quoted 6 lines

 config FSL_IMX31
---

With it:

Done.

Thanks,
Guenter

#9 lore raw

PATCH 4/8 hw/arm/fsl-imx31: Wire up watchdog

In reply to Guenter Roeck

With this patch, the watchdog on i.MX31 emulations is fully operational.

---
 hw/arm/fsl-imx31.c         | 6 ++++++
 include/hw/arm/fsl-imx31.h | 4 ++++
 2 files changed, 10 insertions(+)
hw/arm/fsl-imx31.c +6 -0
index 55e90d104b..cec7d0dd1b 100644
@@ -63,6 +63,8 @@ static void fsl_imx31_init(Object *obj)
         sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]),
                               TYPE_IMX_GPIO);
     }
+
+    sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
 }
 
 static void fsl_imx31_realize(DeviceState *dev, Error **errp)
@@ -205,6 +207,10 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
                                             gpio_table[i].irq));
     }
 
+    /* Watchdog */
+    object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR);
+
     /* On a real system, the first 16k is a `secure boot rom' */
     memory_region_init_rom(&s->secure_rom, NULL, "imx31.secure_rom",
                            FSL_IMX31_SECURE_ROM_SIZE, &err);
include/hw/arm/fsl-imx31.h +4 -0
index ac5ca9826a..dd8561b309 100644
@@ -25,6 +25,7 @@
 #include "hw/timer/imx_epit.h"
 #include "hw/i2c/imx_i2c.h"
 #include "hw/gpio/imx_gpio.h"
+#include "hw/watchdog/wdt_imx2.h"
 #include "exec/memory.h"
 #include "target/arm/cpu.h"
 
@@ -49,6 +50,7 @@ typedef struct FslIMX31State {
     IMXEPITState   epit[FSL_IMX31_NUM_EPITS];
     IMXI2CState    i2c[FSL_IMX31_NUM_I2CS];
     IMXGPIOState   gpio[FSL_IMX31_NUM_GPIOS];
+    IMX2WdtState   wdt;
     MemoryRegion   secure_rom;
     MemoryRegion   rom;
     MemoryRegion   iram;
@@ -87,6 +89,8 @@ typedef struct FslIMX31State {
 #define FSL_IMX31_GPIO1_SIZE            0x4000
 #define FSL_IMX31_GPIO2_ADDR            0x53FD0000
 #define FSL_IMX31_GPIO2_SIZE            0x4000
+#define FSL_IMX31_WDT_ADDR              0x53FDC000
+#define FSL_IMX31_WDT_SIZE              0x4000
 #define FSL_IMX31_AVIC_ADDR             0x68000000
 #define FSL_IMX31_AVIC_SIZE             0x100
 #define FSL_IMX31_SDRAM0_ADDR           0x80000000
Signature · 1 line
2.17.1
Reviewed-by on v1 4/8
#10 lore raw

Re: [PATCH 4/8] hw/arm/fsl-imx31: Wire up watchdog

Quoted 54 lines · Guenter Roeck

With this patch, the watchdog on i.MX31 emulations is fully operational.

---
  hw/arm/fsl-imx31.c         | 6 ++++++
  include/hw/arm/fsl-imx31.h | 4 ++++
  2 files changed, 10 insertions(+)
hw/arm/fsl-imx31.c +6 -0
index 55e90d104b..cec7d0dd1b 100644
@@ -63,6 +63,8 @@ static void fsl_imx31_init(Object *obj)
          sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]),
                                TYPE_IMX_GPIO);
      }
+
+    sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT);
  }
 
  static void fsl_imx31_realize(DeviceState *dev, Error **errp)
@@ -205,6 +207,10 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp)
                                              gpio_table[i].irq));
      }
 
+    /* Watchdog */
+    object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort);
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR);
+
      /* On a real system, the first 16k is a `secure boot rom' */
      memory_region_init_rom(&s->secure_rom, NULL, "imx31.secure_rom",
                             FSL_IMX31_SECURE_ROM_SIZE, &err);
include/hw/arm/fsl-imx31.h +2 -0
index ac5ca9826a..dd8561b309 100644
@@ -25,6 +25,7 @@
  #include "hw/timer/imx_epit.h"
  #include "hw/i2c/imx_i2c.h"
  #include "hw/gpio/imx_gpio.h"
+#include "hw/watchdog/wdt_imx2.h"
  #include "exec/memory.h"
  #include "target/arm/cpu.h"
 
@@ -49,6 +50,7 @@ typedef struct FslIMX31State {
      IMXEPITState   epit[FSL_IMX31_NUM_EPITS];
      IMXI2CState    i2c[FSL_IMX31_NUM_I2CS];
      IMXGPIOState   gpio[FSL_IMX31_NUM_GPIOS];
+    IMX2WdtState   wdt;
      MemoryRegion   secure_rom;
      MemoryRegion   rom;
      MemoryRegion   iram;

include/hw/arm/fsl-imx31.h typedef struct FslIMX31State { · line 96

Quoted 8 lines
include/hw/arm/fsl-imx31.h +2 -0
@@ -87,6 +89,8 @@ typedef struct FslIMX31State {
  #define FSL_IMX31_GPIO1_SIZE            0x4000
  #define FSL_IMX31_GPIO2_ADDR            0x53FD0000
  #define FSL_IMX31_GPIO2_SIZE            0x4000
+#define FSL_IMX31_WDT_ADDR              0x53FDC000
+#define FSL_IMX31_WDT_SIZE              0x4000
  #define FSL_IMX31_AVIC_ADDR             0x68000000
  #define FSL_IMX31_AVIC_SIZE             0x100
  #define FSL_IMX31_SDRAM0_ADDR           0x80000000

Missing Kconfig hunk:

-- >8 --

hw/arm/Kconfig +1 -0
index 4cf8fa4967..8af023abde 100644
@@ -366,6 +366,7 @@ config FSL_IMX31
     select SERIAL
     select IMX
     select IMX_I2C
+    select WDT_IMX2
     select LAN9118
 
 config FSL_IMX6

---

With it:

#11 lore raw

Re: [PATCH 4/8] hw/arm/fsl-imx31: Wire up watchdog

On 3/14/20 2:50 PM, Philippe Mathieu-Daudé wrote:

[ ...]

Quoted 14 lines

Missing Kconfig hunk:

-- >8 --

hw/arm/Kconfig +0 -0
index 4cf8fa4967..8af023abde 100644
@@ -366,6 +366,7 @@ config FSL_IMX31

     select SERIAL
     select IMX
     select IMX_I2C
+    select WDT_IMX2
     select LAN9118

Quoted 6 lines

 config FSL_IMX6
---

With it:

Done.

Thanks,
Guenter

#12 lore raw

PATCH 5/8 hw/arm/fsl-imx6: Connect watchdog interrupts

In reply to Guenter Roeck

With this patch applied, the watchdog in the sabrelite emulation is fully operational, including pretimeout support.

---
 hw/arm/fsl-imx6.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/arm/fsl-imx6.c +9 -0
index ecc62855f2..b266d40881 100644
@@ -397,11 +397,20 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
             FSL_IMX6_WDOG1_ADDR,
             FSL_IMX6_WDOG2_ADDR,
         };
+        static const int FSL_IMX6_WDOGn_IRQ[FSL_IMX6_NUM_WDTS] = {
+            FSL_IMX6_WDOG1_IRQ,
+            FSL_IMX6_WDOG2_IRQ,
+        };
 
+        object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
+                                 &error_abort);
         object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
                                  &error_abort);
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX6_WDOGn_ADDR[i]);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
+                           qdev_get_gpio_in(DEVICE(&s->a9mpcore),
+                                            FSL_IMX6_WDOGn_IRQ[i]));
     }
 
     /* ROM memory */
Signature · 1 line
2.17.1
#13 lore raw

PATCH 6/8 hw/arm/fsl-imx6ul: Connect watchdog interrupts

In reply to Guenter Roeck

With this commit, the watchdog on mcimx6ul-evk is fully operational, including pretimeout support.

---
 hw/arm/fsl-imx6ul.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
hw/arm/fsl-imx6ul.c +10 -0
index c405b68d1d..8d3b91dd85 100644
@@ -496,12 +496,22 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
             FSL_IMX6UL_WDOG2_ADDR,
             FSL_IMX6UL_WDOG3_ADDR,
         };
+        static const int FSL_IMX6UL_WDOGn_IRQ[FSL_IMX6UL_NUM_WDTS] = {
+            FSL_IMX6UL_WDOG1_IRQ,
+            FSL_IMX6UL_WDOG2_IRQ,
+            FSL_IMX6UL_WDOG3_IRQ,
+        };
 
+        object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
+                                 &error_abort);
         object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
                                  &error_abort);
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0,
                         FSL_IMX6UL_WDOGn_ADDR[i]);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
+                           qdev_get_gpio_in(DEVICE(&s->a7mpcore),
+                                            FSL_IMX6UL_WDOGn_IRQ[i]));
     }
 
     /*
Signature · 1 line
2.17.1
#14 lore raw

PATCH 7/8 hw/arm/fsl-imx7: Instantiate various unimplemented devices

In reply to Guenter Roeck

Instantiating PWM, CAN, CAAM, and OCOTP devices is necessary to avoid crashes when booting mainline Linux.

---
 hw/arm/fsl-imx7.c         | 24 ++++++++++++++++++++++++
 include/hw/arm/fsl-imx7.h | 16 ++++++++++++++++
 2 files changed, 40 insertions(+)
hw/arm/fsl-imx7.c +24 -0
index 119b281a50..29382776b2 100644
@@ -459,6 +459,30 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
      */
     create_unimplemented_device("sdma", FSL_IMX7_SDMA_ADDR, FSL_IMX7_SDMA_SIZE);
 
+    /*
+     * CAAM
+     */
+    create_unimplemented_device("caam", FSL_IMX7_CAAM_ADDR, FSL_IMX7_CAAM_SIZE);
+
+    /*
+     * PWM
+     */
+    create_unimplemented_device("pwm1", FSL_IMX7_PWM1_ADDR, FSL_IMX7_PWMn_SIZE);
+    create_unimplemented_device("pwm2", FSL_IMX7_PWM2_ADDR, FSL_IMX7_PWMn_SIZE);
+    create_unimplemented_device("pwm3", FSL_IMX7_PWM3_ADDR, FSL_IMX7_PWMn_SIZE);
+    create_unimplemented_device("pwm4", FSL_IMX7_PWM4_ADDR, FSL_IMX7_PWMn_SIZE);
+
+    /*
+     * CAN
+     */
+    create_unimplemented_device("can1", FSL_IMX7_CAN1_ADDR, FSL_IMX7_CANn_SIZE);
+    create_unimplemented_device("can2", FSL_IMX7_CAN2_ADDR, FSL_IMX7_CANn_SIZE);
+
+    /*
+     * OCOTP
+     */
+    create_unimplemented_device("octop", FSL_IMX7_OCOTP_ADDR,
+                                FSL_IMX7_OCOTP_SIZE);
 
     object_property_set_bool(OBJECT(&s->gpr), true, "realized",
                              &error_abort);
include/hw/arm/fsl-imx7.h +16 -0
index 3a0041c4c2..47826da2b7 100644
@@ -113,6 +113,9 @@ enum FslIMX7MemoryMap {
     FSL_IMX7_IOMUXC_GPR_ADDR      = 0x30340000,
     FSL_IMX7_IOMUXCn_SIZE         = 0x1000,
 
+    FSL_IMX7_OCOTP_ADDR           = 0x30350000,
+    FSL_IMX7_OCOTP_SIZE           = 0x10000,
+
     FSL_IMX7_ANALOG_ADDR          = 0x30360000,
     FSL_IMX7_SNVS_ADDR            = 0x30370000,
     FSL_IMX7_CCM_ADDR             = 0x30380000,
@@ -124,11 +127,24 @@ enum FslIMX7MemoryMap {
     FSL_IMX7_ADC2_ADDR            = 0x30620000,
     FSL_IMX7_ADCn_SIZE            = 0x1000,
 
+    FSL_IMX7_PWM1_ADDR            = 0x30660000,
+    FSL_IMX7_PWM2_ADDR            = 0x30670000,
+    FSL_IMX7_PWM3_ADDR            = 0x30680000,
+    FSL_IMX7_PWM4_ADDR            = 0x30690000,
+    FSL_IMX7_PWMn_SIZE            = 0x10000,
+
     FSL_IMX7_PCIE_PHY_ADDR        = 0x306D0000,
     FSL_IMX7_PCIE_PHY_SIZE        = 0x10000,
 
     FSL_IMX7_GPC_ADDR             = 0x303A0000,
 
+    FSL_IMX7_CAAM_ADDR            = 0x30900000,
+    FSL_IMX7_CAAM_SIZE            = 0x40000,
+
+    FSL_IMX7_CAN1_ADDR            = 0x30A00000,
+    FSL_IMX7_CAN2_ADDR            = 0x30A10000,
+    FSL_IMX7_CANn_SIZE            = 0x10000,
+
     FSL_IMX7_I2C1_ADDR            = 0x30A20000,
     FSL_IMX7_I2C2_ADDR            = 0x30A30000,
     FSL_IMX7_I2C3_ADDR            = 0x30A40000,
Signature · 1 line
2.17.1
#15 lore raw

PATCH 8/8 hw/arm/fsl-imx7: Connect watchdog interrupts

In reply to Guenter Roeck

i.MX7 supports watchdog pretimeout interupts. With this commit, the watchdog in mcimx7d-sabre is fully operational, including pretimeout support.

---
 hw/arm/fsl-imx7.c         | 11 +++++++++++
 include/hw/arm/fsl-imx7.h |  5 +++++
 2 files changed, 16 insertions(+)
hw/arm/fsl-imx7.c +11 -0
index 29382776b2..6c539c8b23 100644
@@ -447,11 +447,22 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
             FSL_IMX7_WDOG3_ADDR,
             FSL_IMX7_WDOG4_ADDR,
         };
+        static const int FSL_IMX7_WDOGn_IRQ[FSL_IMX7_NUM_WDTS] = {
+            FSL_IMX7_WDOG1_IRQ,
+            FSL_IMX7_WDOG2_IRQ,
+            FSL_IMX7_WDOG3_IRQ,
+            FSL_IMX7_WDOG4_IRQ,
+        };
 
+        object_property_set_bool(OBJECT(&s->wdt[i]), true, "pretimeout-support",
+                                 &error_abort);
         object_property_set_bool(OBJECT(&s->wdt[i]), true, "realized",
                                  &error_abort);
 
         sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[i]), 0, FSL_IMX7_WDOGn_ADDR[i]);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[i]), 0,
+                           qdev_get_gpio_in(DEVICE(&s->a7mpcore),
+                                            FSL_IMX7_WDOGn_IRQ[i]));
     }
 
     /*
include/hw/arm/fsl-imx7.h +5 -0
index 47826da2b7..da977f9ffb 100644
@@ -228,6 +228,11 @@ enum FslIMX7IRQs {
     FSL_IMX7_USB2_IRQ     = 42,
     FSL_IMX7_USB3_IRQ     = 40,
 
+    FSL_IMX7_WDOG1_IRQ    = 78,
+    FSL_IMX7_WDOG2_IRQ    = 79,
+    FSL_IMX7_WDOG3_IRQ    = 10,
+    FSL_IMX7_WDOG4_IRQ    = 109,
+
     FSL_IMX7_PCI_INTA_IRQ = 125,
     FSL_IMX7_PCI_INTB_IRQ = 124,
     FSL_IMX7_PCI_INTC_IRQ = 123,
Signature · 1 line
2.17.1