Commit Graph

10 Commits

Author SHA1 Message Date
Vitor Soares
f29fd331aa i3c: master: dw-i3c-master: fix i3c_attach/reattach
This patch fix i3c_attach/reattach functions.

During the i3c_attach the driver ignores the static address used for
SETDASA CCC command.

During the i3c_reattach the driver doesn't update master->addrs[data->index]
with new address if old_dyn_addr = 0.

Fixes: 1dd728f5d4 ("i3c: master: Add driver for Synopsys DesignWare IP")
Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
2019-01-15 11:15:11 +01:00
Christophe JAILLET
0fac32f24c i3c: master: Fix an error checking typo in 'cdns_i3c_master_probe()'
Fix a cut'n'paste typo.
Checking 'master->sysclk' is expected here.

Fixes: 603f2bee2c ("i3c: master: Add driver for Cadence IP")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
2019-01-07 14:18:17 +01:00
Przemyslaw Gaj
25ac3da61b i3c: master: cdns: fix I2C transfers in Cadence I3C master driver
This patch fixes I2C transfers in Cadence I3C master driver.
There was no way to queue more than one I2C transfer before.

Fixes: 603f2bee2c ("i3c: master: Add driver for Cadence IP")
Signed-off-by: Przemyslaw Gaj <pgaj@cadence.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-12-12 17:08:32 +01:00
Dan Carpenter
afe120c777 ic3: off by one in mode_show()
This should be >= ARRAY_SIZE() to avoid reading one element beyond the
end of the array.

Fixes: 3a379bbcea ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-12-05 17:22:58 +01:00
Dan Carpenter
840414ae59 i3c: fix an error code in i3c_master_add_i3c_dev_locked()
We should return "ret" as-is.  The "newdev" variable is a valid pointer.

Fixes: 3a379bbcea ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-12-05 17:22:58 +01:00
Colin Ian King
2b2b283c05 i3c: master: dw: fix mask operation by using the correct operator
The masking operation on status is using a bitwise 'or' rather than
a bitwise 'and' operator, and hence the result is always non-zero
which is probably not what is intended. Fix this by using the correct
operator.

Detected by CoverityScan, CID#1475523 ("Wrong operator used")

Fixes: 88acc98a712a ("i3c: master: Add driver for Synopsys DesignWare IP")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Vitor Soares <vitor.soares@synopsys.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-12-05 17:22:58 +01:00
Vitor Soares
1dd728f5d4 i3c: master: Add driver for Synopsys DesignWare IP
Add driver for Synopsys DesignWare I3C master IP

Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-12-05 17:22:58 +01:00
YueHaibing
ad15e8c0fa i3c: master: Remove set but not used variable 'old_i3c_scl_lim'
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/i3c/master/i3c-master-cdns.c: In function 'cdns_i3c_master_do_daa':
drivers/i3c/master/i3c-master-cdns.c:1137:16: warning:
 variable 'old_i3c_scl_lim' set but not used [-Wunused-but-set-variable]

It never used since introdution in commit
  acfab7d324b2 ("i3c: master: Add driver for Cadence IP")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
2018-12-05 17:22:58 +01:00
Boris Brezillon
603f2bee2c i3c: master: Add driver for Cadence IP
Add a driver for Cadence I3C master IP.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 17:22:58 +01:00
Boris Brezillon
3a379bbcea i3c: Add core I3C infrastructure
Add core infrastructure to support I3C in Linux and document it.

This infrastructure adds basic I3C support. Advanced features will be
added afterwards.

There are a few design choices that are worth mentioning because they
impact the way I3C device drivers can interact with their devices:

- all functions used to send I3C/I2C frames must be called in
  non-atomic context. Mainly done this way to ease implementation, but
  this is not set in stone, and if anyone needs async support, new
  functions can be added later on.
- the bus element is a separate object, but it's tightly coupled with
  the master object. We thus have a 1:1 relationship between i3c_bus
  and i3c_master_controller objects, and if 2 master controllers are
  connected to the same bus and both exposed to the same Linux instance
  they will appear as two distinct busses, and devices on this bus will
  be exposed twice.
- I2C backward compatibility has been designed to be transparent to I2C
  drivers and the I2C subsystem. The I3C master just registers an I2C
  adapter which creates a new I2C bus. I'd say that, from a
  representation PoV it's not ideal because what should appear as a
  single I3C bus exposing I3C and I2C devices here appears as 2
  different buses connected to each other through the parenting (the
  I3C master is the parent of the I2C and I3C busses).
  On the other hand, I don't see a better solution if we want something
  that is not invasive.

Missing features:
- I3C HDR modes are not supported
- no support for multi-master and the associated concepts (mastership
  handover, support for secondary masters, ...)
- I2C devices can only be described using DT because this is the only
  use case I have. However, the framework can easily be extended with
  ACPI and board info support
- I3C slave framework. This has been completely omitted, but shouldn't
  have a huge impact on the I3C framework because I3C slaves don't see
  the whole bus, it's only about handling master requests and generating
  IBIs. Some of the struct, constant and enum definitions could be
  shared, but most of the I3C slave framework logic will be different

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 10:33:49 +01:00