31 Commits

Author SHA1 Message Date
Rishabh Bhatnagar
79d8dbc3ff drivers: esoc: Add support for marmot external modem
Modify esoc driver to introduce new compatible and fops
for marmot external modem target.

Change-Id: I206a6ca7d964013cb1814e0fcf45997982ed45eb
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2020-02-22 13:21:51 -08:00
Rishabh Bhatnagar
3253b953e8 drivers: esoc: Add support for sm8150 + chitwan target
Modify esoc driver to introduce new compatible and fops
for sdxchitwan.

Change-Id: Ieb2c6c3ba6a05cf879c0b2c53cbf995540898774
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2020-02-04 11:13:12 -08:00
Rishabh Bhatnagar
1038908526 esoc: Wait for modem status to go low in crash shutdown
Wait for modem status to go low in crash shutdown. This helps
cover the race condition where there is a crash during graceful
shutdown and we end up in crash path and send crash notification
to clients even before the modem status has gone low. Also set
the crash flag in interrupt path to avoid double queueing of ssr
work.

Change-Id: I680b79c7a1de5e44cb9fcfa0f9d67517c0398f62
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2019-09-18 10:08:04 -07:00
Rishabh Bhatnagar
9686a66620 drivers: esoc: Set crash status after modem status goes low
In situations where graceful shutdown and errfatal occur parallely on
modem, the graceful shutdown thread can go into crash shutdown path
because the crash flag is set asynchronously in errfatal handler.
In this case clients are notified that modem has crashed even though
it hasn't crashed completely. Clients perform cleanup based on the
assumption that modem is completely crashed and this might lead use
after free scenarios. Therefore wait for modem status to go low to
set the crash flag.

Change-Id: Ibafc54b3a136816c33476a28492bd081b053eecc
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2019-07-24 11:42:25 -07:00
Rishabh Bhatnagar
7513448c91 esoc: Protect the crash shutdown path against reboot notifier
SSR shutdown and reboot notifier both invoke clients hooks. These hooks
might be invoked at the same time leading to a race. Synchronize the
two paths.

Change-Id: Ibd0f7248956d60d5831068ffcf88895adb1cd30d
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2019-07-24 11:42:05 -07:00
Rishabh Bhatnagar
e06ef8ea48 esoc: Add mdm error-fatal notifier hook
Add an error-fatal notifier hook to the list of other client hooks,
which would notify the clients about modem's unexpected reset or
error-fatal.

Change-Id: I185c4b05795b7ffb0768c240f25cc487f3d67b63
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2019-06-18 11:46:20 -07:00
Rishabh Bhatnagar
7e442017a7 esoc: Change the toggle delay for external modem.
Minimum toggle delay needed to ensure reset occurs correctly is
120ms. Change the minimum bound of usleep_range to 120ms.

Change-Id: I3a2a4301787ff5032698adc979cbf57153ecacfc
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2019-06-14 16:33:30 -07:00
Raghavendra Rao Ananta
ccc5e484dc esoc: Convert the boot fail configurations to IOCTLs
Currently the external modem's boot fail configurations,
boot_fail_action and n_pon_tries, are set via module parameters.
Convert it to an IOCTL so that a registered user-space
application has control over the configurations.

Change-Id: Iaf412b873fa452b99811a50e7ae886cc49cfcf81
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2019-06-06 13:01:03 -07:00
Raghavendra Rao Ananta
c534fa5509 esoc: Introduce stage-3 reset under boot fail action
Under some corner cases, the external modem could not be
configured to listen to warm-reset. For such a scenario,
even if esoc driver issued a warm reset, the modem would not
react to it, leading to a boot failure. Therefore, introduce a
new boot fail action to perform a stage-3 reset such that
the modem could start afresh.

Change-Id: I1cfc93da9cfe90cc6e3244330184d78a02f54c50
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2019-06-03 16:37:27 -07:00
Raghavendra Rao Ananta
e9ce612b0c esoc: Call the PON and POFF hooks with bit-masked flags
Currently, the esoc driver calls the client's power-on and power-off
hooks with a boolean flag indicating if the external modem is in
error-fatal or not. However, this information itself isn't sufficient
for the clients. The clients also may rely on the actions such as, if
the driver would be shutting down the modem in the sequence or not.
Hence, convert the boolean flag to an integer based flag that carries
the bitmask of all such information.

Convert the esoc callbacks for the MHI driver as it's affected by this
API change.

Change-Id: I376e85ba499574a4c9e8cf3e845ab6311afe52d2
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2019-05-15 09:44:31 -07:00
Raghavendra Rao Ananta
aafc7f7fb9 esoc: Call the power_off hooks from the reboot notifier
Usually, the power_off hooks of the esoc clients are called
before the modem is powered down. Power down of the modem
is also triggered from the reboot notifier path. Hence, call
the power-off hooks from that path too.

Change-Id: Ie5a68fe15a86ec10dcd1f5499dd2d0415038ad7b
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-10-23 10:42:40 -07:00
Raghavendra Rao Ananta
b8e50871ad esoc: Add support for sdxprairie
Add basic operations to support sdxprairie in esoc driver that includes
compatibility, initializations and power control operations (reset,
shutdown, and so on). Most of the configurations are leveraged from
the existing sdx50 configurations.

Change-Id: Ide75e2f2efeac0767c1ecd760bda7e455ab527dc
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-10-10 13:09:20 -07:00
qctecmdr Service
a8f6831b0f Merge "esoc: Move polling of the gpio from an interrupt context" 2018-07-26 19:49:03 -07:00
qctecmdr Service
f3424061bb Merge "esoc: Set default boot fail action to panic" 2018-07-25 18:20:01 -07:00
Raghavendra Rao Ananta
39291827c1 esoc: Move polling of the gpio from an interrupt context
A previous change (<8a1a862455ee0f> esoc: Check for modem status LOW
prior to error handling) introduced a bug wherein the driver polls
the gpio line for 3 seconds in an interrupt context, leading
to a watchdog bark. Hence, move the polling logic to a scheduled
work item in the same path.

Change-Id: I8ff17d354175920610f9ce69ed47e362f2de055d
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-07-25 15:14:18 -07:00
Adam Bickett
e96a57f60c esoc: Set default boot fail action to panic
Update default action upon boot failure to trigger panic.

Change-Id: If976e35de282d2d9ab1fccf472732f21be20d67a
Signed-off-by: Adam Bickett <abickett@codeaurora.org>
2018-07-18 08:57:53 -07:00
Raghavendra Rao Ananta
8a1a862455 esoc: Check for modem status LOW prior to error handling
With the check for the modem status to come LOW, the APQ
could be sure that the modem has not landed into any other
problems on its way to the debug path. Currently, we wait
for the modem status to come LOW only for the situation
where the APQ panics. However, this check is also needed
when the modem panics. The necessary action to handle the
crash is now placed after the check is done.

Change-Id: I16cf1e3a4fdacd1fc98c6f2ec6173de7ea22933a
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-06-20 14:07:12 -07:00
Raghavendra Rao Ananta
52cf7a4003 esoc: Add IPC logging support
Add IPC logging support for detailed tracking of events that the
esoc driver would be handling.

Change-Id: Iadb63dc946efc355de2e68d6c4890aade1a04b0c
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-06-08 10:36:25 -07:00
Raghavendra Rao Ananta
664dc0bd7c esoc: Add module parameters to control driver actions
In order to control some parameters while debugging, such
as, change the number of PON attempts, change the action to
be taken in case the external modem doesn't boot, and so on,
add module parameters.

Change-Id: I508d795a8684533302d8c9668693b630029cecb4
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-06-07 15:52:52 -07:00
qctecmdr Service
f94a7f5570 Merge "esoc: Increase the post power-on delay" 2018-06-01 22:52:13 -07:00
Raghavendra Rao Ananta
f576f14a87 esoc: Increase the post power-on delay
Increase the post power-on delay from 50 ms to 150 ms. This is
to give sufficient time for the external modem to complete the
PCIe link training.

Change-Id: I712177d1fc5d160848ccc838cadbb0f85b2fe1a7
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-05-29 09:34:18 -07:00
Adam Bickett
e26ca7471e esoc: power down on reboot
Power down external modem during primary reboot. This ensures the
external modem is in a consistent state on the subsequent powerup
after the reboot.

Change-Id: I52da95e450a58f4180153d5e069bd2dae8d6132e
CRs-Fixed: 2244359
Signed-off-by: Adam Bickett <abickett@codeaurora.org>
2018-05-28 23:19:28 -07:00
Raghavendra Rao Ananta
ae96f0f13e esoc: Add support to retry the powerup of external modem
Due to recent hardware limitations, the requirement is to do
the warm reset of the modem twice. Once for collecting the
dumps and the other for transferring the firmware images.
If during the process, the driver receives a failed notification,
then power-off the modem. Hence, add code to support these
functionalities.

Change-Id: I4923b6e89474a44bdde477ccbd0c4e73b9648aae
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-05-22 16:02:04 -07:00
Adam Bickett
769ef33945 esoc: update pon, warm reset, poff sequence timing for sdx50m
Update toggle time for sdx50m warm reset, shutdown, and cold reset
to follow the updated configuration.

Change-Id: I7b256fd7596f40403c745e92e6e60c9712a1f313
Signed-off-by: Adam Bickett <abickett@codeaurora.org>
2018-05-15 14:01:08 -07:00
Raghavendra Rao Ananta
fd822c54c7 esoc: Reorder the events in graceful shutdown case.
The correct order for graceful shutdown should be: send sysmon-shutdown,
call the poweroff clinet hooks and finally pull the reset line to low
to trigger a poweroff of the modem.

Change-Id: Ife1aa1db3bcb5aaf2dd643885502ab0bdf005149
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-03-03 11:43:19 -08:00
Raghavendra Rao Ananta
5592496c3b esoc: Ignore waiting for the modem status to go low.
When the esoc driver sends the sysmon-shutdown command to the
modem, it starts it's shutdown process. Then the APQ waits for
the modem status to come low. When it comes low, the modem sees
that the reset line is still held high by the APQ and starts a
powerup sequence again, which is incorrect.

By ignoring the path where the modem's status line is checked,
this situation is avoided. As soon as the esoc driver receives
the sysmon response from the modem, it would now pull the reset line
low, thus turning-off the modem completely.

Change-Id: I98454a49e858eccfbc9a39bfd642f2de691e7834
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-03-03 11:43:19 -08:00
Raghavendra Rao Ananta
4dca34f3f3 esoc: Notify mdm-helper about the modem's error fatal
There is no way for the mdm-helper to know that the
modem has crashed to take necessary action.
Hence, added the support that sends a notification to the
user-space, through IOCTL, as and when the modem sends an
error fatal interrupt to the driver.

Change-Id: I0a596763b310641d4c9e93d03690ba96162515ff
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-03-03 11:43:18 -08:00
Raghavendra Rao Ananta
f41dec67da esoc: Add support for client hooks based on priority
Some subsystems/drivers require notifications from the esoc
driver as soon as the it powers on/off the modem.
For this, the clients cannot directly depend on the
SSR notifications.

Hence, adding support such that the clients who are
interested in listening to such events can register
themselves. Moreover, the order in which these notifications
are sent to the clients can be prioritized statically.

Also, a flexibilty is added such that the user-space
can get information, such as link-id, from the interested
client.

Change-Id: I8274f0fd5210b7d0186dddf63afd69fc98d2e110
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-03-03 11:43:18 -08:00
Raghavendra Rao Ananta
a6eeed7b01 esoc: Add flexibility to avoid soft-reset during modem error fatal
In the event of a modem error-fatal, and if the related SSR is set,
the esoc driver takes the path of doing a warm reboot of the
device. However, modern design requires that the communication
link to the modem is not lost and the fact that the reboot is
done by SDI.

As a result, a flexibility is added such that the modem doesn't
have to go through the warm reboot sequence, thus preserving
the link.

Change-Id: Id78b877b33cdd501972c9b3274284a6b4c73f291
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-02-28 09:55:03 -08:00
Satya Durga Srinivasu Prabhala
52a313742f esoc: Add support for SDX50
Add basic operations to support sdx50 in esoc driver that includes
compatibility, initializations and power control operations (reset,
shutdown, and so on).

Change-Id: Ia53a128b0259d0fc7680bc9452ceaead7b286ca8
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2018-02-22 16:06:58 -08:00
Raghavendra Rao Ananta
4ad0517598 esoc: Add snapshot of esoc driver
This is a snapshot of the esoc driver as of msm-4.4 commit <9d5748a>
(Merge "ARM: dts: msm: disable wdog wakeup on msm8996 vplatform").
The change also removes the support for older modems which are no
longer used.

Change-Id: I879768a3c56c986e66371700c062f3fa41448af7
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
2018-02-21 12:46:26 -08:00