Re: [PATCH] i2c: davinci: Add block read functionality for IPMI
Hi, thanks for the patch. +/* capabilities */ +#define I2C_CAPABILITIES(I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | \ + I2C_FUNC_SMBUS_READ_BLOCK_DATA) I don't see the need for a seperate define. + struct davinci_i2c_dev { struct device *dev; void __iomem*base; @@ -318,7 +322,13 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg-addr); dev-buf = msg-buf; -dev-buf_len = msg-len; + + /* if first received byte is length, set buf_len = 0x as flag */ +if (msg-flags I2C_M_RECV_LEN) +dev-buf_len = 0x; a) this magic value should be a define instead of a comment b) i2c messages easily have a 16 bit range, so 0x is a troublesome choice. +else +dev-buf_len = msg-len; + dev-stop = stop; davinci_i2c_write_reg(dev, DAVINCI_I2C_CNT_REG, dev-buf_len); @@ -456,7 +466,7 @@ i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) static u32 i2c_davinci_func(struct i2c_adapter *adap) { -return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; +return I2C_CAPABILITIES; } static void terminate_read(struct davinci_i2c_dev *dev) @@ -528,10 +538,32 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id) case DAVINCI_I2C_IVR_RDR: if (dev-buf_len) { -*dev-buf++ = -davinci_i2c_read_reg(dev, - DAVINCI_I2C_DRR_REG); +*dev-buf++ = davinci_i2c_read_reg(dev, +DAVINCI_I2C_DRR_REG); +/* + * check if the first received byte is message + * length, i.e, I2C_M_RECV_LEN + */ +if (dev-buf_len == 0x) +dev-buf_len = *(dev-buf - 1) + 1; Please rework the code to get rid of the '- 1' and '+ 1'. They look hackish and make the code less readable. + dev-buf_len--; +/* + * send NACK/STOP bits BEFORE last byte is + * received + */ +if (dev-buf_len == 1) { +w = davinci_i2c_read_reg(dev, +DAVINCI_I2C_MDR_REG); +w |= DAVINCI_I2C_MDR_NACK; +davinci_i2c_write_reg(dev, +DAVINCI_I2C_MDR_REG, w); + +w |= DAVINCI_I2C_MDR_STP; +davinci_i2c_write_reg(dev, +DAVINCI_I2C_MDR_REG, w); +} + Looks like an unreleated change to me? Why is this I2C_M_RECV_LEN specific? Kind regards, Wolfram signature.asc Description: Digital signature ___ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Re: [PATCH] i2c: davinci: Add block read functionality for IPMI
On Friday 02 May 2014 12:19 AM, Murali Karicheri wrote: Intelligent Plaform Management Interface (IPMI) requires I2C driver to support block read, where the first byte received from slave is the length of following data:- Added length check if the read type is block read (I2C_M_RECV_LEN) Send NACK/STOP bits before last byte is received Signed-off-by: Garrett Ding g-d...@ti.com Signed-off-by: Murali Karicheri m-kariche...@ti.com I tested this on a DA850 using i2cdetect and it did not seem to break anything so: Tested-by: Sekhar Nori nsek...@ti.com There are some checks that were triggered in checkpatch. You may want to fix them up. Thanks, Sekhar CHECK: Alignment should match open parenthesis #112: FILE: drivers/i2c/busses/i2c-davinci.c:557: + w = davinci_i2c_read_reg(dev, + DAVINCI_I2C_MDR_REG); CHECK: Alignment should match open parenthesis #115: FILE: drivers/i2c/busses/i2c-davinci.c:560: + davinci_i2c_write_reg(dev, + DAVINCI_I2C_MDR_REG, w); CHECK: Alignment should match open parenthesis #119: FILE: drivers/i2c/busses/i2c-davinci.c:564: + davinci_i2c_write_reg(dev, + DAVINCI_I2C_MDR_REG, w); total: 0 errors, 0 warnings, 3 checks, 67 lines checked ___ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
Re: [PATCH] net: davinci_emac: fix oops caused by uninitialized ndev-dev
From: Sekhar Nori nsek...@ti.com Date: Tue, 20 May 2014 15:41:37 +0530 Commit e194312854edc22a2faf1931b3c0608fe20cb969 (drivers: net: davinci_cpdma: Convert kzalloc() to devm_kzalloc()) triggered a bug in emac_probe() wherein dev member of net_device is used for devres allocations even before it is initialized. This patch fixes that by using the struct device in platform_device instead. While at it, use pdev-dev consistently for console messages instead of using ndev-dev for just one case and remove an unnecessary line continuation. Reported-by: Kevin Hilman khil...@linaro.org Helped-by: George Cherian george.cher...@ti.com Signed-off-by: Sekhar Nori nsek...@ti.com --- This patch fixes a bug in linux-next so it can wait for v3.16 Applied to net-next, thanks. ___ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
[PATCH] [media] dm644x_ccdc: remove check for CONFIG_DM644X_VIDEO_PORT_ENABLE
A check for CONFIG_DM644X_VIDEO_PORT_ENABLE was added in v2.6.32. The related Kconfig symbol was never added so this check has always evaluated to false. Remove that check. Signed-off-by: Paul Bolle pebo...@tiscali.nl --- Untested. Related, trivial, cleanup: make ccdc_enable_vport() a oneliner. drivers/media/platform/davinci/dm644x_ccdc.c | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c index 30fa08405d61..07e98df3d867 100644 --- a/drivers/media/platform/davinci/dm644x_ccdc.c +++ b/drivers/media/platform/davinci/dm644x_ccdc.c @@ -581,13 +581,8 @@ void ccdc_config_raw(void) config_params-alaw.enable) syn_mode |= CCDC_DATA_PACK_ENABLE; -#ifdef CONFIG_DM644X_VIDEO_PORT_ENABLE - /* enable video port */ - val = CCDC_ENABLE_VIDEO_PORT; -#else /* disable video port */ val = CCDC_DISABLE_VIDEO_PORT; -#endif if (config_params-data_sz == CCDC_DATA_8BITS) val |= (CCDC_DATA_10BITS CCDC_FMTCFG_VPIN_MASK) -- 1.9.0 ___ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source