Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Add direct config support for all devices used b...
details: https://anonhg.NetBSD.org/src/rev/bab37d3a516c
branches: trunk
changeset: 765490:bab37d3a516c
user: phx <phx%NetBSD.org@localhost>
date: Sat May 28 13:59:31 2011 +0000
description:
Add direct config support for all devices used by sandpoint.
diffstat:
sys/dev/i2c/ds1307.c | 18 ++++++++++++------
sys/dev/i2c/m41st84.c | 18 ++++++++++++------
sys/dev/i2c/rs5c372.c | 17 ++++++++++++-----
sys/dev/i2c/s390.c | 15 +++++++++++----
4 files changed, 47 insertions(+), 21 deletions(-)
diffs (152 lines):
diff -r 848d455f28fe -r bab37d3a516c sys/dev/i2c/ds1307.c
--- a/sys/dev/i2c/ds1307.c Sat May 28 13:01:49 2011 +0000
+++ b/sys/dev/i2c/ds1307.c Sat May 28 13:59:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ds1307.c,v 1.12 2008/06/08 03:49:26 tsutsui Exp $ */
+/* $NetBSD: ds1307.c,v 1.13 2011/05/28 13:59:31 phx Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.12 2008/06/08 03:49:26 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.13 2011/05/28 13:59:31 phx Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -87,10 +87,16 @@
{
struct i2c_attach_args *ia = arg;
- if (ia->ia_addr == DS1307_ADDR)
- return (1);
-
- return (0);
+ if (ia->ia_name) {
+ /* direct config - check name */
+ if (strcmp(ia->ia_name, "dsrtc") == 0)
+ return 1;
+ } else {
+ /* indirect config - check typical address */
+ if (ia->ia_addr == DS1307_ADDR)
+ return 1;
+ }
+ return 0;
}
static void
diff -r 848d455f28fe -r bab37d3a516c sys/dev/i2c/m41st84.c
--- a/sys/dev/i2c/m41st84.c Sat May 28 13:01:49 2011 +0000
+++ b/sys/dev/i2c/m41st84.c Sat May 28 13:59:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: m41st84.c,v 1.17 2011/04/17 14:58:26 phx Exp $ */
+/* $NetBSD: m41st84.c,v 1.18 2011/05/28 13:59:31 phx Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: m41st84.c,v 1.17 2011/04/17 14:58:26 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: m41st84.c,v 1.18 2011/05/28 13:59:31 phx Exp $");
#include "opt_strtc.h"
@@ -93,10 +93,16 @@
{
struct i2c_attach_args *ia = arg;
- if (ia->ia_addr == M41ST84_ADDR)
- return (1);
-
- return (0);
+ if (ia->ia_name) {
+ /* direct config - check name */
+ if (strcmp(ia->ia_name, "strtc") == 0)
+ return 1;
+ } else {
+ /* indirect config - check typical address */
+ if (ia->ia_addr == M41ST84_ADDR)
+ return 1;
+ }
+ return 0;
}
static void
diff -r 848d455f28fe -r bab37d3a516c sys/dev/i2c/rs5c372.c
--- a/sys/dev/i2c/rs5c372.c Sat May 28 13:01:49 2011 +0000
+++ b/sys/dev/i2c/rs5c372.c Sat May 28 13:59:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rs5c372.c,v 1.10 2009/12/12 14:44:10 tsutsui Exp $ */
+/* $NetBSD: rs5c372.c,v 1.11 2011/05/28 13:59:31 phx Exp $ */
/*
* Copyright (c) 2005 Kimihiro Nonaka
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rs5c372.c,v 1.10 2009/12/12 14:44:10 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rs5c372.c,v 1.11 2011/05/28 13:59:31 phx Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -67,9 +67,16 @@
{
struct i2c_attach_args *ia = arg;
- if (ia->ia_addr == RS5C372_ADDR)
- return (1);
- return (0);
+ if (ia->ia_name) {
+ /* direct config - check name */
+ if (strcmp(ia->ia_name, "rs5c372rtc") == 0)
+ return 1;
+ } else {
+ /* indirect config - check typical address */
+ if (ia->ia_addr == RS5C372_ADDR)
+ return 1;
+ }
+ return 0;
}
static void
diff -r 848d455f28fe -r bab37d3a516c sys/dev/i2c/s390.c
--- a/sys/dev/i2c/s390.c Sat May 28 13:01:49 2011 +0000
+++ b/sys/dev/i2c/s390.c Sat May 28 13:59:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: s390.c,v 1.1 2011/04/04 17:58:40 phx Exp $ */
+/* $NetBSD: s390.c,v 1.2 2011/05/28 13:59:31 phx Exp $ */
/*-
* Copyright (c) 2011 Frank Wille.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: s390.c,v 1.1 2011/04/04 17:58:40 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: s390.c,v 1.2 2011/05/28 13:59:31 phx Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -67,8 +67,15 @@
{
struct i2c_attach_args *ia = arg;
- if (ia->ia_addr == S390_ADDR)
- return 1;
+ if (ia->ia_name) {
+ /* direct config - check name */
+ if (strcmp(ia->ia_name, "s390rtc") == 0)
+ return 1;
+ } else {
+ /* indirect config - check typical address */
+ if (ia->ia_addr == S390_ADDR)
+ return 1;
+ }
return 0;
}
Home |
Main Index |
Thread Index |
Old Index