summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/interface.c
Commit message (Collapse)AuthorAgeFilesLines
* 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: fix parenthesis alignmentsDiwakar Sharma2017-07-271-20/+20
| | | | | | | | Parenthesis alignment issues reported by checkpatch, fixed here. Signed-off-by: Diwakar Sharma <sharmalxmail@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: remove timesync protocol supportGreg Kroah-Hartman2017-01-071-54/+2
| | | | | | | | | | | | | | | | | While the timesync protocol was a great idea, it never ended up getting implemented by any known hardware devices. It's also a bit "interesting" in how it ties into the platform controller. So, just remove it for now. It's not needed, no one uses it, and it's a stumbling block in getting the greybus core code merged out of the staging tree. If anyone wants it in the future, reverting this patch is a great place to start from. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Johan Hovold <johan@kernel.org> Reviewed-by: Alex Elder <elder@kernel.org> Acked-by: Bryan O'Donoghue <pure.logic@nexus-software.ie> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: greybus: remove CONFIG_PM_RUNTIME from kernel_ver.hGreg Kroah-Hartman2016-09-191-1/+1
| | | | | | | | | The last thing remaining in kernel_ver.h was the setting of CONFIG_PM_RUNTIME, which isn't needed in a in-tree implementation. So remove the setting of this value, and the .h file entirely as that was the last thing left in it. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: fix timesync registration sequencingDavid Lin2016-08-061-9/+9
| | | | | | | | | | | | | | | | When enabling an interface, control device should be registered after having successfully added the timesync. Similarly for the interface disable path, control device should be removed first before removing timesync. Testing Done: - Enable and disable the interface Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Suggested-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: David Lin <dtwlin@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: delete control device upon enable failureDavid Lin2016-08-031-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is an issue that when an interface failed to be enabled due to timesync failure, a previously added control device is not deleted as part of the error clean-up. This causes a leak in the sysfs file when the interface is disabled. This would eventually cause this particular interface to be unable to register future control device even after unipro_reset. See failure logs below: [ 906.495261] greybus 1-3.3: failed to add to timesync: -19 [ 906.516497] greybus 1-3.3: failed to re-enable interface: -19 [ 907.016016] greybus 1-3.3: Interface removed ... [ 1623.677343] ------------[ cut here ]------------ [ 1623.681116] WARNING: at kernel/arche/fs/sysfs/dir.c:530 sysfs_add_one+0x98/0xb4() [ 1623.681128] sysfs: cannot create duplicate filename '/bus/greybus/devices/1-3.3.ctrl' [ 1623.681252] Call trace: [ 1623.681265] [<ffffffc000207b40>] dump_backtrace+0x0/0x268 [ 1623.681272] [<ffffffc000207db8>] show_stack+0x10/0x1c [ 1623.681284] [<ffffffc000ccb890>] dump_stack+0x1c/0x28 [ 1623.681295] [<ffffffc00021f9dc>] warn_slowpath_common+0x74/0x9c [ 1623.681301] [<ffffffc00021fa60>] warn_slowpath_fmt+0x5c/0x80 [ 1623.681307] [<ffffffc000366624>] sysfs_add_one+0x94/0xb4 [ 1623.681315] [<ffffffc0003670b4>] sysfs_do_create_link_sd+0x100/0x1c8 [ 1623.681320] [<ffffffc0003671a8>] sysfs_create_link+0x2c/0x38 [ 1623.681332] [<ffffffc0005d5890>] bus_add_device+0xd8/0x190 [ 1623.681338] [<ffffffc0005d39ec>] device_add+0x2b4/0x604 [ 1623.681349] [<ffffffbffc006dfc>] gb_control_add+0x10/0x40 [greybus] [ 1623.681362] [<ffffffbffc003dac>] gb_interface_enable+0x20c/0x3b8 [greybus] [ 1623.681373] [<ffffffbffc002a30>] gb_module_add+0x124/0x174 [greybus] [ 1623.681385] [<ffffffbffc0082cc>] gb_svc_intf_set_power_mode+0xdd4/0xfe8 [greybus] [ 1623.681394] [<ffffffc00023888c>] process_one_work+0x268/0x3c8 [ 1623.681400] [<ffffffc000239a64>] worker_thread+0x204/0x358 [ 1623.681410] [<ffffffc00023f43c>] kthread+0xb8/0xc4 [ 1623.681414] ---[ end trace 44489577dd9220db ]--- [ 1623.681818] greybus 1-3.3.ctrl: failed to register control device: -17 Testing Done: - Continuous unipro_reset stress test Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Jeffrey Carlyle <jcarlyle@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: replace Ara referencesJohan Hovold2016-07-281-14/+14
| | | | | | | Replace all occurrences of the term "Ara" with "GMP" in core. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: Add quirk for no PM for S2 LoaderViresh Kumar2016-07-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | S2 Loader doesn't support runtime PM operations currently and we will fail to suspend/resume the bundle for firmware management protocols. Once that happens, the bundle and its connections will be pretty much useless as we would have tried to disable/enable all connections during such an operation and the S2 loader doesn't expect the connections to go away during normal operation (except in the case of mode-switch). This patch defines a new quirk GB_INTERFACE_QUIRK_NO_PM and uses a new interface init status value (GB_INIT_S2_LOADER_INITIALIZED) which will be advertised by S2 Loader now in the init status. After detecting the currently running stage as S2 Loader, the kernel wouldn't attempt suspending or resuming the bundle. Reviewed-by: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: Rename *_NO_PM as *_NO_BUNDLE_ACTIVATEViresh Kumar2016-07-261-1/+1
| | | | | | | | | | | | | | | Its a special quirk just for the bootrom as it doesn't have any PM operations implemented. As the greybus bootrom bundle driver doesn't try to do any PM stuff, this quirk is used only to skip bundle activate operation currently. Rename the GB_INTERFACE_QUIRK_NO_PM quirk to GB_INTERFACE_QUIRK_NO_BUNDLE_ACTIVATE to suit its purpose better as the GB_INTERFACE_QUIRK_NO_PM will be used for other quirk now. Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: control: suppress bundle_activate() for bootromJohan Hovold2016-07-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | We always knew backward compatibility with the ES3 bootrom, which was finalised about a year ago, would be a pain. Here we go again. The bootrom does not support control requests added after it was burnt into ROM for obvious reasons. This means that we need to suppress sending the new bundle_activate() operation to any interface executing the legacy bootrom. Do so by adding a new NO_PM interface quirk (we can use the control-protocol version for this later once we bump it). Note that the interface-disable path (e.g. for power down) is already handled by the FORCED_DISABLE quirk, and that the suspend/resume paths are currently avoided by making sure that the bootrom bundle never suspends. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: fix interface_id attribute groupJohan Hovold2016-07-211-1/+1
| | | | | | | | | | | | | | | | | | All interfaces, regardless of type, should have an interface_id attribute reflecting its position on the frame. This has been reported to cause an assertion failure in libmoduleutil for dummy modules. Testing done: Verified that the attribute is present for registered dummy interfaces. Reported-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com> Tested-by: Gjorgji Rosikopulos <grosikopulos@mm-sol.com> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> 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: interface: hibernate UniPro link in activation error pathJohan Hovold2016-07-201-2/+9
| | | | | | | | | | | | | To be well-behaved, we should hibernate the link before disabling UniPro in case the link has already been established (i.e. when the interface type has been detected as UniPro or Greybus). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: add power_state attributeViresh Kumar2016-07-201-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User space needs the capability of powering ON or OFF an Interface for multiple use cases. For example, userspace may want an Interface currently in its S3 boot stage, to boot into its S2 Loader stage to update the bridge SPI flash. Or the Interface is running its S2 Loader stage and updated the SPI flash with the new S2 Loader firmware and wants to boot into the new S2 Loader firmware. Another use case can be, Android wants to disable (not eject) a misbehaving module. Add a 'power_state' sysfs file within the interface directory. It can be read to know the current power state of the Interface and can be written to power ON or power OFF an Interface. Possible values that can be written or read from it are: "on" and "off". Testing Done: Tested by enabling/disabling camera module on EVT 2.0. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> CC: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> [johan: drop es3-quirk duplication, add to power attribute group, fix return value, drop tags ] Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: prevent reactivation during removalJohan Hovold2016-07-201-1/+1
| | | | | | | | | | | | | | | | | Make sure to prevent an interface that is going away from being reactivated. This is needed to preemptively close a race between the upcoming feature to reactivate a powered-down interface and physical removal (i.e. module_removed event processing) as well as logical removal (e.g. the current system-suspend hack). Reviewed-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: make sure type is invariant during reactivationJohan Hovold2016-07-201-20/+55
| | | | | | | | | | | | | | | | | | An interface is not expected to change its type after a power down and reactivation so make sure to treat that as a fatal error. This is complicated by the current Toshiba ES3 hack which requires us to retry activation as Greybus interfaces are sometimes misdetected as UniPro interfaces. Handle that by only retrying activation the first time an interface is activated, and for interfaces already detected as having Greybus type. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: clean up ES3 activation-retry hackJohan Hovold2016-07-201-8/+32
| | | | | | | | | | | | | | | Clean up the ES3 activation retry-hack and isolate it in the interface code. This way the retry hack can be reused when we soon start allowing interfaces to be reactivated after having been powered down. Reviewed-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: do not read DME during reactivationJohan Hovold2016-07-201-1/+11
| | | | | | | | | | | | | | It will soon be possible to reactivate an interface that has been powered down after already having been activated. In that case there's no need to re-read the DME attributes as part of activation as the values are already cached. Reviewed-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: use an enum for interface typeJohan Hovold2016-07-201-14/+18
| | | | | | | | | | | | | Use an enum for the interface type instead of using the SVC protocol values directly. Suggested-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Reviewed-by: Patrick Titiano <ptitiano@baylibre.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: amend interface registration messageJohan Hovold2016-07-191-5/+14
| | | | | | | | | | | | Amend the interface registration message with the detected interface type, and only print the Ara VID/PID and DDBL1 attributes for the types for which they exist. Also drop the now redundant message about a detected dummy interface from the activate operation helper. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: make attributes type dependentJohan Hovold2016-07-191-0/+47
| | | | | | | | | | | | Make most interface attributes type dependent (e.g only UniPro and Greybus interfaces should have a DDBL1 Manufacturer ID attribute). Note that the power attributes (e.g. current_now) will only be visible for UniPro- and Greybus-type interfaces (i.e. interfaces that can draw power). Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: partition attribute groupJohan Hovold2016-07-191-3/+38
| | | | | | | | | | | Partition the current attribute group into four groups for UniPro, Greybus, power and common attributes. This is a step in refining the interface-type handling as attributes are type dependent. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: add interface-type attributeJohan Hovold2016-07-191-0/+25
| | | | | | | | | | | Add an interface-type string attribute that represents the detected interface type as either "dummy", "unipro", "greybus", or "unknown". Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Sandeep Patil <sspatil@google.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: timesync/pm: Make synchronous call to restore FrameTimeBryan O'Donoghue2016-07-161-0/+6
| | | | | | | | | | | | | | | When we discussed and agreed a serialized way to-do PM runtime suspend/resume we omitted the necessity to restore the FrameTime on resume. This patch restores the FrameTime synchronously such that when an Interface PM resume callback completes we have either successfully restored the FrameTime including the new Interface or we've produced a result code to indicate what went wrong when trying. Suggested-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Tested-by: David Lin <dtwlin@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: add runtime pm supportDavid Lin2016-07-141-0/+109
| | | | | | | | | | | | | | | | | Configure and enable runtime pm support for the Interface. Refer to the 12.2. The Interface Lifecycle of the Greybus specification for details on the requirements for transitioning from ENUMERATED to SUSPEND and vice versa. All the Bundles for the Interface have to be either OFF or SUSPENDED before the Interface can be autosuspended. Testing Done: - Check the runtime_status of an interface driver and validate the suspend current of a module. Signed-off-by: David Lin <dtwlin@google.com> Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
* greybus: interface: send deactivate prepare when interface is disabledDavid Lin2016-07-081-0/+3
| | | | | | | | | | | | The AP Interface shall exchange a Greybus Control Interface Deactivate Prepare Operation with the Interface being powered down. Testing Done: - Check for the return code after sending the deactivate prepare operation Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
* greybus: interface: implement unipro link hibernate callDavid Lin2016-07-081-4/+2
| | | | | | | | | | Adds AP implementation of unipro link hibernation set power mode call needed for proper cport closure and interface suspend and power off transition. Signed-off-by: David Lin <dtwlin@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Alex Elder <elder@linaro.org>
* greybus: timesync: Enforce TimeSync locks as subordinate to Interface locksBryan O'Donoghue2016-06-231-41/+9
| | | | | | | | | | | | | | | | gb_timesync_svc_teardown() is called from gb_timesync_svc_del() and issues a command to a remote Interface to switch off its timers. The lock ordering is TimeSync => Interface in this case. However gb_module_del() takes an Interface lock then calls gb_interface_del() => gb_timesync_svc_del() in this case the lock ordering is Interface => TimeSync. This patch fixes by removing the taking of the Interface mutex in gb_interface_timesync_do_something(). If an Interface is present in the TimeSync linked-list - it is by definition intf->enabled. Reported-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: timesync: Bind TimeSync into GreybusBryan O'Donoghue2016-06-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | TimeSync needs to bind into Greybus in a few places. - core.c To initialize its internal state and tear-down its internal state. To schedule a timesync to a newly added Bundle after probe() completes. - svc.c To get access to the SVC and enable/disable timesync as well as extracting the authoritative time from the SVC to subsequently disseminate to other entities in the system. - interface.c To get access to an Interface in order to inform APBx of timesync enable/disable and authoritative operations. This patch adds those bindings into Greybus core. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org> Acked-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: timesync: Add timesync core driverBryan O'Donoghue2016-06-061-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the core timesync functionality. 0. arche-platform.c/arche-apb-ctrl.c Modifies the platform layer to hook the incoming TIME_SYNC signal up to the timesync strobe IRQ handler. If the arche-platform driver can't satisfy the request for the wake-detect line, it will return -EAGAIN and the calling work-queue must reschedule the attempt to get exclusive access to the wake-detect pin logic. A private data field is added to the arche-platform driver to enable passing of a timesync pointer to the ISR responsible for synchronizing time. 1. timesync.c A new file added which contains all of the logic associated with sending greybus commands to SVC, APBx or Interfaces to enable, disable and disseminate timing information. 2. timesync_platform.c Any platform/arch specific code goes into timesync_platform.c. Originally the idea was to keep the x86 and ARM arch dependencies in a timesync_platform_arch.c file - however with further refinement that's currently not necessary however just-in-case it becomes necessary to resuscitate arch or platform specific methods for accessing timer resources that access shouldn't be part of the core timesync.c logic and so for the moment we access these timer resources through a thin access layer in timesync_platform.c. Expect this to go away long term ideally. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Acked-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: Mode switch takes over a secondViresh Kumar2016-06-021-1/+1
| | | | | | | | | | | | | | | | | | | Mode switch takes just over a second to complete and the current timeout of one second isn't sufficient. Mode-switch logs from EVT 1.5: [ 56.709082] gb-firmware 1-3.3.1: Requested firmware package 'ara_00000126_00001002_fffe0001_ff980067_03.tftf' [ 57.003968] gb_control_mode_switch_operation: 176 [ 58.041616] greybus 1-3.3: mode switch detected Increase the timeout to two seconds. Tested with EVT 1.5 with gpbridge-test module. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Tested-by: Karthik Ravi Shankar <karthikrs@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: implement generic mode-switch functionalityJohan Hovold2016-05-271-2/+178
| | | | | | | | | | | | | | | | | | | | | | 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: interface: avoid I/O to bootrom during removalJohan Hovold2016-05-271-2/+6
| | | | | | | | | | | | Add an interface quirk flag to suppress I/O during interface disable. This is needed to prevent I/O to the bootrom during controlled connection tear down (e.g. eject or driver unbind). This will be more obvious with the new connection tear-down procedure. 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: interface: clean up bootrom quirk handlingJohan Hovold2016-05-271-4/+7
| | | | | | | | | Clean up bootrom quirk handling in preparation for addition of further flags. 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-7/+0
| | | | | | | | | | | | | | | | | | | | | | 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: tracing: define interface tracesAlex Elder2016-05-261-0/+17
| | | | | | | | | | | | | Define a new gb_module trace point event class, used to trace events associated with the interface abstraction. Define four basic trace points for this--creation time, drop of last reference, before registring interfaces and after de-registering them. In addition, define traces for activating and deactivating, and enabling and disabling an interface. Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: fix svc-resource error messagesJohan Hovold2016-05-261-3/+3
| | | | | | | | | | The interface svc-resource helper are used to enable as well as disable the corresponding SVC resources so make sure the error messages reflect that. 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: gpbridge: rename 'gpbridge' to 'gbphy' everywhereSandeep Patil2016-05-191-1/+1
| | | | | | | | | | | | | | The 'gpbridge' name didn't relaly reflect what the bus is; which is a bus for bridged-phy devices. So, rename all instances of 'gpbridge' to more appropriate 'gbphy' Testing Done: Build and boot tested. 'lsgb' will stop displaying 'GPBridge' devices until I change the library to reflect this change. Signed-off-by: Sandeep Patil <patil_sandeep@projectara.com> Suggested-by: Greg Kroah-Hartman <gregkh@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: retry enumeration of UniPro-only modulesJeffrey Carlyle2016-05-181-1/+2
| | | | | | | | | | | | | | | Greybus modules will sometimes fail to send the mailbox poke and erroneously be enumerated as UniPro-only modules. The root cause for this on the module side is not fully understand, but it seems that this may be due to "the bootrom bug:" a known problem with the bootrom where linkup will occasionally fail because of a race condition. Before the new hotplug code was implemented in the firmware, the SVC would retry enumeration of modules that did not send the mailbox poke; this patch ports that functionality to the AP. Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: remove unused interface-version quirkJohan Hovold2016-05-131-4/+1
| | | | | | | | | The interface-version request was just removed so remove the now unused interface-version quirk. 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: interface: fix type in enable error messageJohan Hovold2016-05-131-1/+1
| | | | | | | | Fix type of PTR_ERR in an interface-enable error message. 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: Revert "interface: Fetch and expose version of interface's firmware"Viresh Kumar2016-05-051-15/+0
| | | | | | | | | | | | | | | | | This reverts commit b957ade7b3e4ab8c149c53346dbf02e977b7f3a7. The interface version is now managed as part of the firmware-management protocol. This operation is already removed from the greybus specifications. Drop interface version support from greybus. Tested with gbsim (sysfs file not available after this patch). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Acked-by: Sandeep Patil <sspatil@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: fix broken UniPro flow controlJohan Hovold2016-04-281-0/+3
| | | | | | | | | | | | | | A recent commit inadvertently disabled E2EFC on all interface connections, due to a failure to clear the ES3 bootrom quirk flags during mode switch. Testing Done: Verified that the CPort flags are again set to 0x7 for non-bootrom interface connections. Fixes: 5b638080e94e ("svc: keep interfaces registered during mode switch") Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: implement interface activation and power downJohan Hovold2016-04-251-2/+122
| | | | | | | | | | | | | | | Implement the interface activation and power-down sequences. Note that all the required SVC operations have not yet been implemented so some stub functions are used for now. Support for hibernating the UniPro link depends on future power-management work so a stub function is used also for this. Interface type handling will be refined later. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: interface: add active state flagJohan Hovold2016-04-251-0/+7
| | | | | | | | Add active state flag to avoid deactivating an interface which is already off. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: module: implement controlled module removalJohan Hovold2016-04-251-1/+21
| | | | | | | | | | | | | | | | | | | Implement controlled module removal through a new module attribute "eject". When a non-zero argument is written to the attribute, all interfaces of the module are disabled (e.g. bundles are deregistered) and deactivated (e.g. powered off) before instructing the SVC to physically eject the module. Note that the module device is not deregistered until the SVC has reported the physical removal of all of its interfaces. A new interface mutex is added to enforce interface state-change serialisation. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: core: add module abstractionJohan Hovold2016-04-251-28/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Greybus module abstraction that will be used to implement controlled module removal (eject) and represent module geometry. Greybus module devices correspond to physical modules and have one or more interfaces. Modules have an id that is identical to the id of their primary interface, which in turn is the interface with lowest numbered id. The module name is constructed from the bus and module id: <bus_id>-<module_id> Interfaces, bundles, and control devices are consequently renamed as <bus_id>-<module_id>.<interface_id> <bus_id>-<module_id>.<interface_id>.<bundle_id> <bus_id>-<module_id>.<interface_id>.ctrl As before, interface ids (and therefore in a sense now also module ids) correspond to physical interface positions on the frame. Modules have the following attributes: module_id num_interfaces where module_id is the id of the module and num_interface the number of interfaces the module has. Note that until SVC module-size detection has been implemented, all interfaces are considered to be part of 1x2 modules. Specifically, the two interfaces of a 2x2 module will be presented as two 1x2 modules for now. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
* greybus: svc: keep interfaces registered during mode switchJohan Hovold2016-04-211-15/+17
| | | | | | | | | | | | | Keep a detected interface registered until it is physically removed. Specifically, do not re-register an interface that is switching mode. Note that this also allows us to get rid of some nasty hacks from core. The Ara VID/PID bootrom hack for ES2 will continue to work, but is now mostly confined to the bootrom driver. 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: interface: reduce control-device lifetimeJohan Hovold2016-04-211-12/+22
| | | | | | | | | | | | Make the control-device lifetime coincide with when the interface is enabled (enumerated). This is needed to be able register a new control device after a mode switch. 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: control: return error pointer when failing to create control deviceJohan Hovold2016-04-211-2/+4
| | | | | | | | Return an error pointer when failing to create a control device. 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>
OpenPOWER on IntegriCloud