Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcmips/dev recognize UCB1100 id.
details: https://anonhg.NetBSD.org/src/rev/e83386a8c313
branches: trunk
changeset: 483547:e83386a8c313
user: uch <uch%NetBSD.org@localhost>
date: Sun Mar 12 15:36:11 2000 +0000
description:
recognize UCB1100 id.
diffstat:
sys/arch/hpcmips/dev/ucb1200.c | 49 ++++++++++++++++++++++++++++++++------
sys/arch/hpcmips/dev/ucb1200reg.h | 7 ++++-
2 files changed, 47 insertions(+), 9 deletions(-)
diffs (128 lines):
diff -r f4c3f5e6c2cd -r e83386a8c313 sys/arch/hpcmips/dev/ucb1200.c
--- a/sys/arch/hpcmips/dev/ucb1200.c Sun Mar 12 15:35:29 2000 +0000
+++ b/sys/arch/hpcmips/dev/ucb1200.c Sun Mar 12 15:36:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ucb1200.c,v 1.3 2000/02/27 16:37:50 uch Exp $ */
+/* $NetBSD: ucb1200.c,v 1.4 2000/03/12 15:36:11 uch Exp $ */
/*
* Copyright (c) 2000, by UCHIYAMA Yasushi
@@ -61,9 +61,9 @@
};
struct ucb1200_softc {
- struct device sc_dev;
- struct device *sc_parent; /* parent (TX39 SIB module) */
- tx_chipset_tag_t sc_tc;
+ struct device sc_dev;
+ struct device *sc_parent; /* parent (TX39 SIB module) */
+ tx_chipset_tag_t sc_tc;
int sc_snd_rate; /* passed down from SIB module */
int sc_tel_rate;
@@ -76,6 +76,7 @@
void ucb1200_attach __P((struct device*, struct device*, void*));
int ucb1200_print __P((void*, const char*));
int ucb1200_search __P((struct device*, struct cfdata*, void*));
+int ucb1200_check_id __P((u_int16_t, int));
#ifdef UCB1200DEBUG
void ucb1200_dump __P((struct ucb1200_softc*));
@@ -85,6 +86,17 @@
sizeof(struct ucb1200_softc), ucb1200_match, ucb1200_attach
};
+const struct ucb_id {
+ u_int16_t id;
+ const char *product;
+} ucb_id[] = {
+ { UCB1100_ID, "PHILIPS UCB1100" },
+ { UCB1200_ID, "PHILIPS UCB1200" },
+ { UCB1300_ID, "PHILIPS UCB1300" },
+ { TC35413F_ID, "TOSHIBA TC35413F" },
+ { 0, 0 }
+};
+
int
ucb1200_match(parent, cf, aux)
struct device *parent;
@@ -98,10 +110,7 @@
return 0;
reg = txsibsf0_reg_read(sa->sa_tc, UCB1200_ID_REG);
- if (reg == UCB1200_ID || reg == TC35413F_ID)
- return 1;
- else
- return 0;
+ return (ucb1200_check_id(reg, 0));
}
void
@@ -112,7 +121,9 @@
{
struct txsib_attach_args *sa = aux;
struct ucb1200_softc *sc = (void*)self;
+ u_int16_t reg;
+ printf(": ");
sc->sc_tc = sa->sa_tc;
sc->sc_parent = parent;
sc->sc_snd_rate = sa->sa_snd_rate;
@@ -125,6 +136,8 @@
if (ucb1200debug)
ucb1200_dump(sc);
#endif
+ reg = txsibsf0_reg_read(sa->sa_tc, UCB1200_ID_REG);
+ (void)ucb1200_check_id(reg, 1);
printf("\n");
config_search(ucb1200_search, self, ucb1200_print);
@@ -159,6 +172,26 @@
return pnp ? QUIET : UNCONF;
}
+int
+ucb1200_check_id(idreg, print)
+ u_int16_t idreg;
+ int print;
+{
+ int i;
+
+ for (i = 0; ucb_id[i].product; i++) {
+ if (ucb_id[i].id == idreg) {
+ if (print) {
+ printf("%s", ucb_id[i].product);
+ }
+
+ return (1);
+ }
+ }
+
+ return 0;
+}
+
void
ucb1200_state_install(dev, sfun, sarg, sid)
struct device *dev;
diff -r f4c3f5e6c2cd -r e83386a8c313 sys/arch/hpcmips/dev/ucb1200reg.h
--- a/sys/arch/hpcmips/dev/ucb1200reg.h Sun Mar 12 15:35:29 2000 +0000
+++ b/sys/arch/hpcmips/dev/ucb1200reg.h Sun Mar 12 15:36:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ucb1200reg.h,v 1.4 2000/03/03 19:54:35 uch Exp $ */
+/* $NetBSD: ucb1200reg.h,v 1.5 2000/03/12 15:36:11 uch Exp $ */
/*
* Copyright (c) 2000, by UCHIYAMA Yasushi
@@ -215,7 +215,12 @@
/*
* ID register
*/
+/* PHILIPS products */
+/* Version 3, Device 0, Supplier 1 */
+#define UCB1100_ID 0x1003
/* Version 4, Device 0, Supplier 1 */
#define UCB1200_ID 0x1004
+/* Version 10, Device 0, Supplier 1 */
+#define UCB1300_ID 0x100a
/* TOSHIBA TC35413F */
#define TC35413F_ID 0x9712
Home |
Main Index |
Thread Index |
Old Index