Commit f8c6d724 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "The ismt driver had a problem with a rarely used transaction type and
  the designware driver was made even more robust against non standard
  ACPI tables"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: designware: Round down ACPI provided clk to nearest supported clk
  i2c: ismt: Return EMSGSIZE for block reads with bogus length
  i2c: ismt: Don't duplicate the receive length for block reads
parents 138e4ad6 231d069f
...@@ -256,7 +256,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ...@@ -256,7 +256,8 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
struct dw_i2c_dev *dev; struct dw_i2c_dev *dev;
u32 acpi_speed, ht = 0; u32 acpi_speed, ht = 0;
struct resource *mem; struct resource *mem;
int irq, ret; int i, irq, ret;
const int supported_speeds[] = { 0, 100000, 400000, 1000000, 3400000 };
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0)
...@@ -297,9 +298,16 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ...@@ -297,9 +298,16 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
} }
acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev); acpi_speed = i2c_acpi_find_bus_speed(&pdev->dev);
/* Some broken DSTDs use 1MiHz instead of 1MHz */ /*
if (acpi_speed == 1048576) * Some DSTDs use a non standard speed, round down to the lowest
acpi_speed = 1000000; * standard speed.
*/
for (i = 1; i < ARRAY_SIZE(supported_speeds); i++) {
if (acpi_speed < supported_speeds[i])
break;
}
acpi_speed = supported_speeds[i - 1];
/* /*
* Find bus speed from the "clock-frequency" device property, ACPI * Find bus speed from the "clock-frequency" device property, ACPI
* or by using fast mode if neither is set. * or by using fast mode if neither is set.
......
...@@ -341,8 +341,10 @@ static int ismt_process_desc(const struct ismt_desc *desc, ...@@ -341,8 +341,10 @@ static int ismt_process_desc(const struct ismt_desc *desc,
break; break;
case I2C_SMBUS_BLOCK_DATA: case I2C_SMBUS_BLOCK_DATA:
case I2C_SMBUS_I2C_BLOCK_DATA: case I2C_SMBUS_I2C_BLOCK_DATA:
memcpy(&data->block[1], dma_buffer, desc->rxbytes); if (desc->rxbytes != dma_buffer[0] + 1)
data->block[0] = desc->rxbytes; return -EMSGSIZE;
memcpy(data->block, dma_buffer, desc->rxbytes);
break; break;
} }
return 0; return 0;
......
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