Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/sa11x0 Update from hpcarm with changes to probe...



details:   https://anonhg.NetBSD.org/src/rev/4d49f60da1e1
branches:  trunk
changeset: 513477:4d49f60da1e1
user:      rjs <rjs%NetBSD.org@localhost>
date:      Wed Aug 01 14:02:58 2001 +0000

description:
Update from hpcarm with changes to probe routine and test for chip ID.

diffstat:

 sys/arch/arm/sa11x0/sa1111.c |  34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diffs (108 lines):

diff -r 9e3dcd61e836 -r 4d49f60da1e1 sys/arch/arm/sa11x0/sa1111.c
--- a/sys/arch/arm/sa11x0/sa1111.c      Wed Aug 01 13:18:44 2001 +0000
+++ b/sys/arch/arm/sa11x0/sa1111.c      Wed Aug 01 14:02:58 2001 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: sa1111.c,v 1.1 2001/07/08 23:37:52 rjs Exp $  */
+/*      $NetBSD: sa1111.c,v 1.2 2001/08/01 14:02:58 rjs Exp $  */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #include <arm/sa11x0/sa1111_reg.h>
 #include <arm/sa11x0/sa1111_var.h>
 
-static int     sacc_match(struct device *, struct cfdata *, void *);
+static int     sacc_probe(struct device *, struct cfdata *, void *);
 static void    sacc_attach(struct device *, struct device *, void *);
 static int     sa1111_search(struct device *, struct cfdata *, void *);
 static int     sa1111_print(void *, const char *);
@@ -86,7 +86,7 @@
 #endif
 
 struct cfattach sacc_ca = {
-       sizeof(struct sacc_softc), sacc_match, sacc_attach
+       sizeof(struct sacc_softc), sacc_probe, sacc_attach
 };
 
 #ifdef INTR_DEBUG
@@ -96,11 +96,24 @@
 #endif
 
 static int
-sacc_match(parent, match, aux)
+sacc_probe(parent, match, aux)
        struct device *parent;
        struct cfdata *match;
        void *aux;
 {
+       struct sa11x0_attach_args *sa = aux;
+       bus_space_handle_t ioh;
+       u_int32_t skid;
+
+       if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &ioh))
+               return (0);
+
+       skid = bus_space_read_4(sa->sa_iot, ioh, SACCSBI_SKID);
+       bus_space_unmap(sa->sa_iot, ioh, sa->sa_size);
+
+       if ((skid & 0xffffff00) != 0x690cc200)
+               return (0);
+
        return (1);
 }
 
@@ -111,6 +124,7 @@
        void *aux;
 {
        int i, gpiopin;
+       u_int32_t skid;
        struct sacc_softc *sc = (struct sacc_softc *)self;
        struct sa11x0_softc *psc = (struct sa11x0_softc *)parent;
        struct sa11x0_attach_args *sa = aux;
@@ -118,6 +132,8 @@
        struct platid_data *p;
 #endif
 
+       printf("\n");
+
        sc->sc_iot = sa->sa_iot;
        sc->sc_piot = psc->sc_iot;
        sc->sc_gpioh = psc->sc_gpioh;
@@ -125,7 +141,7 @@
        if ((p = platid_search(&platid, sacc_platid_table)) == NULL)
                return;
 
-       gpiopin = (int)p->data;
+       gpiopin = (int) p->data;
 #else
        gpiopin = sa->sa_gpio;
 #endif
@@ -137,6 +153,11 @@
                return;
        }
 
+       skid = bus_space_read_4(sc->sc_iot, sc->sc_ioh, SACCSBI_SKID);
+
+       printf("%s: SA1111 rev %d.%d\n", sc->sc_dev.dv_xname,
+              (skid & 0xf0) >> 3, skid & 0xf);
+
        for(i = 0; i < SACCIC_LEN; i++)
                sc->sc_intrhand[i] = NULL;
 
@@ -155,7 +176,7 @@
        /*
         *  Attach each devices
         */
-       config_search(sa1111_search, self, sa1111_print);
+       config_search(sa1111_search, self, NULL);
 }
 
 static int
@@ -175,7 +196,6 @@
        void *aux;
        const char *name;
 {
-       printf("\n");
        return (UNCONF);
 }
 



Home | Main Index | Thread Index | Old Index