Commit Graph

46 Commits

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
Franck Demathieu 946d7c78a0 staging: greybus: sdio: Prefer u32 over uint32_t
It fixes the following issue reported by checkpatch.pl:
Prefer kernel type 'u32' over 'uint32_t'

Signed-off-by: Franck Demathieu <fdemathieu@gmail.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-27 09:29:23 +01:00
Rahul Krishnan db1a4194c8 staging: Greybus: Remove unnecessary braces for single statement block
This patch fixes the following checkpath.pl warning
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Rahul Krishnan <mrahul.krishnan@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-19 14:23:09 +01:00
Rui Miguel Silva 85a42dc867 staging: greybus: sdio: fix cmd_flags check for none response
When checking for command flags field if response is not available we
really need to compare it with the right define and not bitwise AND it.

smatch warn:
        drivers/staging/greybus/sdio.c:481 gb_sdio_command()
        warn: bitwise AND condition is false here

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-10-02 15:49:25 +02:00
Rui Miguel Silva 2064ae5741 staging: greybus: sdio: remove KERNEL_VERSION checks
No need to support older kernel versions in the Greybus SDIO driver, so
remove the checks as needed, we can now rely on all of the correct SDIO
core apis being present.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-09-19 16:47:49 +02:00
Greg Kroah-Hartman 7434564ca1 staging: greybus: sdio: fix min() type check
The 0-day bot pointed out a type difference in one min() call, so fix it
up by being explicit about the type being compared.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-09-19 16:44:41 +02:00
Rui Miguel Silva afbf72505b greybus: sdio: increase maximum segment size
Adjust maximum segment size of the sg list to meet the maximum request
size, this will allow to have less segments which increase the
performance of data movement during transfer operations.

Test Done: using mmc_test with best-case read/write performance and see
that only one segment is used and that the results are better (288KiB vs
300KiB in read operation).

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-08-10 12:00:32 +02:00
Jackson Chang 8f3972f78f greybus: SDIO: Add runtime pm support
Modify SDIO greybus driver to support runtime PM framework.
To enable SDIO runtime PM, it needs to remove MMC_CAP_NEEDS_POLL
and add MMC_CAP2_CORE_RUNTIME_PM in set_host_caps().
The suspend function and resume function have been tested
with micron-sdio image by sysfs. SDIO functions work well
on suspend/resume.

Testing Done: Compiled and verified on EVT2.0 + Micron ARA
              SD module with USB connector

Signed-off-by: Jackson Chang <chang_jackson@projectara.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-08-05 20:14:48 +02:00
Rui Miguel Silva d53cc1c37e greybus: sdio: add switch voltage operation
Core sd/mmc needs the start_signal_voltage_switch operation to be
defined to issue a voltage switch command. So, we define it here even
though we do not need to take in action on it, since all voltage control
is done in the Module.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-07-19 16:38:24 -07:00
Rui Miguel Silva 484a4d6677 greybus: sdio: convert vdd kernel values to greybus
We need to convert vdd kernel values to greybus ones. And we get this by
shifting the kernel values by 8.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-07-19 16:38:24 -07:00
Rui Miguel Silva e3b090ea95 greybus: sdio: avoid extra memory operation at data transfer
Right now greybus sdio uses the greybus operation_sync to transfer data,
this will imply an extra memcpy at greybus core that we can avoid.

Also with this change we remove the need for an extra buffer to store
intermediate copy.

So, let us create the operation and do the memory operations in the sdio
driver.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-21 12:28:09 -07:00
Viresh Kumar 64060fe954 greybus: gbphy: Remove protocol specific version handling
We should be using the generic version handling at bundle level, instead
of at protocol level for bridged PHY devices as well.

The bundle version handling is already in place, though it is *not* used
today as we haven't bumped the version of control protocol yet.

Remove protocol specific handling for bridged PHY devices.

Tested on EVT 1.5 with gpbridge-test module. No nuttx changes are
required with this.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-31 22:02:58 -07:00
Alex Elder ebc9e3750d greybus: fix unbalanced mutex
Running "make coccicheck" on the Greybus code reports that
gb_mmc_get_ro() and gb_mmc_get_cd() can return without releasing
the mutex it acquired if there's an error.  Fix this.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-27 11:28:16 -07:00
Sandeep Patil e54b106dd1 greybus: gpbridge: rename 'gpbridge' to 'gbphy' everywhere
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>
2016-05-19 10:09:13 -07:00
Viresh Kumar 3d64730e11 greybus: sdio: Create separate module
Create separate module for sdio gpbridge driver.

Tested on EVT 1.5 by inserting GP test module, all the devices were
enumerated correctly.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-14 19:13:57 +02:00
Greg Kroah-Hartman dcd2086aa8 greybus: SDIO: convert to a gpbridge driver
This converts the SDIO driver to be a gpbridge driver, moving it away
from the "legacy" interface.

Testing Done: Tested on gbsim.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Signed-off-by: Vaibhav Hiremath <vaibhav.hiremath@linaro.org>
[vaibhav.hiremath@linaro.org: 1.Changed code to retain init/exit fns of
drivers. 2.Exit path fix. 3. Fixed review comments]
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-05 13:38:57 -07:00
Greg Kroah-Hartman 0ec3063244 greybus: convert drivers to use connection->private set/get
This converts all drivers to use the gb_connection_get_data() and
gb_connection_set_data() functions to make it a bit more explicit as to
what is going on.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-22 16:47:28 -04:00
Greg Kroah-Hartman c7b0726504 greybus: gpbridge.h: move protocol init/exit prototypes
Create gpbridge.h for the gpbridge-specific function prototypes, the
rest of the greybus drivers don't care about them.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
2016-03-03 13:52:02 -08:00
Viresh Kumar b933fa4a40 greybus: Prefix hexadecimal values with 0x while printing them
To clearly specify the base for printed values, prefix hexadecimal
values with 0x.

Suggested-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-04 16:23:36 -08:00
Rui Miguel Silva b6789ee55b greybus: sdio: some cleanups in command function
Some cleanups in gb_sdio_command function, ret does not need to be
initialize and mrq is already pointing to request, no need to get it
from host.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-19 12:06:44 -07:00
Rui Miguel Silva 10ed193876 greybus: sdio: send data block details at command request
If SDIO request include data to be transfer send details (data blocks
and block size) in command request, as it seems some controllers need
this info prior to set the registers correctly.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-19 12:06:44 -07:00
Greg Kroah-Hartman 61c80575b9 greybus: sdio: use the bundle struct device instead of the connector
We are removing struct device from the gb_connection structure in the
near future.  The gb_bundle structure's struct device should be used as
a replacement.

This patch moves the sdio driver to use the bundle pointer instead of
the connection pointer.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2015-10-15 09:19:15 -07:00
Rui Miguel Silva f064b872e7 greybus: sdio: clarify operator precedence
When translating capabilities from greybus to mmc values add some
parentheses to clarify operation precedence and avoid static analyses
warnings.

[sdio.c:81]: (style) Clarify calculation precedence for '&' and '?'

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-09 14:02:06 -07:00
Rui Miguel Silva dcb8d8d3e1 greybus: sdio: convert greybus ocr values to mmc ones
It was missing the translation between the ocr vdd values of greybus to
mmc_core values. This would make the detection of range voltage fail.

mmc: host doesn't support card's voltages

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-09 14:02:06 -07:00
Rui Miguel Silva 6cac7dc3aa greybus: sdio: fix card removable detection
In kernel versions bellow 3.15, the mmc_card_is_removable helper
function has an extra check used for a suspend/resume hack. This made
the gd_sdio_process_event to behave badly handling the module card
insert event in that versions.

So, just test bit the flag that we need, instead of using the helper
function. This way will work in all kernel versions.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-09 14:02:06 -07:00
Rui Miguel Silva e0f875c336 greybus: sdio: add field to get_caps response
Frequency maximum and minimum are needed to complete the configuration
of the controller. Add them to get_caps response operation.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-09 14:02:06 -07:00
Johan Hovold b9154df5cf greybus: sdio: fix work-queue leak and use-after-free
A single global work-queue pointer was used for the per-connection
workqueue, something which would lead to memory leaks and all sorts of
bad things if there are ever more than one SDIO connection in a system.

Also add the missing error handling when allocating the queue.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-14 21:57:25 -07:00
Johan Hovold e5265266ec greybus: sdio: fix tear-down use-after-free
The mmc-driver private data must not be accessed after mmc_free_host()
has released it.

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-09-14 21:57:25 -07:00
Viresh Kumar 7071ca1df5 greybus: sdio: Drop get_version support
This is done from a common place now, no need to replicate it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-11 19:33:05 -07:00
Viresh Kumar f1f6fa44ae greybus: sdio: error out only for smaller payloads received
!= was used in place of <, while comparing expected and actual payload
size. The module may be running a higher version of the protocol and
might have some extra fields (towards the end) in the structure, and the
AP needs to ignore them.

This also updates the print (expected-payload-size <
actual-payload-size), when the size doesn't match for requests received
by the module. This gives more details required for debugging.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-10 17:36:55 -07:00
Rui Miguel Silva 9ddf133371 greybus: sdio: fix transfer buffer handling and blocks counting
Fix copy to/from scatterlist destination buffer offset, fix
calculation of blocks to be transfer and make a more verbose out of
error when the blocks receive/send do not match.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Rui Miguel Silva f85451d8f5 greybus: sdio: add need poll to host caps
As we do not have, yet, a event callback to notify core about changes
we add the MMC_CAP_NEEDS_POLL capability to the rest of the caps
received from the module.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Rui Miguel Silva 73f4a52179 greybus: sdio: check number of blocks in transfer
Before initiating a transfers, check if the command (for single block)
match the number of blocks in the request.

While at it, fix also a missing break.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Rui Miguel Silva 882edf59fc greybus: sdio: pass only data pointer to tranfer funtion
No need to pass the all request to the transfer related funtctions.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Rui Miguel Silva 7a5cd5aea2 greybus: sdio: fix call to stop command if no data exist
If data is not available the stop command could dereference NULL.
Fetch the stop command directly from the request instead.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Rui Miguel Silva 08ccc9be68 greybus: sdio: fix return of get_cd and get_ro
Functions were returning the wrong flag for the expected value. Swap
them.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Rui Miguel Silva c36d31cbc5 greybus: sdio: rework of event handler
Between the time connection with module is up and the host is added,
we can receive events (card inserted/removed, write protection
switch), so until the setup is complete we queue the events received
and handle them after.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Rui Miguel Silva ef0cc0ec8d greybus: sdio: split cmd_flags to there meaning
Instead of using values in the command cmd_flags field use the real
flags in a bit mask.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-06 11:15:42 -07:00
Viresh Kumar e18822e3d0 greybus: Rename gb_gpbridge_protocol_driver() as gb_builtin_protocol_driver()
This macro is also required by core protocols like control and svc, and
hence the 'gpbridge' name doesn't fit anymore.

Lets call this macro gb_builtin_protocol_driver().

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-07-01 16:34:55 -07:00
Phong Tran 93a99e8a10 greybus: sdio: correct the usage of mmc request in work queues handler
The mmc request should assigned before use. Then
It should avoid freeing before using in mmc_request_done().

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-29 18:06:08 -07:00
Phong Tran 9b86bdf96e greybus: sdio: change the order of remove and free mmc host
The mmc host should be removed frist. Then it
will be freed.

Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Reviewed-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-29 18:06:08 -07:00
Rui Miguel Silva 5656ab99a0 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>
2015-06-24 17:34:46 -07:00
Rui Miguel Silva 3b6ecd6de6 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>
2015-06-23 23:13:41 -07:00
Viresh Kumar bdac599c70 greybus: Use gb_gpbridge_protocol_init()
Start using gb_gpbridge_protocol_init() in gpbridge drivers.

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-20 22:44:37 -07:00
Viresh Kumar 5357cf3231 greybus: Remove "-gb" suffix from .c files
Some files are prefixed with "gb-" and some are suffixed with "-gb". The
rationale behind the first one is that the modules would be named so, i.e.
gb-*.ko. But there is no reason to keep the "-gb" suffix in the second case.

Remove the unnecessary suffix.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-22 11:27:20 +08:00