linux-2.6-microblaze.git
5 years agostaging: rtl8188eu: cleanup comments in rtl8188eu_led.c
Michael Straube [Wed, 21 Nov 2018 19:49:29 +0000 (20:49 +0100)]
staging: rtl8188eu: cleanup comments in rtl8188eu_led.c

Remove comments in rtl8188eu_led.c. The function names are well
descriptive.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove unnecessary parentheses in rtl8188eu_led.c
Michael Straube [Wed, 21 Nov 2018 19:49:28 +0000 (20:49 +0100)]
staging: rtl8188eu: remove unnecessary parentheses in rtl8188eu_led.c

Remove unnecessary parentheses reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoMerge tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 22 Nov 2018 08:39:45 +0000 (09:39 +0100)]
Merge tag 'iio-for-4.21a' of git://git./linux/kernel/git/jic23/iio into staging-testing

Jonathan writes:

First set of new device support, features and cleanups for IIO in the 4.21 cycle

Along with the headline feature of 5 new drivers, we have the
substantial addition of auxilliary sensor support on the lsm6sdx
parts for ST.  There has also been a good set of staging cleanup
in this period with more underway.

An ever increasing number of devices supported with just a new
ID which is a good sign that at least some manufacturers are
continuing to stabilise their interfaces.

New device support,
* ad7124
  - New driver supporting Analog Devices' ad7124-4 and ad7124-8 parts
    with the inevitable DT binding.
* ad7949
  - New driver supporting Analog Devices' ad7949, AD7682 and AD7689 ADCs.
* rm3100
  - New driver supporting PNIs RM3100 magnometer with bindings and
    vendor prefix.
* ti-dac7311
  - New driver supporting DAC7311DAC6311 and DAC5311 TI DACs, with
    DT bindings.
* vcnl5035
  - New driver supporting the light sensor part of the VCNL4035, with
    DT bindings

Features,
* bindings
  - Add a generic ADC channel binding as we keep reinventing this
    wheel.
* adc128s052
  - Add IDs for additional pin compatible parts.
  - Add APCI ID seen on E3940 UP squared boards.
* ad_sigma_delta
  - Allow for custom data register overiding default.
* kxcjk1013
  - Add KIOX0009 ACPI ID as seen on the Acer One 10.
* lsm6dsx
  - Rework leading to...
  - External sensor support using the built in I2C master.
  - Initial support for a slave lis2mdl magnetometer.
* meson-saradc
  - Add temperature sensor support and bindings.
* st_magn
  - New ID for lsm9dsl_magn with bindings
  - New ID for lis3de accelerometer
* tpl0102
  - Add supprot for IIO_AVAIL_RANGE to report the range available
    from this device to userspace and in kernel users.

Cleanups and minor fixes
* tools
  - Allow outside specification of CFLAGS
* ad2s90
  - Handle and spi_read error.
  - Handle spi_setup failure
  - Drop a pointless assignment.
  - Prevent a potentail race by moving device registration to after
    all other setup.
  - Add missing scale attribute.
  - Add a sanity check on channel type before trying to read it.
* ad2s1210
  - Move to modern gpio descriptors.
  - Drop a gpioin flag which made no sense as far as we can tell.
  - Add dt table (bindings doc to follow when this is ready for
    moving out of staging).
* ad5933
  - Drop camel-case naming of ext_clk_hz.
  - White space fixes.
* ad7150
  - Local variable to shorten overly long line.
  - Alignment and line break fixes.
ad7280a
  - Handle an error path that was previously ignored.
  - Use crc8.h to build the crc table replacing custom code.
  - Avoid unecessary cast.
  - Power down the device if an error happens in probe
  - Use devm routines to simplify probe and remove.
* ad7606
  - Alignment fixes.
* ad7780
  - This worked as long as by coincidence an uninitialized value
    was 0.  Lets not rely on that.
  - Ensure gain update is only used with the ad778x chips that
    actually support it.
  - Tidy up pattern mask generation.
  - Read regulator when scale is requested (which should be infrequent)
    as it might have changed from initialization.
* ad7816
  - Move to modern gpio descriptors
  - Don't use a busy_pin for ad7818 as there isn't one.
  - Ensure RD/WR and CONVST pins are outputs (previously they
    were brought up as inputs which doesn't seem to make any sense)
  - DT id table.
* adc128s052
  - SPDX
* adt7316
  - Alignment fix.
  - Fix data reading.  When using I2C the driver never actually
    used the value read.  This has been broken a very long time
    hence no rush to fix it now + the driver is undergoing a lot
    of cleanup.
  - Sanity check that the i2c read didn't fail to actually read
    anything.
* dpot-dac
  - Mark a switch full through with slightly different text so that
    gcc doesn't warn on it.
* gyro-adc
  - Fix a wrong file in the MAINTAINERS entry and add binding doc to the
    listed files.
* ina2xx
  - Add some early returns to clarify error paths in switch.
* lsm6dsx
  - MAINTAINERS entry.
* max11100
  - SPDX
* max9611
  - SPDX
* mcp4131
  - use of_device_get_match_data in preference to spi_get_device_id
    approach.
* rcar-adc
  - SPDX
* sc27xx
  - Add ADC conversion timeout support to avoid possible fault.
* ssp_sensors
  - Don't free managed resources manually.
* st-magn
  - Add a comment to avoid future confusion over when to use -magn
    postfix (on multi chip in package parts)
  - Add BDU register for LIS3MDL where it seems to have been missed.
* st-sensors
  - Minor spelling, grammar etc fixes.
* tpl0102
  - Use a pointer rather than an index of an array to improve conciseness.

* tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (80 commits)
  Staging: iio: adt7316: Add an extra check for 'ret' equals to 0
  Staging: iio: adt7316: Fix i2c data reading, set the data field
  dt-bindings: iio: adc: Add docs for ad7124
  iio: adc: Add ad7124 support
  dt-bindings: iio: adc: Add common ADCs properties to a separate file
  iio: ad_sigma_delta: Allow to provide custom data register address
  staging: iio: ad7816: Add device tree table.
  iio: imu: st_lsm6dsx: add entry in MAINTAINERS file
  iio: potentiometer: mcp4131: use of_device_get_match_data()
  staging: iio: adc: ad7280a: use devm_* APIs
  staging: iio: adc: ad7280a: power down the device on error in probe
  dt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors
  iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller
  iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine
  iio: imu: st_lsm6dsx: add i2c embedded controller support
  iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine
  iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids
  iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark
  iio: imu: st_lsm6dsx: reload trimming parameter at bootstrap
  iio: imu: st_lsm6dsx: introduce locked read/write utility routines
  ...

5 years agostaging: vchi: Add SPDX-License-Identifier
André Almeida [Tue, 13 Nov 2018 18:58:35 +0000 (16:58 -0200)]
staging: vchi: Add SPDX-License-Identifier

Using multiple license representation as shown here [1].
[1] https://spdx.org/sites/cpstandard/files/pages/files/using_spdx_license_list_short_identifiers.pdf

Signed-off-by: André Almeida <andrealmeid@riseup.net>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: vchi: change type 'int32_t' to 's32'
André Almeida [Tue, 13 Nov 2018 18:58:34 +0000 (16:58 -0200)]
staging: vchi: change type 'int32_t' to 's32'

As one can see in a typedef at linux/types.h:103, s32 and int32_t are
both a 32 bits signed integer. s32 is preferred because it is defined
by the kernel maintainers and it prevents portability issues. Changed
to meet checkpatch criteria.

Signed-off-by: André Almeida <andrealmeid@riseup.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: unzip_vle.c: Align parameter to the parentesis
Cristian Sicilia [Mon, 12 Nov 2018 20:43:59 +0000 (21:43 +0100)]
staging: erofs: unzip_vle.c: Align parameter to the parentesis

Align parameters to the opened parentesis.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: unzip_vle.c: Constant in comparison on right side
Cristian Sicilia [Mon, 12 Nov 2018 20:43:58 +0000 (21:43 +0100)]
staging: erofs: unzip_vle.c: Constant in comparison on right side

Comparisons should place the constant
on the right side of the test.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: erofs: unzip_vle.c: Replace comparison to NULL.
Cristian Sicilia [Mon, 12 Nov 2018 20:43:57 +0000 (21:43 +0100)]
staging: erofs: unzip_vle.c: Replace comparison to NULL.

Replace equal to NULL with logic unary operator,
and removing not equal to NULL comparison.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wlan-ng: remove unused variable in prism2fw.c
Tim Collier [Mon, 19 Nov 2018 08:41:31 +0000 (08:41 +0000)]
staging: wlan-ng: remove unused variable in prism2fw.c

Remove the unused crcend variable from the crcimage function.

Signed-off-by: Tim Collier <osdevtc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: emxx_udc: Fixing function naming
Cristian Sicilia [Fri, 16 Nov 2018 23:46:07 +0000 (00:46 +0100)]
staging: emxx_udc: Fixing function naming

Fix function naming and parenthesis.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: axis-fifo: Split line to stay in 80 characters.
Cristian Sicilia [Fri, 16 Nov 2018 23:24:49 +0000 (00:24 +0100)]
staging: axis-fifo: Split line to stay in 80 characters.

The line is split up to stay in 80 characters-

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8723bs: Correct errors from checkpatch
Josenivaldo Benito Jr [Tue, 13 Nov 2018 01:57:16 +0000 (23:57 -0200)]
staging: rtl8723bs: Correct errors from checkpatch

Correct following errors reported by checkpath.pl:

ERROR: space required before the open parenthesis '(' #265: FILE:
drivers/staging/rtl8723bs/hal/rtl8723bs_recv.c:265:
+                       if(!precvframe) ')'

Also similar errors on line 274 and 283.

Signed-off-by: Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtlwifi: Add new line to stay in 80 characters
Cristian Sicilia [Tue, 13 Nov 2018 19:34:39 +0000 (20:34 +0100)]
staging: rtlwifi: Add new line to stay in 80 characters

The parameter is sent to next line to stay in 80
characters

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtlwifi: Add spaces to match open parenthesis
Cristian Sicilia [Tue, 13 Nov 2018 19:34:38 +0000 (20:34 +0100)]
staging: rtlwifi: Add spaces to match open parenthesis

Added before parameters some spaces to match open parenthesis
on previous line.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: pi433: remove GPL boiler plate text
Michael Straube [Tue, 13 Nov 2018 17:13:40 +0000 (18:13 +0100)]
staging: pi433: remove GPL boiler plate text

The SPDX identifier is a legally binding shorthand,
which can be used instead of the full boiler plate text.

All source and header files have SPDX identifiers.
Remove the GPL boiler plate text to reduce file size.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "staging: greybus: remove extra space before tab"
Greg Kroah-Hartman [Tue, 20 Nov 2018 09:37:04 +0000 (10:37 +0100)]
Revert "staging: greybus: remove extra space before tab"

This reverts commit 57d053682ff55aa16a390ddb054a26deb4dfbf9e.

Johan writes:
This commit doesn't even do what it claims. It leaves the two
spaces before tabs in place and instead removes a tab that was
used to indent a continuation line, and therefore also hurts
readability while introducing an inconsistency.

Reported-by: Johan Hovold <johan@kernel.org>
Cc: Ioannis Valasakis <code@wizofe.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoRevert "staging: greybus: remove multiple blank lines"
Greg Kroah-Hartman [Tue, 20 Nov 2018 09:35:12 +0000 (10:35 +0100)]
Revert "staging: greybus: remove multiple blank lines"

This reverts commit fcb733b546ea943dd2e312cc3b556159cb44345a.

Johan writes:
This patch removes the double newlines that were used as section
headers in the lengthy protocol header file, and therefore hurts
readability.

So I'm reverting it.

Reported-by: Johan Hovold <johan@kernel.org>
Cc: Ioannis Valasakis <code@wizofe.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoStaging: iio: adt7316: Add an extra check for 'ret' equals to 0
Shreeya Patel [Fri, 16 Nov 2018 22:51:32 +0000 (04:21 +0530)]
Staging: iio: adt7316: Add an extra check for 'ret' equals to 0

ret = 0 indicates a case of no error but no data read from
the bus which is an invalid case. This case doesn't ever happen
in reality. It should perhaps be handled for correctness though.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoStaging: iio: adt7316: Fix i2c data reading, set the data field
Shreeya Patel [Fri, 16 Nov 2018 22:49:07 +0000 (04:19 +0530)]
Staging: iio: adt7316: Fix i2c data reading, set the data field

adt7316_i2c_read function nowhere sets the data field.
It is necessary to have an appropriate value for it.
Hence, assign the value stored in 'ret' variable to data field.

This is an ancient bug, and as no one seems to have noticed,
probably no sense in applying it to stable.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: Add docs for ad7124
Stefan Popa [Tue, 13 Nov 2018 11:22:18 +0000 (13:22 +0200)]
dt-bindings: iio: adc: Add docs for ad7124

Add support for Analog Devices AD7124 4-channels and 8-channels ADC.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: Add ad7124 support
Stefan Popa [Tue, 13 Nov 2018 11:21:32 +0000 (13:21 +0200)]
iio: adc: Add ad7124 support

The ad7124-4 and ad7124-8 are a family of 4 and 8 channel sigma-delta ADCs
with 24-bit precision and reference.

Three power modes are available which in turn affect the output data rate:
 * Full power: 9.38 SPS to 19,200 SPS
 * Mid power: 2.34 SPS to 4800 SPS
 * Low power: 1.17 SPS to 2400 SPS

The ad7124-4 can be configured to have four differential inputs, while
ad7124-8 can have 8. Moreover, ad7124 also supports per channel
configuration. Each configuration consists of gain, reference source,
output data rate and bipolar/unipolar configuration.

Datasheets:
Link: http://www.analog.com/media/en/technical-documentation/data-sheets/AD7124-4.pdf
Link: http://www.analog.com/media/en/technical-documentation/data-sheets/ad7124-8.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: adc: Add common ADCs properties to a separate file
Stefan Popa [Tue, 13 Nov 2018 11:21:01 +0000 (13:21 +0200)]
dt-bindings: iio: adc: Add common ADCs properties to a separate file

There are several ADC drivers that depend on the same device tree
bindings. Rather than continue to duplicate the properties, this patch
adds a common adc binding document that can be referenced. For beginning,
only two properties are documented.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: ad_sigma_delta: Allow to provide custom data register address
Lars-Peter Clausen [Tue, 13 Nov 2018 11:20:24 +0000 (13:20 +0200)]
iio: ad_sigma_delta: Allow to provide custom data register address

Some newer devices from the Sigma-Delta ADC family do have their data
register at a different address than the current default address. Add a
parameter to the ad_sigma_delta_info struct which allows to override the
default address.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7816: Add device tree table.
Nishad Kamdar [Wed, 14 Nov 2018 17:46:14 +0000 (23:16 +0530)]
staging: iio: ad7816: Add device tree table.

Add device tree table for matching vendor ID.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add entry in MAINTAINERS file
Lorenzo Bianconi [Thu, 15 Nov 2018 09:10:57 +0000 (10:10 +0100)]
iio: imu: st_lsm6dsx: add entry in MAINTAINERS file

Add entry for st_lsm6dsx imu driver in MAINTAINERS file

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: potentiometer: mcp4131: use of_device_get_match_data()
Slawomir Stepien [Fri, 16 Nov 2018 09:47:21 +0000 (10:47 +0100)]
iio: potentiometer: mcp4131: use of_device_get_match_data()

Try to get the device's data using OF API. In case of failure, fallback
to the spi_get_device_id() method.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: use devm_* APIs
Slawomir Stepien [Sun, 11 Nov 2018 15:59:11 +0000 (16:59 +0100)]
staging: iio: adc: ad7280a: use devm_* APIs

devm_* APIs are device managed and make code simpler.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: adc: ad7280a: power down the device on error in probe
Slawomir Stepien [Sun, 11 Nov 2018 15:59:10 +0000 (16:59 +0100)]
staging: iio: adc: ad7280a: power down the device on error in probe

Power down the device if anything goes wrong after the SPI has been
setup correctly in the probe function.

Existing code that toggles the AD7280A_CTRL_LB_SWRST bit inside
ad7280_chain_setup function is responsible for powering up the device.

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:36 +0000 (15:15 +0100)]
dt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add hw FIFO support to i2c controller
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:35 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller

Introduce hw FIFO support to lsm6dsx i2c controller.
st_lsm6dsx sensor-hub relies on SLV0 for slave configuration since SLV0
is the only channel that can be used to write into i2c slave devices.
SLV{1,2,3} channels are used to read external data and push them into
the hw FIFO

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:34 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine

Introduce st_lsm6dsx_push_tagged_data routine to push samples
to iio buffers. st_lsm6dsx_push_tagged_data will be reused adding
hw fifo support to st_lsm6dsx i2c embedded controller in order to
improve code readability

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: add i2c embedded controller support
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:33 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: add i2c embedded controller support

i2c controller embedded in lsm6dx series can connect up to four
slave devices using accelerometer sensor as trigger for i2c
read/write operations.
Introduce sensor hub support for lsm6dso sensor. Add register map
for lis2mdl magnetometer sensor.
In order to perform single read/write operations st_lsm6dsx driver
relies on SLV0 channel (hw FIFO is not supported yet)

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:32 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine

Add st_lsm6dsx_sensor_set_enable routine and remove
st_lsm6dsx_sensor_{enable/disable} ones in order to make the code more
readable and remove unnecessary functions

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:31 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids

Add ST_LSM6DSX_ID_EXT{0,1,2} sensor ids as reference for slave devices
connected to st_lsm6dsx i2c controller. Moreover introduce odr dependency
between accel and ext devices since i2c embedded controller relies on the
accelerometer sensor as bus read/write trigger so we need to enable accel
device at odr = max(accel_odr, ext_odr) in order to properly communicate
with i2c slave devices

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:30 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark

Remove static qualifier from st_lsm6dsx_set_watermark routine in
order to be reused supporting st_lsm6dsx i2c controller

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: reload trimming parameter at bootstrap
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:29 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: reload trimming parameter at bootstrap

Perform a complete device reset at bootstrap reloading trimming parameter
after sw reset is completed. Device sw reset/boot is explained here:
https://www.st.com/resource/en/application_note/dm00517282.pdf,
section 5.7

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: imu: st_lsm6dsx: introduce locked read/write utility routines
Lorenzo Bianconi [Sun, 11 Nov 2018 14:15:28 +0000 (15:15 +0100)]
iio: imu: st_lsm6dsx: introduce locked read/write utility routines

Add st_lsm6dsx_update_bits_locked, st_lsm6dsx_read_locked and
st_lsm6dsx_write_locked utility routines in order to guarantee
the bus access is atomic respect to reg page configuration.
This is a preliminary patch to add i2c sensor hub support since
i2c master registers are accessed through a reg page multiplexer

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: sc27xx: Add ADC data conversion timeout
Freeman Liu [Fri, 9 Nov 2018 03:25:31 +0000 (11:25 +0800)]
iio: adc: sc27xx: Add ADC data conversion timeout

Sometimes the ADC controller met some problems, and it will not complete
the data conversion, that will can not wake up the read process any more
to block users. So we should add one maximum conversion time to avoid
this issue.

Signed-off-by: Freeman Liu <freeman.liu@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7780: remove unnecessary stashed voltage value
Renato Lui Geh [Mon, 5 Nov 2018 19:16:14 +0000 (17:16 -0200)]
staging: iio: ad7780: remove unnecessary stashed voltage value

This patch removes the unnecessary field int_vref_mv in ad7780_state
referring to the device's voltage.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7780: update voltage on read
Renato Lui Geh [Mon, 5 Nov 2018 19:14:58 +0000 (17:14 -0200)]
staging: iio: ad7780: update voltage on read

The ad7780 driver previously did not read the correct device output, as
it read an outdated value set at initialization. It now updates its
voltage on read.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: magnetometer: Add driver support for PNI RM3100
Song Qiang [Thu, 8 Nov 2018 09:27:49 +0000 (17:27 +0800)]
iio: magnetometer: Add driver support for PNI RM3100

PNI RM3100 is a high resolution, large signal immunity magnetometer,
composed of 3 single sensors and a processing chip with a MagI2C
interface.

Following functions are available:
 - Single-shot measurement from
   /sys/bus/iio/devices/iio:deviceX/in_magn_{axis}_raw
 - Triggerd buffer measurement.
 - DRDY pin for data ready trigger.
 - Both i2c and spi interface are supported.
 - Both interrupt and polling measurement is supported, depends on if
   the 'interrupts' in DT is declared.

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: magnetometer: Add DT support for PNI RM3100
Song Qiang [Thu, 8 Nov 2018 09:27:48 +0000 (17:27 +0800)]
iio: magnetometer: Add DT support for PNI RM3100

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agodt-bindings: Add PNI to the vendor prefixes
Song Qiang [Thu, 8 Nov 2018 09:27:47 +0000 (17:27 +0800)]
dt-bindings: Add PNI to the vendor prefixes

Signed-off-by: Song Qiang <songqiang1304521@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: st-accel: add support for lis3de
Heiko Stuebner [Wed, 7 Nov 2018 15:45:21 +0000 (16:45 +0100)]
iio: st-accel: add support for lis3de

This commit add support for STMicroelectronics lis3de accelerometer.
Datasheet for this device can be found here:

https://www.st.com/resource/en/datasheet/lis3de.pdf

Signed-off-by: Heiko Stuebner <heiko.stuebner@bq.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: Add device tree binding for vishay vcnl4035
Parthiban Nallathambi [Wed, 7 Nov 2018 17:08:21 +0000 (18:08 +0100)]
iio: light: Add device tree binding for vishay vcnl4035

Adding device tree binding for vcnl4035 and vendor
prefix for Vishay Intertechnology

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: light: Add support for vishay vcnl4035
Parthiban Nallathambi [Wed, 7 Nov 2018 17:08:20 +0000 (18:08 +0100)]
iio: light: Add support for vishay vcnl4035

Add support for VCNL4035, which is capable of Ambient light
sensing (ALS) and proximity function. This patch adds support
only for ALS function

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: rcar-gyroadc: convert to SPDX identifiers
Kuninori Morimoto [Thu, 8 Nov 2018 06:40:21 +0000 (06:40 +0000)]
iio: adc: rcar-gyroadc: convert to SPDX identifiers

This patch updates license to use SPDX-License-Identifier
instead of verbose license text.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: max11100: convert to SPDX identifiers
Kuninori Morimoto [Thu, 8 Nov 2018 06:41:10 +0000 (06:41 +0000)]
iio: adc: max11100: convert to SPDX identifiers

This patch updates license to use SPDX-License-Identifier
instead of verbose license text.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agoiio: adc: max9611: convert to SPDX identifiers
Kuninori Morimoto [Thu, 8 Nov 2018 06:42:43 +0000 (06:42 +0000)]
iio: adc: max9611: convert to SPDX identifiers

This patch updates license to use SPDX-License-Identifier
instead of verbose license text.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7780: generates pattern_mask from PAT bits
Giuliano Belinassi [Thu, 8 Nov 2018 13:03:40 +0000 (11:03 -0200)]
staging: iio: ad7780: generates pattern_mask from PAT bits

Previously, all pattern_masks and patterns in the chip_info table were
hardcoded. Now they are generated using the PAT macros, as described in
the datasheets.

Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: iio: ad7780: check if ad778x before gain update
Giuliano Belinassi [Thu, 8 Nov 2018 13:03:20 +0000 (11:03 -0200)]
staging: iio: ad7780: check if ad778x before gain update

Only the ad778x have the 'gain' status bit. Check it before updating
through a new variable is_ad778x in chip_info.

Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
5 years agostaging: wilc1000: rename tsf_hi element of network_info struct
Ajay Singh [Mon, 12 Nov 2018 05:45:35 +0000 (05:45 +0000)]
staging: wilc1000: rename tsf_hi element of network_info struct

Rename 'tsf_hi' element in network_info struct as it's not used to store
only the higher 32-bit value but the complete 64-bit tsf value.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: use ENOBUFS error code instead of WILC_TX_ERR_NO_BUF macro
Ajay Singh [Mon, 12 Nov 2018 05:45:32 +0000 (05:45 +0000)]
staging: wilc1000: use ENOBUFS error code instead of WILC_TX_ERR_NO_BUF macro

Make use of 'ENOBUFS' instead of WILC_TX_ERR_NO_BUF macro. The value of
WILC_TX_ERR_NO_BUF is -2, which is confusing with ENOENT error code.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: added 'WILC_' prefix for constants to have clear namespace
Ajay Singh [Mon, 12 Nov 2018 05:45:29 +0000 (05:45 +0000)]
staging: wilc1000: added 'WILC_' prefix for constants to have clear namespace

For better namespace added 'WILC_' prefix for driver specific constants.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: rename firmware related constants to follow better namespace
Ajay Singh [Mon, 12 Nov 2018 05:45:26 +0000 (05:45 +0000)]
staging: wilc1000: rename firmware related constants to follow better namespace

Rename the firmware related macro by prefix with 'WILC_FW_' prefix for
a better namespace. Also, move them to wilc_wlan_if.h file along with other
FW related macros.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: move current_tx_rate enum to wilc_wlan_if.h file
Ajay Singh [Mon, 12 Nov 2018 05:45:23 +0000 (05:45 +0000)]
staging: wilc1000: move current_tx_rate enum to wilc_wlan_if.h file

Move 'current_tx_rate' enum to wilc_wlan_if.h, to have it along with the
other FW related to constants. Also added prefix to have a better
namespace.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: use proper namespace for macros in wilc_wlan_if.h header
Ajay Singh [Mon, 12 Nov 2018 05:45:20 +0000 (05:45 +0000)]
staging: wilc1000: use proper namespace for macros in wilc_wlan_if.h header

Rename the macros defined in wilc_wlan_if.h header to have clear
namespace. As convention used 'WILC_FW_' prefix for constants defined for
firmware and 'WILC_' prefix for driver constants.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: restructure macros used to handle security type
Ajay Singh [Mon, 12 Nov 2018 05:45:17 +0000 (05:45 +0000)]
staging: wilc1000: restructure macros used to handle security type

Restructure the code to have a proper namespace for macro defined to
handle the security types. Move them as part of wilc_wlan_if.h header as
along with other macro defined for firmware.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: use enum contants for mac status & added 'WILC_' prefix
Ajay Singh [Mon, 12 Nov 2018 05:45:14 +0000 (05:45 +0000)]
staging: wilc1000: use enum contants for mac status & added 'WILC_' prefix

Clubbed mac status constants inside the enum constant and also added
'WILC_' prefix to have better namespace.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: move sdio_cmd52 & sdio_cmd53 struct to source file
Ajay Singh [Mon, 12 Nov 2018 05:45:11 +0000 (05:45 +0000)]
staging: wilc1000: move sdio_cmd52 & sdio_cmd53 struct to source file

Moved sdio_cmd52 & sdio_cmd53 struct from wilc_wlan_if.h, as its used in
wilc_sdio.cfile.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: remove unused macros and struct members in host_interface.h
Ajay Singh [Mon, 12 Nov 2018 05:45:08 +0000 (05:45 +0000)]
staging: wilc1000: remove unused macros and struct members in host_interface.h

Cleanup patch to remove the unused macros and struct members in
host_interface.h header file.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: use WLAN_PMKID_LEN macro from ieee80211.h header
Ajay Singh [Mon, 12 Nov 2018 05:45:06 +0000 (05:45 +0000)]
staging: wilc1000: use WLAN_PMKID_LEN macro from ieee80211.h header

Make use of WLAN_PMKID_LEN macro provided by ieee80211.h header instead
of PMKID_LEN.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: use macro from ieee80211.h in register frame api's
Ajay Singh [Mon, 12 Nov 2018 05:45:03 +0000 (05:45 +0000)]
staging: wilc1000: use macro from ieee80211.h in register frame api's

Make use of ieee80211.h provided macros and removed the extra macro
defined for the same purpose.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: gasket: formatting fixes
Robert Deal [Sat, 10 Nov 2018 05:04:34 +0000 (00:04 -0500)]
staging: gasket: formatting fixes

Reformat arguments in a few functions in gasket_page_table.c to better
follow linux kernel formatting standards.

Signed-off-by: Robert Deal <robert.edward.deal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: Remove unused mutex cfg_values_lock
Adham Abozaeid [Fri, 9 Nov 2018 18:20:17 +0000 (18:20 +0000)]
staging: wilc1000: Remove unused mutex cfg_values_lock

After removing cfg_values member, cfg_values_lock that was used to protect
it can also be removed.

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: Don't keep a copy of wiphy parameters in the driver
Adham Abozaeid [Fri, 9 Nov 2018 18:20:16 +0000 (18:20 +0000)]
staging: wilc1000: Don't keep a copy of wiphy parameters in the driver

host_if_drv.cfg_values is a write only member, and can be removed

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: wilc1000: validate cfg parameters before scheduling the work
Adham Abozaeid [Fri, 9 Nov 2018 18:20:15 +0000 (18:20 +0000)]
staging: wilc1000: validate cfg parameters before scheduling the work

Validate cfg parameters after being called by cfg80211 in set_wiphy_params
before scheduling the work executed in handle_cfg_param

Signed-off-by: Adham Abozaeid <adham.abozaeid@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: remove unnecessary parentheses in recv_linux.c
Michael Straube [Sat, 10 Nov 2018 17:54:46 +0000 (18:54 +0100)]
staging: rtl8188eu: remove unnecessary parentheses in recv_linux.c

Remove unnecessary parentheses reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: add spaces around '*' in recv_linux.c
Michael Straube [Sat, 10 Nov 2018 17:54:45 +0000 (18:54 +0100)]
staging: rtl8188eu: add spaces around '*' in recv_linux.c

Add spaces around '*' to conform with kernel coding style.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: rtl8188eu: use __func__ in recv_linux.c
Michael Straube [Sat, 10 Nov 2018 17:54:44 +0000 (18:54 +0100)]
staging: rtl8188eu: use __func__ in recv_linux.c

Use __func__ instead of hardcoded function name.
Reported by checkpatch.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: dt-bindings: add dt bindings for mt7621 pcie controller
Sergio Paracuellos [Fri, 26 Oct 2018 16:48:06 +0000 (18:48 +0200)]
staging: mt7621-pci: dt-bindings: add dt bindings for mt7621 pcie controller

This commit adds pci device tree bindings for the Mt7621 pci controller.
This is a temporal file included in staging driver directory and will be
moved to its correct location when this driver gets out of staging.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: replace 'mdelay()' with 'msleep()'
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:59 +0000 (11:49 +0100)]
staging: mt7621-pci: replace 'mdelay()' with 'msleep()'

Function 'mt7621_pcie_init_ports' is never called in atomic context.
It calls mdelay() to busily wait, which is not necessary. mdelay()
can be replaced with msleep().

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: move some code into 'mt7621_pcie_init_ports'
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:58 +0000 (11:49 +0100)]
staging: mt7621-pci: move some code into 'mt7621_pcie_init_ports'

Some clocks bits related code is in driver probe function and can
perfectly be moved into 'mt7621_pcie_init_ports' function which is
a more accurate place for it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:57 +0000 (11:49 +0100)]
staging: mt7621-pci: factor out 'mt7621_pcie_enable_port' function

Function 'mt7621_pcie_enable_ports' tries to enable all PCI ports.
To make it more readable the single port initialization part has
been factor out into a new 'mt7621_pcie_enable_port' function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: enable interrupt when port is being enabled
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:56 +0000 (11:49 +0100)]
staging: mt7621-pci: enable interrupt when port is being enabled

Interrupt is being enabled in port initialization when the port phy
has not been initialized yet. Just enable the interrupt when the port
is being enabled which is a more accurate place for this.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: use PCIE_PORT_LINKUP instead of hardcode value
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:55 +0000 (11:49 +0100)]
staging: mt7621-pci: use PCIE_PORT_LINKUP instead of hardcode value

PCIE_PORT_LINKUP is defined and can be used to check if link is up
for each controller. Use it instead of use a hardcode value.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: use PERST_N instead of gpio control
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:54 +0000 (11:49 +0100)]
staging: mt7621-pci: use PERST_N instead of gpio control

Driver is using gpio control instead of each port PERST_N
bit. Use PERST_N bit of each port cleaning all the ugly
gpio code in driver probe function.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: add some definitions for enabling and disabling GEN and GEN1...
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:53 +0000 (11:49 +0100)]
staging: mt7621-pci: add some definitions for enabling and disabling GEN and GEN1 clocks

Instead of use hardcoded values when calling 'rt_sysc_m32' for enabling
and disabling RALINK_PCIE_CLK_GEN and RALINK_PCIE_CLK_GEN1 create
some preprocessor definitions.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: rewrite hardcoded code for enabling ports
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:52 +0000 (11:49 +0100)]
staging: mt7621-pci: rewrite hardcoded code for enabling ports

There are some hardcoded values in the process for enabling and
disabling some stuff inside 'mt7621_pcie_enable_ports' function.
Create some preprocessor definitions to make code more readable.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: rewrite RC FTS configuration
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:51 +0000 (11:49 +0100)]
staging: mt7621-pci: rewrite RC FTS configuration

The RC FTS configuration is done using hardcoded registers
and bitshift operations. Make it a bit clean defining some
prepocessor definitions and simple macros.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: align function definition style along the code
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:50 +0000 (11:49 +0100)]
staging: mt7621-pci: align function definition style along the code

Make some function definition changes in order to get all the
functions in the code with the same style.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: remove non sense comment
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:49 +0000 (11:49 +0100)]
staging: mt7621-pci: remove non sense comment

There is a comment at the beggining which has no sense at all.
Remove it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: reorder preprocessor definitions
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:48 +0000 (11:49 +0100)]
staging: mt7621-pci: reorder preprocessor definitions

Reorder a bit register definitions and some values into
logical groups adding some comments for each group. Also
unify all of register to use 16 bit in definitions instead
of having some with 16 bits and some with 8 bits.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: remove unused preprocessor definitions
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:47 +0000 (11:49 +0100)]
staging: mt7621-pci: remove unused preprocessor definitions

There are some preprocessor definition which are not being used at
all. Remove them cleaning the code a bit.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: factor out 'mt7621_pcie_init_ports' function
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:46 +0000 (11:49 +0100)]
staging: mt7621-pci: factor out 'mt7621_pcie_init_ports' function

Instead of just inline this code in the probe driver function factor
out a new 'mt7621_pcie_init_ports' function to achieve this.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: avoid use of global variable 'pcie_link_status'
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:45 +0000 (11:49 +0100)]
staging: mt7621-pci: avoid use of global variable 'pcie_link_status'

'pcie_link_status' is a global variable which is being used as a
mask to know which virtual bridges are or not enabled. Instead of
this extract a new 'mt7621_pcie_init_virtual_bridges' function where
a similar local variable is used for the same task. This allow us to
properly configure the virtual PCI-PCI bridges in configuration
registers of the mt7621 pci controller. For a correct initiation of
which is connected use 'enabled' field of 'mt7621_pcie_port' struct.
With this change driver probe function gets a bit cleaner and readable.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: factor out 'mt7621_pcie_enable_ports' function
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:44 +0000 (11:49 +0100)]
staging: mt7621-pci: factor out 'mt7621_pcie_enable_ports' function

Driver probe function check for a bit in 'pcie_link_status' for
enabling the pcie port or not. Instead of this add 'enabled' field
in 'mt7621_pcie_port' structure and check its value to achieve this
inside a new 'mt7621_pcie_enable_ports' function. The offsets for
the correct port are derived from the slot of the port. This field
'enabled' is properly initilized in 'mt7621_pcie_init_port'. Also
depending of the number of ports enabled we have to properly init
its registers taking into account that we will use virtual bridges
from zero to num_slots_enabled as follows:
    - Only one enabled -> only enable virtual bridge 0.
    - Two enabled -> enable virtual bridges 0 and 1.
    - Three enabled -> enable virtual bridges 0, 1 and 2.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: use dev_* functions instead of printk
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:43 +0000 (11:49 +0100)]
staging: mt7621-pci: use dev_* functions instead of printk

checkpatch script is complaining about the use of printk instead
of use more proper dev_* kernel functions. Replace all of them
removing warnings.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: use a trailing */ on a separate line
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:42 +0000 (11:49 +0100)]
staging: mt7621-pci: use a trailing */ on a separate line

Chackpatch script is compalining about one comment which
is not following the kernel style. Fix it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: remap and use sysctl from device tree
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:41 +0000 (11:49 +0100)]
staging: mt7621-pci: remap and use sysctl from device tree

There are some pointer read and writes which can be replaced
properly using sysctl registers readed from device tree. Remap
sysctl registers and replace in proper places.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-dts: add sysctl registers base address to pcie
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:40 +0000 (11:49 +0100)]
staging: mt7621-dts: add sysctl registers base address to pcie

Add missing system control registers address in pcie node of
the device tree.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: rename 'mt7621_pcie_enable_port' into 'mt7621_pcie_init_port'
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:39 +0000 (11:49 +0100)]
staging: mt7621-pci: rename 'mt7621_pcie_enable_port' into 'mt7621_pcie_init_port'

Rename function 'mt7621_pcie_enable_port' with a name which is better
for what the function is really doing calling it 'mt7621_pcie_init_port'.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: debug port N_FTS inside 'mt7621_pcie_enable_port'
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:38 +0000 (11:49 +0100)]
staging: mt7621-pci: debug port N_FTS inside 'mt7621_pcie_enable_port'

Move debug for the port N_FTS from driver probe function to the more
appropiate one 'mt7621_pcie_enable_port'.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: factor out 'mt7621_enable_phy' function
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:37 +0000 (11:49 +0100)]
staging: mt7621-pci: factor out 'mt7621_enable_phy' function

Factor out a new function 'mt7621_enable_phy' for enabling the
pcie phy for each port and call it from 'mt7621_pcie_enable_port'.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: rewrite pcie phy related functions
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:36 +0000 (11:49 +0100)]
staging: mt7621-pci: rewrite pcie phy related functions

Function 'bypass_pipe_rst' and 'set_phy_for_ssc' can be
written in a cleaner way. Instead of use comments to see which
bits are the ones which are being enabled add new macros with
that information using BIT and GENMASK kernel macros. Avoid the
use of set_pcie_phy which is kind of dark and use new macros also
resetting and adding bits using bitwise operators directly in the
code. Now these function are offset-based on the port to use them
cleaner in driver probe functio and improving readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: reagroup reset related macros all together
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:35 +0000 (11:49 +0100)]
staging: mt7621-pci: reagroup reset related macros all together

Reset bits related macros are in different parts. Reagroup
all of them together to  improve readability.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: remove reset related unused macros
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:34 +0000 (11:49 +0100)]
staging: mt7621-pci: remove reset related unused macros

There are three macros which are not being used at all.
Remove them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: remove two commented code lines
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:33 +0000 (11:49 +0100)]
staging: mt7621-pci: remove two commented code lines

This two lines whch are commented are not needed at all.
Remove them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: remove GPL2+ text from license header
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:32 +0000 (11:49 +0100)]
staging: mt7621-pci: remove GPL2+ text from license header

This file has a valid SPDX license line added so reamining
GPL2+ boilerplate text is not needed at all. Remove it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: mt7621-pci: remove [ASSERT|DEASSERT]_SYSRST_PCIE macros
Sergio Paracuellos [Sun, 4 Nov 2018 10:49:31 +0000 (11:49 +0100)]
staging: mt7621-pci: remove [ASSERT|DEASSERT]_SYSRST_PCIE macros

Driver is using reset_control kernel API's to manage this so this
two macros are not needed anymore. Remove them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>