Commit 2a99b507 authored by matthieu castet's avatar matthieu castet Committed by Greg Kroah-Hartman

[PATCH] USB: UEAGLE : cosmetic

- improve debug trace in order to make easy to solve user problems.
- indent some code
- increase version number
Signed-off-by: default avatarMatthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 87ed0aeb
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
#include "usbatm.h" #include "usbatm.h"
#define EAGLEUSBVERSION "ueagle 1.2" #define EAGLEUSBVERSION "ueagle 1.3"
/* /*
...@@ -314,6 +314,10 @@ struct cmv { ...@@ -314,6 +314,10 @@ struct cmv {
((d) & 0xff) << 16 | \ ((d) & 0xff) << 16 | \
((a) & 0xff) << 8 | \ ((a) & 0xff) << 8 | \
((b) & 0xff)) ((b) & 0xff))
#define GETSA1(a) ((a >> 8) & 0xff)
#define GETSA2(a) (a & 0xff)
#define GETSA3(a) ((a >> 24) & 0xff)
#define GETSA4(a) ((a >> 16) & 0xff)
#define SA_CNTL MAKESA('C', 'N', 'T', 'L') #define SA_CNTL MAKESA('C', 'N', 'T', 'L')
#define SA_DIAG MAKESA('D', 'I', 'A', 'G') #define SA_DIAG MAKESA('D', 'I', 'A', 'G')
...@@ -728,11 +732,12 @@ static void uea_load_page(void *xsc) ...@@ -728,11 +732,12 @@ static void uea_load_page(void *xsc)
uea_err(INS_TO_USBDEV(sc), "sending DSP block %u failed\n", i); uea_err(INS_TO_USBDEV(sc), "sending DSP block %u failed\n", i);
return; return;
bad1: bad1:
uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n",pageno); uea_err(INS_TO_USBDEV(sc), "invalid DSP page %u requested\n", pageno);
} }
static inline void wake_up_cmv_ack(struct uea_softc *sc) static inline void wake_up_cmv_ack(struct uea_softc *sc)
{ {
BUG_ON(sc->cmv_ack);
sc->cmv_ack = 1; sc->cmv_ack = 1;
wake_up(&sc->cmv_ack_wait); wake_up(&sc->cmv_ack_wait);
} }
...@@ -743,6 +748,9 @@ static inline int wait_cmv_ack(struct uea_softc *sc) ...@@ -743,6 +748,9 @@ static inline int wait_cmv_ack(struct uea_softc *sc)
sc->cmv_ack, ACK_TIMEOUT); sc->cmv_ack, ACK_TIMEOUT);
sc->cmv_ack = 0; sc->cmv_ack = 0;
uea_dbg(INS_TO_USBDEV(sc), "wait_event_timeout : %d ms\n",
jiffies_to_msecs(ret));
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -791,6 +799,12 @@ static int uea_cmv(struct uea_softc *sc, ...@@ -791,6 +799,12 @@ static int uea_cmv(struct uea_softc *sc,
struct cmv cmv; struct cmv cmv;
int ret; int ret;
uea_enters(INS_TO_USBDEV(sc));
uea_vdbg(INS_TO_USBDEV(sc), "Function : %d-%d, Address : %c%c%c%c, "
"offset : 0x%04x, data : 0x%08x\n",
FUNCTION_TYPE(function), FUNCTION_SUBTYPE(function),
GETSA1(address), GETSA2(address), GETSA3(address),
GETSA4(address), offset, data);
/* we send a request, but we expect a reply */ /* we send a request, but we expect a reply */
sc->cmv_function = function | 0x2; sc->cmv_function = function | 0x2;
sc->cmv_idx++; sc->cmv_idx++;
...@@ -808,7 +822,9 @@ static int uea_cmv(struct uea_softc *sc, ...@@ -808,7 +822,9 @@ static int uea_cmv(struct uea_softc *sc,
ret = uea_request(sc, UEA_SET_BLOCK, UEA_MPTX_START, CMV_SIZE, &cmv); ret = uea_request(sc, UEA_SET_BLOCK, UEA_MPTX_START, CMV_SIZE, &cmv);
if (ret < 0) if (ret < 0)
return ret; return ret;
return wait_cmv_ack(sc); ret = wait_cmv_ack(sc);
uea_leaves(INS_TO_USBDEV(sc));
return ret;
} }
static inline int uea_read_cmv(struct uea_softc *sc, static inline int uea_read_cmv(struct uea_softc *sc,
...@@ -922,7 +938,7 @@ static int uea_stat(struct uea_softc *sc) ...@@ -922,7 +938,7 @@ static int uea_stat(struct uea_softc *sc)
* we check the status again in order to detect the failure earlier * we check the status again in order to detect the failure earlier
*/ */
if (sc->stats.phy.flags) { if (sc->stats.phy.flags) {
uea_dbg(INS_TO_USBDEV(sc), "Stat flag = %d\n", uea_dbg(INS_TO_USBDEV(sc), "Stat flag = 0x%x\n",
sc->stats.phy.flags); sc->stats.phy.flags);
return 0; return 0;
} }
...@@ -1101,6 +1117,8 @@ static int uea_start_reset(struct uea_softc *sc) ...@@ -1101,6 +1117,8 @@ static int uea_start_reset(struct uea_softc *sc)
if (ret < 0) if (ret < 0)
return ret; return ret;
uea_vdbg(INS_TO_USBDEV(sc), "Ready CMV received\n");
/* Enter in R-IDLE (cmv) until instructed otherwise */ /* Enter in R-IDLE (cmv) until instructed otherwise */
ret = uea_write_cmv(sc, SA_CNTL, 0, 1); ret = uea_write_cmv(sc, SA_CNTL, 0, 1);
if (ret < 0) if (ret < 0)
...@@ -1121,6 +1139,7 @@ static int uea_start_reset(struct uea_softc *sc) ...@@ -1121,6 +1139,7 @@ static int uea_start_reset(struct uea_softc *sc)
} }
/* Enter in R-ACT-REQ */ /* Enter in R-ACT-REQ */
ret = uea_write_cmv(sc, SA_CNTL, 0, 2); ret = uea_write_cmv(sc, SA_CNTL, 0, 2);
uea_vdbg(INS_TO_USBDEV(sc), "Entering in R-ACT-REQ state\n");
out: out:
release_firmware(cmvs_fw); release_firmware(cmvs_fw);
sc->reset = 0; sc->reset = 0;
...@@ -1235,6 +1254,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) ...@@ -1235,6 +1254,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv)
if (cmv->bFunction == MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY)) { if (cmv->bFunction == MAKEFUNCTION(ADSLDIRECTIVE, MODEMREADY)) {
wake_up_cmv_ack(sc); wake_up_cmv_ack(sc);
uea_leaves(INS_TO_USBDEV(sc));
return; return;
} }
...@@ -1249,6 +1269,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) ...@@ -1249,6 +1269,7 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv)
sc->data = sc->data << 16 | sc->data >> 16; sc->data = sc->data << 16 | sc->data >> 16;
wake_up_cmv_ack(sc); wake_up_cmv_ack(sc);
uea_leaves(INS_TO_USBDEV(sc));
return; return;
bad2: bad2:
...@@ -1256,12 +1277,14 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv) ...@@ -1256,12 +1277,14 @@ static void uea_dispatch_cmv(struct uea_softc *sc, struct cmv* cmv)
"Function : %d, Subfunction : %d\n", "Function : %d, Subfunction : %d\n",
FUNCTION_TYPE(cmv->bFunction), FUNCTION_TYPE(cmv->bFunction),
FUNCTION_SUBTYPE(cmv->bFunction)); FUNCTION_SUBTYPE(cmv->bFunction));
uea_leaves(INS_TO_USBDEV(sc));
return; return;
bad1: bad1:
uea_err(INS_TO_USBDEV(sc), "invalid cmv received, " uea_err(INS_TO_USBDEV(sc), "invalid cmv received, "
"wPreamble %d, bDirection %d\n", "wPreamble %d, bDirection %d\n",
le16_to_cpu(cmv->wPreamble), cmv->bDirection); le16_to_cpu(cmv->wPreamble), cmv->bDirection);
uea_leaves(INS_TO_USBDEV(sc));
} }
/* /*
...@@ -1508,7 +1531,7 @@ static ssize_t read_##name(struct device *dev, \ ...@@ -1508,7 +1531,7 @@ static ssize_t read_##name(struct device *dev, \
int ret = -ENODEV; \ int ret = -ENODEV; \
struct uea_softc *sc; \ struct uea_softc *sc; \
\ \
mutex_lock(&uea_mutex); \ mutex_lock(&uea_mutex); \
sc = dev_to_uea(dev); \ sc = dev_to_uea(dev); \
if (!sc) \ if (!sc) \
goto out; \ goto out; \
...@@ -1516,7 +1539,7 @@ static ssize_t read_##name(struct device *dev, \ ...@@ -1516,7 +1539,7 @@ static ssize_t read_##name(struct device *dev, \
if (reset) \ if (reset) \
sc->stats.phy.name = 0; \ sc->stats.phy.name = 0; \
out: \ out: \
mutex_unlock(&uea_mutex); \ mutex_unlock(&uea_mutex); \
return ret; \ return ret; \
} \ } \
\ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment