]> git.sur5r.net Git - u-boot/blobdiff - board/keymile/kmp204x/qrio.c
stm32: stm32f4: move flash driver to mtd driver location
[u-boot] / board / keymile / kmp204x / qrio.c
index 08d5ca43dfd596c72cf216342945f1d243d442ae..edf3bf11a89403c3d02026282aee77248157c45e 100644 (file)
@@ -91,7 +91,7 @@ void qrio_set_opendrain_gpio(u8 port_off, u8 gpio_nr, u8 val)
 
 #define WDMASK_OFF     0x16
 
-static void qrio_wdmask(u8 bit, bool wden)
+void qrio_wdmask(u8 bit, bool wden)
 {
        u16 wdmask;
        void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
@@ -173,3 +173,35 @@ void qrio_enable_app_buffer(void)
        ctrll |= (CTRLL_WRB_BUFENA);
        out_8(qrio_base + CTRLL_OFF, ctrll);
 }
+
+#define REASON1_OFF    0x12
+#define REASON1_CPUWD  0x01
+
+void qrio_cpuwd_flag(bool flag)
+{
+       u8 reason1;
+       void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+       reason1 = in_8(qrio_base + REASON1_OFF);
+       if (flag)
+               reason1 |= REASON1_CPUWD;
+       else
+               reason1 &= ~REASON1_CPUWD;
+       out_8(qrio_base + REASON1_OFF, reason1);
+}
+
+#define RSTCFG_OFF     0x11
+
+void qrio_uprstreq(u8 mode)
+{
+       u32 rstcfg;
+       void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+       rstcfg = in_8(qrio_base + RSTCFG_OFF);
+
+       if (mode & UPREQ_CORE_RST)
+               rstcfg |= UPREQ_CORE_RST;
+       else
+               rstcfg &= ~UPREQ_CORE_RST;
+
+       out_8(qrio_base + RSTCFG_OFF, rstcfg);
+}