Re: [PATCH RFC/RFT] sched/fair: Improve the behavior of sync flag

2017-08-27 Thread Mike Galbraith
On Sat, 2017-08-26 at 23:39 -0700, Joel Fernandes wrote:
> 
> > P.S. to get the most bang for your synchronous buck, you want a
> > preemptive wakeup.. but that butts heads with the fair engine.
> >
> 
> By preemptive wake up I guess you mean the waker would give up its
> time slice and let the wakee use it? That's a cool idea but I agree it
> would be against the fair task behavior.

No, I meant a preemption, that being the cheapest switch.  Any mucking
about with vruntime is a non-starter (NAK bait), making guaranteed
preemption a non-starter.

-Mike 




[GIT PULL] Staging/IIO driver fixes for 4.13-rc7

2017-08-27 Thread Greg KH
The following changes since commit ef954844c7ace62f773f4f23e28d2d915adc419f:

  Linux 4.13-rc5 (2017-08-13 16:01:32 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-4.13-rc7

for you to fetch changes up to 2c6f1d76c668024a9efa50af382df4f3cf8e:

  Merge tag 'fixes-for-4.13b' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 
(2017-08-20 10:45:54 -0700)


staging/iio fixes for 4.13-rc7

Here are few small staging driver fixes, and some more IIO driver fixes
for 4.13-rc7.  Nothing major, just resolutions for some reported
problems.

All of these have been in linux-next with no reported problems.

Signed-off-by: Greg Kroah-Hartman 


Andreas Klinger (1):
  iio: bmp280: properly initialize device for humidity reading

Charles Milette (1):
  staging: rtl8188eu: add RNX-N150NUB support

Colin Ian King (1):
  Revert "staging: fsl-mc: be consistent when checking strcmp() return"

Dragos Bogdan (1):
  iio: imu: adis16480: Fix acceleration scale factor for adis16480

Fabrice Gasnier (6):
  iio: trigger: stm32-timer: fix quadrature mode get routine
  iio: trigger: stm32-timer: fix write_raw return value
  iio: trigger: stm32-timer: fix get/set down count direction
  iio: trigger: stm32-timer: add enable attribute
  iio: adc: stm32: fix common clock rate
  iio: trigger: stm32-timer: fix get trigger mode

Greg Kroah-Hartman (1):
  Merge tag 'fixes-for-4.13b' of git://git.kernel.org/.../jic23/iio into 
staging-linus

Jonathan Corbet (1):
  PATCH] iio: Fix some documentation warnings

Lorenzo Bianconi (2):
  iio: magnetometer: st_magn: fix status register address for LSM303AGR
  iio: magnetometer: st_magn: remove ihl property for LSM303AGR

Srinivas Pandruvada (1):
  iio: hid-sensor-trigger: Fix the race with user space powering up sensors

Stefan Brüns (1):
  iio: adc: ina219: Avoid underflow for sleeping time

 drivers/iio/adc/ina2xx-adc.c   |  2 +-
 drivers/iio/adc/stm32-adc-core.c   | 10 +--
 .../iio/common/hid-sensors/hid-sensor-trigger.c|  8 +--
 drivers/iio/imu/adis16480.c|  2 +-
 drivers/iio/magnetometer/st_magn_core.c|  4 +-
 drivers/iio/pressure/bmp280-core.c | 27 ++-
 drivers/iio/pressure/bmp280.h  |  5 ++
 drivers/iio/trigger/stm32-timer-trigger.c  | 82 --
 drivers/staging/fsl-mc/bus/fsl-mc-allocator.c  |  6 +-
 drivers/staging/rtl8188eu/os_dep/usb_intf.c|  1 +
 include/linux/iio/iio.h|  2 +-
 include/linux/iio/trigger.h|  4 +-
 12 files changed, 107 insertions(+), 46 deletions(-)


Re: [PATCH] of: do not leak console options

2017-08-27 Thread Sergey Senozhatsky
Hello,

(Cc Andrew, Grant)

On (08/25/17 17:37), Rob Herring wrote:
> On Sat, Aug 26, 2017 at 02:36:47AM +0900, Sergey Senozhatsky wrote:
> > If add_preferred_console() returns error then we must free a
> > copy of `of_stdout_options' that we create right before the
> > console registration.
> > 
> > Signed-off-by: Sergey Senozhatsky 
> > ---
> >  drivers/of/base.c | 11 +--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/of/base.c b/drivers/of/base.c
> > index 260d33c0f26c..9fcf7011d206 100644
> > --- a/drivers/of/base.c
> > +++ b/drivers/of/base.c
> > @@ -1779,10 +1779,17 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_id);
> >   */
> >  bool of_console_check(struct device_node *dn, char *name, int index)
> >  {
> > +   bool ret;
> > +   char *options;
> > +
> > if (!dn || dn != of_stdout || console_set_on_cmdline)
> > return false;
> > -   return !add_preferred_console(name, index,
> > - kstrdup(of_stdout_options, GFP_KERNEL));
> > +
> > +   options = kstrdup(of_stdout_options, GFP_KERNEL);
> 
> The real question is why are we doing the kstrdup in the first place. 

I wouldn't know :) let's find that out

the patch used to pass `of_stdout_options' in v1 and v2
https://patches.linaro.org/patch/41559/

starting from v3 options are kstrdup-ed
https://patchwork.kernel.org/patch/5398761/

> AFAICT, the only reason is options within the console/printk code is a 
> char * and not a const char *. I can't imagine that options need 
> modifications?

as far as I can tell, ->match callback has side efects, sometimes.

for example,

register_console()
newcon->match(newcon, c->name, c->index, c->options)

for amba-pl011.c ends up in pl011_console_match(), which calls

uart_parse_earlycon(options, &iotype, &addr, &options)

and uart_parse_earlycon() does the following

int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
char **options)
{
if (strncmp(p, "mmio,", 5) == 0) {
*iotype = UPIO_MEM;
p += 5;
} else if (strncmp(p, "mmio16,", 7) == 0) {
*iotype = UPIO_MEM16;
p += 7;
} else if (strncmp(p, "mmio32,", 7) == 0) {
*iotype = UPIO_MEM32;
p += 7;
} else if (strncmp(p, "mmio32be,", 9) == 0) {
*iotype = UPIO_MEM32BE;
p += 9;
} else if (strncmp(p, "mmio32native,", 13) == 0) {
*iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ?
UPIO_MEM32BE : UPIO_MEM32;
p += 13;
} else if (strncmp(p, "io,", 3) == 0) {
*iotype = UPIO_PORT;
p += 3;
} else if (strncmp(p, "0x", 2) == 0) {
*iotype = UPIO_MEM;
} else {
return -EINVAL;
}

/*
 * Before you replace it with kstrtoull(), think about options separator
 * (',') it will not tolerate
 */
*addr = simple_strtoull(p, NULL, 0);
p = strchr(p, ',');
if (p)
p++;

*options = p;
return 0;
}

that's just one example I found after a very quick grepping. may be
there are other control paths that can change ->options.
wondering if something like this was the reason for kstrdup().

-ss


[GIT PULL] Char/Misc driver fixes for 4.13-rc7

2017-08-27 Thread Greg KH
The following changes since commit ef954844c7ace62f773f4f23e28d2d915adc419f:

  Linux 4.13-rc5 (2017-08-13 16:01:32 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ 
tags/char-misc-4.13-rc7

for you to fetch changes up to b2a6d1b999a4c13e5997bb864694e77172d45250:

  ANDROID: binder: fix proc->tsk check. (2017-08-22 18:42:57 -0700)


char/misc fix for 4.13-rc7

Here is a single misc driver fix for 4.13-rc7.  It resolves a reported
problem in the Android binder driver due to previous patches in 4.13-rc.

It's been in linux-next with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Martijn Coenen (1):
  ANDROID: binder: fix proc->tsk check.

 drivers/android/binder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Re: [stable 4.4 0/2 V2] missing mei device ids

2017-08-27 Thread Greg Kroah-Hartman
On Sun, Aug 27, 2017 at 08:52:50AM +0300, Tomas Winkler wrote:
> Device ids that are missing in 4.4 stable
> 
> Tomas Winkler (2):
>   mei: me: add broxton pci device ids
>   mei: me: add lewisburg device ids

Thanks for the update, both now applied.

greg k-h


Re: [PATCH v2 1/2] power: supply: move HDQ interface for bq27xxx from w1 to power/supply

2017-08-27 Thread Evgeniy Polyakov
Hi everyone

Sorry for long delay

25.07.2017, 16:48, "Sebastian Reichel" :
> Here is a signed immutable branch for Andrew's patch, which moves
> bq27000 w1 driver to the power-supply subsystem. I guess git will
> figure everything out without this, but better safe than sorry :)
>
> The following changes since commit 520eccdfe187591a51ea9ab4c1a024ae4d0f68d9:
>
>   Linux 4.13-rc2 (2017-07-23 16:15:17 -0700)
>
> are available in the git repository at:
>
>   git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git 
> tags/ib-w1-bq27000-4.14
>
> for you to fetch changes up to 55a9db679183bcf85a6e5c44a4f92f158bb6f03d:
>
>   power: supply: move HDQ interface for bq27xxx from w1 to power/supply 
> (2017-07-25 15:17:39 +0200)

Greg, should it be pulled into your tree or submitted as a separate pull 
request or as set of patches?
Either way looks good to me, please get it into your tree.


Re: [PATCH v4 0/5] w1: ds1wm: register access patch

2017-08-27 Thread Evgeniy Polyakov
Hi everyone

25.07.2017, 14:27, "Johannes Poehlmann" :
> To make the ds1wm driver work on a powerpc architecture (big endian, 32bit)
> with a register offset multiplier of 4 I had to make some changes to

> Version 4 of the patchset
>    work on Greg Kroah-Hartmanns comments:
> o added changelog to every patch
> o separate one big patch into two
> o use bool
> o use blockcomments
> o dev_dbg instead of dev_info
> o rebased to v4.13-rc2

Greg, please pull this series named [PATCH v4 ...] w1: ds1wm ... into the tree, 
it looks ok


Re: [PATCH v4 1/2] wire: export w1_touch_bit

2017-08-27 Thread Evgeniy Polyakov
Hi

19.07.2017, 23:14, "Jan Kandziora" :
> The w1_ds28e17 driver from the next part of this patch needs to emit
> single-bit read timeslots to the DS28E17. The w1 subsystem already
> has this function but it is not exported outside drivers/w1/w1_io.c
>
> This subpatch exports the w1_touch_bit symbol with EXPORT_SYMBOL_GPL,
> same as the other exported symbols in drivers/w1/w1_io.c
>
> May be also useful later for writing drivers for other Onewire chips
> which do single-bit communication.
>
> Signed-off-by: Jan Kandziora 
> ---
> Changes in v4 against v3 in this subpatch:
>   - adapted to linux-4.12.0

Greg, please pull this patch series into the tree, it has been adopted to the 
latest vanilla tree to date.
Acked-by: Evgeniy Polyakov 


Re: [PATCH linux v5 0/3] Export 1-wire thermal sensors as hwmon device

2017-08-27 Thread Evgeniy Polyakov
Hi

18.07.2017, 02:09, "Jaghathiswari Rankappagounder Natarajan" :
> Hi Greg,
> Please pull in this patchset into the tree. Thanks!

Here is a patchset, is it visible in your mailbox?
If so, please pull it into your tree.

> Summary of what this patchset does:
>
> Our board has 4 DS18B20 1-wire temperature sensors. Each 1-wire bus and the
> sensor under it is already configured against the Linux 1-wire driver
> (called w1). They have a sysfs file(e.g.
> /sys/bus/w1/devices/w1_bus_master1/28-07704f4c/w1_slave) which, when read,
> runs code to read the temperature. We'd like the temperatures to show up in
> hwmon, so that the BMC IPMI sensor plumbing can forward those to host.
>
> This patchset is based on linux mainline version v4.10.
>
> Tested:
> Yes; On a board with 4 DS18B20 1-wire temperature sensors:
> root@zaius:/sys/class/hwmon# ls
> hwmon0 hwmon1 hwmon2 hwmon3 hwmon4 hwmon5
> root@zaius:/sys/class/hwmon# cd hwmon0
> root@zaius:/sys/class/hwmon/hwmon0# ls
> device name subsystem temp1_input uevent
> root@zaius:/sys/class/hwmon/hwmon0# cat temp1_input
> 24500
> root@zaius:/sys/class/hwmon/hwmon0# cd ..
> root@zaius:/sys/class/hwmon# cd hwmon1
> root@zaius:/sys/class/hwmon/hwmon1# cat temp1_input
> 26562
> root@zaius:/sys/class/hwmon/hwmon1# cd ..
> root@zaius:/sys/class/hwmon# cd hwmon2
> root@zaius:/sys/class/hwmon/hwmon2# cat temp1_input
> 27250
> root@zaius:/sys/class/hwmon/hwmon2# cd ..
> root@zaius:/sys/class/hwmon# cd hwmon3
> root@zaius:/sys/class/hwmon/hwmon3# cat temp1_input
> 22250
> root@zaius:/sys/class/hwmon/hwmon3#
>
> Jaghathiswari Rankappagounder Natarajan (3):
>   drivers: w1: add hwmon support structures
>   drivers: w1: refactor w1_slave_show to make the temp reading
> functionality separate
>   drivers: w1: add hwmon temp support for w1_therm
>
>  drivers/w1/slaves/w1_therm.c | 164 
> +++
>  drivers/w1/w1.c | 18 -
>  drivers/w1/w1.h | 2 +
>  drivers/w1/w1_family.h | 2 +
>  4 files changed, 156 insertions(+), 30 deletions(-)
>
> --
> 2.13.2.932.g7449e964c-goog


[PATCH] nubus: remove cast to void pointer

2017-08-27 Thread Himanshu Jha
Casting void pointers to other pointer types in unnecessary.

Signed-off-by: Himanshu Jha 
---
 drivers/nubus/nubus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
index df431e8..5450f1a 100644
--- a/drivers/nubus/nubus.c
+++ b/drivers/nubus/nubus.c
@@ -167,7 +167,7 @@ static unsigned char *nubus_dirptr(const struct 
nubus_dirent *nd)
 void nubus_get_rsrc_mem(void *dest, const struct nubus_dirent *dirent,
int len)
 {
-   unsigned char *t = (unsigned char *)dest;
+   unsigned char *t = dest;
unsigned char *p = nubus_dirptr(dirent);
 
while (len) {
@@ -180,7 +180,7 @@ EXPORT_SYMBOL(nubus_get_rsrc_mem);
 void nubus_get_rsrc_str(void *dest, const struct nubus_dirent *dirent,
int len)
 {
-   unsigned char *t = (unsigned char *)dest;
+   unsigned char *t = dest;
unsigned char *p = nubus_dirptr(dirent);
 
while (len) {
-- 
2.7.4



[PATCH] be2net: Fix some u16 fields appropriately

2017-08-27 Thread Haishuang Yan
In be_tx_compl_process, frag_index declared as u32, so it's better to
declare last_index as u32 also.

CC: Ajit Khaparde 
Fixes: b0fd2eb28bd4 ("be2net: Declare some u16 fields as u32 to improve
performance")
Signed-off-by: Haishuang Yan 
---
 drivers/net/ethernet/emulex/benet/be.h  | 2 +-
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be.h 
b/drivers/net/ethernet/emulex/benet/be.h
index 674cf9d..2ba4d61 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -255,7 +255,7 @@ struct be_tx_stats {
 /* Structure to hold some data of interest obtained from a TX CQE */
 struct be_tx_compl_info {
u8 status;  /* Completion status */
-   u16 end_index;  /* Completed TXQ Index */
+   u32 end_index;  /* Completed TXQ Index */
 };
 
 struct be_tx_obj {
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c 
b/drivers/net/ethernet/emulex/benet/be_main.c
index 319eee3..3645344 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -2606,7 +2606,7 @@ static struct be_tx_compl_info *be_tx_compl_get(struct 
be_tx_obj *txo)
 }
 
 static u16 be_tx_compl_process(struct be_adapter *adapter,
-  struct be_tx_obj *txo, u16 last_index)
+  struct be_tx_obj *txo, u32 last_index)
 {
struct sk_buff **sent_skbs = txo->sent_skb_list;
struct be_queue_info *txq = &txo->q;
-- 
1.8.3.1





Re: [PATCH v2] w1:fix byteorder of W1_READ_ROM id under big-endian cpu

2017-08-27 Thread Evgeniy Polyakov
Hi Chen

19.07.2017, 10:58, "Chen Lin" :
> The byteorder of para rn(W1_READ_ROM id) pass to w1_slave_found must
> be the same with the byterorder defined in struct w1_reg_num.
>
> The rn read from 'rv = w1_read_block(dev, (u8 *)&rn, 8)' is a byte
> serial and not cpu endian relative, it need to change to cpu endian
> before passed to w1_slave_found.

But w1_reg_num has a different layout for be/le systems, isn't it enough?

> Signed-off-by: Chen Lin 
> Reviewed-by: Jiang Biao 
> ---
> Forgot the description in v1.
>
> ---
>  drivers/w1/w1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index 95ea7e6..c531545 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -979,7 +979,7 @@ void w1_search(struct w1_master *dev, u8 search_type, 
> w1_slave_found_callback cb
>  mutex_unlock(&dev->bus_mutex);
>
>  if (rv == 8 && rn)
> - cb(dev, rn);
> + cb(dev, le64_to_cpu(rn));
>
>  break;
>  }
> --
> 1.8.3.1


Re: I/O hangs after resuming from suspend-to-ram

2017-08-27 Thread Oleksandr Natalenko
Hi.

Here is disk setup for QEMU VM:

===
[root@archmq ~]# smartctl -i /dev/sda
…
Device Model: QEMU HARDDISK
Serial Number:QM1
Firmware Version: 2.5+
User Capacity:4,294,967,296 bytes [4.29 GB]
Sector Size:  512 bytes logical/physical
Device is:Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA/ATAPI-7, ATA/ATAPI-5 published, ANSI NCITS 340-2000
Local Time is:Sun Aug 27 09:31:54 2017 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

[root@archmq ~]# lsblk
NAMEMAJ:MIN RM  SIZE RO TYPE   MOUNTPOINT
sda   8:004G  0 disk   
`-sda18:104G  0 part   
  `-md0   9:004G  0 raid10 
`-system253:004G  0 crypt  
  |-system-boot 253:10  512M  0 lvm/boot
  |-system-swap 253:20  512M  0 lvm[SWAP]
  `-system-root 253:303G  0 lvm/
sdb   8:16   04G  0 disk   
`-sdb18:17   04G  0 part   
  `-md0   9:004G  0 raid10 
`-system253:004G  0 crypt  
  |-system-boot 253:10  512M  0 lvm/boot
  |-system-swap 253:20  512M  0 lvm[SWAP]
  `-system-root 253:303G  0 lvm/
sr0  11:01 1024M  0 rom

[root@archmq ~]# mdadm --misc --detail /dev/md0
/dev/md0:
Version : 1.2
  Creation Time : Sat Jul 29 16:37:05 2017
 Raid Level : raid10
 Array Size : 4191232 (4.00 GiB 4.29 GB)
  Used Dev Size : 4191232 (4.00 GiB 4.29 GB)
   Raid Devices : 2
  Total Devices : 2
Persistence : Superblock is persistent

Update Time : Sun Aug 27 09:30:33 2017
  State : clean 
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

 Layout : far=2
 Chunk Size : 512K

   Name : archiso:0
   UUID : 43f4be59:c8d2fa0a:a94acdff:1c7f2f4e
 Events : 485

Number   Major   Minor   RaidDevice State
   0   810  active sync   /dev/sda1
   1   8   171  active sync   /dev/sdb1
===

In words: 2 virtual disks, RAID10 setup with far-2 layout, LUKS on it, then 
LVM, then ext4 for boot, swap and btrfs for /.

I couldn't reproduce the issue with single disk without RAID.

On neděle 27. srpna 2017 8:02:00 CEST Ming Lei wrote:
> On Sat, Aug 26, 2017 at 12:48:01PM +0200, Oleksandr Natalenko wrote:
> > Quick update: reproduced on both v4.12.7 and v4.13.0-rc6.
> 
> BTW, given it hangs during resume, it isn't easy to collect debug
> info, and there should have been lots useful info there.
> 
> You mentioned that you can reproduce it on QEMU, could you
> share the exact raid10 setting? such as which disks behind
> the raid10.
> 
> Or can you reproduce the issue without raid10 involved?
> 
> I will try to reproduce it in my VM if you may provide the
> above info.
> 
> Thanks,
> Ming




Re: [Qemu-devel] kvm_intel fails to load on Conroe CPUs running Linux 4.12

2017-08-27 Thread Gerhard Wiesinger

On 17.08.2017 23:14, Gerhard Wiesinger wrote:

On 17.08.2017 22:58, Gerhard Wiesinger wrote:
>
> On 07.08.2017 19:50, Paolo Bonzini wrote:
>
> >Not much to say, unfortunately. It's pretty much the same capabilities
> >as a Prescott/Cedar Mill processor, except that it has MSR bitmaps. It
> >also lacks FlexPriority compared to the Conroe I had checked.
> >
> >It's not great that even the revert patch doesn't apply cleanly---this
> >is *not* necessarily a boring area of the hypervisor...
> >
> >Given the rarity of your machine I'm currently leaning towards _not_
> >reverting the change. I'll check another non-Xeon Core 2 tomorrow that
> >is from December 2008 (IIRC). If that one also lacks vNMI, or if I get
> >other reports, I suppose I will have to reconsider that.

Hello Paolo,

Can you please revert the patch.

CPU is a Core 2 Extreme QX6700: SL9UL (B3) running VERY stable with 
ECC RAM for years now.
https://ark.intel.com/products/28028/Intel-Core2-Extreme-Processor-QX6700-8M-Cache-2_66-GHz-1066-MHz-FSB?q=Core%202%20Extreme%20QX6700 


https://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors

CPU details below.

Thank you.

Ciao,
Gerhard 


Hello Paolo,

Any update on this major issue?

Thnx.

Ciao,
Gerhard


[PATCH 0/6] perf tools: Minor build fixes

2017-08-27 Thread David Carrillo-Cisneros
Collection of minor fixes to compile with LLVM and
non-standard tool names.

David Carrillo-Cisneros (6):
  tools build tests: Don't hardcode gcc name
  perf tools: Allow external definition of flex and bison binary names
  tools lib: Allow external definition of CC, AR and LD
  perf tools: Robustify detection of clang binary
  perf tools: Remove BUG_ON char[] to bool implicit conversions
  perf tools: Pass full path of FEATURES_DUMP

 tools/build/tests/ex/Makefile  |  2 +-
 tools/include/linux/kernel.h   |  2 ++
 tools/lib/api/Makefile |  8 
 tools/lib/subcmd/Makefile  |  2 +-
 tools/perf/Makefile.config |  4 ++--
 tools/perf/Makefile.perf   |  6 +++---
 tools/perf/builtin-lock.c  | 15 ++-
 tools/perf/util/intel-pt-decoder/Build |  2 +-
 tools/scripts/Makefile.include |  4 +++-
 9 files changed, 27 insertions(+), 18 deletions(-)

-- 
2.14.1.342.g6490525c54-goog



[PATCH 1/6] tools build tests: Don't hardcode gcc name

2017-08-27 Thread David Carrillo-Cisneros
Use $(CC) instead of harcoded gcc binary name.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/build/tests/ex/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/tests/ex/Makefile b/tools/build/tests/ex/Makefile
index c50d5782ad5a..027d6c8a58a7 100644
--- a/tools/build/tests/ex/Makefile
+++ b/tools/build/tests/ex/Makefile
@@ -8,7 +8,7 @@ ex:
 include $(srctree)/tools/build/Makefile.include
 
 ex: ex-in.o libex-in.o
-   gcc -o $@ $^
+   $(CC) -o $@ $^
 
 ex.%: fixdep FORCE
make -f $(srctree)/tools/build/Makefile.build dir=. $@
-- 
2.14.1.342.g6490525c54-goog



[PATCH 5/6] perf tools: Remove BUG_ON char[] to bool implicit conversions

2017-08-27 Thread David Carrillo-Cisneros
When compiling with LLVM, errors like this are shown:

  builtin-lock.c:46:10: error: implicit conversion turns string literal into 
bool: 'const char [39]' to 'bool'

Due to error message implicit conversion into bool. Fix it by defining a
BUG macro without a boolean argument and use it instead.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/include/linux/kernel.h |  2 ++
 tools/perf/builtin-lock.c| 15 ++-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h
index 77d2e94ca5df..0951c96205c4 100644
--- a/tools/include/linux/kernel.h
+++ b/tools/include/linux/kernel.h
@@ -70,6 +70,8 @@
 #endif
 #endif
 
+#define BUG() abort()
+
 #if __BYTE_ORDER == __BIG_ENDIAN
 #define cpu_to_le16 bswap_16
 #define cpu_to_le32 bswap_32
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index ff98652484a7..7d1e4289 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -152,7 +152,8 @@ static void thread_stat_insert(struct thread_stat *new)
else if (new->tid > p->tid)
rb = &(*rb)->rb_right;
else
-   BUG_ON("inserting invalid thread_stat\n");
+   pr_err("inserting invalid thread_stat\n");
+   BUG();
}
 
rb_link_node(&new->rb, parent, rb);
@@ -457,7 +458,8 @@ static int report_lock_acquire_event(struct perf_evsel 
*evsel,
free(seq);
goto end;
default:
-   BUG_ON("Unknown state of lock sequence found!\n");
+   pr_err("Unknown state of lock sequence found!\n");
+   BUG();
break;
}
 
@@ -518,7 +520,8 @@ static int report_lock_acquired_event(struct perf_evsel 
*evsel,
free(seq);
goto end;
default:
-   BUG_ON("Unknown state of lock sequence found!\n");
+   pr_err("Unknown state of lock sequence found!\n");
+   BUG();
break;
}
 
@@ -573,7 +576,8 @@ static int report_lock_contended_event(struct perf_evsel 
*evsel,
free(seq);
goto end;
default:
-   BUG_ON("Unknown state of lock sequence found!\n");
+   pr_err("Unknown state of lock sequence found!\n");
+   BUG();
break;
}
 
@@ -632,7 +636,8 @@ static int report_lock_release_event(struct perf_evsel 
*evsel,
bad_hist[BROKEN_RELEASE]++;
goto free_seq;
default:
-   BUG_ON("Unknown state of lock sequence found!\n");
+   pr_err("Unknown state of lock sequence found!\n");
+   BUG();
break;
}
 
-- 
2.14.1.342.g6490525c54-goog



[PATCH 3/6] tools lib: Allow external definition of CC, AR and LD

2017-08-27 Thread David Carrillo-Cisneros
Use already defined values for CC, AR and LD when available.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/lib/api/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index eb6e0b36bfc1..2538675731c7 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -8,9 +8,9 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
 
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
-LD = $(CROSS_COMPILE)ld
+CC ?= $(CROSS_COMPILE)gcc
+AR ?= $(CROSS_COMPILE)ar
+LD ?= $(CROSS_COMPILE)ld
 
 MAKEFLAGS += --no-print-directory
 
-- 
2.14.1.342.g6490525c54-goog



[PATCH 2/6] perf tools: Allow external definition of flex and bison binary names

2017-08-27 Thread David Carrillo-Cisneros
Allow user to define flex and bison binary names by passing
FLEX and BISON variables.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/Makefile.perf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a700a079a218..58924eb0f40b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -164,8 +164,8 @@ LN  = ln -f
 MKDIR   = mkdir
 FIND= find
 INSTALL = install
-FLEX= flex
-BISON   = bison
+FLEX?= flex
+BISON   ?= bison
 STRIP   = strip
 AWK = awk
 
-- 
2.14.1.342.g6490525c54-goog



[PATCH 6/6] perf tools: Pass full path of FEATURES_DUMP

2017-08-27 Thread David Carrillo-Cisneros
When building with an external FEATURES_DUMP, bpf complains
that features dump file is not found. Fix it by passing full file path.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/perf/Makefile.perf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 58924eb0f40b..a5bf3100f812 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -240,7 +240,7 @@ endif
 ifeq ($(FEATURES_DUMP),)
 FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
 else
-FEATURE_DUMP_EXPORT := $(FEATURES_DUMP)
+FEATURE_DUMP_EXPORT := $(realpath $(FEATURES_DUMP))
 endif
 
 export prefix bindir sharedir sysconfdir DESTDIR
-- 
2.14.1.342.g6490525c54-goog



[PATCH 4/6] perf tools: Robustify detection of clang binary

2017-08-27 Thread David Carrillo-Cisneros
Prior to this patch, make scripts tested for CLANG with
ifeq ($(CC), clang), failing to detect CLANG binaries with
different names. Fix it by testing for the existence of
__clang__ macro in the list of compiler defined macros.

Signed-off-by: David Carrillo-Cisneros 
---
 tools/lib/api/Makefile | 2 +-
 tools/lib/subcmd/Makefile  | 2 +-
 tools/perf/Makefile.config | 4 ++--
 tools/perf/util/intel-pt-decoder/Build | 2 +-
 tools/scripts/Makefile.include | 4 +++-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 2538675731c7..4563ba7ede6f 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -19,7 +19,7 @@ LIBFILE = $(OUTPUT)libapi.a
 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE 
-D_FORTIFY_SOURCE=2 -fPIC
 
-ifeq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 0)
   CFLAGS += -O3
 else
   CFLAGS += -O6
diff --git a/tools/lib/subcmd/Makefile b/tools/lib/subcmd/Makefile
index 3d1c3b5b5150..7e9f03c97e4c 100644
--- a/tools/lib/subcmd/Makefile
+++ b/tools/lib/subcmd/Makefile
@@ -21,7 +21,7 @@ LIBFILE = $(OUTPUT)libsubcmd.a
 CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -U_FORTIFY_SOURCE 
-D_FORTIFY_SOURCE=2 -fPIC
 
-ifeq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 0)
   CFLAGS += -O3
 else
   CFLAGS += -O6
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 6a64c6bbd9a5..63f534a0902f 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -148,7 +148,7 @@ ifndef DEBUG
 endif
 
 ifeq ($(DEBUG),0)
-ifeq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 0)
   CFLAGS += -O3
 else
   CFLAGS += -O6
@@ -184,7 +184,7 @@ ifdef PYTHON_CONFIG
   PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
   PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
   PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
-  ifeq ($(CC), clang)
+  ifeq ($(CC_NO_CLANG), 1)
 PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
   endif
   FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
diff --git a/tools/perf/util/intel-pt-decoder/Build 
b/tools/perf/util/intel-pt-decoder/Build
index 7aca5d6d7e1f..10e0814bb8d2 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -25,6 +25,6 @@ $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: 
util/intel-pt-decoder/in
 
 CFLAGS_intel-pt-insn-decoder.o += -I$(OUTPUT)util/intel-pt-decoder
 
-ifneq ($(CC), clang)
+ifeq ($(CC_NO_CLANG), 1)
   CFLAGS_intel-pt-insn-decoder.o += -Wno-override-init
 endif
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index ccad8ce925e4..1e8b6116ba3c 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -39,7 +39,9 @@ EXTRA_WARNINGS += -Wundef
 EXTRA_WARNINGS += -Wwrite-strings
 EXTRA_WARNINGS += -Wformat
 
-ifneq ($(CC), clang)
+CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; 
echo $$?)
+
+ifeq ($(CC_NO_CLANG), 1)
 EXTRA_WARNINGS += -Wstrict-aliasing=3
 endif
 
-- 
2.14.1.342.g6490525c54-goog



Re: [PATCH] of: do not leak console options

2017-08-27 Thread Sergey Senozhatsky
On (08/27/17 16:19), Sergey Senozhatsky wrote:
[..]
> int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
>   char **options)
> {
>   if (strncmp(p, "mmio,", 5) == 0) {
>   *iotype = UPIO_MEM;
>   p += 5;
>   } else if (strncmp(p, "mmio16,", 7) == 0) {
>   *iotype = UPIO_MEM16;
>   p += 7;
>   } else if (strncmp(p, "mmio32,", 7) == 0) {
>   *iotype = UPIO_MEM32;
>   p += 7;
>   } else if (strncmp(p, "mmio32be,", 9) == 0) {
>   *iotype = UPIO_MEM32BE;
>   p += 9;
>   } else if (strncmp(p, "mmio32native,", 13) == 0) {
>   *iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ?
>   UPIO_MEM32BE : UPIO_MEM32;
>   p += 13;
>   } else if (strncmp(p, "io,", 3) == 0) {
>   *iotype = UPIO_PORT;
>   p += 3;
>   } else if (strncmp(p, "0x", 2) == 0) {
>   *iotype = UPIO_MEM;
>   } else {
>   return -EINVAL;
>   }
> 
>   /*
>* Before you replace it with kstrtoull(), think about options separator
>* (',') it will not tolerate
>*/
>   *addr = simple_strtoull(p, NULL, 0);
>   p = strchr(p, ',');
>   if (p)
>   p++;
> 
>   *options = p;
>   return 0;
> }
> 
> that's just one example I found after a very quick grepping. may be
> there are other control paths that can change ->options.

well, obviously, it doesn't change the options per se, but it sort of
demonstrates that _probably_ somewhere ->options could be changed. on
the other hand, that ->options = ->options + X makes it rather hard
to kfree() the ->options. well, we never kfree() the ->options anyway,
as far as I can tell...

-ss


Re: [PATCH] RDMA/bnxt_re: remove unnecessary call to memset

2017-08-27 Thread Yuval Shaia
On Fri, Aug 25, 2017 at 09:41:02PM +0530, Himanshu Jha wrote:
> call to memset to assign 0 value immediately after allocating
> memory with kzalloc is unnecesaary as kzalloc allocates the memory
> filled with 0 value.
> 
> Signed-off-by: Himanshu Jha 
> ---
>  drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c 
> b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index f0e01b3..fa6fbac 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -969,7 +969,6 @@ static struct bnxt_re_ah *bnxt_re_create_shadow_qp_ah
>   if (!ah)
>   return NULL;
>  
> - memset(ah, 0, sizeof(*ah));
>   ah->rdev = rdev;
>   ah->qplib_ah.pd = &pd->qplib_pd;
>  
> @@ -1016,7 +1015,6 @@ static struct bnxt_re_qp *bnxt_re_create_shadow_qp
>   if (!qp)
>   return NULL;
>  
> - memset(qp, 0, sizeof(*qp));
>   qp->rdev = rdev;
>  
>   /* Initialize the shadow QP structure from the QP1 values */
> -- 
> 2.7.4

FWIW

Reviewed-by: Yuval Shaia 

> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Alexandre Belloni
On 27/08/2017 at 04:30:08 +0200, Andreas Färber wrote:
> Am 27.08.2017 um 04:05 schrieb Andrew Lunn:
> > n Sun, Aug 27, 2017 at 02:33:27AM +0200, Andreas Färber wrote:
> >> +struct rtd119x_rtc {
> >> +  void __iomem *base;
> >> +  struct clk *clk;
> >> +  struct rtc_device *rtcdev;
> >> +  unsigned base_year;
> >> +  spinlock_t lock;
> > 
> > Where is this lock initialised? I would expect a call to
> > spin_lock_init() somewhere.
> 
> Hm, the spinlock in my irq mux series doesn't have that call either; my
> reset driver did have it. The zero initialization appears to work OK,
> but you're probably right that it should be there.
> 
> > I also wonder what this lock is protecting, which rtc->ops_lock does
> > not protect?
> 
> By that same argument we could ask why so many drivers (and mine, too)
> are calling rtc_valid_tm() when __rtc_read_time() calls it again...
> 

Most of them probably predates the introduction of the check in
__rtc_read_time().


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


Re: Support for advanced documentation around data type definitions

2017-08-27 Thread SF Markus Elfring
Hello,

Do you find it relevant to clarify the following details?

Some data type definitions are provided by Linux source files.
How would you like to see them represented in the documentation formats
which are generated by the Sphinx software?

Regards,
Markus


Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Alexandre Belloni
Hi,

Not much to add, apart from the spinlock issue already spotted by Andrew.

On 27/08/2017 at 02:33:27 +0200, Andreas Färber wrote:
> +struct rtd119x_rtc {
> + void __iomem *base;
> + struct clk *clk;
> + struct rtc_device *rtcdev;
> + unsigned base_year;

checkpatch complains this should be made unsigned int

> + spinlock_t lock;
> +};
> +
> +static inline int rtd119x_rtc_year_days(int year)
> +{
> + return rtc_year_days(1, 12, year);

I'm not sure it is worth wrapping rtc_year_days

> +static int rtd119x_rtc_read_time(struct device *dev, struct rtc_time *tm)
> +{
> + struct rtd119x_rtc *data = dev_get_drvdata(dev);
> + unsigned long flags;
> + s32 day;
> + u32 sec;
> + unsigned year;

unsigned int

> + int tries = 0;
> +
> + spin_lock_irqsave(&data->lock, flags);
> +
> + while (true) {
> + tm->tm_sec = (readl_relaxed(data->base + RTD_RTCSEC) & 
> RTD_RTCSEC_RTCSEC_MASK) >> 1;
> + tm->tm_min  = readl_relaxed(data->base + RTD_RTCMIN) & 
> RTD_RTCMIN_RTCMIN_MASK;
> + tm->tm_hour = readl_relaxed(data->base + RTD_RTCHR) & 
> RTD_RTCHR_RTCHR_MASK;
> + day  =  readl_relaxed(data->base + RTD_RTCDATE1) & 
> RTD_RTCDATE1_RTCDATE1_MASK;
> + day |= (readl_relaxed(data->base + RTD_RTCDATE2) & 
> RTD_RTCDATE2_RTCDATE2_MASK) << 8;
> + sec  = (readl_relaxed(data->base + RTD_RTCSEC) & 
> RTD_RTCSEC_RTCSEC_MASK) >> 1;
> + tries++;
> +
> + if (sec == tm->tm_sec)
> + break;
> +
> + if (tries >= 3) {
> + spin_unlock_irqrestore(&data->lock, flags);
> + return -EINVAL;
> + }
> + }
> + if (tries > 1)
> + dev_dbg(dev, "%s: needed %i tries\n", __func__, tries);
> +
> + spin_unlock_irqrestore(&data->lock, flags);
> +
> + year = data->base_year;
> + while (day >= rtd119x_rtc_year_days(year)) {
> + day -= rtd119x_rtc_year_days(year);
> + year++;
> + }
> + tm->tm_year = year - 1900;
> + tm->tm_yday = day;
> +
> + tm->tm_mon = 0;
> + while (day >= rtc_month_days(tm->tm_mon, year)) {
> + day -= rtc_month_days(tm->tm_mon, year);
> + tm->tm_mon++;
> + }
> + tm->tm_mday = day + 1;
> +
> + return rtc_valid_tm(tm);

As you spotted, you can return 0 here.

> +}
> +
> +static int rtd119x_rtc_set_time(struct device *dev, struct rtc_time *tm)
> +{
> + struct rtd119x_rtc *data = dev_get_drvdata(dev);
> + unsigned long flags;
> + unsigned day;

ditto


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andreas Färber
Hi Andrew,

Am 27.08.2017 um 05:27 schrieb Andrew Lunn:
> On Sun, Aug 27, 2017 at 04:30:08AM +0200, Andreas Färber wrote:
>> Am 27.08.2017 um 04:05 schrieb Andrew Lunn:
>>> n Sun, Aug 27, 2017 at 02:33:27AM +0200, Andreas Färber wrote:
 +struct rtd119x_rtc {
 +  void __iomem *base;
 +  struct clk *clk;
 +  struct rtc_device *rtcdev;
 +  unsigned base_year;
 +  spinlock_t lock;
>>>
>>> Where is this lock initialised? I would expect a call to
>>> spin_lock_init() somewhere.
>>
>> Hm, the spinlock in my irq mux series doesn't have that call either; my
>> reset driver did have it. The zero initialization appears to work OK,
>> but you're probably right that it should be there.
> 
> Hi Andreas
> 
> I suspect you will have problems if you enable spin lock debug code,
> like CONFIG_DEBUG_SPINLOCK.

Thanks for that hint. Surprisingly the irq mux is still fine with that
option enabled, but the rtc now shows:

[1.193722] BUG: spinlock bad magic on CPU#0, swapper/0/1
[1.199264]  lock: 0x80007bd40db8, .magic: , .owner:
/-1, .owner_cpu: 0
[1.207648] CPU: 0 PID: 1 Comm: swapper/0 Not tainted
4.13.0-rc6-next-20170825-00061-g88513c6f5687 #180
[1.217269] Hardware name: Zidoo X9S (DT)
[1.221378] Call trace:
[1.223900] [] dump_backtrace+0x0/0x320
[1.229439] [] show_stack+0x14/0x1c
[1.234622] [] dump_stack+0x94/0xbc
[1.239804] [] spin_bug+0x84/0xa4
[1.244806] [] do_raw_spin_lock+0x30/0xd4
[1.250522] [] _raw_spin_lock_irqsave+0x28/0x38
[1.256772] [] rtd119x_rtc_read_time+0x24/0x14c
[1.263019] [] __rtc_read_time+0x3c/0x64
[1.268644] [] rtc_read_time+0x34/0x5c
[1.274091] [] __rtc_read_alarm+0x24/0x2f0
[1.279893] [] rtc_device_register+0xa0/0x144
[1.285962] [] devm_rtc_device_register+0x5c/0xa4
[1.292390] [] rtd119x_rtc_probe+0x174/0x1b4
[1.298373] [] platform_drv_probe+0x54/0xa8
[1.304265] [] driver_probe_device+0x1fc/0x2b8
[1.310423] [] __driver_attach+0x74/0xa4
[1.316051] [] bus_for_each_dev+0x80/0x90
[1.321765] [] driver_attach+0x20/0x28
[1.327211] [] bus_add_driver+0x194/0x1e0
[1.332925] [] driver_register+0x98/0xd0
[1.338550] [] __platform_driver_register+0x48/0x50
[1.345155] [] rtd119x_rtc_driver_init+0x18/0x20
[1.351493] [] do_one_initcall+0x118/0x13c
[1.357299] [] kernel_init_freeable+0x220/0x224
[1.363548] [] kernel_init+0x10/0xf8
[1.368819] [] ret_from_fork+0x10/0x18
[1.375104] rtd1295-rtc 9801b600.rtc: rtc core: registered rtc as rtc0

Will fix.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andreas Färber
Am 27.08.2017 um 10:27 schrieb Alexandre Belloni:
> On 27/08/2017 at 04:30:08 +0200, Andreas Färber wrote:
>> Am 27.08.2017 um 04:05 schrieb Andrew Lunn:
>> By that same argument we could ask why so many drivers (and mine, too)
>> are calling rtc_valid_tm() when __rtc_read_time() calls it again...
> 
> Most of them probably predates the introduction of the check in
> __rtc_read_time().

Replacing with 0 here then.

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


Re: [RFC 1/3] dt-bindings: rtc: Add Realtek RTD1295

2017-08-27 Thread Andreas Färber
Hi Rob,

Am 23.08.2017 um 02:29 schrieb Rob Herring:
> On Sun, Aug 20, 2017 at 03:36:29AM +0200, Andreas Färber wrote:
>> Add a binding for the RTC on the Realtek RTD119x/RTD129x SoC families.
>>
>> Signed-off-by: Andreas Färber 
>> ---
>>  .../devicetree/bindings/rtc/realtek,rtd119x.txt  | 16 
>> 
>>  1 file changed, 16 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt
> 
> Acked-by: Rob Herring 

Thanks. Did you read the RFC question in the cover letter as well and
have any comments? Downstream has an rtc-base-year = <2014>; property
that I had left out in this RFC and due to your ack not included in v2.

Should we default to 2014 in the driver and add an optional base-year
property once we encounter a diverging device, or should we make it
required from the beginning? I did not spot any other rtc binding with
such a property and would appreciate a clarification.

Thanks in advance,

Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


Re: [PATCH 2/2] leds: gpio: Allow LED to retain state at shutdown

2017-08-27 Thread Jacek Anaszewski
Hi Andrew,

On 08/25/2017 09:32 AM, Pavel Machek wrote:
> On Fri 2017-08-25 16:05:03, Andrew Jeffery wrote:
>> In some systems, such as BMCs, we want to retain the state of LEDs
>> across a reboot of the BMC whilst the host remains up.
> 
> I'd spell out what BMC is...

I agree with Pavel. Please give the expansion of the acronym
in both DT patch and the driver commit message.

> 
> Otherwise series looks good.
> 
> Acked-by: Pavel Machek 

-- 
Best regards,
Jacek Anaszewski


Re: [PATCH] m68knommu: remove dead code

2017-08-27 Thread Angelo Dureghello

Hi,

just to inform you that i have in mind to add spi(soon, at least seems
just a matter con Kconfig changes) and usdhc(later)
drivers/support for stmark2 mcf5441x based board.
But no problem, in case i'll re-add the this code as needed.

On 24/08/2017 16:34, Alexandre Belloni wrote:

As CONFIG_RTC_DRV_M5441x doesn't exist because the driver never made it
upstream, there is no device to register. Remove code that is never
compiled and init_BSP() as it doesn't do anything.

Signed-off-by: Alexandre Belloni 
---
  arch/m68k/coldfire/m5441x.c | 37 -
  1 file changed, 37 deletions(-)

diff --git a/arch/m68k/coldfire/m5441x.c b/arch/m68k/coldfire/m5441x.c
index dc589b039b62..04fd7fde9fb3 100644
--- a/arch/m68k/coldfire/m5441x.c
+++ b/arch/m68k/coldfire/m5441x.c
@@ -222,40 +222,3 @@ void __init config_BSP(char *commandp, int size)
m5441x_uarts_init();
m5441x_fec_init();
  }
-
-
-#if IS_ENABLED(CONFIG_RTC_DRV_M5441x)
-static struct resource m5441x_rtc_resources[] = {
-   {
-   .start  = MCFRTC_BASE,
-   .end= MCFRTC_BASE + MCFRTC_SIZE - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .start  = MCF_IRQ_RTC,
-   .end= MCF_IRQ_RTC,
-   .flags  = IORESOURCE_IRQ,
-   },
-};
-
-static struct platform_device m5441x_rtc = {
-   .name   = "mcfrtc",
-   .id = 0,
-   .resource   = m5441x_rtc_resources,
-   .num_resources  = ARRAY_SIZE(m5441x_rtc_resources),
-};
-#endif
-
-static struct platform_device *m5441x_devices[] __initdata = {
-#if IS_ENABLED(CONFIG_RTC_DRV_M5441x)
-   &m5441x_rtc,
-#endif
-};
-
-static int __init init_BSP(void)
-{
-   platform_add_devices(m5441x_devices, ARRAY_SIZE(m5441x_devices));
-   return 0;
-}
-
-arch_initcall(init_BSP);



Regards,
Angelo


Re: [PATCHv5 06/19] x86/boot/compressed/64: Detect and handle 5-level paging at boot-time

2017-08-27 Thread Cyrill Gorcunov
On Mon, Aug 21, 2017 at 06:29:03PM +0300, Kirill A. Shutemov wrote:
> This patch prepare decompression code to boot-time switching between 4-
> and 5-level paging.
> 
> Signed-off-by: Kirill A. Shutemov 
> ---
>  arch/x86/boot/compressed/head_64.S | 24 
>  1 file changed, 24 insertions(+)
> 
> diff --git a/arch/x86/boot/compressed/head_64.S 
> b/arch/x86/boot/compressed/head_64.S
> index fbf4c32d0b62..2e362aea3319 100644
> --- a/arch/x86/boot/compressed/head_64.S
> +++ b/arch/x86/boot/compressed/head_64.S
> @@ -347,6 +347,28 @@ preferred_addr:
>   leaqboot_stack_end(%rbx), %rsp
>  
>  #ifdef CONFIG_X86_5LEVEL
> + /* Preserve rbx across cpuid */
> + movq%rbx, %r8
> +
> + /* Check if leaf 7 is supported */
> + movl$0, %eax

Use xor instead, it should be shorter

> + cpuid
> + cmpl$7, %eax
> + jb  lvl5
> +
> + /*
> +  * Check if la57 is supported.
> +  * The feature is enumerated with CPUID.(EAX=07H, ECX=0):ECX[bit 16]
> +  */
> + movl$7, %eax
> + movl$0, %ecx

same


Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andreas Färber
Hi Alexandre,

Am 27.08.2017 um 11:13 schrieb Alexandre Belloni:
> Not much to add, apart from the spinlock issue already spotted by Andrew.
> 
> On 27/08/2017 at 02:33:27 +0200, Andreas Färber wrote:
>> +struct rtd119x_rtc {
>> +void __iomem *base;
>> +struct clk *clk;
>> +struct rtc_device *rtcdev;
>> +unsigned base_year;
> 
> checkpatch complains this should be made unsigned int

Ouch, I forgot to add my pre-commit hook in this tree and wasn't aware
of that rule yet. The RFC had it already. Fixed.

>> +spinlock_t lock;
>> +};
>> +
>> +static inline int rtd119x_rtc_year_days(int year)
>> +{
>> +return rtc_year_days(1, 12, year);
> 
> I'm not sure it is worth wrapping rtc_year_days
[snip]

Well, I found your rtc_year_days rather confusing and had to play with
the arguments until I got it working as expected, so I wanted an inline
function (or macro) as abstraction from my three callers.

Sadly the naming is rather confusing as I am looking for the number of
days 365..366, whereas your rtc_year_days is meant to return 0..365 and
I would just like to extract the 12th array element but need to counter
the -1 subtraction. rtc_year_days(31, 11, year) + 1 is not intuitive
either - reads like November (and ranges are not documented).

What about exporting a convenient rtc_days_in_year(year) from rtc-lib.c
accessing the table directly without rtc_year_days detour? Alternatively
an inline function in rtc.h to the same effect without the array?

Also despite is_leap_year() returning a bool || expression you keep
using it as array index or integer to add. That assumes true == 1,
whereas to my knowledge only false is guaranteed to be 0 and any
non-zero value means true. So I'd expect the code to be like this:

diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c
index 1ae7da5cfc60..8983a408fc30 100644
--- a/drivers/rtc/rtc-lib.c
+++ b/drivers/rtc/rtc-lib.c
@@ -32,7 +32,7 @@ static const unsigned short rtc_ydays[2][13] = {
  */
 int rtc_month_days(unsigned int month, unsigned int year)
 {
-   return rtc_days_in_month[month] + (is_leap_year(year) && month
== 1);
+   return rtc_days_in_month[month] + ((is_leap_year(year) && month
== 1) ? 1 : 0);
 }
 EXPORT_SYMBOL(rtc_month_days);

@@ -41,7 +41,7 @@ EXPORT_SYMBOL(rtc_month_days);
  */
 int rtc_year_days(unsigned int day, unsigned int month, unsigned int year)
 {
-   return rtc_ydays[is_leap_year(year)][month] + day-1;
+   return rtc_ydays[is_leap_year(year) ? 1 : 0][month] + day-1;
 }
 EXPORT_SYMBOL(rtc_year_days);

@@ -69,7 +69,7 @@ void rtc_time64_to_tm(time64_t time, struct rtc_time *tm)
- LEAPS_THRU_END_OF(1970 - 1);
if (days < 0) {
year -= 1;
-   days += 365 + is_leap_year(year);
+   days += 365 + (is_leap_year(year) ? 1 : 0);
}
tm->tm_year = year - 1900;
tm->tm_yday = days + 1;

The above rtc_time64_to_tm() hunk could be converted to the proposed
rtc_days_in_year(). rtc-mcp795.c has another candidate.

By reusing rtc_year_days I elegantly avoided is_leap_year in my code,
but I could spell out 365 + (is_leap_year(year) ? 1 : 0) in my function
if preferred. I dislike duplicating expressions in code.

What do you think?

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)


[PATCH 1/2] Extend 1W master driver DS2482 with module option to support PPM/SPU/1WS features

2017-08-27 Thread Andrew Worsley
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 
Acked-by: Evgeniy Polyakov 
---
 drivers/w1/masters/ds2482.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index d49681cd29af..5b3e017d9276 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -70,6 +70,8 @@ MODULE_PARM_DESC(active_pullup, "Active pullup (apply to all 
buses): " \
 #define DS2482_REG_CFG_PPM 0x02/* presence pulse masking */
 #define DS2482_REG_CFG_APU 0x01/* active pull-up */
 
+/* extra configurations - e.g. 1WS */
+int extra_config;
 
 /**
  * Write and verify codes for the CHANNEL_SELECT command (DS2482-800 only).
@@ -403,7 +405,7 @@ static u8 ds2482_w1_reset_bus(void *data)
/* If the chip did reset since detect, re-config it */
if (err & DS2482_REG_STS_RST)
ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG,
-ds2482_calculate_config(0x00));
+   ds2482_calculate_config(extra_config));
}
 
mutex_unlock(&pdev->access_lock);
@@ -429,8 +431,7 @@ static u8 ds2482_w1_set_pullup(void *data, int delay)
ds2482_wait_1wire_idle(pdev);
/* note: it seems like both SPU and APU have to be set! */
retval = ds2482_send_cmd_data(pdev, DS2482_CMD_WRITE_CONFIG,
-   ds2482_calculate_config(DS2482_REG_CFG_SPU |
-   DS2482_REG_CFG_APU));
+   
ds2482_calculate_config(extra_config|DS2482_REG_CFG_SPU|DS2482_REG_CFG_APU));
ds2482_wait_1wire_idle(pdev);
}
 
@@ -483,7 +484,7 @@ static int ds2482_probe(struct i2c_client *client,
 
/* Set all config items to 0 (off) */
ds2482_send_cmd_data(data, DS2482_CMD_WRITE_CONFIG,
-   ds2482_calculate_config(0x00));
+   ds2482_calculate_config(extra_config));
 
mutex_init(&data->access_lock);
 
@@ -558,4 +559,7 @@ module_i2c_driver(ds2482_driver);
 
 MODULE_AUTHOR("Ben Gardner ");
 MODULE_DESCRIPTION("DS2482 driver");
+module_param(extra_config, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(extra_config, "Extra Configuration settings 
1=APU,2=PPM,3=SPU,8=1WS");
+
 MODULE_LICENSE("GPL");
-- 
2.11.0



[no subject]

2017-08-27 Thread Andrew Worsley
Hi, this extends the one wire master DS2482 driver to support other interfacing
modes and adds a slave one wire DS28E05 EEPROM driver. This allows the one
wire master DS2482 driver to support the OverDrive interface mode which is
required for it to talk to the DS28E05 slave chip.

These patches are against the recent 4.13.0-rc6 mainline kernel and compile
against it. The code was tested against the recent Debian stable 4.9 kernel.
The code did require some changes between the two kernels to compile but are
functionally the same.

Hopefully it is useful for some other people wanting to use these or similar
chips.

Thanks

Andrew Worsley


[PATCH 2/2] Add 1w slave driver for DS28E05 EEPROM

2017-08-27 Thread Andrew Worsley
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 
Acked-by: Evgeniy Polyakov 
---
 drivers/w1/slaves/Kconfig |   8 ++
 drivers/w1/slaves/Makefile|   1 +
 drivers/w1/slaves/w1_ds2805.c | 313 ++
 drivers/w1/w1.c   |   2 +
 4 files changed, 324 insertions(+)
 create mode 100644 drivers/w1/slaves/w1_ds2805.c

diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig
index fb68465908f2..bb4d7ed2ce55 100644
--- a/drivers/w1/slaves/Kconfig
+++ b/drivers/w1/slaves/Kconfig
@@ -65,6 +65,14 @@ config W1_SLAVE_DS2423
  Say Y here if you want to use a 1-wire
  counter family device (DS2423).
 
+config W1_SLAVE_DS2805
+   tristate "112-byte EEPROM support (DS28E05)"
+   help
+ Say Y here if you want to use a 1-wire
+ is a 112-byte user-programmable EEPROM is
+  organized as 7 pages of 16 bytes each with 64bit
+  unique number. Requires OverDrive Speed to talk to.
+
 config W1_SLAVE_DS2431
tristate "1kb EEPROM family support (DS2431)"
help
diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile
index 54c63e420302..4622d8fed362 100644
--- a/drivers/w1/slaves/Makefile
+++ b/drivers/w1/slaves/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_W1_SLAVE_DS2413) += w1_ds2413.o
 obj-$(CONFIG_W1_SLAVE_DS2406)  += w1_ds2406.o
 obj-$(CONFIG_W1_SLAVE_DS2423)  += w1_ds2423.o
 obj-$(CONFIG_W1_SLAVE_DS2431)  += w1_ds2431.o
+obj-$(CONFIG_W1_SLAVE_DS2805)  += w1_ds2805.o
 obj-$(CONFIG_W1_SLAVE_DS2433)  += w1_ds2433.o
 obj-$(CONFIG_W1_SLAVE_DS2438)  += w1_ds2438.o
 obj-$(CONFIG_W1_SLAVE_DS2760)  += w1_ds2760.o
diff --git a/drivers/w1/slaves/w1_ds2805.c b/drivers/w1/slaves/w1_ds2805.c
new file mode 100644
index ..29348d283a65
--- /dev/null
+++ b/drivers/w1/slaves/w1_ds2805.c
@@ -0,0 +1,313 @@
+/*
+ * w1_ds2805 - w1 family 0d (DS28E05) driver
+ *
+ * Copyright (c) 2016 Andrew Worsley amwors...@gmail.com
+ *
+ * This source code is licensed under the GNU General Public License,
+ * Version 2. See the file COPYING for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define W1_EEPROM_DS2805   0x0D
+
+#define W1_F0D_EEPROM_SIZE 128
+#define W1_F0D_PAGE_BITS   3
+#define W1_F0D_PAGE_SIZE   (1< size)
+   return 0;
+
+   if ((off + count) > size)
+   return size - off;
+
+   return count;
+}
+
+/*
+ * Read a block from W1 ROM two times and compares the results.
+ * If they are equal they are returned, otherwise the read
+ * is repeated W1_F0D_READ_RETRIES times.
+ *
+ * count must not exceed W1_F0D_READ_MAXLEN.
+ */
+static int w1_f0d_readblock(struct w1_slave *sl, int off, int count, char *buf)
+{
+   u8 wrbuf[3];
+   u8 cmp[W1_F0D_READ_MAXLEN];
+   int tries = W1_F0D_READ_RETRIES;
+
+   do {
+   wrbuf[0] = W1_F0D_READ_EEPROM;
+   wrbuf[1] = off & 0x7f;
+   wrbuf[2] = 0;
+
+   if (w1_reset_select_slave(sl))
+   return -1;
+
+   w1_write_block(sl->master, wrbuf, sizeof(wrbuf));
+   w1_read_block(sl->master, buf, count);
+
+   if (w1_reset_select_slave(sl))
+   return -1;
+
+   w1_write_block(sl->master, wrbuf, sizeof(wrbuf));
+   w1_read_block(sl->master, cmp, count);
+
+   if (!memcmp(cmp, buf, count))
+   return 0;
+   } while (--tries);
+
+   dev_err(&sl->dev, "proof reading failed %d times\n",
+   W1_F0D_READ_RETRIES);
+
+   return -1;
+}
+
+static ssize_t w1_f0d_read_bin(struct file *filp, struct kobject *kobj,
+  struct bin_attribute *bin_attr,
+  char *buf, loff_t off, size_t count)
+{
+   struct w1_slave *sl = kobj_to_w1_slave(kobj);
+   int todo = count;
+
+   count = w1_f0d_fix_count(off, count, W1_F0D_EEPROM_SIZE);
+   if (count == 0)
+   return 0;
+
+   mutex_lock(&sl->master->mutex);
+
+   /* read directly from the EEPROM in chunks of W1_F0D_READ_MAXLEN */
+   while (todo > 0) {
+   int block_read;
+
+   if (todo >= W1_F0D_READ_MAXLEN)
+   block_read = W1_F0D_READ_MAXLEN;
+   else
+   block_read = todo;
+
+   if (w1_f0d_readblock(sl, off, block_read, buf) < 0) {
+   count = -EIO;
+   break;
+   }
+
+   todo -= W1_F0D_READ_MAXLEN;
+   buf += W1_F0D_READ_MAXLEN;
+   off += W1_F0D_READ_MAXLEN;
+   }
+
+   mutex_unlock(&sl->master->mutex);
+
+   return count;
+}
+
+/*
+ * Writes to the scratchpad and reads it back for verification.
+ * Then copies the scratchpad to EE

Re: [RFC PATCH v4 3/6] i2c: add docs to clarify DMA handling

2017-08-27 Thread Mauro Carvalho Chehab
Em Thu, 17 Aug 2017 16:14:46 +0200
Wolfram Sang  escreveu:

> Signed-off-by: Wolfram Sang 
> ---
>  Documentation/i2c/DMA-considerations | 50 
> 
>  1 file changed, 50 insertions(+)
>  create mode 100644 Documentation/i2c/DMA-considerations
> 
> diff --git a/Documentation/i2c/DMA-considerations 
> b/Documentation/i2c/DMA-considerations
> new file mode 100644
> index 00..a4b4a107102452
> --- /dev/null
> +++ b/Documentation/i2c/DMA-considerations
> @@ -0,0 +1,50 @@
> +Linux I2C and DMA
> +-

I would use, instead:

=
Linux I2C and DMA
=

As this is the way we're starting document titles, after converted to
ReST. So, better to have it already using the right format, as one day
someone will convert i2c documentation to ReST. So, it would be
really cool if this document could be just renamed without needing
to patch it during such conversion :-)

There are also a couple of things here that Sphinx would complain.
So, it could be worth to rename it to *.rst, while you're writing
it, and see what:
make htmldocs
will complain and how it will look in html.

> +
> +Given that I2C is a low-speed bus where largely small messages are 
> transferred,
> +it is not considered a prime user of DMA access. At this time of writing, 
> only
> +10% of I2C bus master drivers have DMA support implemented.

Are you sure about that? I'd say that, on media, at least half of the
drivers use DMA for I2C bus access, as the I2C bus is on a remote
board that talks with CPU via USB, using DMA, and all communication
with USB should be DMA-safe.

I guess what you really wanted to say on most of this section is
about SoC (and other CPUs) where the I2C bus master is is at the
mainboard, and not on some peripheral.

> And the vast
> +majority of transactions are so small that setting up DMA for it will likely
> +add more overhead than a plain PIO transfer.
> +
> +Therefore, it is *not* mandatory that the buffer of an I2C message is DMA 
> safe.

Again, that may not be true on media boards. The code that implements the
I2C transfers there, on most boards, have to be DMA safe, as it won't
otherwise send/receive commands from the chips that are after the USB
bridge.

> +It does not seem reasonable to apply additional burdens when the feature is 
> so
> +rarely used. However, it is recommended to use a DMA-safe buffer if your
> +message size is likely applicable for DMA. Most drivers have this threshold
> +around 8 bytes (as of today, this is mostly an educated guess, however). For
> +any message of 16 byte or larger, it is probably a really good idea.
> +
> +If you use such a buffer in a i2c_msg, set the I2C_M_DMA_SAFE flag with it.
> +Then, the I2C core and drivers know they can safely operate DMA on it. Note
> +that setting this flag makes only sense in kernel space. User space data is
> +copied into kernel space anyhow. The I2C core makes sure the destination
> +buffers in kernel space are always DMA capable.
> +
> +FIXME: Need to implement i2c_master_{send|receive}_dma and proper buffers 
> for i2c_smbus_xfer_emulated.
> +
> +Drivers wishing to implement DMA can use helper functions from the I2C core.
> +One gives you a DMA-safe buffer for a given i2c_msg as long as a certain
> +threshold is met.
> +
> + dma_buf = i2c_get_dma_safe_msg_buf(msg, threshold_in_byte);

I'm concerned about the new bits added by this call. Right now,
USB drivers just use kalloc() for transfer buffers used to send and
receive URB control messages for both setting the main device and
for I2C messages. Before this changeset, buffers allocated this
way are DMA save and have been working for years.

When you add some flags that would make the I2C subsystem aware
that a buffer is now DMA safe, I guess you could be breaking
those drivers, as a DMA safe buffer will now be considered as
DMA-unsafe.

So, you'll likely need to patch all media USB drivers to fix it,
or come up with some other solution.

> +
> +If a buffer is returned, it either msg->buf for the I2C_M_DMA_SAFE case or a
> +bounce buffer. But you don't need to care about that detail. If NULL is
> +returned, the threshold was not met or a bounce buffer could not be 
> allocated.
> +Fall back to PIO in that case.
> +
> +In any case, a buffer obtained from above needs to be released. It ensures 
> data
> +is copied back to the message and a potentially used bounce buffer is freed.
> +
> + i2c_release_dma_safe_msg_buf(msg, dma_buf);
> +
> +The bounce buffer handling from the core is generic and simple. It will 
> always
> +allocate a new bounce buffer. If you want a more sophisticated handling (e.g.
> +reusing pre-allocated buffers), you are free to implement your own.
> +
> +Please also check the in-kernel documentation for details. The i2c-sh_mobile
> +driver can be used as a reference example how to use the above helpers.
> +
> +Final note: If you plan to use DMA with I2C (or with anything else, actually)

[PATCH 2/2] arm64: dts: uniphier: fix size of sdctrl node

2017-08-27 Thread Masahiro Yamada
All registers are located within 0x400 size from the base address.

Signed-off-by: Masahiro Yamada 
---

 arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
index f4948d0aa348..a29c279b6e8e 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
@@ -320,7 +320,7 @@
sdctrl@5981 {
compatible = "socionext,uniphier-ld20-sdctrl",
 "simple-mfd", "syscon";
-   reg = <0x5981 0x800>;
+   reg = <0x5981 0x400>;
 
sd_clk: clock {
compatible = "socionext,uniphier-ld20-sd-clock";
-- 
2.7.4



[PATCH 1/2] arm64: dts: uniphier: add AIDET nodes

2017-08-27 Thread Masahiro Yamada
Add UniPhier AIDET (ARM Interrupt Detector) nodes to support
active low interrupts.

Signed-off-by: Masahiro Yamada 
---

 arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi | 7 +++
 arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi | 7 +++
 2 files changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
index 5537a457af97..ee4aff53a5f5 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi
@@ -355,6 +355,13 @@
};
};
 
+   aidet: aidet@5fc2 {
+   compatible = "socionext,uniphier-ld11-aidet";
+   reg = <0x5fc2 0x200>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
gic: interrupt-controller@5fe0 {
compatible = "arm,gic-v3";
reg = <0x5fe0 0x1>, /* GICD */
diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
index 304cb743d70c..f4948d0aa348 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
@@ -376,6 +376,13 @@
};
};
 
+   aidet: aidet@5fc2 {
+   compatible = "socionext,uniphier-ld20-aidet";
+   reg = <0x5fc2 0x200>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
gic: interrupt-controller@5fe0 {
compatible = "arm,gic-v3";
reg = <0x5fe0 0x1>, /* GICD */
-- 
2.7.4



[PATCH 1/2] ARM: dts: uniphier: add AIDET nodes

2017-08-27 Thread Masahiro Yamada
Add UniPhier AIDET (ARM Interrupt Detector) nodes to support
active low interrupts.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/boot/dts/uniphier-ld4.dtsi  | 7 +++
 arch/arm/boot/dts/uniphier-pro4.dtsi | 7 +++
 arch/arm/boot/dts/uniphier-pro5.dtsi | 7 +++
 arch/arm/boot/dts/uniphier-pxs2.dtsi | 7 +++
 arch/arm/boot/dts/uniphier-sld8.dtsi | 7 +++
 5 files changed, 35 insertions(+)

diff --git a/arch/arm/boot/dts/uniphier-ld4.dtsi 
b/arch/arm/boot/dts/uniphier-ld4.dtsi
index 91410609b181..79183db5b386 100644
--- a/arch/arm/boot/dts/uniphier-ld4.dtsi
+++ b/arch/arm/boot/dts/uniphier-ld4.dtsi
@@ -270,6 +270,13 @@
interrupt-controller;
};
 
+   aidet: aidet@6183 {
+   compatible = "socionext,uniphier-ld4-aidet";
+   reg = <0x6183 0x200>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
sysctrl@6184 {
compatible = "socionext,uniphier-ld4-sysctrl",
 "simple-mfd", "syscon";
diff --git a/arch/arm/boot/dts/uniphier-pro4.dtsi 
b/arch/arm/boot/dts/uniphier-pro4.dtsi
index 0c43d7836015..b3dbbd9b6e39 100644
--- a/arch/arm/boot/dts/uniphier-pro4.dtsi
+++ b/arch/arm/boot/dts/uniphier-pro4.dtsi
@@ -268,6 +268,13 @@
};
};
 
+   aidet: aidet@5fc2 {
+   compatible = "socionext,uniphier-pro4-aidet";
+   reg = <0x5fc2 0x200>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
timer@6200 {
compatible = "arm,cortex-a9-global-timer";
reg = <0x6200 0x20>;
diff --git a/arch/arm/boot/dts/uniphier-pro5.dtsi 
b/arch/arm/boot/dts/uniphier-pro5.dtsi
index 36b64e53ed2e..41a6493ed29a 100644
--- a/arch/arm/boot/dts/uniphier-pro5.dtsi
+++ b/arch/arm/boot/dts/uniphier-pro5.dtsi
@@ -331,6 +331,13 @@
};
};
 
+   aidet: aidet@5fc2 {
+   compatible = "socionext,uniphier-pro5-aidet";
+   reg = <0x5fc2 0x200>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
timer@6200 {
compatible = "arm,cortex-a9-global-timer";
reg = <0x6200 0x20>;
diff --git a/arch/arm/boot/dts/uniphier-pxs2.dtsi 
b/arch/arm/boot/dts/uniphier-pxs2.dtsi
index ed2b9a4516aa..37bbaa4b4de5 100644
--- a/arch/arm/boot/dts/uniphier-pxs2.dtsi
+++ b/arch/arm/boot/dts/uniphier-pxs2.dtsi
@@ -315,6 +315,13 @@
};
};
 
+   aidet: aidet@5fc2 {
+   compatible = "socionext,uniphier-pxs2-aidet";
+   reg = <0x5fc2 0x200>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
timer@6200 {
compatible = "arm,cortex-a9-global-timer";
reg = <0x6200 0x20>;
diff --git a/arch/arm/boot/dts/uniphier-sld8.dtsi 
b/arch/arm/boot/dts/uniphier-sld8.dtsi
index 5b0b2f822519..b08390332971 100644
--- a/arch/arm/boot/dts/uniphier-sld8.dtsi
+++ b/arch/arm/boot/dts/uniphier-sld8.dtsi
@@ -270,6 +270,13 @@
interrupt-controller;
};
 
+   aidet: aidet@6183 {
+   compatible = "socionext,uniphier-sld8-aidet";
+   reg = <0x6183 0x200>;
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
sysctrl@6184 {
compatible = "socionext,uniphier-sld8-sysctrl",
 "simple-mfd", "syscon";
-- 
2.7.4



[PATCH 2/2] ARM: dts: uniphier: fix size of sdctrl nodes

2017-08-27 Thread Masahiro Yamada
All registers are located within 0x400 size from the base address.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/boot/dts/uniphier-pro5.dtsi | 2 +-
 arch/arm/boot/dts/uniphier-pxs2.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/uniphier-pro5.dtsi 
b/arch/arm/boot/dts/uniphier-pro5.dtsi
index 41a6493ed29a..b026bcd42a06 100644
--- a/arch/arm/boot/dts/uniphier-pro5.dtsi
+++ b/arch/arm/boot/dts/uniphier-pro5.dtsi
@@ -292,7 +292,7 @@
sdctrl@5981 {
compatible = "socionext,uniphier-pro5-sdctrl",
 "simple-mfd", "syscon";
-   reg = <0x5981 0x800>;
+   reg = <0x5981 0x400>;
 
sd_clk: clock {
compatible = "socionext,uniphier-pro5-sd-clock";
diff --git a/arch/arm/boot/dts/uniphier-pxs2.dtsi 
b/arch/arm/boot/dts/uniphier-pxs2.dtsi
index 37bbaa4b4de5..90b020c95083 100644
--- a/arch/arm/boot/dts/uniphier-pxs2.dtsi
+++ b/arch/arm/boot/dts/uniphier-pxs2.dtsi
@@ -276,7 +276,7 @@
sdctrl@5981 {
compatible = "socionext,uniphier-pxs2-sdctrl",
 "simple-mfd", "syscon";
-   reg = <0x5981 0x800>;
+   reg = <0x5981 0x400>;
 
sd_clk: clock {
compatible = "socionext,uniphier-pxs2-sd-clock";
-- 
2.7.4



Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name

2017-08-27 Thread Mark Brown
On Sat, Aug 26, 2017 at 11:09:49PM +0800, Donglin Peng wrote:

> It seems that the v3 patch should be applied other than v2.

Please send incremental fixes rather than new versions for things that
are are already applied.


signature.asc
Description: PGP signature


Re: kvm splat in mmu_spte_clear_track_bits

2017-08-27 Thread Adam Borowski
On Fri, Aug 25, 2017 at 03:40:50PM +0200, Paolo Bonzini wrote:
> On 25/08/2017 15:14, Adam Borowski wrote:
> >>> I would also try commit 1372324b328cd5dabaef5e345e37ad48c63df2a9 to
> >>> identify whether it was caused by a KVM change in 4.13 or something
> >>> else.
> > I've ran different guests for a couple of hours, no explosions.  Thus it
> > looks like updating Cornelia's email address isn't the cause.
> > 
> > Too bad, there's 15k commits between 1372324b and 7f680d7ec315.
> 
> So:
> 
> - 4.12 works
> 
> - 1372324b328cd5dabaef5e345e37ad48c63df2a9 works
> 
> - 4.13-rc6 fails
> 
> The next ones to test are going to be
> c136b84393d4e340e1b53fc7f737dd5827b19ee5 and 4.13-rc1.

c136b84393d4e340e1b53fc7f737dd5827b19ee5 works

4.13-rc1 works
Which actually isn't so surprising, as I pull from linus/master every Sunday
night/Monday morning, so I'd would have noticed KVM breakage sooner.

4.13-rc4 works

4.13-rc5 works (but ↓)

v4.13-rc5-173-g58d4e450a490 works... uh oh.
It shouldn't -- it's merge-base between mainline and what I was running on
the initial crash, and I'm sure anything non-mainline I had isn't the
culprit.  After a couple of hours of running various loads inside and
outside KVM, I finally got it to crash.

4.13-rc5 retested fails
Crashed only after two hours or so of testing.

4.13-rc4 apparently works
It survived several hours of varied tests (like 5 debian-installer runs, a
win10 point release upgrade, some hurd package building, openbsd, etc),
all while the host was likewise busy.


Thus: to the best of my knowledge, the problem is between 4.13-rc4 and 4.13-rc5
but I wouldn't bet my life on it.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢰⠒⠀⣿⡁ Vat kind uf sufficiently advanced technology iz dis!?
⢿⡄⠘⠷⠚⠋⠀ -- Genghis Ht'rok'din
⠈⠳⣄ 


[PATCH] DSA support for Micrel KSZ8895

2017-08-27 Thread Pavel Machek
Hi!

So I fought with the driver a bit more, and now I have something that
kind-of-works.

"great great hack" belows worries me.

Yeah, disabled code needs to be removed before merge.

No, tag_ksz part probably is not acceptable. Do you see solution
better than just copying it into tag_ksz1 file?

Any more comments, etc?

Help would be welcome.

Best regards,
Pavel

Signed-off-by: Pavel Machek 

diff --git a/drivers/net/dsa/microchip/Kconfig 
b/drivers/net/dsa/microchip/Kconfig
index a8b8f59099ce..7b7d7ddb3488 100644
--- a/drivers/net/dsa/microchip/Kconfig
+++ b/drivers/net/dsa/microchip/Kconfig
@@ -1,12 +1,25 @@
 menuconfig MICROCHIP_KSZ
-   tristate "Microchip KSZ series switch support"
+   tristate "Microchip KSZ 9477 series switch support"
+   depends on NET_DSA
+   select NET_DSA_TAG_KSZ
+   help
+ This driver adds support for Microchip KSZ switch chips.
+
+menuconfig MICROCHIP_KSZ_8895
+   tristate "Microchip KSZ 8895 series switch support"
depends on NET_DSA
select NET_DSA_TAG_KSZ
help
  This driver adds support for Microchip KSZ switch chips.
 
 config MICROCHIP_KSZ_SPI_DRIVER
-   tristate "KSZ series SPI connected switch driver"
+   tristate "KSZ 9477 series SPI connected switch driver"
depends on MICROCHIP_KSZ && SPI
help
  Select to enable support for registering switches configured through 
SPI.
+
+config MICROCHIP_KSZ_8895_SPI_DRIVER
+   tristate "KSZ 8895 series SPI connected switch driver"
+   depends on MICROCHIP_KSZ_8895 && SPI
+   help
+ Select to enable support for registering switches configured through 
SPI.
diff --git a/drivers/net/dsa/microchip/Makefile 
b/drivers/net/dsa/microchip/Makefile
index ed335e29fae8..b6a17f79d2d9 100644
--- a/drivers/net/dsa/microchip/Makefile
+++ b/drivers/net/dsa/microchip/Makefile
@@ -1,2 +1,4 @@
 obj-$(CONFIG_MICROCHIP_KSZ)+= ksz_common.o
+obj-$(CONFIG_MICROCHIP_KSZ_8895)+= ksz_8895.o
 obj-$(CONFIG_MICROCHIP_KSZ_SPI_DRIVER) += ksz_spi.o
+obj-$(CONFIG_MICROCHIP_KSZ_8895_SPI_DRIVER)+= ksz_8895_spi.o
diff --git a/drivers/net/dsa/microchip/ksz_8895.c 
b/drivers/net/dsa/microchip/ksz_8895.c
new file mode 100644
index ..d546e08b1281
--- /dev/null
+++ b/drivers/net/dsa/microchip/ksz_8895.c
@@ -0,0 +1,721 @@
+/*
+ * Microchip switch driver main logic
+ *
+ * Copyright (C) 2017
+ * Copyright (C) 2017 Pavel Machek 
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ksz_8895_reg.h"
+#include "ksz_priv.h"
+
+static const struct {
+   int index;
+   char string[ETH_GSTRING_LEN];
+} mib_names[TOTAL_SWITCH_COUNTER_NUM] = {
+   { 0x00, "???" },
+};
+
+static void ksz_cfg(struct ksz_device *dev, u32 addr, u8 bits, bool set)
+{
+   u8 data;
+
+   ksz_read8(dev, addr, &data);
+   if (set)
+   data |= bits;
+   else
+   data &= ~bits;
+   ksz_write8(dev, addr, data);
+}
+
+#if 0
+static void ksz_cfg32(struct ksz_device *dev, u32 addr, u32 bits, bool set)
+{
+   u32 data;
+
+   ksz_read32(dev, addr, &data);
+   if (set)
+   data |= bits;
+   else
+   data &= ~bits;
+   ksz_write32(dev, addr, data);
+}
+#endif
+
+static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits,
+bool set)
+{
+   u32 addr;
+   u8 data;
+
+   addr = PORT_CTRL_ADDR(port, offset);
+   ksz_read8(dev, addr, &data);
+
+   if (set)
+   data |= bits;
+   else
+   data &= ~bits;
+
+   ksz_write8(dev, addr, data);
+}
+
+#if 0
+static void ksz_port_cfg32(struct ksz_device *dev, int port, int offset,
+  u32 bits, bool set)
+{
+   u32 addr;
+   u32 data;
+
+   addr = PORT_CTRL_ADDR(port, offset);
+   ksz_read32(dev, addr, &data);
+
+   if (set)
+   data |= bits;
+   else
+   data &= ~bits;
+
+   ksz_write32(dev, addr, data);
+}
+#endif
+
+#define NOTIMPL() do { NOTIMPLV(); return -EJUKEBOX; } while (0)
+#de

Re: [PATCH 0/4] net: stmmac: revert the EMAC bindings

2017-08-27 Thread Chen-Yu Tsai
On Sat, Aug 26, 2017 at 3:12 AM, Maxime Ripard
 wrote:
> Hi,
>
> The bindings of the stmmac glue for the new Allwinner EMAC controller
> are still controversial and being discussed, even though they've been
> merged in 4.13.
>
> In order not to introduce any binding we do not really want to commit
> to in a stable release, especially since that would mean we would have
> to support both the right and old bindings, let's revert them.
>
> We will reintroduce them in due time, once the discussion has settled
> down.
>
> The first three patches should go through the arm-soc tree, the last
> one through the net tree. All of them must be treated as fixes.
>
> Thanks!
> Maxime
>
> Maxime Ripard (4):
>   dt-bindings: net: Revert sun8i dwmac binding
>   arm64: dts: allwinner: Revert EMAC changes
>   arm: dts: sunxi: Revert EMAC changes
>   net: stmmac: sun8i: Remove the compatibles
>
>  .../devicetree/bindings/net/dwmac-sun8i.txt| 84 
> --
>  arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts  |  9 ---
>  arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts| 19 -
>  arch/arm/boot/dts/sun8i-h3-beelink-x2.dts  |  8 ---

I think this particular change is in -next, not v4.13-rc.

Otherwise, whole series is

Acked-by: Chen-Yu Tsai 

>  arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts  |  7 --
>  arch/arm/boot/dts/sun8i-h3-orangepi-2.dts  |  8 ---
>  arch/arm/boot/dts/sun8i-h3-orangepi-one.dts|  8 ---
>  arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts|  5 --
>  arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts |  8 ---
>  arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts   | 22 --
>  arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts | 16 -
>  arch/arm/boot/dts/sunxi-h3-h5.dtsi | 26 ---
>  .../boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 17 -
>  .../boot/dts/allwinner/sun50i-a64-pine64-plus.dts  | 15 
>  .../arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 18 -
>  .../dts/allwinner/sun50i-a64-sopine-baseboard.dts  | 17 -
>  arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi  | 20 --
>  .../boot/dts/allwinner/sun50i-h5-nanopi-neo2.dts   | 17 -
>  .../boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts  | 17 -
>  .../dts/allwinner/sun50i-h5-orangepi-prime.dts | 17 -
>  drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c  |  8 ---
>  21 files changed, 366 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/net/dwmac-sun8i.txt
>
> --
> 2.13.5
>


[git pull] IOMMU Fixes for Linux iommu-fixes-v4.13-rc6

2017-08-27 Thread Joerg Roedel
Hi Linus,

The following changes since commit a7990c647b35415e3dd07a077480a908678947ba:

  iommu/arm-smmu: fix null-pointer dereference in arm_smmu_add_device 
(2017-08-11 16:56:51 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git 
tags/iommu-fixes-v4.13-rc6

for you to fetch changes up to 2926a2aa5c14fb2add75e6584845b1c03022235f:

  iommu: Fix wrong freeing of iommu_device->dev (2017-08-15 13:58:48 +0200)


IOMMU Fixes for Linux v4.13-rc6

Another fix, this time in common IOMMU sysfs code

- In the conversion from the old iommu sysfs-code to the
  iommu_device_register interface, I missed to update the
  release path for the struct device associated with an IOMMU.
  It freed the 'struct device', which was a pointer before, but
  is now embedded in another struct. Freeing from the middle of
  allocated memory had all kinds of nasty side effects when an
  IOMMU was unplugged. Unfortunatly nobody unplugged and IOMMU
  until now, so this was not discovered earlier.  The fix is to
  make the 'struct device' a pointer again.


Joerg Roedel (1):
  iommu: Fix wrong freeing of iommu_device->dev

 drivers/iommu/amd_iommu_types.h |  4 +++-
 drivers/iommu/intel-iommu.c |  4 +++-
 drivers/iommu/iommu-sysfs.c | 32 
 include/linux/iommu.h   | 12 +++-
 4 files changed, 37 insertions(+), 15 deletions(-)

Please pull.

Thanks,

Joerg


signature.asc
Description: Digital signature


[PATCH] Revert "pinctrl: sunxi: Don't enforce bias disable (for now)"

2017-08-27 Thread Priit Laes
This reverts commit 2154d94b40ea2a5de05245521371d0461bb0d669.

The original patch was intented to avoid some issues with the sunxi
gpio rework and was supposed to be reverted after all the required
DT bits had been merged around v4.10.

Signed-off-by: Priit Laes 
---
 drivers/pinctrl/sunxi/pinctrl-sunxi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c 
b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 0dfd7fa66c48..52edf3b5988d 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -564,7 +564,8 @@ static int sunxi_pconf_group_set(struct pinctrl_dev 
*pctldev,
val = arg / 10 - 1;
break;
case PIN_CONFIG_BIAS_DISABLE:
-   continue;
+   val = 0;
+   break;
case PIN_CONFIG_BIAS_PULL_UP:
if (arg == 0)
return -EINVAL;
-- 
2.13.5



[PATCH 3/3] arm64: dts: realtek: Add ProBox2 Ava

2017-08-27 Thread Andreas Färber
Add a Device Tree for the PROBOX2 AVA TV Box.
Move common memory reservations into rtd1295.dtsi.

Cc: supp...@probox2.com
Signed-off-by: Andreas Färber 
---
 I've been torn on whether this should be just rtd1295-ava.dts?
 The vendor is indicated in the compatible string and model property.
 rtd1295-x9s.dts hadn't sounded unique enough to me, but we might revisit that.
 
 arch/arm64/boot/dts/realtek/Makefile   |  1 +
 .../arm64/boot/dts/realtek/rtd1295-probox2-ava.dts | 31 ++
 arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts  |  6 -
 arch/arm64/boot/dts/realtek/rtd1295.dtsi   |  6 +
 4 files changed, 38 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts

diff --git a/arch/arm64/boot/dts/realtek/Makefile 
b/arch/arm64/boot/dts/realtek/Makefile
index 8521e921e59a..f43d0209ded7 100644
--- a/arch/arm64/boot/dts/realtek/Makefile
+++ b/arch/arm64/boot/dts/realtek/Makefile
@@ -1,3 +1,4 @@
+dtb-$(CONFIG_ARCH_REALTEK) += rtd1295-probox2-ava.dtb
 dtb-$(CONFIG_ARCH_REALTEK) += rtd1295-zidoo-x9s.dtb
 
 always := $(dtb-y)
diff --git a/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts 
b/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts
new file mode 100644
index ..8e2b0e75298a
--- /dev/null
+++ b/arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017 Andreas Färber
+ *
+ * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+ */
+
+/dts-v1/;
+
+#include "rtd1295.dtsi"
+
+/ {
+   compatible = "probox2,ava", "realtek,rtd1295";
+   model = "PROBOX2 AVA";
+
+   memory@0 {
+   device_type = "memory";
+   reg = <0x0 0x8000>;
+   };
+
+   aliases {
+   serial0 = &uart0;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+&uart0 {
+   status = "okay";
+};
diff --git a/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts 
b/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts
index 6efa8091bb30..da19faab29d5 100644
--- a/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts
+++ b/arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts
@@ -6,12 +6,6 @@
 
 /dts-v1/;
 
-/memreserve/   0x 0x0003;
-/memreserve/   0x0001f000 0x1000;
-/memreserve/   0x0003 0x000d;
-/memreserve/   0x01b0 0x004be000;
-/memreserve/   0x01ffe000 0x4000;
-
 #include "rtd1295.dtsi"
 
 / {
diff --git a/arch/arm64/boot/dts/realtek/rtd1295.dtsi 
b/arch/arm64/boot/dts/realtek/rtd1295.dtsi
index 8ae0949ad89e..c0b48953439a 100644
--- a/arch/arm64/boot/dts/realtek/rtd1295.dtsi
+++ b/arch/arm64/boot/dts/realtek/rtd1295.dtsi
@@ -6,6 +6,12 @@
  * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  */
 
+/memreserve/   0x 0x0003;
+/memreserve/   0x0001f000 0x1000;
+/memreserve/   0x0003 0x000d;
+/memreserve/   0x01b0 0x004be000;
+/memreserve/   0x01ffe000 0x4000;
+
 #include 
 #include 
 #include 
-- 
2.12.3



[PATCH 2/3] dt-bindings: arm: realtek: Add ProBox2 AVA

2017-08-27 Thread Andreas Färber
Document a compatible string for the PROBOX2 AVA TV Box.

Cc: supp...@probox2.com
Signed-off-by: Andreas Färber 
---
 Documentation/devicetree/bindings/arm/realtek.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/realtek.txt 
b/Documentation/devicetree/bindings/arm/realtek.txt
index 13d755787b4f..297c15eb81e2 100644
--- a/Documentation/devicetree/bindings/arm/realtek.txt
+++ b/Documentation/devicetree/bindings/arm/realtek.txt
@@ -12,6 +12,7 @@ Required root node properties:
 
 Root node property compatible must contain, depending on board:
 
+ - ProBox2 AVA: "probox2,ava"
  - Zidoo X9S: "zidoo,x9s"
 
 
-- 
2.12.3



[PATCH 1/3] dt-bindings: Add vendor prefix for ProBox2

2017-08-27 Thread Andreas Färber
PROBOX2 is a Hong Kong based manufacturer of TV boxes.

Cc: supp...@probox2.com
Signed-off-by: Andreas Färber 
---
 I did not find a fully spelled out company name for this brand.
 
 http://probox2.com/contact-us/
 https://www.facebook.com/pg/probox2/about/
 
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 37867c3cb94b..683b1693078f 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -261,6 +261,7 @@ plathomePlat'Home Co., Ltd.
 plda   PLDA
 poslab Poslab Technology Co., Ltd.
 powervrPowerVR (deprecated, use img)
+probox2PROBOX2
 pulsedlightPulsedLight, Inc
 qcaQualcomm Atheros, Inc.
 qcom   Qualcomm Technologies, Inc
-- 
2.12.3



[PATCH 0/3] arm64: dts: Initial ProBox2 Ava support

2017-08-27 Thread Andreas Färber
Hello,

This mini-series adds a Device Tree for the PROBOX2 AVA Android TV Box.

Unlike the Zidoo X9S, serial (loady) was the only working way to boot a new
kernel from the vendor's U-Boot on this TV Box.
PROBOX2 support has been informed about bootloader issues with Ethernet, USB
and FAT on SD; the same symptoms have since been observed on the Lake I, so
be warned that those bugs might inconvenience other RTD1295 devices, too.

More details at:
https://en.opensuse.org/HCL:ProBox2_Ava

@PROBOX2: Please review the following three patches and either signal your
acknowledgement of my naming with an "Acked-by: name " line or point
out any changes you would like to see applied (e.g., company name). Thanks!

Latest experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next

Have a lot of fun!

Cheers,
Andreas

Cc: supp...@probox2.com
Cc: devicet...@vger.kernel.org

Cc: Wangchanchan 
Cc: beelinkserv...@bee-link.com

Andreas Färber (3):
  dt-bindings: Add vendor prefix for ProBox2
  dt-bindings: arm: realtek: Add ProBox2 AVA
  arm64: dts: realtek: Add ProBox2 Ava

 Documentation/devicetree/bindings/arm/realtek.txt  |  1 +
 .../devicetree/bindings/vendor-prefixes.txt|  1 +
 arch/arm64/boot/dts/realtek/Makefile   |  1 +
 .../arm64/boot/dts/realtek/rtd1295-probox2-ava.dts | 31 ++
 arch/arm64/boot/dts/realtek/rtd1295-zidoo-x9s.dts  |  6 -
 arch/arm64/boot/dts/realtek/rtd1295.dtsi   |  6 +
 6 files changed, 40 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm64/boot/dts/realtek/rtd1295-probox2-ava.dts

-- 
2.12.3



Re: Stable apply request [was: Bluetooth: bnep: fix possible might sleep error in bnep_session]

2017-08-27 Thread Greg KH
On Wed, Aug 23, 2017 at 08:14:15PM +0200, Marcel Holtmann wrote:
> Hi Jiri,
> 
> >>> It looks like bnep_session has same pattern as the issue reported in
> >>> old rfcomm:
> >>> 
> >>>   while (1) {
> >>>   set_current_state(TASK_INTERRUPTIBLE);
> >>>   if (condition)
> >>>   break;
> >>>   // may call might_sleep here
> >>>   schedule();
> >>>   }
> >>>   __set_current_state(TASK_RUNNING);
> >>> 
> >>> Which fixed at:
> >>>   dfb2fae Bluetooth: Fix nested sleeps
> >>> 
> >>> So let's fix it at the same way, also follow the suggestion of:
> >>> https://lwn.net/Articles/628628/
> > 
> > ...
> > 
> >> all 3 patches have been applied to bluetooth-next tree.
> > 
> > Hi,
> > 
> > given users are hitting it in at least 4.4 and 4.12, can we have all
> > three in all stables where this applies?
> > 
> > 5da8e47d849d Bluetooth: hidp: fix possible might sleep error in
> > hidp_session_thread
> > f06d977309d0 Bluetooth: cmtp: fix possible might sleep error in cmtp_session
> > 25717382c1dd Bluetooth: bnep: fix possible might sleep error in bnep_session
> > 
> > I am not sure: to stable directly or via net stable?
> 
> as Dave said, just email -stable directly and have Greg pick them up.

All now picked up :)


[PATCH v4 7/7] dpaa_eth: check allocation result

2017-08-27 Thread Madalin Bucur
Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 73ca8d7..4225806 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -2561,6 +2561,9 @@ static struct dpaa_bp *dpaa_bp_alloc(struct device *dev)
 
dpaa_bp->bpid = FSL_DPAA_BPID_INV;
dpaa_bp->percpu_count = devm_alloc_percpu(dev, *dpaa_bp->percpu_count);
+   if (!dpaa_bp->percpu_count)
+   return ERR_PTR(-ENOMEM);
+
dpaa_bp->config_count = FSL_DPAA_ETH_MAX_BUF_COUNT;
 
dpaa_bp->seed_cb = dpaa_bp_seed;
-- 
2.1.0



[PATCH v4 6/7] Documentation: networking: add RSS information

2017-08-27 Thread Madalin Bucur
Signed-off-by: Madalin Bucur 
---
 Documentation/networking/dpaa.txt | 68 ++-
 1 file changed, 67 insertions(+), 1 deletion(-)

diff --git a/Documentation/networking/dpaa.txt 
b/Documentation/networking/dpaa.txt
index 76e016d..f88194f 100644
--- a/Documentation/networking/dpaa.txt
+++ b/Documentation/networking/dpaa.txt
@@ -13,6 +13,7 @@ Contents
- Configuring DPAA Ethernet in your kernel
- DPAA Ethernet Frame Processing
- DPAA Ethernet Features
+   - DPAA IRQ Affinity and Receive Side Scaling
- Debugging
 
 DPAA Ethernet Overview
@@ -147,7 +148,10 @@ gradually.
 
 The driver has Rx and Tx checksum offloading for UDP and TCP. Currently the Rx
 checksum offload feature is enabled by default and cannot be controlled through
-ethtool.
+ethtool. Also, rx-flow-hash and rx-hashing was added. The addition of RSS
+provides a big performance boost for the forwarding scenarios, allowing
+different traffic flows received by one interface to be processed by different
+CPUs in parallel.
 
 The driver has support for multiple prioritized Tx traffic classes. Priorities
 range from 0 (lowest) to 3 (highest). These are mapped to HW workqueues with
@@ -166,6 +170,68 @@ classes as follows:
 tc qdisc add dev  root handle 1: \
 mqprio num_tc 4 map 0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 3 hw 1
 
+DPAA IRQ Affinity and Receive Side Scaling
+==
+
+Traffic coming on the DPAA Rx queues or on the DPAA Tx confirmation
+queues is seen by the CPU as ingress traffic on a certain portal.
+The DPAA QMan portal interrupts are affined each to a certain CPU.
+The same portal interrupt services all the QMan portal consumers.
+
+By default the DPAA Ethernet driver enables RSS, making use of the
+DPAA FMan Parser and Keygen blocks to distribute traffic on 128
+hardware frame queues using a hash on IP v4/v6 source and destination
+and L4 source and destination ports, in present in the received frame.
+When RSS is disabled, all traffic received by a certain interface is
+received on the default Rx frame queue. The default DPAA Rx frame
+queues are configured to put the received traffic into a pool channel
+that allows any available CPU portal to dequeue the ingress traffic.
+The default frame queues have the HOLDACTIVE option set, ensuring that
+traffic bursts from a certain queue are serviced by the same CPU.
+This ensures a very low rate of frame reordering. A drawback of this
+is that only one CPU at a time can service the traffic received by a
+certain interface when RSS is not enabled.
+
+To implement RSS, the DPAA Ethernet driver allocates an extra set of
+128 Rx frame queues that are configured to dedicated channels, in a
+round-robin manner. The mapping of the frame queues to CPUs is now
+hardcoded, there is no indirection table to move traffic for a certain
+FQ (hash result) to another CPU. The ingress traffic arriving on one
+of these frame queues will arrive at the same portal and will always
+be processed by the same CPU. This ensures intra-flow order preservation
+and workload distribution for multiple traffic flows.
+
+RSS can be turned off for a certain interface using ethtool, i.e.
+
+   # ethtool -N fm1-mac9 rx-flow-hash tcp4 ""
+
+To turn it back on, one needs to set rx-flow-hash for tcp4/6 or udp4/6:
+
+   # ethtool -N fm1-mac9 rx-flow-hash udp4 sfdn
+
+There is no independent control for individual protocols, any command
+run for one of tcp4|udp4|ah4|esp4|sctp4|tcp6|udp6|ah6|esp6|sctp6 is
+going to control the rx-flow-hashing for all protocols on that interface.
+
+Besides using the FMan Keygen computed hash for spreading traffic on the
+128 Rx FQs, the DPAA Ethernet driver also sets the skb hash value when
+the NETIF_F_RXHASH feature is on (active by default). This can be turned
+on or off through ethtool, i.e.:
+
+   # ethtool -K fm1-mac9 rx-hashing off
+   # ethtool -k fm1-mac9 | grep hash
+   receive-hashing: off
+   # ethtool -K fm1-mac9 rx-hashing on
+   Actual changes:
+   receive-hashing: on
+   # ethtool -k fm1-mac9 | grep hash
+   receive-hashing: on
+
+Please note that Rx hashing depends upon the rx-flow-hashing being on
+for that interface - turning off rx-flow-hashing will also disable the
+rx-hashing (without ethtool reporting it as off as that depends on the
+NETIF_F_RXHASH feature flag).
+
 Debugging
 =
 
-- 
2.1.0



[PATCH v4 1/7] fsl/fman: move struct fman to header file

2017-08-27 Thread Madalin Bucur
Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/fman/fman.c  | 80 +
 drivers/net/ethernet/freescale/fman/fman.h  | 75 +++
 drivers/net/ethernet/freescale/fman/fman_port.c |  8 +--
 3 files changed, 82 insertions(+), 81 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fman/fman.c 
b/drivers/net/ethernet/freescale/fman/fman.c
index e714b8f..8179cc1 100644
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -32,9 +32,6 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include "fman.h"
-#include "fman_muram.h"
-
 #include 
 #include 
 #include 
@@ -46,6 +43,9 @@
 #include 
 #include 
 
+#include "fman.h"
+#include "fman_muram.h"
+
 /* General defines */
 #define FMAN_LIODN_TBL 64  /* size of LIODN table */
 #define MAX_NUM_OF_MACS10
@@ -564,80 +564,6 @@ struct fman_cfg {
u32 qmi_def_tnums_thresh;
 };
 
-/* Structure that holds information received from device tree */
-struct fman_dts_params {
-   void __iomem *base_addr;/* FMan virtual address */
-   struct resource *res;   /* FMan memory resource */
-   u8 id;  /* FMan ID */
-
-   int err_irq;/* FMan Error IRQ */
-
-   u16 clk_freq;   /* FMan clock freq (In Mhz) */
-
-   u32 qman_channel_base;  /* QMan channels base */
-   u32 num_of_qman_channels;   /* Number of QMan channels */
-
-   struct resource muram_res;  /* MURAM resource */
-};
-
-/** fman_exceptions_cb
- * fman- Pointer to FMan
- * exception   - The exception.
- *
- * Exceptions user callback routine, will be called upon an exception
- * passing the exception identification.
- *
- * Return: irq status
- */
-typedef irqreturn_t (fman_exceptions_cb)(struct fman *fman,
-enum fman_exceptions exception);
-
-/** fman_bus_error_cb
- * fman- Pointer to FMan
- * port_id - Port id
- * addr- Address that caused the error
- * tnum- Owner of error
- * liodn   - Logical IO device number
- *
- * Bus error user callback routine, will be called upon bus error,
- * passing parameters describing the errors and the owner.
- *
- * Return: IRQ status
- */
-typedef irqreturn_t (fman_bus_error_cb)(struct fman *fman, u8 port_id,
-   u64 addr, u8 tnum, u16 liodn);
-
-struct fman {
-   struct device *dev;
-   void __iomem *base_addr;
-   struct fman_intr_src intr_mng[FMAN_EV_CNT];
-
-   struct fman_fpm_regs __iomem *fpm_regs;
-   struct fman_bmi_regs __iomem *bmi_regs;
-   struct fman_qmi_regs __iomem *qmi_regs;
-   struct fman_dma_regs __iomem *dma_regs;
-   struct fman_hwp_regs __iomem *hwp_regs;
-   fman_exceptions_cb *exception_cb;
-   fman_bus_error_cb *bus_error_cb;
-   /* Spinlock for FMan use */
-   spinlock_t spinlock;
-   struct fman_state_struct *state;
-
-   struct fman_cfg *cfg;
-   struct muram_info *muram;
-   /* cam section in muram */
-   unsigned long cam_offset;
-   size_t cam_size;
-   /* Fifo in MURAM */
-   unsigned long fifo_offset;
-   size_t fifo_size;
-
-   u32 liodn_base[64];
-   u32 liodn_offset[64];
-
-   struct fman_dts_params dts_params;
-};
-
 static irqreturn_t fman_exceptions(struct fman *fman,
   enum fman_exceptions exception)
 {
diff --git a/drivers/net/ethernet/freescale/fman/fman.h 
b/drivers/net/ethernet/freescale/fman/fman.h
index f53e147..1015dac 100644
--- a/drivers/net/ethernet/freescale/fman/fman.h
+++ b/drivers/net/ethernet/freescale/fman/fman.h
@@ -34,6 +34,8 @@
 #define __FM_H
 
 #include 
+#include 
+#include 
 
 /* FM Frame descriptor macros  */
 /* Frame queue Context Override */
@@ -274,6 +276,79 @@ struct fman_intr_src {
void *src_handle;
 };
 
+/** fman_exceptions_cb
+ * fman - Pointer to FMan
+ * exception- The exception.
+ *
+ * Exceptions user callback routine, will be called upon an exception
+ * passing the exception identification.
+ *
+ * Return: irq status
+ */
+typedef irqreturn_t (fman_exceptions_cb)(struct fman *fman,
+enum fman_exceptions exception);
+/** fman_bus_error_cb
+ * fman - Pointer to FMan
+ * port_id  - Port id
+ * addr - Address that caused the error
+ * tnum - Owner of error
+ * liodn- Logical IO device number
+ *
+ * Bus error user callback routine, will be called upon bus error,
+ * passing parameters describing the errors and the owner.
+ *
+ * Return: IRQ status
+ */
+typedef irqreturn_t (fman_bus_error_cb)(struct fman *fman, u8 port_id,
+   u64 addr, u8 tnum, u16 liodn);
+
+/* 

[PATCH v4 0/7] Add RSS to DPAA 1.x Ethernet driver

2017-08-27 Thread Madalin Bucur
This patch set introduces Receive Side Scaling for the DPAA Ethernet
driver. Documentation is updated with details related to the new
feature and limitations that apply.
Added also a small fix.

v2: removed a C++ style comment
v3: move struct fman to header file to avoid exporting a function
v4: addressed compilation issues introduced in v3

Iordache Florinel-R70177 (1):
  fsl/fman: enable FMan Keygen

Madalin Bucur (6):
  fsl/fman: move struct fman to header file
  dpaa_eth: use multiple Rx frame queues
  dpaa_eth: enable Rx hashing control
  dpaa_eth: add NETIF_F_RXHASH
  Documentation: networking: add RSS information
  dpaa_eth: check allocation result

 Documentation/networking/dpaa.txt  |  68 +-
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c |  76 +-
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |   2 +
 .../net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c   |   3 +
 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 118 
 drivers/net/ethernet/freescale/fman/Makefile   |   2 +-
 drivers/net/ethernet/freescale/fman/fman.c |  88 +--
 drivers/net/ethernet/freescale/fman/fman.h |  77 ++
 drivers/net/ethernet/freescale/fman/fman_keygen.c  | 783 +
 drivers/net/ethernet/freescale/fman/fman_keygen.h  |  46 ++
 drivers/net/ethernet/freescale/fman/fman_port.c|  59 +-
 drivers/net/ethernet/freescale/fman/fman_port.h|   7 +
 12 files changed, 1235 insertions(+), 94 deletions(-)
 create mode 100644 drivers/net/ethernet/freescale/fman/fman_keygen.c
 create mode 100644 drivers/net/ethernet/freescale/fman/fman_keygen.h

-- 
2.1.0



[PATCH v4 5/7] dpaa_eth: add NETIF_F_RXHASH

2017-08-27 Thread Madalin Bucur
Set the skb hash when then FMan Keygen hash result is available.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 23 +++---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |  1 +
 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c |  9 +++--
 drivers/net/ethernet/freescale/fman/fman_port.c| 11 +++
 drivers/net/ethernet/freescale/fman/fman_port.h|  2 ++
 5 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 6d89e74..73ca8d7 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -236,7 +236,7 @@ static int dpaa_netdev_init(struct net_device *net_dev,
net_dev->max_mtu = dpaa_get_max_mtu();
 
net_dev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
-NETIF_F_LLTX);
+NETIF_F_LLTX | NETIF_F_RXHASH);
 
net_dev->hw_features |= NETIF_F_SG | NETIF_F_HIGHDMA;
/* The kernels enables GSO automatically, if we declare NETIF_F_SG.
@@ -2237,12 +2237,13 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct 
qman_portal *portal,
dma_addr_t addr = qm_fd_addr(fd);
enum qm_fd_format fd_format;
struct net_device *net_dev;
-   u32 fd_status;
+   u32 fd_status, hash_offset;
struct dpaa_bp *dpaa_bp;
struct dpaa_priv *priv;
unsigned int skb_len;
struct sk_buff *skb;
int *count_ptr;
+   void *vaddr;
 
fd_status = be32_to_cpu(fd->status);
fd_format = qm_fd_get_format(fd);
@@ -2288,7 +2289,8 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct 
qman_portal *portal,
dma_unmap_single(dpaa_bp->dev, addr, dpaa_bp->size, DMA_FROM_DEVICE);
 
/* prefetch the first 64 bytes of the frame or the SGT start */
-   prefetch(phys_to_virt(addr) + qm_fd_get_offset(fd));
+   vaddr = phys_to_virt(addr);
+   prefetch(vaddr + qm_fd_get_offset(fd));
 
fd_format = qm_fd_get_format(fd);
/* The only FD types that we may receive are contig and S/G */
@@ -2309,6 +2311,18 @@ static enum qman_cb_dqrr_result rx_default_dqrr(struct 
qman_portal *portal,
 
skb->protocol = eth_type_trans(skb, net_dev);
 
+   if (net_dev->features & NETIF_F_RXHASH && priv->keygen_in_use &&
+   !fman_port_get_hash_result_offset(priv->mac_dev->port[RX],
+ &hash_offset)) {
+   enum pkt_hash_types type;
+
+   /* if L4 exists, it was used in the hash generation */
+   type = be32_to_cpu(fd->status) & FM_FD_STAT_L4CV ?
+   PKT_HASH_TYPE_L4 : PKT_HASH_TYPE_L3;
+   skb_set_hash(skb, be32_to_cpu(*(u32 *)(vaddr + hash_offset)),
+type);
+   }
+
skb_len = skb->len;
 
if (unlikely(netif_receive_skb(skb) == NET_RX_DROP))
@@ -2774,6 +2788,9 @@ static int dpaa_eth_probe(struct platform_device *pdev)
if (err)
goto init_ports_failed;
 
+   /* Rx traffic distribution based on keygen hashing defaults to on */
+   priv->keygen_in_use = true;
+
priv->percpu_priv = devm_alloc_percpu(dev, *priv->percpu_priv);
if (!priv->percpu_priv) {
dev_err(dev, "devm_alloc_percpu() failed\n");
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
index 496a12c..bd94220 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
@@ -159,6 +159,7 @@ struct dpaa_priv {
struct list_head dpaa_fq_list;
 
u8 num_tc;
+   bool keygen_in_use;
u32 msg_enable; /* net_device message level */
 
struct {
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
index 965f652..faea674 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
@@ -402,6 +402,8 @@ static void dpaa_get_strings(struct net_device *net_dev, 
u32 stringset,
 static int dpaa_get_hash_opts(struct net_device *dev,
  struct ethtool_rxnfc *cmd)
 {
+   struct dpaa_priv *priv = netdev_priv(dev);
+
cmd->data = 0;
 
switch (cmd->flow_type) {
@@ -409,7 +411,8 @@ static int dpaa_get_hash_opts(struct net_device *dev,
case TCP_V6_FLOW:
case UDP_V4_FLOW:
case UDP_V6_FLOW:
-   cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
+   if (priv->keygen_in_use)
+   cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
/* Fall through */
case IPV4_FLOW:
case IPV6_FLOW:
@@ -421,7 +424,8 @@ static int dpaa_get_hash_opts(struct net_device *dev,
case AH_V6_FLOW:

[PATCH v4 2/7] fsl/fman: enable FMan Keygen

2017-08-27 Thread Madalin Bucur
From: Iordache Florinel-R70177 

Add support for the FMan Keygen with a hardcoded scheme to spread
incoming traffic on a FQ range based on source and destination IPs
and ports.

Signed-off-by: Iordache Florinel 
Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/fman/Makefile  |   2 +-
 drivers/net/ethernet/freescale/fman/fman.c|   8 +
 drivers/net/ethernet/freescale/fman/fman.h|   2 +
 drivers/net/ethernet/freescale/fman/fman_keygen.c | 783 ++
 drivers/net/ethernet/freescale/fman/fman_keygen.h |  46 ++
 drivers/net/ethernet/freescale/fman/fman_port.c   |  40 +-
 drivers/net/ethernet/freescale/fman/fman_port.h   |   5 +
 7 files changed, 884 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ethernet/freescale/fman/fman_keygen.c
 create mode 100644 drivers/net/ethernet/freescale/fman/fman_keygen.h

diff --git a/drivers/net/ethernet/freescale/fman/Makefile 
b/drivers/net/ethernet/freescale/fman/Makefile
index 6049177..2c38119 100644
--- a/drivers/net/ethernet/freescale/fman/Makefile
+++ b/drivers/net/ethernet/freescale/fman/Makefile
@@ -4,6 +4,6 @@ obj-$(CONFIG_FSL_FMAN) += fsl_fman.o
 obj-$(CONFIG_FSL_FMAN) += fsl_fman_port.o
 obj-$(CONFIG_FSL_FMAN) += fsl_mac.o
 
-fsl_fman-objs  := fman_muram.o fman.o fman_sp.o
+fsl_fman-objs  := fman_muram.o fman.o fman_sp.o fman_keygen.o
 fsl_fman_port-objs := fman_port.o
 fsl_mac-objs:= mac.o fman_dtsec.o fman_memac.o fman_tgec.o
diff --git a/drivers/net/ethernet/freescale/fman/fman.c 
b/drivers/net/ethernet/freescale/fman/fman.c
index 8179cc1..f420dac 100644
--- a/drivers/net/ethernet/freescale/fman/fman.c
+++ b/drivers/net/ethernet/freescale/fman/fman.c
@@ -45,6 +45,7 @@
 
 #include "fman.h"
 #include "fman_muram.h"
+#include "fman_keygen.h"
 
 /* General defines */
 #define FMAN_LIODN_TBL 64  /* size of LIODN table */
@@ -56,6 +57,7 @@
 /* Modules registers offsets */
 #define BMI_OFFSET 0x0008
 #define QMI_OFFSET 0x00080400
+#define KG_OFFSET  0x000C1000
 #define DMA_OFFSET 0x000C2000
 #define FPM_OFFSET 0x000C3000
 #define IMEM_OFFSET0x000C4000
@@ -1737,6 +1739,7 @@ static int fman_config(struct fman *fman)
fman->qmi_regs = base_addr + QMI_OFFSET;
fman->dma_regs = base_addr + DMA_OFFSET;
fman->hwp_regs = base_addr + HWP_OFFSET;
+   fman->kg_regs = base_addr + KG_OFFSET;
fman->base_addr = base_addr;
 
spin_lock_init(&fman->spinlock);
@@ -2009,6 +2012,11 @@ static int fman_init(struct fman *fman)
/* Init HW Parser */
hwp_init(fman->hwp_regs);
 
+   /* Init KeyGen */
+   fman->keygen = keygen_init(fman->kg_regs);
+   if (!fman->keygen)
+   return -EINVAL;
+
err = enable(fman, cfg);
if (err != 0)
return err;
diff --git a/drivers/net/ethernet/freescale/fman/fman.h 
b/drivers/net/ethernet/freescale/fman/fman.h
index 1015dac..bfa02e0 100644
--- a/drivers/net/ethernet/freescale/fman/fman.h
+++ b/drivers/net/ethernet/freescale/fman/fman.h
@@ -328,6 +328,7 @@ struct fman {
struct fman_qmi_regs __iomem *qmi_regs;
struct fman_dma_regs __iomem *dma_regs;
struct fman_hwp_regs __iomem *hwp_regs;
+   struct fman_kg_regs __iomem *kg_regs;
fman_exceptions_cb *exception_cb;
fman_bus_error_cb *bus_error_cb;
/* Spinlock for FMan use */
@@ -336,6 +337,7 @@ struct fman {
 
struct fman_cfg *cfg;
struct muram_info *muram;
+   struct fman_keygen *keygen;
/* cam section in muram */
unsigned long cam_offset;
size_t cam_size;
diff --git a/drivers/net/ethernet/freescale/fman/fman_keygen.c 
b/drivers/net/ethernet/freescale/fman/fman_keygen.c
new file mode 100644
index 000..f54da3c
--- /dev/null
+++ b/drivers/net/ethernet/freescale/fman/fman_keygen.c
@@ -0,0 +1,783 @@
+/*
+ * Copyright 2017 NXP
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of NXP nor the
+ *   names of its contributors may be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY NXP ``AS IS'' AND ANY
+ * EXPRE

[PATCH v4 3/7] dpaa_eth: use multiple Rx frame queues

2017-08-27 Thread Madalin Bucur
Add a block of 128 Rx frame queues per port. The FMan hardware will
send traffic on one of these queues based on the FMan port Parse
Classify Distribute setup. The hash computed by the FMan Keygen
block will select the Rx FQ.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 50 +++---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h |  1 +
 .../net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c   |  3 ++
 3 files changed, 47 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index c7fa285..6d89e74 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -158,7 +158,7 @@ MODULE_PARM_DESC(tx_timeout, "The Tx timeout in ms");
 #define DPAA_RX_PRIV_DATA_SIZE (u16)(DPAA_TX_PRIV_DATA_SIZE + \
dpaa_rx_extra_headroom)
 
-#define DPAA_ETH_RX_QUEUES 128
+#define DPAA_ETH_PCD_RXQ_NUM   128
 
 #define DPAA_ENQUEUE_RETRIES   10
 
@@ -169,6 +169,7 @@ struct fm_port_fqs {
struct dpaa_fq *tx_errq;
struct dpaa_fq *rx_defq;
struct dpaa_fq *rx_errq;
+   struct dpaa_fq *rx_pcdq;
 };
 
 /* All the dpa bps in use at any moment */
@@ -628,6 +629,7 @@ static inline void dpaa_assign_wq(struct dpaa_fq *fq, int 
idx)
fq->wq = 5;
break;
case FQ_TYPE_RX_DEFAULT:
+   case FQ_TYPE_RX_PCD:
fq->wq = 6;
break;
case FQ_TYPE_TX:
@@ -688,6 +690,7 @@ static int dpaa_alloc_all_fqs(struct device *dev, struct 
list_head *list,
  struct fm_port_fqs *port_fqs)
 {
struct dpaa_fq *dpaa_fq;
+   u32 fq_base, fq_base_aligned, i;
 
dpaa_fq = dpaa_fq_alloc(dev, 0, 1, list, FQ_TYPE_RX_ERROR);
if (!dpaa_fq)
@@ -701,6 +704,26 @@ static int dpaa_alloc_all_fqs(struct device *dev, struct 
list_head *list,
 
port_fqs->rx_defq = &dpaa_fq[0];
 
+   /* the PCD FQIDs range needs to be aligned for correct operation */
+   if (qman_alloc_fqid_range(&fq_base, 2 * DPAA_ETH_PCD_RXQ_NUM))
+   goto fq_alloc_failed;
+
+   fq_base_aligned = ALIGN(fq_base, DPAA_ETH_PCD_RXQ_NUM);
+
+   for (i = fq_base; i < fq_base_aligned; i++)
+   qman_release_fqid(i);
+
+   for (i = fq_base_aligned + DPAA_ETH_PCD_RXQ_NUM;
+i < (fq_base + 2 * DPAA_ETH_PCD_RXQ_NUM); i++)
+   qman_release_fqid(i);
+
+   dpaa_fq = dpaa_fq_alloc(dev, fq_base_aligned, DPAA_ETH_PCD_RXQ_NUM,
+   list, FQ_TYPE_RX_PCD);
+   if (!dpaa_fq)
+   goto fq_alloc_failed;
+
+   port_fqs->rx_pcdq = &dpaa_fq[0];
+
if (!dpaa_fq_alloc(dev, 0, DPAA_ETH_TXQ_NUM, list, FQ_TYPE_TX_CONF_MQ))
goto fq_alloc_failed;
 
@@ -870,13 +893,14 @@ static void dpaa_fq_setup(struct dpaa_priv *priv,
  const struct dpaa_fq_cbs *fq_cbs,
  struct fman_port *tx_port)
 {
-   int egress_cnt = 0, conf_cnt = 0, num_portals = 0, cpu;
+   int egress_cnt = 0, conf_cnt = 0, num_portals = 0, portal_cnt = 0, cpu;
const cpumask_t *affine_cpus = qman_affine_cpus();
-   u16 portals[NR_CPUS];
+   u16 channels[NR_CPUS];
struct dpaa_fq *fq;
 
for_each_cpu(cpu, affine_cpus)
-   portals[num_portals++] = qman_affine_channel(cpu);
+   channels[num_portals++] = qman_affine_channel(cpu);
+
if (num_portals == 0)
dev_err(priv->net_dev->dev.parent,
"No Qman software (affine) channels found");
@@ -890,6 +914,12 @@ static void dpaa_fq_setup(struct dpaa_priv *priv,
case FQ_TYPE_RX_ERROR:
dpaa_setup_ingress(priv, fq, &fq_cbs->rx_errq);
break;
+   case FQ_TYPE_RX_PCD:
+   if (!num_portals)
+   continue;
+   dpaa_setup_ingress(priv, fq, &fq_cbs->rx_defq);
+   fq->channel = channels[portal_cnt++ % num_portals];
+   break;
case FQ_TYPE_TX:
dpaa_setup_egress(priv, fq, tx_port,
  &fq_cbs->egress_ern);
@@ -1039,7 +1069,8 @@ static int dpaa_fq_init(struct dpaa_fq *dpaa_fq, bool 
td_enable)
/* Put all the ingress queues in our "ingress CGR". */
if (priv->use_ingress_cgr &&
(dpaa_fq->fq_type == FQ_TYPE_RX_DEFAULT ||
-dpaa_fq->fq_type == FQ_TYPE_RX_ERROR)) {
+dpaa_fq->fq_type == FQ_TYPE_RX_ERROR ||
+dpaa_fq->fq_type == FQ_TYPE_RX_PCD)) {
initfq.we_mask |= cpu_to_be16(QM_INITFQ_WE_CGID);
initfq.fqd.fq_ctrl |= cpu_to_be16(QM_FQCTRL_CGE);
i

[PATCH v4 4/7] dpaa_eth: enable Rx hashing control

2017-08-27 Thread Madalin Bucur
Allow ethtool control of the Rx flow hashing. By default RSS is
enabled, this allows to turn it off by bypassing the FMan Keygen
block and sending all traffic on the default Rx frame queue.

Signed-off-by: Madalin Bucur 
---
 drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c | 113 +
 1 file changed, 113 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c 
b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
index aad825088..965f652 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c
@@ -399,6 +399,117 @@ static void dpaa_get_strings(struct net_device *net_dev, 
u32 stringset,
memcpy(strings, dpaa_stats_global, size);
 }
 
+static int dpaa_get_hash_opts(struct net_device *dev,
+ struct ethtool_rxnfc *cmd)
+{
+   cmd->data = 0;
+
+   switch (cmd->flow_type) {
+   case TCP_V4_FLOW:
+   case TCP_V6_FLOW:
+   case UDP_V4_FLOW:
+   case UDP_V6_FLOW:
+   cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
+   /* Fall through */
+   case IPV4_FLOW:
+   case IPV6_FLOW:
+   case SCTP_V4_FLOW:
+   case SCTP_V6_FLOW:
+   case AH_ESP_V4_FLOW:
+   case AH_ESP_V6_FLOW:
+   case AH_V4_FLOW:
+   case AH_V6_FLOW:
+   case ESP_V4_FLOW:
+   case ESP_V6_FLOW:
+   cmd->data |= RXH_IP_SRC | RXH_IP_DST;
+   break;
+   default:
+   cmd->data = 0;
+   break;
+   }
+
+   return 0;
+}
+
+static int dpaa_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
+ u32 *unused)
+{
+   int ret = -EOPNOTSUPP;
+
+   switch (cmd->cmd) {
+   case ETHTOOL_GRXFH:
+   ret = dpaa_get_hash_opts(dev, cmd);
+   break;
+   default:
+   break;
+   }
+
+   return ret;
+}
+
+static void dpaa_set_hash(struct net_device *net_dev, bool enable)
+{
+   struct mac_device *mac_dev;
+   struct fman_port *rxport;
+   struct dpaa_priv *priv;
+
+   priv = netdev_priv(net_dev);
+   mac_dev = priv->mac_dev;
+   rxport = mac_dev->port[0];
+
+   fman_port_use_kg_hash(rxport, enable);
+}
+
+static int dpaa_set_hash_opts(struct net_device *dev,
+ struct ethtool_rxnfc *nfc)
+{
+   int ret = -EINVAL;
+
+   /* we support hashing on IPv4/v6 src/dest IP and L4 src/dest port */
+   if (nfc->data &
+   ~(RXH_IP_SRC | RXH_IP_DST | RXH_L4_B_0_1 | RXH_L4_B_2_3))
+   return -EINVAL;
+
+   switch (nfc->flow_type) {
+   case TCP_V4_FLOW:
+   case TCP_V6_FLOW:
+   case UDP_V4_FLOW:
+   case UDP_V6_FLOW:
+   case IPV4_FLOW:
+   case IPV6_FLOW:
+   case SCTP_V4_FLOW:
+   case SCTP_V6_FLOW:
+   case AH_ESP_V4_FLOW:
+   case AH_ESP_V6_FLOW:
+   case AH_V4_FLOW:
+   case AH_V6_FLOW:
+   case ESP_V4_FLOW:
+   case ESP_V6_FLOW:
+   dpaa_set_hash(dev, !!nfc->data);
+   ret = 0;
+   break;
+   default:
+   break;
+   }
+
+   return ret;
+}
+
+static int dpaa_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
+{
+   int ret = -EOPNOTSUPP;
+
+   switch (cmd->cmd) {
+   case ETHTOOL_SRXFH:
+   ret = dpaa_set_hash_opts(dev, cmd);
+   break;
+   default:
+   break;
+   }
+
+   return ret;
+}
+
 const struct ethtool_ops dpaa_ethtool_ops = {
.get_drvinfo = dpaa_get_drvinfo,
.get_msglevel = dpaa_get_msglevel,
@@ -412,4 +523,6 @@ const struct ethtool_ops dpaa_ethtool_ops = {
.get_strings = dpaa_get_strings,
.get_link_ksettings = dpaa_get_link_ksettings,
.set_link_ksettings = dpaa_set_link_ksettings,
+   .get_rxnfc = dpaa_get_rxnfc,
+   .set_rxnfc = dpaa_set_rxnfc,
 };
-- 
2.1.0



[PATCH] staging: r8822be: remove unnecessary call to memset

2017-08-27 Thread Himanshu Jha
call to memset to assign 0 value immediately after allocating
memory with kzalloc is unnecesaary as kzalloc allocates the memory
filled with 0 value.

Build and tested it.

Signed-off-by: Himanshu Jha 
---
 drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c  | 2 --
 drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c | 5 -
 2 files changed, 7 deletions(-)

diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c 
b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c
index ee7c3d0..0551c47 100644
--- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c
+++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx.c
@@ -5308,7 +5308,6 @@ halmac_write_cam_88xx(struct halmac_adapter 
*halmac_adapter, u32 entry_index,
cam_entry_format = kzalloc(sizeof(*cam_entry_format), GFP_KERNEL);
if (!cam_entry_format)
return HALMAC_RET_NULL_POINTER;
-   memset(cam_entry_format, 0x00, sizeof(*cam_entry_format));
 
cam_entry_format->key_id = cam_entry_info->key_id;
cam_entry_format->valid = cam_entry_info->valid;
@@ -5461,7 +5460,6 @@ halmac_clear_cam_entry_88xx(struct halmac_adapter 
*halmac_adapter,
cam_entry_format = kzalloc(sizeof(*cam_entry_format), GFP_KERNEL);
if (!cam_entry_format)
return HALMAC_RET_NULL_POINTER;
-   memset(cam_entry_format, 0x00, sizeof(*cam_entry_format));
 
for (i = 0; i < 8; i++) {
HALMAC_REG_WRITE_32(halmac_adapter, REG_CAMWRITE,
diff --git a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c 
b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
index 50f6f25..f33024e 100644
--- a/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
+++ b/drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_func_88xx.c
@@ -691,7 +691,6 @@ halmac_func_pg_efuse_by_map_88xx(struct halmac_adapter 
*halmac_adapter,
/* out of memory */
return HALMAC_RET_MALLOC_FAIL;
}
-   memset(eeprom_mask_updated, 0x00, eeprom_mask_size);
 
status = halmac_update_eeprom_mask_88xx(halmac_adapter, pg_efuse_info,
eeprom_mask_updated);
@@ -3604,10 +3603,6 @@ halmac_verify_send_rsvd_page_88xx(struct halmac_adapter 
*halmac_adapter)
return HALMAC_RET_MALLOC_FAIL;
}
 
-   memset(rsvd_page, 0x00,
-  h2c_pkt_verify_size +
-  halmac_adapter->hw_config_info.txdesc_size);
-
ret_status = halmac_dump_fifo_88xx(
halmac_adapter, HAL_FIFO_SEL_RSVD_PAGE, 0,
h2c_pkt_verify_size +
-- 
2.7.4



Re: [PATCH v4 1/3] dt-bindings: i2c: modify information formats

2017-08-27 Thread Wolfram Sang
On Mon, Aug 21, 2017 at 11:36:52AM +0800, Jun Gao wrote:
> From: Jun Gao 
> 
> Use common name MediaTek and modify the compatible information
> formats of all SoCs to the same.
> 
> Signed-off-by: Jun Gao 

Applied to for-next, thanks!



signature.asc
Description: PGP signature


Re: [PATCH v4 2/3] dt-bindings: i2c: Add MediaTek MT7622 i2c binding

2017-08-27 Thread Wolfram Sang
On Mon, Aug 21, 2017 at 11:36:53AM +0800, Jun Gao wrote:
> From: Jun Gao 
> 
> Add MT7622 i2c binding to binding file. Compare to MT8173 i2c
> controller, MT7622 limits message numbers to 255, and does not
> support 4GB DMA mode.
> 
> Signed-off-by: Jun Gao 

Applied to for-next, thanks!



signature.asc
Description: PGP signature


Re: [PATCH v4 3/3] i2c: mediatek: Add i2c compatible for MediaTek MT7622

2017-08-27 Thread Wolfram Sang
On Mon, Aug 21, 2017 at 11:36:54AM +0800, Jun Gao wrote:
> From: Jun Gao 
> 
> Add i2c compatible for MT7622. Compare to MT8173 i2c controller,
> MT7622 limits message numbers to 255, and does not support 4GB
> DMA mode.
> 
> Signed-off-by: Jun Gao 
> Reviewed-by: Yingjoe Chen 

Applied to for-next, thanks!



signature.asc
Description: PGP signature


Re: [PATCH net-next v7 05/10] landlock: Add LSM hooks related to filesystem

2017-08-27 Thread Mickaël Salaün

On 26/08/2017 03:16, Alexei Starovoitov wrote:
> On Fri, Aug 25, 2017 at 10:16:39AM +0200, Mickaël Salaün wrote:

>>>
 +/* a directory inode contains only one dentry */
 +HOOK_NEW_FS(inode_create, 3,
 +  struct inode *, dir,
 +  struct dentry *, dentry,
 +  umode_t, mode,
 +  WRAP_ARG_INODE, dir,
 +  WRAP_ARG_RAW, LANDLOCK_ACTION_FS_WRITE
 +);
>>>
>>> more general question: why you're not wrapping all useful
>>> arguments? Like in the above dentry can be acted upon
>>> by the landlock rule and it's readily available...
>>
>> The context used for the FS event must have the exact same types for all
>> calls. This event is meant to be generic but we can add more specific
>> ones if needed, like I do with FS_IOCTL.
> 
> I see. So all FS events will have dentry as first argument
> regardless of how it is in LSM hook ?

All FS events will have a const struct bpf_handle_fs pointer as first
argument, which wrap either a struct file, a struct dentry, a struct
path or a struct inode. Having only one type (struct bpf_handle_fs) is
needed for the eBPF type checker to verify if a Landlock rule (tied to
an event) can access a context field and which operation is allowed
(with this pointer).

> I guess that will simplify the rules indeed.
> I suspect you're doing it to simplify the LSM->landlock shim layer as well, 
> right?

That's right. This ABI is independent from the LSM API and much more
simpler to use.

> 
>> The idea is to enable people to write simple rules, while being able to
>> write fine grain rules for special cases (e.g. IOCTL) if needed.
>>
>>>
>>> The limitation of only 2 args looks odd.
>>> Is it a hard limitation ? how hard to extend?
>>
>> It's not a hard limit at all. Actually, the FS_FNCTL event should have
>> three arguments (I'll add them in the next series): FS handle, FCNTL
>> command and FCNTL argument. I made sure that it's really easy to add
>> more arguments to the context of an event.
> 
> The reason I'm asking, because I'm not completely convinced that
> adding another argument to existing event will be backwards compatible.
> It looks like you're expecting only two args for all FS events, right?

There is four events right now: FS, FS_IOCTL, FS_LOCK and FS_FCNTL. Each
of them are independent. Their context fields can be of the same or
different eBPF type (e.g. scalar, file handle) and numbers. Actually,
these four events have the same arg1 field (file handle) and the same
arg2 eBPF type (scalar), even if arg2 does not have the same semantic
(i.e. abstract FS action, IOCTL command…).

For example, if we want to extend the FS_FCNTL's context in the future,
we will just have to add an arg3. The check is performed in
landlock_is_valid_access() and landlock_decide(). If a field is not used
by an event, then this field will have a NOT_INIT type and accessing it
will be denied.

> How can you add 3rd argument? All FS events would have to get it,
> but in some LSM hooks such argument will be meaningless, whereas
> in other places it will carry useful info that rule can operate on.
> Would that mean that we'll have FS_3 event type and only few LSM
> hooks will be converted to it. That works, but then we'll lose
> compatiblity with old rules written for FS event and that given hook.
> Otherwise we'd need to have fancy logic to accept old FS event
> into FS_3 LSM hook.

If we want to add a third argument to the FS event, then it will become
accessible because its type will be different than NOT_INIT. This keep
the compatibility with old rules because this new field was then denied.

If we want to add a new argument but only for a subset of the hooks used
by the FS event, then we need to create a new event, like FS_FCNTL. For
example, we may want to add a FS_RENAME event to be able to tie the
source file and the destination file of a rename call.

Anyway, I added the subtype/ABI version as a safeguard in case of
unexpected future evolution.



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v2 1/3] i2c: davinci: Preserve return value of devm_clk_get

2017-08-27 Thread Wolfram Sang
On Wed, Aug 16, 2017 at 05:17:13PM -0500, Franklin S Cooper Jr wrote:
> The i2c driver can run into driver dependency issues if its loaded
> before a clock driver it depends on. Therefore, EPROBE_DEFER may be
> returned by devm_clk_get and should be returned in probe to allow the
> kernel to reprobe the driver at a later time. This patch allows the error
> value returned by devm_clk_get to be passed through and not overwritten.
> 
> Signed-off-by: Franklin S Cooper Jr 
> Reviewed-by: Grygorii Strashko 

Applied to for-next, thanks!

Waiting for V3 of the other patches.



signature.asc
Description: PGP signature


Re: [PATCH 1/3] thunderbolt: Remove superfluous check

2017-08-27 Thread Mika Westerberg
On Tue, Aug 15, 2017 at 10:02:28AM +0300, Mika Westerberg wrote:
> On Tue, Aug 15, 2017 at 08:19:01AM +0300, Bernat, Yehezkel wrote:
> > The key size is tested by hex2bin() already (as '\0' isn't an hex digit)
> > 
> > Suggested-by: Andy Shevchenko 
> > Signed-off-by: Yehezkel Bernat 
> 
> Acked-by: Mika Westerberg 

Hi Greg,

Do you have any comments regarding these patches? If not could you take
them to your char-misc tree?

Thanks!


Re: [PATCH v2 2/3] rtc: Add Realtek RTD1295

2017-08-27 Thread Andrew Lunn
> >> +static inline int rtd119x_rtc_year_days(int year)
> >> +{
> >> +  return rtc_year_days(1, 12, year);
> > 
> > I'm not sure it is worth wrapping rtc_year_days
> [snip]
> 
> Well, I found your rtc_year_days rather confusing and had to play with
> the arguments until I got it working as expected, so I wanted an inline
> function (or macro) as abstraction from my three callers.

I agree with that. I was wondering why 1st December was being used. I
would say this API does not do too well on Rusty's API Design
Manifesto.

It does at least get the day/month/year in the right order ;-)

Andrew


Applied "ASoC: davinci-mcasp: check memory allocation failure" to the asoc tree

2017-08-27 Thread Mark Brown
The patch

   ASoC: davinci-mcasp: check memory allocation failure

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4243e0457c9b1fe5e96fba19296469466eb24b1d Mon Sep 17 00:00:00 2001
From: Christophe Jaillet 
Date: Sun, 27 Aug 2017 08:46:50 +0200
Subject: [PATCH] ASoC: davinci-mcasp: check memory allocation failure

Check memory allocation failures and return -ENOMEM in such cases, as
already done above for another memory allocation.

This avoids NULL pointers dereference.

Signed-off-by: Christophe JAILLET 
Signed-off-by: Mark Brown 
---
 sound/soc/davinci/davinci-mcasp.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/davinci/davinci-mcasp.c 
b/sound/soc/davinci/davinci-mcasp.c
index d486908d4e0e..f395bbc7c354 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -1851,6 +1851,10 @@ static int davinci_mcasp_probe(struct platform_device 
*pdev)
mcasp->context.xrsr_regs = devm_kzalloc(&pdev->dev,
sizeof(u32) * mcasp->num_serializer,
GFP_KERNEL);
+   if (!mcasp->context.xrsr_regs) {
+   ret = -ENOMEM;
+   goto err;
+   }
 #endif
mcasp->serial_dir = pdata->serial_dir;
mcasp->version = pdata->version;
-- 
2.13.2



Re: [PATCH] MAINTAINERS: drop entry for Blackfin I2C and Sonic's email

2017-08-27 Thread Wolfram Sang
On Sun, Aug 13, 2017 at 05:34:31PM +0200, Wolfram Sang wrote:
> Sonic's email address bounced, so remove it from MAINTAINERS. Since
> there was no I2C/TWI maintenance activity for 3 years now, drop that
> whole entry.
> 
> Signed-off-by: Wolfram Sang 

Applied to i2c/for-next, thanks!



signature.asc
Description: PGP signature


Applied "ASoC: Add a sanity check before using dai driver name" to the asoc tree

2017-08-27 Thread Mark Brown
The patch

   ASoC: Add a sanity check before using dai driver name

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 6a6dafda937cfcdbbfe46a3e093de8bb929ba52d Mon Sep 17 00:00:00 2001
From: Jeffy Chen 
Date: Thu, 24 Aug 2017 12:40:17 +0800
Subject: [PATCH] ASoC: Add a sanity check before using dai driver name

The dai driver's name is allowed to be NULL. So add a sanity check for
that.

Signed-off-by: Jeffy Chen 
Reported-by: Donglin Peng 
Signed-off-by: Mark Brown 
---
 sound/soc/soc-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6fab0ff213ef..74c17068bb11 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1029,7 +1029,8 @@ struct snd_soc_dai *snd_soc_find_dai(
continue;
list_for_each_entry(dai, &component->dai_list, list) {
if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)
-   && strcmp(dai->driver->name, dlc->dai_name))
+   && (!dai->driver->name
+   || strcmp(dai->driver->name, dlc->dai_name)))
continue;
 
return dai;
-- 
2.13.2



Re: [PATCH RESEND] blackfin: merge the two TWI header files

2017-08-27 Thread Wolfram Sang
On Sun, Aug 13, 2017 at 04:21:17PM +0200, Wolfram Sang wrote:
> There seems to be no need for separate ones since all users include both
> files anyhow. Merge them because include/linux/i2c is to be deprecated.
> 
> Signed-off-by: Wolfram Sang 

Applied to i2c/for-next, thanks!



signature.asc
Description: PGP signature


Re: [PATCH resend] thunderbolt: Fix reset response_type

2017-08-27 Thread Mika Westerberg
On Wed, Aug 16, 2017 at 11:54:17AM +0300, Dan Carpenter wrote:
> 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 
> Signed-off-by: Dan Carpenter 
> Acked-by: Mika Westerberg 
> ---
> Resending with Greg CC'd.  This was also:
> Signed-off-by: Andreas Noever 
> But I wasn't sure if I should add that tag.

Hi Greg,

Can you pick this fix to your char-misc tree?

Thanks!


Re: [RFC 1/3] dt-bindings: rtc: Add Realtek RTD1295

2017-08-27 Thread Andrew Lunn
> Thanks. Did you read the RFC question in the cover letter as well and
> have any comments? Downstream has an rtc-base-year = <2014>; property
> that I had left out in this RFC and due to your ack not included in v2.
> 
> Should we default to 2014 in the driver and add an optional base-year
> property once we encounter a diverging device, or should we make it
> required from the beginning? I did not spot any other rtc binding with
> such a property and would appreciate a clarification.

Hi Andreas

>From the perspective of the hardware, does it care what the base is?

A device using a different base will initially return the wrong
time. But once the correct time has been written back, it will be O.K.

This only becomes an issue if a device is used with different OSs,
which have different bases. Swapping back and forth between OSs then
becomes an issue.

KISS suggests not having a base in DT until it is actually
required. Since it is an additional property, it does not break
backwards compatibility when added.

  Andrew



Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name

2017-08-27 Thread Donglin Peng
Hi Jeffy,

On Sun, Aug 27, 2017 at 8:19 PM, Mark Brown  wrote:
> On Sat, Aug 26, 2017 at 11:09:49PM +0800, Donglin Peng wrote:
>
>> It seems that the v3 patch should be applied other than v2.
>
> Please send incremental fixes rather than new versions for things that
> are are already applied.

You should send a incremental patch rather than v3 patch, because your
v2 patch had been applied and caused this issue.


[PATCH] x86/boot: provide more slack space during decompression

2017-08-27 Thread Jan H . Schönherr
The current slack space is not enough for LZ4, which has a worst case
overhead of 0.4% for data that cannot be further compressed. With
an LZ4 compressed kernel with an embedded initrd, the output is likely
to overwrite the input.

Increase the slack space to avoid that.

Signed-off-by: Jan H. Schönherr 
---
 arch/x86/boot/header.S | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 2ed8f0c..1bb08ec 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -520,8 +520,14 @@ pref_address:  .quad LOAD_PHYSICAL_ADDR
# preferred load addr
 # the description in lib/decompressor_xxx.c for specific information.
 #
 # extra_bytes = (uncompressed_size >> 12) + 65536 + 128
+#
+# LZ4 is even worse: data that cannot be further compressed grows by 0.4%,
+# or one byte per 256 bytes. OTOH, we can safely get rid of the +128 as
+# the size-dependent part now grows so fast.
+#
+# extra_bytes = (uncompressed_size >> 8) + 65536
 
-#define ZO_z_extra_bytes   ((ZO_z_output_len >> 12) + 65536 + 128)
+#define ZO_z_extra_bytes   ((ZO_z_output_len >> 8) + 65536)
 #if ZO_z_output_len > ZO_z_input_len
 # define ZO_z_extract_offset   (ZO_z_output_len + ZO_z_extra_bytes - \
 ZO_z_input_len)
-- 
2.3.1.dirty



[PATCH RESEND] regulator: rn5t618: add RC5T619 PMIC support

2017-08-27 Thread Pierre-Hugues Husson
Extend the driver to support Ricoh RC5T619.
Support the additional regulators and slightly different voltage ranges.

Signed-off-by: Pierre-Hugues Husson 
---
 drivers/regulator/Kconfig |  4 ++--
 drivers/regulator/rn5t618-regulator.c | 35 +++
 include/linux/mfd/rn5t618.h   |  6 ++
 3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 1205e82971d0..c2986e91caef 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -709,8 +709,8 @@ config REGULATOR_RN5T618
tristate "Ricoh RN5T567/618 voltage regulators"
depends on MFD_RN5T618
help
- Say y here to support the regulators found on Ricoh RN5T567 or
- RN5T618 PMIC.
+ Say y here to support the regulators found on Ricoh RN5T567,
+ RN5T618 or RC5T619 PMIC.
 
 config REGULATOR_RT5033
tristate "Richtek RT5033 Regulators"
diff --git a/drivers/regulator/rn5t618-regulator.c 
b/drivers/regulator/rn5t618-regulator.c
index 8d2819e36654..ef2be56460fe 100644
--- a/drivers/regulator/rn5t618-regulator.c
+++ b/drivers/regulator/rn5t618-regulator.c
@@ -79,6 +79,29 @@ static struct regulator_desc rn5t618_regulators[] = {
REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 90, 350, 25000),
 };
 
+static struct regulator_desc rc5t619_regulators[] = {
+   /* DCDC */
+   REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 60, 350, 12500),
+   REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 60, 350, 12500),
+   REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 60, 350, 12500),
+   REG(DCDC4, DC4CTL, BIT(0), DC4DAC, 0xff, 60, 350, 12500),
+   REG(DCDC5, DC5CTL, BIT(0), DC5DAC, 0xff, 60, 350, 12500),
+   /* LDO */
+   REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 90, 350, 25000),
+   REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 90, 350, 25000),
+   REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 90, 350, 25000),
+   REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 90, 350, 25000),
+   REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 60, 350, 25000),
+   REG(LDO6, LDOEN1, BIT(5), LDO6DAC, 0x7f, 60, 350, 25000),
+   REG(LDO7, LDOEN1, BIT(6), LDO7DAC, 0x7f, 90, 350, 25000),
+   REG(LDO8, LDOEN1, BIT(7), LDO8DAC, 0x7f, 90, 350, 25000),
+   REG(LDO9, LDOEN2, BIT(0), LDO9DAC, 0x7f, 90, 350, 25000),
+   REG(LDO10, LDOEN2, BIT(0), LDO10DAC, 0x7f, 90, 350, 25000),
+   /* LDO RTC */
+   REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 170, 350, 25000),
+   REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 90, 350, 25000),
+};
+
 static int rn5t618_regulator_probe(struct platform_device *pdev)
 {
struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent);
@@ -86,13 +109,20 @@ static int rn5t618_regulator_probe(struct platform_device 
*pdev)
struct regulator_dev *rdev;
struct regulator_desc *regulators;
int i;
+   int num_regulators = 0;
 
switch (rn5t618->variant) {
case RN5T567:
regulators = rn5t567_regulators;
+   num_regulators = ARRAY_SIZE(rn5t567_regulators);
break;
case RN5T618:
regulators = rn5t618_regulators;
+   num_regulators = ARRAY_SIZE(rn5t618_regulators);
+   break;
+   case RC5T619:
+   regulators = rc5t619_regulators;
+   num_regulators = ARRAY_SIZE(rc5t619_regulators);
break;
default:
return -EINVAL;
@@ -101,10 +131,7 @@ static int rn5t618_regulator_probe(struct platform_device 
*pdev)
config.dev = pdev->dev.parent;
config.regmap = rn5t618->regmap;
 
-   for (i = 0; i < RN5T618_REG_NUM; i++) {
-   if (!regulators[i].name)
-   continue;
-
+   for (i = 0; i < num_regulators; i++) {
rdev = devm_regulator_register(&pdev->dev,
   ®ulators[i],
   &config);
diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h
index e5a6cdeb77db..d61bc58aba8a 100644
--- a/include/linux/mfd/rn5t618.h
+++ b/include/linux/mfd/rn5t618.h
@@ -226,11 +226,17 @@ enum {
RN5T618_DCDC2,
RN5T618_DCDC3,
RN5T618_DCDC4,
+   RN5T618_DCDC5,
RN5T618_LDO1,
RN5T618_LDO2,
RN5T618_LDO3,
RN5T618_LDO4,
RN5T618_LDO5,
+   RN5T618_LDO6,
+   RN5T618_LDO7,
+   RN5T618_LDO8,
+   RN5T618_LDO9,
+   RN5T618_LDO10,
RN5T618_LDORTC1,
RN5T618_LDORTC2,
RN5T618_REG_NUM,
-- 
2.14.1



Re: [PATCH] DSA support for Micrel KSZ8895

2017-08-27 Thread Andrew Lunn
On Sun, Aug 27, 2017 at 02:36:58PM +0200, Pavel Machek wrote:
> Hi!
> 
> So I fought with the driver a bit more, and now I have something that
> kind-of-works.


Thanks for keeping on working on this.
 
> "great great hack" belows worries me.
> 
> Yeah, disabled code needs to be removed before merge.
> 
> No, tag_ksz part probably is not acceptable. Do you see solution
> better than just copying it into tag_ksz1 file?
> 
> Any more comments, etc?

It would help with review if you split this up into multiple patches.
The change to the tagger should be one patch. The mdio emulation would
make a reasonable standalone patch etc.

I will do a more detailed review later.

  Andrew


Re: [PATCH 1/9] ASoC: max98927: Added TDM support

2017-08-27 Thread Mark Brown
On Fri, Aug 25, 2017 at 05:41:02PM -0700, Ryan Lee wrote:
> Signed-off-by: Ryan Lee 

This says it's adding support for TDM mode but...

> + case SND_SOC_DAIFMT_DSP_A:
> + format = MAX98927_PCM_FORMAT_TDM_MODE1;
> + break;
> + case SND_SOC_DAIFMT_DSP_B:
> + format = MAX98927_PCM_FORMAT_TDM_MODE0;
> + break;
>   case SND_SOC_DAIFMT_PDM:
> - max98927->iface |= SND_SOC_DAIFMT_PDM;
> + use_pdm = true;
>   break;

...it looks like it's adding support for two new DSP modes and generally
making a bunch of other changes.  This probably needs splitting up, or
at least a bit more of a changelog.


signature.asc
Description: PGP signature


Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name

2017-08-27 Thread Mark Brown
On Sun, Aug 27, 2017 at 09:54:09PM +0800, Donglin Peng wrote:
> On Sun, Aug 27, 2017 at 8:19 PM, Mark Brown  wrote:

> > Please send incremental fixes rather than new versions for things that
> > are are already applied.

> You should send a incremental patch rather than v3 patch, because your
> v2 patch had been applied and caused this issue.

Right, so I actually just looked at this and I think the right thing got
applied as everything seems to be building fine but I could be confused
here.


signature.asc
Description: PGP signature


Applied "regulator: rn5t618: add RC5T619 PMIC support" to the regulator tree

2017-08-27 Thread Mark Brown
The patch

   regulator: rn5t618: add RC5T619 PMIC support

has been applied to the regulator tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 83b2a3c2ab24561cb6de45e6b155e3a7c4c1c91b Mon Sep 17 00:00:00 2001
From: Pierre-Hugues Husson 
Date: Sun, 27 Aug 2017 15:58:31 +0200
Subject: [PATCH] regulator: rn5t618: add RC5T619 PMIC support

Extend the driver to support Ricoh RC5T619.
Support the additional regulators and slightly different voltage ranges.

Signed-off-by: Pierre-Hugues Husson 
Signed-off-by: Mark Brown 
---
 drivers/regulator/Kconfig |  4 ++--
 drivers/regulator/rn5t618-regulator.c | 35 +++
 include/linux/mfd/rn5t618.h   |  6 ++
 3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 99b9362331b5..a847f8231337 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -700,8 +700,8 @@ config REGULATOR_RN5T618
tristate "Ricoh RN5T567/618 voltage regulators"
depends on MFD_RN5T618
help
- Say y here to support the regulators found on Ricoh RN5T567 or
- RN5T618 PMIC.
+ Say y here to support the regulators found on Ricoh RN5T567,
+ RN5T618 or RC5T619 PMIC.
 
 config REGULATOR_RT5033
tristate "Richtek RT5033 Regulators"
diff --git a/drivers/regulator/rn5t618-regulator.c 
b/drivers/regulator/rn5t618-regulator.c
index 8d2819e36654..ef2be56460fe 100644
--- a/drivers/regulator/rn5t618-regulator.c
+++ b/drivers/regulator/rn5t618-regulator.c
@@ -79,6 +79,29 @@ static struct regulator_desc rn5t618_regulators[] = {
REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 90, 350, 25000),
 };
 
+static struct regulator_desc rc5t619_regulators[] = {
+   /* DCDC */
+   REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 60, 350, 12500),
+   REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 60, 350, 12500),
+   REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 60, 350, 12500),
+   REG(DCDC4, DC4CTL, BIT(0), DC4DAC, 0xff, 60, 350, 12500),
+   REG(DCDC5, DC5CTL, BIT(0), DC5DAC, 0xff, 60, 350, 12500),
+   /* LDO */
+   REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 90, 350, 25000),
+   REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 90, 350, 25000),
+   REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 90, 350, 25000),
+   REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 90, 350, 25000),
+   REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 60, 350, 25000),
+   REG(LDO6, LDOEN1, BIT(5), LDO6DAC, 0x7f, 60, 350, 25000),
+   REG(LDO7, LDOEN1, BIT(6), LDO7DAC, 0x7f, 90, 350, 25000),
+   REG(LDO8, LDOEN1, BIT(7), LDO8DAC, 0x7f, 90, 350, 25000),
+   REG(LDO9, LDOEN2, BIT(0), LDO9DAC, 0x7f, 90, 350, 25000),
+   REG(LDO10, LDOEN2, BIT(0), LDO10DAC, 0x7f, 90, 350, 25000),
+   /* LDO RTC */
+   REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 170, 350, 25000),
+   REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 90, 350, 25000),
+};
+
 static int rn5t618_regulator_probe(struct platform_device *pdev)
 {
struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent);
@@ -86,13 +109,20 @@ static int rn5t618_regulator_probe(struct platform_device 
*pdev)
struct regulator_dev *rdev;
struct regulator_desc *regulators;
int i;
+   int num_regulators = 0;
 
switch (rn5t618->variant) {
case RN5T567:
regulators = rn5t567_regulators;
+   num_regulators = ARRAY_SIZE(rn5t567_regulators);
break;
case RN5T618:
regulators = rn5t618_regulators;
+   num_regulators = ARRAY_SIZE(rn5t618_regulators);
+   break;
+   case RC5T619:
+   regulators = rc5t619_regulators;
+   num_regulators = ARRAY_SIZE(rc5t619_regulators);
break;
default:
return -EINVAL;
@@ -101,10 +131,7 @@ static int rn5t618_regulator_probe(struct platform_device 
*pdev)
config.dev = pdev->dev.parent;
config.regmap = rn5t618->re

Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name

2017-08-27 Thread Mark Brown
On Sun, Aug 27, 2017 at 10:31:52PM +0800, Jeffy Chen wrote:

This is a HTML only mail and I have a text only client...


signature.asc
Description: PGP signature


Re: [PATCH v3 05/14] [media] cxd2880: Add tuner part of the driver

2017-08-27 Thread Mauro Carvalho Chehab
Em Wed, 16 Aug 2017 13:37:14 +0900
 escreveu:

> From: Yasunari Takiguchi 
> 
> This part of the driver has the main routines to handle
> the tuner and demodulator functionality.  The tnrdmd_mon.* files
> have monitor functions for the driver.
> This is part of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

This series is on a much better state. Thanks!

Patches 1-4 sound ok to me.

Still, there are a few issues on this patch. See below.

> 
> [Change list]
> Changes in V3
>drivers/media/dvb-frontends/cxd2880/cxd2880_dtv.h
>   -removed code relevant to ISDB-T

Just curiosity here: why is it removed?

>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd.c
>   -removed unnecessary cast
>   -removed code relevant to ISDB-T
>   -changed CXD2880_SLEEP to usleep_range
>   -changed cxd2880_memset to memset 
>   -changed cxd2880_atomic_set to atomic_set
>   -modified return code
>   -modified coding style of if()
>   -changed to use const values at writing a lot of registers 
>with a command. 
>   -changed hexadecimal code to lower case. 
>   -adjusted of indent spaces
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd.h
>   -removed code relevant to ISDB-T
>   -changed cxd2880_atomic struct to atomic_t
>   -modified return code
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_driver_version.h
>   -updated version information
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_mon.c
>   -changed CXD2880_SLEEP to usleep_range
>   -removed unnecessary cast
>   -modified return code
>   -modified coding style of if() 
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_mon.h
>   -modified return code
> 
> Changes in V2
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_driver_version.h
>   -updated version information
> 
> Signed-off-by: Yasunari Takiguchi 
> Signed-off-by: Masayuki Yamamoto 
> Signed-off-by: Hideki Nozawa 
> Signed-off-by: Kota Yonezawa 
> Signed-off-by: Toshihiko Matsumoto 
> Signed-off-by: Satoshi Watanabe 
> ---
>  drivers/media/dvb-frontends/cxd2880/cxd2880_dtv.h  |   46 +
>  .../media/dvb-frontends/cxd2880/cxd2880_tnrdmd.c   | 4030 
> 
>  .../media/dvb-frontends/cxd2880/cxd2880_tnrdmd.h   |  391 ++
>  .../cxd2880/cxd2880_tnrdmd_driver_version.h|   29 +
>  .../dvb-frontends/cxd2880/cxd2880_tnrdmd_mon.c |  221 ++
>  .../dvb-frontends/cxd2880/cxd2880_tnrdmd_mon.h |   52 +
>  6 files changed, 4769 insertions(+)
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_dtv.h
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd.c
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd.h
>  create mode 100644 
> drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_driver_version.h
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_mon.c
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_mon.h
> 
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_dtv.h 
> b/drivers/media/dvb-frontends/cxd2880/cxd2880_dtv.h
> new file mode 100644
> index ..2d35d3990060
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_dtv.h
> @@ -0,0 +1,46 @@
> +/*
> + * cxd2880_dtv.h
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + * DTV related definitions
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see .
> + */
> +
> +#ifndef CXD2880_DTV_H
> +#define CXD2880_DTV_H
> +
> +enum cxd2880_dtv_sys {
> + CXD2880_DTV_SYS_UNKNOWN,
> + CXD2880_DTV_SYS_DVBT,
> + CXD2880_DTV_SYS_DVBT2,
> + CXD2880_DTV_SYS_ANY
> +};
> +
> +enum cxd2880_dtv_bandwidth {
> + CXD2880_DTV_BW_UNKNOWN = 0,
> + CXD2880_

Re: [PATCH v3 05/14] [media] cxd2880: Add tuner part of the driver

2017-08-27 Thread Mauro Carvalho Chehab
Em Sun, 27 Aug 2017 11:45:44 -0300
Mauro Carvalho Chehab  escreveu:

> Em Wed, 16 Aug 2017 13:37:14 +0900
>  escreveu:
> 
> > From: Yasunari Takiguchi 
> > 
> > This part of the driver has the main routines to handle
> > the tuner and demodulator functionality.  The tnrdmd_mon.* files
> > have monitor functions for the driver.
> > This is part of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.
> 
> This series is on a much better state. Thanks!
> 
> Patches 1-4 sound ok to me.
> 
> Still, there are a few issues on this patch. See below.
> 
> > 
> > [Change list]
> > Changes in V3
> >drivers/media/dvb-frontends/cxd2880/cxd2880_dtv.h
> >   -removed code relevant to ISDB-T

Forgot to mention... Just a small detail: the change list is important for
us to understand the differences between submitted versions, but it makes
no sense to track them when patches get merged upstream, as the previous
versions of the patches won't be there at the git history.

So, please put change lists after a blank line with just "---", e. g.:


From: Yasunari Takiguchi 

This part of the driver has the main routines to handle
the tuner and demodulator functionality.  The tnrdmd_mon.* files
have monitor functions for the driver.
This is part of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.

---

(change list and whatever other notes that are relevant to the
 patch reviewers but won't be merged upstream)

The reason is simple: Kernel maintainers' scripts will just remove
everything after the "---" line when applying the series ;-)

Thanks,
Mauro


Re: [PATCH] spi-nor: intel-spi: Fix Kconfig dependency to LPC_ICH

2017-08-27 Thread Mika Westerberg
On Fri, Aug 25, 2017 at 08:11:54PM +0800, Bin Meng wrote:
> Other LPC_ICH users (like gpio, watchdog) use the 'select' logic, so I
> would prefer to keep things consistent.

Fair enough.

Acked-by: Mika Westerberg 


Re: [Qemu-devel] kvm_intel fails to load on Conroe CPUs running Linux 4.12

2017-08-27 Thread Gerhard Wiesinger

On 27.08.2017 14:03, Paolo Bonzini wrote:

Il 27 ago 2017 9:49 AM, "Gerhard Wiesinger"  ha
scritto:

On 17.08.2017 23:14, Gerhard Wiesinger wrote:


On 17.08.2017 22:58, Gerhard Wiesinger wrote:

On 07.08.2017 19:50, Paolo Bonzini wrote:


Not much to say, unfortunately. It's pretty much the same capabilities
as a Prescott/Cedar Mill processor, except that it has MSR bitmaps. It
also lacks FlexPriority compared to the Conroe I had checked.

It's not great that even the revert patch doesn't apply cleanly---this
is *not* necessarily a boring area of the hypervisor...

Given the rarity of your machine I'm currently leaning towards _not_
reverting the change. I'll check another non-Xeon Core 2 tomorrow that
is from December 2008 (IIRC). If that one also lacks vNMI, or if I get
other reports, I suppose I will have to reconsider that.

Hello Paolo,

Can you please revert the patch.

CPU is a Core 2 Extreme QX6700: SL9UL (B3) running VERY stable with ECC
RAM for years now.
https://ark.intel.com/products/28028/Intel-Core2-Extreme-
Processor-QX6700-8M-Cache-2_66-GHz-1066-MHz-FSB?q=Core%
202%20Extreme%20QX6700
https://en.wikipedia.org/wiki/List_of_Intel_Core_2_microprocessors

CPU details below.

Thank you.

Ciao,
Gerhard


Hello Paolo,

Any update on this major issue?


We will revert the patch, but 4.13.0 will not have the fix. Expect it in
later stable kernels (because vacations).

Thnx. Why will 4.13.0 NOT have the fix?

Thnx.

Ciao,
Gerhard


[PATCH 2/4] irda: move drivers/net/irda to drivers/staging/irda/drivers

2017-08-27 Thread Greg Kroah-Hartman
Move the irda drivers from drivers/net/irda/ to
drivers/staging/irda/drivers as they will be deleted in a future kernel
release.

Signed-off-by: Greg Kroah-Hartman 
---
 drivers/net/Makefile| 1 -
 drivers/staging/Makefile| 1 +
 drivers/{net/irda => staging/irda/drivers}/Kconfig  | 0
 drivers/{net/irda => staging/irda/drivers}/Makefile | 0
 drivers/{net/irda => staging/irda/drivers}/act200l-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/actisys-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/ali-ircc.c   | 0
 drivers/{net/irda => staging/irda/drivers}/ali-ircc.h   | 0
 drivers/{net/irda => staging/irda/drivers}/au1k_ir.c| 0
 drivers/{net/irda => staging/irda/drivers}/bfin_sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/bfin_sir.h   | 0
 drivers/{net/irda => staging/irda/drivers}/donauboe.c   | 0
 drivers/{net/irda => staging/irda/drivers}/donauboe.h   | 0
 drivers/{net/irda => staging/irda/drivers}/esi-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/girbil-sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/irda-usb.c   | 0
 drivers/{net/irda => staging/irda/drivers}/irda-usb.h   | 0
 drivers/{net/irda => staging/irda/drivers}/irtty-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/irtty-sir.h  | 0
 drivers/{net/irda => staging/irda/drivers}/kingsun-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/ks959-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/ksdazzle-sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/litelink-sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/ma600-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/mcp2120-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/mcs7780.c| 0
 drivers/{net/irda => staging/irda/drivers}/mcs7780.h| 0
 drivers/{net/irda => staging/irda/drivers}/nsc-ircc.c   | 0
 drivers/{net/irda => staging/irda/drivers}/nsc-ircc.h   | 0
 drivers/{net/irda => staging/irda/drivers}/old_belkin-sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/pxaficp_ir.c | 0
 drivers/{net/irda => staging/irda/drivers}/sa1100_ir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/sh_sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/sir-dev.h| 0
 drivers/{net/irda => staging/irda/drivers}/sir_dev.c| 0
 drivers/{net/irda => staging/irda/drivers}/sir_dongle.c | 0
 drivers/{net/irda => staging/irda/drivers}/smsc-ircc2.c | 0
 drivers/{net/irda => staging/irda/drivers}/smsc-ircc2.h | 0
 drivers/{net/irda => staging/irda/drivers}/smsc-sio.h   | 0
 drivers/{net/irda => staging/irda/drivers}/stir4200.c   | 0
 drivers/{net/irda => staging/irda/drivers}/tekram-sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/toim3232-sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/via-ircc.c   | 0
 drivers/{net/irda => staging/irda/drivers}/via-ircc.h   | 0
 drivers/{net/irda => staging/irda/drivers}/vlsi_ir.c| 0
 drivers/{net/irda => staging/irda/drivers}/vlsi_ir.h| 0
 drivers/{net/irda => staging/irda/drivers}/w83977af.h   | 0
 drivers/{net/irda => staging/irda/drivers}/w83977af_ir.c| 0
 drivers/{net/irda => staging/irda/drivers}/w83977af_ir.h| 0
 drivers/staging/irda/net/Kconfig| 2 +-
 50 files changed, 2 insertions(+), 2 deletions(-)
 rename drivers/{net/irda => staging/irda/drivers}/Kconfig (100%)
 rename drivers/{net/irda => staging/irda/drivers}/Makefile (100%)
 rename drivers/{net/irda => staging/irda/drivers}/act200l-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/actisys-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/ali-ircc.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/ali-ircc.h (100%)
 rename drivers/{net/irda => staging/irda/drivers}/au1k_ir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/bfin_sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/bfin_sir.h (100%)
 rename drivers/{net/irda => staging/irda/drivers}/donauboe.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/donauboe.h (100%)
 rename drivers/{net/irda => staging/irda/drivers}/esi-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/girbil-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/irda-usb.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/irda-usb.h (100%)
 rename drivers/{net/irda => staging/irda/drivers}/irtty-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/irtty-sir.h (100%)
 rename drivers/{net/irda => staging/irda/drivers}/kingsun-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/ks959-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/ksdazzle-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/litelink-sir.c (100%)
 rename drivers/{net/irda => staging/irda/drivers}/ma600-s

[PATCH 1/4] irda: move net/irda/ to drivers/staging/irda/net/

2017-08-27 Thread Greg Kroah-Hartman
It's time to get rid of IRDA.  It's long been broken, and no one seems
to use it anymore.  So move it to staging and after a while, we can
delete it from there.

To start, move the network irda core from net/irda to
drivers/staging/irda/net/

Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/Kconfig | 2 ++
 drivers/staging/Makefile| 1 +
 {net/irda => drivers/staging/irda/net}/Kconfig  | 6 +++---
 {net/irda => drivers/staging/irda/net}/Makefile | 0
 {net/irda => drivers/staging/irda/net}/af_irda.c| 0
 {net/irda => drivers/staging/irda/net}/discovery.c  | 0
 {net/irda => drivers/staging/irda/net}/ircomm/Kconfig   | 0
 {net/irda => drivers/staging/irda/net}/ircomm/Makefile  | 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_core.c | 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_event.c| 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_lmp.c  | 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_param.c| 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_ttp.c  | 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_tty.c  | 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_tty_attach.c   | 0
 {net/irda => drivers/staging/irda/net}/ircomm/ircomm_tty_ioctl.c| 0
 {net/irda => drivers/staging/irda/net}/irda_device.c| 0
 {net/irda => drivers/staging/irda/net}/iriap.c  | 0
 {net/irda => drivers/staging/irda/net}/iriap_event.c| 0
 {net/irda => drivers/staging/irda/net}/irias_object.c   | 0
 {net/irda => drivers/staging/irda/net}/irlan/Kconfig| 0
 {net/irda => drivers/staging/irda/net}/irlan/Makefile   | 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_client.c | 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_client_event.c   | 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_common.c | 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_eth.c| 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_event.c  | 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_filter.c | 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_provider.c   | 0
 {net/irda => drivers/staging/irda/net}/irlan/irlan_provider_event.c | 0
 {net/irda => drivers/staging/irda/net}/irlap.c  | 0
 {net/irda => drivers/staging/irda/net}/irlap_event.c| 0
 {net/irda => drivers/staging/irda/net}/irlap_frame.c| 0
 {net/irda => drivers/staging/irda/net}/irlmp.c  | 0
 {net/irda => drivers/staging/irda/net}/irlmp_event.c| 0
 {net/irda => drivers/staging/irda/net}/irlmp_frame.c| 0
 {net/irda => drivers/staging/irda/net}/irmod.c  | 0
 {net/irda => drivers/staging/irda/net}/irnet/Kconfig| 0
 {net/irda => drivers/staging/irda/net}/irnet/Makefile   | 0
 {net/irda => drivers/staging/irda/net}/irnet/irnet.h| 0
 {net/irda => drivers/staging/irda/net}/irnet/irnet_irda.c   | 0
 {net/irda => drivers/staging/irda/net}/irnet/irnet_irda.h   | 0
 {net/irda => drivers/staging/irda/net}/irnet/irnet_ppp.c| 0
 {net/irda => drivers/staging/irda/net}/irnet/irnet_ppp.h| 0
 {net/irda => drivers/staging/irda/net}/irnetlink.c  | 0
 {net/irda => drivers/staging/irda/net}/irproc.c | 0
 {net/irda => drivers/staging/irda/net}/irqueue.c| 0
 {net/irda => drivers/staging/irda/net}/irsysctl.c   | 0
 {net/irda => drivers/staging/irda/net}/irttp.c  | 0
 {net/irda => drivers/staging/irda/net}/parameters.c | 0
 {net/irda => drivers/staging/irda/net}/qos.c| 0
 {net/irda => drivers/staging/irda/net}/timer.c  | 0
 {net/irda => drivers/staging/irda/net}/wrapper.c| 0
 net/Kconfig | 1 -
 net/Makefile| 1 -
 55 files changed, 6 insertions(+), 5 deletions(-)
 rename {net/irda => drivers/staging/irda/net}/Kconfig (95%)
 rename {net/irda => drivers/staging/irda/net}/Makefile (100%)
 rename {net/irda => drivers/staging/irda/net}/af_irda.c (100%)
 rename {net/irda => drivers/staging/irda/net}/discovery.c (100%)
 rename {net/irda => drivers/staging/irda/net}/ircomm/Kconfig (100%)
 rename {net/irda => drivers/staging/irda/net}/ircomm/Makefile (100%)
 rename {net/irda => drivers/staging/irda/net}/ircomm/ircomm_core.c (100%)
 rename {net/irda => drivers/staging/irda/net}/ircomm/ircomm_event.c (100%)
 rename {net/irda => drivers/staging/irda/net}/ircomm/ircomm_lmp.c (100%)
 rename {net/irda

[PATCH 3/4] irda: move include/net/irda into staging subdirectory

2017-08-27 Thread Greg Kroah-Hartman
And finally, move the irda include files into
drivers/staging/irda/include/net/irda.  Yes, it's a long path, but it
makes it easy for us to just add a Makefile directory path addition and
all of the net and drivers code "just works".

Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/irda/drivers/Makefile  | 2 ++
 {include => drivers/staging/irda/include}/net/irda/af_irda.h   | 0
 {include => drivers/staging/irda/include}/net/irda/crc.h   | 0
 {include => drivers/staging/irda/include}/net/irda/discovery.h | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_core.h   | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_event.h  | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_lmp.h| 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_param.h  | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_ttp.h| 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_tty.h| 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_tty_attach.h | 0
 {include => drivers/staging/irda/include}/net/irda/irda.h  | 0
 {include => drivers/staging/irda/include}/net/irda/irda_device.h   | 0
 {include => drivers/staging/irda/include}/net/irda/iriap.h | 0
 {include => drivers/staging/irda/include}/net/irda/iriap_event.h   | 0
 {include => drivers/staging/irda/include}/net/irda/irias_object.h  | 0
 {include => drivers/staging/irda/include}/net/irda/irlan_client.h  | 0
 {include => drivers/staging/irda/include}/net/irda/irlan_common.h  | 0
 {include => drivers/staging/irda/include}/net/irda/irlan_eth.h | 0
 {include => drivers/staging/irda/include}/net/irda/irlan_event.h   | 0
 {include => drivers/staging/irda/include}/net/irda/irlan_filter.h  | 0
 {include => drivers/staging/irda/include}/net/irda/irlan_provider.h| 0
 {include => drivers/staging/irda/include}/net/irda/irlap.h | 0
 {include => drivers/staging/irda/include}/net/irda/irlap_event.h   | 0
 {include => drivers/staging/irda/include}/net/irda/irlap_frame.h   | 0
 {include => drivers/staging/irda/include}/net/irda/irlmp.h | 0
 {include => drivers/staging/irda/include}/net/irda/irlmp_event.h   | 0
 {include => drivers/staging/irda/include}/net/irda/irlmp_frame.h   | 0
 {include => drivers/staging/irda/include}/net/irda/irmod.h | 0
 {include => drivers/staging/irda/include}/net/irda/irqueue.h   | 0
 {include => drivers/staging/irda/include}/net/irda/irttp.h | 0
 {include => drivers/staging/irda/include}/net/irda/parameters.h| 0
 {include => drivers/staging/irda/include}/net/irda/qos.h   | 0
 {include => drivers/staging/irda/include}/net/irda/timer.h | 0
 {include => drivers/staging/irda/include}/net/irda/wrapper.h   | 0
 drivers/staging/irda/net/Makefile  | 2 ++
 36 files changed, 4 insertions(+)
 rename {include => drivers/staging/irda/include}/net/irda/af_irda.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/crc.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/discovery.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/ircomm_core.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/ircomm_event.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/ircomm_lmp.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/ircomm_param.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/ircomm_ttp.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/ircomm_tty.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/ircomm_tty_attach.h 
(100%)
 rename {include => drivers/staging/irda/include}/net/irda/irda.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irda_device.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/iriap.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/iriap_event.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irias_object.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlan_client.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlan_common.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlan_eth.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlan_event.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlan_filter.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlan_provider.h 
(100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlap.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlap_event.h (100%)
 rename {include => drivers/staging/irda/include}/net/irda/irlap_frame.h (100%)
 rename {include => drivers/staging/irda/include}

[PATCH 0/4] irda: move it to drivers/staging so we can delete it

2017-08-27 Thread Greg Kroah-Hartman
The IRDA code has long been obsolete and broken.  So, to keep people
from trying to use it, and to prevent people from having to maintain it,
let's move it to drivers/staging/ so that we can delete it entirely from
the kernel in a few releases.


Greg Kroah-Hartman (4):
  irda: move net/irda/ to drivers/staging/irda/net/
  irda: move drivers/net/irda to drivers/staging/irda/drivers
  irda: move include/net/irda into staging subdirectory
  staging: irda: add a TODO file.

 drivers/net/Makefile  | 1 -
 drivers/staging/Kconfig   | 2 ++
 drivers/staging/Makefile  | 2 ++
 drivers/staging/irda/TODO | 4 
 drivers/{net/irda => staging/irda/drivers}/Kconfig| 0
 drivers/{net/irda => staging/irda/drivers}/Makefile   | 2 ++
 drivers/{net/irda => staging/irda/drivers}/act200l-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/actisys-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/ali-ircc.c | 0
 drivers/{net/irda => staging/irda/drivers}/ali-ircc.h | 0
 drivers/{net/irda => staging/irda/drivers}/au1k_ir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/bfin_sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/bfin_sir.h | 0
 drivers/{net/irda => staging/irda/drivers}/donauboe.c | 0
 drivers/{net/irda => staging/irda/drivers}/donauboe.h | 0
 drivers/{net/irda => staging/irda/drivers}/esi-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/girbil-sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/irda-usb.c | 0
 drivers/{net/irda => staging/irda/drivers}/irda-usb.h | 0
 drivers/{net/irda => staging/irda/drivers}/irtty-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/irtty-sir.h| 0
 drivers/{net/irda => staging/irda/drivers}/kingsun-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/ks959-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/ksdazzle-sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/litelink-sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/ma600-sir.c| 0
 drivers/{net/irda => staging/irda/drivers}/mcp2120-sir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/mcs7780.c  | 0
 drivers/{net/irda => staging/irda/drivers}/mcs7780.h  | 0
 drivers/{net/irda => staging/irda/drivers}/nsc-ircc.c | 0
 drivers/{net/irda => staging/irda/drivers}/nsc-ircc.h | 0
 drivers/{net/irda => staging/irda/drivers}/old_belkin-sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/pxaficp_ir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/sa1100_ir.c| 0
 drivers/{net/irda => staging/irda/drivers}/sh_sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/sir-dev.h  | 0
 drivers/{net/irda => staging/irda/drivers}/sir_dev.c  | 0
 drivers/{net/irda => staging/irda/drivers}/sir_dongle.c   | 0
 drivers/{net/irda => staging/irda/drivers}/smsc-ircc2.c   | 0
 drivers/{net/irda => staging/irda/drivers}/smsc-ircc2.h   | 0
 drivers/{net/irda => staging/irda/drivers}/smsc-sio.h | 0
 drivers/{net/irda => staging/irda/drivers}/stir4200.c | 0
 drivers/{net/irda => staging/irda/drivers}/tekram-sir.c   | 0
 drivers/{net/irda => staging/irda/drivers}/toim3232-sir.c | 0
 drivers/{net/irda => staging/irda/drivers}/via-ircc.c | 0
 drivers/{net/irda => staging/irda/drivers}/via-ircc.h | 0
 drivers/{net/irda => staging/irda/drivers}/vlsi_ir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/vlsi_ir.h  | 0
 drivers/{net/irda => staging/irda/drivers}/w83977af.h | 0
 drivers/{net/irda => staging/irda/drivers}/w83977af_ir.c  | 0
 drivers/{net/irda => staging/irda/drivers}/w83977af_ir.h  | 0
 {include => drivers/staging/irda/include}/net/irda/af_irda.h  | 0
 {include => drivers/staging/irda/include}/net/irda/crc.h  | 0
 {include => drivers/staging/irda/include}/net/irda/discovery.h| 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_core.h  | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_event.h | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_lmp.h   | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_param.h | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_ttp.h   | 0
 {include => drivers/staging/irda/include}/net/irda/ircomm_tty.h   | 0
 .../staging/irda/include}/net/irda/ircomm_tty_attach.h| 0
 {include => drivers/staging/irda/include}/net/irda/irda.h | 0
 {include => drivers/staging/irda/include}/net/irda/irda_device.h  | 0
 {include => drivers/staging/irda/

[PATCH 4/4] staging: irda: add a TODO file.

2017-08-27 Thread Greg Kroah-Hartman
The irda code will be deleted in a future kernel release, so no need to
have anyone do any new work on it.

Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/irda/TODO | 4 
 1 file changed, 4 insertions(+)
 create mode 100644 drivers/staging/irda/TODO

diff --git a/drivers/staging/irda/TODO b/drivers/staging/irda/TODO
new file mode 100644
index ..7d98a5cffaff
--- /dev/null
+++ b/drivers/staging/irda/TODO
@@ -0,0 +1,4 @@
+The irda code will be removed soon from the kernel tree as it is old and
+obsolete and broken.
+
+Don't worry about fixing up anything here, it's not needed.
-- 
2.14.1



Re: [PATCH v3 07/14] [media] cxd2880: Add top level of the driver

2017-08-27 Thread Mauro Carvalho Chehab
Em Wed, 16 Aug 2017 13:39:45 +0900
 escreveu:

> From: Yasunari Takiguchi 
> 
> This provides the main dvb frontend operation functions
> for the Sony CXD2880 DVB-T2/T tuner + demodulator driver.
> 
> [Change list]
> Changes in V3
>drivers/media/dvb-frontends/cxd2880/cxd2880_top.c
>   -adjusted indent spaces
>   -modified debugging code
>   -removed unnecessary cast
>   -modified return code
>   -modified coding style of if() 
>   -modified about measurement period of PER/BER.
>   -changed hexadecimal code to lower case. 
> 
> Signed-off-by: Yasunari Takiguchi 
> Signed-off-by: Masayuki Yamamoto 
> Signed-off-by: Hideki Nozawa 
> Signed-off-by: Kota Yonezawa 
> Signed-off-by: Toshihiko Matsumoto 
> Signed-off-by: Satoshi Watanabe 
> ---
>  drivers/media/dvb-frontends/cxd2880/cxd2880_top.c | 1879 
> +
>  1 file changed, 1879 insertions(+)
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_top.c
> 
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c 
> b/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c
> new file mode 100644
> index ..306966dd186b
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c
> @@ -0,0 +1,1879 @@
> +/*
> + * cxd2880_top.c
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see .
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
> +
> +#include 
> +
> +#include "dvb_frontend.h"
> +#include "dvb_math.h"
> +
> +#include "cxd2880.h"
> +#include "cxd2880_tnrdmd_mon.h"
> +#include "cxd2880_tnrdmd_dvbt2_mon.h"
> +#include "cxd2880_tnrdmd_dvbt_mon.h"
> +#include "cxd2880_integ_dvbt2.h"
> +#include "cxd2880_integ_dvbt.h"
> +#include "cxd2880_devio_spi.h"
> +#include "cxd2880_spi_device.h"
> +#include "cxd2880_tnrdmd_driver_version.h"
> +
> +struct cxd2880_priv {
> + struct cxd2880_tnrdmd tnrdmd;
> + struct spi_device *spi;
> + struct cxd2880_io regio;
> + struct cxd2880_spi_device spi_device;
> + struct cxd2880_spi cxd2880_spi;
> + struct cxd2880_dvbt_tune_param dvbt_tune_param;
> + struct cxd2880_dvbt2_tune_param dvbt2_tune_param;
> + struct mutex *spi_mutex; /* For SPI access exclusive control */
> + unsigned long pre_ber_update;
> + unsigned long pre_ber_interval;
> + unsigned long post_ber_update;
> + unsigned long post_ber_interval;
> + unsigned long ucblock_update;
> + unsigned long ucblock_interval;
> +};
> +
> +static int cxd2880_pre_bit_err_t(
> + struct cxd2880_tnrdmd *tnrdmd, u32 *pre_bit_err,
> + u32 *pre_bit_count)
> +{
> + u8 rdata[2];
> + int ret = 0;
> +
> + if ((!tnrdmd) || (!pre_bit_err) || (!pre_bit_count))
> + return -EINVAL;
> +
> + if (tnrdmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB)
> + return -EINVAL;
> +
> + if (tnrdmd->state != CXD2880_TNRDMD_STATE_ACTIVE)
> + return -EPERM;
> +
> + if (tnrdmd->sys != CXD2880_DTV_SYS_DVBT)
> + return -EPERM;
> +
> + ret = slvt_freeze_reg(tnrdmd);
> + if (ret)
> + return ret;
> +
> + ret = tnrdmd->io->write_reg(tnrdmd->io,
> + CXD2880_IO_TGT_DMD,
> + 0x00, 0x10);
> + if (ret) {
> + slvt_unfreeze_reg(tnrdmd);
> + return ret;
> + }
> +
> + ret = tnrdmd->io->read_regs(tnrdmd->io,
> + CXD2880_IO_TGT_DMD,
> + 0x39, rdata, 1);
> + if (ret) {
> + slvt_unfreeze_reg(tnrdmd);
> + return ret;
> + }
> +
> + if ((rdata[0] & 0x01) == 0) {
> + slvt_unfreeze_reg(tnrdmd);
> + return -EBUSY;
> + }
> +
> + ret = tnrdmd->io->read_regs(tnrdm

Re: [PATCH v3 08/14] [media] cxd2880: Add DVB-T control functions the driver

2017-08-27 Thread Mauro Carvalho Chehab
Em Wed, 16 Aug 2017 13:40:37 +0900
 escreveu:

> From: Yasunari Takiguchi 
> 
> Provide definitions, interfaces and functions needed for DVB-T
> of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.
> 
> [Change list]
> Changes in V3
>drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt.h
>   -no change
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.c
>   -modified return code
>   -modified coding style of if() 
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.h
>   -modified return code
> 
> Signed-off-by: Yasunari Takiguchi 
> Signed-off-by: Masayuki Yamamoto 
> Signed-off-by: Hideki Nozawa 
> Signed-off-by: Kota Yonezawa 
> Signed-off-by: Toshihiko Matsumoto 
> Signed-off-by: Satoshi Watanabe 
> ---
>  drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt.h |   91 ++
>  .../dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.c| 1115 
> 
>  .../dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.h|   62 ++
>  3 files changed, 1268 insertions(+)
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt.h
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.c
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.h
> 
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt.h 
> b/drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt.h
> new file mode 100644
> index ..345c094760d2
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt.h
> @@ -0,0 +1,91 @@
> +/*
> + * cxd2880_dvbt.h
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + * DVB-T related definitions
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see .
> + */
> +
> +#ifndef CXD2880_DVBT_H
> +#define CXD2880_DVBT_H
> +
> +#include "cxd2880_common.h"
> +
> +enum cxd2880_dvbt_constellation {
> + CXD2880_DVBT_CONSTELLATION_QPSK,
> + CXD2880_DVBT_CONSTELLATION_16QAM,
> + CXD2880_DVBT_CONSTELLATION_64QAM,
> + CXD2880_DVBT_CONSTELLATION_RESERVED_3
> +};
> +
> +enum cxd2880_dvbt_hierarchy {
> + CXD2880_DVBT_HIERARCHY_NON,
> + CXD2880_DVBT_HIERARCHY_1,
> + CXD2880_DVBT_HIERARCHY_2,
> + CXD2880_DVBT_HIERARCHY_4
> +};
> +
> +enum cxd2880_dvbt_coderate {
> + CXD2880_DVBT_CODERATE_1_2,
> + CXD2880_DVBT_CODERATE_2_3,
> + CXD2880_DVBT_CODERATE_3_4,
> + CXD2880_DVBT_CODERATE_5_6,
> + CXD2880_DVBT_CODERATE_7_8,
> + CXD2880_DVBT_CODERATE_RESERVED_5,
> + CXD2880_DVBT_CODERATE_RESERVED_6,
> + CXD2880_DVBT_CODERATE_RESERVED_7
> +};
> +
> +enum cxd2880_dvbt_guard {
> + CXD2880_DVBT_GUARD_1_32,
> + CXD2880_DVBT_GUARD_1_16,
> + CXD2880_DVBT_GUARD_1_8,
> + CXD2880_DVBT_GUARD_1_4
> +};
> +
> +enum cxd2880_dvbt_mode {
> + CXD2880_DVBT_MODE_2K,
> + CXD2880_DVBT_MODE_8K,
> + CXD2880_DVBT_MODE_RESERVED_2,
> + CXD2880_DVBT_MODE_RESERVED_3
> +};
> +
> +enum cxd2880_dvbt_profile {
> + CXD2880_DVBT_PROFILE_HP = 0,
> + CXD2880_DVBT_PROFILE_LP
> +};
> +
> +struct cxd2880_dvbt_tpsinfo {
> + enum cxd2880_dvbt_constellation constellation;
> + enum cxd2880_dvbt_hierarchy hierarchy;
> + enum cxd2880_dvbt_coderate rate_hp;
> + enum cxd2880_dvbt_coderate rate_lp;
> + enum cxd2880_dvbt_guard guard;
> + enum cxd2880_dvbt_mode mode;
> + u8 fnum;
> + u8 length_indicator;
> + u16 cell_id;
> + u8 cell_id_ok;
> + u8 reserved_even;
> + u8 reserved_odd;
> +};
> +
> +#endif
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.c 
> b/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.c
> new file mode 100644
> index ..8a16cb359171
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt.c
> @@ -0,0 +1,1115 @@
> +/*
> + * cxd2880_tnrdmd_dvbt.c
> + * Sony CXD2880 DVB-T2/T

Re: [RESEND PATCH v4 2/2] i2c: Add Spreadtrum I2C controller driver

2017-08-27 Thread Wolfram Sang
Hi,

thanks for your submission.

> +static void sprd_i2c_dump_reg(struct sprd_i2c *i2c_dev)
> +{
> + dev_err(&i2c_dev->adap.dev, ": ==dump i2c-%d reg===\n",
> + i2c_dev->adap.nr);
> + dev_err(&i2c_dev->adap.dev, ": I2C_CTRL:0x%x\n",
> + readl(i2c_dev->base + I2C_CTL));
> + dev_err(&i2c_dev->adap.dev, ": I2C_ADDR_CFG:0x%x\n",
> + readl(i2c_dev->base + I2C_ADDR_CFG));
> + dev_err(&i2c_dev->adap.dev, ": I2C_COUNT:0x%x\n",
> + readl(i2c_dev->base + I2C_COUNT));
> + dev_err(&i2c_dev->adap.dev, ": I2C_RX:0x%x\n",
> + readl(i2c_dev->base + I2C_RX));
> + dev_err(&i2c_dev->adap.dev, ": I2C_STATUS:0x%x\n",
> + readl(i2c_dev->base + I2C_STATUS));
> + dev_err(&i2c_dev->adap.dev, ": ADDR_DVD0:0x%x\n",
> + readl(i2c_dev->base + ADDR_DVD0));
> + dev_err(&i2c_dev->adap.dev, ": ADDR_DVD1:0x%x\n",
> + readl(i2c_dev->base + ADDR_DVD1));
> + dev_err(&i2c_dev->adap.dev, ": ADDR_STA0_DVD:0x%x\n",
> + readl(i2c_dev->base + ADDR_STA0_DVD));
> + dev_err(&i2c_dev->adap.dev, ": ADDR_RST:0x%x\n",
> + readl(i2c_dev->base + ADDR_RST));

I really thing register dumps should be dev_dbg().

> +}
> +
> +static void sprd_i2c_set_count(struct sprd_i2c *i2c_dev, u32 count)
> +{
> + writel(count, i2c_dev->base + I2C_COUNT);
> +}
> +
> +static void sprd_i2c_send_stop(struct sprd_i2c *i2c_dev, int stop)
> +{
> + unsigned int tmp = readl(i2c_dev->base + I2C_CTL);

u32? Here and in many other places?

...

> +static irqreturn_t sprd_i2c_isr_thread(int irq, void *dev_id)
> +{
> + struct sprd_i2c *i2c_dev = dev_id;
> + struct i2c_msg *msg = i2c_dev->msg;
> + int ack = readl(i2c_dev->base + I2C_STATUS) & I2C_RX_ACK;
> + u32 i2c_count = readl(i2c_dev->base + I2C_COUNT);
> + u32 i2c_tran;
> +
> + if (msg->flags & I2C_M_RD)
> + i2c_tran = i2c_dev->count >= I2C_FIFO_FULL_THLD;
> + else
> + i2c_tran = i2c_count;
> +
> + /*
> +  * If we got one ACK from slave when writing data, and we did not

Here you say: "If we get ack..."

> +  * finish this transmission (i2c_tran is not zero), then we should
> +  * continue to write data.
> +  *
> +  * For reading data, ack is always 0, if i2c_tran is not 0 which
> +  * means we still need to contine to read data from slave.
> +  */
> + if (i2c_tran && !ack) {

... but the code gives the assumption you did NOT get an ack. So, either
rename the variable to 'ack_err' or keep it 'ack' and invert the logic
when initializing the variable.

> + sprd_i2c_data_transfer(i2c_dev);
> + return IRQ_HANDLED;
> + }
> +
> + i2c_dev->err = 0;
> +
> + /*
> +  * If we did not get one ACK from slave when writing data, we should
> +  * dump all registers to check I2C status.

Why? I would say no. NACK from a slave can always happen, e.g. when an
EEPROM is busy erasing a page.

> +  */
> + if (ack) {
> + i2c_dev->err = -EIO;
> + sprd_i2c_dump_reg(i2c_dev);
> + } else if (msg->flags & I2C_M_RD && i2c_dev->count) {
> + sprd_i2c_read_bytes(i2c_dev, i2c_dev->buf, i2c_dev->count);
> + }
> +
> + /* Transmission is done and clear ack and start operation */
> + sprd_i2c_clear_ack(i2c_dev);
> + sprd_i2c_clear_start(i2c_dev);
> + complete(&i2c_dev->complete);
> +
> + return IRQ_HANDLED;
> +}

...

> +
> + pm_runtime_set_autosuspend_delay(i2c_dev->dev, SPRD_I2C_PM_TIMEOUT);
> + pm_runtime_use_autosuspend(i2c_dev->dev);
> + pm_runtime_set_active(i2c_dev->dev);
> + pm_runtime_enable(i2c_dev->dev);
> +
> + ret = pm_runtime_get_sync(i2c_dev->dev);
> + if (ret < 0) {
> + dev_err(&pdev->dev, "i2c%d pm runtime resume failed!\n",
> + pdev->id);

Error message has wrong text.

> + goto err_rpm_put;
> + }
> +
> +static int sprd_i2c_init(void)
> +{
> + return platform_driver_register(&sprd_i2c_driver);
> +}
> +arch_initcall_sync(sprd_i2c_init);

arch_initcall? and no exit() function? Why is it that way and/or why
can't you use platform_module_driver()?

Rest looks good. I like the comments you added to the code.

Regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCH v3 09/14] [media] cxd2880: Add DVB-T monitor and integration layer functions

2017-08-27 Thread Mauro Carvalho Chehab
Em Wed, 16 Aug 2017 13:41:42 +0900
 escreveu:

> From: Yasunari Takiguchi 
> 
> Provide monitor and integration layer functions (DVB-T)
> for the Sony CXD2880 DVB-T2/T tuner + demodulator driver.
> 
> [Change list]
> Changes in V3
>drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt.c
>   -changed CXD2880_SLEEP to usleep_range
>   -chnaged cxd2880_atomic_set to atomic_set
>   -modified return code
>   -modified coding style of if() 
>drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt.h
>   -modified return code
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c
>   -removed unnecessary cast
>   -changed cxd2880_math_log to intlog10
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.h
>   -modified return code
> 
> Signed-off-by: Yasunari Takiguchi 
> Signed-off-by: Masayuki Yamamoto 
> Signed-off-by: Hideki Nozawa 
> Signed-off-by: Kota Yonezawa 
> Signed-off-by: Toshihiko Matsumoto 
> Signed-off-by: Satoshi Watanabe 
> ---
>  .../dvb-frontends/cxd2880/cxd2880_integ_dvbt.c |  198 
>  .../dvb-frontends/cxd2880/cxd2880_integ_dvbt.h |   58 +
>  .../cxd2880/cxd2880_tnrdmd_dvbt_mon.c  | 1227 
> 
>  .../cxd2880/cxd2880_tnrdmd_dvbt_mon.h  |  106 ++
>  4 files changed, 1589 insertions(+)
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt.c
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt.h
>  create mode 100644 
> drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c
>  create mode 100644 
> drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.h
> 
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt.c 
> b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt.c
> new file mode 100644
> index ..729cb0939203
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt.c
> @@ -0,0 +1,198 @@
> +/*
> + * cxd2880_integ_dvbt.c
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + * integration layer functions for DVB-T
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see .
> + */
> +
> +#include "cxd2880_tnrdmd_dvbt.h"
> +#include "cxd2880_integ_dvbt.h"
> +
> +static int dvbt_wait_demod_lock(struct cxd2880_tnrdmd *tnr_dmd);
> +
> +int cxd2880_integ_dvbt_tune(struct cxd2880_tnrdmd *tnr_dmd,
> + struct cxd2880_dvbt_tune_param
> + *tune_param)
> +{
> + int ret = 0;
> +
> + if ((!tnr_dmd) || (!tune_param))
> + return -EINVAL;
> +
> + if (tnr_dmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB)
> + return -EINVAL;
> +
> + if ((tnr_dmd->state != CXD2880_TNRDMD_STATE_SLEEP) &&
> + (tnr_dmd->state != CXD2880_TNRDMD_STATE_ACTIVE))
> + return -EPERM;
> +
> + atomic_set(&tnr_dmd->cancel, 0);
> +
> + if ((tune_param->bandwidth != CXD2880_DTV_BW_5_MHZ) &&
> + (tune_param->bandwidth != CXD2880_DTV_BW_6_MHZ) &&
> + (tune_param->bandwidth != CXD2880_DTV_BW_7_MHZ) &&
> + (tune_param->bandwidth != CXD2880_DTV_BW_8_MHZ)) {
> + return -EOPNOTSUPP;
> + }
> +
> + ret = cxd2880_tnrdmd_dvbt_tune1(tnr_dmd, tune_param);
> + if (ret)
> + return ret;
> +
> + usleep_range(CXD2880_TNRDMD_WAIT_AGC_STABLE * 1,
> +  CXD2880_TNRDMD_WAIT_AGC_STABLE * 1 + 1000);
> +
> + ret = cxd2880_tnrdmd_dvbt_tune2(tnr_dmd, tune_param);
> + if (ret)
> + return ret;
> +
> + ret = dvbt_wait_demod_lock(tnr_dmd);
> + if (ret)
> + return ret;
> +
> + return ret;
> +}
> +
> +int cxd2880_integ_dvbt_wait_ts_lock(struct cxd2880_tnrdmd *tnr_dmd)
> +{
> + int ret = 0;
> + enum cxd2880_tnrdmd_lock_result lo

Re: [PATCH 0/4] irda: move it to drivers/staging so we can delete it

2017-08-27 Thread Joe Perches
On Sun, 2017-08-27 at 17:03 +0200, Greg Kroah-Hartman wrote:
> The IRDA code has long been obsolete and broken.  So, to keep people
> from trying to use it, and to prevent people from having to maintain it,
> let's move it to drivers/staging/ so that we can delete it entirely from
> the kernel in a few releases.

MAINTAINERS should be updated as well.

It'd probably be nice to try to get an email to
the irda mailing list too if it still works.



Re: [PATCH v3 10/14] [media] cxd2880: Add DVB-T2 control functions for the driver

2017-08-27 Thread Mauro Carvalho Chehab
Em Wed, 16 Aug 2017 13:42:32 +0900
 escreveu:

> From: Yasunari Takiguchi 
> 
> Provide definitions, interfaces and functions needed for DVB-T2
> of the Sony CXD2880 DVB-T2/T tuner + demodulator driver.
> 
> [Change list]
> Changes in V3
>drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt2.h
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2.c
>   -modified return code
>   -modified coding style of if() 
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2.h
>   -modified return code
> 
> Signed-off-by: Yasunari Takiguchi 
> Signed-off-by: Masayuki Yamamoto 
> Signed-off-by: Hideki Nozawa 
> Signed-off-by: Kota Yonezawa 
> Signed-off-by: Toshihiko Matsumoto 
> Signed-off-by: Satoshi Watanabe 
> ---
>  .../media/dvb-frontends/cxd2880/cxd2880_dvbt2.h|  402 ++
>  .../dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2.c   | 1359 
> 
>  .../dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2.h   |   82 ++
>  3 files changed, 1843 insertions(+)
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt2.h
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2.c
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2.h
> 
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt2.h 
> b/drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt2.h
> new file mode 100644
> index ..674ed17deef5
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_dvbt2.h
> @@ -0,0 +1,402 @@
> +/*
> + * cxd2880_dvbt2.h
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + * DVB-T2 related definitions
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see .
> + */
> +
> +#ifndef CXD2880_DVBT2_H
> +#define CXD2880_DVBT2_H
> +
> +#include "cxd2880_common.h"
> +
> +enum cxd2880_dvbt2_profile {
> + CXD2880_DVBT2_PROFILE_BASE,
> + CXD2880_DVBT2_PROFILE_LITE,
> + CXD2880_DVBT2_PROFILE_ANY
> +};
> +
> +enum cxd2880_dvbt2_version {
> + CXD2880_DVBT2_V111,
> + CXD2880_DVBT2_V121,
> + CXD2880_DVBT2_V131
> +};
> +
> +enum cxd2880_dvbt2_s1 {
> + CXD2880_DVBT2_S1_BASE_SISO = 0x00,
> + CXD2880_DVBT2_S1_BASE_MISO = 0x01,
> + CXD2880_DVBT2_S1_NON_DVBT2 = 0x02,
> + CXD2880_DVBT2_S1_LITE_SISO = 0x03,
> + CXD2880_DVBT2_S1_LITE_MISO = 0x04,
> + CXD2880_DVBT2_S1_RSVD3 = 0x05,
> + CXD2880_DVBT2_S1_RSVD4 = 0x06,
> + CXD2880_DVBT2_S1_RSVD5 = 0x07,
> + CXD2880_DVBT2_S1_UNKNOWN = 0xff
> +};
> +
> +enum cxd2880_dvbt2_base_s2 {
> + CXD2880_DVBT2_BASE_S2_M2K_G_ANY = 0x00,
> + CXD2880_DVBT2_BASE_S2_M8K_G_DVBT = 0x01,
> + CXD2880_DVBT2_BASE_S2_M4K_G_ANY = 0x02,
> + CXD2880_DVBT2_BASE_S2_M1K_G_ANY = 0x03,
> + CXD2880_DVBT2_BASE_S2_M16K_G_ANY = 0x04,
> + CXD2880_DVBT2_BASE_S2_M32K_G_DVBT = 0x05,
> + CXD2880_DVBT2_BASE_S2_M8K_G_DVBT2 = 0x06,
> + CXD2880_DVBT2_BASE_S2_M32K_G_DVBT2 = 0x07,
> + CXD2880_DVBT2_BASE_S2_UNKNOWN = 0xff
> +};
> +
> +enum cxd2880_dvbt2_lite_s2 {
> + CXD2880_DVBT2_LITE_S2_M2K_G_ANY = 0x00,
> + CXD2880_DVBT2_LITE_S2_M8K_G_DVBT = 0x01,
> + CXD2880_DVBT2_LITE_S2_M4K_G_ANY = 0x02,
> + CXD2880_DVBT2_LITE_S2_M16K_G_DVBT2 = 0x03,
> + CXD2880_DVBT2_LITE_S2_M16K_G_DVBT = 0x04,
> + CXD2880_DVBT2_LITE_S2_RSVD1 = 0x05,
> + CXD2880_DVBT2_LITE_S2_M8K_G_DVBT2 = 0x06,
> + CXD2880_DVBT2_LITE_S2_RSVD2 = 0x07,
> + CXD2880_DVBT2_LITE_S2_UNKNOWN = 0xff
> +};
> +
> +enum cxd2880_dvbt2_guard {
> + CXD2880_DVBT2_G1_32 = 0x00,
> + CXD2880_DVBT2_G1_16 = 0x01,
> + CXD2880_DVBT2_G1_8 = 0x02,
> + CXD2880_DVBT2_G1_4 = 0x03,
> + CXD2880_DVBT2_G1_128 = 0x04,
> + CXD2880_DVBT2_G19_128 = 0x05,
> + CXD2880_DVBT2_G19_256 = 0x06,
> + CXD2880_DVBT2_G_RSVD1 = 0x07,
> +

Re: [PATCH 2/2] mtd: spi-nor: Altera ASMI Parallel II IP Core

2017-08-27 Thread matthew . gerlach


Hi Cyrille,

I think I figured out the confusion with regards to dummy cycles.  See my 
comment in line.


Matthew Gerlach

On Tue, 15 Aug 2017, Cyrille Pitchen wrote:


Le 15/08/2017 à 19:20, matthew.gerl...@linux.intel.com a écrit :


Hi Cyrille,

Thanks for the great feedback.  See my comments inline.

Matthew Gerlach

On Fri, 11 Aug 2017, Cyrille Pitchen wrote:


Hi Matthew,

Le 06/08/2017 à 20:24, matthew.gerl...@linux.intel.com a écrit :

From: Matthew Gerlach 

Signed-off-by: Matthew Gerlach 
---
 MAINTAINERS |   7 +
 drivers/mtd/spi-nor/Kconfig |   6 +
 drivers/mtd/spi-nor/Makefile|   3 +-
 drivers/mtd/spi-nor/altera-asmip2.c | 474

 include/linux/mtd/altera-asmip2.h   |  24 ++
 5 files changed, 513 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mtd/spi-nor/altera-asmip2.c
 create mode 100644 include/linux/mtd/altera-asmip2.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 672b5d5..9583c1a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -644,6 +644,13 @@ ALPS PS/2 TOUCHPAD DRIVER
 R:Pali Rohár 
 F:drivers/input/mouse/alps.*

+ALTERA ASMI Parallel II Driver
+M:  Matthew Gerlach 
+L:  linux-...@lists.infradead.org
+S:  Maintained
+F:  drivers/mtd/spi-nor/altera-asmip2.c
+F:  inclulde/linux/mtd/altera-asmip2.h
+
 ALTERA MAILBOX DRIVER
 M:Ley Foon Tan 
 L:nios2-...@lists.rocketboards.org (moderated for non-subscribers)
diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index 69c638d..eb2c522 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -129,4 +129,10 @@ config SPI_STM32_QUADSPI
   This enables support for the STM32 Quad SPI controller.
   We only connect the NOR to this controller.

+config SPI_ALTERA_ASMIP2
+tristate "Altera ASMI Parallel II IP"
+depends on OF && HAS_IOMEM
+help
+  Enable support for Altera ASMI Parallel II.
+
 endif # MTD_SPI_NOR
diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index c5f171d..1c79324 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -1,4 +1,5 @@
 obj-$(CONFIG_MTD_SPI_NOR)+= spi-nor.o
+obj-$(CONFIG_SPI_ALTERA_ASMIP2)+= altera-asmip2.o
 obj-$(CONFIG_SPI_ASPEED_SMC)+= aspeed-smc.o
 obj-$(CONFIG_SPI_ATMEL_QUADSPI)+= atmel-quadspi.o
 obj-$(CONFIG_SPI_CADENCE_QUADSPI)+= cadence-quadspi.o
@@ -9,4 +10,4 @@ obj-$(CONFIG_SPI_NXP_SPIFI)+= nxp-spifi.o
 obj-$(CONFIG_SPI_INTEL_SPI)+= intel-spi.o
 obj-$(CONFIG_SPI_INTEL_SPI_PCI)+= intel-spi-pci.o
 obj-$(CONFIG_SPI_INTEL_SPI_PLATFORM)+= intel-spi-platform.o
-obj-$(CONFIG_SPI_STM32_QUADSPI)+= stm32-quadspi.o
\ No newline at end of file
+obj-$(CONFIG_SPI_STM32_QUADSPI)+= stm32-quadspi.o
diff --git a/drivers/mtd/spi-nor/altera-asmip2.c
b/drivers/mtd/spi-nor/altera-asmip2.c
new file mode 100644
index 000..2095f2e
--- /dev/null
+++ b/drivers/mtd/spi-nor/altera-asmip2.c
@@ -0,0 +1,474 @@
+/*
+ * Copyright (C) 2017 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but
WITHOUT
+ * ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
along with
+ * this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define QSPI_ACTION_REG 0
+#define QSPI_ACTION_RST BIT(0)
+#define QSPI_ACTION_EN BIT(1)
+#define QSPI_ACTION_SC BIT(2)
+#define QSPI_ACTION_CHIP_SEL_SFT 4
+#define QSPI_ACTION_DUMMY_SFT 8
+#define QSPI_ACTION_READ_BACK_SFT 16
+
+#define QSPI_FIFO_CNT_REG 4
+#define QSPI_FIFO_DEPTH 0x200
+#define QSPI_FIFO_CNT_MSK 0x3ff
+#define QSPI_FIFO_CNT_RX_SFT 0
+#define QSPI_FIFO_CNT_TX_SFT 12
+
+#define QSPI_DATA_REG 0x8
+
+#define QSPI_POLL_TIMEOUT 1000
+#define QSPI_POLL_INTERVAL 5
+
+struct altera_asmip2 {
+void __iomem *csr_base;
+u32 num_flashes;
+struct device *dev;
+struct altera_asmip2_flash
*flash[ALTERA_ASMIP2_MAX_NUM_FLASH_CHIP];
+struct mutex bus_mutex;
+};
+
+struct altera_asmip2_flash {
+struct spi_nor nor;
+struct altera_asmip2 *q;
+u32 bank;
+};
+
+static int altera_asmip2_write_reg(struct spi_nor *nor, u8 opcode,
u8 *val,
+int len)
+{
+struct altera_asmip2_flash *flash = nor->priv;
+struct altera_asmip2 *q = flash->q;
+u32 reg;
+int ret;
+int i;
+
+if ((len + 1) > QSPI_FIFO_DEPTH) {
+dev_err(q->dev, "%s bad len %d > %d\n",
+__func__, len + 1, QSPI_FIFO_DEPTH);
+return -EINVAL;
+}
+
+writel(opcode, q->csr

Re: [PATCH v3 11/14] [media] cxd2880: Add DVB-T2 monitor and integration layer functions

2017-08-27 Thread Mauro Carvalho Chehab
Em Wed, 16 Aug 2017 13:43:41 +0900
 escreveu:

> From: Yasunari Takiguchi 
> 
> Provide monitor and integration layer functions (DVB-T2)
> for the Sony CXD2880 DVB-T2/T tuner + demodulator driver.
> 
> [Change list]
> Changes in V3
>drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt2.c
>   -changed CXD2880_SLEEP to usleep_range
>   -replaced cxd2880_atomic_set to atomic_set
>   -modified return code
>   -modified coding style of if()  
>drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt2.h
>   -modified return code
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c
>   -removed unnecessary cast
>   -changed cxd2880_math_log to intlog10
>   -modified return code
>   -modified coding style of if() 
>   -changed hexadecimal code to lower case. 
>drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.h
>   -modified return code
> 
> Signed-off-by: Yasunari Takiguchi 
> Signed-off-by: Masayuki Yamamoto 
> Signed-off-by: Hideki Nozawa 
> Signed-off-by: Kota Yonezawa 
> Signed-off-by: Toshihiko Matsumoto 
> Signed-off-by: Satoshi Watanabe 
> ---
>  .../dvb-frontends/cxd2880/cxd2880_integ_dvbt2.c|  312 +++
>  .../dvb-frontends/cxd2880/cxd2880_integ_dvbt2.h|   64 +
>  .../cxd2880/cxd2880_tnrdmd_dvbt2_mon.c | 2622 
> 
>  .../cxd2880/cxd2880_tnrdmd_dvbt2_mon.h |  170 ++
>  4 files changed, 3168 insertions(+)
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt2.c
>  create mode 100644 drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt2.h
>  create mode 100644 
> drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c
>  create mode 100644 
> drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.h
> 
> diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt2.c 
> b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt2.c
> new file mode 100644
> index ..ac049820d797
> --- /dev/null
> +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_integ_dvbt2.c
> @@ -0,0 +1,312 @@
> +/*
> + * cxd2880_integ_dvbt2.c
> + * Sony CXD2880 DVB-T2/T tuner + demodulator driver
> + * integration layer functions for DVB-T2
> + *
> + * Copyright (C) 2016, 2017 Sony Semiconductor Solutions Corporation
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; version 2 of the License.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see .
> + */
> +
> +#include "cxd2880_tnrdmd_dvbt2.h"
> +#include "cxd2880_tnrdmd_dvbt2_mon.h"
> +#include "cxd2880_integ_dvbt2.h"
> +
> +static int dvbt2_wait_demod_lock(struct cxd2880_tnrdmd *tnr_dmd,
> +  enum cxd2880_dvbt2_profile
> +  profile);
> +
> +static int dvbt2_wait_l1_post_lock(struct cxd2880_tnrdmd *tnr_dmd);
> +
> +int cxd2880_integ_dvbt2_tune(struct cxd2880_tnrdmd *tnr_dmd,
> +  struct cxd2880_dvbt2_tune_param
> +  *tune_param)
> +{
> + int ret = 0;
> +
> + if ((!tnr_dmd) || (!tune_param))
> + return -EINVAL;
> +
> + if (tnr_dmd->diver_mode == CXD2880_TNRDMD_DIVERMODE_SUB)
> + return -EINVAL;
> +
> + if ((tnr_dmd->state != CXD2880_TNRDMD_STATE_SLEEP) &&
> + (tnr_dmd->state != CXD2880_TNRDMD_STATE_ACTIVE))
> + return -EPERM;
> +
> + atomic_set(&tnr_dmd->cancel, 0);
> +
> + if ((tune_param->bandwidth != CXD2880_DTV_BW_1_7_MHZ) &&
> + (tune_param->bandwidth != CXD2880_DTV_BW_5_MHZ) &&
> + (tune_param->bandwidth != CXD2880_DTV_BW_6_MHZ) &&
> + (tune_param->bandwidth != CXD2880_DTV_BW_7_MHZ) &&
> + (tune_param->bandwidth != CXD2880_DTV_BW_8_MHZ)) {
> + return -EOPNOTSUPP;
> + }
> +
> + if ((tune_param->profile != CXD2880_DVBT2_PROFILE_BASE) &&
> + (tune_param->profile != CXD2880_DVBT2_PROFILE_LITE))
> + return -EINVAL;
> +
> + ret = cxd2880_tnr

Re: [PATCH v3 14/14] [media] cxd2880 : Update MAINTAINERS file for CXD2880 driver

2017-08-27 Thread Mauro Carvalho Chehab
Em Wed, 16 Aug 2017 17:02:05 +0900
"Takiguchi, Yasunari"  escreveu:

> From: Yasunari Takiguchi 
> 
> I add an e-mail address and re-send this mail again.
> 
> This is MAINTAINERS file update about the driver for
> the Sony CXD2880 DVB-T2/T tuner + demodulator.

Patches 12-14 look OK to me (although I didn't try to compile).

You can likely fold them into a single patch adding an entry to 
MAINTAINERS and the driver to Kconfig/Makefile.

Regards,
Mauro

> 
> [Change list]
> Changes in V3
>MAINTAINERS
>   -no change
> 
> Signed-off-by: Yasunari Takiguchi 
> Signed-off-by: Masayuki Yamamoto 
> Signed-off-by: Hideki Nozawa 
> Signed-off-by: Kota Yonezawa 
> Signed-off-by: Toshihiko Matsumoto 
> Signed-off-by: Satoshi Watanabe 
> ---
>  MAINTAINERS | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6f7721d1634c..12a80c33c194 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8302,6 +8302,15 @@ T: git git://linuxtv.org/media_tree.git
>  S:   Supported
>  F:   drivers/media/dvb-frontends/cxd2841er*
>  
> +MEDIA DRIVERS FOR CXD2880
> +M:   Yasunari Takiguchi 
> +L:   linux-me...@vger.kernel.org
> +W:   http://linuxtv.org/
> +T:   git git://linuxtv.org/media_tree.git
> +S:   Supported
> +F:   drivers/media/dvb-frontends/cxd2880/*
> +F:   drivers/media/spi/cxd2880*
> +
>  MEDIA DRIVERS FOR FREESCALE IMX
>  M:   Steve Longerbeam 
>  M:   Philipp Zabel 



Thanks,
Mauro


  1   2   3   4   >