Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Reset the hardware like other drivers do for bet...
details: https://anonhg.NetBSD.org/src/rev/0df1a54918d8
branches: trunk
changeset: 448378:0df1a54918d8
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Thu Jan 31 18:21:21 2019 +0000
description:
Reset the hardware like other drivers do for better compatibility with
more chip firmware versions.
>From (and should fix) PR kern/53913.
diffstat:
sys/dev/usb/uchcom.c | 29 +++++++----------------------
1 files changed, 7 insertions(+), 22 deletions(-)
diffs (58 lines):
diff -r c5e605db8258 -r 0df1a54918d8 sys/dev/usb/uchcom.c
--- a/sys/dev/usb/uchcom.c Thu Jan 31 16:03:50 2019 +0000
+++ b/sys/dev/usb/uchcom.c Thu Jan 31 18:21:21 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uchcom.c,v 1.27 2018/12/13 01:40:02 jakllsch Exp $ */
+/* $NetBSD: uchcom.c,v 1.28 2019/01/31 18:21:21 jakllsch Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.27 2018/12/13 01:40:02 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.28 2019/01/31 18:21:21 jakllsch Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -118,6 +118,9 @@
#define UCHCOMIBUFSIZE 256
#define UCHCOMOBUFSIZE 256
+#define UCHCOM_RESET_VALUE 0x501F
+#define UCHCOM_RESET_INDEX 0xD90A
+
struct uchcom_softc
{
device_t sc_dev;
@@ -763,27 +766,9 @@
reset_chip(struct uchcom_softc *sc)
{
usbd_status err;
- uint8_t lcr, lcr2, pre, div;
- uint16_t val=0, idx=0;
- err = read_reg(sc, UCHCOM_REG_LCR, &lcr, UCHCOM_REG_LCR2, &lcr2);
- if (err)
- goto failed;
-
- err = read_reg(sc, UCHCOM_REG_BPS_PRE, &pre, UCHCOM_REG_BPS_DIV, &div);
- if (err)
- goto failed;
-
- val |= (uint16_t)lcr << 8;
- val |= 0x9c; /* magic from vendor Linux and Android drivers */
- idx |= pre & 0x07;
- idx |= (uint16_t)div << 8;
- idx |= UCHCOM_BPS_PRE_IMM;
-
- DPRINTF(("%s: reset v=0x%04X, i=0x%04X\n",
- device_xname(sc->sc_dev), val, idx));
-
- err = generic_control_out(sc, UCHCOM_REQ_RESET, val, idx);
+ err = generic_control_out(sc, UCHCOM_REQ_RESET,
+ UCHCOM_RESET_VALUE, UCHCOM_RESET_INDEX);
if (err)
goto failed;
Home |
Main Index |
Thread Index |
Old Index