Module Name:    src
Committed By:   reinoud
Date:           Fri Apr 18 14:32:49 UTC 2014

Modified Files:
        src/sys/arch/arm/samsung: exynos_reg.h exynos_wdt.c
Added Files:
        src/sys/arch/arm/samsung: exynos_wdt_reg.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_reg.h \
    src/sys/arch/arm/samsung/exynos_wdt.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/samsung/exynos_wdt_reg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/samsung/exynos_reg.h
diff -u src/sys/arch/arm/samsung/exynos_reg.h:1.1 src/sys/arch/arm/samsung/exynos_reg.h:1.2
--- src/sys/arch/arm/samsung/exynos_reg.h:1.1	Sun Apr 13 02:26:26 2014
+++ src/sys/arch/arm/samsung/exynos_reg.h	Fri Apr 18 14:32:49 2014
@@ -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! */
Index: src/sys/arch/arm/samsung/exynos_wdt.c
diff -u src/sys/arch/arm/samsung/exynos_wdt.c:1.1 src/sys/arch/arm/samsung/exynos_wdt.c:1.2
--- src/sys/arch/arm/samsung/exynos_wdt.c:1.1	Sun Apr 13 02:26:26 2014
+++ src/sys/arch/arm/samsung/exynos_wdt.c	Fri Apr 18 14:32:49 2014
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_wdt.c
 
 #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 @@ exynos_wdt_attach(device_t parent, devic
 	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;
 	}

Added files:

Index: src/sys/arch/arm/samsung/exynos_wdt_reg.h
diff -u /dev/null src/sys/arch/arm/samsung/exynos_wdt_reg.h:1.1
--- /dev/null	Fri Apr 18 14:32:49 2014
+++ src/sys/arch/arm/samsung/exynos_wdt_reg.h	Fri Apr 18 14:32:49 2014
@@ -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_ */
+

Reply via email to