mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:02:20 +00:00
some more driver bugfixes and a DT binding conversion
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmRVbZsACgkQFA3kzBSg KbZ2JQ/+MeH1WFmgwehnJqdkNUg0Iy0q8gJ3C3RH3I6/T0d9nV4U4BChPWqcw6wr pjP2KG9ygXDb/sSb27gtXwxgCMnlXTCO06lEj2HyR7hLVxPV39cp5jwWqtmz0Xh1 DzvbsuicZyDUNQoeOYvsyUSAjYGHpIzNS7PZmVXDDN7aoP2iMOmGfbTe6xtHVcAx Ax9aQrNUIsaB4xLWGy8kXw4p2kQLXvmXa3JFth+3ME9QwrfLaC1Ra7qAvy0RKZwj JVAPsWsS/AK2U+bW6fTmwnuAWp+U/xRIjnleU7ynqriqIrOVJV39mcEZiHAubDc7 7q7vxOQL4FooLhvT0fLcfvRiCWvocdSaRFaqCyD0y3SNPQ+gJEhlhBZXCqeU1xPf 2We+aObVoyLdd/TB3c1jnVeTC9a5/oxGElwJGHyrwWrLPwf/8QuAr3rCj32Tn/Fw ofELqGK6bJY7nSO00JFoLFltzrrt+zJd1dZ/uQyqb6p91OTNMY95lWLjmjONt9wq 2xKQ03jeGysTpOxY/KOn1mLw4RBhXcQJuJA3JXN0u91lbr0L/hDc8cDEMf7hGjOG F+G3w2Cw96HBkMokmSa8uZnt4W54yMFmpJaLMasmNWJYc4khg58qLwksPIPwdYgx 8F++YYdtqUT+cvMp4Asql/CaCWYwJdOdW9h7/y1r+mJNNFOCEOk= =3aLp -----END PGP SIGNATURE----- Merge tag 'i2c-for-6.4-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull more i2c updates from Wolfram Sang: "Some more driver bugfixes and a DT binding conversion" * tag 'i2c-for-6.4-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: dt-bindings: i2c: brcm,kona-i2c: convert to YAML i2c: gxp: fix build failure without CONFIG_I2C_SLAVE i2c: imx-lpi2c: avoid taking clk_prepare mutex in PM callbacks i2c: omap: Fix standard mode false ACK readings i2c: tegra: Fix PEC support for SMBUS block read
This commit is contained in:
commit
a5e219005a
@ -1,35 +0,0 @@
|
||||
Broadcom Kona Family I2C
|
||||
=========================
|
||||
|
||||
This I2C controller is used in the following Broadcom SoCs:
|
||||
|
||||
BCM11130
|
||||
BCM11140
|
||||
BCM11351
|
||||
BCM28145
|
||||
BCM28155
|
||||
|
||||
Required Properties
|
||||
-------------------
|
||||
- compatible: "brcm,bcm11351-i2c", "brcm,kona-i2c"
|
||||
- reg: Physical base address and length of controller registers
|
||||
- interrupts: The interrupt number used by the controller
|
||||
- clocks: clock specifier for the kona i2c external clock
|
||||
- clock-frequency: The I2C bus frequency in Hz
|
||||
- #address-cells: Should be <1>
|
||||
- #size-cells: Should be <0>
|
||||
|
||||
Refer to clocks/clock-bindings.txt for generic clock consumer
|
||||
properties.
|
||||
|
||||
Example:
|
||||
|
||||
i2c@3e016000 {
|
||||
compatible = "brcm,bcm11351-i2c","brcm,kona-i2c";
|
||||
reg = <0x3e016000 0x80>;
|
||||
interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&bsc1_clk>;
|
||||
clock-frequency = <400000>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
};
|
59
Documentation/devicetree/bindings/i2c/brcm,kona-i2c.yaml
Normal file
59
Documentation/devicetree/bindings/i2c/brcm,kona-i2c.yaml
Normal file
@ -0,0 +1,59 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/i2c/brcm,kona-i2c.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Broadcom Kona family I2C controller
|
||||
|
||||
maintainers:
|
||||
- Florian Fainelli <f.fainelli@gmail.com>
|
||||
|
||||
allOf:
|
||||
- $ref: /schemas/i2c/i2c-controller.yaml#
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
items:
|
||||
- enum:
|
||||
- brcm,bcm11351-i2c
|
||||
- brcm,bcm21664-i2c
|
||||
- brcm,bcm23550-i2c
|
||||
- const: brcm,kona-i2c
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
maxItems: 1
|
||||
|
||||
clock-frequency:
|
||||
enum: [ 100000, 400000, 1000000, 3400000 ]
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- interrupts
|
||||
- clocks
|
||||
- clock-frequency
|
||||
|
||||
unevaluatedProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/arm-gic.h>
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
|
||||
i2c@3e016000 {
|
||||
compatible = "brcm,bcm11351-i2c", "brcm,kona-i2c";
|
||||
reg = <0x3e016000 0x80>;
|
||||
interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&bsc1_clk>;
|
||||
clock-frequency = <400000>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
};
|
||||
...
|
@ -353,7 +353,6 @@ static void gxp_i2c_chk_data_ack(struct gxp_i2c_drvdata *drvdata)
|
||||
writew(value, drvdata->base + GXP_I2CMCMD);
|
||||
}
|
||||
|
||||
#if IS_ENABLED(CONFIG_I2C_SLAVE)
|
||||
static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata)
|
||||
{
|
||||
u8 value;
|
||||
@ -437,7 +436,6 @@ static bool gxp_i2c_slave_irq_handler(struct gxp_i2c_drvdata *drvdata)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static irqreturn_t gxp_i2c_irq_handler(int irq, void *_drvdata)
|
||||
{
|
||||
|
@ -639,7 +639,7 @@ static int __maybe_unused lpi2c_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct lpi2c_imx_struct *lpi2c_imx = dev_get_drvdata(dev);
|
||||
|
||||
clk_bulk_disable_unprepare(lpi2c_imx->num_clks, lpi2c_imx->clks);
|
||||
clk_bulk_disable(lpi2c_imx->num_clks, lpi2c_imx->clks);
|
||||
pinctrl_pm_select_sleep_state(dev);
|
||||
|
||||
return 0;
|
||||
@ -651,7 +651,7 @@ static int __maybe_unused lpi2c_runtime_resume(struct device *dev)
|
||||
int ret;
|
||||
|
||||
pinctrl_pm_select_default_state(dev);
|
||||
ret = clk_bulk_prepare_enable(lpi2c_imx->num_clks, lpi2c_imx->clks);
|
||||
ret = clk_bulk_enable(lpi2c_imx->num_clks, lpi2c_imx->clks);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to enable I2C clock, ret=%d\n", ret);
|
||||
return ret;
|
||||
|
@ -1058,7 +1058,7 @@ omap_i2c_isr(int irq, void *dev_id)
|
||||
u16 stat;
|
||||
|
||||
stat = omap_i2c_read_reg(omap, OMAP_I2C_STAT_REG);
|
||||
mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG);
|
||||
mask = omap_i2c_read_reg(omap, OMAP_I2C_IE_REG) & ~OMAP_I2C_STAT_NACK;
|
||||
|
||||
if (stat & mask)
|
||||
ret = IRQ_WAKE_THREAD;
|
||||
|
@ -242,9 +242,10 @@ struct tegra_i2c_hw_feature {
|
||||
* @is_dvc: identifies the DVC I2C controller, has a different register layout
|
||||
* @is_vi: identifies the VI I2C controller, has a different register layout
|
||||
* @msg_complete: transfer completion notifier
|
||||
* @msg_buf_remaining: size of unsent data in the message buffer
|
||||
* @msg_len: length of message in current transfer
|
||||
* @msg_err: error code for completed message
|
||||
* @msg_buf: pointer to current message data
|
||||
* @msg_buf_remaining: size of unsent data in the message buffer
|
||||
* @msg_read: indicates that the transfer is a read access
|
||||
* @timings: i2c timings information like bus frequency
|
||||
* @multimaster_mode: indicates that I2C controller is in multi-master mode
|
||||
@ -277,6 +278,7 @@ struct tegra_i2c_dev {
|
||||
|
||||
struct completion msg_complete;
|
||||
size_t msg_buf_remaining;
|
||||
unsigned int msg_len;
|
||||
int msg_err;
|
||||
u8 *msg_buf;
|
||||
|
||||
@ -1169,7 +1171,7 @@ static void tegra_i2c_push_packet_header(struct tegra_i2c_dev *i2c_dev,
|
||||
else
|
||||
i2c_writel(i2c_dev, packet_header, I2C_TX_FIFO);
|
||||
|
||||
packet_header = msg->len - 1;
|
||||
packet_header = i2c_dev->msg_len - 1;
|
||||
|
||||
if (i2c_dev->dma_mode && !i2c_dev->msg_read)
|
||||
*dma_buf++ = packet_header;
|
||||
@ -1242,20 +1244,32 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
|
||||
return err;
|
||||
|
||||
i2c_dev->msg_buf = msg->buf;
|
||||
i2c_dev->msg_len = msg->len;
|
||||
|
||||
/* The condition true implies smbus block read and len is already read */
|
||||
if (msg->flags & I2C_M_RECV_LEN && end_state != MSG_END_CONTINUE)
|
||||
i2c_dev->msg_buf = msg->buf + 1;
|
||||
|
||||
i2c_dev->msg_buf_remaining = msg->len;
|
||||
i2c_dev->msg_err = I2C_ERR_NONE;
|
||||
i2c_dev->msg_read = !!(msg->flags & I2C_M_RD);
|
||||
reinit_completion(&i2c_dev->msg_complete);
|
||||
|
||||
/*
|
||||
* For SMBUS block read command, read only 1 byte in the first transfer.
|
||||
* Adjust that 1 byte for the next transfer in the msg buffer and msg
|
||||
* length.
|
||||
*/
|
||||
if (msg->flags & I2C_M_RECV_LEN) {
|
||||
if (end_state == MSG_END_CONTINUE) {
|
||||
i2c_dev->msg_len = 1;
|
||||
} else {
|
||||
i2c_dev->msg_buf += 1;
|
||||
i2c_dev->msg_len -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
i2c_dev->msg_buf_remaining = i2c_dev->msg_len;
|
||||
|
||||
if (i2c_dev->msg_read)
|
||||
xfer_size = msg->len;
|
||||
xfer_size = i2c_dev->msg_len;
|
||||
else
|
||||
xfer_size = msg->len + I2C_PACKET_HEADER_SIZE;
|
||||
xfer_size = i2c_dev->msg_len + I2C_PACKET_HEADER_SIZE;
|
||||
|
||||
xfer_size = ALIGN(xfer_size, BYTES_PER_FIFO_WORD);
|
||||
|
||||
@ -1295,7 +1309,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
|
||||
if (!i2c_dev->msg_read) {
|
||||
if (i2c_dev->dma_mode) {
|
||||
memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE,
|
||||
msg->buf, msg->len);
|
||||
msg->buf, i2c_dev->msg_len);
|
||||
|
||||
dma_sync_single_for_device(i2c_dev->dma_dev,
|
||||
i2c_dev->dma_phys,
|
||||
@ -1352,7 +1366,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
|
||||
i2c_dev->dma_phys,
|
||||
xfer_size, DMA_FROM_DEVICE);
|
||||
|
||||
memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf, msg->len);
|
||||
memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf, i2c_dev->msg_len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1408,8 +1422,8 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[],
|
||||
ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], MSG_END_CONTINUE);
|
||||
if (ret)
|
||||
break;
|
||||
/* Set the read byte as msg len */
|
||||
msgs[i].len = msgs[i].buf[0];
|
||||
/* Set the msg length from first byte */
|
||||
msgs[i].len += msgs[i].buf[0];
|
||||
dev_dbg(i2c_dev->dev, "reading %d bytes\n", msgs[i].len);
|
||||
}
|
||||
ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], end_type);
|
||||
|
@ -385,7 +385,6 @@ static inline void i2c_set_clientdata(struct i2c_client *client, void *data)
|
||||
|
||||
/* I2C slave support */
|
||||
|
||||
#if IS_ENABLED(CONFIG_I2C_SLAVE)
|
||||
enum i2c_slave_event {
|
||||
I2C_SLAVE_READ_REQUESTED,
|
||||
I2C_SLAVE_WRITE_REQUESTED,
|
||||
@ -396,9 +395,10 @@ enum i2c_slave_event {
|
||||
|
||||
int i2c_slave_register(struct i2c_client *client, i2c_slave_cb_t slave_cb);
|
||||
int i2c_slave_unregister(struct i2c_client *client);
|
||||
bool i2c_detect_slave_mode(struct device *dev);
|
||||
int i2c_slave_event(struct i2c_client *client,
|
||||
enum i2c_slave_event event, u8 *val);
|
||||
#if IS_ENABLED(CONFIG_I2C_SLAVE)
|
||||
bool i2c_detect_slave_mode(struct device *dev);
|
||||
#else
|
||||
static inline bool i2c_detect_slave_mode(struct device *dev) { return false; }
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user