Johan Hovold [Wed, 1 Jul 2015 10:37:29 +0000 (12:37 +0200)]
greybus: operation: drop redundant oom message
Drop redundant OOM message, which would already have been logged by the
memory subsystem.
Also remove a FIXME about possibly sending a pre-allocated response,
which is neither possible or desirable. If we ever run out of memory we
have bigger problems then getting a response back to firmware.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Johan Hovold [Wed, 1 Jul 2015 10:37:26 +0000 (12:37 +0200)]
greybus: operation: add incoming-operation flag
Add flag field to struct gb_operation, and a first flag
GB_OPERATION_FLAG_INCOMING to identify incoming operations.
Pass an initial set of flags when allocating new operations, and use
these to identify incoming operations rather than overloading the
meaning of GB_OPERATION_TYPE_INVALID. This also allows us to set the
type for all operations during allocation.
Also add convenience helper to identify incoming operations.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The final reference of an operation will be put after its completion
handler has run, so we must not drop the reference if it has already
been scheduled to avoid use-after-free.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Johan Hovold [Wed, 1 Jul 2015 10:37:24 +0000 (12:37 +0200)]
greybus: operation: make response helper static
Since commit 46ce118a2678 ("operation: refactor response handling")
sending operation responses is handled by greybus core so there is
currently no need to export the response helper.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The current host-controller message-cancellation implementation suffer
from a lifetime bug as dynamically allocated URBs would complete and be
deallocated while being unlinked as part of cancellation.
The current locking is also insufficient to prevent the related race
where the URB is deallocated before being unlinked.
Fix this by pushing the cancellation implementation from greybus core
down to the host-controller drivers, and replace the "cookie" pointer
with a hcpriv field that those drivers can use to maintain their state
with the required locking and reference counting in place.
Specifically the drivers need to acquire a reference to the URB under a
lock before calling usb_kill_urb as part of cancellation.
Note that this also removes the insufficient gb_message_mutex, which
also effectively prevented us from implementing support for submissions
from atomic context.
Instead the host-controller drivers must now explicitly make sure that
the pre-allocated URBs are not reused while cancellation is in progress.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The responsibility of this routine is to configure ARA switch to
establish a connection between a cport on the AP and a cport on an
interface.
The SVC protocol is responsible for such requests and we already have
connection_{create|destroy}_operation() to take care of this.
Moreover, this request is not served by the firmware or gbsim today and
they just print a debug message on this request. And so it is safe to
drop svc_set_route_send() function and fix the required functionality of
configuring the switch in svc protocol driver later.
greybus: connection: intf_cport_id is local to an interface
intf_cport_id is local to an interface and same intf_cport_id can be
used for two separate interface blocks. For finding a connection for an
interface, we are matching intf_cport_id of the connection with
cport_id, passed as argument. This is wrong, as it can match for a
connection on a different interface block.
Fix it by also comparing interface block for which connection is
requested.
greybus: connection: bind protocol after the connection is operational
We may bind protocol with a connection from gb_connection_create(), if
bundle's device_id is already set. That's not the case until now.
But if the protocol is initialized with a call to
protocol->connection_init() from this place, kernel will crash.
This will happen because the connection isn't fully initialized yet, for
example its operation list isn't initialized yet. And as soon as the
protocol driver tries to send a request to the module from its
connection_init() callback, we will add an operation to this
uninitialized list. And it will crash while doing:
prev->next = new;
Try to bind the connection with a protocol only after the connection is
ready for operations.
Bryan O'Donoghue [Mon, 29 Jun 2015 17:09:15 +0000 (18:09 +0100)]
greybus: uart: Update UART to reflect field size changes
The greybus UART protocol specification was updated to reduce the size of
the control field in serial-state-request and line-state-request. This
patch updates the kernel protocol driver to reflect the specification
changes. Once applied gbsim changes will be also be updated automatically
since gbsim depends on the header being modified directly.
Bryan O'Donoghue [Mon, 29 Jun 2015 17:09:14 +0000 (18:09 +0100)]
greybus: uart: Add support for UART error signals
After reviewing the UART specification for greybus break, parity, framing
and over-run errors were moved to the receive-data message. This patch
implements that specification change in the UART protocol driver. Matching
code in gbsim has been tested with this change.
Parity/overrun/framing and break signals have been moved to the
receive-data message to more easily associate the signals with the TTY API.
Update the definitions in the protocol header and add a flags field to the
receive-data structure to facilitate transmission of those signal with the
receive-data message.
Mark Greer [Fri, 26 Jun 2015 23:38:46 +0000 (16:38 -0700)]
greybus: gb-audio: Ensure i2c adapter struct exists before using
The current audio code uses i2c_get_adapter() without checking
that a non-NULL pointer is returned (i.e., that the i2c device
actually exists). When that happens, the system panics.
Fix the potential panic by erroring out with -ENODEV when
i2c_get_adapter() returns NULL.
CC: John Stultz <john.stultz@linaro.com> Signed-off-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Johan Hovold [Tue, 23 Jun 2015 12:17:41 +0000 (14:17 +0200)]
greybus: esx: fix null-deref on hotplug events
We must be prepared to receive hotplug events as soon as we submit the
SVC URB. Since commit 2eb8a6a947d7 ("core: don't set up endo until host
device is initialized") this is no longer the case as the endo would not
have been setup, something which may lead to a null-pointer dereference
in endo_get_module_id() when the interface is created (see oops below
with an added dev_dbg for hd->endo).
Fix this by setting up the endo before submitting the SVC URB.
Rui Miguel Silva [Wed, 24 Jun 2015 22:20:26 +0000 (23:20 +0100)]
greybus: sdio: fix defines for older kernels
Some of the options for mmc host, are not defined in older kernels.
MMC_CAP2_HS400_1_2V, MMC_CAP2_HS400_1_8V, MMC_TIMING_MMC_DDR52 and
MMC_TIMING_MMC_HS400.
To not use them for older versions.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Tested-by: Mark Greer <mgreer@animalcreek.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Viresh Kumar [Mon, 22 Jun 2015 11:12:30 +0000 (16:42 +0530)]
greybus: control: Warn if non-control cport/bundles have control protocol/classes
It is possible that (by mistake) the manifest contains non-control
cports with their protocol set as control-protocol or non-control bundle
with their class set as control-class.
Catch such cases, WARN for them and finally ignore them.
Also WARN if the control cport doesn't have its protocol as
control-protocol and control bundle doesn't have its class as
control-class.
Viresh Kumar [Mon, 22 Jun 2015 11:12:27 +0000 (16:42 +0530)]
greybus: interface: Get manifest using Control protocol
Control protocol is ready to be used for fetching manifest. Lets do it.
This changes few things:
- Creates/initializes bundle/connection for control protocol initially
and skips doing the same later.
- Manifest is parsed at link-up now, instead of hotplug which was the
case earlier. This is because we need device_id (provided during
link-up) for registering bundle.
- Manifest is fetched using control protocol.
Viresh Kumar [Mon, 22 Jun 2015 11:12:26 +0000 (16:42 +0530)]
greybus: Add control protocol support
Add control protocol driver that is responsible for handling operations
on control CPort. The AP also needs to support incoming requests on its
control port. Features not implemented yet are marked as TODO for now.
NOTE: This also fixes cport-bundle-id to 0 and cport-id to 2 for control
protocol.
Viresh Kumar [Mon, 22 Jun 2015 11:06:47 +0000 (16:36 +0530)]
greybus: manifest: Allow bundles/connections list to be non-empty at manifest parsing
A connection and a bundle will be created for interfaces at the very
beginning for control protocol's functioning. And so the list of bundles
and connections for a interface will be non-empty by the time manifest
is parsed.
Currently we are firing a WARN when these lists are found to be
non-empty. Lets fix that to contain single bundle and connection for
control protocol.
Rui Miguel Silva [Mon, 22 Jun 2015 13:03:52 +0000 (14:03 +0100)]
greybus: sdio: extend sdio implementation
Extend sdio implementation, as it for now it was basically stubs.
This implementation is compile tested only since there is no fw or
simulation support yet.
Next step is to add sdio support to gbsim and test it with success
using the mmc_test facility.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alexandre Bailon [Mon, 15 Jun 2015 16:08:14 +0000 (18:08 +0200)]
greybus: es2.c: add a control request for endpoints mapping
ES2 give us more endpoints. Use them to map one cport to two endpoints
(in and out). Because there is more cports than endpoints, we still
need to mux other cports traffic on 2 endpoints.
Firmware currently assumes these endpoints are 2 and 3.
By default, all cports are muxed.
To map one cport to 2 endpoints, use map_cport_to_ep().
Alexandre Bailon [Mon, 15 Jun 2015 16:08:12 +0000 (18:08 +0200)]
greybus: es2.c: create dedicated struct for cport_in and cport_out
Instead of keep cport buffers, urbs and endpoints in es1_ap_dev,
move them in two dedicated struct (es1_cport_in and es1_cport_out),
in order to ease the migration to es2 (increase the number of endpoint).
Alex Elder [Sat, 13 Jun 2015 16:02:11 +0000 (11:02 -0500)]
greybus: esX: use one byte to encode cport ids in header
We now limit the maximum value for both host and module CPort ids,
and we know they can always be represented in a single byte.
Make use of this by using only one of the two pad bytes for encoding
the CPort id in a message header.
(Note that we have never used a CPort higher than 255. Encoding
such a small CPort id in little endian 2-byte format has the same
result as what is done here.)
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Sat, 13 Jun 2015 16:02:10 +0000 (11:02 -0500)]
greybus: reserve host cport id 0
For ES1 and ES2, we use pad bytes in an operation message header to
encode the CPort ID used for transferring the message. The pad
bytes should otherwise be zero, and we ensure this as the message
is passed to or from the upper layer.
If host-side CPort ID 0 is used, we have no way of knowing whether
the CPort field has been "packed" into the header.
To allow detection of this, reserve host CPort id 0. Update
cport_id_valid() to treat 0 as invalid.
(CPort ID 0 is reserved by one of the UniPro standards. We'll
assume for now that we never use it for Greybus.)
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Sat, 13 Jun 2015 16:02:09 +0000 (11:02 -0500)]
greybus: rename HOST_DEV_CPORT_ID_MAX
We limit the number of host-side CPorts to a fixed maximum (which
is less than the 4096 that UniPro allows). This patch imposes a
similar limit on the CPort IDs defined by modules (signaling an
error if one too large is found in a manifest).
It seems reasonable to use the same value for both limits. Change
the name of the constant that defines the host limit and use it for
both. Update cport_id_valid() to enforce the maximum.
(Ultimately we should impose a limit like this; this change is being
made in preparation for supporting multiple connections over a
single CPort.)
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Sat, 13 Jun 2015 16:02:08 +0000 (11:02 -0500)]
greybus: esX: encapsulate packing cport id into header
For the ES1 and ES2 host interfaces we encode the CPort ID over
which the message should be sent within the message itself. The
CPort ID is recorded in unused pad bytes found in the operation
message header in order to avoid introducing misaligned messages.
This patch defines some helper routines to abstract this activity.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Sat, 13 Jun 2015 16:02:07 +0000 (11:02 -0500)]
greybus: introduce cport_id_valid()
Define a public predicate that defines whether a CPort ID is valid.
Use it in the message_send() routine, and make the message reported
more accurately reflect the error. Also use it to check whether the
CPort ID in a received message is valid; if it is not, just drop the
message.
Get rid of local variable "buffer" in message_send(); it adds no
value.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Fri, 12 Jun 2015 15:21:12 +0000 (10:21 -0500)]
greybus: manifest: clean up properly when parsing bundles
Currently, if an error occurs creating a bundle, we simply
return an error without cleaning up any of the bundles that
had already been successfully set up.
Add code to destroy bundles that have been created in the event
an error occurs. Add a check to ensure the interface's list of
bundles was empty before parsing for bundles begins.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Fri, 12 Jun 2015 15:21:11 +0000 (10:21 -0500)]
greybus: bundle: fix gb_bundle_destroy()
Currently gb_bundle_destroy() takes an interface as an argument,
and really doesn't do what a function by that name should do.
What it now does is delete all bundles associated with a given
interface. What it should do is destroy a single bundle.
Move the looping logic out of gb_bundle_destroy() and into its
caller, gb_interface_destroy(). Pass each bundle in an interface to
gb_bundle_destroy(), which will do what's required to destroy a
single bundle (including removing it from its interface's bundle
list under protection of the lock).
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Fri, 12 Jun 2015 15:21:09 +0000 (10:21 -0500)]
greybus: manifest: clean up properly when parsing cports
Currently, if an error occurs creating a connection, we simply
return an error without cleaning up any of the connections that
had already been successfully set up.
Add code to destroy connections that have been created in the event
an error occurs. Add a check to ensure the bundle's list of
connections was empty before parsing for CPorts begins.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Fri, 12 Jun 2015 15:21:08 +0000 (10:21 -0500)]
greybus: connection: un-abstract host cport id allocation
I did this recently for the endo id allocation code.
It's clearer now that the allocation of a CPort ID to use for
the AP side of a connection is not very complicated, and it
happens in a pretty controlled environment. The functions that
abstract getting and releasing those ids don't really add that
much value.
This patch removes gb_connection_hd_cport_id_alloc() and
gb_connection_hd_cport_id_free(), and just open-codes their
activity in the few places they are called.
It is obvious now that the CPort ID allocation isn't done in
atomic context, so we can change the ida_simple_get() call to
use GFP_KERNEL.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Fri, 12 Jun 2015 15:21:07 +0000 (10:21 -0500)]
greybus: connection: drop unneeded gb_protocol_put() calls
Although a connection records its protocol id when it gets
created, its protocol handler doesn't actually get assigned
until gb_connection_bind_protocol() is called.
In gb_connection_create() there are some error paths in
which a reference to the connection's protocol is released
before the protocol handler has been associated with the
connection.
Get rid of those calls.
As a result, we will never pass a null protocol pointer to
gb_protocol_put(). Add a precautionary warning in that
function in the event that ever occurs.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Fri, 12 Jun 2015 15:21:06 +0000 (10:21 -0500)]
greybus: connection: remove extra kfree() call
When an error occurs in the device_add() call for a connection, the
device reference is dropped as required. Because that's the device's
only reference, that will also lead to gb_connection_release() being
called, which frees the connection structure.
Right now we're then making an extra request to free the connection,
which is wrong. Fix that.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Viresh Kumar [Thu, 11 Jun 2015 11:09:42 +0000 (16:39 +0530)]
greybus: endo: Fix compilation warning
WARNING: /home/viresh/work/repos/ara/greybus/greybus.o(.init.text+0xb8):
Section mismatch in reference from the function init_module() to the
function .exit.text:gb_endo_exit()
The function __init init_module() references
a function __exit gb_endo_exit().
Alex Elder [Tue, 9 Jun 2015 22:42:58 +0000 (17:42 -0500)]
greybus: connection: check for duplicate cport ids
Check at connection creation time for an attempt to create a
connection with an interface CPort ID that's the same as one that's
already been created.
Define a new helper function to look for such a duplicate. The
check for a duplicate is only performed at initialization time,
and CPorts are initialized serially for each bundle, so there's
no need to acquire the list lock for this search.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:56 +0000 (17:42 -0500)]
greybus: manifest: rework bundle parsing
Rework the the code that parses the manifest for bundles so it only
touches each manifest descriptor once. (Previously the list was
scanned from the beginning repeatedly until all bundles were found.)
Shorten the name of the descriptor variable, to avoid line wrap.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:55 +0000 (17:42 -0500)]
greybus: manifest: rework cport parsing
Rework the the code that parses the manifest for CPorts associated
with a bundle so it only touches each manifest descriptor once.
(Previously the list was scanned from the beginning repeatedly
until all bundle CPorts were found.) Shorten the name of the
descriptor variable, to avoid line wrap.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:54 +0000 (17:42 -0500)]
greybus: manifest: use bundle's embedded interface pointer
An initialized bundle structure contains a pointer to its
interface. Because of this there's no need to provide
the interface pointer to gb_manifest_parse_cports(). This
also precludes the possibility of passing a bad interface
pointer.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:53 +0000 (17:42 -0500)]
greybus: manifest: really minor cleanups
This patch incorporates some very small cleanups to "manifest.c":
- Rearrange code a bit in gb_manifest_parse() that ensures a
manifest is big enough to hold a header. If the manifest is
exactly the size of a header, the error reported will now be
"...must have 1 interface..." rather than "short manifest".
- Fix the function comment for gb_manifest_parse_cports().
- Use "an interface," not "a interface," and don't capitalize.
- Delete some braces when getting interface product string.
- A few other minor changes to comments and white space.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:52 +0000 (17:42 -0500)]
greybus: endo: clean up id assignment code
Recently code was added (back) to assign a unique id to each
endo, so satisfy uniqueness requirements of the Linux device
subsystem. An ID allocator is used to manage the space of IDs.
Now that we have gb_endo_init(), we can initialize the map there,
and fully hide the ID map within "endo.c".
The original functions gb_endo_id_alloc() and gb_endo_id_free()
provided a nice abstract interface, but the direct ID allocation
calls are quite simple, so just call them directly.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:51 +0000 (17:42 -0500)]
greybus: endo: define endo_init() and endo_exit()
Define init and exit functions to do one-time setup and teardown
of endo-related functionality. Currently they're place holders;
the next patch will populate them.
Note that we now call gb_operation_exit() from gb_init(), so
we can no longer mark that function with __exit.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:50 +0000 (17:42 -0500)]
greybus: tag core init and exit functions
The top-level functions gb_init() and gb_exit() are tagged with
__init and __exit, respectively. These functions call a few
other functions that are similarly used only at initialization
and termination time. So mark those functions accordingly.
Note that, because gb_ap_exit() and gb_debugfs_cleanup()
are called by gb_init() in error paths, these functions
cannot be declared with the __exit attribute.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Tue, 9 Jun 2015 22:42:49 +0000 (17:42 -0500)]
greybus: drop some unnecessary headers
There's no need to include anything other than "greybus.h" in
"connection.c". Same thing in "core.c" and "manifest.c" and
"svc.c". Some files need headers included, but most come along
with "greybus.h".
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Mark Greer [Tue, 9 Jun 2015 22:29:35 +0000 (15:29 -0700)]
greybus: gb-audio: Reset sample count when CPort deactivated
The sample count placed in Greybus I2S audio messages should be
reset every time a new audio stream is set up. However, the
current code does not do the reset so make it so it does.
Signed-off-by: Mark Greer <mgreer@animalcreek.com> Acked-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The firmware is having a hard time with 4k buffers and memory
allocation, so decrease the size on the host side to 2k. Also move away
from using PAGE_SIZE to denote 4k as that's not the case on all
architectures, and someone, someday, might get a rude surprise.
Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Viresh Kumar [Thu, 4 Jun 2015 12:46:45 +0000 (18:16 +0530)]
greybus: Tear down devices in the reverse order
Normally, its a good practice to free resources in the reverse order in
which they are allocated, so that all the dependencies can be sorted out
properly.
This is true while creating/destroying devices as well. For example
consider this scenario (I faced a crash with control protocol due to
this). For a new module, we will first create a bundle+connection for
the control cport and then create other bundles/connections after
parsing manifest.
And while destroying interface on module hot unplug, we are removing the
devices in the order they are added. And so the bundle/connection for
the control cport are destroyed first. But, control cport was still
required while destroying other bundles/connections.
To solve this problem, lets destroy the resources in the reverse order
in which they are added.
Alex Elder [Mon, 8 Jun 2015 17:05:14 +0000 (12:05 -0500)]
greybus: manifest: clean up a few pr_err() calls
Provide a little more information in two pr_err() calls.
Also enclose a reported condition in parentheses, to match
the style used everywhere else in the file.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Mon, 8 Jun 2015 17:05:13 +0000 (12:05 -0500)]
greybus: core: rename greybus_deregister()
Rename greybus_deregister() to be greybus_deregister_driver(), so
its name mirrors the greybus_register_driver() function it matches.
Define greybus_deregister() to be a trivial macro.
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Alex Elder [Mon, 8 Jun 2015 17:05:12 +0000 (12:05 -0500)]
greybus: uart: properly interpret receive data size
In gb_uart_request_recv(), the receive data size is in little-endian
format. Do the proper byte swapping of that value before using it.
Found by "make check".
Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Viresh Kumar [Thu, 4 Jun 2015 04:48:01 +0000 (10:18 +0530)]
greybus: s/bundle_cport_id/intf_cport_id
This isn't unique just for the bundle but the complete interface. Its
wrong to call it bundle_cport_id. Lets name it intf_cport_id to make
things clear.
greybus: uart: Add gb_uart_request_recv for receiving async UART data
gb_uart_request_recv job in life is to process unsolicited greybus
mesages from the UART.
Hook the incoming UART data and pass to the TTY layer.
Line-state changes still TBD.
greybus: uart: Update uart.c to register tty ports
For each new UART connection we need to do a tty_port_init else
we'll crash when trying to access the tty mutex later on.
Base the TTY major/minor numbers on non-zero values.
Supply an empty operations structure for the newly regitered port.
Arbitrary number 255 is both not aligned and probably too big.
Move the UART count down to 16 which is still large but, more realistic.
8 may be too few for future testing setups, 16 should accomodate any.
greybus: uart: Move UART protocol structs/defines to greybus_protocols.h
gbsim depends on the structures and defines in greybus_protocols.h
generally in order to simulate firmware. Move UART defines into this
header to facilitate.
Alex Elder [Wed, 27 May 2015 16:17:52 +0000 (11:17 -0500)]
greybus: endo: drop redundant prefixes from sysfs basenames
This commit: 7e761e2 endo: rework some attributes
added a new "endo_id" attribute, located under a new "Endo"
directory in sysfs. The resulting path looks like:
Documentation/sysfs/endo-TYPE/Endo/endo_id
There's no need to have a separate "Endo" subdirectory to contain
Endo-specific attributes.
That commit also added "svc_" to some other paths related to the
SVC, like:
Documentation/sysfs/endo-TYPE/SVC/svc_version
The additional "svc_" is redundant.
This patch retouches those paths a bit, mainly to remove some
redundancy. It also makes the pathname components all lower case.
As a result, the above two paths now look like:
Documentation/sysfs/endo-TYPE/id
Documentation/sysfs/endo-TYPE/svc/version