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

This commit is contained in:
rjs 2001-08-01 14:02:58 +00:00
parent d9f2bbf31f
commit faf8b4c913

View File

@ -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 @@ struct platid_data sacc_platid_table[] = {
#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 @@ struct cfattach sacc_ca = {
#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 @@ sacc_attach(parent, self, aux)
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 @@ sacc_attach(parent, self, aux)
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 @@ sacc_attach(parent, self, aux)
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 @@ sacc_attach(parent, self, aux)
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 @@ sacc_attach(parent, self, aux)
/*
* Attach each devices
*/
config_search(sa1111_search, self, sa1111_print);
config_search(sa1111_search, self, NULL);
}
static int
@ -175,7 +196,6 @@ sa1111_print(aux, name)
void *aux;
const char *name;
{
printf("\n");
return (UNCONF);
}