summaryrefslogtreecommitdiff
path: root/sys/arch/zaurus
diff options
context:
space:
mode:
authorUwe Stuehler <uwe@cvs.openbsd.org>2005-03-08 23:29:07 +0000
committerUwe Stuehler <uwe@cvs.openbsd.org>2005-03-08 23:29:07 +0000
commit17556f06216ad5419a54bf5611bec0c2393b58d0 (patch)
treed9db4a17a2741a06bad705d183c165864693bb3b /sys/arch/zaurus
parente76e29c22c26da4326c0b202a2f81a788976794a (diff)
Oops. Put scoop GPIO pins into correct state on suspend, and remove an
unnecessary function while there. ok drahn@
Diffstat (limited to 'sys/arch/zaurus')
-rw-r--r--sys/arch/zaurus/dev/zaurus_scoop.c49
-rw-r--r--sys/arch/zaurus/dev/zaurus_scoopreg.h20
2 files changed, 20 insertions, 49 deletions
diff --git a/sys/arch/zaurus/dev/zaurus_scoop.c b/sys/arch/zaurus/dev/zaurus_scoop.c
index 5372d9ff7f3..b741464aa33 100644
--- a/sys/arch/zaurus/dev/zaurus_scoop.c
+++ b/sys/arch/zaurus/dev/zaurus_scoop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_scoop.c,v 1.6 2005/02/22 21:53:03 uwe Exp $ */
+/* $OpenBSD: zaurus_scoop.c,v 1.7 2005/03/08 23:29:06 uwe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -32,7 +32,7 @@ struct scoop_softc {
struct device sc_dev;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
- u_int16_t sc_gpwr;
+ u_int16_t sc_gpwr; /* GPIO state before suspend */
};
int scoopmatch(struct device *, void *, void *);
@@ -165,28 +165,6 @@ scoop_led_set(int led, int on)
}
}
-int scoop_leds(void);
-int
-scoop_leds(void)
-{
- int leds = 0;
-
- if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL) {
-
- if (scoop_gpio_pin_read(scoop_cd.cd_devs[0],
- SCOOP0_LED_GREEN))
- leds |= SCOOP_LED_GREEN;
-
- /* XXX */
- if (scoop_cd.cd_ndevs > 1 &&
- scoop_gpio_pin_read(scoop_cd.cd_devs[0],
- SCOOP0_LED_ORANGE_C3000))
- leds |= SCOOP_LED_ORANGE;
- }
-
- return leds;
-}
-
void
scoop_battery_temp_adc(int enable)
{
@@ -241,27 +219,21 @@ scoop_check_mcr(void)
}
}
-void scoop_suspend(void);
-void scoop_resume(void);
-int led_state;
-
void
scoop_suspend(void)
{
struct scoop_softc *sc;
u_int32_t rv;
- led_state = scoop_leds();
- scoop_led_set(SCOOP_LED_GREEN | SCOOP_LED_ORANGE, 0);
-
if (scoop_cd.cd_ndevs > 0 && scoop_cd.cd_devs[0] != NULL) {
sc = scoop_cd.cd_devs[0];
sc->sc_gpwr = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
SCOOP_GPWR);
/* C3000 */
bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- sc->sc_gpwr & ~(SCOOP0_MUTE_L | SCOOP0_MUTE_R |
- SCOOP0_JK_A_C3000 | SCOOP0_ADC_TEMP_ON_C3000));
+ sc->sc_gpwr & ~((1<<SCOOP0_MUTE_L) | (1<<SCOOP0_MUTE_R) |
+ (1<<SCOOP0_JK_A_C3000) | (1<<SCOOP0_ADC_TEMP_ON_C3000) |
+ (1<<SCOOP0_LED_GREEN)));
}
/* C3000 */
@@ -270,12 +242,13 @@ scoop_suspend(void)
sc->sc_gpwr = bus_space_read_2(sc->sc_iot, sc->sc_ioh,
SCOOP_GPWR);
bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- sc->sc_gpwr & ~(SCOOP1_RESERVED_4 | SCOOP1_RESERVED_5 |
- SCOOP1_RESERVED_6 | SCOOP1_BACKLIGHT_CONT |
- SCOOP1_BACKLIGHT_ON | SCOOP1_MIC_BIAS));
+ sc->sc_gpwr & ~((1<<SCOOP1_RESERVED_4) |
+ (1<<SCOOP1_RESERVED_5) | (1<<SCOOP1_RESERVED_6) |
+ (1<<SCOOP1_BACKLIGHT_CONT) | (1<<SCOOP1_BACKLIGHT_ON) |
+ (1<<SCOOP1_MIC_BIAS)));
rv = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR);
bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
- rv | (SCOOP1_IR_ON | SCOOP1_RESERVED_3));
+ rv | ((1<<SCOOP1_IR_ON) | (1<<SCOOP1_RESERVED_3)));
}
}
@@ -295,6 +268,4 @@ scoop_resume(void)
bus_space_write_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR,
sc->sc_gpwr);
}
-
- scoop_led_set(led_state, 1);
}
diff --git a/sys/arch/zaurus/dev/zaurus_scoopreg.h b/sys/arch/zaurus/dev/zaurus_scoopreg.h
index 11e252b9fa6..e430f99f9fd 100644
--- a/sys/arch/zaurus/dev/zaurus_scoopreg.h
+++ b/sys/arch/zaurus/dev/zaurus_scoopreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: zaurus_scoopreg.h,v 1.5 2005/01/31 02:22:16 uwe Exp $ */
+/* $OpenBSD: zaurus_scoopreg.h,v 1.6 2005/03/08 23:29:06 uwe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -20,17 +20,17 @@
#define SCOOP1_BASE 0x08800040
#define SCOOP_SIZE 0x2c
-#define SCOOP_MCR 0x00
-#define SCOOP_CDR 0x04
-#define SCOOP_CSR 0x08
-#define SCOOP_CPR 0x0c
-#define SCOOP_CCR 0x10
-#define SCOOP_IRR 0x14
+#define SCOOP_MCR 0x00 /* (R/W) */
+#define SCOOP_CDR 0x04 /* (R?/W) */
+#define SCOOP_CSR 0x08 /* card status register (R) */
+#define SCOOP_CPR 0x0c /* card power register (R/W) */
+#define SCOOP_CCR 0x10 /* card configuration reg.? (R/W) */
+#define SCOOP_IRR 0x14 /* XXX for pcic: bit 0x4 role is? */
#define SCOOP_IRM 0x14
-#define SCOOP_IMR 0x18
+#define SCOOP_IMR 0x18 /* (R/W) */
#define SCOOP_ISR 0x1c
-#define SCOOP_GPCR 0x20
-#define SCOOP_GPWR 0x24
+#define SCOOP_GPCR 0x20 /* GPIO pin direction (R/W) */
+#define SCOOP_GPWR 0x24 /* GPIO pin output level (R/W) */
#define SCOOP_GPRR 0x28
/* GPIO bits */