IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
We don't need to dynamically allocate the i2c adapter structure, we
can just embed it right in struct gb_i2c_device.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This field is never used (and not needed) so get rid of it.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
An operation is what can timeout, not a connection itself. So notify
the operation timedout, and the connection can then do with it as it
sees fit, if necessary.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
We can't do anything if killing a gbuf fails, so just make this function
"always" be successful.
At the same time, make the host controller function also be called
"kill_gbuf" to keep the terminology in sync.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
When registering a host controller, verify that all of the needed
callbacks are present, so we don't have to do the testing on any "hot"
paths when we want to send real data.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org.
Hook up gbuf_kill_gbuf() by implementing yet-another-host-controller
callback and a gbuf-specific pointer to hold the tracking data the hcd
needs in order to be able to abort a transfer.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
If we somehow get a hotplug event for a module id that we already have
created[1], don't try to create it again, or sysfs will complain loudly.
Instead, abort the creation properly.
[1] If, for example, you happened to run a script on a greybus emulator
twice in a row...
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
We were thinking that module attributes were known at the time the
device was created in the system, so we could query them to know if the
sysfs file was present or not. Unfortunatly that's not the case, we
create the device before we parse the values, so just always show the
sysfs attributes. If there is no such attribute, the sysfs file will be
empty (i.e. for the string attributes.)
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
I screwed up the error handling in a patch the other day. If we get
an error on an input URB we should not re-submit it.
Signed-off-by: Alex Elder <elder@linaro.org>
This patch hooks up modules, interfaces, and connections to the driver
model. Now we have a correct hierarchy, and drivers can be correctly
bound to the proper portions in the future. Devices are correctly
reference counted and torn down in the proper order on removal of a
module.
Some basic sysfs attributes have been created for interfaces and
connections. Module attributes are not working properly, but that will
be fixed in future changes.
This has been tested on Alex's machine, with multiple hotplug and unplug
operations of a module working correctly.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename and renumber the values for the AP ID service message
and related symbols to match the recently-updated spec.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
The route for a connection needs to be set *before* we initialize
the connection.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
We removed the DDB function messages from the spec as they are
not needed. Now remove it from the code.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Rather than bringing up all interfaces described in the manifest,
wait until we get a link up message, and at that time go initialize
the link.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Give svc_set_route_send() non-private scope so it can be used by a
function outside "ap.c" in the next patch. Change its type so it
can tell its caller if an error occurs.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Define the state of a connection. A connection will not be
enabled until it has been successfully set up. Once it starts
getting torn down its state will move to "being destroyed".
Don't send any operation request messages unless the connection is
enabled. And drop any incoming messages if if the connection is
not enabled.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Define a new function operation_cancel() that cancels an
outstanding operation. Use it to clear out any operations that
might be pending at the time a connection is torn down.
Note: This code isn't really functional yet, partially because
greybus_kill_gbuf() is not implemented.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Arrange for operation requests that takke too long to time out.
At the moment, nothing happens when that occurs (other than a silly
message getting printed). When the connection and operation and
interface and module code are cleaned up properly, this event should
most likely cause the affected module to get torn down.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
When the AP receives a link up event, request that the SVC set a
route to the interface's device id (this device id has been
previously reported to the AP). In the future, we may not always
immediately set a route upon receiving a link up event but this
is sufficient for the known use cases at this time.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
CPort connections are being handled in the application layer connection
protocol and the layer 3 switch doesn't care about them. Also, the
switch doesn't care about a source device id when setting up the route
table. Reduce the message to just the necessary destination device ID.
As the SVC is aware of which switch port it found the module/interface
and assigned the device ID, we can simply tell the SVC to set a route
to the device ID it has reported to the AP as being active.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
The link up message is the event that tells the AP what device ID
has been assigned to a particular interface on a module during
enumeration. The link up is sent *only* after the hotplug event
for a particular module has been sent to the AP.
The link up payload must carry the Module ID and Interface ID
to uniquely identify the struct gb_interface to which the
Device ID has been assigned.
After processing of the link up message, the interface's device_id
field will contain the assigned Device ID so that the AP has the
information necessary to issue network route commands.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Add support for getting a struct gb_interface from an
Interface ID.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Add support for getting a struct gb_module from a
Module ID.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
We can't know that the greybus values and the kernel values for a number
of battery enumerated types will remain in sync. And as theses are sent
by an external device from the kernel, we have to explicitly check these
values.
Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
The AP needs to know its assigned Device ID in order to establish
Greybus connections between CPorts. We could have pulled the Device
ID from the controller hardware in a driver specific manner, but
instead we define one generic message from the SVC to let the
AP know this information. Add this additional unipro management
message and handle it by setting the supplied Device ID in the
struct greybus_host_device. The greybus core will use this to
populate the source Device ID when establishing a connection
between the AP and another module's CPort.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
When a module gets destroyed all of its state and the state of its
interfaces and connections (etc.) need to be torn down. This is
not now being done properly. Add this teardown code.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
The battery code was not stashing a copy of its private data
pointer. It'll be needed in the next patch.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
The function that computes the operation id for a connection is
wrongly using MOD rather than AND. Fix that.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This adds support to talk to the battery to get the various requests
made to it, based on the battery protocol defined in the Greybus
Specification.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
With a few minor changes, ap_disconnect() can correctly handle
cleaning up even a partially initialized USB interface. Make those
changes, and then use ap_disconnect() to simplify cleanup for all
the error paths in ap_probe(). Reset all fields as they're cleaned
up to facilitate debugging.
Signed-off-by: Alex Elder <elder@linaro.org>
The next patch has ap_probe() reference ap_disconnect(). To prepare
for that, move ap_disconnect() up in the file.
This is done as a separate commit to make it easier to see this move
involves no other change to that function. This and the next commit
can be squashed if desired.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
We no longer keep copies of strings found in the manifuest in
a module's strings array, so we can get rid of the strings array.
Similarly, the new manifest parsing code sets up connections for
each cport id advertised for a module, so the cport array is
no longer needed either.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
A struct gb_module has a bunch of fields from the earlier skeleton
code, where a module was assumed to possibly have one of every
type of device available on the GP Bridge. The manifest parsing
code changed it so these things will be related to connection
endpoints, so these gb_module fields are no longer needed.
A few of these (battery and sdio) haven't been implemented the "new
way" yet, so just leave a bit of the code that was there commented
out for now.
Also, gb_tty seems to be partially implemented and I don't want to
remove that without knowing where it's headed, so that one stays.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Everything we do on greybus will involve an operation, so create a
slab cache for that frequently-allocated data structure.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Drop the USB device reference taken at the top of ap_probe() in the
event greybus_create_hd() fails.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
core_param() takes four parameters instead of three and so results in this
compilation error:
greybus/core.c:25:33: error: macro "core_param" requires 4 arguments, but only 3 given
core_param(nogreybus, bool, 0444);
^
Fix this by adding proper arguments to it.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Offset (or hwgpio num) is the offset within a gpiochip, not the
unique gpio namespace number. Adjust the error checking and use
of offset in our operation calls to fix this.
Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
probably a cut and paste error got this unused status field. remove it.
Signed-off-by: Matt Porter <mporter@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
GPIO remove changed the api for 3.17 to try to make up for some
previously foolish design decisions. Handle that in kernel_ver.h to
make the code simple.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>