Skip to content

Instantly share code, notes, and snippets.

@tsutsui
Created November 11, 2019 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsutsui/45768db42694c9b8c8b258019ce75896 to your computer and use it in GitHub Desktop.
Save tsutsui/45768db42694c9b8c8b258019ce75896 to your computer and use it in GitHub Desktop.
Fix attach failure of zaudio(4) wm8731 on NetBSD/zaurus 9.0_BETA (and prior)
Index: arch/arm/sa11x0/sa11x0_ost.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/sa11x0/sa11x0_ost.c,v
retrieving revision 1.32
diff -u -p -d -r1.32 sa11x0_ost.c
--- arch/arm/sa11x0/sa11x0_ost.c 9 Oct 2016 14:43:17 -0000 1.32
+++ arch/arm/sa11x0/sa11x0_ost.c 11 Nov 2019 15:44:44 -0000
@@ -80,14 +80,23 @@ struct saost_softc {
static struct saost_softc *saost_sc = NULL;
+#define PXA270_OST_FREQ 3250000 /* PXA270 uses 3.25MHz */
+#define SAOST_FREQ 3686400 /* Others use 3.6864MHz */
+#define SAOST_MAXFREQ SAOST_FREQ
+
#if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
+/*
+ * On dynamic configuration, assume fastest frequency for early delay(9)
+ * before tc_init(9), because longer delay(9) is almost harmless during
+ * device probe and initialization.
+ */
#include <arm/xscale/pxa2x0cpu.h>
-static uint32_t freq;
-#define TIMER_FREQUENCY freq
+static uint32_t saost_freq = SAOST_MAXFREQ;
+#define TIMER_FREQUENCY saost_freq
#elif defined(CPU_XSCALE_PXA270)
-#define TIMER_FREQUENCY 3250000 /* PXA270 uses 3.25MHz */
+#define TIMER_FREQUENCY PXA270_OST_FREQ
#else
-#define TIMER_FREQUENCY 3686400 /* 3.6864MHz */
+#define TIMER_FREQUENCY SAOST_FREQ
#endif
#ifndef STATHZ
@@ -230,7 +239,7 @@ cpu_initclocks(void)
stathz = STATHZ;
profhz = stathz;
#if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
- TIMER_FREQUENCY = (CPU_IS_PXA250) ? 3686400 : 3250000;
+ TIMER_FREQUENCY = (CPU_IS_PXA270) ? PXA270_OST_FREQ : SAOST_FREQ;
#endif
sc->sc_statclock_step = TIMER_FREQUENCY / stathz;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment