1
0
Fork 0
Commit Graph

24 Commits (579b9239c1f38665b21e8d0e6ee83ecc96dbd6bb)

Author SHA1 Message Date
Greg Kroah-Hartman 863dbc52e7 staging: greybus: Remove redundant license text
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>
2017-11-11 14:46:21 +01:00
Greg Kroah-Hartman eb50fd3a22 staging: greybus: add SPDX identifiers to all greybus driver files
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>
2017-11-11 14:46:20 +01:00
Johan Hovold b15d97d770 greybus: core: add module abstraction
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>
2016-04-25 11:08:30 -07:00
Johan Hovold 0f37860de9 greybus: kill the endo
Remove the now unused endo and module code.

Note that the never-implemented serial and version attributes of the
endo can be implemented as svc attributes if needed.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:35:59 -08:00
Johan Hovold 2537636aba greybus: hd: rename host-device structure
Rename host-device structure gb_host_device to match our other
structures.

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>
2015-11-04 20:25:57 -08:00
Viresh Kumar 51e93aea65 greybus: endo: Create modules after validating Endo ID
We already have code to parse Endo ID, lets use it to create modules at
run time instead of creating them from a static array.

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>
2015-05-11 13:30:09 -07:00
Greg Kroah-Hartman a4d9150cba greybus: endo: hook up endos into the device tree
This hooks up the endo, and modules, into the device tree.  All modules
for a specific endo are created when the host device is initialized.
When an interface is registered, the correct module for it is found and
that module is used for the sysfs tree.  When the interface is removed,
the reference on the module is dropped.

When the host device goes away, the whole endo and modules are removed
at once.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2015-04-09 22:50:09 +02:00
Viresh Kumar c9d9d0d443 greybus: interface: Fetch interface id instead of module id during setup
There can be more than one interface on a module and we need to know the
interface for which the event has occurred.

But at the same time we may not need the module id at all. During initial phase
when AP is probed, the AP will receive the unique Endo id which shall be enough
to draw relationships between interface and module ids.

Code for that isn't available today and so lets create another routine to get
module id (which needs to be fixed separately), which will simply return
interface id passed to it.

Now that we have interface id, update rest of the code to use it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-05 18:04:38 +02:00
Viresh Kumar 2352a73212 greybus: Unregister devices to get them freed
Devices registered with the device-core needs to be freed by calling
device_unregister(). For module we are calling just put_device() and for
bundle, connection and interface we are calling device_del().

All of these are incomplete and so none of them get freed, i.e. the
.release() routine is never called for their devices.

Module being a special case that it needs to maintain a refcount or a
list of interfaces to trace its usage count. I have chosen refcount.

And so once the refcount is zero, we can Unregister the device and
module will get free as well.

Because of this bug in freeing devices, their sysfs directories were not
getting removed properly and after a manifest is parsed with the help of
gbsim, removing modules was creating problems. The sysfs directory
'greybus' wasn't getting removed. And inserting the modules again
resulted in warnings and insmod failure.

WARNING: CPU: 3 PID: 4277 at
/build/buildd/linux-3.13.0/fs/sysfs/dir.c:486
sysfs_warn_dup+0x86/0xa0()

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-05 16:23:22 +02:00
Greg Kroah-Hartman e5646710c1 greybus: module: get rid of global list of modules
Use the list that the driver core keeps of our structure, no need to
duplicate it with a local list as well.  This gets rid of a static lock
too, always a nice thing to do.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2015-01-02 13:05:42 -08:00
Greg Kroah-Hartman df671553cb greybus: add module support
Modules in the greybus system sit above the interface, so insert them
early in the sysfs tree.  We dynamically create them when we have an
interface that references a module, as we don't get a "module create"
message directly.  They also dynamically go away when the last interface
associated with a module is removed.

Naming scheme for modules/interfaces/bundles/connections is bumped up by
one ':', and now looks like the following:

/sys/bus/greybus $ tree
.
├── devices
│   ├── 7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7
│   ├── 7:7 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7
│   ├── 7:7:0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7/7:7:0
│   └── 7:7:0:1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/7/7:7/7:7:0/7:7:0:1
├── drivers
├── drivers_autoprobe
├── drivers_probe
└── uevent

6 directories, 3 files
/sys/bus/greybus $ grep . devices/*/uevent
devices/7/uevent:DEVTYPE=greybus_module
devices/7:7/uevent:DEVTYPE=greybus_interface
devices/7:7:0/uevent:DEVTYPE=greybus_bundle
devices/7:7:0:1/uevent:DEVTYPE=greybus_connection

We still have some "confusion" about interface ids and module ids, which
will be cleaned up later when the svc control protocol changes die down,
right now we just name a module after the interface as we don't have any
modules that have multiple interfaces in our systems.

This has been tested with gbsim.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-12-23 15:30:00 -08:00
Greg Kroah-Hartman e50522209a greybus: interface_block: rename module.[c|h] to interface_block.[c|h]
"modules" in the driver model here, are really "interface blocks" as
that is what they are physically tied to.  So rename the files before we
start changing the code to make it obvious what is going on.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-12-11 19:53:59 -05:00
Greg Kroah-Hartman 1cd9ba1477 greybus: module: remove obsolete gb_tty pointer
We aren't using this anymore, so remove gb_tty from struct gb_module.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-12-11 19:53:59 -05:00
Greg Kroah-Hartman 708c126695 greybus: module versions: remove them
We removed the module version from the spec, so remove them from the
code as well.  It's still in the manifest as we need to sync with gbsim
/ firmware when we do that, which will happen sometime in the next
weeks.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-12-11 19:53:59 -05:00
Viresh Kumar 2206ea9cf8 greybus: interface: move gb_module_interface_init() to interface.c
That's where it belong to. Also rename it in a similar way to:
gb_interface_create() and gb_interface_destroy().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-14 13:49:04 -08:00
Alex Elder c41b4f1212 greybus: only initialize interfaces when up
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>
2014-10-22 17:22:22 +08:00
Matt Porter 6271b5bac9 greybus: module: add gb_module_find()
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>
2014-10-22 13:57:49 +08:00
Alex Elder 6ff5e00a17 greybus: remove cports and strings from gb_module
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>
2014-10-21 06:28:23 +08:00
Alex Elder 09c521dc0a greybus: drop gb_* device fields from gb_module
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>
2014-10-21 06:27:37 +08:00
Alex Elder 574341c672 greybus: add device initialization
Set up the infrastructure for initializing connections based on
their protocol.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-17 18:14:11 +02:00
Alex Elder 63cc932b02 greybus: October 1 updates
Update the definitions in "greybus_manifest.h" to reflect the
changes to the Greybus specification made on October 1.

They are:
    - renaming "device" to be "interface"
    - renumbering greybus descriptor type
    - eliminating the notion of a "function"
    - defining a CPort's protocol in the CPort descriptor
    - having a "class" take on the types previously used for "function"
    - renaming "serial number" to be "unique id" (for now)
    - relying on an interface's maximum cport id to determine how
      much device+cport address space the interface consumes
    - adding a simple class descriptor
    - renaming gb_interface->interface_id to be gb_interface->id

This also reorders some things to match ordering in the document,
and adds some commentary for the various structures.

Since greybus_function_type is gone, we eliminate the "type" field
from a function structure.  (Functions are going away, next.)

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:22:04 -07:00
Alex Elder b09c94a1b7 greybus: start improving manifest parsing
Currently the module manifest parsing code is sort of representative
only and is not really very useful.

This patch begins doing "real" parsing of the module manifest.
It scans the module manifest to identify the descriptors it holds.
It then verifies there's only one module descriptor found, and
initializes new some fields in the gb_module structure based on what
it contains (converting what's found to native byte order).
Note that if anything unexpected is found or other errors occur when
parsing the manifest, the parse fails.

Because we now save this converted information when it's parsed we
no longer have a greybus_descriptor_module struct within a struct
gb_module.  And because we've already converted these values, we can
do a little less work displaying values in sysfs.  (We also now show
vendor, product, and version values in the right byte order.)  This
eliminates the need for greybus_string(), so get rid of it.

It also slightly simplifies the greybus module matching code.

Move some existing parsing code into a new file, "manifest.c".

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:18:41 -07:00
Alex Elder 8c12cde3c2 greybus: define greybus interface abstraction
Define new source files "interface.h" and "interface.c" to contain
the definitions of the Greybus interface abstraction.  A Greybus
interface represents a UniPro device present in a UniPro module.
For Project Ara, each interface block on a module implements a
UniPro interface.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:17:20 -07:00
Alex Elder e1e9dbddfe greybus: isolate greybus module code
Define new source files "module.h" and "module.c" to separate the
definitions of the Greybus module abstraction from other code.

Rename "greybus_module" to be "gb_module", for brevity.  Do the same
for a few other symbols with "greybus_module" in their names.  A few
(like greybus_module_id) are more visible outside this kernel module
so we'll keep their names more descriptive.

Add a definition for U8_MAX in "kernel_ver.h" (it appeared in 3.14).

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:17:20 -07:00