Commit graph

37 commits

Author SHA1 Message Date
qctecmdr
46ce72b895 Merge "i3c: i3c-master-qcom-geni: Force the xfer mode as DMA mode" 2021-04-24 14:42:41 -07:00
Mukesh Kumar Savaliya
62f02fd389 i3c: i3c-master-qcom-geni: Add HW and FW version read support
This change adds the support to read Firmware and QUP HW version
during probe time. This helps to take decision during debug and
also serves as a debug information.

Change-Id: I3d5de6bc11dd5b30bbc0e345d9b48b342c4ff3ed
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-11-27 11:12:31 +05:30
Mukesh Kumar Savaliya
554cd52a96 i3c: i3c-master-qcom-geni: Manage driver suspend in late PM stage
While executing suspend_noirq callbacks non-wakeup interrupts are
disabled, wake-up interrupts are enabled but their handling is
deferred till the completion of suspend_noirq stage and gets handled
when resume starts again immediately after suspend_late.

GENI I3C driver unvotes the resources in the suspend_noirq stage.
There is no issue wrt managing clk and pinctrl resources at noirq
tage however ICC BW voting can't be done at noirq stage.

ICC request to RPM needs an ACK from RPM driver, the ack here is
nothing but interrupt from IPCC driver and it can't be processed
at noirq stage, hence flow is indefinitely stuck in I3C suspend_noirq
callback.

This issue primarily occurs for platforms using IPCC driver but  also
there is no harm making driver to suspend during late suspend. This is
by design of all buses drivers for now.

Change-Id: Icdbba72f431da321a3343364400c180f325ac369
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-11-27 00:40:02 +05:30
Mukesh Kumar Savaliya
d9fc9718f5 i3c: i3c-master-qcom-geni: Handle timeout for DMA FSM reset
This change adds timeout handling scenario for the DMA TX/TX reset
sequence and adds the proper error logs. If return value from API
wait_for_completion_timeout() is not taken cared, may mislead the
debug.

Also Fix the issue of not initializing the completion variable
during command execution time.

Change-Id: I01442e611ea531bbd6124c0b5f4b6c8da9c79281
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-10-25 01:12:20 +05:30
Mukesh Kumar Savaliya
04e2774ee8 i3c: i3c-master-qcom-geni: Save master device info to debug list
This change stores each probed master device to the global device list.
This will help to debug and know the master device information easily.

Change-Id: I1987aa54f1b24280a3b6a2436bbe1e5deccb8b6e
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-10-24 18:56:17 +05:30
Mukesh Kumar Savaliya
2613c7fe9c i3c: i3c-master-qcom-geni: Log error if DMA mode fails
This change adds IPC error logs if there is any failure while executing
DMA mode transfer. Driver gracefully switches to the FIFO mode though,
this change can help debug future issue in mode switching.

Change-Id: Ifdcb0a42b13e4ecd3fd3bc70f46b377adb63236c
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-10-24 17:53:44 +05:30
qctecmdr
f3192b9d52 Merge "i3c: i3c-master-qcom-geni: Manage probe time resources" 2020-10-23 05:30:15 -07:00
qctecmdr
ed57810b41 Merge "i3c: i3c-master-qcom-geni: Fix IBI and Hot join related issues" 2020-10-23 05:30:15 -07:00
Mukesh Kumar Savaliya
6f99e8cf0a i3c: i3c-master-qcom-geni: Fix DMA and FIFO mode timeout scenario
This change primarily fixes timeout issue observed during
command send as part of read and write operations. This will
do proper cleanup of the GENI in command timeout with cancel
and abort operations while waiting for the done event.

Change-Id: Icd1a546fd6f54046640910e2d1225da855b2ea42
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-10-23 01:28:37 +05:30
Mukesh Kumar Savaliya
d4f9da6511 i3c: i3c-master-qcom-geni: Manage probe time resources
This change enhances the probe routine and cleanup the resources
properly if the failure is observed on previous operations.

Also add proper logging to exactly highlight the failure.

Change-Id: Idedc9e424a739758c3b8aa08675fb3e06bf67bb2
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-10-20 19:51:02 +05:30
Mukesh Kumar Savaliya
a4ac384410 i3c: i3c-master-qcom-geni: Force the xfer mode as DMA mode
This change enables DMA mode for regular private transfers.
And forces FIFO mode for CCC and DAA operations.

We can selectively decide to switch between xfer modes later
which is based on data length of the transfer similar to i2c
way of xfer mode selection.

Change-Id: Iaa183d314ebd27c43e498b438d3791a6b716d1de
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-10-20 00:25:08 +05:30
Mukesh Kumar Savaliya
46ae8ddee7 i3c: i3c-master-qcom-geni: Fix IBI and Hot join related issues
This patch fixes two issues observed during recent test with SN220.
Fix IBI issue to set the payload len based on clients config and
configures the same for master.

Also fix the hot join issue observed during unregistering IBI
which basically creates race between generation of hot join event
and unregistering of IBI. Hence avoid disabling the interrupt and
resetting IBI controller.

Change-Id: I7c151a90375d8c65f2332462332ef576945fb4fd
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-10-19 01:18:26 +05:30
qctecmdr
21188830f1 Merge "i3c: i3c-master-qcom-geni: Fix wrong reset of the TX, RX engine" 2020-07-26 05:42:16 -07:00
Mukesh Kumar Savaliya
b07d219d61 i3c: i3c-master-qcom-geni: Fix wrong reset of the TX, RX engine
This change corrects the wrong reset of the Primary and Secondary
Engine of the QUP SE upon read, write error.

Change-Id: I6d1461864745e22f10f87521947a934dcb02d161
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-07-22 12:43:30 +05:30
Mukesh Kumar Savaliya
649ea4d383 i3c: i3c-master-qcom-geni: Avoid NULL pointer access for i3cboardinfo
This change prevents dereferencing NULL pointer access happening with
i3cboardinfo during daa process.

Change-Id: Icdca8b727694d523773884f9b9436e17262db056
Signed-off-by: Mukesh Kumar Savaliya <msavaliy@codeaurora.org>
2020-07-18 01:31:55 +05:30
Ivaylo Georgiev
1ba1a55750 Merge wakeup_source changes into msm-4.19
* refs/heads/tmp-5da1114:
  Restore "UPSTREAM: PM / wakeup updates"

Change-Id: Ic256d059a99f075b519c4441c8b12fe4da818d62
Signed-off-by: Ivaylo Georgiev <irgeorgiev@codeaurora.org>
2020-05-23 05:22:24 -07:00
Subramanian Ananthanarayanan
d765a74951 i3c: i3c-master-qcom-geni: Add support to make I3C driver GKI compliant
Add support in I3C driver to make it a DLKM .

Change-Id: Icba66627f96ad0c905c5a022cda66661023303e4
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
2020-05-21 10:56:15 +05:30
Subramanian Ananthanarayanan
5994e64141 i3c: i3c-master-qcom-geni: Support for 3.4 Mhz,400 Khz
The change involes support for 3.4 Mhz and modified clk values for 400 Khz
to support NFC enumeration. Also changed open drain frequency to be used
from i2c clk freq passed from DTSI.

Change-Id: Ibba2416dab09c958b31779857aad5fe8dd753773
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
2020-04-21 19:39:36 +05:30
Subramanian Ananthanarayanan
480051d96c i3c: i3c-master-qcom-geni: Support for i3c hot-join feature
This change is to support bus enumeration through hot-join request.

Change-Id: I4639aeea861e3c48617096de4790e2bde46ce0da
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
2020-04-21 19:36:13 +05:30
Subramanian Ananthanarayanan
a7d29dd672 i3c: i3c-master-qcom-geni: Support for static address zero
This change is to support bus enumeration for slaves with static
address as zero. Also changes are made to link client ofnode for
slaves as part of attach dev callback.

Change-Id: Ia57882fb2d3ff87d8b832adf98e74ba66ba5e194
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
2019-12-06 17:34:14 +05:30
Subramanian Ananthanarayanan
137b5f5720 i3c: i3c-master-qcom-geni: Support for OD,PUSH-PULL mode frequency switch
This change is to support both OD,PUSH-PULL mode frequency upto 12.5 Mhz.
Also to make use of same source frequency during both the operations.

Change-Id: I48ecd4a48f11de466b8b15d8454b8e7e8acc6825
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
2019-11-08 11:38:22 +05:30
Subramanian Ananthanarayanan
a61c76b519 i3c: i3c-master-qcom-geni: Support for IBI wakeup from system suspend
This change is to support i3c ibi wakeup during system suspend scenario.

Change-Id: Icc74ccb913f390499083bb6fb5bf8c590af1b438
Signed-off-by: Subramanian Ananthanarayanan <skananth@codeaurora.org>
2019-11-04 15:16:58 +05:30
Alok Chauhan
997f9f2779 i3c: master-qcom-geni: Enable support for IBI controller
Enable IBI controller to detect and handle IBI
(In-Band Interrupt) requests from I3C slaves connected
on I3C bus.

IBI is method whereby a I3C slave device notify the master
of an interrupt on I3C bus.

Change-Id: I2023fcc93dd45daa24f67be10cfd87314a9bc39b
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-07-23 11:18:24 +05:30
Colin Ian King
f72d2e6d0e i3c: fix undefined behaviour of a shift of an int by more than 31 places
Currently the shift of two enum ints by more than 31 places on
can result in undefined behaviour with 64 bit longs. Fix this by
casting the ints to unsigned long before the shift.

Addresses-Coverity: ("Bad shift operation").
Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure").

Change-Id: I483f5ba295e01177c0cab0cd14a12dd6becf08f2
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Git-commit: 476c7e1d34f2a03b1aa5a924c50703053fe5f77c
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-06-28 15:19:56 +05:30
Vitor Soares
1d6278870b i3c: Fix the verification of random PID
The validation of random PID should be done by checking the
boardinfo->pid instead of info.pid which is empty.

Doing the change the info struture declaration is no longer necessary.

Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Change-Id: I55bb08181b316db9bc3801de1b592a2eaa29f3b7
Signed-off-by: Vitor Soares <vitor.soares@synopsys.com>
Cc: Boris Brezillon <bbrezillon@kernel.org>
Cc: <stable@vger.kernel.org>
Git-commit: 9752c37cc89f43675e70cf9acff23519fa84b48c
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-06-28 15:13:26 +05:30
qctecmdr
6596f440e7 Merge "i3c: master-qcom-geni: Correct I3C command parameter" 2019-05-15 03:46:01 -07:00
Alok Chauhan
ffddff4695 i3c: master-qcom-geni: Configure i3c mode register
configure i3c mode gpio register to set pad mode
for scl and sda lines.

Change-Id: Ie0ad19def756fc4407cbbc580a997aa9ab984eac
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-05-14 12:50:02 -07:00
Alok Chauhan
53a31eabd0 i3c: master-qcom-geni: Add NULL pointer check
Add null pointer check while iterating over all
I3C device present on the bus before reading
device information in DAA sequence.

Change-Id: I36ded06b51a3d330cf9e1fe85ea6314432a708ad
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-05-14 11:42:39 +05:30
Alok Chauhan
eeb1a0e2bd i3c: master-qcom-geni: Correct I3C command parameter
Correct i3c command parameter in DAA sequence and add
parameter to avoid NACK from IBI controller.

Change-Id: I71f46f98d42a8b4943275622ebdb51032333ca3a
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-05-07 19:22:27 +05:30
Alok Chauhan
59e8c62220 i3c: master-qcom-geni: Enable IBI controller in legacy mode
Enable IBI controller in legacy mode to make QUPv3 receives
correct sda/scl via IBI mux.

Change-Id: I90fa5a9ebaa009c09d2c66d049180ec31b0aeed7
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-05-07 19:21:07 +05:30
Alok Chauhan
10426ae5ea i3c: master-qcom-geni: Log i3c state in error scenario
Log i3c registers status at the time of error. This will
help in debug.

Change-Id: If175248d28f015ec6b53a79cebb218e740a3e106
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-05-07 19:19:35 +05:30
Alok Chauhan
9d46c0e4fb i3c: master-qcom-geni: correct i3c timing configuration
Correct i3c high time period configuration in Fast plus
mode.

Change-Id: I095aeff72b9f687b241d3599a1d03a826ea68160
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-05-07 19:16:00 +05:30
Alok Chauhan
81f04f4fdd i3c: Add a driver for Qualcomm GENI I3C master IP
Add a driver for Qualcomm GENI I3C master IP based on
proposed I3C framework.

Change-Id: Id12e8921ab4d73110fb973b8ccb432f616dc1591
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-03-18 12:30:02 +05:30
Jisheng Zhang
db35444180 i3c: fix missing detach if failed to retrieve i3c dev
If we failed to retrieve the i3c dev, we should detach the i3c dev
I.E i3c_master_detach_i3c_dev().

Change-Id: I4161ce67c99c9213d72f90a5369a8911c3f51432
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Git-commit: 093c61b6a0d5768f48442ec59d671496314cc47d
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-03-13 15:03:56 +05:30
Dan Carpenter
caabacf134 ic3: master: off by one in mode_show()
This should be >= ARRAY_SIZE() to avoid reading one element beyond the
end of the array.

Change-Id: Ia26f48d55f98a989c1ce2f23893f80e7a651855a
Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Git-commit: afe120c777b7a6aa23b8c8a5fedae9201a7ced0c
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-03-13 15:03:14 +05:30
Dan Carpenter
0efb296128 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.

Change-Id: Ic7196271dc547363e899adb46be86e36af4fc92d
Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Git-commit: 840414ae59d8858bca0a704e7f9c910d661348d7
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-03-13 15:02:34 +05:30
Boris Brezillon
ace0c3c406 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

Change-Id: Ia1a95de803228a57b1ee572f7bbe5cb81c7644e5
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Git-commit: 3a379bbcea0af6280e1ca0d1edfcf4e68cde6ee0
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
2019-03-13 15:01:42 +05:30