platform/kernel/linux-exynos.git
7 years agodrivers: w1: Add 1w slave driver for DS28E05 EEPROM
Andrew Worsley [Sun, 27 Aug 2017 11:34:23 +0000 (21:34 +1000)]
drivers: w1: Add 1w slave driver for DS28E05 EEPROM

Add a one wire driver for the DS28E05 one wire slave chip. This chip
requires OverDrive support to talk to it.

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers: w1: Extend 1W master driver DS2482 with module option to support PPM/SPU...
Andrew Worsley [Sun, 27 Aug 2017 11:34:22 +0000 (21:34 +1000)]
drivers: w1: Extend 1W master driver DS2482 with module option to support PPM/SPU/1WS features

Extend the one wire DS2482 master driver with a module option that allows support
for PPM/SPU/1WS interface modes to be requested. This allows support of chips
that require one or more of these features such as the DS28E05.

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: ds2438: make several functions static
Colin Ian King [Sat, 12 Aug 2017 21:34:03 +0000 (22:34 +0100)]
w1: ds2438: make several functions static

The functions w1_ds2438_get_page, w1_ds2438_get_temperature,
w1_ds2438_change_config_bit and w1_ds2438_get_voltage are local to
the source and do not need to be in global scope, so make it static.

Cleans up sparse warnings:
symbol 'w1_ds2438_get_page' was not declared. Should it be static?
symbol 'w1_ds2438_get_temperature' was not declared. Should it be static?
symbol 'w1_ds2438_change_config_bit' was not declared. Should it be static?
symbol 'w1_ds2438_get_voltage' was not declared. Should it be static?

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: ds1wm: add messages to make incorporation in mfd-drivers easier
Johannes Poehlmann [Tue, 25 Jul 2017 11:27:15 +0000 (13:27 +0200)]
w1: ds1wm: add messages to make incorporation in mfd-drivers easier

w1: ds1wm: add messages to make incorporation in mfd-drivers easier

Signed-off-by: Johannes Poehlmann <johannes.poehlmann@izt-labs.de>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: ds1wm: silence interrupts on HW before claiming the interrupt
Johannes Poehlmann [Tue, 25 Jul 2017 11:27:14 +0000 (13:27 +0200)]
w1: ds1wm: silence interrupts on HW before claiming the interrupt

w1: ds1wm: silence interrupts on HW before claiming the interrupt.
This way avoid possible invalid interrupts in the initialization phase.

Signed-off-by: Johannes Poehlmann <johannes.poehlmann@izt-labs.de>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: ds1wm: add level interrupt modes
Johannes Poehlmann [Tue, 25 Jul 2017 11:27:13 +0000 (13:27 +0200)]
w1: ds1wm: add level interrupt modes

w1: ds1wm: add level interrupt modes

Signed-off-by: Johannes Poehlmann <johannes.poehlmann@izt-labs.de>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: ds1wm: make endian clean and use standard io memory accessors
Johannes Poehlmann [Tue, 25 Jul 2017 11:27:12 +0000 (13:27 +0200)]
w1: ds1wm: make endian clean and use standard io memory accessors

o Make endian clean, make HW-endianness configurable.

o Use ioread*, iowrite* instead of __raw_readb,__raw_writeb
  to also use memory-barriers when accessing HW-registers.
  We do not want reordering to happen here.

Both changes are tightly coupled, so I do them in one patch

Signed-off-by: Johannes Poehlmann <johannes.poehlmann@izt-labs.de>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: ds1wm: fix register offset (bus shift) calculation
Johannes Poehlmann [Tue, 25 Jul 2017 11:27:11 +0000 (13:27 +0200)]
w1: ds1wm: fix register offset (bus shift) calculation

Replace incorrect register offsett calculation by
direct configuration of bus_shift in mfd-cell.

Indirect definition of address-shift by resource size
was unobvious and was wrong (should have used a binary log).

Signed-off-by: Johannes Poehlmann <johannes.poehlmann@izt-labs.de>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: ds2490: constify usb_device_id and fix space before '[' error
Arvind Yadav [Sat, 12 Aug 2017 08:38:02 +0000 (14:08 +0530)]
w1: ds2490: constify usb_device_id and fix space before '[' error

usb_device_id are not supposed to change at runtime. All functions
working with usb_device_id provided by <linux/usb.h> work with
const usb_device_id. So mark the non-const structs as const.

Fix checkpatch.pl error:
ERROR: space prohibited before open square bracket '['.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agochar: tlclk: constify attribute_group structures.
Arvind Yadav [Wed, 2 Aug 2017 11:19:05 +0000 (16:49 +0530)]
char: tlclk: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agow1: constify attribute_group structures.
Arvind Yadav [Fri, 28 Jul 2017 10:30:42 +0000 (16:00 +0530)]
w1: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/fsi/scom: Remove reset before every putscom
Edward A. James [Thu, 20 Jul 2017 14:55:32 +0000 (09:55 -0500)]
drivers/fsi/scom: Remove reset before every putscom

Reset causes problems for operations requiring multiple scoms (e.g. i2c
over scom). Instead, reset scom engine during probe.

Signed-off-by: Edward A. James <eajames@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/fsi: add const to bin_attribute structures
Bhumika Goyal [Wed, 2 Aug 2017 14:09:32 +0000 (19:39 +0530)]
drivers/fsi: add const to bin_attribute structures

Declare bin_attribute structures as const as they are only passed as an
argument to the function device_create_bin_file. This argument is of
type const, so declare the structure as const.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomux: zap mux- prefix from the source files
Peter Rosin [Tue, 22 Aug 2017 06:27:08 +0000 (08:27 +0200)]
mux: zap mux- prefix from the source files

Preserve the module names with Makefile additions.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomux: include compiler.h from mux/consumer.h
Ulrich Hecht [Tue, 22 Aug 2017 06:27:07 +0000 (08:27 +0200)]
mux: include compiler.h from mux/consumer.h

Required for __must_check.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomux: convert to using %pOF instead of full_name
Rob Herring [Tue, 22 Aug 2017 06:27:06 +0000 (08:27 +0200)]
mux: convert to using %pOF instead of full_name

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoapplicom: constify pci_device_id.
Arvind Yadav [Tue, 1 Aug 2017 16:01:57 +0000 (21:31 +0530)]
applicom: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agochar: xilinx_hwicap: Fix warnings in the driver
Nava kishore Manne [Fri, 28 Jul 2017 13:17:26 +0000 (15:17 +0200)]
char: xilinx_hwicap: Fix warnings in the driver

This patch fixes the below warning
        --> Use #include <linux/io.h> instead of <asm/io.h>
        --> Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
        --> please, no space before tabs
        --> Block comments use a trailing */ on a separate line
        --> Possible unnecessary 'out of memory' message
        --> Block comments use * on subsequent lines
        --> Block comments use a trailing */ on a separate line
        --> braces {} are not necessary for any arm of this statement
        --> DT compatible string "xlnx,opb-hwicap-1.00.b"
    appears un-documented
        --> DT compatible string "xlnx,xps-hwicap-1.00.a"
            appears un-documented

Signed-off-by: Nava kishore Manne <navam@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agochar: xilinx_hwicap: Fix kernel doc warnings
Nava kishore Manne [Fri, 28 Jul 2017 13:17:25 +0000 (15:17 +0200)]
char: xilinx_hwicap: Fix kernel doc warnings

This patch fixes the kernel doc warnings in the driver.

Signed-off-by: Nava kishore Manne <navam@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge tag 'extcon-next-for-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Mon, 28 Aug 2017 15:01:04 +0000 (17:01 +0200)]
Merge tag 'extcon-next-for-4.14' of git://git./linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for 4.14

Detailed description for this pull request:
1. Add new 'extcon-usbc-cros-ec.c' driver
- ChromeOS Embedded Controller extcon driver supports
  the detection of the Display Port (EXTCON_DISP_DP)
  through USB C-type and contol it.

2. Update extcon core
- Modify the description for both functions and structures
  in order to improve the readability and give the more correct
  guide about the role of functions because there are different
  explanation even if the same arguments.

- Keep the indentation with tab instead of space

- Remove the following deprecated extcon API. The deprecated API
  are exchanged on all of linux tree.
  : extcon_get_cable_state_() -> extcon_get_state()
  : extcon_set_cable_state_() -> extcon_set_state_sync()

3. Include the two immutable branch as following:
- ib-extcon-mfd-4.14 for the 'extcon-ubsc-cros-ec.c' driver
  because the patches of 'extcon-ubsc-cros-ec.c' touch the MFD directory.
- ib-extcon-usb-phy-4.14 for removing the deprecated extcon API
  because the usb/phy driver usese the deprecated extcon API.
  So, this immutable branch alters the extcon API and then
  remove them from extcon.

4. Fix minor issue of extcon driver
- Fix the MHL detection on extcon-max77693.c
- Convert to using %pOF instead of full_name on extcon.c
- Add 'const' kerywod for acpi_device_id on extcon-intel-int3496.c

7 years agoMerge tag 'stm-for-greg-20170825' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Mon, 28 Aug 2017 14:58:19 +0000 (16:58 +0200)]
Merge tag 'stm-for-greg-20170825' of git://git./linux/kernel/git/ash/stm into char-misc-next

Alexander writes:

stm class / intel_th: Updates for 4.14

Intel TH:
 * Updated subdevice management code to better fit host mode
 * Added support for Low Power Path (LPP) output type
 * Fixed memory allocation with IOMMU enabled (DMAR tables)
 * Added Cannon Lake PCH PCI IDs
 * Added a quirk to force time sync on devices that need it

STM:
 * Fixed potential read overflow in ioctl()
 * Documented stm_ftrace source.

7 years agovmci: fix duplicated code for different branches
Gustavo A. R. Silva [Fri, 18 Aug 2017 01:43:10 +0000 (20:43 -0500)]
vmci: fix duplicated code for different branches

Refactor code in order to avoid identical code for different branches.

This issue was detected with the help of Coccinelle.

Addresses-Coverity-ID: 1226762
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: apds9802als: constify i2c_device_id
Arvind Yadav [Mon, 21 Aug 2017 16:43:25 +0000 (22:13 +0530)]
misc: apds9802als: constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions
working with i2c_device_id provided by <linux/i2c.h> work with
const i2c_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: hmc6352: constify i2c_device_id
Arvind Yadav [Mon, 21 Aug 2017 16:43:26 +0000 (22:13 +0530)]
misc: hmc6352: constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions
working with i2c_device_id provided by <linux/i2c.h> work with
const i2c_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: isl29020: constify i2c_device_id
Arvind Yadav [Mon, 21 Aug 2017 16:43:27 +0000 (22:13 +0530)]
misc: isl29020: constify i2c_device_id

i2c_device_id are not supposed to change at runtime. All functions
working with i2c_device_id provided by <linux/i2c.h> work with
const i2c_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: Convert to using %pOF instead of full_name
Rob Herring [Tue, 18 Jul 2017 21:43:15 +0000 (16:43 -0500)]
misc: Convert to using %pOF instead of full_name

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: apds9802als: constify attribute_group structures.
Arvind Yadav [Fri, 4 Aug 2017 06:37:52 +0000 (12:07 +0530)]
misc: apds9802als: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: apds990x: constify attribute_group structures.
Arvind Yadav [Fri, 4 Aug 2017 06:37:53 +0000 (12:07 +0530)]
misc: apds990x: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: bh1770glc: constify attribute_group structures.
Arvind Yadav [Fri, 4 Aug 2017 06:37:54 +0000 (12:07 +0530)]
misc: bh1770glc: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: isl29020: constify attribute_group structures.
Arvind Yadav [Fri, 4 Aug 2017 06:37:55 +0000 (12:07 +0530)]
misc: isl29020: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: lis3lv02d: constify attribute_group structures.
Arvind Yadav [Fri, 4 Aug 2017 06:37:56 +0000 (12:07 +0530)]
misc: lis3lv02d: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: ti-st: constify attribute_group structures.
Arvind Yadav [Fri, 4 Aug 2017 06:37:57 +0000 (12:07 +0530)]
misc: ti-st: constify attribute_group structures.

attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMISC: add const to bin_attribute structures
Bhumika Goyal [Wed, 2 Aug 2017 09:10:06 +0000 (14:40 +0530)]
MISC: add const to bin_attribute structures

Add const to bin_attribute structures as they are only passed to the
functions sysfs_{remove/create}_bin_file. The arguments passed are of
type const, so declare the structures to be const.

Done using Coccinelle.

@m disable optional_qualifier@
identifier s;
position p;
@@
static struct bin_attribute s@p={...};

@okay1@
position p;
identifier m.s;
@@
(
sysfs_create_bin_file(...,&s@p,...)
|
sysfs_remove_bin_file(...,&s@p,...)
)

@bad@
position p!={m.p,okay1.p};
identifier m.s;
@@
s@p

@change depends on !bad disable optional_qualifier@
identifier m.s;
@@
static
+const
struct bin_attribute s={...};

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: pch_phub: constify pci_device_id.
Arvind Yadav [Sun, 30 Jul 2017 05:26:34 +0000 (10:56 +0530)]
misc: pch_phub: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: hpilo: constify pci_device_id.
Arvind Yadav [Sun, 30 Jul 2017 05:26:35 +0000 (10:56 +0530)]
misc: hpilo: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: tifm: constify pci_device_id.
Arvind Yadav [Sun, 30 Jul 2017 05:26:36 +0000 (10:56 +0530)]
misc: tifm: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

checkpatch ERROR: space prohibited before open square bracket '['

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: ioc4: constify pci_device_id.
Arvind Yadav [Sun, 30 Jul 2017 05:26:37 +0000 (10:56 +0530)]
misc: ioc4: constify pci_device_id.

pci_device_id are not supposed to change at runtime. All functions
working with pci_device_id provided by <linux/pci.h> work with
const pci_device_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: eeprom_93xx46: Include <linux/gpio/consumer.h>
Fabio Estevam [Thu, 20 Jul 2017 02:35:29 +0000 (23:35 -0300)]
misc: eeprom_93xx46: Include <linux/gpio/consumer.h>

eeprom_93xx46_platform_data struct has a 'struct gpio_desc'
type member, so it is better to include <linux/gpio/consumer.h>,
which provides 'struct gpio_desc' type.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agomisc: eeprom_93xx46: Simplify the usage of gpiod API
Fabio Estevam [Thu, 20 Jul 2017 02:35:28 +0000 (23:35 -0300)]
misc: eeprom_93xx46: Simplify the usage of gpiod API

Commit 3ca9b1ac28398c ("misc: eeprom_93xx46: Add support for a GPIO
'select' line.") introduced the optional usage of 'select-gpios'
by using the gpiod API in a convoluted way.

Rewrite the gpiod handling to make the code simpler.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agofirmware: vpd: use memunmap instead of iounmap
Pan Bian [Thu, 10 Aug 2017 23:13:13 +0000 (07:13 +0800)]
firmware: vpd: use memunmap instead of iounmap

In functions vpd_sections_init() and vpd_section_init(), iounmap() is
used to unmap memory. However, in these cases, memunmap() should be
used.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoandroid: binder: Add shrinker tracepoints
Sherry Yang [Wed, 23 Aug 2017 15:46:43 +0000 (08:46 -0700)]
android: binder: Add shrinker tracepoints

Add tracepoints in binder transaction allocator to
record lru hits and alloc/free page.

Signed-off-by: Sherry Yang <sherryy@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoandroid: binder: Add global lru shrinker to binder
Sherry Yang [Wed, 23 Aug 2017 15:46:42 +0000 (08:46 -0700)]
android: binder: Add global lru shrinker to binder

Hold on to the pages allocated and mapped for transaction
buffers until the system is under memory pressure. When
that happens, use linux shrinker to free pages. Without
using shrinker, patch "android: binder: Move buffer out
of area shared with user space" will cause a significant
slow down for small transactions that fit into the first
page because free list buffer header used to be inlined
with buffer data.

In addition to prevent the performance regression for
small transactions, this patch improves the performance
for transactions that take up more than one page.

Modify alloc selftest to work with the shrinker change.

Test: Run memory intensive applications (Chrome and Camera)
to trigger shrinker callbacks. Binder frees memory as expected.
Test: Run binderThroughputTest with high memory pressure
option enabled.

Signed-off-by: Sherry Yang <sherryy@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoandroid: binder: Move buffer out of area shared with user space
Sherry Yang [Wed, 23 Aug 2017 15:46:41 +0000 (08:46 -0700)]
android: binder: Move buffer out of area shared with user space

Binder driver allocates buffer meta data in a region that is mapped
in user space. These meta data contain pointers in the kernel.

This patch allocates buffer meta data on the kernel heap that is
not mapped in user space, and uses a pointer to refer to the data mapped.

Signed-off-by: Sherry Yang <sherryy@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoandroid: binder: Add allocator selftest
Sherry Yang [Wed, 23 Aug 2017 15:46:40 +0000 (08:46 -0700)]
android: binder: Add allocator selftest

binder_alloc_selftest tests that alloc_new_buf handles page allocation and
deallocation properly when allocate and free buffers. The test allocates 5
buffers of various sizes to cover all possible page alignment cases, and
frees the buffers using a list of exhaustive freeing order.

Test: boot the device with ANDROID_BINDER_IPC_SELFTEST config option
enabled. Allocator selftest passes.

Signed-off-by: Sherry Yang <sherryy@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoandroid: binder: Refactor prev and next buffer into a helper function
Sherry Yang [Wed, 23 Aug 2017 15:46:39 +0000 (08:46 -0700)]
android: binder: Refactor prev and next buffer into a helper function

Use helper functions buffer_next and buffer_prev instead
of list_entry to get the next and previous buffers.

Signed-off-by: Sherry Yang <sherryy@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/fmc: carrier can program FPGA on registration
Federico Vaga [Tue, 18 Jul 2017 06:33:24 +0000 (08:33 +0200)]
drivers/fmc: carrier can program FPGA on registration

The initial FPGA may require programming before it is useful.

Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Tested-by: Pat Riehecky <riehecky@fnal.gov>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/fmc: change registration prototype
Federico Vaga [Tue, 18 Jul 2017 06:33:13 +0000 (08:33 +0200)]
drivers/fmc: change registration prototype

Permit use of either fmc_device_register_n or fmc_device_register_n_gw
depending on the type of device in use.

Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Tested-by: Pat Riehecky <riehecky@fnal.gov>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/fmc: The only way to dump the SDB is from debugfs
Federico Vaga [Tue, 18 Jul 2017 06:33:03 +0000 (08:33 +0200)]
drivers/fmc: The only way to dump the SDB is from debugfs

Driver should not call fmc_sdb_dump() anymore. (actually they can but the
operation is not supported, so it will print an error message)

Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Tested-by: Pat Riehecky <riehecky@fnal.gov>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/fmc: hide fmc operations behind helpers
Federico Vaga [Tue, 18 Jul 2017 06:32:53 +0000 (08:32 +0200)]
drivers/fmc: hide fmc operations behind helpers

This gave us more freedom to change/add/remove operations without
recompiling all device driver.

Typically, Carrier board implement the fmc operations, so they will not
use these helpers.

Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Tested-by: Pat Riehecky <riehecky@fnal.gov>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodrivers/fmc: remove unused variable
Federico Vaga [Tue, 18 Jul 2017 06:32:42 +0000 (08:32 +0200)]
drivers/fmc: remove unused variable

Signed-off-by: Federico Vaga <federico.vaga@cern.ch>
Tested-by: Pat Riehecky <riehecky@fnal.gov>
Acked-by: Alessandro Rubini <rubini@gnudd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agothunderbolt: Fix reset response_type
Dan Carpenter [Wed, 16 Aug 2017 08:54:17 +0000 (11:54 +0300)]
thunderbolt: Fix reset response_type

There is a mistake here where we accidentally use sizeof(TB_CFG_PKG_RESET)
instead of just TB_CFG_PKG_RESET.  The size of an int is 4 so it's the
same as TB_CFG_PKG_NOTIFY_ACK.

Fixes: d7f781bfdbf4 ("thunderbolt: Rework control channel to be more reliable")
Reported-by: Colin King <colin.king@canonical.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: stable <stable@vger.kernel.org> # 4.13
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agothunderbolt: Allow clearing the key
Bernat, Yehezkel [Tue, 15 Aug 2017 05:19:20 +0000 (08:19 +0300)]
thunderbolt: Allow clearing the key

If secure authentication of a devices fails, either because the device
already has another key uploaded, or there is some other error sending
challenge to the device, and the user only wants to approve the device
just once (without a new key being uploaded to the device) the current
implementation does not allow this because the key cannot be cleared
once set even if we allow it to be changed.

Make this scenario possible and allow clearing the key by writing
empty string to the key sysfs file.

Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agothunderbolt: Make key root-only accessible
Bernat, Yehezkel [Tue, 15 Aug 2017 05:19:12 +0000 (08:19 +0300)]
thunderbolt: Make key root-only accessible

Non-root user may read the key back after root wrote it there.
This removes read access to everyone but root.

Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agothunderbolt: Remove superfluous check
Bernat, Yehezkel [Tue, 15 Aug 2017 05:19:01 +0000 (08:19 +0300)]
thunderbolt: Remove superfluous check

The key size is tested by hex2bin() already (as '\0' isn't an hex digit)

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Yehezkel Bernat <yehezkel.bernat@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:35:57 +0000 (22:05 +0530)]
coresight: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etb10: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:35:58 +0000 (22:05 +0530)]
coresight: etb10: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm3x: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:35:59 +0000 (22:05 +0530)]
coresight: etm3x: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:36:00 +0000 (22:06 +0530)]
coresight: etm4x: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: funnel: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:36:01 +0000 (22:06 +0530)]
coresight: funnel: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: replicator: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:36:02 +0000 (22:06 +0530)]
coresight: replicator: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: stm: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:36:03 +0000 (22:06 +0530)]
coresight: stm: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: tmc: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:36:04 +0000 (22:06 +0530)]
coresight: tmc: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: tpiu: constify amba_id
Arvind Yadav [Thu, 24 Aug 2017 16:36:05 +0000 (22:06 +0530)]
coresight: tpiu: constify amba_id

amba_id are not supposed to change at runtime. All functions
working with const amba_id. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: STM: Clean up __iomem type usage
Stephen Boyd [Wed, 2 Aug 2017 16:22:20 +0000 (10:22 -0600)]
coresight: STM: Clean up __iomem type usage

The casting and other things here is odd, and causes sparse to
complain:

drivers/hwtracing/coresight/coresight-stm.c:279:35: warning: incorrect type in argument 1 (different address spaces)
drivers/hwtracing/coresight/coresight-stm.c:279:35:    expected void [noderef] <asn:2>*addr
drivers/hwtracing/coresight/coresight-stm.c:279:35:    got struct stm_drvdata *drvdata
drivers/hwtracing/coresight/coresight-stm.c:327:17: warning: incorrect type in argument 2 (different address spaces)
drivers/hwtracing/coresight/coresight-stm.c:327:17:    expected void volatile [noderef] <asn:2>*addr
drivers/hwtracing/coresight/coresight-stm.c:327:17:    got void *addr
drivers/hwtracing/coresight/coresight-stm.c:330:17: warning: incorrect type in argument 2 (different address spaces)
drivers/hwtracing/coresight/coresight-stm.c:330:17:    expected void volatile [noderef] <asn:2>*addr
drivers/hwtracing/coresight/coresight-stm.c:330:17:    got void *addr
drivers/hwtracing/coresight/coresight-stm.c:333:17: warning: incorrect type in argument 2 (different address spaces)
drivers/hwtracing/coresight/coresight-stm.c:333:17:    expected void volatile [noderef] <asn:2>*addr
drivers/hwtracing/coresight/coresight-stm.c:333:17:    got void *addr

>From what I can tell, we don't really need to treat ch_addr as
anything besides a pointer, and we can just do pointer math
instead of ORing in the bits of the offset and achieve the same
thing.

Also, we were passing a drvdata pointer to the
coresight_timeout() function, but we really wanted to pass the
address of the register base. Luckily the base is the first
member of the structure, so everything works out, but this is
quite unsafe if we ever change the structure layout. Clean this
all up so sparse stops complaining on this code.

Reported-by: Satyajit Desai <sadesai@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: Add support for Coresight SoC 600 components
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:18 +0000 (10:22 -0600)]
coresight: Add support for Coresight SoC 600 components

Add the peripheral ids for the Coresight SoC 600 TPIU, replicator
and funnel.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc: Add support for Coresight SoC 600 TMC
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:17 +0000 (10:22 -0600)]
coresight tmc: Add support for Coresight SoC 600 TMC

The coresight SoC 600 supports ETR save-restore which allows us
to restore a trace session by retaining the RRP/RWP/STS.Full values
when the TMC leaves the Disabled state. However, the TMC doesn't
have a scatter-gather unit in built.

Also, TMCs have different PIDs in different configurations (ETF,
ETB & ETR), unlike the previous generation.

While the DEVID exposes some of the features/changes in the TMC,
it doesn't explicitly advertises the new save-restore feature
as described above.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc: Support for save-restore in ETR
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:16 +0000 (10:22 -0600)]
coresight tmc: Support for save-restore in ETR

The Coresight SoC 600 TMC ETR supports save-restore feature,
where the values of the RRP/RWP and STS.Full are retained
when it leaves the Disabled state. Hence, we must program the
RRP/RWP and STS.Full to a proper value. For now, set the RRP/RWP
to the base address of the buffer and clear the STS.Full register.
This can be later exploited for proper save-restore of ETR
trace contexts (e.g, perf).

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc etr: Setup AXI cache encoding for read transfers
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:15 +0000 (10:22 -0600)]
coresight tmc etr: Setup AXI cache encoding for read transfers

If the ETR supports split cache encoding (i.e, separate bits for
read and write transfers) unlike the older version (where read
and write transfers use the same encoding in AXICTL[2-5]).
This feature is not advertised and has to be described by the
static mask associated with the device id.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc etr: Cleanup AXICTL register handling
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:14 +0000 (10:22 -0600)]
coresight tmc etr: Cleanup AXICTL register handling

This patch cleans up how we setup the AXICTL register on
TMC ETR. At the moment we don't set the CacheCtrl bits, which
drives the arcache and awcache bits on AXI bus specifying the
cacheablitiy. Set this to Write-back Read and Write-allocate.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc etr: Detect address width at runtime
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:13 +0000 (10:22 -0600)]
coresight tmc etr: Detect address width at runtime

TMC in Coresight SoC-600 advertises the AXI address width
in the device configuration register.

Bit 16 - AXIAW_VALID
 0 - AXI Address Width not valid
 1 - Valid AXI Address width in Bits[23-17]

Bits [23-17] - AXIAW. If AXIAW_VALID = b01 then
 0x20 - 32bit AXI address bus
 0x28 - 40bit AXI address bus
 0x2c - 44bit AXI address bus
 0x30 - 48bit AXI address bus
 0x34 - 52bit AXI address bus

Use the address bits from the device configuration register, if
available. Otherwise, default to 40bit.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc: Detect support for scatter gather
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:12 +0000 (10:22 -0600)]
coresight tmc: Detect support for scatter gather

The SG unit in the TMC has been removed in Coresight SoC-600.
This is however advertised by DEVID:Bit 24 = 0b1. On the
previous generation, the bit is RES0, hence we can rely on the
DEVID to detect the support.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc etr: Add capabilitiy information
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:11 +0000 (10:22 -0600)]
coresight tmc etr: Add capabilitiy information

With new version of TMC ETR, there are differing set of
features supported by the TMC. Add the capability of a
given TMC ETR for making safer decisions at runtime.

The device configuration register of the TMC (DEVID) lists
some of the capabilities. So, we can detect some of them at
probe. However, some of the features (or changes in behavior)
are not advertised and we have to depend on the PID to infer
the features. So we use a static description of the "unadvertised"
capabilities attached to the PID. Combining both, the static
and the dynamic capabilities, we maintain a bitmask of the
available features which can be later checked to take
appropriate actions.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc: Handle configuration types properly
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:10 +0000 (10:22 -0600)]
coresight tmc: Handle configuration types properly

Coresight SoC 600 defines a new configuration for TMC, Embedded Trace
Streamer (ETS), indicated by 0x3 in MODE:CONFIG_TYPE. This would break
the existing driver which will treat anything other than ETR/ETB as an
ETF. Fix the driver to check the configuration type properly and also
add a warning if we encounter an unsupported configuration (ETS).

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight replicator: Expose replicator management registers
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:09 +0000 (10:22 -0600)]
coresight replicator: Expose replicator management registers

Expose the idfilter* registers of the programmable replicator.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc: Expose DBA and AXICTL
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:08 +0000 (10:22 -0600)]
coresight tmc: Expose DBA and AXICTL

Expose DBALO,DBAHI and AXICTL registers

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight tmc: Add helpers for accessing 64bit registers
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:07 +0000 (10:22 -0600)]
coresight tmc: Add helpers for accessing 64bit registers

Coresight TMC splits 64bit registers into a pair of 32bit registers
(e.g DBA, RRP, RWP). Provide helpers to read/write to these registers.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: Use the new helper for defining registers
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:06 +0000 (10:22 -0600)]
coresight: Use the new helper for defining registers

Use the new helpers for exposing coresight component registers,
choosing the 64bit variants for appropriate registers.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: Add support for reading 64bit registers
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:05 +0000 (10:22 -0600)]
coresight: Add support for reading 64bit registers

Add support for reading a lower and upper 32bits of a register
as a single 64bit register. Also add simplified macros for
direct register accesses.

Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight replicator: Cleanup programmable replicator naming
Suzuki K Poulose [Wed, 2 Aug 2017 16:22:04 +0000 (10:22 -0600)]
coresight replicator: Cleanup programmable replicator naming

The Linux coresight drivers define the programmable ATB replicator as
Qualcomm replicator, while this is designed by ARM. This can cause
confusion to a user selecting the driver. Cleanup all references to
make it explicitly clear. This patch :

 1) Replace the compatible string for the replicator :
      qcom,coresight-replicator1x => arm,coresight-dynamic-replicator
 2) Changes the Kconfig symbol (since this is not part of any defconfigs)
     CORESIGHT_QCOM_REPLICATOR => CORESIGHT_DYNAMIC_REPLICATOR
 3) Improves the help message in the Kconfig.
 4) Changes the name of the driver and the file :
      coresight-replicator-qcom => coresight-dynamic-replicator

Cc: Pratik Patel <pratikp@codeaurora.org>
Cc: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: devicetree@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Acked-by: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm4x: Adds trace return stack option programming for ETMv4.
Mike Leach [Wed, 2 Aug 2017 16:22:03 +0000 (10:22 -0600)]
coresight: etm4x: Adds trace return stack option programming for ETMv4.

Adds handling to program the return stack option into ETMv4 hardware if
specified in the perf command line.

If option is not supported by the hardware then it will be ignored.
This allows capture to move between core/ETM combinations that have the
hardware support to those that do not.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: ptm: Adds trace return stack option programming for PTM.
Mike Leach [Wed, 2 Aug 2017 16:22:02 +0000 (10:22 -0600)]
coresight: ptm: Adds trace return stack option programming for PTM.

Adds handling to program the return stack option into PTM hardware if
specified in the perf command line.

If option is not supported by the hardware then it will be ignored.
This allows capture to move between core/ETM combinations that have the
hardware support to those that do not.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: pmu: Adds return stack option to perf coresight pmu
Mike Leach [Wed, 2 Aug 2017 16:22:01 +0000 (10:22 -0600)]
coresight: pmu: Adds return stack option to perf coresight pmu

Return stack is a programmable option on some ETM and PTM hardware.
Adds the option flags to enable this from the perf event command line.

Signed-off-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agohwtracing: coresight: constify attribute_group structures.
Arvind Yadav [Wed, 2 Aug 2017 16:22:00 +0000 (10:22 -0600)]
hwtracing: coresight: constify attribute_group structures.

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work with const
attribute_group. So mark the non-const structs as const.

File size before:
  text    data     bss     dec     hex filename
   2573     288     296    3157     c55 coresight-etm-perf.o

File size After adding 'const':
   text    data     bss     dec     hex filename
   2613     224     296    3133     c3d coresight-etm-perf.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etm3x: Set synchronisation frequencty to TRM default
Mathieu Poirier [Wed, 2 Aug 2017 16:21:59 +0000 (10:21 -0600)]
coresight: etm3x: Set synchronisation frequencty to TRM default

Register ETMSYNCFR holds the number of by that need to be generated before
periodic synchronisation packets are inserted in the trace stream.  By
zeroing out the config structure, the current code effectively disable
periodic synchronization.

This patch simply initialise the recommended value for this register as
specified in the technical reference manual.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etb10: Move etb_disable_hw() outside of lock
Mathieu Poirier [Wed, 2 Aug 2017 16:21:58 +0000 (10:21 -0600)]
coresight: etb10: Move etb_disable_hw() outside of lock

Function etb_disable_hw() is already taking care of unlocking and locking
the coresight access register and as such doesn't need to be placed
within the unlock/lock of function etb_update_buffer().

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: Add barrier packet for synchronisation
Mathieu Poirier [Wed, 2 Aug 2017 16:21:57 +0000 (10:21 -0600)]
coresight: Add barrier packet for synchronisation

When a buffer overflow happens the synchronisation patckets usually
present at the beginning of the buffer are lost, a situation that
prevents the decoder from knowing the context of the traces being
decoded.

This patch adds a barrier packet to be used by sink IPs when a buffer
overflow condition is detected.  These barrier packets are then used
by the decoding library as markers to force re-synchronisation.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: etb10: Remove useless conversion to LE
Mathieu Poirier [Wed, 2 Aug 2017 16:21:56 +0000 (10:21 -0600)]
coresight: etb10: Remove useless conversion to LE

Internal CoreSight components are rendering trace data in little-endian
format.  As such there is no need to convert the data once more, hence
removing the extra step.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agocoresight: Correct buffer lost increment
Mathieu Poirier [Wed, 2 Aug 2017 16:21:55 +0000 (10:21 -0600)]
coresight: Correct buffer lost increment

Many conditions may cause synchronisation to be lost when updating
the perf ring buffer but the end result is still the same: synchronisation
is lost.  As such there is no need to increment the lost count for each
condition, just once will suffice.

Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: Move the ownership check to irq_chip callback
Kiran Gunda [Wed, 23 Aug 2017 12:46:26 +0000 (18:16 +0530)]
spmi: pmic-arb: Move the ownership check to irq_chip callback

Check the irq ownership in the irq_request_resources callback
instead of checking it during the irq mapping. This can prevent
installing the flow handler for the interrupt that is not owned by the EE
and allow the irq translation during the gpio driver probe.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Tested-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: Convert to using %pOF instead of full_name
Rob Herring [Tue, 18 Jul 2017 21:43:32 +0000 (16:43 -0500)]
spmi: Convert to using %pOF instead of full_name

Now that we have a custom printf format specifier, convert users of
full_name to use %pOF instead. This is preparation to remove storing
of the full path string for each node.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: Remove checking opc value not less than 0
Fenglin Wu [Fri, 28 Jul 2017 07:10:47 +0000 (12:40 +0530)]
spmi: pmic-arb: Remove checking opc value not less than 0

The opc parameter in pmic_arb_write_cmd() function is defined with type
u8 and it's always greater than or equal to 0. Checking that it's not
less than 0 is redundant and it can cause a forbidden warning during
compilation. Remove the check.

Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: add support for HW version 5
David Collins [Fri, 28 Jul 2017 07:10:46 +0000 (12:40 +0530)]
spmi: pmic-arb: add support for HW version 5

Add support for version 5 of the SPMI PMIC arbiter.  It utilizes
different offsets for registers than those found on version 3.
Also, the procedure to determine if writing and IRQ access is
allowed for a given PPID changes for version 5.

Signed-off-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: fix a possible null pointer dereference
Kiran Gunda [Fri, 28 Jul 2017 07:10:45 +0000 (12:40 +0530)]
spmi: pmic-arb: fix a possible null pointer dereference

If "core" memory resource is not specified, then the driver could
end up dereferencing a null pointer. Fix this issue.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: return __iomem pointer instead of offset
Kiran Gunda [Fri, 28 Jul 2017 07:10:44 +0000 (12:40 +0530)]
spmi: pmic-arb: return __iomem pointer instead of offset

Modify the pmic_arb version ops to return an __iomem pointer
to the address instead of an offset. That way we do not need to
care about the base address changes in the new HW version.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: use irq_chip callback to set spmi irq wakeup capability
Kiran Gunda [Fri, 28 Jul 2017 07:10:43 +0000 (12:40 +0530)]
spmi: pmic-arb: use irq_chip callback to set spmi irq wakeup capability

Currently the driver sets the pmic arbiter core interrupt as wakeup capable
irrespective of the child irqs which causes the system to wakeup
unnecessarily. To fix this, set the core interrupt as wakeup capable
only if any of the child irqs request for it. Do this by marking it as
wakeup capable in the irq_set_wake callback.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: return the value instead of passing by pointer
Kiran Gunda [Fri, 28 Jul 2017 07:10:42 +0000 (12:40 +0530)]
spmi: pmic-arb: return the value instead of passing by pointer

Returning the output value from a function, when it is possible, is the
better and cleaner way than passing it by the pointer. Hence, modify
the ppid_to_apid mapping function to return apid instead of passing
it by a pointer. While at it, pass the ppid as function parameter to
ppid_to_apid mapping function instead of passing the sid and addr.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: replace the writel_relaxed with __raw_writel
Kiran Gunda [Fri, 28 Jul 2017 07:10:41 +0000 (12:40 +0530)]
spmi: pmic-arb: replace the writel_relaxed with __raw_writel

Replace the writel_relaxed with __raw_writel to avoid byte swapping
in pmic_arb_write_data() function. That way the code is independent
of the CPU endianness.

Fixes: 111a10bf3e53 ("spmi: pmic-arb: rename spmi_pmic_arb_dev to
spmi_pmic_arb")
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: fix memory allocation for mapping_table
Kiran Gunda [Fri, 28 Jul 2017 07:10:40 +0000 (12:40 +0530)]
spmi: pmic-arb: fix memory allocation for mapping_table

Allocate the correct memory size (max_pmic_peripherals) for the
mapping_table that holds the apid to ppid mapping. Also use a local
variable for mapping_table for better alignment of the code.

Fixes: 987a9f128b8a ("spmi: pmic-arb: Support more than 128 peripherals")
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: optimize qpnpint_irq_set_type function
Kiran Gunda [Fri, 28 Jul 2017 07:10:39 +0000 (12:40 +0530)]
spmi: pmic-arb: optimize qpnpint_irq_set_type function

Optimize the qpnpint_irq_set_type() by using a local variable
to hold the handler type. Also clean up other variable usage.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agospmi: pmic-arb: clean up pmic_arb_find_apid function
Kiran Gunda [Fri, 28 Jul 2017 07:10:38 +0000 (12:40 +0530)]
spmi: pmic-arb: clean up pmic_arb_find_apid function

Clean up the pmic_arb_find_apid() by using the local
variables to improve the code readability.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>