Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/samsung Fix attachment of wdt to also use the b...



details:   https://anonhg.NetBSD.org/src/rev/db60f6ffc4bf
branches:  trunk
changeset: 795562:db60f6ffc4bf
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Apr 18 14:32:49 2014 +0000

description:
Fix attachment of wdt to also use the bus_space_handle

While here, move the registers outside the global register file to a separate
wdt_reg.h file.

diffstat:

 sys/arch/arm/samsung/exynos_reg.h     |  17 -----------
 sys/arch/arm/samsung/exynos_wdt.c     |   9 +++--
 sys/arch/arm/samsung/exynos_wdt_reg.h |  51 +++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 21 deletions(-)

diffs (119 lines):

diff -r a18a9cf8c2d8 -r db60f6ffc4bf sys/arch/arm/samsung/exynos_reg.h
--- a/sys/arch/arm/samsung/exynos_reg.h Fri Apr 18 14:18:33 2014 +0000
+++ b/sys/arch/arm/samsung/exynos_reg.h Fri Apr 18 14:32:49 2014 +0000
@@ -95,23 +95,6 @@
 /* standard block size for offsets defined below */
 #define EXYNOS_BLOCK_SIZE              0x00010000
 
-#define EXYNOS_WDT_WTCON               0x0000
-#define  WTCON_PRESCALER               __BITS(15,8)
-#define  WTCON_ENABLE                  __BIT(5)
-#define  WTCON_CLOCK_SELECT            __BITS(4,3)
-#define  WTCON_CLOCK_SELECT_16         __SHIFTIN(0, WTCON_CLOCK_SELECT)
-#define  WTCON_CLOCK_SELECT_32         __SHIFTIN(1, WTCON_CLOCK_SELECT)
-#define  WTCON_CLOCK_SELECT_64         __SHIFTIN(2, WTCON_CLOCK_SELECT)
-#define  WTCON_CLOCK_SELECT_128                __SHIFTIN(3, WTCON_CLOCK_SELECT)
-#define  WTCON_INT_ENABLE              __BIT(2)
-#define  WTCON_RESET_ENABLE            __BIT(0)
-#define EXYNOS_WDT_WTDAT               0x0004
-#define  WTDAT_RELOAD                  __BITS(15,0)
-#define EXYNOS_WDT_WTCNT               0x0008
-#define  WTCNT_COUNT                   __BITS(15,0)
-#define EXYNOS_WDT_WTCLRINT            0x000C
-
-
 /* standard frequency settings */
 #define EXYNOS_ACLK_REF_FREQ           (200*1000*1000) /* 200 Mhz */
 #define EXYNOS_UART_FREQ               (109*1000*1000) /* should be EXYNOS_ACLK_REF_FREQ! */
diff -r a18a9cf8c2d8 -r db60f6ffc4bf sys/arch/arm/samsung/exynos_wdt.c
--- a/sys/arch/arm/samsung/exynos_wdt.c Fri Apr 18 14:18:33 2014 +0000
+++ b/sys/arch/arm/samsung/exynos_wdt.c Fri Apr 18 14:32:49 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exynos_wdt.c,v 1.1 2014/04/13 02:26:26 matt Exp $      */
+/*     $NetBSD: exynos_wdt.c,v 1.2 2014/04/18 14:32:49 reinoud Exp $   */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "exynos_wdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.1 2014/04/13 02:26:26 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c,v 1.2 2014/04/18 14:32:49 reinoud Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -46,6 +46,7 @@
 
 #include <arm/samsung/exynos_reg.h>
 #include <arm/samsung/exynos_var.h>
+#include <arm/samsung/exynos_wdt_reg.h>
 
 #if NEXYNOS_WDT > 0
 static int exynos_wdt_match(device_t, cfdata_t, void *);
@@ -177,8 +178,8 @@
        sc->sc_dev = self;
        sc->sc_bst = exyo->exyo_core_bst;
 
-       if (bus_space_map(sc->sc_bst, exyo->exyo_loc.loc_offset,
-           exyo->exyo_loc.loc_size, 0, &sc->sc_wdog_bsh)) {
+       if (bus_space_subregion(sc->sc_bst, exyo->exyo_core_bsh,
+           exyo->exyo_loc.loc_offset, exyo->exyo_loc.loc_size, &sc->sc_wdog_bsh)) {
                aprint_error(": failed to map registers\n");
                return;
        }
diff -r a18a9cf8c2d8 -r db60f6ffc4bf sys/arch/arm/samsung/exynos_wdt_reg.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/samsung/exynos_wdt_reg.h     Fri Apr 18 14:32:49 2014 +0000
@@ -0,0 +1,51 @@
+/* $NetBSD */
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ARM_SAMSUNG_EXYNOS_WDT_REG_H_
+#define _ARM_SAMSUNG_EXYNOS_WDT_REG_H_
+
+#define EXYNOS_WDT_WTCON               0x0000
+#define  WTCON_PRESCALER               __BITS(15,8)
+#define  WTCON_ENABLE                  __BIT(5)
+#define  WTCON_CLOCK_SELECT            __BITS(4,3)
+#define  WTCON_CLOCK_SELECT_16         __SHIFTIN(0, WTCON_CLOCK_SELECT)
+#define  WTCON_CLOCK_SELECT_32         __SHIFTIN(1, WTCON_CLOCK_SELECT)
+#define  WTCON_CLOCK_SELECT_64         __SHIFTIN(2, WTCON_CLOCK_SELECT)
+#define  WTCON_CLOCK_SELECT_128                __SHIFTIN(3, WTCON_CLOCK_SELECT)
+#define  WTCON_INT_ENABLE              __BIT(2)
+#define  WTCON_RESET_ENABLE            __BIT(0)
+#define EXYNOS_WDT_WTDAT               0x0004
+#define  WTDAT_RELOAD                  __BITS(15,0)
+#define EXYNOS_WDT_WTCNT               0x0008
+#define  WTCNT_COUNT                   __BITS(15,0)
+#define EXYNOS_WDT_WTCLRINT            0x000C
+
+#endif /* _ARM_SAMSUNG_EXYNOS_WDT_REG_H_ */
+



Home | Main Index | Thread Index | Old Index