Re: [U-Boot] [PATCH v3] ftwdt010_wdt: support faraday ftwdt010 watchdog

2011-02-09 Thread Macpaul Lin
Dear Wolfgang,

Since the Linux Driver still under clean up, I will modify the copyright
 statement
 of this driver for u-boot and send patch v3.


I have modified copyright statement for this patch ftwdt010_wdt v3
http://patchwork.ozlabs.org/patch/77564/
and send patch v4
http://patchwork.ozlabs.org/patch/80490/
about 2 weeks ago.

Just remind you if this method is capable, please apply the new patch.
Thanks a lot.


-- 
Best regards,
Macpaul Lin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] ftwdt010_wdt: support faraday ftwdt010 watchdog

2011-01-26 Thread Macpaul Lin
Dear Wolfgang

2011/1/26 Wolfgang Denk w...@denx.de

 Dear Macpaul Lin,


[deleted]


 Maybe you can add a link to the mailing list entry which shows your
 submission?  I think it is in any case interesting to the reader to be
 able to refer to the Linux driver source as well.

  If the driver source haven't be accepted by Linux kernel, I think I can
  modify the copyright
  statement hence this driver is independent with current Linux Kernel.

 Indeed.


Since the Linux Driver still under clean up, I will modify the copyright
statement
of this driver for u-boot and send patch v3.

Po-Yu: If you were doing the code clean up works for watchdog timer for
Linux
Kernel, please keep on doing this work. Since I have no time to deal with
Linux
Kernel recently. If you have clean patch of this watchdog driver please
commit it, too.

Best regards,
Macpaul Lin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] ftwdt010_wdt: support faraday ftwdt010 watchdog

2011-01-25 Thread Wolfgang Denk
Dear Macpaul Lin,

In message 1294195930-11548-1-git-send-email-macp...@andestech.com you wrote:
 Faraday ftwdt010 watchdog is an architecture independant
 watchdog. It is usaually used in SoC chip design.
 
 Signed-off-by: Macpaul Lin macp...@andestech.com
 ---
 Change v2:
   Fix the wrong title of ftwdt010_wdt patch.
 Change v3:
   Patch v2 was encoded in utf-8. Fixed to ASCII.
...
 +++ b/drivers/watchdog/ftwdt010_wdt.c
 @@ -0,0 +1,95 @@
 +/*
 + * [origin: Linux kernel drivers/watchdog/ftwdt010_wdt.c]

Sorry, but I see only now that this file was derived from Linux.
Please note this accordingly in the commit message - see
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
 

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
No man knows what true happiness is until he gets married.  By  then,
of course, its too late.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] ftwdt010_wdt: support faraday ftwdt010 watchdog

2011-01-25 Thread Macpaul Lin
Hi Wolfgang,

2011/1/26 Wolfgang Denk w...@denx.de

 Dear Macpaul Lin,

 In message 1294195930-11548-1-git-send-email-macp...@andestech.com you
 wrote:
  Faraday ftwdt010 watchdog is an architecture independant
  watchdog. It is usaually used in SoC chip design.
 
  Signed-off-by: Macpaul Lin macp...@andestech.com
  ---
  Change v2:
Fix the wrong title of ftwdt010_wdt patch.
  Change v3:
Patch v2 was encoded in utf-8. Fixed to ASCII.
 ...
  +++ b/drivers/watchdog/ftwdt010_wdt.c
  @@ -0,0 +1,95 @@
  +/*
  + * [origin: Linux kernel drivers/watchdog/ftwdt010_wdt.c]

 Sorry, but I see only now that this file was derived from Linux.
 Please note this accordingly in the commit message - see

 http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
 


Ah, there is a problem here.

The upstream Linux Kernel source tree has not accept this commit.
If the reference driver source (GPL) haven't released to Linux Kernel yet,
or the reference source code is just send to Linux Kernel. How do we deal
with it?

If the driver source haven't be accepted by Linux kernel, I think I can
modify the copyright
statement hence this driver is independent with current Linux Kernel.
-- 
Best regards,
Macpaul Lin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] ftwdt010_wdt: support faraday ftwdt010 watchdog

2011-01-25 Thread Wolfgang Denk
Dear Macpaul Lin,

In message aanlktin+fd7edxc4vy1ifgnpgoa5zbax83ciqjva+...@mail.gmail.com you 
wrote:
 
  Sorry, but I see only now that this file was derived from Linux.
  Please note this accordingly in the commit message - see
 
  http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
...
 The upstream Linux Kernel source tree has not accept this commit.
 If the reference driver source (GPL) haven't released to Linux Kernel yet,
 or the reference source code is just send to Linux Kernel. How do we deal
 with it?

Maybe you can add a link to the mailing list entry which shows your
submission?  I think it is in any case interesting to the reader to be
able to refer to the Linux driver source as well.

 If the driver source haven't be accepted by Linux kernel, I think I can
 modify the copyright
 statement hence this driver is independent with current Linux Kernel.

Indeed.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
If it happens once, it's a bug.
If it happens twice, it's a feature.
If it happens more than twice, it's a design philosophy.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3] ftwdt010_wdt: support faraday ftwdt010 watchdog

2011-01-04 Thread Macpaul Lin
Faraday ftwdt010 watchdog is an architecture independant
watchdog. It is usaually used in SoC chip design.

Signed-off-by: Macpaul Lin macp...@andestech.com
---
Change v2:
  Fix the wrong title of ftwdt010_wdt patch.
Change v3:
  Patch v2 was encoded in utf-8. Fixed to ASCII.

 drivers/watchdog/Makefile   |1 +
 drivers/watchdog/ftwdt010_wdt.c |   95 ++
 drivers/watchdog/ftwdt010_wdt.h |   96 +++
 3 files changed, 192 insertions(+), 0 deletions(-)
 create mode 100644 drivers/watchdog/ftwdt010_wdt.c
 create mode 100644 drivers/watchdog/ftwdt010_wdt.h

diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 6ab4d52..5579bf2 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB:= $(obj)libwatchdog.o
 
 COBJS-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
+COBJS-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c
new file mode 100644
index 000..8571f15
--- /dev/null
+++ b/drivers/watchdog/ftwdt010_wdt.c
@@ -0,0 +1,95 @@
+/*
+ * [origin: Linux kernel drivers/watchdog/ftwdt010_wdt.c]
+ *
+ * Watchdog driver for the FTWDT010 Watch Dog Driver
+ *
+ * (c) Copyright 2004 Faraday Technology Corp. (www.faraday-tech.com)
+ * Based on sa1100_wdt.c by Oleg Drokin gr...@crimea.edu
+ * Based on SoftDog driver by Alan Cox a...@redhat.com
+ *
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Macpaul Lin, Andes Technology Corporation macp...@andestech.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * 27/11/2004 Initial release, Faraday.
+ * 12/01/2011 Port to u-boot, Macpaul Lin.
+ */
+
+#include common.h
+#include watchdog.h
+#include asm/io.h
+#include ftwdt010_wdt.h
+
+/*
+ * Set the watchdog time interval.
+ * Counter is 32 bit.
+ */
+static int ftwdt010_wdt_settimeout(unsigned int timeout)
+{
+   unsigned int reg;
+
+   struct ftwdt010_wdt *wd = (struct ftwdt010_wdt *)CONFIG_FTWDT010_BASE;
+
+   debug(Activating WDT..\n);
+
+   /* Check if disabled */
+   if (readl(wd-wdcr)  ~FTWDT010_WDCR_ENABLE) {
+   printf(sorry, watchdog is disabled\n);
+   return -1;
+   }
+
+   /*
+* In a 66MHz system,
+* if you set WDLOAD as 0x03EF1480 (6600)
+* the reset timer is 1 second.
+*/
+   reg = FTWDT010_WDLOAD(timeout * FTWDT010_TIMEOUT_FACTOR);
+
+   writel(reg, wd-wdload);
+
+   return 0;
+}
+
+void ftwdt010_wdt_reset()
+{
+   struct ftwdt010_wdt *wd = (struct ftwdt010_wdt *)CONFIG_FTWDT010_BASE;
+
+   /* clear control register */
+   writel(0, wd-wdcr);
+
+   /* Write Magic number */
+   writel(FTWDT010_WDRESTART_MAGIC, wd-wdrestart);
+
+   /* Enable WDT */
+   writel((FTWDT010_WDCR_RST | FTWDT010_WDCR_ENABLE), wd-wdcr);
+}
+
+void ftwdt010_wdt_disable()
+{
+   struct ftwdt010_wdt *wd = (struct ftwdt010_wdt *)CONFIG_FTWDT010_BASE;
+
+   debug(Deactivating WDT..\n);
+
+   /*
+* It was defined with CONFIG_WATCHDOG_NOWAYOUT in Linux
+*
+* Shut off the timer.
+* Lock it in if it's a module and we defined ...NOWAYOUT
+*/
+   writel(0, wd-wdcr);
+}
+
+void hw_watchdog_reset()
+{
+   ftwdt010_wdt_reset();
+}
+
+void hw_watchdog_init(void)
+{
+   /* set timer in ms */
+   ftwdt010_wdt_settimeout(CONFIG_FTWDT010_HW_TIMEOUT * 1000);
+}
diff --git a/drivers/watchdog/ftwdt010_wdt.h b/drivers/watchdog/ftwdt010_wdt.h
new file mode 100644
index 000..00daec5
--- /dev/null
+++ b/drivers/watchdog/ftwdt010_wdt.h
@@ -0,0 +1,96 @@
+/*
+ * [origin: Linux kernel drivers/watchdog/ftwdt010_wdt.c]
+ *
+ * Watchdog driver for the FTWDT010 Watch Dog Driver
+ *
+ * (c) Copyright 2004 Faraday Technology Corp. (www.faraday-tech.com)
+ * Based on sa1100_wdt.c by Oleg Drokin gr...@crimea.edu
+ * Based on SoftDog driver by Alan Cox a...@redhat.com
+ *
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Macpaul Lin, Andes Technology Corporation macp...@andestech.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * 27/11/2004 Initial release, Faraday.
+ * 12/01/2011 Port to u-boot, Macpaul Lin.
+ */
+
+#ifndef __FTWDT010_H
+#define __FTWDT010_H
+
+struct ftwdt010_wdt {
+   unsigned intwdcounter;  /* Counter Reg  - 0x00 */
+   unsigned intwdload; /* Counter Auto Reload Reg - 0x04 */
+   unsigned int