Unbreak LED support on Elan cpus.

This commit is contained in:
Poul-Henning Kamp 2004-04-03 18:42:52 +00:00
parent 18a810fa8d
commit 93c98d4d1d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127801

View File

@ -77,7 +77,6 @@ static u_int pps_a, pps_d;
static u_int echo_a, echo_d; static u_int echo_a, echo_d;
#endif /* CPU_ELAN_PPS */ #endif /* CPU_ELAN_PPS */
#ifdef CPU_SOEKRIS
static u_int led_cookie[32]; static u_int led_cookie[32];
static dev_t led_dev[32]; static dev_t led_dev[32];
@ -93,7 +92,6 @@ gpio_led(void *cookie, int state)
v ^= 0xc; v ^= 0xc;
mmcrptr[v / 2] = u; mmcrptr[v / 2] = u;
} }
#endif
static int static int
sysctl_machdep_elan_gpio_config(SYSCTL_HANDLER_ARGS) sysctl_machdep_elan_gpio_config(SYSCTL_HANDLER_ARGS)
@ -117,7 +115,9 @@ sysctl_machdep_elan_gpio_config(SYSCTL_HANDLER_ARGS)
/* Disallow any disabled pins and count pps and echo */ /* Disallow any disabled pins and count pps and echo */
np = ne = 0; np = ne = 0;
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (gpio_config[i] == '-' && (buf[i] != '-' && buf[i] != '.')) if (gpio_config[i] == '-' && buf[i] == '.')
buf[i] = gpio_config[i];
if (gpio_config[i] == '-' && buf[i] != '-')
return (EPERM); return (EPERM);
if (buf[i] == 'P') { if (buf[i] == 'P') {
np++; np++;
@ -149,12 +149,15 @@ sysctl_machdep_elan_gpio_config(SYSCTL_HANDLER_ARGS)
else else
v = 0; v = 0;
#ifdef CPU_SOEKRIS #ifdef CPU_SOEKRIS
if (i == 9)
;
else
#endif
if (buf[i] != 'l' && buf[i] != 'L' && led_dev[i] != NULL) { if (buf[i] != 'l' && buf[i] != 'L' && led_dev[i] != NULL) {
led_destroy(led_dev[i]); led_destroy(led_dev[i]);
led_dev[i] = NULL; led_dev[i] = NULL;
mmcrptr[(0xc2a + v) / 2] &= ~u; mmcrptr[(0xc2a + v) / 2] &= ~u;
} }
#endif
switch (buf[i]) { switch (buf[i]) {
#ifdef CPU_ELAN_PPS #ifdef CPU_ELAN_PPS
case 'P': case 'P':
@ -177,7 +180,6 @@ sysctl_machdep_elan_gpio_config(SYSCTL_HANDLER_ARGS)
gpio_config[i] = buf[i]; gpio_config[i] = buf[i];
break; break;
#endif /* CPU_ELAN_PPS */ #endif /* CPU_ELAN_PPS */
#ifdef CPU_SOEKRIS
case 'l': case 'l':
case 'L': case 'L':
if (buf[i] == 'L') if (buf[i] == 'L')
@ -192,7 +194,6 @@ sysctl_machdep_elan_gpio_config(SYSCTL_HANDLER_ARGS)
mmcrptr[(0xc2a + v) / 2] |= u; mmcrptr[(0xc2a + v) / 2] |= u;
gpio_config[i] = buf[i]; gpio_config[i] = buf[i];
break; break;
#endif
case '.': case '.':
gpio_config[i] = buf[i]; gpio_config[i] = buf[i];
break; break;