summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/connection.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: greybus: move the greybus core to drivers/greybusGreg Kroah-Hartman2019-08-271-942/+0
| | | | | | | | | | | | | | | | The Greybus core code has been stable for a long time, and has been shipping for many years in millions of phones. With the advent of a recent Google Summer of Code project, and a number of new devices in the works from various companies, it is time to get the core greybus code out of staging as it really is going to be with us for a while. Cc: Johan Hovold <johan@kernel.org> Cc: linux-kernel@vger.kernel.org Cc: greybus-dev@lists.linaro.org Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Alex Elder <elder@kernel.org> Link: https://lore.kernel.org/r/20190825055429.18547-9-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: move core include files to include/linux/greybus/Greg Kroah-Hartman2019-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | With the goal of moving the core of the greybus code out of staging, the include files need to be moved to include/linux/greybus.h and include/linux/greybus/ Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Cc: Johan Hovold <johan@kernel.org> Cc: Vaibhav Agarwal <vaibhav.sr@gmail.com> Cc: Rui Miguel Silva <rmfrfs@gmail.com> Cc: David Lin <dtwlin@gmail.com> Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Cc: greybus-dev@lists.linaro.org Cc: devel@driverdev.osuosl.org Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Alex Elder <elder@kernel.org> Link: https://lore.kernel.org/r/20190825055429.18547-8-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: Parenthesis alignmentCristian Sicilia2018-11-261-41/+41
| | | | | | | | Some parameters are aligned with parentheses. Some parentheses was opened at end of line. Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: remove multiple blank linesIoannis Valasakis2018-11-091-4/+0
| | | | | | | | Remove continuous multiple blank lines. Reported by checkpatch. Signed-off-by: Ioannis Valasakis <code@wizofe.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: Remove redundant license textGreg Kroah-Hartman2017-11-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Now that the SPDX tag is in all greybus files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Acked-by: David Lin <dtwlin@gmail.com> Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Acked-by: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman2017-11-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/greybus files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Acked-by: David Lin <dtwlin@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: make cport_quiesce() method optionalAlexandre Bailon2017-04-181-0/+3
| | | | | | | | | | | | The cport_quiesce() method is mandatory in the case of the es2 Greybus hd controller to shutdown the cports on the es2 controller. In order to add support of another controller which may not need to shutdown its cports, make the cport_quiesce() optional, and check if the controller implement it before to use it. Signed-off-by: Alexandre Bailon <abailon@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: add host device function pointer checksJason Hrycay2017-01-031-0/+6
| | | | | | | | | | | | Add sanity checks for cport_quiesce and cport_clear before invoking the callbacks as these function pointers are not required during the host device registration. This follows the logic implemented elsewhere for various other function pointers. Signed-off-by: Jason Hrycay <jhrycay@gmail.com> Reviewed-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Acked-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* greybus: connection: implement new connection handlingJohan Hovold2016-08-261-35/+92
| | | | | | | | Implement the new connection setup and tear-down sequences for control connections and bundle connections (offloaded and non-offloaded). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: fix offloaded-connection ping cport idJohan Hovold2016-08-031-1/+1
| | | | | | | | | | | The host-device cport_ping callback expects the AP side cport id, but was incorrectly passed the interface cport id. Note that no host-device driver currently implements this callback, and that it is soon even to be removed. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: drop the svc quiescing operationJohan Hovold2016-07-191-19/+0
| | | | | | | | | | | | | | | | | | | Connection tear down is being reworked, and the SVC quiescing operation is going away. Let's remove this operation now along with the coupled second ping from our intermediate tear down implementation. This both avoids unnecessary noise in the logs resulting from the fact that the SVC side of the quiescing operation was never merged, and speeds up connection tear down slightly. Testing done: Tested on EVT2 using runtime PM. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: remove CDSI1 hackFabien Parent2016-07-061-10/+0
| | | | | | | | | | | | | This hack is not necessary anymore since the firmware is now able to handle correctly (dis)connect{ed,ing} operations on the CDSI CPort. Testing Done: Checked that I could start the camera app several time and got the preview each time. Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
* greybus: Revert "greybus: gb_connections_lock: don't use spin_lock_irq()"Johan Hovold2016-06-291-7/+4
| | | | | | | | | | | | | | | | | | | | This reverts commit b022fd95108e8b9d202532a74d39e86152bc8f7f. Someone decided that all use of spin_lock_irq was to be considered a bug and went on a search-and-replace type "bug-fixing" spree last week. This is however just plain wrong. Using spin_lock_irq is perfectly fine in paths were interrupts have not been disabled, and this is in fact even preferred over the lazy approach of always using spin_lock_irqsave instead of understanding the code that is being written or modified. All current uses of spin_lock_irq have already been vetted in this respect. Also note that it is only used in functions that may sleep, that is, in functions that must not be called with interrupts disabled in the first place. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: Revert "connection: switch to using ↵Johan Hovold2016-06-291-30/+23
| | | | | | | | | | | | | | | | | | | | | | spin_lock_irqsave/spin_lock_irqrestore excluisvely" This reverts commit 426237c515b42b9f06d9a2b1021a6d2c4d440c51. Someone decided that all use of spin_lock_irq was to be considered a bug and went on a search-and-replace type "bug-fixing" spree last week. This is however just plain wrong. Using spin_lock_irq is perfectly fine in paths were interrupts have not been disabled, and this is in fact even preferred over the lazy approach of always using spin_lock_irqsave instead of understanding the code that is being written or modified. All current uses of spin_lock_irq have already been vetted in this respect. Also note that it is only used in functions that may sleep, that is, in functions that must not be called with interrupts disabled in the first place. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add support for high-priority connectionsJohan Hovold2016-06-241-2/+3
| | | | | | | | | | | | | | | | | | | | | Add connection flag to indicate that a connection has high priority. For the SVC and control connections this may be used by the host-device driver as a hint to allocate dedicated DMA channels or to use polling to avoid message congestion. We also allow drivers to set this flag on their connections, even though we currently have no use case for this (and the host-device driver is again free to ignore it). Note that this mechanism can be used to indicate also high-bandwidth connections (e.g. wanting larger buffers or dedicated endpoints), but that that should be done using a separate high-bandwidth flag rather than overloading the high-priority flag. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: prevent drivers from specifying core flagsJohan Hovold2016-06-241-4/+4
| | | | | | | | | Prevent drivers from specifying core flags (currently only GB_CONNECTION_FLAG_CONTROL) when creating connections. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: hd: add flag argument to cport_enable callbackJohan Hovold2016-06-241-1/+2
| | | | | | | | | | Add a flag argument to the host-device cport_enable callback that can be used to provide hints about the connection being created (e.g. connection priority). Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: switch to using spin_lock_irqsave/spin_lock_irqrestore ↵Jeffrey Carlyle2016-06-241-23/+30
| | | | | | | | | | | | | | | | | | | | | | excluisvely We know that it is a bad idea to explicitly enable IRQs when we don't don't know if they were already off before we disabled, so switch to the save _irqsave and _irqrestore functions. Ultimately, we need to review places in the Greybus drivers where IRQs are disabled and remove unnecessary instances. This is only an interim step. This code will never run from hard irq context, as it is already taking mutex in the path. Testing done: booted EVT2.0, ran suspend/resume test app with a period of 20s for a few dozen cycles. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: gb_connections_lock: don't use spin_lock_irq()Viresh Kumar2016-06-231-4/+7
| | | | | | | | | | | | | | | | | | | | | | | spin_[un]lock_irq() routines should be used carefully as they things can go wrong, if they are mixed with spin_lock_irqsave() or other variants. The main problem is that spin_[un]lock_irq() routines doesn't check if the IRQs are already disabled/enabled on the local CPU and so spin_unlock_irq() will forcefully enable interrupts for example. This may not work well, if some other code was relying on interrupts being disabled. Use spin_lock_irqsave() and spin_unlock_restore() instead. This patch doesn't claim that it fixes the JIRA completely, but the issue was harder to reproduce for some iterations after this, which was quite easy to reproduce earlier on. Tested on EVT 2.0 with lots of debug patches to kernel and greybus. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: Revert "greybus: don't use spin_lock_irq()"Greg Kroah-Hartman2016-06-231-37/+27
| | | | | | | | | This reverts commit 469fbe5da0229edcb42aa08bef8e10feaa37e6d7. It isn't correct in places. Reported-by: Gjorgji Rosikopulos <rosikopulos_gjorgji@projectara.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: don't use spin_lock_irq()Viresh Kumar2016-06-231-27/+37
| | | | | | | | | | | | | | | | | | | | | | | | spin_[un]lock_irq() routines should be used carefully as they things can go wrong, if they are mixed with spin_lock_irqsave() or other variants. The main problem is that spin_[un]lock_irq() routines doesn't check if the IRQs are already disabled/enabled on the local CPU and so spin_unlock_irq() will forcefully enable interrupts for example. This may not work well, if some other code was relying on interrupts being disabled. Use spin_lock_irqsave() and spin_unlock_restore() instead. This patch doesn't claim that it fixes the JIRA completely, but the issue was harder to reproduce for some iterations after this, which was quite easy to reproduce earlier on. Tested on EVT 2.0 with lots of debug patches to kernel and greybus. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add trace events before disabling connectionViresh Kumar2016-06-161-4/+4
| | | | | | | | | | | | | | This is what we are doing elsewhere: - Send enable/create trace events after enabling/creating stuff. - Send disable/remove trace events before disabling/removing stuff. This wasn't followed in a same way while disabling connections. Fix it. Compile tested. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: Return bool from gb_connection_intf_find()Viresh Kumar2016-06-101-5/+4
| | | | | | | | | | | | This is used only to check if an existing connection already uses the cport_id or not and doesn't really need to return pointer to the connection. While at it, also rename it to suit its purpose. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: Remove extra blank linesViresh Kumar2016-06-101-1/+0
| | | | | | | | | | | | This patch removes few blank lines across the repository at places where two blank lines were present together or when a blank line is present at the start or end of a routine. Note that this doesn't remove most of them from greybus_protocols.h as they were added on purpose. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: Avoid unnecessary line breaksViresh Kumar2016-06-091-4/+2
| | | | | | | | Some line breaks weren't required as we never crossed 80 columns, remove them. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: tracing: add timing tracesAlex Elder2016-06-031-0/+2
| | | | | | | | | | | | | | | | | Bryan reports he used certain message traces to determine when time sync messages transit the boundary between the Greybus core and the host device. This patch adds two trace events--one a message event for outbound messages (because it indicates its operation and its destination), and one host device event for incoming messages (because message information isn't available as early as desired). These events are being created to allow the same sort of analysis of messages without having to store extra information for every message trace. (The next patch changes the information a message trace records.) Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: tracing: define connection tracesAlex Elder2016-06-031-0/+21
| | | | | | | | | | | | Define a new gb_connection trace point event class, used to trace events associated with the connection abstraction. Define four basic trace events for this--creation, drop of last reference, and when adding or dropping any other reference. There are certainly more events that we might want to add, but aim is to just get the basic framework in place. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: implement generic mode-switch functionalityJohan Hovold2016-05-271-4/+32
| | | | | | | | | | | | | | | | | | | | | | Add a generic interface for bundle drivers to use to request that a mode switch is carried out on its behalf. Mode switching involves tearing down all connections to an interface, sending a unidirectional mode-switch request, and waiting for a mailbox event that triggers deferred control connection reset and re-enumeration of the interface. In case of a timeout waiting for the interface mailbox event, or on other errors, the interface is powered off. All of this needs to be done by core from work-queue context in order not to block incoming SVC requests and bundle-device tear down. Care must also be taken to serialise against concurrent module removal events and eject requests. Special handling of legacy mode-switching is also added in order to continue to support the ES3 bootrom. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add flush host-device callbackJohan Hovold2016-05-271-0/+24
| | | | | | | | | | | | | | | | | | | Add a new host-device callback to flush any host-device queues, including any ongoing transfers, as part of connection tear down. The host-device buffers are flushed after the disconnecting operation have completed and the AP queues have been emptied. This can be used to flush already queued messages which upon reception would have been discarded by the remote end anyway. Note that this does not remove the need to flush any host-device queues as part of CPort disable which needs to make the CPort ready for reuse after deallocating all associated state and resetting the port. Suggested-by: Mitchell Tasman <tasman@leaflabs.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: implement proper connection closureJohan Hovold2016-05-271-7/+102
| | | | | | | | | | | | | | | | | | | Implement proper connection closure, which includes sending ping requests on the connection being tore down while coordinating with the remote interface as well as the SVC. This specifically implements the new ping operation, which in case of offloaded connections is handled by the host-device driver in an implementation-defined manner through a new callback. Note that the normal connection tear-down procedure is executed in case of failed connection establishment due to failed connected operation. Specifically, the disconnecting request is sent also in case the connected operation never succeeded. This is needed since the interface may have enabled FCT flow upon receiving the connected request. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: move CPort Buffer configuration out of svc helpersJohan Hovold2016-05-271-12/+9
| | | | | | | | | | | | The CPort Buffer configuration in the host-device needs to match the CPort feature flags set by the SVC, but they need not always be configured at the same point in time. This will be used when implementing proper connection tear down. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: rename an error labelJohan Hovold2016-05-271-2/+2
| | | | | | | | Rename an error label to make it more descriptive. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: log cport-enable error messagesJohan Hovold2016-05-271-2/+9
| | | | | | | | | Log failures to disable a host cport, and include the connection name in cport enable/disable error messages. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add control connection flagJohan Hovold2016-05-271-7/+8
| | | | | | | | | | Add control connection flag which will be set for control connections. Also add a helper function to test if the flag is set. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: core: avoid I/O to disconnected interfacesJohan Hovold2016-05-271-0/+21
| | | | | | | | | | | | | | | | | | | | | | Add new helper to disable connections to interfaces that have already been disconnected (e.g. forcibly removed). The connection tear-down procedure differs enough depending on whether the interface is still present or already gone to warrant a dedicated helper. This will become more obvious with the new tear-down procedure, which involves I/O on the connection being tore down. This also simplifies handling of the legacy bootrom, which does not support the new tear-down operations. Specifically, this allows us to remove the early control-connection tear down during interface disable, and also avoids some error messages currently printed during legacy mode switch (i.e. bootrom boot-over-UniPro) and forcible removal. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: verify disabled when destroyedAlex Elder2016-05-181-0/+3
| | | | | | | | | | | A connection must be in DISABLED state before it gets destroyed. Warn if this is ever not the case (and do the disconnect) before proceeding with connection destruction. Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add camera-data connected workaroundJohan Hovold2016-05-131-0/+10
| | | | | | | | | | | | Firmware currently lacks a representation of the offloaded CDSI connections and connected requests sent for these ports therefore fails. Add a temporary work-around until this has been resolved in firmware. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: hd: generalise cport allocationJohan Hovold2016-05-131-1/+1
| | | | | | | | | | | | | Generalise CPort allocation by allowing host-device drivers to override the default implementation. Also pass the connection flags down the stack as such information is needed for proper CPort allocation. Specifically, this will initially be used to allow the camera driver to allocate the dedicated CDSI CPorts. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: hd: move CPort allocation to host-device codeJohan Hovold2016-05-131-22/+8
| | | | | | | | | | | | Move host-device CPort allocation to the host-device code. Proper CPort allocation requires knowledge of the hardware and must be handled by the host-device driver. This is an intermediate step that moves the generic CPort-allocation code to the host-device code. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add helper for creating offloaded connectionJohan Hovold2016-05-131-0/+13
| | | | | | | | | | | | | Add helper for creating offloaded connection. This can later be extended to support more elaborate resource management. Also fix a minor white space issue. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add no-flow-control connection flagJohan Hovold2016-05-131-3/+4
| | | | | | | | | | | | Add a no-flow-control connection flag, which is set for connection that should not have any flow-control feature enabled. This flag is specifically set for all connections to the legacy ES3 bootrom, and will also be used by the camera driver eventually. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: export gb_connection_disable_rx() fnVaibhav Hiremath2016-05-051-0/+1
| | | | | | | | | | | | gb_connection_disable_rx() fn is required to be used by other modules (e.g. bridged-phy drivers) and so export it. Testing Done: Tested on gbsim. Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: clean up ES3-bootroom-quirk handlingJohan Hovold2016-03-301-2/+5
| | | | | | | | | | | | | | Clean up handling of the ES3-bootrom quirks by adding an interface quirk-flags field that is set appropriately when we detect that the ES3 bootrom is running. Note that we need to reserve the DME_DIS_UNIPRO_BOOT_STARTED and DME_DIS_FALLBACK_UNIPRO_BOOT_STARTED status values for the ES3 bootrom, which does not support any CPort features (unlike later boot stages). Add a BOOTROM infix to the defines to make this more clear. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: hd: rename CPort-features callbacksJohan Hovold2016-03-041-10/+12
| | | | | | | | Rename the CPort-features callbacks, that are not just used to enable FCT flow, to the more descriptive cport_features_enable/disable. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add CSD connection flagJohan Hovold2016-03-041-1/+1
| | | | | | | | | | | Add CSD connection flag that can be specified when allocating a connection to enable Controlled Segment Dropping in favour of E2EFC which is enabled by default. Note that most connections are expected to have E2EFC enabled. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: generalise CPortFlags handlingJohan Hovold2016-03-041-1/+12
| | | | | | | | | | | | | Generalise the svc connection-create helper to accept a cport-flags argument and handle the flags in the connection code instead. Note that the camera driver currently manages its data connection directly. We keep E2EFC enabled for now even though it will soon need to be disabled due to some pending firmware updates. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add connection-flag interfaceJohan Hovold2016-03-041-4/+20
| | | | | | | | | Add interface for associating a flag bitmask with a connection when creating it. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: {en,dis}able fct flow in connection managementFabien Parent2016-02-241-1/+12
| | | | | | | | | | The AP must enable the FCT flow of APBA once it has received the response from the AP that the connection between APBA and a module has been setted up. Disable the flow of FCT tokens when destroying connections. Signed-off-by: Fabien Parent <fparent@baylibre.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: add api to {en,dis}able unipro fct flowFabien Parent2016-02-241-0/+28
| | | | | | | | | | In order to support mailbox-free control cport init on the bridges the AP must be able to enable/disable the flow of unipro fct tokens. Add a new API that will enable or disable on APBA the flow of fct tokens. Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Fabien Parent <fparent@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: connection: Fix sparse warnings around lockingViresh Kumar2016-02-021-0/+2
| | | | | | | | | | | | | | | | | | | The callers ensures that connection->lock is taken before calling few routines, but that isn't enough for sparse as it sees an unexpected unlock. greybus/connection.c:380:29: warning: context imbalance in 'gb_connection_cancel_operations' - unexpected unlock Fix that adding __must_lock() attribute to the function declaration. This also adds the attribute for gb_connection_flush_incoming_operations(), which isn't showing any sparse warnings with the current state of code, but with minor rearrangements of the code. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>