Description of problem: firmware loading fails intermittantly for nxt2004 with messages Version-Release number of selected component (if applicable): 3.12.5-302.fc20.x86_64 How reproducible: Normal Boot Steps to Reproduce: 1. Boot 2. View DMESG for errors 3. One capture card of two in the box will not work in mythtv Actual results: [ 5.299935] nxt200x: NXT2004 Detected [ 5.609145] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=255 is too big! ... (deleted for brevity) [ 5.613353] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=149 is too big! [ 5.619130] nxt200x: nxt2004_init: Firmware upload complete [ 5.893328] nxt200x: Timeout waiting for nxt2004 to init. [ 6.224522] nxt200x: Timeout waiting for nxt2004 to init. [ 6.680790] nxt200x: Timeout waiting for nxt2004 to init. [ 6.853888] nxt200x: NXT2004 Detected [ 6.864897] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=255 is too big! ... (deleted for brevity) [ 6.867955] nxt200x: nxt200x_writebytes: i2c wr reg=002c: len=149 is too big! [ 6.874899] nxt200x: nxt2004_init: Firmware upload complete [ 7.149064] nxt200x: Timeout waiting for nxt2004 to init. [ 7.411216] nxt200x: Timeout waiting for nxt200x to stop. This is ok after firmware upload. [ 7.674351] nxt200x: Timeout waiting for nxt200x to stop. This is ok after firmware upload. [ 7.946515] nxt200x: Timeout waiting for nxt2004 to init. [ 8.209669] nxt200x: Timeout waiting for nxt200x to stop. This is ok after firmware upload. [ 8.219691] nxt200x: Error writing multireg register 0x08 [ 8.229697] nxt200x: Error writing multireg register 0x08 [ 8.249710] nxt200x: Error writing multireg register 0x80 [ 8.272682] nxt200x: Error writing multireg register 0x80 [ 8.291734] nxt200x: Error writing multireg register 0x08 [ 8.310733] nxt200x: Error writing multireg register 0x08 [ 8.328746] nxt200x: Error writing multireg register 0x80 [ 8.338742] nxt200x: Error writing multireg register 0x81 [ 8.348753] nxt200x: Error writing multireg register 0x82 [ 8.366769] nxt200x: Error writing multireg register 0x88 [ 8.385774] nxt200x: Error writing multireg register 0x80 [ 8.664941] nxt200x: Timeout waiting for nxt2004 to init. Expected results: [ 9.417683] nxt200x: NXT2004 Detected [ 10.953627] nxt200x: nxt2004_init: Firmware upload complete [ 11.584960] nxt200x: NXT2004 Detected [ 12.994817] nxt200x: nxt2004_init: Firmware upload complete Additional info: This was not present in kernel-3.11.10-301.fc20.x86_64 It appears that this is due to [PATCH 3.11 178/272] [media] dvb-frontends: Don't use dynamic static allocation. If I revert the patch for nxt200x.c with the following patch --- linux-3.12.5-302.mark.fc20.x86_64/drivers/media/dvb-frontends/nxt200x.c 2014-01-02 10:13:20.673696273 -0700 +++ vanilla-3.12/drivers/media/dvb-frontends/nxt200x.c 2013-11-03 16:41:51.000000000 -0700 @@ -39,9 +39,6 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt -/* Max transfer size done by I2C transfer functions */ -#define MAX_XFER_SIZE 64 - #define NXT2002_DEFAULT_FIRMWARE "dvb-fe-nxt2002.fw" #define NXT2004_DEFAULT_FIRMWARE "dvb-fe-nxt2004.fw" #define CRC_CCIT_MASK 0x1021 @@ -98,16 +95,10 @@ static int i2c_readbytes(struct nxt200x_ static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, const u8 *buf, u8 len) { - u8 buf2[MAX_XFER_SIZE]; + u8 buf2 [len+1]; int err; struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = buf2, .len = len + 1 }; - if (1 + len > sizeof(buf2)) { - pr_warn("%s: i2c wr reg=%04x: len=%d is too big!\n", - __func__, reg, len); - return -EINVAL; - } - buf2[0] = reg; memcpy(&buf2[1], buf, len); the firmware loads correctly and the mpeg capture cards work.
Hi Mark, thanks for the detailed analysis. Could you bring this up at linux-media.org (archives: http://www.spinics.net/lists/linux-media/). This is where the DVB folks hang out. Thanks, Michele
Sent email to linux-media.org on 5 Jan 2014.
*********** MASS BUG UPDATE ************** We apologize for the inconvenience. There is a large number of bugs to go through and several of them have gone stale. Due to this, we are doing a mass bug update across all of the Fedora 20 kernel bugs. Fedora 20 has now been rebased to 3.13.4-200.fc20. Please test this kernel update and let us know if you issue has been resolved or if it is still present with the newer kernel. If you experience different issues, please open a new bug report for those.
It appears to have been fixed in 3.13.3: https://lwn.net/Articles/586145/ . . . nxt200x: increase write buffer size . . . I tried the latest kernel, 3.13.5-200.fc20.x86_64, and seems to work OK.
Thanks.