slim_msm: Report flow-error and mask apps slimbus port interrupts

Apps side slimbus ports may overflow/underflow if BAM pipes connected
to those ports don't have descriptors scheduled.
Report such errors and mask the port interrupts until BAM pipes have
descriptors scheduled to avoid interrupts firing multiple times.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slim_msm: Signal client's completion for per transfer notification

Slimbus ports are connected to BAM pipes and ports inform the pipe
when descriptor's data transfer is done. Clients queue a completion
per descrptor when that descriptor is processed. This completion will
get overwritten if client queues multiple descriptors. Use
per-transfer user-data as client's completion to avoid this problem.
This also reduces controller-driver involvement in data transfer.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slim_msm: Optimize slimbus data port's connection with BAM pipe

Slimbus data port on apps side can be connected in any diretion (as
source, or as destination). BAM pipe connected to that port should
only be disconnected/reconnected if this port direction changes.
This helps with reducing calls to connect/disconnect BAM pipes.
Allocate descriptors to avoid getting descriptor-space from the
common pool and free them only when the port is deallocated.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slimbus: Fix port allocation and deallocation for manager's ports

Since Manager's ports don't have any direction when allocated, make
sure the direction is not checked when connect-port is called on a
manager port. Ensure that controller's port resourced are freed-up
when dealloc_mgrports is called.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slim_msm: Get platform-specific information from platform-data

Number of pipes available to application processor for data channels,
and product-code field of enumeration address needed for setting
these pipes can be different for different platforms.
Store this platform-specific information in platform-data, and get
it from Device-Tree if applicable.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slimbus: Provide framer-booted notification to slimbus device drivers

When slimbus resets (due to bus reset sequence, or after it shuts down
and comes up), framer boots up and starts clocking the bus.
Devices on the bus may be in undefined state at that time. Callback
is provided to slimbus device drivers so that controller can report
framer-booted notification so that drivers can take necessary action
to put devices in reset state so that they can acquire sync, report
present, and be operational.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slim_msm: ngd: Return success for channel removal during ADSP SSR

Slimbus master component resides on ADSP when this driver is used.
Wehn ADSP restarts, slimbus component goes down and bus is not
operational until it comes back up. During restart, slimbus clients
are notified since their device goes down, and the clients remove
channels and/or disconnect ports. Since bus is not operational,
return success for channel removal/port disconnection calls so that
the channel, port state is consistent with HW (not active, removed)

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slim_ngd: Return success for resource removal requests if HW restarts

Channel and ports are removed when HW restarts. Return success to
client channel removal, port disconnection requests when slimbus HW
is restarting.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slim_ngd: Fix logical address notification mechanism

It's possible that multiple slaves report present and expect
corresponding notifications concurrently. Make sure notifications
are sent out in that case. Since notifications cannot be sent when
device doesn't have associated driver, make sure logical address
is not queried in that case.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>