Re: [PATCH v2] staging: bcm2835-audio: Release resources on module_exit()

2018-03-14 Thread Kirill Marinushkin
On 03/13/18 22:23, Andy Shevchenko wrote:
> On Tue, Mar 13, 2018 at 9:34 PM, Kirill Marinushkin
>  wrote:
>> In the current implementation, `rmmod snd_bcm2835` does not release
>> resources properly. It causes an oops when trying to list sound devices.
>>
>> This commit fixes it.
> Nice catch!
>
> See my comments below.
>
>>  static void snd_devm_unregister_child(struct device *dev, void *res)
>>  {
>> struct device *childdev = *(struct device **)res;
>> +   struct bcm2835_chip *chip = dev_get_drvdata(childdev);
>> +   struct snd_card *card = chip->card;
>> +
>> +   snd_card_free(card);
>> +   dev_set_drvdata(childdev, NULL);
> AFAIU this is done by device core.

Maybe you are right. But I don't know, which function in the device core does 
it.
It is safe to have this line. So, I suggest to keep it.

>
>> device_unregister(childdev);
>>  }
>> +static void snd_devm_release(struct device *dev)
>> +{
>> +   struct bcm2835_chip *chip = dev_get_drvdata(dev);
>> +
>> +   kfree(chip);
>> +}
>
>>  /* chip-specific constructor
>> @@ -122,7 +136,7 @@ static int snd_bcm2835_create(struct snd_card *card,
>>
>> err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, );
>> if (err) {
>> -   snd_bcm2835_free(chip);
>> +   kfree(chip);
> Do you call device_register() inside snd_device_new()?
> In this case you might need put_device() here instead of simple kfree().

No, from what I see, device_register() does not happen inside snd_device_new().

>> return err;
>> }

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-03-14 Thread Deepa Dinamani
On Wed, Mar 14, 2018 at 1:52 PM, Arnd Bergmann  wrote:
> On Wed, Mar 14, 2018 at 4:50 AM, Deepa Dinamani  
> wrote:
>> The file arch/arm64/kernel/process.c needs asm/compat.h also to be
>> included directly since this is included conditionally from
>> include/compat.h. This does seem to be typical of arm64 as I was not
>> completely able to get rid of asm/compat.h includes for arm64 in this
>> series. My plan is to have separate patches to get rid of asm/compat.h
>> includes for the architectures that are not straight forward to keep
>> this series simple.
>> I will fix this and update the series.
>>
>
> I ran across the same thing in two more files during randconfig testing on
> arm64 now, adding this fixup on top for the moment, but maybe there
> is a better way:

I was looking at how Al tested his uaccess patches:
https://www.spinics.net/lists/linux-fsdevel/msg108752.html

He seems to be running the kbuild bot tests on his own git.
Is it possible to verify it this way on the 2038 tree? Or, I could
host a tree also.

Thanks,
Deepa
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3]PCI: hv: fix PCI-BUS domainID corruption

2018-03-14 Thread Sridhar Pitchai
Whenever PCI bus is added, HyperV guarantees the BUS id is unique. Even
with that when a first device is added to the bus, it overrides bus domain
ID with the device serial number. Sometime this can result in BUS ID not
being unique. In this case, when PCI_BUS and a device to bus is added, the
first device overwrites the bus domain ID to the device serial number,
which is 0. Since there exsist a PCI bus with domain ID 0 already the PCI
bus addition fails. This patch make sure when a device is added to a bus,
it never updated the bus domain ID. Since we have the transparent SRIOV
mode now, the short VF device name is no longer needed.

Fixes: 4a9b0933bdfc("PCI:hv:Use device serial number as PCI domain")
Cc: sta...@vger.kernel.org
Signed-off-by: Sridhar Pitchai 
---

Changes in v3:
* fix the commit comment. [KY Srinivasan, Michael Kelley]
---
 drivers/pci/host/pci-hyperv.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 2faf38e..ac67e56 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1518,17 +1518,6 @@ static struct hv_pci_dev *new_pcichild_device(struct 
hv_pcibus_device *hbus,
get_pcichild(hpdev, hv_pcidev_ref_childlist);
spin_lock_irqsave(>device_list_lock, flags);
 
-   /*
-* When a device is being added to the bus, we set the PCI domain
-* number to be the device serial number, which is non-zero and
-* unique on the same VM.  The serial numbers start with 1, and
-* increase by 1 for each device.  So device names including this
-* can have shorter names than based on the bus instance UUID.
-* Only the first device serial number is used for domain, so the
-* domain number will not change after the first device is added.
-*/
-   if (list_empty(>children))
-   hbus->sysdata.domain = desc->ser;
list_add_tail(>list_entry, >children);
spin_unlock_irqrestore(>device_list_lock, flags);
return hpdev;
-- 
2.7.4 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/13] staging: add drivers to support Mediatek mt7621 in gnubee-pc1

2018-03-14 Thread NeilBrown
On Thu, Mar 15 2018, NeilBrown wrote:

> Hi Greg,
>  I'd like to submit the following drivers to staging.  They
>  are all for components of the mt7621 MIPS-based SOC from Mediatek.
>  I lifted them out of libreCMC and (for the ethernet code) out
>  of email posts from about 2 years ago.  I forward-ported
>  them to mainline, fixed enough bugs that they mostly work,
>  and moved them to staging.
>
>  With these patches the GNUBEE is almost usable.  It needs
>  one patch to arch/mips/kernel/setup.c because mips_cm_probe()
>  is being called too early.  To successfully reboot (i.e warm-restart)
>  it needs a small patch to drivers/mtd/devices/m25p80.c.
>
>  I've made a point of only included code that I can actually test
>  on hardware that I have.  That has meant selecting only a few patches
>  from a series and in a couple of cases, discarding some files from a
>  patch.  I haven't discard code from within a file that I need part
>  of.
>
>  All the driver patches had a From: of John Crispin so he is cc:ed -
>  thanks John!!

Unfortunately the email address I had for John bounces.  So if anyone
replies for any reason, you might like to delete his address from the
Cc.

Thanks,
NeilBrown


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6 0/6] staging: Introduce DPAA2 Ethernet Switch driver

2018-03-14 Thread Andrew Lunn
On Wed, Mar 14, 2018 at 10:55:52AM -0500, Razvan Stefanescu wrote:
> This patchset introduces the Ethernet Switch Driver for Freescale/NXP SoCs
> with DPAA2 (DataPath Acceleration Architecture v2). The driver manages
> switch objects discovered on the fsl-mc bus. A description of the driver
> can be found in the associated README file.

Hi Greg

This code has much better quality than the usual stuff in staging. I
see no reason not to merge it. 

Andrew
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [Y2038] [PATCH v4 02/10] include: Move compat_timespec/ timeval to compat_time.h

2018-03-14 Thread Arnd Bergmann
On Wed, Mar 14, 2018 at 4:50 AM, Deepa Dinamani  wrote:
> The file arch/arm64/kernel/process.c needs asm/compat.h also to be
> included directly since this is included conditionally from
> include/compat.h. This does seem to be typical of arm64 as I was not
> completely able to get rid of asm/compat.h includes for arm64 in this
> series. My plan is to have separate patches to get rid of asm/compat.h
> includes for the architectures that are not straight forward to keep
> this series simple.
> I will fix this and update the series.
>

I ran across the same thing in two more files during randconfig testing on
arm64 now, adding this fixup on top for the moment, but maybe there
is a better way:

commit 4f3e9e1211799a79b201a1af309a1ec3864147ec
Author: Arnd Bergmann 
Date:   Wed Mar 14 18:23:16 2018 +0100

arm64: fix perf_regs.c

arch/arm64/kernel/perf_regs.c: In function 'perf_reg_abi':
arch/arm64/kernel/perf_regs.c:50:6: error: implicit declaration of
function 'is_compat_thread'; did you mean 'is_compat_task'?
[-Werror=implicit-function-declaration]
arch/arm64/kernel/hw_breakpoint.c: In function 'is_compat_bp':
arch/arm64/kernel/hw_breakpoint.c:182:16: error: implicit
declaration of function 'is_compat_thread'; did you mean
'is_compat_task'? [-Werror=implicit-function-declaration]

Signed-off-by: Arnd Bergmann 

diff --git a/arch/arm64/kernel/hw_breakpoint.c
b/arch/arm64/kernel/hw_breakpoint.c
index 413dbe530da8..74bb56f656ef 100644
--- a/arch/arm64/kernel/hw_breakpoint.c
+++ b/arch/arm64/kernel/hw_breakpoint.c
@@ -30,6 +30,7 @@
 #include 
 #include 

+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm64/kernel/perf_regs.c b/arch/arm64/kernel/perf_regs.c
index 0bbac612146e..1b463a4efe49 100644
--- a/arch/arm64/kernel/perf_regs.c
+++ b/arch/arm64/kernel/perf_regs.c
@@ -6,6 +6,7 @@
 #include 
 #include 

+#include 
 #include 
 #include 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/7] staging: pi433: fix CamelCase for bitRate variables

2018-03-14 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/rf69.c | 16 
 drivers/staging/pi433/rf69.h |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index b57d3f4e9321..e11c9cca447b 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -201,26 +201,26 @@ int rf69_set_modulation_shaping(struct spi_device *spi,
}
 }
 
-int rf69_set_bit_rate(struct spi_device *spi, u16 bitRate)
+int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate)
 {
int retval;
-   u32 bitRate_min;
-   u32 bitRate_reg;
+   u32 bit_rate_min;
+   u32 bit_rate_reg;
u8 msb;
u8 lsb;
 
// check input value
-   bitRate_min = F_OSC / 8388608; // 8388608 = 2^23;
-   if (bitRate < bitRate_min) {
+   bit_rate_min = F_OSC / 8388608; // 8388608 = 2^23;
+   if (bit_rate < bit_rate_min) {
dev_dbg(>dev, "setBitRate: illegal input param");
return -EINVAL;
}
 
// calculate reg settings
-   bitRate_reg = (F_OSC / bitRate);
+   bit_rate_reg = (F_OSC / bit_rate);
 
-   msb = (bitRate_reg & 0xff00) >> 8;
-   lsb = (bitRate_reg & 0xff);
+   msb = (bit_rate_reg & 0xff00) >> 8;
+   lsb = (bit_rate_reg & 0xff);
 
// transmit to RF 69
retval = rf69_write_reg(spi, REG_BITRATE_MSB, msb);
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 78366f251084..ee22a10c85c0 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -29,7 +29,7 @@ int rf69_set_mode(struct spi_device *spi, enum mode mode);
 int rf69_set_data_mode(struct spi_device *spi, u8 data_mode);
 int rf69_set_modulation(struct spi_device *spi, enum modulation modulation);
 int rf69_set_modulation_shaping(struct spi_device *spi, enum mod_shaping 
mod_shaping);
-int rf69_set_bit_rate(struct spi_device *spi, u16 bitRate);
+int rf69_set_bit_rate(struct spi_device *spi, u16 bit_rate);
 int rf69_set_deviation(struct spi_device *spi, u32 deviation);
 int rf69_set_frequency(struct spi_device *spi, u32 frequency);
 int rf69_enable_amplifier(struct spi_device *spi, u8 amplifier_mask);
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/7] staging: pi433: fix CamelCase for DIONumber variable

2018-03-14 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/rf69.c | 4 ++--
 drivers/staging/pi433/rf69.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index e11c9cca447b..e3394094f6a1 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -501,14 +501,14 @@ int rf69_set_ook_threshold_dec(struct spi_device *spi, 
enum threshold_decrement
}
 }
 
-int rf69_set_dio_mapping(struct spi_device *spi, u8 DIONumber, u8 value)
+int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value)
 {
u8 mask;
u8 shift;
u8 dio_addr;
u8 dio_value;
 
-   switch (DIONumber) {
+   switch (dio_number) {
case 0:
mask = MASK_DIO0; shift = SHIFT_DIO0; dio_addr = 
REG_DIOMAPPING1;
break;
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index ee22a10c85c0..4d6fc07f8255 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -41,7 +41,7 @@ int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain 
lnaGain);
 int rf69_set_bandwidth(struct spi_device *spi, enum mantisse mantisse, u8 
exponent);
 int rf69_set_bandwidth_during_afc(struct spi_device *spi, enum mantisse 
mantisse, u8 exponent);
 int rf69_set_ook_threshold_dec(struct spi_device *spi, enum 
threshold_decrement threshold_decrement);
-int rf69_set_dio_mapping(struct spi_device *spi, u8 DIONumber, u8 value);
+int rf69_set_dio_mapping(struct spi_device *spi, u8 dio_number, u8 value);
 bool rf69_get_flag(struct spi_device *spi, enum flag flag);
 int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold);
 int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length);
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/7] staging: pi433: fix CamelCase for syncSize variable

2018-03-14 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/rf69.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index b2c54999b022..b57d3f4e9321 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -633,16 +633,16 @@ int rf69_set_fifo_fill_condition(struct spi_device *spi, 
enum fifo_fill_conditio
}
 }
 
-int rf69_set_sync_size(struct spi_device *spi, u8 syncSize)
+int rf69_set_sync_size(struct spi_device *spi, u8 sync_size)
 {
// check input value
-   if (syncSize > 0x07) {
+   if (sync_size > 0x07) {
dev_dbg(>dev, "set: illegal input param");
return -EINVAL;
}
 
// write value
-   return rf69_read_mod_write(spi, REG_SYNC_CONFIG, 
MASK_SYNC_CONFIG_SYNC_SIZE, (syncSize << 3));
+   return rf69_read_mod_write(spi, REG_SYNC_CONFIG, 
MASK_SYNC_CONFIG_SYNC_SIZE, (sync_size << 3));
 }
 
 int rf69_set_sync_values(struct spi_device *spi, u8 sync_values[8])
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/7] staging: pi433: fix CamelCase for preambleLength variable

2018-03-14 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/rf69.c | 6 +++---
 drivers/staging/pi433/rf69.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index e5c7e48a3b86..b2c54999b022 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -590,7 +590,7 @@ int rf69_set_rssi_threshold(struct spi_device *spi, u8 
threshold)
return rf69_write_reg(spi, REG_RSSITHRESH, threshold);
 }
 
-int rf69_set_preamble_length(struct spi_device *spi, u16 preambleLength)
+int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length)
 {
int retval;
u8 msb, lsb;
@@ -598,8 +598,8 @@ int rf69_set_preamble_length(struct spi_device *spi, u16 
preambleLength)
/* no value check needed - u16 exactly matches register size */
 
/* calculate reg settings */
-   msb = (preambleLength & 0xff00) >> 8;
-   lsb = (preambleLength & 0xff);
+   msb = (preamble_length & 0xff00) >> 8;
+   lsb = (preamble_length & 0xff);
 
/* transmit to chip */
retval = rf69_write_reg(spi, REG_PREAMBLE_MSB, msb);
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index d83808a5dd86..78366f251084 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -44,7 +44,7 @@ int rf69_set_ook_threshold_dec(struct spi_device *spi, enum 
threshold_decrement
 int rf69_set_dio_mapping(struct spi_device *spi, u8 DIONumber, u8 value);
 bool rf69_get_flag(struct spi_device *spi, enum flag flag);
 int rf69_set_rssi_threshold(struct spi_device *spi, u8 threshold);
-int rf69_set_preamble_length(struct spi_device *spi, u16 preambleLength);
+int rf69_set_preamble_length(struct spi_device *spi, u16 preamble_length);
 int rf69_enable_sync(struct spi_device *spi);
 int rf69_disable_sync(struct spi_device *spi);
 int rf69_set_fifo_fill_condition(struct spi_device *spi, enum 
fifo_fill_condition fifo_fill_condition);
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/13] staging: mt7621-eth: add support for mt7621

2018-03-14 Thread NeilBrown
From: John Crispin 

Add support for SoCs from the mt7621 family. These all have 2 GMAC ports,
both of which are attached to the same internal 1000MBit switch. Currently
we only support GMAC1 as the sole CPU port. MT7621 is very similar to
MT7620 with only a few registers having different offsets. MT7621 is the
first SoC to have the new QDMA engine builtin. The older PDMA engine is
also present. unfortunatley, to get the best performance we need to run RX
on PDMA and TX on QDMA. This SoC is also the first to have TX vlan
offloading and TSO6 support.

NeilBrown: the driver didn't work when I tested, so I changed it
  to match known-working code as much as possible.  This included
  converting to the PDMA engine for TX.

Signed-off-by: John Crispin 
Signed-off-by: Felix Fietkau 
Signed-off-by: Michael Lee 
Signed-off-by: NeilBrown 
---
 drivers/staging/mt7621-eth/TODO |3 +
 drivers/staging/mt7621-eth/soc_mt7621.c |  160 +++
 2 files changed, 163 insertions(+)
 create mode 100644 drivers/staging/mt7621-eth/soc_mt7621.c

diff --git a/drivers/staging/mt7621-eth/TODO b/drivers/staging/mt7621-eth/TODO
index 50fb5a959ee8..f9e47d4b4cd4 100644
--- a/drivers/staging/mt7621-eth/TODO
+++ b/drivers/staging/mt7621-eth/TODO
@@ -6,5 +6,8 @@
 - convert gsw code to use switchdev interfaces
 - md7620_mmi_write etc should probably be wrapped
   in a regmap abstraction.
+- Get soc_mt7621 to work with QDMA TX if possible.
+- Ensure phys are correctly configured when a cable
+  is plugged in.
 
 Cc: NeilBrown 
diff --git a/drivers/staging/mt7621-eth/soc_mt7621.c 
b/drivers/staging/mt7621-eth/soc_mt7621.c
new file mode 100644
index ..743c0eed89b6
--- /dev/null
+++ b/drivers/staging/mt7621-eth/soc_mt7621.c
@@ -0,0 +1,160 @@
+/*   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 program is distributed in the hope that 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.
+ *
+ *   Copyright (C) 2009-2016 John Crispin 
+ *   Copyright (C) 2009-2016 Felix Fietkau 
+ *   Copyright (C) 2013-2016 Michael Lee 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "mtk_eth_soc.h"
+#include "gsw_mt7620.h"
+#include "mdio.h"
+
+#define MT7620_CDMA_CSG_CFG0x400
+#define MT7621_CDMP_IG_CTRL(MT7620_CDMA_CSG_CFG + 0x00)
+#define MT7621_CDMP_EG_CTRL(MT7620_CDMA_CSG_CFG + 0x04)
+#define MT7621_RESET_FEBIT(6)
+#define MT7621_L4_VALIDBIT(24)
+
+#define MT7621_TX_DMA_UDF  BIT(19)
+
+#define CDMA_ICS_ENBIT(2)
+#define CDMA_UCS_ENBIT(1)
+#define CDMA_TCS_ENBIT(0)
+
+#define GDMA_ICS_ENBIT(22)
+#define GDMA_TCS_ENBIT(21)
+#define GDMA_UCS_ENBIT(20)
+
+/* frame engine counters */
+#define MT7621_REG_MIB_OFFSET  0x2000
+#define MT7621_PPE_AC_BCNT0(MT7621_REG_MIB_OFFSET + 0x00)
+#define MT7621_GDM1_TX_GBCNT   (MT7621_REG_MIB_OFFSET + 0x400)
+#define MT7621_GDM2_TX_GBCNT   (MT7621_GDM1_TX_GBCNT + 0x40)
+
+#define GSW_REG_GDMA1_MAC_ADRL 0x508
+#define GSW_REG_GDMA1_MAC_ADRH 0x50C
+#define GSW_REG_GDMA2_MAC_ADRL 0x1508
+#define GSW_REG_GDMA2_MAC_ADRH 0x150C
+
+
+#define MT7621_MTK_RST_GL  0x04
+#define MT7620_MTK_INT_STATUS2 0x08
+
+/* MTK_INT_STATUS reg on mt7620 define CNT_GDM1_AF at BIT(29)
+ * but after test it should be BIT(13).
+ */
+#define MT7621_MTK_GDM1_AF BIT(28)
+#define MT7621_MTK_GDM2_AF BIT(29)
+
+static const u16 mt7621_reg_table[MTK_REG_COUNT] = {
+   [MTK_REG_PDMA_GLO_CFG] = RT5350_PDMA_GLO_CFG,
+   [MTK_REG_PDMA_RST_CFG] = RT5350_PDMA_RST_CFG,
+   [MTK_REG_DLY_INT_CFG] = RT5350_DLY_INT_CFG,
+   [MTK_REG_TX_BASE_PTR0] = RT5350_TX_BASE_PTR0,
+   [MTK_REG_TX_MAX_CNT0] = RT5350_TX_MAX_CNT0,
+   [MTK_REG_TX_CTX_IDX0] = RT5350_TX_CTX_IDX0,
+   [MTK_REG_TX_DTX_IDX0] = RT5350_TX_DTX_IDX0,
+   [MTK_REG_RX_BASE_PTR0] = RT5350_RX_BASE_PTR0,
+   [MTK_REG_RX_MAX_CNT0] = RT5350_RX_MAX_CNT0,
+   [MTK_REG_RX_CALC_IDX0] = RT5350_RX_CALC_IDX0,
+   [MTK_REG_RX_DRX_IDX0] = RT5350_RX_DRX_IDX0,
+   [MTK_REG_MTK_INT_ENABLE] = RT5350_MTK_INT_ENABLE,
+   [MTK_REG_MTK_INT_STATUS] = RT5350_MTK_INT_STATUS,
+   [MTK_REG_MTK_DMA_VID_BASE] = 0,
+   [MTK_REG_MTK_COUNTER_BASE] = MT7621_GDM1_TX_GBCNT,
+   [MTK_REG_MTK_RST_GL] = MT7621_MTK_RST_GL,
+   [MTK_REG_MTK_INT_STATUS2] = MT7620_MTK_INT_STATUS2,
+};
+
+static void mt7621_mtk_reset(struct mtk_eth *eth)
+{
+   mtk_reset(eth, MT7621_RESET_FE);
+}
+
+static int 

[PATCH 08/13] staging: mt7621-eth: add the drivers core files

2018-03-14 Thread NeilBrown
From: John Crispin 

Original comment:

This patch adds the main chunk of the driver. The ethernet core is used in
all of the Mediatek/Ralink Wireless SoCs. Over the years we have seen
various changes to
* the register layout
* the type of ports (single/dual gbit, internal FE/Gbit switch)
* dma engine (PDMA/QDMA)

and new offloading features were added, such as
* checksum
* VLAN TX/RX
* TSO
* LRO

The core functionality has however remained the same allowing us to use
the same code for all SoCs.

The abstraction for the various SoCs uses the typical ops struct pattern
which allows us to extend or override the core functionality depending on
which SoC we are on. The code to bring up the switches and external ports
has also been split into separate files.

There are 2 types of DMA engine, PDMA and the newer QDMA. PDMA uses a
typical ring buffer while QDMA uses a linked list. Unfortunatley we have
the MT7621 which has a few silicon issues. Due to these issues we need to
PDMA for RX and QDMA for TX. All SoCs newer than the MT7621 can can run on
QDMA exclusively.

Most of the SoCs have a switch frontend. Older silicon has a so called ESW
(Ethernet Switch) while newer cores have a GSW (Gigabit switch).
Additionally there is a MDIO bus that can be used to talk to PHYs. In these
cases one switch port get changed into a normal MAC port.

Some SoCs have a dual MAC, we currently only support this on MT7623.

NeilBrown:
 - removed everything not closely related to mt7621, as that is all I
   can test
 - converted ethtool.c to new ethtool_link_ksettings interfaces.
   Doesn't work yet.
 - updated some phydev interface use: e.g. dev_name() -> phydev_name()
 - updated mdio to use mdiobus_get_phy()
 - added some missing export_symbols
 - updated get_stats64 interface
 - TX_DMA_FPORT and TX_DMA_TSO to tx dma descriptor
 - range checked RX_DMA_FPORT in rx dma descriptor
 - tell hardware what mac address was chosen
 - fixed MT7620_GDMA1_FWD_CFG which was using wrong value

Signed-off-by: John Crispin 
Signed-off-by: Felix Fietkau 
Signed-off-by: Michael Lee 
Signed-off-by: NeilBrown 
---
 drivers/staging/mt7621-eth/TODO  |3 
 drivers/staging/mt7621-eth/ethtool.c |  225 +++
 drivers/staging/mt7621-eth/ethtool.h |   22 
 drivers/staging/mt7621-eth/mdio.c|  271 
 drivers/staging/mt7621-eth/mdio.h|   27 
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 2178 ++
 drivers/staging/mt7621-eth/mtk_eth_soc.h |  721 ++
 7 files changed, 3447 insertions(+)
 create mode 100644 drivers/staging/mt7621-eth/ethtool.c
 create mode 100644 drivers/staging/mt7621-eth/ethtool.h
 create mode 100644 drivers/staging/mt7621-eth/mdio.c
 create mode 100644 drivers/staging/mt7621-eth/mdio.h
 create mode 100644 drivers/staging/mt7621-eth/mtk_eth_soc.c
 create mode 100644 drivers/staging/mt7621-eth/mtk_eth_soc.h

diff --git a/drivers/staging/mt7621-eth/TODO b/drivers/staging/mt7621-eth/TODO
index 5f269af0db5c..25c550e8df8c 100644
--- a/drivers/staging/mt7621-eth/TODO
+++ b/drivers/staging/mt7621-eth/TODO
@@ -1,4 +1,7 @@
 
 - verify devicetree documentation is consistent with code
+- fix ethtool - currently doesn't return valid data.
+- general code review and clean up
+- add support for second MAC on mt7621
 
 Cc: NeilBrown 
diff --git a/drivers/staging/mt7621-eth/ethtool.c 
b/drivers/staging/mt7621-eth/ethtool.c
new file mode 100644
index ..38ba0c040aba
--- /dev/null
+++ b/drivers/staging/mt7621-eth/ethtool.c
@@ -0,0 +1,225 @@
+/*   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 program is distributed in the hope that 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.
+ *
+ *   Copyright (C) 2009-2016 John Crispin 
+ *   Copyright (C) 2009-2016 Felix Fietkau 
+ *   Copyright (C) 2013-2016 Michael Lee 
+ */
+
+#include "mtk_eth_soc.h"
+
+static const char mtk_gdma_str[][ETH_GSTRING_LEN] = {
+#define _FE(x...)  # x,
+MTK_STAT_REG_DECLARE
+#undef _FE
+};
+
+static int mtk_get_link_ksettings(struct net_device *dev,
+ struct ethtool_link_ksettings *cmd)
+{
+   struct mtk_mac *mac = netdev_priv(dev);
+   int err;
+
+   if (!mac->phy_dev)
+   return -ENODEV;
+
+   if (mac->phy_flags == MTK_PHY_FLAG_ATTACH) {
+   err = phy_read_status(mac->phy_dev);
+   if (err)
+   return -ENODEV;
+   }
+
+   phy_ethtool_ksettings_get(mac->phy_dev, cmd);
+   return 0;
+}
+
+static int 

[PATCH 12/13] staging: mt7621-eth: mediatek: add Kconfig and Makefile

2018-03-14 Thread NeilBrown
From: John Crispin 

This patch adds the Makefile and Kconfig required to make the driver build.

Signed-off-by: John Crispin 
Signed-off-by: Felix Fietkau 
Signed-off-by: Michael Lee 
Signed-off-by: NeilBrown 
---
 drivers/staging/Kconfig |2 ++
 drivers/staging/Makefile|1 +
 drivers/staging/mt7621-eth/Kconfig  |   39 +++
 drivers/staging/mt7621-eth/Makefile |   14 +
 4 files changed, 56 insertions(+)
 create mode 100644 drivers/staging/mt7621-eth/Kconfig
 create mode 100644 drivers/staging/mt7621-eth/Makefile

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 4c872bf7c280..d9cddad71da2 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -132,4 +132,6 @@ source "drivers/staging/mt7621-dma/Kconfig"
 
 source "drivers/staging/mt7621-mmc/Kconfig"
 
+source "drivers/staging/mt7621-eth/Kconfig"
+
 endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 8ce10da1ab1d..2a7defcd6836 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -58,3 +58,4 @@ obj-$(CONFIG_SOC_MT7621)  += mt7621-gpio/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-spi/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-dma/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-mmc/
+obj-$(CONFIG_SOC_MT7621)   += mt7621-eth/
diff --git a/drivers/staging/mt7621-eth/Kconfig 
b/drivers/staging/mt7621-eth/Kconfig
new file mode 100644
index ..44ea86c7a96c
--- /dev/null
+++ b/drivers/staging/mt7621-eth/Kconfig
@@ -0,0 +1,39 @@
+config NET_VENDOR_MEDIATEK_STAGING
+   bool "MediaTek ethernet driver - staging version"
+   depends on RALINK
+   ---help---
+ If you have an MT7621 Mediatek SoC with ethernet, say Y.
+
+if NET_VENDOR_MEDIATEK_STAGING
+choice
+   prompt "MAC type"
+
+config NET_MEDIATEK_MT7621
+   bool "MT7621"
+   depends on MIPS && SOC_MT7621
+
+endchoice
+
+config NET_MEDIATEK_SOC_STAGING
+   tristate "MediaTek SoC Gigabit Ethernet support"
+   depends on NET_VENDOR_MEDIATEK_STAGING
+   select PHYLIB
+   ---help---
+ This driver supports the gigabit ethernet MACs in the
+ MediaTek SoC family.
+
+config NET_MEDIATEK_MDIO
+   def_bool NET_MEDIATEK_SOC_STAGING
+   depends on NET_MEDIATEK_MT7621
+   select PHYLIB
+
+config NET_MEDIATEK_MDIO_MT7620
+   def_bool NET_MEDIATEK_SOC_STAGING
+   depends on NET_MEDIATEK_MT7621
+   select NET_MEDIATEK_MDIO
+
+config NET_MEDIATEK_GSW_MT7621
+   def_tristate NET_MEDIATEK_SOC_STAGING
+   depends on NET_MEDIATEK_MT7621
+
+endif #NET_VENDOR_MEDIATEK_STAGING
diff --git a/drivers/staging/mt7621-eth/Makefile 
b/drivers/staging/mt7621-eth/Makefile
new file mode 100644
index ..018bcc3596b3
--- /dev/null
+++ b/drivers/staging/mt7621-eth/Makefile
@@ -0,0 +1,14 @@
+#
+# Makefile for the Ralink SoCs built-in ethernet macs
+#
+
+mtk-eth-soc-y  += mtk_eth_soc.o ethtool.o
+
+mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MDIO)+= mdio.o
+mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MDIO_MT7620) += mdio_mt7620.o
+
+mtk-eth-soc-$(CONFIG_NET_MEDIATEK_MT7621)  += soc_mt7621.o
+
+obj-$(CONFIG_NET_MEDIATEK_GSW_MT7621)  += gsw_mt7621.o
+
+obj-$(CONFIG_NET_MEDIATEK_SOC_STAGING) += mtk-eth-soc.o


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/13] staging: mt7621-eth: add mdio support for mt762X family

2018-03-14 Thread NeilBrown
From: John Crispin 

NeilBrown: this patch originally contained soc-mt7620.c
  but as I cannot test that, I removed it.  Some functions
  from mdio-mt7620.c are needed for soc-mt7621.c support
  - fixed  mt7620_has_carrier() to read correct register.

Original comment:

Add support for SoCs from the mt7620 family. These all have one dedicated
external gbit port and a builtin 5 port 100mbit switch. Additionally one
of the 5 switch ports can be changed to become an additional gbit port
that we can attach a phy to. MT7620 was the first SoC released after
Ralink was acquired by MTK and has seen a lot of changes to the core.

With MT7620 we have seen the addition of some advanced features such as
TX vlan offloading, RX scatter gather and TSO. Newer MTK SoCs are based on
this design.

Although the builtin MT7530 is gbit capable, the builtin PHYs are only
100mbit. There are boards in the wild that use one of the gbit MACs to
attach an external MT7530. For this to work a few hacks need to be applied
to reorganize the MDIO address mappings and autopolling for the SoC to
correctly work with the external switch. This is however not part of the
series and will be part of a later series once we evaluated if we want to
use DSA or switchdev.

Signed-off-by: John Crispin 
Signed-off-by: Felix Fietkau 
Signed-off-by: Michael Lee 
Signed-off-by: NeilBrown 
---
 drivers/staging/mt7621-eth/TODO  |2 
 drivers/staging/mt7621-eth/mdio_mt7620.c |  173 ++
 2 files changed, 175 insertions(+)
 create mode 100644 drivers/staging/mt7621-eth/mdio_mt7620.c

diff --git a/drivers/staging/mt7621-eth/TODO b/drivers/staging/mt7621-eth/TODO
index 1ab0530131ae..50fb5a959ee8 100644
--- a/drivers/staging/mt7621-eth/TODO
+++ b/drivers/staging/mt7621-eth/TODO
@@ -4,5 +4,7 @@
 - general code review and clean up
 - add support for second MAC on mt7621
 - convert gsw code to use switchdev interfaces
+- md7620_mmi_write etc should probably be wrapped
+  in a regmap abstraction.
 
 Cc: NeilBrown 
diff --git a/drivers/staging/mt7621-eth/mdio_mt7620.c 
b/drivers/staging/mt7621-eth/mdio_mt7620.c
new file mode 100644
index ..ced605c2914e
--- /dev/null
+++ b/drivers/staging/mt7621-eth/mdio_mt7620.c
@@ -0,0 +1,173 @@
+/*   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 program is distributed in the hope that 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.
+ *
+ *   Copyright (C) 2009-2016 John Crispin 
+ *   Copyright (C) 2009-2016 Felix Fietkau 
+ *   Copyright (C) 2013-2016 Michael Lee 
+ */
+
+#include 
+#include 
+#include 
+
+#include "mtk_eth_soc.h"
+#include "gsw_mt7620.h"
+#include "mdio.h"
+
+static int mt7620_mii_busy_wait(struct mt7620_gsw *gsw)
+{
+   unsigned long t_start = jiffies;
+
+   while (1) {
+   if (!(mtk_switch_r32(gsw,
+gsw->piac_offset + MT7620_GSW_REG_PIAC) &
+GSW_MDIO_ACCESS))
+   return 0;
+   if (time_after(jiffies, t_start + GSW_REG_PHY_TIMEOUT))
+   break;
+   }
+
+   dev_err(gsw->dev, "mdio: MDIO timeout\n");
+   return -1;
+}
+
+u32 _mt7620_mii_write(struct mt7620_gsw *gsw, u32 phy_addr,
+ u32 phy_register, u32 write_data)
+{
+   if (mt7620_mii_busy_wait(gsw))
+   return -1;
+
+   write_data &= 0x;
+
+   mtk_switch_w32(gsw, GSW_MDIO_ACCESS | GSW_MDIO_START | GSW_MDIO_WRITE |
+   (phy_register << GSW_MDIO_REG_SHIFT) |
+   (phy_addr << GSW_MDIO_ADDR_SHIFT) | write_data,
+   MT7620_GSW_REG_PIAC);
+
+   if (mt7620_mii_busy_wait(gsw))
+   return -1;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(_mt7620_mii_write);
+
+u32 _mt7620_mii_read(struct mt7620_gsw *gsw, int phy_addr, int phy_reg)
+{
+   u32 d;
+
+   if (mt7620_mii_busy_wait(gsw))
+   return 0x;
+
+   mtk_switch_w32(gsw, GSW_MDIO_ACCESS | GSW_MDIO_START | GSW_MDIO_READ |
+   (phy_reg << GSW_MDIO_REG_SHIFT) |
+   (phy_addr << GSW_MDIO_ADDR_SHIFT),
+   MT7620_GSW_REG_PIAC);
+
+   if (mt7620_mii_busy_wait(gsw))
+   return 0x;
+
+   d = mtk_switch_r32(gsw, MT7620_GSW_REG_PIAC) & 0x;
+
+   return d;
+}
+EXPORT_SYMBOL_GPL(_mt7620_mii_read);
+
+int mt7620_mdio_write(struct mii_bus *bus, int phy_addr, int phy_reg, u16 val)
+{
+   struct mtk_eth *eth = bus->priv;
+   struct mt7620_gsw *gsw = 

[PATCH 09/13] staging: mt7621-eth: add gigabit switch driver (GSW)

2018-03-14 Thread NeilBrown
From: John Crispin 

The GSW is found in all of the 1000mbit SoCs. it has 5 external ports,
1-2 cpu ports and 1 further port that the internal HW offloading engine
connects to. The switch core used is a MT7530, which also exists as a
standalone chip. Although these SoCs (mt7620/1/3) share the same switch
core, the bring up of these is slightly different. One of the reasons is
that on mt7620 the switch core is mmio mapped while MT7621/3 talks to the
switch via MDIO addr 0x1f. Additionally, the SoCs have different MAC types
and some of them have TRGMII support. MT7621 can do 1,2gbit and MT7623 is
able to do 2,6gbit. The support for the TRGMII bring up is not part of this
series as the code is based on the SDK driver and has between 1500 and 2000
magic values that still need to be converted to defines.

Because of these differences we have 3 separate drivers for these 3 SoCs.
These drivers are very basic and only provides basic init and irq support.

The SoC and switch core both have support for a special tag making DSA
support possible.

NeilBrown:
 - added setting to mt7621_hw_init to match working code from libreCMC
 This needs to be converted to use switchdev.

Signed-off-by: John Crispin 
Signed-off-by: NeilBrown 
---
 drivers/staging/mt7621-eth/TODO |1 
 drivers/staging/mt7621-eth/gsw_mt7620.h |  277 +
 drivers/staging/mt7621-eth/gsw_mt7621.c |  298 +++
 3 files changed, 576 insertions(+)
 create mode 100644 drivers/staging/mt7621-eth/gsw_mt7620.h
 create mode 100644 drivers/staging/mt7621-eth/gsw_mt7621.c

diff --git a/drivers/staging/mt7621-eth/TODO b/drivers/staging/mt7621-eth/TODO
index 25c550e8df8c..1ab0530131ae 100644
--- a/drivers/staging/mt7621-eth/TODO
+++ b/drivers/staging/mt7621-eth/TODO
@@ -3,5 +3,6 @@
 - fix ethtool - currently doesn't return valid data.
 - general code review and clean up
 - add support for second MAC on mt7621
+- convert gsw code to use switchdev interfaces
 
 Cc: NeilBrown 
diff --git a/drivers/staging/mt7621-eth/gsw_mt7620.h 
b/drivers/staging/mt7621-eth/gsw_mt7620.h
new file mode 100644
index ..1766939e2101
--- /dev/null
+++ b/drivers/staging/mt7621-eth/gsw_mt7620.h
@@ -0,0 +1,277 @@
+/*   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 program is distributed in the hope that 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.
+ *
+ *   Copyright (C) 2009-2016 John Crispin 
+ *   Copyright (C) 2009-2016 Felix Fietkau 
+ *   Copyright (C) 2013-2016 Michael Lee 
+ */
+
+#ifndef _RALINK_GSW_MT7620_H__
+#define _RALINK_GSW_MT7620_H__
+
+#define GSW_REG_PHY_TIMEOUT(5 * HZ)
+
+#define MT7620_GSW_REG_PIAC0x0004
+
+#define GSW_NUM_VLANS  16
+#define GSW_NUM_VIDS   4096
+#define GSW_NUM_PORTS  7
+#define GSW_PORT6  6
+
+#define GSW_MDIO_ACCESSBIT(31)
+#define GSW_MDIO_READ  BIT(19)
+#define GSW_MDIO_WRITE BIT(18)
+#define GSW_MDIO_START BIT(16)
+#define GSW_MDIO_ADDR_SHIFT20
+#define GSW_MDIO_REG_SHIFT 25
+
+#define GSW_REG_PORT_PMCR(x)   (0x3000 + (x * 0x100))
+#define GSW_REG_PORT_STATUS(x) (0x3008 + (x * 0x100))
+#define GSW_REG_SMACCR00x3fE4
+#define GSW_REG_SMACCR10x3fE8
+#define GSW_REG_CKGCR  0x3ff0
+
+#define GSW_REG_IMR0x7008
+#define GSW_REG_ISR0x700c
+#define GSW_REG_GPC1   0x7014
+
+#define SYSC_REG_CHIP_REV_ID   0x0c
+#define SYSC_REG_CFG   0x10
+#define SYSC_REG_CFG1  0x14
+#define RST_CTRL_MCM   BIT(2)
+#define SYSC_PAD_RGMII2_MDIO   0x58
+#define SYSC_GPIO_MODE 0x60
+
+#define PORT_IRQ_ST_CHG0x7f
+
+#define MT7621_ESW_PHY_POLLING 0x
+#define MT7620_ESW_PHY_POLLING 0x7000
+
+#definePMCR_IPGBIT(18)
+#definePMCR_MAC_MODE   BIT(16)
+#definePMCR_FORCE  BIT(15)
+#definePMCR_TX_EN  BIT(14)
+#definePMCR_RX_EN  BIT(13)
+#definePMCR_BACKOFFBIT(9)
+#definePMCR_BACKPRES   BIT(8)
+#definePMCR_RX_FC  BIT(5)
+#definePMCR_TX_FC  BIT(4)
+#definePMCR_SPEED(_x)  (_x << 2)
+#definePMCR_DUPLEX BIT(1)
+#definePMCR_LINK   BIT(0)
+
+#define PHY_AN_EN  BIT(31)
+#define PHY_PRE_EN BIT(30)
+#define PMY_MDC_CONF(_x)   ((_x & 0x3f) << 24)
+
+/* ethernet subsystem config register */
+#define 

[PATCH 6/7] staging: pi433: fix CamelCase for lnaGain enum

2018-03-14 Thread Valentin Vidic
Fixes checkpatch warning:

  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/Documentation/pi433.txt | 2 +-
 drivers/staging/pi433/pi433_if.h  | 2 +-
 drivers/staging/pi433/rf69.c  | 4 ++--
 drivers/staging/pi433/rf69.h  | 2 +-
 drivers/staging/pi433/rf69_enum.h | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/pi433/Documentation/pi433.txt 
b/drivers/staging/pi433/Documentation/pi433.txt
index 79bccc586869..3bb38644eb6e 100644
--- a/drivers/staging/pi433/Documentation/pi433.txt
+++ b/drivers/staging/pi433/Documentation/pi433.txt
@@ -196,7 +196,7 @@ rf params:
sets the electrical adoption of the antenna
fifty_ohm   - for antennas with an impedance of 50Ohm
two_hundred_ohm - for antennas with an impedance of 200Ohm
-   lnaGain
+   lna_gain
sets the gain of the low noise amp
automatic   - lna gain is determined by an agc
max - lna gain is set to maximum
diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h
index be4a96055a97..b6e214c29ddf 100644
--- a/drivers/staging/pi433/pi433_if.h
+++ b/drivers/staging/pi433/pi433_if.h
@@ -117,7 +117,7 @@ struct pi433_rx_cfg {
__u8rssi_threshold;
enum threshold_decrement threshold_decrement;
enum antenna_impedance  antenna_impedance;
-   enum lnaGainlna_gain;
+   enum lna_gain   lna_gain;
enum mantisse   bw_mantisse;/* normal: 0x50 */
__u8bw_exponent;/* during AFC: 0x8b */
enum dagc   dagc;
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index e3394094f6a1..0bc459e32f6b 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -399,9 +399,9 @@ int rf69_set_antenna_impedance(struct spi_device *spi, enum 
antenna_impedance an
}
 }
 
-int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain lnaGain)
+int rf69_set_lna_gain(struct spi_device *spi, enum lna_gain lna_gain)
 {
-   switch (lnaGain) {
+   switch (lna_gain) {
case automatic:
return rf69_read_mod_write(spi, REG_LNA, MASK_LNA_GAIN, 
LNA_GAIN_AUTO);
case max:
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index 4d6fc07f8255..b9f6850e3316 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -37,7 +37,7 @@ int rf69_disable_amplifier(struct spi_device *spi, u8 
amplifier_mask);
 int rf69_set_output_power_level(struct spi_device *spi, u8 power_level);
 int rf69_set_pa_ramp(struct spi_device *spi, enum pa_ramp pa_ramp);
 int rf69_set_antenna_impedance(struct spi_device *spi, enum antenna_impedance 
antenna_impedance);
-int rf69_set_lna_gain(struct spi_device *spi, enum lnaGain lnaGain);
+int rf69_set_lna_gain(struct spi_device *spi, enum lna_gain lna_gain);
 int rf69_set_bandwidth(struct spi_device *spi, enum mantisse mantisse, u8 
exponent);
 int rf69_set_bandwidth_during_afc(struct spi_device *spi, enum mantisse 
mantisse, u8 exponent);
 int rf69_set_ook_threshold_dec(struct spi_device *spi, enum 
threshold_decrement threshold_decrement);
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 5ac3d33a3d0c..eabaea99949d 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -65,7 +65,7 @@ enum antenna_impedance {
two_hundred_ohm
 };
 
-enum lnaGain {
+enum lna_gain {
automatic,
max,
max_minus_6,
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 7/7] staging: pi433: fix CamelCase for dagc enum

2018-03-14 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/Documentation/pi433.txt | 4 ++--
 drivers/staging/pi433/rf69.c  | 4 ++--
 drivers/staging/pi433/rf69_enum.h | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/pi433/Documentation/pi433.txt 
b/drivers/staging/pi433/Documentation/pi433.txt
index 3bb38644eb6e..d0b7000faafc 100644
--- a/drivers/staging/pi433/Documentation/pi433.txt
+++ b/drivers/staging/pi433/Documentation/pi433.txt
@@ -215,9 +215,9 @@ rf params:
Allowd values: 0...7
dagc;
operation mode of the digital automatic gain control
-   normalMode
+   normal_mode
improve
-   improve4LowModulationIndex
+   improve_for_low_modulation_index
 
  packet format:
enable_sync
diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 0bc459e32f6b..5b0554823263 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -751,11 +751,11 @@ int rf69_set_fifo_threshold(struct spi_device *spi, u8 
threshold)
 int rf69_set_dagc(struct spi_device *spi, enum dagc dagc)
 {
switch (dagc) {
-   case normalMode:
+   case normal_mode:
return rf69_write_reg(spi, REG_TESTDAGC, DAGC_NORMAL);
case improve:
return rf69_write_reg(spi, REG_TESTDAGC, 
DAGC_IMPROVED_LOWBETA0);
-   case improve4LowModulationIndex:
+   case improve_for_low_modulation_index:
return rf69_write_reg(spi, REG_TESTDAGC, 
DAGC_IMPROVED_LOWBETA1);
default:
dev_dbg(>dev, "set: illegal input param");
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index eabaea99949d..493bd0025453 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -135,9 +135,9 @@ enum address_filtering {
 };
 
 enum dagc {
-   normalMode,
+   normal_mode,
improve,
-   improve4LowModulationIndex
+   improve_for_low_modulation_index
 };
 
 #endif
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7] staging: pi433: fix CamelCase for GPIO functions

2018-03-14 Thread Valentin Vidic
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: 
  CHECK: Avoid CamelCase: 

Signed-off-by: Valentin Vidic 
---
 drivers/staging/pi433/pi433_if.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 5c6a7224180a..583b3803cf38 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -997,7 +997,7 @@ static int pi433_release(struct inode *inode, struct file 
*filp)
 
 /*-*/
 
-static int setup_GPIOs(struct pi433_device *device)
+static int setup_gpio(struct pi433_device *device)
 {
charname[5];
int retval;
@@ -1059,7 +1059,7 @@ static int setup_GPIOs(struct pi433_device *device)
return 0;
 }
 
-static void free_GPIOs(struct pi433_device *device)
+static void free_gpio(struct pi433_device *device)
 {
int i;
 
@@ -1174,7 +1174,7 @@ static int pi433_probe(struct spi_device *spi)
mutex_init(>rx_lock);
 
/* setup GPIO (including irq_handler) for the different DIOs */
-   retval = setup_GPIOs(device);
+   retval = setup_gpio(device);
if (retval) {
dev_dbg(>dev, "setup of GPIOs failed");
goto GPIO_failed;
@@ -1261,7 +1261,7 @@ static int pi433_probe(struct spi_device *spi)
 device_create_failed:
pi433_free_minor(device);
 minor_failed:
-   free_GPIOs(device);
+   free_gpio(device);
 GPIO_failed:
kfree(device);
 
@@ -1273,7 +1273,7 @@ static int pi433_remove(struct spi_device *spi)
struct pi433_device *device = spi_get_drvdata(spi);
 
/* free GPIOs */
-   free_GPIOs(device);
+   free_gpio(device);
 
/* make sure ops on existing fds can abort cleanly */
device->spi = NULL;
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/13] staging: add drivers to support Mediatek mt7621 in gnubee-pc1

2018-03-14 Thread NeilBrown
Hi Greg,
 I'd like to submit the following drivers to staging.  They
 are all for components of the mt7621 MIPS-based SOC from Mediatek.
 I lifted them out of libreCMC and (for the ethernet code) out
 of email posts from about 2 years ago.  I forward-ported
 them to mainline, fixed enough bugs that they mostly work,
 and moved them to staging.

 With these patches the GNUBEE is almost usable.  It needs
 one patch to arch/mips/kernel/setup.c because mips_cm_probe()
 is being called too early.  To successfully reboot (i.e warm-restart)
 it needs a small patch to drivers/mtd/devices/m25p80.c.

 I've made a point of only included code that I can actually test
 on hardware that I have.  That has meant selecting only a few patches
 from a series and in a couple of cases, discarding some files from a
 patch.  I haven't discard code from within a file that I need part
 of.

 All the driver patches had a From: of John Crispin so he is cc:ed -
 thanks John!!

 I have added TODO files, some of which have useful details.
 I think some of the drivers (eth,mmc, maybe dma) should be merged
 with related mainline code rather than added as separate drivers.

 I've included a dts file for the GNUBEE.  When all the other drivers
 move out of staging, it should follow them.

 I plan to continue to work on these drivers, but probably not for a
 few weeks at least.

Thanks,
NeilBrown

---

John Crispin (12):
  staging: mt7621-pci: MIPS/ralink: add MT7621 pcie driver
  staging: mt7621-pinctrl: ralink: add pinctrl driver
  staging: mt7621-gpio: ralink: add mt7621 gpio controller
  staging: mt7621-spi: add mt7621 support
  staging: mt7621-dma: ralink: add rt2880 dma engine
  staging: mt7621-mmc: MIPS: ralink: add sdhci for mt7620a SoC
  staging: mt7621-eth: Document ralink/mediatek SoC ethernet binding
  staging: mt7621-eth: add the drivers core files
  staging: mt7621-eth: add gigabit switch driver (GSW)
  staging: mt7621-eth: add mdio support for mt762X family
  staging: mt7621-eth: add support for mt7621
  staging: mt7621-eth: mediatek: add Kconfig and Makefile

NeilBrown (1):
  staging: mt7621-dts: add dts files


 drivers/staging/Kconfig|   14 
 drivers/staging/Makefile   |8 
 drivers/staging/mt7621-dma/Kconfig |   12 
 drivers/staging/mt7621-dma/Makefile|4 
 drivers/staging/mt7621-dma/TODO|5 
 drivers/staging/mt7621-dma/mtk-hsdma.c |  767 +
 drivers/staging/mt7621-dma/ralink-gdma.c   |  928 ++
 drivers/staging/mt7621-dts/Kconfig |5 
 drivers/staging/mt7621-dts/Makefile|3 
 drivers/staging/mt7621-dts/TODO|5 
 drivers/staging/mt7621-dts/gbpc1.dts   |  143 +
 drivers/staging/mt7621-dts/mt7621.dtsi |  471 +++
 .../devicetree/bindings/net/mediatek-net-gsw.txt   |   48 
 drivers/staging/mt7621-eth/Kconfig |   39 
 drivers/staging/mt7621-eth/Makefile|   14 
 drivers/staging/mt7621-eth/TODO|   13 
 drivers/staging/mt7621-eth/ethtool.c   |  225 +
 drivers/staging/mt7621-eth/ethtool.h   |   22 
 drivers/staging/mt7621-eth/gsw_mt7620.h|  277 ++
 drivers/staging/mt7621-eth/gsw_mt7621.c|  298 ++
 drivers/staging/mt7621-eth/mdio.c  |  271 ++
 drivers/staging/mt7621-eth/mdio.h  |   27 
 drivers/staging/mt7621-eth/mdio_mt7620.c   |  173 +
 drivers/staging/mt7621-eth/mtk_eth_soc.c   | 2178 ++
 drivers/staging/mt7621-eth/mtk_eth_soc.h   |  721 +
 drivers/staging/mt7621-eth/soc_mt7621.c|  160 +
 drivers/staging/mt7621-gpio/Kconfig|6 
 drivers/staging/mt7621-gpio/Makefile   |3 
 drivers/staging/mt7621-gpio/TODO   |5 
 drivers/staging/mt7621-gpio/gpio-mt7621.c  |  353 ++
 drivers/staging/mt7621-mmc/Kconfig |   16 
 drivers/staging/mt7621-mmc/Makefile|   42 
 drivers/staging/mt7621-mmc/TODO|8 
 drivers/staging/mt7621-mmc/board.h |  137 +
 drivers/staging/mt7621-mmc/dbg.c   |  347 ++
 drivers/staging/mt7621-mmc/dbg.h   |  156 +
 drivers/staging/mt7621-mmc/mt6575_sd.h | 1001 +++
 drivers/staging/mt7621-mmc/sd.c| 3074 
 drivers/staging/mt7621-pci/Makefile|1 
 drivers/staging/mt7621-pci/TODO|   12 
 drivers/staging/mt7621-pci/pci-mt7621.c|  840 +
 drivers/staging/mt7621-pinctrl/Kconfig |4 
 drivers/staging/mt7621-pinctrl/Makefile|3 
 drivers/staging/mt7621-pinctrl/TODO|6 
 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c|  472 +++
 

[PATCH 05/13] staging: mt7621-dma: ralink: add rt2880 dma engine

2018-03-14 Thread NeilBrown
From: John Crispin 

Signed-off-by: John Crispin 
Signed-off-by: NeilBrown 
---
 drivers/staging/Kconfig  |2 
 drivers/staging/Makefile |1 
 drivers/staging/mt7621-dma/Kconfig   |   12 
 drivers/staging/mt7621-dma/Makefile  |4 
 drivers/staging/mt7621-dma/TODO  |5 
 drivers/staging/mt7621-dma/mtk-hsdma.c   |  767 +
 drivers/staging/mt7621-dma/ralink-gdma.c |  928 ++
 7 files changed, 1719 insertions(+)
 create mode 100644 drivers/staging/mt7621-dma/Kconfig
 create mode 100644 drivers/staging/mt7621-dma/Makefile
 create mode 100644 drivers/staging/mt7621-dma/TODO
 create mode 100644 drivers/staging/mt7621-dma/mtk-hsdma.c
 create mode 100644 drivers/staging/mt7621-dma/ralink-gdma.c

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index bcc6da1f656a..fa8cb95da178 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -128,4 +128,6 @@ source "drivers/staging/mt7621-gpio/Kconfig"
 
 source "drivers/staging/mt7621-spi/Kconfig"
 
+source "drivers/staging/mt7621-dma/Kconfig"
+
 endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 051af9965549..a577f3ac2dd0 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -56,3 +56,4 @@ obj-$(CONFIG_SOC_MT7621)  += mt7621-pci/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-pinctrl/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-gpio/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-spi/
+obj-$(CONFIG_SOC_MT7621)   += mt7621-dma/
diff --git a/drivers/staging/mt7621-dma/Kconfig 
b/drivers/staging/mt7621-dma/Kconfig
new file mode 100644
index ..2423c40099d1
--- /dev/null
+++ b/drivers/staging/mt7621-dma/Kconfig
@@ -0,0 +1,12 @@
+config DMA_RALINK
+   tristate "RALINK DMA support"
+   depends on RALINK && !SOC_RT288X
+   select DMA_ENGINE
+   select DMA_VIRTUAL_CHANNELS
+
+config MTK_HSDMA
+   tristate "MTK HSDMA support"
+   depends on RALINK && SOC_MT7621
+   select DMA_ENGINE
+   select DMA_VIRTUAL_CHANNELS
+
diff --git a/drivers/staging/mt7621-dma/Makefile 
b/drivers/staging/mt7621-dma/Makefile
new file mode 100644
index ..d3152d45cf45
--- /dev/null
+++ b/drivers/staging/mt7621-dma/Makefile
@@ -0,0 +1,4 @@
+obj-$(CONFIG_DMA_RALINK) += ralink-gdma.o
+obj-$(CONFIG_MTK_HSDMA) += mtk-hsdma.o
+
+ccflags-y += -I$(srctree)/drivers/dma
diff --git a/drivers/staging/mt7621-dma/TODO b/drivers/staging/mt7621-dma/TODO
new file mode 100644
index ..fdbc5002c32a
--- /dev/null
+++ b/drivers/staging/mt7621-dma/TODO
@@ -0,0 +1,5 @@
+
+- general code review and clean up
+- ensure device-tree requirements are documented
+
+Cc: NeilBrown 
diff --git a/drivers/staging/mt7621-dma/mtk-hsdma.c 
b/drivers/staging/mt7621-dma/mtk-hsdma.c
new file mode 100644
index ..5eba86e2d566
--- /dev/null
+++ b/drivers/staging/mt7621-dma/mtk-hsdma.c
@@ -0,0 +1,767 @@
+/*
+ *  Copyright (C) 2015, Michael Lee 
+ *  MTK HSDMA support
+ *
+ *  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;  either version 2 of the License, or (at your
+ *  option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "virt-dma.h"
+
+#define HSDMA_BASE_OFFSET  0x800
+
+#define HSDMA_REG_TX_BASE  0x00
+#define HSDMA_REG_TX_CNT   0x04
+#define HSDMA_REG_TX_CTX   0x08
+#define HSDMA_REG_TX_DTX   0x0c
+#define HSDMA_REG_RX_BASE  0x100
+#define HSDMA_REG_RX_CNT   0x104
+#define HSDMA_REG_RX_CRX   0x108
+#define HSDMA_REG_RX_DRX   0x10c
+#define HSDMA_REG_INFO 0x200
+#define HSDMA_REG_GLO_CFG  0x204
+#define HSDMA_REG_RST_CFG  0x208
+#define HSDMA_REG_DELAY_INT0x20c
+#define HSDMA_REG_FREEQ_THRES  0x210
+#define HSDMA_REG_INT_STATUS   0x220
+#define HSDMA_REG_INT_MASK 0x228
+#define HSDMA_REG_SCH_Q01  0x280
+#define HSDMA_REG_SCH_Q23  0x284
+
+#define HSDMA_DESCS_MAX0xfff
+#define HSDMA_DESCS_NUM8
+#define HSDMA_DESCS_MASK   (HSDMA_DESCS_NUM - 1)
+#define HSDMA_NEXT_DESC(x) (((x) + 1) & HSDMA_DESCS_MASK)
+
+/* HSDMA_REG_INFO */
+#define HSDMA_INFO_INDEX_MASK  0xf
+#define HSDMA_INFO_INDEX_SHIFT 24
+#define HSDMA_INFO_BASE_MASK   0xff
+#define HSDMA_INFO_BASE_SHIFT  16
+#define HSDMA_INFO_RX_MASK 0xff
+#define HSDMA_INFO_RX_SHIFT8
+#define HSDMA_INFO_TX_MASK 0xff
+#define 

[PATCH 02/13] staging: mt7621-pinctrl: ralink: add pinctrl driver

2018-03-14 Thread NeilBrown
From: John Crispin 

Signed-off-by: John Crispin 
Signed-off-by: NeilBrown 
---
 drivers/staging/Kconfig |2 
 drivers/staging/Makefile|1 
 drivers/staging/mt7621-pinctrl/Kconfig  |4 
 drivers/staging/mt7621-pinctrl/Makefile |3 
 drivers/staging/mt7621-pinctrl/TODO |6 
 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c |  472 +++
 6 files changed, 488 insertions(+)
 create mode 100644 drivers/staging/mt7621-pinctrl/Kconfig
 create mode 100644 drivers/staging/mt7621-pinctrl/Makefile
 create mode 100644 drivers/staging/mt7621-pinctrl/TODO
 create mode 100644 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index e95ab683331e..cdd04c8b4445 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -122,4 +122,6 @@ source "drivers/staging/vboxvideo/Kconfig"
 
 source "drivers/staging/pi433/Kconfig"
 
+source "drivers/staging/mt7621-pinctrl/Kconfig"
+
 endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 4e79a4ad6cf6..db90d85a80d3 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -53,3 +53,4 @@ obj-$(CONFIG_CRYPTO_DEV_CCREE)+= ccree/
 obj-$(CONFIG_DRM_VBOXVIDEO)+= vboxvideo/
 obj-$(CONFIG_PI433)+= pi433/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-pci/
+obj-$(CONFIG_SOC_MT7621)   += mt7621-pinctrl/
diff --git a/drivers/staging/mt7621-pinctrl/Kconfig 
b/drivers/staging/mt7621-pinctrl/Kconfig
new file mode 100644
index ..37cf9c3273be
--- /dev/null
+++ b/drivers/staging/mt7621-pinctrl/Kconfig
@@ -0,0 +1,4 @@
+config PINCTRL_RT2880
+   bool "RT2800 pinctrl driver for RALINK/Mediatek SOCs"
+   depends on RALINK
+   select PINMUX
diff --git a/drivers/staging/mt7621-pinctrl/Makefile 
b/drivers/staging/mt7621-pinctrl/Makefile
new file mode 100644
index ..856102137a1e
--- /dev/null
+++ b/drivers/staging/mt7621-pinctrl/Makefile
@@ -0,0 +1,3 @@
+obj-$(CONFIG_PINCTRL_RT2880)   += pinctrl-rt2880.o
+
+ccflags-y += -I$(srctree)/drivers/pinctrl
diff --git a/drivers/staging/mt7621-pinctrl/TODO 
b/drivers/staging/mt7621-pinctrl/TODO
new file mode 100644
index ..b2c235a16d5c
--- /dev/null
+++ b/drivers/staging/mt7621-pinctrl/TODO
@@ -0,0 +1,6 @@
+
+- general code review and cleanup
+- should probably be always selected by 'config RALINK'
+- ensure device-tree requirements are documented
+
+Cc: NeilBrown 
diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
new file mode 100644
index ..3d2d1c2a006f
--- /dev/null
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -0,0 +1,472 @@
+/*
+ *  linux/drivers/pinctrl/pinctrl-rt2880.c
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  publishhed by the Free Software Foundation.
+ *
+ *  Copyright (C) 2013 John Crispin 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "core.h"
+
+#define SYSC_REG_GPIO_MODE 0x60
+#define SYSC_REG_GPIO_MODE20x64
+
+struct rt2880_priv {
+   struct device *dev;
+
+   struct pinctrl_pin_desc *pads;
+   struct pinctrl_desc *desc;
+
+   struct rt2880_pmx_func **func;
+   int func_count;
+
+   struct rt2880_pmx_group *groups;
+   const char **group_names;
+   int group_count;
+
+   uint8_t *gpio;
+   int max_pins;
+};
+
+static int rt2880_get_group_count(struct pinctrl_dev *pctrldev)
+{
+   struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev);
+
+   return p->group_count;
+}
+
+static const char *rt2880_get_group_name(struct pinctrl_dev *pctrldev,
+unsigned group)
+{
+   struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev);
+
+   if (group >= p->group_count)
+   return NULL;
+
+   return p->group_names[group];
+}
+
+static int rt2880_get_group_pins(struct pinctrl_dev *pctrldev,
+unsigned group,
+const unsigned **pins,
+unsigned *num_pins)
+{
+   struct rt2880_priv *p = pinctrl_dev_get_drvdata(pctrldev);
+
+   if (group >= p->group_count)
+   return -EINVAL;
+
+   *pins = p->groups[group].func[0].pins;
+   *num_pins = p->groups[group].func[0].pin_count;
+
+   return 0;
+}
+
+static void rt2880_pinctrl_dt_free_map(struct pinctrl_dev *pctrldev,
+   struct pinctrl_map *map, unsigned num_maps)
+{
+   int i;
+
+   for (i = 0; i < num_maps; i++)
+   if (map[i].type 

[PATCH 04/13] staging: mt7621-spi: add mt7621 support

2018-03-14 Thread NeilBrown
From: John Crispin 

NeilBrown:
The code will fail with a warning if asked to transfer
more than 32 bytes at a time.  So used max_transfer_size
interface to tell users about this.

Signed-off-by: John Crispin 
Signed-off-by: NeilBrown 
---
 drivers/staging/Kconfig |2 
 drivers/staging/Makefile|1 
 drivers/staging/mt7621-spi/Kconfig  |6 
 drivers/staging/mt7621-spi/Makefile |1 
 drivers/staging/mt7621-spi/TODO |5 
 drivers/staging/mt7621-spi/spi-mt7621.c |  489 +++
 6 files changed, 504 insertions(+)
 create mode 100644 drivers/staging/mt7621-spi/Kconfig
 create mode 100644 drivers/staging/mt7621-spi/Makefile
 create mode 100644 drivers/staging/mt7621-spi/TODO
 create mode 100644 drivers/staging/mt7621-spi/spi-mt7621.c

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 7568e10399fa..bcc6da1f656a 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -126,4 +126,6 @@ source "drivers/staging/mt7621-pinctrl/Kconfig"
 
 source "drivers/staging/mt7621-gpio/Kconfig"
 
+source "drivers/staging/mt7621-spi/Kconfig"
+
 endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 609fdb218985..051af9965549 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -55,3 +55,4 @@ obj-$(CONFIG_PI433)   += pi433/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-pci/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-pinctrl/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-gpio/
+obj-$(CONFIG_SOC_MT7621)   += mt7621-spi/
diff --git a/drivers/staging/mt7621-spi/Kconfig 
b/drivers/staging/mt7621-spi/Kconfig
new file mode 100644
index ..0b90f4cfa426
--- /dev/null
+++ b/drivers/staging/mt7621-spi/Kconfig
@@ -0,0 +1,6 @@
+config SPI_MT7621
+   tristate "MediaTek MT7621 SPI Controller"
+   depends on RALINK
+   help
+ This selects a driver for the MediaTek MT7621 SPI Controller.
+
diff --git a/drivers/staging/mt7621-spi/Makefile 
b/drivers/staging/mt7621-spi/Makefile
new file mode 100644
index ..3be508f63bac
--- /dev/null
+++ b/drivers/staging/mt7621-spi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SPI_MT7621)   += spi-mt7621.o
diff --git a/drivers/staging/mt7621-spi/TODO b/drivers/staging/mt7621-spi/TODO
new file mode 100644
index ..fdbc5002c32a
--- /dev/null
+++ b/drivers/staging/mt7621-spi/TODO
@@ -0,0 +1,5 @@
+
+- general code review and clean up
+- ensure device-tree requirements are documented
+
+Cc: NeilBrown 
diff --git a/drivers/staging/mt7621-spi/spi-mt7621.c 
b/drivers/staging/mt7621-spi/spi-mt7621.c
new file mode 100644
index ..d95e0b32f1f0
--- /dev/null
+++ b/drivers/staging/mt7621-spi/spi-mt7621.c
@@ -0,0 +1,489 @@
+/*
+ * spi-mt7621.c -- MediaTek MT7621 SPI controller driver
+ *
+ * Copyright (C) 2011 Sergiy 
+ * Copyright (C) 2011-2013 Gabor Juhos 
+ * Copyright (C) 2014-2015 Felix Fietkau 
+ *
+ * Some parts are based on spi-orion.c:
+ *   Author: Shadi Ammouri 
+ *   Copyright (C) 2007-2008 Marvell Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define SPI_BPW_MASK(bits) BIT((bits) - 1)
+
+#define DRIVER_NAME"spi-mt7621"
+/* in usec */
+#define RALINK_SPI_WAIT_MAX_LOOP   2000
+
+/* SPISTAT register bit field */
+#define SPISTAT_BUSY   BIT(0)
+
+#define MT7621_SPI_TRANS   0x00
+#define SPITRANS_BUSY  BIT(16)
+
+#define MT7621_SPI_OPCODE  0x04
+#define MT7621_SPI_DATA0   0x08
+#define MT7621_SPI_DATA4   0x18
+#define SPI_CTL_TX_RX_CNT_MASK 0xff
+#define SPI_CTL_START  BIT(8)
+
+#define MT7621_SPI_POLAR   0x38
+#define MT7621_SPI_MASTER  0x28
+#define MT7621_SPI_MOREBUF 0x2c
+#define MT7621_SPI_SPACE   0x3c
+
+#define MT7621_CPHABIT(5)
+#define MT7621_CPOLBIT(4)
+#define MT7621_LSB_FIRST   BIT(3)
+
+#define RT2880_SPI_MODE_BITS   (SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST | 
SPI_CS_HIGH)
+
+struct mt7621_spi;
+
+struct mt7621_spi {
+   struct spi_master   *master;
+   void __iomem*base;
+   unsigned intsys_freq;
+   unsigned intspeed;
+   struct clk  *clk;
+   spinlock_t  lock;
+
+   struct mt7621_spi_ops   *ops;
+};
+
+static inline struct mt7621_spi *spidev_to_mt7621_spi(struct spi_device *spi)
+{
+   return spi_master_get_devdata(spi->master);
+}
+
+static inline u32 mt7621_spi_read(struct mt7621_spi *rs, u32 reg)
+{
+   return 

[PATCH 07/13] staging: mt7621-eth: Document ralink/mediatek SoC ethernet binding

2018-03-14 Thread NeilBrown
From: John Crispin 

Add possible dt binding for mediatek gigabit switches.

Signed-off-by: John Crispin 
Signed-off-by: Felix Fietkau 
Signed-off-by: Michael Lee 
Cc: devicet...@vger.kernel.org
Signed-off-by: NeilBrown 
---
 .../devicetree/bindings/net/mediatek-net-gsw.txt   |   48 
 drivers/staging/mt7621-eth/TODO|4 ++
 2 files changed, 52 insertions(+)
 create mode 100644 
drivers/staging/mt7621-eth/Documentation/devicetree/bindings/net/mediatek-net-gsw.txt
 create mode 100644 drivers/staging/mt7621-eth/TODO

diff --git 
a/drivers/staging/mt7621-eth/Documentation/devicetree/bindings/net/mediatek-net-gsw.txt
 
b/drivers/staging/mt7621-eth/Documentation/devicetree/bindings/net/mediatek-net-gsw.txt
new file mode 100644
index ..596b38552697
--- /dev/null
+++ 
b/drivers/staging/mt7621-eth/Documentation/devicetree/bindings/net/mediatek-net-gsw.txt
@@ -0,0 +1,48 @@
+Mediatek Gigabit Switch
+===
+
+The mediatek gigabit switch can be found on Mediatek SoCs.
+
+Required properties:
+- compatible: Should be "mediatek,mt7620-gsw", "mediatek,mt7621-gsw",
+  "mediatek,mt7623-gsw"
+- reg: Address and length of the register set for the device
+- interrupts: Should contain the gigabit switches interrupt
+
+
+Additional required properties for ARM based SoCs:
+- mediatek,reset-pin: phandle describing the reset GPIO
+- clocks: the clocks used by the switch
+- clock-names: the names of the clocks listed in the clocks property
+  these should be "trgpll", "esw", "gp2", "gp1"
+- mt7530-supply: the phandle of the regulator used to power the switch
+- mediatek,pctl-regmap: phandle to the port control regmap. this is used to
+  setup the drive current
+
+
+Optional properties:
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+
+Example:
+
+gsw: switch@1b10 {
+   compatible = "mediatek,mt7623-gsw";
+   reg = <0 0x1b11 0 0x30>;
+
+   interrupt-parent = <>;
+   interrupts = <168 IRQ_TYPE_EDGE_RISING>;
+
+   clocks = < CLK_APMIXED_TRGPLL>,
+< CLK_ETHSYS_ESW>,
+< CLK_ETHSYS_GP2>,
+< CLK_ETHSYS_GP1>;
+   clock-names = "trgpll", "esw", "gp2", "gp1";
+
+   mt7530-supply = <_vpa_reg>;
+
+   mediatek,pctl-regmap = <_pctl_a>;
+   mediatek,reset-pin = < 15 0>;
+
+   status = "okay";
+};
diff --git a/drivers/staging/mt7621-eth/TODO b/drivers/staging/mt7621-eth/TODO
new file mode 100644
index ..5f269af0db5c
--- /dev/null
+++ b/drivers/staging/mt7621-eth/TODO
@@ -0,0 +1,4 @@
+
+- verify devicetree documentation is consistent with code
+
+Cc: NeilBrown 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/13] staging: mt7621-gpio: ralink: add mt7621 gpio controller

2018-03-14 Thread NeilBrown
From: John Crispin 

Signed-off-by: John Crispin 
Signed-off-by: NeilBrown 
---
 drivers/staging/Kconfig   |2 
 drivers/staging/Makefile  |1 
 drivers/staging/mt7621-gpio/Kconfig   |6 
 drivers/staging/mt7621-gpio/Makefile  |3 
 drivers/staging/mt7621-gpio/TODO  |5 
 drivers/staging/mt7621-gpio/gpio-mt7621.c |  353 +
 6 files changed, 370 insertions(+)
 create mode 100644 drivers/staging/mt7621-gpio/Kconfig
 create mode 100644 drivers/staging/mt7621-gpio/Makefile
 create mode 100644 drivers/staging/mt7621-gpio/TODO
 create mode 100644 drivers/staging/mt7621-gpio/gpio-mt7621.c

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index cdd04c8b4445..7568e10399fa 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -124,4 +124,6 @@ source "drivers/staging/pi433/Kconfig"
 
 source "drivers/staging/mt7621-pinctrl/Kconfig"
 
+source "drivers/staging/mt7621-gpio/Kconfig"
+
 endif # STAGING
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index db90d85a80d3..609fdb218985 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -54,3 +54,4 @@ obj-$(CONFIG_DRM_VBOXVIDEO)   += vboxvideo/
 obj-$(CONFIG_PI433)+= pi433/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-pci/
 obj-$(CONFIG_SOC_MT7621)   += mt7621-pinctrl/
+obj-$(CONFIG_SOC_MT7621)   += mt7621-gpio/
diff --git a/drivers/staging/mt7621-gpio/Kconfig 
b/drivers/staging/mt7621-gpio/Kconfig
new file mode 100644
index ..c741ec3f4e50
--- /dev/null
+++ b/drivers/staging/mt7621-gpio/Kconfig
@@ -0,0 +1,6 @@
+config GPIO_MT7621
+   bool "Mediatek GPIO Support"
+   depends on SOC_MT7620 || SOC_MT7621
+   select ARCH_REQUIRE_GPIOLIB
+   help
+ Say yes here to support the Mediatek SoC GPIO device
diff --git a/drivers/staging/mt7621-gpio/Makefile 
b/drivers/staging/mt7621-gpio/Makefile
new file mode 100644
index ..e269ab1b8717
--- /dev/null
+++ b/drivers/staging/mt7621-gpio/Makefile
@@ -0,0 +1,3 @@
+obj-$(CONFIG_GPIO_MT7621)  += gpio-mt7621.o
+
+ccflags-y += -I$(srctree)/$(src)/include
diff --git a/drivers/staging/mt7621-gpio/TODO b/drivers/staging/mt7621-gpio/TODO
new file mode 100644
index ..71439054e2e4
--- /dev/null
+++ b/drivers/staging/mt7621-gpio/TODO
@@ -0,0 +1,5 @@
+
+- general code review and clean up
+- ensure device-tree requirements are documented
+
+Cc:  NeilBrown 
diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
new file mode 100644
index ..5c57abea853f
--- /dev/null
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -0,0 +1,353 @@
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Copyright (C) 2009-2011 Gabor Juhos 
+ * Copyright (C) 2013 John Crispin 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MTK_MAX_BANK   3
+#define MTK_BANK_WIDTH 32
+
+enum mediatek_gpio_reg {
+   GPIO_REG_CTRL = 0,
+   GPIO_REG_POL,
+   GPIO_REG_DATA,
+   GPIO_REG_DSET,
+   GPIO_REG_DCLR,
+   GPIO_REG_REDGE,
+   GPIO_REG_FEDGE,
+   GPIO_REG_HLVL,
+   GPIO_REG_LLVL,
+   GPIO_REG_STAT,
+   GPIO_REG_EDGE,
+};
+
+static void __iomem *mediatek_gpio_membase;
+static int mediatek_gpio_irq;
+static struct irq_domain *mediatek_gpio_irq_domain;
+
+struct mtk_gc {
+   struct gpio_chip chip;
+   spinlock_t lock;
+   int bank;
+   u32 rising;
+   u32 falling;
+} *gc_map[MTK_MAX_BANK];
+
+static inline struct mtk_gc
+*to_mediatek_gpio(struct gpio_chip *chip)
+{
+   struct mtk_gc *mgc;
+
+   mgc = container_of(chip, struct mtk_gc, chip);
+
+   return mgc;
+}
+
+static inline void
+mtk_gpio_w32(struct mtk_gc *rg, u8 reg, u32 val)
+{
+   iowrite32(val, mediatek_gpio_membase + (reg * 0x10) + (rg->bank * 0x4));
+}
+
+static inline u32
+mtk_gpio_r32(struct mtk_gc *rg, u8 reg)
+{
+   return ioread32(mediatek_gpio_membase + (reg * 0x10) + (rg->bank * 
0x4));
+}
+
+static void
+mediatek_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+{
+   struct mtk_gc *rg = to_mediatek_gpio(chip);
+
+   mtk_gpio_w32(rg, (value) ? GPIO_REG_DSET : GPIO_REG_DCLR, BIT(offset));
+}
+
+static int
+mediatek_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+   struct mtk_gc *rg = to_mediatek_gpio(chip);
+
+   return !!(mtk_gpio_r32(rg, GPIO_REG_DATA) & BIT(offset));
+}
+
+static int
+mediatek_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
+{
+   struct mtk_gc *rg = to_mediatek_gpio(chip);
+   unsigned long flags;
+   u32 t;
+
+   

Re: [PATCH 47/47] staging: iio: remove iio-trig-bfin-timer driver

2018-03-14 Thread Arnd Bergmann
On Wed, Mar 14, 2018 at 6:06 PM, Jonathan Cameron
 wrote:
> On Wed, 14 Mar 2018 17:32:07 +0100
> Greg Kroah-Hartman  wrote:
>> On Wed, Mar 14, 2018 at 04:36:00PM +0100, Arnd Bergmann wrote:
>> > I'm not sure about the other staging iio drivers though: almost
>> > all of them are for Analog Devices devices like this one. They
>> > are likely used along with blackfin SoCs, but could easily be
>> > used on any others as well.
>> >
>> > It might be time to consider whether they should be removed, but
>> > it doesn't feel like a decision that I should be making.
>>
>> The IIO driver maintainer/developers are talking about that currently, I
>> think they have a plan for those other drivers.
>
> Some of the drivers are under consideration for removal (particularly most
> of the meter drivers) but it is unconnected to the blackfin removal.
> They are simply other obsolete parts that we don't have test hardware
> for and need sufficient 'surgery' that we wouldn't feel comfortable
> cleaning them up without.  One has been reprieved as a user, who was
> happy to test, came forward when I announced the intent to remove them.

Ok, thanks for the clarification. I'll just drop my comment then, as you
clearly have this under control

>> > Signed-off-by: Arnd Bergmann 
>>
>> Acked-by: Greg Kroah-Hartman 
> Acked-by: Jonathan Cameron 

Thanks,

  Arnd
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: fsl-dpaa2/eth: Fix incorrect kfree

2018-03-14 Thread Ioana Radulescu
Use netdev_alloc_frag() instead of kmalloc to allocate space for
the S/G table of egress multi-buffer frames.

This fixes a bug where an unaligned pointer received from the
allocator would be overwritten with the 64B aligned value,
leading to a wrong address being later passed to kfree.

Signed-off-by: Ioana Radulescu 
Reported-by: Dan Carpenter 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
index c81a01f..f013af6 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
@@ -374,12 +374,14 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv,
/* Prepare the HW SGT structure */
sgt_buf_size = priv->tx_data_offset +
   sizeof(struct dpaa2_sg_entry) * (1 + num_dma_bufs);
-   sgt_buf = kzalloc(sgt_buf_size + DPAA2_ETH_TX_BUF_ALIGN, GFP_ATOMIC);
+   sgt_buf = netdev_alloc_frag(sgt_buf_size + DPAA2_ETH_TX_BUF_ALIGN);
if (unlikely(!sgt_buf)) {
err = -ENOMEM;
goto sgt_buf_alloc_failed;
}
sgt_buf = PTR_ALIGN(sgt_buf, DPAA2_ETH_TX_BUF_ALIGN);
+   memset(sgt_buf, 0, sgt_buf_size);
+
sgt = (struct dpaa2_sg_entry *)(sgt_buf + priv->tx_data_offset);
 
/* Fill in the HW SGT structure.
@@ -421,7 +423,7 @@ static int build_sg_fd(struct dpaa2_eth_priv *priv,
return 0;
 
 dma_map_single_failed:
-   kfree(sgt_buf);
+   skb_free_frag(sgt_buf);
 sgt_buf_alloc_failed:
dma_unmap_sg(dev, scl, num_sg, DMA_BIDIRECTIONAL);
 dma_map_sg_failed:
@@ -525,9 +527,9 @@ static void free_tx_fd(const struct dpaa2_eth_priv *priv,
return;
}
 
-   /* Free SGT buffer kmalloc'ed on tx */
+   /* Free SGT buffer allocated on tx */
if (fd_format != dpaa2_fd_single)
-   kfree(skbh);
+   skb_free_frag(skbh);
 
/* Move on with skb release */
dev_kfree_skb(skb);
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v2]PCI: hv: fix PCI-BUS domainID corruption

2018-03-14 Thread Michael Kelley (EOSG)
> -Original Message-
> From: Sridhar Pitchai
> Sent: Wednesday, March 14, 2018 11:08 AM
> To: Lorenzo Pieralisi ; Michael Kelley (EOSG)
> 
> Cc: Bjorn Helgaas ; Jake Oshins ; 
> Haiyang
> Zhang ; Stephen Hemminger ; 
> Dexuan
> Cui ; KY Srinivasan ;
> de...@linuxdriverproject.org; linux-...@vger.kernel.org; 
> linux-ker...@vger.kernel.org
> Subject: [PATCH v2]PCI: hv: fix PCI-BUS domainID corruption
> 
> Whenever PCI bus is added, HyperV guarantees the BUS id is unique. Even 
> with
> that when a first device is added to the bus, it overrides bus domain ID 
> with
> the device serial number. Sometime this can result in BUS ID not being 
> unique.
> In this case, when PCI_BUS and a device added to the bus, even before the 
> PCI
> BUS is added to kernel, the first device tends to overwrite the domain ID 
> with
> 0. Since there exists a PCI bus with domain ID 0 already the PCI bus 
> addition
> fails. This patch make sure when a device is added to a bus, it never 
> updated
> the bus domain ID. Since we have the transparent SRIOV mode now, the 
> short VF
> device name is no longer needed.
> 
> Fixes: 4a9b0933bdfc("PCI:hv:Use device serial number as PCI domain")
> Cc: sta...@vger.kernel.org
> Signed-off-by: Sridhar Pitchai 
> ---

Reviewed-by: Michael Kelley 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 7/7] staging:iio:ade7854: Add proper error handling condition

2018-03-14 Thread Rodrigo Siqueira
There is some improper error handling for IRQ and device register.  This
patch adds a proper verification. The IRQ correction was extracted from
John Syne patches.

Signed-off-by: Rodrigo Siqueira 
Signed-off-by: John Syne 
---
 drivers/staging/iio/meter/ade7854.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854.c 
b/drivers/staging/iio/meter/ade7854.c
index 09fd8c067738..49cbe365e43d 100644
--- a/drivers/staging/iio/meter/ade7854.c
+++ b/drivers/staging/iio/meter/ade7854.c
@@ -436,7 +436,7 @@ static int ade7854_initial_setup(struct iio_dev *indio_dev)
 
/* Disable IRQ */
ret = ade7854_set_irq(dev, false);
-   if (ret) {
+   if (ret < 0) {
dev_err(dev, "disable irq failed");
goto err_ret;
}
@@ -544,7 +544,7 @@ int ade7854_probe(struct iio_dev *indio_dev, struct device 
*dev)
indio_dev->modes = INDIO_DIRECT_MODE;
 
ret = devm_iio_device_register(dev, indio_dev);
-   if (ret)
+   if (ret < 0)
return ret;
 
/* Get the device into a sane initial state */
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/7] staging:iio:ade7854: Remove read_reg_* duplications

2018-03-14 Thread Rodrigo Siqueira
The original code had a read function per data size; after updates, all
read functions tasks were centralized in a single function, but the old
signature was kept to maintain the module working without problems. This
patch removes a set of duplications associated with read_reg_*, and
update the areas that calling the old interface by the new one. During
the update for use a single function, some errors handlings were updated
based on the John Syne patches.

Signed-off-by: Rodrigo Siqueira 
Signed-off-by: John Syne 
---
 drivers/staging/iio/meter/ade7854-i2c.c | 53 +--
 drivers/staging/iio/meter/ade7854-spi.c | 55 ++---
 drivers/staging/iio/meter/ade7854.c | 28 -
 drivers/staging/iio/meter/ade7854.h |  7 ++---
 4 files changed, 20 insertions(+), 123 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854-i2c.c 
b/drivers/staging/iio/meter/ade7854-i2c.c
index 845f8c348945..fc1ff08dc2d3 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -110,54 +110,6 @@ static int ade7854_i2c_read_reg(struct device *dev,
return ret;
 }
 
-static int ade7854_i2c_read_reg_8(struct device *dev,
- u16 reg_address,
- u8 *val)
-{
-   int ret;
-
-   ret = ade7854_i2c_read_reg(dev, reg_address, (u32 *)val,
-  DATA_SIZE_8_BITS);
-
-   return ret;
-}
-
-static int ade7854_i2c_read_reg_16(struct device *dev,
-  u16 reg_address,
-  u16 *val)
-{
-   int ret;
-
-   ret = ade7854_i2c_read_reg(dev, reg_address, (u32 *)val,
-  DATA_SIZE_16_BITS);
-
-   return ret;
-}
-
-static int ade7854_i2c_read_reg_24(struct device *dev,
-  u16 reg_address,
-  u32 *val)
-{
-   int ret;
-
-   ret = ade7854_i2c_read_reg(dev, reg_address, (u32 *)val,
-  DATA_SIZE_24_BITS);
-
-   return ret;
-}
-
-static int ade7854_i2c_read_reg_32(struct device *dev,
-  u16 reg_address,
-  u32 *val)
-{
-   int ret;
-
-   ret = ade7854_i2c_read_reg(dev, reg_address, (u32 *)val,
-  DATA_SIZE_32_BITS);
-
-   return ret;
-}
-
 static int ade7854_i2c_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
 {
@@ -169,10 +121,7 @@ static int ade7854_i2c_probe(struct i2c_client *client,
return -ENOMEM;
st = iio_priv(indio_dev);
i2c_set_clientdata(client, indio_dev);
-   st->read_reg_8 = ade7854_i2c_read_reg_8;
-   st->read_reg_16 = ade7854_i2c_read_reg_16;
-   st->read_reg_24 = ade7854_i2c_read_reg_24;
-   st->read_reg_32 = ade7854_i2c_read_reg_32;
+   st->read_reg = ade7854_i2c_read_reg;
st->write_reg = ade7854_i2c_write_reg;
st->i2c = client;
st->irq = client->irq;
diff --git a/drivers/staging/iio/meter/ade7854-spi.c 
b/drivers/staging/iio/meter/ade7854-spi.c
index 0feef24aa888..5711f9ff822e 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -94,7 +94,7 @@ static int ade7854_spi_read_reg(struct device *dev,
st->tx[2] = reg_address & 0xFF;
 
ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers));
-   if (ret) {
+   if (ret < 0) {
dev_err(>spi->dev, "problem when reading register 0x%02X",
reg_address);
goto error_spi_read_unlock;
@@ -120,54 +120,6 @@ static int ade7854_spi_read_reg(struct device *dev,
return ret;
 }
 
-static int ade7854_spi_read_reg_8(struct device *dev,
- u16 reg_address,
- u8 *val)
-{
-   int ret;
-
-   ret = ade7854_spi_read_reg(dev, reg_address, (u32 *)val,
-  DATA_SIZE_8_BITS);
-
-   return ret;
-}
-
-static int ade7854_spi_read_reg_16(struct device *dev,
-  u16 reg_address,
-  u16 *val)
-{
-   int ret;
-
-   ret = ade7854_spi_read_reg(dev, reg_address, (u32 *)val,
-  DATA_SIZE_16_BITS);
-
-   return ret;
-}
-
-static int ade7854_spi_read_reg_24(struct device *dev,
-  u16 reg_address,
-  u32 *val)
-{
-   int ret;
-
-   ret = ade7854_spi_read_reg(dev, reg_address, (u32 *)val,
-  DATA_SIZE_24_BITS);
-
-   return ret;
-}
-
-static int ade7854_spi_read_reg_32(struct device *dev,
-  u16 reg_address,
-  u32 *val)
-{
- 

[PATCH 5/7] staging:iio:ade7854: Rework SPI read function

2018-03-14 Thread Rodrigo Siqueira
Rework read SPI function to reduce the code duplication and centralizes
all the task in a single function.

Signed-off-by: Rodrigo Siqueira 
---
 drivers/staging/iio/meter/ade7854-spi.c | 132 ++--
 1 file changed, 41 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854-spi.c 
b/drivers/staging/iio/meter/ade7854-spi.c
index df3df85f9440..0feef24aa888 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -67,9 +67,10 @@ static int ade7854_spi_write_reg(struct device *dev,
return ret;
 }
 
-static int ade7854_spi_read_reg_8(struct device *dev,
- u16 reg_address,
- u8 *val)
+static int ade7854_spi_read_reg(struct device *dev,
+   u16 reg_address,
+   u32 *val,
+   enum data_size type)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7854_state *st = iio_priv(indio_dev);
@@ -82,7 +83,7 @@ static int ade7854_spi_read_reg_8(struct device *dev,
}, {
.rx_buf = st->rx,
.bits_per_word = 8,
-   .len = 1,
+   .len = type,
}
};
 
@@ -94,51 +95,52 @@ static int ade7854_spi_read_reg_8(struct device *dev,
 
ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers));
if (ret) {
-   dev_err(>spi->dev, "problem when reading 8 bit register 
0x%02X",
+   dev_err(>spi->dev, "problem when reading register 0x%02X",
reg_address);
-   goto error_ret;
+   goto error_spi_read_unlock;
+   }
+
+   switch (type) {
+   case DATA_SIZE_8_BITS:
+   *val = st->rx[0];
+   break;
+   case DATA_SIZE_16_BITS:
+   *val = be16_to_cpup((const __be16 *)st->rx);
+   break;
+   case DATA_SIZE_24_BITS:
+   *val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2];
+   break;
+   case DATA_SIZE_32_BITS:
+   *val = be32_to_cpup((const __be32 *)st->rx);
+   break;
}
-   *val = st->rx[0];
 
-error_ret:
+error_spi_read_unlock:
mutex_unlock(>buf_lock);
return ret;
 }
 
+static int ade7854_spi_read_reg_8(struct device *dev,
+ u16 reg_address,
+ u8 *val)
+{
+   int ret;
+
+   ret = ade7854_spi_read_reg(dev, reg_address, (u32 *)val,
+  DATA_SIZE_8_BITS);
+
+   return ret;
+}
+
 static int ade7854_spi_read_reg_16(struct device *dev,
   u16 reg_address,
   u16 *val)
 {
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
int ret;
-   struct spi_transfer xfers[] = {
-   {
-   .tx_buf = st->tx,
-   .bits_per_word = 8,
-   .len = 3,
-   }, {
-   .rx_buf = st->rx,
-   .bits_per_word = 8,
-   .len = 2,
-   }
-   };
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = ADE7854_READ_REG;
-   st->tx[1] = (reg_address >> 8) & 0xFF;
-   st->tx[2] = reg_address & 0xFF;
+   ret = ade7854_spi_read_reg(dev, reg_address, (u32 *)val,
+  DATA_SIZE_16_BITS);
 
-   ret = spi_sync_transfer(st->spi, xfers, ARRAY_SIZE(xfers));
-   if (ret) {
-   dev_err(>spi->dev, "problem when reading 16 bit register 
0x%02X",
-   reg_address);
-   goto error_ret;
-   }
-   *val = be16_to_cpup((const __be16 *)st->rx);
-
-error_ret:
-   mutex_unlock(>buf_lock);
return ret;
 }
 
@@ -146,37 +148,11 @@ static int ade7854_spi_read_reg_24(struct device *dev,
   u16 reg_address,
   u32 *val)
 {
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
int ret;
-   struct spi_transfer xfers[] = {
-   {
-   .tx_buf = st->tx,
-   .bits_per_word = 8,
-   .len = 3,
-   }, {
-   .rx_buf = st->rx,
-   .bits_per_word = 8,
-   .len = 3,
-   }
-   };
 
-   mutex_lock(>buf_lock);
-
-   st->tx[0] = ADE7854_READ_REG;
-   st->tx[1] = (reg_address >> 8) & 0xFF;
-   st->tx[2] = reg_address & 0xFF;
+   ret = ade7854_spi_read_reg(dev, reg_address, (u32 *)val,
+  DATA_SIZE_24_BITS);
 
-   ret = 

[PATCH 3/7] staging:iio:ade7854: Replace many functions for one function

2018-03-14 Thread Rodrigo Siqueira
This patch removes code duplications related to the write_reg_*
functions and centralizes them in a single function. Also, it eliminates
the legacy functions and replaces them by a unique signature that is
used by SPI and I2C.

Signed-off-by: Rodrigo Siqueira 
---
 drivers/staging/iio/meter/ade7854-i2c.c | 50 +
 drivers/staging/iio/meter/ade7854-spi.c | 49 +---
 drivers/staging/iio/meter/ade7854.c | 12 
 drivers/staging/iio/meter/ade7854.h |  9 +++---
 4 files changed, 12 insertions(+), 108 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854-i2c.c 
b/drivers/staging/iio/meter/ade7854-i2c.c
index 03133a05eae4..f302359d2265 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -65,51 +65,6 @@ static int ade7854_i2c_write_reg(struct device *dev,
return ret;
 }
 
-static int ade7854_i2c_write_reg_8(struct device *dev,
-  u16 reg_address,
-  u8 val)
-{
-   int ret;
-
-   ret = ade7854_i2c_write_reg(dev, reg_address, val, DATA_SIZE_8_BITS);
-
-   return ret;
-}
-
-static int ade7854_i2c_write_reg_16(struct device *dev,
-   u16 reg_address,
-   u16 val)
-{
-   int ret;
-
-   ret = ade7854_i2c_write_reg(dev, reg_address, val, DATA_SIZE_16_BITS);
-
-   return ret;
-}
-
-static int ade7854_i2c_write_reg_24(struct device *dev,
-   u16 reg_address,
-   u32 val)
-{
-   int ret;
-
-   ret = ade7854_i2c_write_reg(dev, reg_address, val, DATA_SIZE_24_BITS);
-
-   return ret;
-}
-
-static int ade7854_i2c_write_reg_32(struct device *dev,
-   u16 reg_address,
-   u32 val)
-{
-   int ret;
-
-   ret = ade7854_i2c_write_reg(dev, reg_address, val, DATA_SIZE_32_BITS);
-
-   return ret;
-}
-
-
 static int ade7854_i2c_read_reg_8(struct device *dev,
  u16 reg_address,
  u8 *val)
@@ -230,10 +185,7 @@ static int ade7854_i2c_probe(struct i2c_client *client,
st->read_reg_16 = ade7854_i2c_read_reg_16;
st->read_reg_24 = ade7854_i2c_read_reg_24;
st->read_reg_32 = ade7854_i2c_read_reg_32;
-   st->write_reg_8 = ade7854_i2c_write_reg_8;
-   st->write_reg_16 = ade7854_i2c_write_reg_16;
-   st->write_reg_24 = ade7854_i2c_write_reg_24;
-   st->write_reg_32 = ade7854_i2c_write_reg_32;
+   st->write_reg = ade7854_i2c_write_reg;
st->i2c = client;
st->irq = client->irq;
 
diff --git a/drivers/staging/iio/meter/ade7854-spi.c 
b/drivers/staging/iio/meter/ade7854-spi.c
index 0dae118428cf..df3df85f9440 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -67,50 +67,6 @@ static int ade7854_spi_write_reg(struct device *dev,
return ret;
 }
 
-static int ade7854_spi_write_reg_8(struct device *dev,
-  u16 reg_address,
-  u8 val)
-{
-   int ret;
-
-   ret = ade7854_spi_write_reg(dev, reg_address, val, DATA_SIZE_8_BITS);
-
-   return ret;
-}
-
-static int ade7854_spi_write_reg_16(struct device *dev,
-   u16 reg_address,
-   u16 val)
-{
-   int ret;
-
-   ret = ade7854_spi_write_reg(dev, reg_address, val, DATA_SIZE_16_BITS);
-
-   return ret;
-}
-
-static int ade7854_spi_write_reg_24(struct device *dev,
-   u16 reg_address,
-   u32 val)
-{
-   int ret;
-
-   ret = ade7854_spi_write_reg(dev, reg_address, val, DATA_SIZE_24_BITS);
-
-   return ret;
-}
-
-static int ade7854_spi_write_reg_32(struct device *dev,
-   u16 reg_address,
-   u32 val)
-{
-   int ret;
-
-   ret = ade7854_spi_write_reg(dev, reg_address, val, DATA_SIZE_32_BITS);
-
-   return ret;
-}
-
 static int ade7854_spi_read_reg_8(struct device *dev,
  u16 reg_address,
  u8 *val)
@@ -276,10 +232,7 @@ static int ade7854_spi_probe(struct spi_device *spi)
st->read_reg_16 = ade7854_spi_read_reg_16;
st->read_reg_24 = ade7854_spi_read_reg_24;
st->read_reg_32 = ade7854_spi_read_reg_32;
-   st->write_reg_8 = ade7854_spi_write_reg_8;
-   st->write_reg_16 = ade7854_spi_write_reg_16;
-   st->write_reg_24 = ade7854_spi_write_reg_24;
-   st->write_reg_32 = ade7854_spi_write_reg_32;
+   st->write_reg = ade7854_spi_write_reg;
st->irq = spi->irq;
st->spi = spi;
 
diff --git a/drivers/staging/iio/meter/ade7854.c 
b/drivers/staging/iio/meter/ade7854.c
index 

[PATCH 4/7] staging:iio:ade7854: Rework I2C read function

2018-03-14 Thread Rodrigo Siqueira
The read operation for the I2C function has many duplications that can
be generalized into a single function. This patch reworks the read
operation for I2C to centralizes all similar code in a single function.
Part of the rework includes a proper error handling and a fix on the
i2c_master_recv for 32 bits as pointed by John Syne patches.

It is possible to remove all the old interface to use the new one,
however, for keeping the things simple and working this patch maintain
legacy interface.

Signed-off-by: Rodrigo Siqueira 
Signed-off-by: John Syne 
---
 drivers/staging/iio/meter/ade7854-i2c.c | 106 ++--
 1 file changed, 47 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854-i2c.c 
b/drivers/staging/iio/meter/ade7854-i2c.c
index f302359d2265..845f8c348945 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -65,9 +65,10 @@ static int ade7854_i2c_write_reg(struct device *dev,
return ret;
 }
 
-static int ade7854_i2c_read_reg_8(struct device *dev,
- u16 reg_address,
- u8 *val)
+static int ade7854_i2c_read_reg(struct device *dev,
+   u16 reg_address,
+   u32 *val,
+   enum data_size type)
 {
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7854_state *st = iio_priv(indio_dev);
@@ -78,42 +79,58 @@ static int ade7854_i2c_read_reg_8(struct device *dev,
st->tx[1] = reg_address & 0xFF;
 
ret = i2c_master_send(st->i2c, st->tx, 2);
-   if (ret)
-   goto out;
+   if (ret < 0)
+   goto error_i2c_read_unlock;
 
-   ret = i2c_master_recv(st->i2c, st->rx, 1);
-   if (ret)
-   goto out;
+   ret = i2c_master_recv(st->i2c, st->rx, type);
+   if (ret < 0)
+   goto error_i2c_read_unlock;
 
-   *val = st->rx[0];
-out:
+   switch (type) {
+   case DATA_SIZE_8_BITS:
+   *val = st->rx[0];
+   break;
+   case DATA_SIZE_16_BITS:
+   *val = (st->rx[0] << 8) | st->rx[1];
+   break;
+   case DATA_SIZE_24_BITS:
+   *val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2];
+   break;
+   case DATA_SIZE_32_BITS:
+   *val = (st->rx[0] << 24) | (st->rx[1] << 16) |
+   (st->rx[2] << 8) | st->rx[3];
+   break;
+   default:
+   ret = -EINVAL;
+   goto error_i2c_read_unlock;
+   }
+
+error_i2c_read_unlock:
mutex_unlock(>buf_lock);
return ret;
 }
 
+static int ade7854_i2c_read_reg_8(struct device *dev,
+ u16 reg_address,
+ u8 *val)
+{
+   int ret;
+
+   ret = ade7854_i2c_read_reg(dev, reg_address, (u32 *)val,
+  DATA_SIZE_8_BITS);
+
+   return ret;
+}
+
 static int ade7854_i2c_read_reg_16(struct device *dev,
   u16 reg_address,
   u16 *val)
 {
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
int ret;
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = (reg_address >> 8) & 0xFF;
-   st->tx[1] = reg_address & 0xFF;
-
-   ret = i2c_master_send(st->i2c, st->tx, 2);
-   if (ret)
-   goto out;
-
-   ret = i2c_master_recv(st->i2c, st->rx, 2);
-   if (ret)
-   goto out;
+   ret = ade7854_i2c_read_reg(dev, reg_address, (u32 *)val,
+  DATA_SIZE_16_BITS);
 
-   *val = (st->rx[0] << 8) | st->rx[1];
-out:
-   mutex_unlock(>buf_lock);
return ret;
 }
 
@@ -121,25 +138,11 @@ static int ade7854_i2c_read_reg_24(struct device *dev,
   u16 reg_address,
   u32 *val)
 {
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
int ret;
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = (reg_address >> 8) & 0xFF;
-   st->tx[1] = reg_address & 0xFF;
-
-   ret = i2c_master_send(st->i2c, st->tx, 2);
-   if (ret)
-   goto out;
-
-   ret = i2c_master_recv(st->i2c, st->rx, 3);
-   if (ret)
-   goto out;
+   ret = ade7854_i2c_read_reg(dev, reg_address, (u32 *)val,
+  DATA_SIZE_24_BITS);
 
-   *val = (st->rx[0] << 16) | (st->rx[1] << 8) | st->rx[2];
-out:
-   mutex_unlock(>buf_lock);
return ret;
 }
 
@@ -147,26 +150,11 @@ static int ade7854_i2c_read_reg_32(struct device *dev,
   u16 reg_address,
   u32 *val)
 {
-   struct iio_dev *indio_dev = 

[PATCH 2/7] staging:iio:ade7854: Rework SPI write function

2018-03-14 Thread Rodrigo Siqueira
The write operation using SPI has a many code duplications (similar to
I2C) and four different interfaces per data size. This patch introduces
a single function that centralizes the main task related to SPI.

Signed-off-by: Rodrigo Siqueira 
---
 drivers/staging/iio/meter/ade7854-spi.c | 100 ++--
 1 file changed, 45 insertions(+), 55 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854-spi.c 
b/drivers/staging/iio/meter/ade7854-spi.c
index 4419b8f06197..0dae118428cf 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -15,9 +15,10 @@
 #include 
 #include "ade7854.h"
 
-static int ade7854_spi_write_reg_8(struct device *dev,
-  u16 reg_address,
-  u8 val)
+static int ade7854_spi_write_reg(struct device *dev,
+u16 reg_address,
+u32 val,
+enum data_size type)
 {
int ret;
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
@@ -32,36 +33,58 @@ static int ade7854_spi_write_reg_8(struct device *dev,
st->tx[0] = ADE7854_WRITE_REG;
st->tx[1] = (reg_address >> 8) & 0xFF;
st->tx[2] = reg_address & 0xFF;
-   st->tx[3] = val & 0xFF;
+   switch (type) {
+   case DATA_SIZE_8_BITS:
+   st->tx[3] = val & 0xFF;
+   break;
+   case DATA_SIZE_16_BITS:
+   xfer.len = 5;
+   st->tx[3] = (val >> 8) & 0xFF;
+   st->tx[4] = val & 0xFF;
+   break;
+   case DATA_SIZE_24_BITS:
+   xfer.len = 6;
+   st->tx[3] = (val >> 16) & 0xFF;
+   st->tx[4] = (val >> 8) & 0xFF;
+   st->tx[5] = val & 0xFF;
+   break;
+   case DATA_SIZE_32_BITS:
+   xfer.len = 7;
+   st->tx[3] = (val >> 24) & 0xFF;
+   st->tx[4] = (val >> 16) & 0xFF;
+   st->tx[5] = (val >> 8) & 0xFF;
+   st->tx[6] = val & 0xFF;
+   break;
+   default:
+   ret = -EINVAL;
+   goto error_spi_mutex_unlock;
+   }
 
ret = spi_sync_transfer(st->spi, , 1);
+error_spi_mutex_unlock:
mutex_unlock(>buf_lock);
 
return ret;
 }
 
+static int ade7854_spi_write_reg_8(struct device *dev,
+  u16 reg_address,
+  u8 val)
+{
+   int ret;
+
+   ret = ade7854_spi_write_reg(dev, reg_address, val, DATA_SIZE_8_BITS);
+
+   return ret;
+}
+
 static int ade7854_spi_write_reg_16(struct device *dev,
u16 reg_address,
u16 val)
 {
int ret;
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
-   struct spi_transfer xfer = {
-   .tx_buf = st->tx,
-   .bits_per_word = 8,
-   .len = 5,
-   };
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = ADE7854_WRITE_REG;
-   st->tx[1] = (reg_address >> 8) & 0xFF;
-   st->tx[2] = reg_address & 0xFF;
-   st->tx[3] = (val >> 8) & 0xFF;
-   st->tx[4] = val & 0xFF;
-
-   ret = spi_sync_transfer(st->spi, , 1);
-   mutex_unlock(>buf_lock);
+   ret = ade7854_spi_write_reg(dev, reg_address, val, DATA_SIZE_16_BITS);
 
return ret;
 }
@@ -71,24 +94,8 @@ static int ade7854_spi_write_reg_24(struct device *dev,
u32 val)
 {
int ret;
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
-   struct spi_transfer xfer = {
-   .tx_buf = st->tx,
-   .bits_per_word = 8,
-   .len = 6,
-   };
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = ADE7854_WRITE_REG;
-   st->tx[1] = (reg_address >> 8) & 0xFF;
-   st->tx[2] = reg_address & 0xFF;
-   st->tx[3] = (val >> 16) & 0xFF;
-   st->tx[4] = (val >> 8) & 0xFF;
-   st->tx[5] = val & 0xFF;
-
-   ret = spi_sync_transfer(st->spi, , 1);
-   mutex_unlock(>buf_lock);
+   ret = ade7854_spi_write_reg(dev, reg_address, val, DATA_SIZE_24_BITS);
 
return ret;
 }
@@ -98,25 +105,8 @@ static int ade7854_spi_write_reg_32(struct device *dev,
u32 val)
 {
int ret;
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
-   struct spi_transfer xfer = {
-   .tx_buf = st->tx,
-   .bits_per_word = 8,
-   .len = 7,
-   };
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = ADE7854_WRITE_REG;
-   st->tx[1] = (reg_address >> 8) & 0xFF;
-   st->tx[2] = reg_address & 0xFF;
-   st->tx[3] = (val >> 24) & 0xFF;
-   st->tx[4] = (val >> 16) & 0xFF;
-   

[PATCH 1/7] staging:iio:ade7854: Rework I2C write function

2018-03-14 Thread Rodrigo Siqueira
The write operation using I2C has many code duplications and four
different interfaces per data size. This patch introduces a single
function that centralizes the main tasks.

The central function inserted by this patch can easily replace all the
four functions related to the data size. However, this patch does not
remove any code signature for keeping the meter module work and make
easier to review this patch.

Signed-off-by: Rodrigo Siqueira 
---
 drivers/staging/iio/meter/ade7854-i2c.c | 89 +++--
 drivers/staging/iio/meter/ade7854.h |  7 +++
 2 files changed, 58 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854-i2c.c 
b/drivers/staging/iio/meter/ade7854-i2c.c
index 317e4f0d8176..03133a05eae4 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -15,41 +15,74 @@
 #include 
 #include "ade7854.h"
 
-static int ade7854_i2c_write_reg_8(struct device *dev,
-  u16 reg_address,
-  u8 val)
+static int ade7854_i2c_write_reg(struct device *dev,
+u16 reg_address,
+u32 val,
+enum data_size type)
 {
int ret;
+   int count;
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct ade7854_state *st = iio_priv(indio_dev);
 
mutex_lock(>buf_lock);
st->tx[0] = (reg_address >> 8) & 0xFF;
st->tx[1] = reg_address & 0xFF;
-   st->tx[2] = val;
 
-   ret = i2c_master_send(st->i2c, st->tx, 3);
+   switch (type) {
+   case DATA_SIZE_8_BITS:
+   st->tx[2] = val & 0xFF;
+   count = 3;
+   break;
+   case DATA_SIZE_16_BITS:
+   st->tx[2] = (val >> 8) & 0xFF;
+   st->tx[3] = val & 0xFF;
+   count = 4;
+   break;
+   case DATA_SIZE_24_BITS:
+   st->tx[2] = (val >> 16) & 0xFF;
+   st->tx[3] = (val >> 8) & 0xFF;
+   st->tx[4] = val & 0xFF;
+   count = 5;
+   break;
+   case DATA_SIZE_32_BITS:
+   st->tx[2] = (val >> 24) & 0xFF;
+   st->tx[3] = (val >> 16) & 0xFF;
+   st->tx[4] = (val >> 8) & 0xFF;
+   st->tx[5] = val & 0xFF;
+   count = 6;
+   break;
+   default:
+   ret = -EINVAL;
+   goto error_i2c_write_unlock;
+   }
+
+   ret = i2c_master_send(st->i2c, st->tx, count);
+
+error_i2c_write_unlock:
mutex_unlock(>buf_lock);
 
return ret;
 }
 
+static int ade7854_i2c_write_reg_8(struct device *dev,
+  u16 reg_address,
+  u8 val)
+{
+   int ret;
+
+   ret = ade7854_i2c_write_reg(dev, reg_address, val, DATA_SIZE_8_BITS);
+
+   return ret;
+}
+
 static int ade7854_i2c_write_reg_16(struct device *dev,
u16 reg_address,
u16 val)
 {
int ret;
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = (reg_address >> 8) & 0xFF;
-   st->tx[1] = reg_address & 0xFF;
-   st->tx[2] = (val >> 8) & 0xFF;
-   st->tx[3] = val & 0xFF;
-
-   ret = i2c_master_send(st->i2c, st->tx, 4);
-   mutex_unlock(>buf_lock);
+   ret = ade7854_i2c_write_reg(dev, reg_address, val, DATA_SIZE_16_BITS);
 
return ret;
 }
@@ -59,18 +92,8 @@ static int ade7854_i2c_write_reg_24(struct device *dev,
u32 val)
 {
int ret;
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
 
-   mutex_lock(>buf_lock);
-   st->tx[0] = (reg_address >> 8) & 0xFF;
-   st->tx[1] = reg_address & 0xFF;
-   st->tx[2] = (val >> 16) & 0xFF;
-   st->tx[3] = (val >> 8) & 0xFF;
-   st->tx[4] = val & 0xFF;
-
-   ret = i2c_master_send(st->i2c, st->tx, 5);
-   mutex_unlock(>buf_lock);
+   ret = ade7854_i2c_write_reg(dev, reg_address, val, DATA_SIZE_24_BITS);
 
return ret;
 }
@@ -80,23 +103,13 @@ static int ade7854_i2c_write_reg_32(struct device *dev,
u32 val)
 {
int ret;
-   struct iio_dev *indio_dev = dev_to_iio_dev(dev);
-   struct ade7854_state *st = iio_priv(indio_dev);
-
-   mutex_lock(>buf_lock);
-   st->tx[0] = (reg_address >> 8) & 0xFF;
-   st->tx[1] = reg_address & 0xFF;
-   st->tx[2] = (val >> 24) & 0xFF;
-   st->tx[3] = (val >> 16) & 0xFF;
-   st->tx[4] = (val >> 8) & 0xFF;
-   st->tx[5] = val & 0xFF;
 
-   ret = i2c_master_send(st->i2c, st->tx, 6);
-   mutex_unlock(>buf_lock);
+   ret = ade7854_i2c_write_reg(dev, reg_address, val, 

[PATCH 0/7] staging:iio:ade7854: Cleanup on I2C/SPI code

2018-03-14 Thread Rodrigo Siqueira
This patchset reworks the I2C/SPI code from meter module. The set of
patches try to reduce the code duplication and make the communication
reliable. The current version of the module had many code duplications,
which make the code more error-prone and hard to read. Jonh Syne
identified some wrong error handling and fixed it in his patches; in
this series of patches I analyzed Jonh's fixes, and use it in the new
code.

It is important to highlight that meter module is under observation, due
to the lack of hardware and the old design of the chip. However, John
has the hardware for testing and interest to help to update the code
[1]. As a result, this patchset represents the first work effort to
update the meter module in the staging.

1 - https://marc.info/?l=linux-iio=152046885922153=2 

Rodrigo Siqueira (7):
  staging:iio:ade7854: Rework I2C write function
  staging:iio:ade7854: Rework SPI write function
  staging:iio:ade7854: Replace many functions for one function
  staging:iio:ade7854: Rework I2C read function
  staging:iio:ade7854: Rework SPI read function
  staging:iio:ade7854: Remove read_reg_* duplications
  staging:iio:ade7854: Add proper error handling condition.

 drivers/staging/iio/meter/ade7854-i2c.c | 236 
 drivers/staging/iio/meter/ade7854-spi.c | 268 +++-
 drivers/staging/iio/meter/ade7854.c |  44 +++---
 drivers/staging/iio/meter/ade7854.h |  23 +--
 4 files changed, 160 insertions(+), 411 deletions(-)

-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2]PCI: hv: fix PCI-BUS domainID corruption

2018-03-14 Thread Sridhar Pitchai
Whenever PCI bus is added, HyperV guarantees the BUS id is unique. Even with
that when a first device is added to the bus, it overrides bus domain ID 
with
the device serial number. Sometime this can result in BUS ID not being 
unique.
In this case, when PCI_BUS and a device added to the bus, even before the 
PCI
BUS is added to kernel, the first device tends to overwrite the domain ID 
with
0. Since there exists a PCI bus with domain ID 0 already the PCI bus 
addition
fails. This patch make sure when a device is added to a bus, it never 
updated
the bus domain ID. Since we have the transparent SRIOV mode now, the short 
VF
device name is no longer needed.

Fixes: 4a9b0933bdfc("PCI:hv:Use device serial number as PCI domain")
Cc: sta...@vger.kernel.org
Signed-off-by: Sridhar Pitchai 
---

Changes in v2:
* fix the commit comments.
---
 drivers/pci/host/pci-hyperv.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 2faf38e..ac67e56 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1518,17 +1518,6 @@ static struct hv_pci_dev *new_pcichild_device(struct 
hv_pcibus_device *hbus,
get_pcichild(hpdev, hv_pcidev_ref_childlist);
spin_lock_irqsave(>device_list_lock, flags);
 
-   /*
-* When a device is being added to the bus, we set the PCI domain
-* number to be the device serial number, which is non-zero and
-* unique on the same VM.  The serial numbers start with 1, and
-* increase by 1 for each device.  So device names including this
-* can have shorter names than based on the bus instance UUID.
-* Only the first device serial number is used for domain, so the
-* domain number will not change after the first device is added.
-*/
-   if (list_empty(>children))
-   hbus->sysdata.domain = desc->ser;
list_add_tail(>list_entry, >children);
spin_unlock_irqrestore(>device_list_lock, flags);
return hpdev;
-- 
2.7.4




___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2]PCI: hv: fix PCI-BUS domainID corruption

2018-03-14 Thread Sridhar Pitchai
Whenever PCI bus is added, HyperV guarantees the BUS id is unique. Even with
that when a first device is added to the bus, it overrides bus domain ID with
the device serial number. Sometime this can result in BUS ID not being unique.
In this case, when PCI_BUS and a device added to the bus, even before the PCI
BUS is added to kernel, the first device tends to overwrite the domain ID with
0. Since there exists a PCI bus with domain ID 0 already the PCI bus addition
fails. This patch make sure when a device is added to a bus, it never updated
the bus domain ID. Since we have the transparent SRIOV mode now, the short VF
device name is no longer needed.

Fixes: 4a9b0933bdfc("PCI:hv:Use device serial number as PCI domain")
Cc: sta...@vger.kernel.org
Signed-off-by: Sridhar Pitchai 
---

Changes in v2:
* fix the commit comments.
---
 drivers/pci/host/pci-hyperv.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 2faf38e..ac67e56 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -1518,17 +1518,6 @@ static struct hv_pci_dev *new_pcichild_device(struct 
hv_pcibus_device *hbus,
get_pcichild(hpdev, hv_pcidev_ref_childlist);
spin_lock_irqsave(>device_list_lock, flags);
 
-   /*
-* When a device is being added to the bus, we set the PCI domain
-* number to be the device serial number, which is non-zero and
-* unique on the same VM.  The serial numbers start with 1, and
-* increase by 1 for each device.  So device names including this
-* can have shorter names than based on the bus instance UUID.
-* Only the first device serial number is used for domain, so the
-* domain number will not change after the first device is added.
-*/
-   if (list_empty(>children))
-   hbus->sysdata.domain = desc->ser;
list_add_tail(>list_entry, >children);
spin_unlock_irqrestore(>device_list_lock, flags);
return hpdev;
-- 
2.7.4


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-14 Thread Steve Longerbeam

Hi Peter,


On 03/14/2018 09:51 AM, Peter Seiderer wrote:

Enables gstreamer v4l2src lost frame detection, e.g:

   0:00:08.685185668  348  0x54f520 WARN  v4l2src 
gstv4l2src.c:970:gst_v4l2src_create: lost frames detected: count = 
141 - ts: 0:00:08.330177332

Signed-off-by: Peter Seiderer 
---
Changes in v2:
   - fill vb2_v4l2_buffer sequence entry in imx-ic-prpencvf too
 (suggested by Steve Longerbeam)

Changes in v3:
   - add changelog (suggested by Greg Kroah-Hartman, Fabio Estevam
 and Dan Carpenter) and patch history
   - use u32 (instead of __u32) (suggested by Dan Carpenter)
   - let sequence counter start with zero,


There's no need to initialize (unsigned) priv->frame_sequence to -1. Just
increment it _after_ the "if (done) {...}" block instead of before.

Steve


  keeping v4l2-compliance
 testing happy (needs additional setting of field to a valid
 value, patch will follow soon)
---
  drivers/staging/media/imx/imx-ic-prpencvf.c | 5 +
  drivers/staging/media/imx/imx-media-csi.c   | 5 +
  2 files changed, 10 insertions(+)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ae453fd422f0..274683d2d4ba 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -103,6 +103,7 @@ struct prp_priv {
int nfb4eof_irq;
  
  	int stream_count;

+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;  /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -208,8 +209,11 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct 
ipuv3_channel *ch)
struct vb2_buffer *vb;
dma_addr_t phys;
  
+	priv->frame_sequence++;

+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -637,6 +641,7 @@ static int prp_start(struct prp_priv *priv)
  
  	/* init EOF completion waitq */

init_completion(>last_eof_comp);
+   priv->frame_sequence = -1;
priv->last_eof = false;
priv->nfb4eof = false;
  
diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c

index 5a195f80a24d..161a92946a86 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
  
  	int stream_count; /* streaming counter */

+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
  
+	priv->frame_sequence++;

+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
  
  	/* init EOF completion waitq */

init_completion(>last_eof_comp);
+   priv->frame_sequence = -1;
priv->last_eof = false;
priv->nfb4eof = false;
  


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()

2018-03-14 Thread Dexuan Cui
> From: Lorenzo Pieralisi 
> Sent: Wednesday, March 14, 2018 04:50
> On Tue, Mar 13, 2018 at 06:23:39PM +, Dexuan Cui wrote:
> 
> [...]
> 
> > Hi Lorenzo, Bjorn, and all,
> > Do you need more ACKs? Currently Michael and Haiyang reviewed and ack'd
> > the patchset.
> >
> > Should I send a v4 that just removes the "CC: sta...@vger.kernel.org" tag
> > for patches 1, 2, 4 and 5? I tend to avoid a v4 as I supppose it would be
> > easier if you just remove the tags if you belive it's necessary (IMHO all 
> > the
> > 6 paches are not big and it would be great if we can have all of them in
> > the old stable kernels, but I respect your decision).
> 
> I think you need a v4 since for patches that are actually fixing a bug I
> want a Fixes: tag added and I want them to be applicable independently
> of other patches in the series. Send them in a separate series if you
> prefer - I just want to make sure they apply independently.

Ok, I'll send 2 series: one for
[6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()
[3/6] PCI: hv: serialize the present/eject work items
These fix real issues reported by Mellanox when they tested SR-IOV with VMs
runnning on Hyper-V. I'll add stable tags for them.

The other series will cover these 4 patces which don't need to go in stable:
[5/6] PCI: hv: hv_pci_devices_present(): only queue a new work when necessary
[4/6] PCI: hv: remove hbus->enum_sem
[2/6] PCI: hv: hv_eject_device_work(): remove the bogus test
[1/6] PCI: hv: fix a comment typo in _hv_pcifront_read_config()
 
> As for marking patches for stable kernels, I do not think it is right
> to send cosmetic churn to stable kernels anyway, at least that's my
> reading of the policy.
> 
> You can easily post a v4 with patches reshuffled - I will apply them
> accordingly.
OK.
 
> Before re-posting please read this to improve formatting (I can do it
> for you but while at it you can do it yourself):
> https://marc.info/?l=linux-pci=150905742808166=2
Will read. Thanks!

-- Dexuan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 47/47] staging: iio: remove iio-trig-bfin-timer driver

2018-03-14 Thread Jonathan Cameron
On Wed, 14 Mar 2018 17:32:07 +0100
Greg Kroah-Hartman  wrote:

> On Wed, Mar 14, 2018 at 04:36:00PM +0100, Arnd Bergmann wrote:
> > The blackfin architecture is getting removed, so the timer trigger
> > driver is now obsolete. Since this is the last remaining iio trigger
> > driver in staging, I'm removing the entire directory.
Great.

> > 
> > I'm not sure about the other staging iio drivers though: almost
> > all of them are for Analog Devices devices like this one. They
> > are likely used along with blackfin SoCs, but could easily be
> > used on any others as well.
> > 
> > It might be time to consider whether they should be removed, but
> > it doesn't feel like a decision that I should be making.  
> 
> The IIO driver maintainer/developers are talking about that currently, I
> think they have a plan for those other drivers.

Some of the drivers are under consideration for removal (particularly most
of the meter drivers) but it is unconnected to the blackfin removal.
They are simply other obsolete parts that we don't have test hardware
for and need sufficient 'surgery' that we wouldn't feel comfortable
cleaning them up without.  One has been reprieved as a user, who was
happy to test, came forward when I announced the intent to remove them.

> 
> > Signed-off-by: Arnd Bergmann   
> 
> Acked-by: Greg Kroah-Hartman 
Acked-by: Jonathan Cameron 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-14 Thread Peter Seiderer
Enables gstreamer v4l2src lost frame detection, e.g:

  0:00:08.685185668  348  0x54f520 WARN  v4l2src 
gstv4l2src.c:970:gst_v4l2src_create: lost frames detected: count = 
141 - ts: 0:00:08.330177332

Signed-off-by: Peter Seiderer 
---
Changes in v2:
  - fill vb2_v4l2_buffer sequence entry in imx-ic-prpencvf too
(suggested by Steve Longerbeam)

Changes in v3:
  - add changelog (suggested by Greg Kroah-Hartman, Fabio Estevam
and Dan Carpenter) and patch history
  - use u32 (instead of __u32) (suggested by Dan Carpenter)
  - let sequence counter start with zero, keeping v4l2-compliance
testing happy (needs additional setting of field to a valid
value, patch will follow soon)
---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 5 +
 drivers/staging/media/imx/imx-media-csi.c   | 5 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c 
b/drivers/staging/media/imx/imx-ic-prpencvf.c
index ae453fd422f0..274683d2d4ba 100644
--- a/drivers/staging/media/imx/imx-ic-prpencvf.c
+++ b/drivers/staging/media/imx/imx-ic-prpencvf.c
@@ -103,6 +103,7 @@ struct prp_priv {
int nfb4eof_irq;
 
int stream_count;
+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;  /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -208,8 +209,11 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct 
ipuv3_channel *ch)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -637,6 +641,7 @@ static int prp_start(struct prp_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = -1;
priv->last_eof = false;
priv->nfb4eof = false;
 
diff --git a/drivers/staging/media/imx/imx-media-csi.c 
b/drivers/staging/media/imx/imx-media-csi.c
index 5a195f80a24d..161a92946a86 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -111,6 +111,7 @@ struct csi_priv {
struct v4l2_ctrl_handler ctrl_hdlr;
 
int stream_count; /* streaming counter */
+   u32 frame_sequence; /* frame sequence counter */
bool last_eof;   /* waiting for last EOF at stream off */
bool nfb4eof;/* NFB4EOF encountered during streaming */
struct completion last_eof_comp;
@@ -234,8 +235,11 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
struct vb2_buffer *vb;
dma_addr_t phys;
 
+   priv->frame_sequence++;
+
done = priv->active_vb2_buf[priv->ipu_buf_num];
if (done) {
+   done->vbuf.sequence = priv->frame_sequence;
vb = >vbuf.vb2_buf;
vb->timestamp = ktime_get_ns();
vb2_buffer_done(vb, priv->nfb4eof ?
@@ -543,6 +547,7 @@ static int csi_idmac_start(struct csi_priv *priv)
 
/* init EOF completion waitq */
init_completion(>last_eof_comp);
+   priv->frame_sequence = -1;
priv->last_eof = false;
priv->nfb4eof = false;
 
-- 
2.16.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 46/47] staging: irda: remove bfin_sir driver

2018-03-14 Thread Arnd Bergmann
On Wed, Mar 14, 2018 at 5:32 PM, Greg Kroah-Hartman
 wrote:
> On Wed, Mar 14, 2018 at 04:35:59PM +0100, Arnd Bergmann wrote:
>> The blackfin architecture is getting removed, so this
>> driver is now obsolete.
>>
>> Signed-off-by: Arnd Bergmann 
>> ---
>>  drivers/staging/irda/drivers/Kconfig|  45 --
>>  drivers/staging/irda/drivers/Makefile   |   1 -
>>  drivers/staging/irda/drivers/bfin_sir.c | 819 
>> 
>>  drivers/staging/irda/drivers/bfin_sir.h |  93 
>>  4 files changed, 958 deletions(-)
>>  delete mode 100644 drivers/staging/irda/drivers/bfin_sir.c
>>  delete mode 100644 drivers/staging/irda/drivers/bfin_sir.h
>
> I just deleted all of drivers/staging/irda/ earlier today :)

Perfect, dropping this patch from my series then. Thanks,

  Arnd
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 46/47] staging: irda: remove bfin_sir driver

2018-03-14 Thread Greg Kroah-Hartman
On Wed, Mar 14, 2018 at 04:35:59PM +0100, Arnd Bergmann wrote:
> The blackfin architecture is getting removed, so this
> driver is now obsolete.
> 
> Signed-off-by: Arnd Bergmann 
> ---
>  drivers/staging/irda/drivers/Kconfig|  45 --
>  drivers/staging/irda/drivers/Makefile   |   1 -
>  drivers/staging/irda/drivers/bfin_sir.c | 819 
> 
>  drivers/staging/irda/drivers/bfin_sir.h |  93 
>  4 files changed, 958 deletions(-)
>  delete mode 100644 drivers/staging/irda/drivers/bfin_sir.c
>  delete mode 100644 drivers/staging/irda/drivers/bfin_sir.h

I just deleted all of drivers/staging/irda/ earlier today :)

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 47/47] staging: iio: remove iio-trig-bfin-timer driver

2018-03-14 Thread Greg Kroah-Hartman
On Wed, Mar 14, 2018 at 04:36:00PM +0100, Arnd Bergmann wrote:
> The blackfin architecture is getting removed, so the timer trigger
> driver is now obsolete. Since this is the last remaining iio trigger
> driver in staging, I'm removing the entire directory.
> 
> I'm not sure about the other staging iio drivers though: almost
> all of them are for Analog Devices devices like this one. They
> are likely used along with blackfin SoCs, but could easily be
> used on any others as well.
> 
> It might be time to consider whether they should be removed, but
> it doesn't feel like a decision that I should be making.

The IIO driver maintainer/developers are talking about that currently, I
think they have a plan for those other drivers.

> Signed-off-by: Arnd Bergmann 

Acked-by: Greg Kroah-Hartman 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] hv: add SPDX license to trace

2018-03-14 Thread Stephen Hemminger
Missing license on Hyper-V VMBUS tracing files.

Signed-off-by: Stephen Hemminger 
---
 drivers/hv/hv_trace.c | 2 ++
 drivers/hv/hv_trace.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/hv/hv_trace.c b/drivers/hv/hv_trace.c
index df47acd01a81..38d359cf1e70 100644
--- a/drivers/hv/hv_trace.c
+++ b/drivers/hv/hv_trace.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
+
 #include "hyperv_vmbus.h"
 
 #define CREATE_TRACE_POINTS
diff --git a/drivers/hv/hv_trace.h b/drivers/hv/hv_trace.h
index d635ee95b20d..999f80a63bff 100644
--- a/drivers/hv/hv_trace.h
+++ b/drivers/hv/hv_trace.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
+
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM hyperv
 
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] hv: add SPDX license id to Kconfig

2018-03-14 Thread Stephen Hemminger
Missing license on Kconfig file.

Signed-off-by: Stephen Hemminger 
---
 drivers/hv/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig
index 50b89ea0e60f..97954f575c3f 100644
--- a/drivers/hv/Kconfig
+++ b/drivers/hv/Kconfig
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
 menu "Microsoft Hyper-V guest support"
 
 config HYPERV
-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] hv: license identfiers

2018-03-14 Thread Stephen Hemminger
A couple trivial patches to add SPDX license tag to
some files related to Hyper-V VMBUS.

Stephen Hemminger (2):
  hv: add SPDX license to trace
  hv: add SPDX license id to Kconfig

 drivers/hv/Kconfig| 2 ++
 drivers/hv/hv_trace.c | 2 ++
 drivers/hv/hv_trace.h | 2 ++
 3 files changed, 6 insertions(+)

-- 
2.16.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 00/10] posix_clocks: Prepare syscalls for 64 bit time_t conversion

2018-03-14 Thread Arnd Bergmann
On Wed, Mar 14, 2018 at 5:03 AM, Deepa Dinamani  wrote:
> The series is a preparation series for individual architectures
> to use 64 bit time_t syscalls in compat and 32 bit emulation modes.
>
> This is a follow up to the series Arnd Bergmann posted:
> https://sourceware.org/ml/libc-alpha/2015-05/msg00070.html [1]
>
> Thomas, Arnd, this seems ready to be merged now.
> Can you help get this merged?
>
> Big picture is as per the lwn article:
> https://lwn.net/Articles/643234/ [2]
>
> The series is directed at converting posix clock syscalls:
> clock_gettime, clock_settime, clock_getres and clock_nanosleep
> to use a new data structure __kernel_timespec at syscall boundaries.
> __kernel_timespec maintains 64 bit time_t across all execution modes.
>
> vdso will be handled as part of each architecture when they enable
> support for 64 bit time_t.
>
> The compat syscalls are repurposed to provide backward compatibility
> by using them as native syscalls as well for 32 bit architectures.
> They will continue to use timespec at syscall boundaries.
>
> CONFIG_64_BIT_TIME controls whether the syscalls use __kernel_timespec
> or timespec at syscall boundaries.
>
> The series does the following:
> 1. Enable compat syscalls on 32 bit architectures.
> 2. Add a new __kernel_timespec type to be used as the data structure
>for all the new syscalls.
> 3. Add new config CONFIG_64BIT_TIME(intead of the CONFIG_COMPAT_TIME in
>[1] and [2] to switch to new definition of __kernel_timespec. It is
>the same as struct timespec otherwise.
> 4. Add new CONFIG_32BIT_TIME to conditionally compile compat syscalls.

I've applied all 10 patches to my y2038 git branch [1], which is part
of linux-next,
to give it a little wider testing. If everything goes well, I'd send a
pull request to
Thomas next week so he can integrate it into tip from there, or (if he prefers)
send it directly to Linus in the merge window.

Thanks a lot for your persistence and your work on this!

  Arnd

[1] git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git#y2038
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 4/6] staging: fsl-dpaa2/ethsw: Add maintainer for Ethernet Switch driver

2018-03-14 Thread Razvan Stefanescu
Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- no changes
 v4:
- no changes
 v5:
- no changes
 v6:
- no changes

 MAINTAINERS | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index c3c2b75..20d7bf2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4410,6 +4410,12 @@ L:   linux-ker...@vger.kernel.org
 S: Maintained
 F: drivers/staging/fsl-dpaa2/ethernet
 
+DPAA2 ETHERNET SWITCH DRIVER
+M: Razvan Stefanescu 
+L: linux-ker...@vger.kernel.org
+S: Maintained
+F: drivers/staging/fsl-dpaa2/ethsw
+
 DPT_I2O SCSI RAID DRIVER
 M: Adaptec OEM Raid Solutions 
 L: linux-s...@vger.kernel.org
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 6/6] staging: fsl-dpaa2/ethsw: Add TODO

2018-03-14 Thread Razvan Stefanescu
Add a TODO file describing what needs to be added/changed before the driver
can be moved out of staging.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- no changes
 v4:
- remove fsl-mc bus driver dependency as it is out of staging
 v5:
- no changes
 v6:
- add port partitioning requirement

 drivers/staging/fsl-dpaa2/ethsw/TODO | 14 ++
 1 file changed, 14 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/TODO

diff --git a/drivers/staging/fsl-dpaa2/ethsw/TODO 
b/drivers/staging/fsl-dpaa2/ethsw/TODO
new file mode 100644
index 000..24b5e95
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/TODO
@@ -0,0 +1,14 @@
+* Add I/O capabilities on switch port netdevices. This will allow control
+traffic to reach the CPU.
+* Add ACL to redirect control traffic to CPU.
+* Add support for displaying learned FDB entries
+* Add support for multiple FDBs and switch port partitioning
+* MC firmware uprev; the DPAA2 objects used by the Ethernet Switch driver
+need to be kept in sync with binary interface changes in MC
+* refine README file
+* cleanup
+
+NOTE: At least first three of the above are required before getting the
+DPAA2 Ethernet Switch driver out of staging. Another requirement is that
+dpio driver is moved to drivers/soc (this is required for I/O).
+
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 47/47] staging: iio: remove iio-trig-bfin-timer driver

2018-03-14 Thread Arnd Bergmann
The blackfin architecture is getting removed, so the timer trigger
driver is now obsolete. Since this is the last remaining iio trigger
driver in staging, I'm removing the entire directory.

I'm not sure about the other staging iio drivers though: almost
all of them are for Analog Devices devices like this one. They
are likely used along with blackfin SoCs, but could easily be
used on any others as well.

It might be time to consider whether they should be removed, but
it doesn't feel like a decision that I should be making.

Signed-off-by: Arnd Bergmann 
---
 MAINTAINERS   |   1 -
 drivers/staging/iio/Kconfig   |   1 -
 drivers/staging/iio/Makefile  |   1 -
 drivers/staging/iio/trigger/Kconfig   |  19 --
 drivers/staging/iio/trigger/Makefile  |   5 -
 drivers/staging/iio/trigger/iio-trig-bfin-timer.c | 292 --
 drivers/staging/iio/trigger/iio-trig-bfin-timer.h |  25 --
 7 files changed, 344 deletions(-)
 delete mode 100644 drivers/staging/iio/trigger/Kconfig
 delete mode 100644 drivers/staging/iio/trigger/Makefile
 delete mode 100644 drivers/staging/iio/trigger/iio-trig-bfin-timer.c
 delete mode 100644 drivers/staging/iio/trigger/iio-trig-bfin-timer.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 6eb7387bb1e9..c85ce0cd5038 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -859,7 +859,6 @@ F:  drivers/iio/*/ad*
 F: drivers/iio/adc/ltc2497*
 X: drivers/iio/*/adjd*
 F: drivers/staging/iio/*/ad*
-F: drivers/staging/iio/trigger/iio-trig-bfin-timer.c
 
 ANDES ARCHITECTURE
 M: Greentime Hu 
diff --git a/drivers/staging/iio/Kconfig b/drivers/staging/iio/Kconfig
index 8abc1ab3c0c7..bd9445956511 100644
--- a/drivers/staging/iio/Kconfig
+++ b/drivers/staging/iio/Kconfig
@@ -14,6 +14,5 @@ source "drivers/staging/iio/impedance-analyzer/Kconfig"
 source "drivers/staging/iio/light/Kconfig"
 source "drivers/staging/iio/meter/Kconfig"
 source "drivers/staging/iio/resolver/Kconfig"
-source "drivers/staging/iio/trigger/Kconfig"
 
 endmenu
diff --git a/drivers/staging/iio/Makefile b/drivers/staging/iio/Makefile
index 455bffc29649..e99a375c07b9 100644
--- a/drivers/staging/iio/Makefile
+++ b/drivers/staging/iio/Makefile
@@ -13,4 +13,3 @@ obj-y += impedance-analyzer/
 obj-y += light/
 obj-y += meter/
 obj-y += resolver/
-obj-y += trigger/
diff --git a/drivers/staging/iio/trigger/Kconfig 
b/drivers/staging/iio/trigger/Kconfig
deleted file mode 100644
index 0b01d24cea51..
diff --git a/drivers/staging/iio/trigger/Makefile 
b/drivers/staging/iio/trigger/Makefile
deleted file mode 100644
index 1300a21363db..
diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.c 
b/drivers/staging/iio/trigger/iio-trig-bfin-timer.c
deleted file mode 100644
index 71f11d7472c0..
diff --git a/drivers/staging/iio/trigger/iio-trig-bfin-timer.h 
b/drivers/staging/iio/trigger/iio-trig-bfin-timer.h
deleted file mode 100644
index fb05a2a8397c..
-- 
2.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 5/6] staging: fsl-dpaa2/ethsw: Add README

2018-03-14 Thread Razvan Stefanescu
Add a README file describing the driver architecture, components and
interfaces.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- no changes
 v4:
- no changes
 v5:
- no changes
 v6:
- no changes

 drivers/staging/fsl-dpaa2/ethsw/README | 106 +
 1 file changed, 106 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/README

diff --git a/drivers/staging/fsl-dpaa2/ethsw/README 
b/drivers/staging/fsl-dpaa2/ethsw/README
new file mode 100644
index 000..f6fc07f
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/README
@@ -0,0 +1,106 @@
+DPAA2 Ethernet Switch driver
+
+
+This file provides documentation for the DPAA2 Ethernet Switch driver
+
+
+Contents
+
+   Supported Platforms
+   Architecture Overview
+   Creating an Ethernet Switch
+   Features
+
+
+   Supported Platforms
+===
+This driver provides networking support for Freescale LS2085A, LS2088A
+DPAA2 SoCs.
+
+
+Architecture Overview
+=
+The Ethernet Switch in the DPAA2 architecture consists of several hardware
+resources that provide the functionality. These are allocated and
+configured via the Management Complex (MC) portals. MC abstracts most of
+these resources as DPAA2 objects and exposes ABIs through which they can
+be configured and controlled.
+
+For a more detailed description of the DPAA2 architecture and its object
+abstractions see:
+   drivers/staging/fsl-mc/README.txt
+
+The Ethernet Switch is built on top of a Datapath Switch (DPSW) object.
+
+Configuration interface:
+
+  -
+ | DPAA2 Switch driver |
+  -
+   .
+   .
+  --
+ | DPSW API |
+  --
+   .   software
+ = . ==
+   .   hardware
+  -
+ | MC hardware portals |
+  -
+   .
+   .
+ --
+| DPSW |
+ --
+
+Driver uses the switch device driver model and exposes each switch port as
+a network interface, which can be included in a bridge. Traffic switched
+between ports is offloaded into the hardware. Exposed network interfaces
+are not used for I/O, they are used just for configuration. This
+limitation is going to be addressed in the future.
+
+The DPSW can have ports connected to DPNIs or to PHYs via DPMACs.
+
+
+ [ethA] [ethB] [ethC] [ethD] [ethE] [ethF]
+:  :  :  :  :  :
+:  :  :  :  :  :
+[eth drv]  [eth drv]  [ethsw drv  ]
+:  :  :  :  :  :kernel
+
+:  :  :  :  :  :hardware
+ [DPNI]  [DPNI] [= DPSW =]
+|  |  |  |  |  |
+|   --   |   [DPMAC][DPMAC]
+ ---|  |
+|  |
+  [PHY]  [PHY]
+
+For a more detailed description of the Ethernet switch device driver model
+see:
+   Documentation/networking/switchdev.txt
+
+Creating an Ethernet Switch
+===
+A device is created for the switch objects probed on the MC bus. Each DPSW
+has a number of properties which determine the configuration options and
+associated hardware resources.
+
+A DPSW object (and the other DPAA2 objects needed for a DPAA2 switch) can
+be added to a container on the MC bus in one of two ways: statically,
+through a Datapath Layout Binary file (DPL) that is parsed by MC at boot
+time; or created dynamically at runtime, via the DPAA2 objects APIs.
+
+Features
+
+Driver configures DPSW to perform hardware switching offload of
+unicast/multicast/broadcast (VLAN tagged or untagged) traffic between its
+ports.
+
+It allows configuration of hardware learning, flooding, multicast groups,
+port VLAN configuration and STP state.
+
+Static entries can be added/removed from the FDB.
+
+Hardware statistics for each port are provided through ethtool -S option.
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2018-03-14 Thread Razvan Stefanescu
Introduce the DPAA2 Ethernet Switch driver, which manages Datapath Switch
(DPSW) objects discovered on the MC bus.

Suggested-by: Alexandru Marginean 
Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- fix PVID cleanup in ethsw_port_add_vlan()
- rename err2 to ret in ethsw_port_add/del_vlan()
- avoid duplicate code in ethsw_probe()
- move destroy_workqueue to ethsw_takedown()
- have a function for unregistering notifiers
- above changes implement review comments for v1 from Bogdan P.
 v3:
- no changes
 v4:
- adjust to moving MC-bus out of staging
- support adding/deleting multicast entries to/from FDB
- selectively discard benign MC errors for calling add/delete fdb entries
  multiple times to avoid spamming console with stack traces
- refactor setting TCI to avoid code duplication
- clean probe code error path
 v5:
- replace ethsw_irq0_handler() with NULL
- do not allow adding ports of the same switch to multiple bridge devices
 v6:
- use SPDX license identifier
- fix indentation

 drivers/staging/fsl-dpaa2/ethsw/Makefile |2 +-
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c  | 1507 ++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h  |   65 ++
 3 files changed, 1573 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h

diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile 
b/drivers/staging/fsl-dpaa2/ethsw/Makefile
index 9846e61..7755603 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/Makefile
+++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
@@ -7,4 +7,4 @@
 
 obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
 
-dpaa2-ethsw-objs := dpsw.o
+dpaa2-ethsw-objs := ethsw.o dpsw.o
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
new file mode 100644
index 000..5aa6e95
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -0,0 +1,1507 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * DPAA2 Ethernet Switch driver
+ *
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2017-2018 NXP
+ *
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "ethsw.h"
+
+static struct workqueue_struct *ethsw_owq;
+
+/* Minimal supported DPSW version */
+#define DPSW_MIN_VER_MAJOR 8
+#define DPSW_MIN_VER_MINOR 0
+
+#define DEFAULT_VLAN_ID1
+
+static int ethsw_add_vlan(struct ethsw_core *ethsw, u16 vid)
+{
+   int err;
+
+   struct dpsw_vlan_cfgvcfg = {
+   .fdb_id = 0,
+   };
+
+   if (ethsw->vlans[vid]) {
+   dev_err(ethsw->dev, "VLAN already configured\n");
+   return -EEXIST;
+   }
+
+   err = dpsw_vlan_add(ethsw->mc_io, 0,
+   ethsw->dpsw_handle, vid, );
+   if (err) {
+   dev_err(ethsw->dev, "dpsw_vlan_add err %d\n", err);
+   return err;
+   }
+   ethsw->vlans[vid] = ETHSW_VLAN_MEMBER;
+
+   return 0;
+}
+
+static int ethsw_port_set_tci(struct ethsw_port_priv *port_priv,
+ struct dpsw_tci_cfg *tci_cfg)
+{
+   struct ethsw_core *ethsw = port_priv->ethsw_data;
+   struct net_device *netdev = port_priv->netdev;
+   bool is_oper;
+   int err, ret;
+
+   /* Interface needs to be down to change PVID */
+   is_oper = netif_oper_up(netdev);
+   if (is_oper) {
+   err = dpsw_if_disable(ethsw->mc_io, 0,
+ ethsw->dpsw_handle,
+ port_priv->idx);
+   if (err) {
+   netdev_err(netdev, "dpsw_if_disable err %d\n", err);
+   return err;
+   }
+   }
+
+   err = dpsw_if_set_tci(ethsw->mc_io, 0, ethsw->dpsw_handle,
+ port_priv->idx, tci_cfg);
+   if (err) {
+   netdev_err(netdev, "dpsw_if_set_tci err %d\n", err);
+   goto set_tci_error;
+   }
+
+   /* Delete previous PVID info and mark the new one */
+   if (port_priv->pvid)
+   port_priv->vlans[port_priv->pvid] &= ~ETHSW_VLAN_PVID;
+   port_priv->vlans[tci_cfg->vlan_id] |= ETHSW_VLAN_PVID;
+   port_priv->pvid = tci_cfg->vlan_id;
+
+set_tci_error:
+   if (is_oper) {
+   ret = dpsw_if_enable(ethsw->mc_io, 0,
+ethsw->dpsw_handle,
+port_priv->idx);
+   if (ret) {
+   netdev_err(netdev, "dpsw_if_enable err %d\n", ret);
+   return ret;
+   }
+   }
+
+   return err;
+}
+
+static int ethsw_port_add_vlan(struct ethsw_port_priv *port_priv,
+  u16 vid, u16 flags)
+{
+   struct ethsw_core *ethsw = 

[PATCH v6 1/6] staging: fsl-dpaa2/ethsw: Add APIs for DPSW object

2018-03-14 Thread Razvan Stefanescu
Add the command build/parse APIs for operating on DPSW objects through
the DPAA2 Management Complex.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- use u8 for en parameter of dpsw_if_set_flooding/broadcast()
 v3:
- no changes
 v4:
- adjust to moving MC-bus out of staging
- fix sparse warnings
 v5:
   - no changes
 v6:
   - use SPDX license identifier

 drivers/staging/fsl-dpaa2/Kconfig  |8 +
 drivers/staging/fsl-dpaa2/Makefile |1 +
 drivers/staging/fsl-dpaa2/ethsw/Makefile   |   10 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h |  333 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 1091 
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h |  554 ++
 6 files changed, 1997 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/Makefile
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.h

diff --git a/drivers/staging/fsl-dpaa2/Kconfig 
b/drivers/staging/fsl-dpaa2/Kconfig
index dfff675..8a508ef 100644
--- a/drivers/staging/fsl-dpaa2/Kconfig
+++ b/drivers/staging/fsl-dpaa2/Kconfig
@@ -16,3 +16,11 @@ config FSL_DPAA2_ETH
---help---
  Ethernet driver for Freescale DPAA2 SoCs, using the
  Freescale MC bus driver
+
+config FSL_DPAA2_ETHSW
+   tristate "Freescale DPAA2 Ethernet Switch"
+   depends on FSL_DPAA2
+   depends on NET_SWITCHDEV
+   ---help---
+   Driver for Freescale DPAA2 Ethernet Switch. Select
+   BRIDGE to have support for bridge tools.
diff --git a/drivers/staging/fsl-dpaa2/Makefile 
b/drivers/staging/fsl-dpaa2/Makefile
index 0836ba8..6cfd76b 100644
--- a/drivers/staging/fsl-dpaa2/Makefile
+++ b/drivers/staging/fsl-dpaa2/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_FSL_DPAA2_ETH)+= ethernet/
+obj-$(CONFIG_FSL_DPAA2_ETHSW)  += ethsw/
diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile 
b/drivers/staging/fsl-dpaa2/ethsw/Makefile
new file mode 100644
index 000..9846e61
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for the Freescale DPAA2 Ethernet Switch
+#
+# Copyright 2014-2017 Freescale Semiconductor Inc.
+# Copyright 2017-2018 NXP
+
+obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
+
+dpaa2-ethsw-objs := dpsw.o
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
new file mode 100644
index 000..07407d5
--- /dev/null
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
@@ -0,0 +1,333 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2014-2016 Freescale Semiconductor Inc.
+ * Copyright 2017-2018 NXP
+ *
+ */
+
+#ifndef __FSL_DPSW_CMD_H
+#define __FSL_DPSW_CMD_H
+
+/* DPSW Version */
+#define DPSW_VER_MAJOR 8
+#define DPSW_VER_MINOR 0
+
+#define DPSW_CMD_BASE_VERSION  1
+#define DPSW_CMD_ID_OFFSET 4
+
+#define DPSW_CMD_ID(id)(((id) << DPSW_CMD_ID_OFFSET) | 
DPSW_CMD_BASE_VERSION)
+
+/* Command IDs */
+#define DPSW_CMDID_CLOSEDPSW_CMD_ID(0x800)
+#define DPSW_CMDID_OPEN DPSW_CMD_ID(0x802)
+
+#define DPSW_CMDID_GET_API_VERSION  DPSW_CMD_ID(0xa02)
+
+#define DPSW_CMDID_ENABLE   DPSW_CMD_ID(0x002)
+#define DPSW_CMDID_DISABLE  DPSW_CMD_ID(0x003)
+#define DPSW_CMDID_GET_ATTR DPSW_CMD_ID(0x004)
+#define DPSW_CMDID_RESETDPSW_CMD_ID(0x005)
+
+#define DPSW_CMDID_SET_IRQ_ENABLE   DPSW_CMD_ID(0x012)
+
+#define DPSW_CMDID_SET_IRQ_MASK DPSW_CMD_ID(0x014)
+
+#define DPSW_CMDID_GET_IRQ_STATUS   DPSW_CMD_ID(0x016)
+#define DPSW_CMDID_CLEAR_IRQ_STATUS DPSW_CMD_ID(0x017)
+
+#define DPSW_CMDID_IF_SET_TCI   DPSW_CMD_ID(0x030)
+#define DPSW_CMDID_IF_SET_STP   DPSW_CMD_ID(0x031)
+
+#define DPSW_CMDID_IF_GET_COUNTER   DPSW_CMD_ID(0x034)
+
+#define DPSW_CMDID_IF_ENABLEDPSW_CMD_ID(0x03D)
+#define DPSW_CMDID_IF_DISABLE   DPSW_CMD_ID(0x03E)
+
+#define DPSW_CMDID_IF_SET_MAX_FRAME_LENGTH  DPSW_CMD_ID(0x044)
+
+#define DPSW_CMDID_IF_GET_LINK_STATEDPSW_CMD_ID(0x046)
+#define DPSW_CMDID_IF_SET_FLOODING  DPSW_CMD_ID(0x047)
+#define DPSW_CMDID_IF_SET_BROADCAST DPSW_CMD_ID(0x048)
+
+#define DPSW_CMDID_VLAN_ADD DPSW_CMD_ID(0x060)
+#define DPSW_CMDID_VLAN_ADD_IF  DPSW_CMD_ID(0x061)
+#define DPSW_CMDID_VLAN_ADD_IF_UNTAGGED DPSW_CMD_ID(0x062)
+
+#define DPSW_CMDID_VLAN_REMOVE_IF   DPSW_CMD_ID(0x064)
+#define DPSW_CMDID_VLAN_REMOVE_IF_UNTAGGED  DPSW_CMD_ID(0x065)
+#define DPSW_CMDID_VLAN_REMOVE_IF_FLOODING  DPSW_CMD_ID(0x066)
+#define DPSW_CMDID_VLAN_REMOVE  DPSW_CMD_ID(0x067)
+
+#define DPSW_CMDID_FDB_ADD_UNICAST  DPSW_CMD_ID(0x084)
+#define DPSW_CMDID_FDB_REMOVE_UNICAST   

[PATCH v6 3/6] staging: fsl-dpaa2/ethsw: Add ethtool support

2018-03-14 Thread Razvan Stefanescu
Add driver information, link details and hardware statistics to be
reported via ethtool -S.

Signed-off-by: Razvan Stefanescu 
---
Changelog:
 v2:
- no changes
 v3:
- removed driver version
 v4:
- no changes
 v5:
- no changes
 v6:
- use SPDX license identifier

 drivers/staging/fsl-dpaa2/ethsw/Makefile|   2 +-
 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h  |  13 ++
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c  |  32 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h  |  32 +
 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c | 182 
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c |   1 +
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h |   2 +
 7 files changed, 263 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c

diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile 
b/drivers/staging/fsl-dpaa2/ethsw/Makefile
index 7755603..f6f2cf7 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/Makefile
+++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
@@ -7,4 +7,4 @@
 
 obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
 
-dpaa2-ethsw-objs := ethsw.o dpsw.o
+dpaa2-ethsw-objs := ethsw.o ethsw-ethtool.o dpsw.o
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
index 07407d5..1c203e6 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
@@ -49,6 +49,8 @@
 #define DPSW_CMDID_IF_SET_FLOODING  DPSW_CMD_ID(0x047)
 #define DPSW_CMDID_IF_SET_BROADCAST DPSW_CMD_ID(0x048)
 
+#define DPSW_CMDID_IF_SET_LINK_CFG  DPSW_CMD_ID(0x04C)
+
 #define DPSW_CMDID_VLAN_ADD DPSW_CMD_ID(0x060)
 #define DPSW_CMDID_VLAN_ADD_IF  DPSW_CMD_ID(0x061)
 #define DPSW_CMDID_VLAN_ADD_IF_UNTAGGED DPSW_CMD_ID(0x062)
@@ -237,6 +239,17 @@ struct dpsw_cmd_if_set_max_frame_length {
__le16 frame_length;
 };
 
+struct dpsw_cmd_if_set_link_cfg {
+   /* cmd word 0 */
+   __le16 if_id;
+   u8 pad[6];
+   /* cmd word 1 */
+   __le32 rate;
+   __le32 pad1;
+   /* cmd word 2 */
+   __le64 options;
+};
+
 struct dpsw_cmd_if_get_link_state {
__le16 if_id;
 };
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
index 3f9b86b..aefa52f 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
@@ -358,6 +358,38 @@ int dpsw_get_attributes(struct fsl_mc_io *mc_io,
 }
 
 /**
+ * dpsw_if_set_link_cfg() - Set the link configuration.
+ * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
+ * @token: Token of DPSW object
+ * @if_id: Interface id
+ * @cfg:   Link configuration
+ *
+ * Return: '0' on Success; Error code otherwise.
+ */
+int dpsw_if_set_link_cfg(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
+u16 token,
+u16 if_id,
+struct dpsw_link_cfg *cfg)
+{
+   struct mc_command cmd = { 0 };
+   struct dpsw_cmd_if_set_link_cfg *cmd_params;
+
+   /* prepare command */
+   cmd.header = mc_encode_cmd_header(DPSW_CMDID_IF_SET_LINK_CFG,
+ cmd_flags,
+ token);
+   cmd_params = (struct dpsw_cmd_if_set_link_cfg *)cmd.params;
+   cmd_params->if_id = cpu_to_le16(if_id);
+   cmd_params->rate = cpu_to_le32(cfg->rate);
+   cmd_params->options = cpu_to_le64(cfg->options);
+
+   /* send command to mc*/
+   return mc_send_command(mc_io, );
+}
+
+/**
  * dpsw_if_get_link_state - Return the link state
  * @mc_io: Pointer to MC portal's I/O object
  * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h 
b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
index 6de53f6..3335add 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.h
@@ -220,6 +220,38 @@ enum dpsw_action {
 };
 
 /**
+ * Enable auto-negotiation
+ */
+#define DPSW_LINK_OPT_AUTONEG  0x0001ULL
+/**
+ * Enable half-duplex mode
+ */
+#define DPSW_LINK_OPT_HALF_DUPLEX  0x0002ULL
+/**
+ * Enable pause frames
+ */
+#define DPSW_LINK_OPT_PAUSE0x0004ULL
+/**
+ * Enable a-symmetric pause frames
+ */
+#define DPSW_LINK_OPT_ASYM_PAUSE   0x0008ULL
+
+/**
+ * struct dpsw_link_cfg - Structure representing DPSW link configuration
+ * @rate: Rate
+ * @options: Mask of available options; use 'DPSW_LINK_OPT_' values
+ */
+struct dpsw_link_cfg {
+   u32 rate;
+   u64 options;
+};
+
+int dpsw_if_set_link_cfg(struct fsl_mc_io *mc_io,
+u32 cmd_flags,
+u16 token,
+u16 if_id,
+struct dpsw_link_cfg *cfg);
+/**
  

[PATCH v6 0/6] staging: Introduce DPAA2 Ethernet Switch driver

2018-03-14 Thread Razvan Stefanescu
This patchset introduces the Ethernet Switch Driver for Freescale/NXP SoCs
with DPAA2 (DataPath Acceleration Architecture v2). The driver manages
switch objects discovered on the fsl-mc bus. A description of the driver
can be found in the associated README file.

The patchset consists of:
* A set of libraries containing APIs for configuring and controlling
  Management Complex (MC) switch objects
* The DPAA2 Ethernet Switch driver
* Patch adding ethtool support

Limitations:
* no support for control traffic to/from CPU
* only DPSW ports can be added to a bridge

Changelog:
 v2: addressed comments from Bogdan P.

 v3: addressed comments from Andrew L. (patch 3/6 updated)

 v4: adjust to moving MC-bus out of staging
 support adding/deleting multicast entries to/from FDB
 avoid triggering console stack traces due to benign MC errors
 refactor TCI setting code to avoid code duplication
 fix sparse warning

 v5: addresed comments from Andrew L. (patch 2/6 updated)
 replace ethsw_irq0_handler() with NULL
 do not allow adding ports of the same switch to multiple bridges

 v6: addressed comment from Andrew L. and Greg KH.
 add port partitioning in the TODO file
 replace licensing text with SPDX identifier

Razvan Stefanescu (6):
  staging: fsl-dpaa2/ethsw: Add APIs for DPSW object
  staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver
  staging: fsl-dpaa2/ethsw: Add ethtool support
  staging: fsl-dpaa2/ethsw: Add maintainer for Ethernet Switch driver
  staging: fsl-dpaa2/ethsw: Add README
  staging: fsl-dpaa2/ethsw: Add TODO

 MAINTAINERS |6 +
 drivers/staging/fsl-dpaa2/Kconfig   |8 +
 drivers/staging/fsl-dpaa2/Makefile  |1 +
 drivers/staging/fsl-dpaa2/ethsw/Makefile|   10 +
 drivers/staging/fsl-dpaa2/ethsw/README  |  106 ++
 drivers/staging/fsl-dpaa2/ethsw/TODO|   14 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h  |  346 ++
 drivers/staging/fsl-dpaa2/ethsw/dpsw.c  | 1123 +
 drivers/staging/fsl-dpaa2/ethsw/dpsw.h  |  586 +
 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c |  182 +++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 1508 +++
 drivers/staging/fsl-dpaa2/ethsw/ethsw.h |   67 +
 12 files changed, 3957 insertions(+)
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/Makefile
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/README
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/TODO
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.h
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.c
 create mode 100644 drivers/staging/fsl-dpaa2/ethsw/ethsw.h

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 46/47] staging: irda: remove bfin_sir driver

2018-03-14 Thread Arnd Bergmann
The blackfin architecture is getting removed, so this
driver is now obsolete.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/irda/drivers/Kconfig|  45 --
 drivers/staging/irda/drivers/Makefile   |   1 -
 drivers/staging/irda/drivers/bfin_sir.c | 819 
 drivers/staging/irda/drivers/bfin_sir.h |  93 
 4 files changed, 958 deletions(-)
 delete mode 100644 drivers/staging/irda/drivers/bfin_sir.c
 delete mode 100644 drivers/staging/irda/drivers/bfin_sir.h

diff --git a/drivers/staging/irda/drivers/Kconfig 
b/drivers/staging/irda/drivers/Kconfig
index e070e1222733..71ac76c5295a 100644
--- a/drivers/staging/irda/drivers/Kconfig
+++ b/drivers/staging/irda/drivers/Kconfig
@@ -17,51 +17,6 @@ config IRTTY_SIR
 
  If unsure, say Y.
 
-config BFIN_SIR
-   tristate "Blackfin SIR on UART"
-   depends on BLACKFIN && IRDA
-   default n
-   help
- Say Y here if your want to enable SIR function on Blackfin UART
- devices.
-
- To activate this driver you can start irattach like:
- "irattach irda0 -s"
-
- Saying M, it will be built as a module named bfin_sir.
-
- Note that you need to turn off one of the serial drivers for SIR
- to use that UART.
-
-config BFIN_SIR0
-   bool "Blackfin SIR on UART0"
-   depends on BFIN_SIR && !SERIAL_BFIN_UART0
-
-config BFIN_SIR1
-   bool "Blackfin SIR on UART1"
-   depends on BFIN_SIR && !SERIAL_BFIN_UART1 && (!BF531 && !BF532 && 
!BF533 && !BF561)
-
-config BFIN_SIR2
-   bool "Blackfin SIR on UART2"
-   depends on BFIN_SIR && !SERIAL_BFIN_UART2 && (BF54x || BF538 || BF539)
-
-config BFIN_SIR3
-   bool "Blackfin SIR on UART3"
-   depends on BFIN_SIR && !SERIAL_BFIN_UART3 && (BF54x)
-
-choice
-   prompt "SIR Mode"
-   depends on BFIN_SIR
-   default SIR_BFIN_DMA
-
-config SIR_BFIN_DMA
-   bool "DMA mode"
-   depends on !DMA_UNCACHED_NONE
-
-config SIR_BFIN_PIO
-   bool "PIO mode"
-endchoice
-
 config SH_SIR
tristate "SuperH SIR on UART"
depends on IRDA && SUPERH && \
diff --git a/drivers/staging/irda/drivers/Makefile 
b/drivers/staging/irda/drivers/Makefile
index e2901b135528..d5307ed2d9b4 100644
--- a/drivers/staging/irda/drivers/Makefile
+++ b/drivers/staging/irda/drivers/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_MCS_FIR) += mcs7780.o
 obj-$(CONFIG_AU1000_FIR)   += au1k_ir.o
 # SIR drivers
 obj-$(CONFIG_IRTTY_SIR)+= irtty-sir.o  sir-dev.o
-obj-$(CONFIG_BFIN_SIR) += bfin_sir.o
 obj-$(CONFIG_SH_SIR)   += sh_sir.o
 # dongle drivers for SIR drivers
 obj-$(CONFIG_ESI_DONGLE)   += esi-sir.o
diff --git a/drivers/staging/irda/drivers/bfin_sir.c 
b/drivers/staging/irda/drivers/bfin_sir.c
deleted file mode 100644
index 59e409b68349..
diff --git a/drivers/staging/irda/drivers/bfin_sir.h 
b/drivers/staging/irda/drivers/bfin_sir.h
deleted file mode 100644
index d47cf14bb4a5..
-- 
2.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v5 1/6] staging: fsl-dpaa2/ethsw: Add APIs for DPSW object

2018-03-14 Thread Razvan Stefanescu
> 
> Can you resend this series and just use the correct SPDX identifiers for
> all of the new files, instead of all of this horrid boiler-plate code?
> 
> That will save me time when I have to go delete all of this in the near
> future :)
> 
> Also, why dual license it?  Are you _SURE_ you want to do that, and are
> totally aware of all of the crazy issues surrounding it?  Hint, it
> almost never means what you might think it does, and I have yet to know
> of anyone doing anything "real" with any dual-licensed Linux kernel
> code.
> 
> Remember, BSD is not the license you want/need for GPL header files that
> are exposed to userspace...
> 
> 
> thanks,
> 
> greg k-h

Thank you for your observation. I will update the patches with the SPDX 
identifiers.

Razvan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v5 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver

2018-03-14 Thread Razvan Stefanescu


> -Original Message-
> From: Andrew Lunn [mailto:and...@lunn.ch]
> Sent: Tuesday, March 13, 2018 5:26 PM
> To: Razvan Stefanescu 
> Cc: gre...@linuxfoundation.org; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org; net...@vger.kernel.org; Alexander Graf
> ; a...@arndb.de; Alexandru Marginean
> ; Ruxandra Ioana Ciocoi Radulescu
> ; Ioana Ciornei ;
> Laurentiu Tudor ; stuyo...@gmail.com
> Subject: Re: [PATCH v5 2/6] staging: fsl-dpaa2/ethsw: Add Freescale DPAA2
> Ethernet Switch driver
> 
> > Hello Andrew,
> >
> > The current driver implementation uses only a single FDB for the switch,
> > so  it is not possible configure multiple flooding domains to accommodate
> > ports partitioning.
> 
> Ah, O.K. Rather than break somebodies network by wrongly flooding, it
> would be better to return -EOPNOTSUPP when the requirement for the
> second FDB is met. The offload to hardware will then not happen, and
> the software bridge will do all the work.
> 
Thank you for your suggestion. I will add to the TODO list in v6.

Razvan
> Andrew
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 6/7] staging: wilc1000: remove unwanted braces and correct code alignment

2018-03-14 Thread Ajay Singh
On Wed, 14 Mar 2018 18:15:04 +0530
 wrote:

> From: HariPrasath Elango 
> 
> Remove the unwated brace and corrected the code block alignment
> accordingly

Changes done in this patch are already taken care. Today, Greg has
applied the patch which had these changes. This patch can be ignore from
the patchset.


Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/7] staging: wilc1000: replace switch statement by simple if condition

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

In this case,there is only a single switch case statement.So replacing
by a simple if condition.

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c901108..17bd762 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -772,14 +772,8 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
}
 
if (sme->crypto.n_akm_suites) {
-   switch (sme->crypto.akm_suites[0]) {
-   case WLAN_AKM_SUITE_8021X:
+   if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X)
auth_type = IEEE8021;
-   break;
-
-   default:
-   break;
-   }
}
 
curr_channel = pstrNetworkInfo->ch;
-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 7/7] staging: wilc1000: use kmemdup to replace kmalloc/memcpy

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

kmalloc followed by memcpy can be replaced by kmemdup.Also added the
related error handling part

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/host_interface.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0fac8e1..4ae2da6 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -992,9 +992,13 @@ static s32 handle_connect(struct wilc_vif *vif,
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
info_element_size = hif_drv->usr_conn_req.ies_len;
-   info_element = kmalloc(info_element_size, GFP_KERNEL);
-   memcpy(info_element, hif_drv->usr_conn_req.ies,
-   info_element_size);
+   info_element = kmemdup(hif_drv->usr_conn_req.ies,
+  info_element_size,
+  GFP_KERNEL);
+   if (!info_element) {
+   result = -ENOMEM;
+   goto ERRORHANDLER;
+   }
}
 
wid_list[wid_cnt].id = (u16)WID_11I_MODE;
-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7] staging: wilc1000: Fix code block alignment

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

Fix the code alignment for a block of code to adhere to coding
guidelines

Signed-off-by: HariPrasath Elango 
Reviewed-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index fe19bf3..1af3c14 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -861,10 +861,10 @@ static int wilc_mac_open(struct net_device *ndev)
break;
}
}
-   wilc_get_mac_address(vif, mac_add);
-   netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
-   memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
 
+   wilc_get_mac_address(vif, mac_add);
+   netdev_dbg(ndev, "Mac address: %pM\n", mac_add);
+   memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
memcpy(ndev->dev_addr, wl->vif[i]->src_addr, ETH_ALEN);
 
if (!is_valid_ether_addr(ndev->dev_addr)) {
-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/7] staging: wilc1000: destroy initialized mutex object

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

A mutex object that is initialized but not destroyed.This patch destroys
the mutex object

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 205304c..c901108 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2303,6 +2303,7 @@ int wilc_deinit_host_int(struct net_device *net)
 
op_ifcs--;
 
+   mutex_destroy(>scan_req_lock);
ret = wilc_deinit(vif);
 
clear_shadow_scan();
-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/7] staging: wilc1000: Destroy mutex object in deinitialization

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

Destroy the mutex object that is initialized in wlan_init_locks()

Signed-off-by: HariPrasath Elango 
Reviewed-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_wlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 1af3c14..38a83bd 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -678,6 +678,7 @@ static int wlan_deinit_locks(struct net_device *dev)
 
mutex_destroy(>hif_cs);
mutex_destroy(>rxq_cs);
+   mutex_destroy(>txq_add_to_head_cs);
 
return 0;
 }
-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/7] staging: wilc1000: use kmemdup instead of kmalloc and memcpy

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

Kmalloc followed by memcpy can be replaced by kmemdup.

Signed-off-by: HariPrasath Elango 
Reviewed-by: Ajay Singh 
---
 drivers/staging/wilc1000/linux_mon.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index f93f411..c6fd6b3 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -146,7 +146,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
if (!mgmt_tx)
return -ENOMEM;
 
-   mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
+   mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC);
if (!mgmt_tx->buff) {
kfree(mgmt_tx);
return -ENOMEM;
@@ -154,7 +154,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 
*buf, size_t len)
 
mgmt_tx->size = len;
 
-   memcpy(mgmt_tx->buff, buf, len);
wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size,
   mgmt_tx_complete);
 
-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/7] Cleanup patches for wilc1000 driver

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

This patchset has few cleanup patches related to coding guidelines and few
trivial changes

HariPrasath Elango (7):
  staging: wilc1000: Fix code block alignment
  staging: wilc1000: Destroy mutex object in deinitialization
  staging: wilc1000: use kmemdup instead of kmalloc and memcpy
  staging: wilc1000: destroy initialized mutex object
  staging: wilc1000: replace switch statement by simple if condition
  staging: wilc1000: remove unwanted braces and correct code alignment
  staging: wilc1000: use kmemdup to replace kmalloc/memcpy

 drivers/staging/wilc1000/host_interface.c | 27 +--
 drivers/staging/wilc1000/linux_mon.c  |  3 +--
 drivers/staging/wilc1000/linux_wlan.c |  7 +++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  9 ++--
 4 files changed, 22 insertions(+), 24 deletions(-)

-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wilc1000: use kmemdup to replace kmalloc/memcpy

2018-03-14 Thread
On Wed, Mar 14, 2018 at 12:38:18PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Mar 13, 2018 at 06:19:32PM +0530, hariprasath.ela...@gmail.com wrote:
> > From: HariPrasath Elango 
> > 
> > kmalloc followed by memcpy can be replaced by kmemdup.Also added the
> > related error handling part
> > 
> > Signed-off-by: HariPrasath Elango 
> > ---
> >  drivers/staging/wilc1000/host_interface.c | 10 +++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> You have sent at least 8 patches for this driver over the past day, yet
> I have no idea what order to apply these in at all.
> 
> Please resend them all as a proper patch series, numbered so I have a
> clue as to what order to apply them in.  Also preserve the acks/reviews
> that others have provided so they don't have to provide that again.
> 
> thanks,
> 
> greg k-h

Hi Greg, thanks. Yes I will send a patchset to make things easier for
you keeping in tact the review history

regards,
hari prasath
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 1/6] staging: fsl-dpaa2/ethsw: Add APIs for DPSW object

2018-03-14 Thread Greg KH
On Tue, Mar 13, 2018 at 08:51:51AM -0500, Razvan Stefanescu wrote:
> Add the command build/parse APIs for operating on DPSW objects through
> the DPAA2 Management Complex.
> 
> Signed-off-by: Razvan Stefanescu 
> ---
> Changelog:
>  v2:
> - use u8 for en parameter of dpsw_if_set_flooding/broadcast()
>  v3:
> - no changes
>  v4:
> - adjust to moving MC-bus out of staging
> - fix sparse warnings
>  v5:
>- no changes
> 
>  drivers/staging/fsl-dpaa2/Kconfig  |8 +
>  drivers/staging/fsl-dpaa2/Makefile |1 +
>  drivers/staging/fsl-dpaa2/ethsw/Makefile   |7 +
>  drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h |  358 +
>  drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 1116 
> 
>  drivers/staging/fsl-dpaa2/ethsw/dpsw.h |  579 +++
>  6 files changed, 2069 insertions(+)
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/Makefile
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.c
>  create mode 100644 drivers/staging/fsl-dpaa2/ethsw/dpsw.h
> 
> diff --git a/drivers/staging/fsl-dpaa2/Kconfig 
> b/drivers/staging/fsl-dpaa2/Kconfig
> index dfff675..8a508ef 100644
> --- a/drivers/staging/fsl-dpaa2/Kconfig
> +++ b/drivers/staging/fsl-dpaa2/Kconfig
> @@ -16,3 +16,11 @@ config FSL_DPAA2_ETH
>   ---help---
> Ethernet driver for Freescale DPAA2 SoCs, using the
> Freescale MC bus driver
> +
> +config FSL_DPAA2_ETHSW
> + tristate "Freescale DPAA2 Ethernet Switch"
> + depends on FSL_DPAA2
> + depends on NET_SWITCHDEV
> + ---help---
> + Driver for Freescale DPAA2 Ethernet Switch. Select
> + BRIDGE to have support for bridge tools.
> diff --git a/drivers/staging/fsl-dpaa2/Makefile 
> b/drivers/staging/fsl-dpaa2/Makefile
> index 0836ba8..6cfd76b 100644
> --- a/drivers/staging/fsl-dpaa2/Makefile
> +++ b/drivers/staging/fsl-dpaa2/Makefile
> @@ -3,3 +3,4 @@
>  #
>  
>  obj-$(CONFIG_FSL_DPAA2_ETH)  += ethernet/
> +obj-$(CONFIG_FSL_DPAA2_ETHSW)+= ethsw/
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/Makefile 
> b/drivers/staging/fsl-dpaa2/ethsw/Makefile
> new file mode 100644
> index 000..db137f7
> --- /dev/null
> +++ b/drivers/staging/fsl-dpaa2/ethsw/Makefile
> @@ -0,0 +1,7 @@
> +#
> +# Makefile for the Freescale DPAA2 Ethernet Switch
> +#
> +
> +obj-$(CONFIG_FSL_DPAA2_ETHSW) += dpaa2-ethsw.o
> +
> +dpaa2-ethsw-objs := dpsw.o
> diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h 
> b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
> new file mode 100644
> index 000..36edef6
> --- /dev/null
> +++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw-cmd.h
> @@ -0,0 +1,358 @@
> +/* Copyright 2013-2016 Freescale Semiconductor Inc.
> + * Copyright 2017-2018 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 the above-listed copyright holders nor the
> + *names of any 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDERS OR CONTRIBUTORS 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.
> + */

Can you resend this series and just use the correct SPDX identifiers for
all of the new files, instead of all of this horrid boiler-plate code?

That will save me time when I have to go delete all of this in the near
future :)

Also, why dual license it?  Are you _SURE_ you want to do that, and are
totally 

Re: [PATCH] staging: ccree: remove ccree staging copy

2018-03-14 Thread Greg Kroah-Hartman
On Mon, Mar 12, 2018 at 05:56:57AM -0700, Gilad Ben-Yossef wrote:
> On Thu, Mar 8, 2018 at 9:14 AM, Greg Kroah-Hartman
>  wrote:
> > On Thu, Mar 08, 2018 at 08:44:38AM +, Gilad Ben-Yossef wrote:
> >> Now when the ccree driver has been accepted into the cryptodev tree
> >> we can remove the staging tree copy.
> >
> > Yeah!  Nice job.
> >
> >>
> >> Please note that this commit may cause a merge conflict with the
> >> cryptodev tree since we needed to disable the staging copy in order
> >> to get the new copy to compile but the resolution is trivial.
> >>
> >> Signed-off-by: Gilad Ben-Yossef 
> >> ---
> >>  drivers/staging/Kconfig  |2 -
> >>  drivers/staging/Makefile |1 -
> >>  drivers/staging/ccree/Kconfig|   27 -
> >>  drivers/staging/ccree/Makefile   |7 -
> >>  drivers/staging/ccree/TODO   |   10 -
> >>  drivers/staging/ccree/cc_aead.c  | 2704 
> >> --
> >>  drivers/staging/ccree/cc_aead.h  |  109 --
> >>  drivers/staging/ccree/cc_buffer_mgr.c| 1651 --
> >>  drivers/staging/ccree/cc_buffer_mgr.h|   74 -
> >>  drivers/staging/ccree/cc_cipher.c| 1165 -
> >>  drivers/staging/ccree/cc_cipher.h|   74 -
> >>  drivers/staging/ccree/cc_crypto_ctx.h|  170 --
> >>  drivers/staging/ccree/cc_debugfs.c   |  101 --
> >>  drivers/staging/ccree/cc_debugfs.h   |   32 -
> >>  drivers/staging/ccree/cc_driver.c|  474 --
> >>  drivers/staging/ccree/cc_driver.h|  194 ---
> >>  drivers/staging/ccree/cc_fips.c  |  111 --
> >>  drivers/staging/ccree/cc_fips.h  |   37 -
> >>  drivers/staging/ccree/cc_hash.c  | 2296 -
> >>  drivers/staging/ccree/cc_hash.h  |  114 --
> >>  drivers/staging/ccree/cc_host_regs.h |  142 --
> >>  drivers/staging/ccree/cc_hw_queue_defs.h |  590 ---
> >>  drivers/staging/ccree/cc_ivgen.c |  280 
> >>  drivers/staging/ccree/cc_ivgen.h |   55 -
> >>  drivers/staging/ccree/cc_kernel_regs.h   |  167 --
> >>  drivers/staging/ccree/cc_lli_defs.h  |   59 -
> >>  drivers/staging/ccree/cc_pm.c|  122 --
> >>  drivers/staging/ccree/cc_pm.h|   57 -
> >>  drivers/staging/ccree/cc_request_mgr.c   |  713 
> >>  drivers/staging/ccree/cc_request_mgr.h   |   51 -
> >>  drivers/staging/ccree/cc_sram_mgr.c  |  107 --
> >>  drivers/staging/ccree/cc_sram_mgr.h  |   65 -
> >>  32 files changed, 11761 deletions(-)
> >>  delete mode 100644 drivers/staging/ccree/Kconfig
> >>  delete mode 100644 drivers/staging/ccree/Makefile
> >>  delete mode 100644 drivers/staging/ccree/TODO
> >>  delete mode 100644 drivers/staging/ccree/cc_aead.c
> >>  delete mode 100644 drivers/staging/ccree/cc_aead.h
> >>  delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.c
> >>  delete mode 100644 drivers/staging/ccree/cc_buffer_mgr.h
> >>  delete mode 100644 drivers/staging/ccree/cc_cipher.c
> >>  delete mode 100644 drivers/staging/ccree/cc_cipher.h
> >>  delete mode 100644 drivers/staging/ccree/cc_crypto_ctx.h
> >>  delete mode 100644 drivers/staging/ccree/cc_debugfs.c
> >>  delete mode 100644 drivers/staging/ccree/cc_debugfs.h
> >>  delete mode 100644 drivers/staging/ccree/cc_driver.c
> >>  delete mode 100644 drivers/staging/ccree/cc_driver.h
> >>  delete mode 100644 drivers/staging/ccree/cc_fips.c
> >>  delete mode 100644 drivers/staging/ccree/cc_fips.h
> >>  delete mode 100644 drivers/staging/ccree/cc_hash.c
> >>  delete mode 100644 drivers/staging/ccree/cc_hash.h
> >>  delete mode 100644 drivers/staging/ccree/cc_host_regs.h
> >>  delete mode 100644 drivers/staging/ccree/cc_hw_queue_defs.h
> >>  delete mode 100644 drivers/staging/ccree/cc_ivgen.c
> >>  delete mode 100644 drivers/staging/ccree/cc_ivgen.h
> >>  delete mode 100644 drivers/staging/ccree/cc_kernel_regs.h
> >>  delete mode 100644 drivers/staging/ccree/cc_lli_defs.h
> >>  delete mode 100644 drivers/staging/ccree/cc_pm.c
> >>  delete mode 100644 drivers/staging/ccree/cc_pm.h
> >>  delete mode 100644 drivers/staging/ccree/cc_request_mgr.c
> >>  delete mode 100644 drivers/staging/ccree/cc_request_mgr.h
> >>  delete mode 100644 drivers/staging/ccree/cc_sram_mgr.c
> >>  delete mode 100644 drivers/staging/ccree/cc_sram_mgr.h
> >>
> >> diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
> >> index e95ab68..7802c26 100644
> >> --- a/drivers/staging/Kconfig
> >> +++ b/drivers/staging/Kconfig
> >> @@ -114,8 +114,6 @@ source "drivers/staging/greybus/Kconfig"
> >>
> >>  source "drivers/staging/vc04_services/Kconfig"
> >>
> >> -source "drivers/staging/ccree/Kconfig"
> >> -
> >>  source "drivers/staging/typec/Kconfig"
> >>
> >>  source "drivers/staging/vboxvideo/Kconfig"
> >> diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
> >> index af8cd6a..56afa21 100644
> >> --- a/drivers/staging/Makefile
> >> 

Re: [PATCH] staging: lustre: o2iblnd: fix race at kiblnd_connect_peer

2018-03-14 Thread Greg Kroah-Hartman
On Fri, Mar 09, 2018 at 02:49:18AM -0500, Doug Oucharek wrote:
> From: Alexander Boyko 
> 
> cmid will be destroyed at OFED if kiblnd_cm_callback return error.
> if error happen before the end of kiblnd_connect_peer, it will touch
> destroyed cmid and fail as
> (o2iblnd_cb.c:1315:kiblnd_connect_peer())
> ASSERTION( cmid->device != ((void *)0) ) failed:
> 
> Signed-off-by: Alexander Boyko 
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10015
> Reviewed-by: Alexey Lyashkov 
> Reviewed-by: Doug Oucharek 
> Reviewed-by: John L. Hammond 
> Signed-off-by: Doug Oucharek 

Your email address here does not match the From: line :(

Please fix up and resend...

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 6/6] PCI: hv: fix 2 hang issues in hv_compose_msi_msg()

2018-03-14 Thread Lorenzo Pieralisi
On Tue, Mar 13, 2018 at 06:23:39PM +, Dexuan Cui wrote:

[...]

> Hi Lorenzo, Bjorn, and all,
> Do you need more ACKs? Currently Michael and Haiyang reviewed and ack'd 
> the patchset.
> 
> Should I send a v4 that just removes the "CC: sta...@vger.kernel.org" tag
> for patches 1, 2, 4 and 5? I tend to avoid a v4 as I supppose it would be 
> easier if you just remove the tags if you belive it's necessary (IMHO all the
> 6 paches are not big and it would be great if we can have all of them in 
> the old stable kernels, but I respect your decision).

I think you need a v4 since for patches that are actually fixing a bug I
want a Fixes: tag added and I want them to be applicable independently
of other patches in the series. Send them in a separate series if you
prefer - I just want to make sure they apply independently.

As for marking patches for stable kernels, I do not think it is right
to send cosmetic churn to stable kernels anyway, at least that's my
reading of the policy.

You can easily post a v4 with patches reshuffled - I will apply them
accordingly.

Before re-posting please read this to improve formatting (I can do it
for you but while at it you can do it yourself):

https://marc.info/?l=linux-pci=150905742808166=2

Thanks,
Lorenzo
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: ks7010: remove unnecessary brackets in single statement block

2018-03-14 Thread Greg KH
On Sun, Mar 11, 2018 at 08:22:55AM +0100, Sergio Paracuellos wrote:
> This patch fix the following sparse warning:
> braces {} are not necessary for single statement blocks

sparse gives you this warning?  Are you sure it's not checkpatch that
does this?

Please fix up and resend.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Update rf_type_definition

2018-03-14 Thread Greg KH
On Wed, Feb 07, 2018 at 06:23:34AM +0900, l4stpr0g...@gmail.com wrote:
> From: Kangmin Park 

Your subject line should say the subsystem and driver you are modifying.
Look at the hundreds of other patches on the mailing lists for examples
of how to properly format it.

> 
> enum RT_RF_TYPE_DEFINITION on rtl8723bs/include/rtw_rf.h
> is different from enum tag_HAL_RF_Type_Definition on
> rtl8723bs/include/HalVerDef.h
> 
> So, update them to be the same reference from
> enum rf_type on rtlwifi/wifi.h which recent version.
> 
> As a result, ODM_RF_TYPE_E needs to be updated as well
> Therefore, it is updated reference from enum odm_rf_type
> on rtlwifi/phydm/phydm_pre_define.h too.
> And update some additional code to check more
> chip versions that resulted from it.
> 
> Also, fixed some space required errors and
> line over 80 characters warnings by checkpatch.pl.

When you say "also", that means you should be splitting this patch up
into multpile patches.  Please only do one-thing-per-patch.

This should be a patch series, please fix it up and resend.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Fix partial warnings of checkpatch.pl for drivers/staging/greybus/i2c.c

2018-03-14 Thread Greg KH
On Tue, Mar 06, 2018 at 07:52:46PM +0100, Horatiu Vultur wrote:
> Fix partial warnings of checkpatch.pl for drivers/staging/greybus/i2c.c

What do you mean by "partial"?

And why did you not cc: the people that scripts/get_maintainer.pl told
you to?

Please provide a better description here in the changelog text and cc:
the correct people so they can review the patch.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wilc1000: use kmemdup to replace kmalloc/memcpy

2018-03-14 Thread Greg Kroah-Hartman
On Tue, Mar 13, 2018 at 06:19:32PM +0530, hariprasath.ela...@gmail.com wrote:
> From: HariPrasath Elango 
> 
> kmalloc followed by memcpy can be replaced by kmemdup.Also added the
> related error handling part
> 
> Signed-off-by: HariPrasath Elango 
> ---
>  drivers/staging/wilc1000/host_interface.c | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

You have sent at least 8 patches for this driver over the past day, yet
I have no idea what order to apply these in at all.

Please resend them all as a proper patch series, numbered so I have a
clue as to what order to apply them in.  Also preserve the acks/reviews
that others have provided so they don't have to provide that again.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[GIT PULL] Staging fixes for 4.16-rc6

2018-03-14 Thread Greg KH
The following changes since commit 4a3928c6f8a53fa1aed28ccba227742486e8ddcb:

  Linux 4.16-rc3 (2018-02-25 18:50:41 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-4.16-rc6

for you to fetch changes up to 740a5759bf222332fbb5eda42f89aa25ba38f9b2:

  staging: android: ashmem: Fix possible deadlock in ashmem_ioctl (2018-03-06 
07:21:10 -0800)


Staging fixes for 4.16-rc6

Here are 3 staging driver fixes for 4.16-rc6

Two of them are lockdep fixes for the ashmem driver that have been
reported by a number of people recently.  The last one is a fix for the
comedi driver core.

All of these have been in linux-next for a while with no reported
issues.

Signed-off-by: Greg Kroah-Hartman 


Frank Mori Hess (1):
  staging: comedi: fix comedi_nsamples_left.

Joel Fernandes (1):
  staging: android: ashmem: Fix lockdep issue during llseek

Yisheng Xie (1):
  staging: android: ashmem: Fix possible deadlock in ashmem_ioctl

 drivers/staging/android/ashmem.c | 23 ++-
 drivers/staging/comedi/drivers.c |  3 +--
 2 files changed, 11 insertions(+), 15 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: pi433: Remove comments inside code

2018-03-14 Thread hariprasath . elango
From: HariPrasath Elango 

Remove comments inbetween code as in this case.

Signed-off-by: HariPrasath Elango 
---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 88da91d..5c6a722 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -1331,7 +1331,7 @@ static int __init pi433_init(void)
 * that will key udev/mdev to add/remove /dev nodes.  Last, register
 * Last, register the driver which manages those device numbers.
 */
-   status = alloc_chrdev_region(_dev, 0 /*firstminor*/, 
N_PI433_MINORS /*count*/, "pi433" /*name*/);
+   status = alloc_chrdev_region(_dev, 0, N_PI433_MINORS, "pi433");
if (status < 0)
return status;
 
-- 
2.10.0.GIT

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: ks7010: remove useless DPRINTK traces

2018-03-14 Thread Sergio Paracuellos
On Wed, Mar 14, 2018 at 9:13 AM, Dan Carpenter  wrote:
> On Tue, Mar 13, 2018 at 05:55:20PM +0100, Sergio Paracuellos wrote:
>> @@ -786,14 +723,6 @@ void hostif_connect_indication(struct ks_wlan_private 
>> *priv)
>>
>>   switch (connect_code) {
>>   case RESULT_CONNECT:/* connect */
>> - DPRINTK(3, "connect :: scan_ind_count=%d\n",
>> - priv->scan_ind_count);
>> - if (!(priv->connect_status & FORCE_DISCONNECT))
>> - netif_carrier_on(netdev);
>> - tmp = FORCE_DISCONNECT & priv->connect_status;
>> - priv->connect_status = tmp + CONNECT_STATUS;
>> - break;
>> - case RESULT_DISCONNECT: /* disconnect */
>>   DPRINTK(3, "disconnect :: scan_ind_count=%d\n",
>>   priv->scan_ind_count);
>>   netif_carrier_off(netdev);
>
> I was on board until this chunk.  You got a bit carried away.

I do not understand how that could have happened. Sorry for this. From
now I will be more careful in reviewing my own patches.

I'll review these and send v2.

Thanks,

>
> regards,
> dan carpenter

Best regards,
   Sergio Paracuellos
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] hv_netvsc: Make sure out channel is fully opened on send

2018-03-14 Thread Mohammed Gamal
On Tue, 2018-03-13 at 12:35 -0700, Stephen Hemminger wrote:
> On Tue, 13 Mar 2018 20:06:50 +0100
> Mohammed Gamal  wrote:
> 
> > Dring high network traffic changes to network interface parameters
> > such as number of channels or MTU can cause a kernel panic with a
> > NULL
> > pointer dereference. This is due to netvsc_device_remove() being
> > called and deallocating the channel ring buffers, which can then be
> > accessed by netvsc_send_pkt() before they're allocated on calling
> > netvsc_device_add()
> > 
> > The patch fixes this problem by checking the channel state and
> > returning
> > ENODEV if not yet opened. We also move the call to
> > hv_ringbuf_avail_percent()
> > which may access the uninitialized ring buffer.
> > 
> > Signed-off-by: Mohammed Gamal 
> > ---
> >  drivers/net/hyperv/netvsc.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/hyperv/netvsc.c
> > b/drivers/net/hyperv/netvsc.c
> > index 0265d70..44a8358 100644
> > --- a/drivers/net/hyperv/netvsc.c
> > +++ b/drivers/net/hyperv/netvsc.c
> > @@ -757,7 +757,7 @@ static inline int netvsc_send_pkt(
> >     struct netdev_queue *txq = netdev_get_tx_queue(ndev,
> > packet->q_idx);
> >     u64 req_id;
> >     int ret;
> > -   u32 ring_avail = hv_ringbuf_avail_percent(_channel-
> > >outbound);
> > +   u32 ring_avail;
> >  
> >     nvmsg.hdr.msg_type = NVSP_MSG1_TYPE_SEND_RNDIS_PKT;
> >     if (skb)
> > @@ -773,7 +773,7 @@ static inline int netvsc_send_pkt(
> >  
> >     req_id = (ulong)skb;
> >  
> > -   if (out_channel->rescind)
> > +   if (out_channel->rescind || out_channel->state !=
> > CHANNEL_OPENED_STATE)
> >     return -ENODEV;
> >  
> >     if (packet->page_buf_cnt) {
> > @@ -791,6 +791,7 @@ static inline int netvsc_send_pkt(
> >        VMBUS_DATA_PACKET_FLAG_COMP
> > LETION_REQUESTED);
> >     }
> >  
> > +   ring_avail = hv_ringbuf_avail_percent(_channel-
> > >outbound);
> >     if (ret == 0) {
> >     atomic_inc_return(>queue_sends);
> >  
> 
> Thanks for your patch. Yes there are races with the current update
> logic. The root cause goes higher up in the flow; the send queues
> should
> be stopped before netvsc_device_remove is called. Solving it where
> you tried
> to is racy and not going to work reliably.
> 
> Network patches should go to net...@vger.kernel.org
> 
> You can't move the ring_avail check until after the vmbus_sendpacket
> because
> that will break the flow control logic.
> 
Why? I don't see ring_avail being used before that point.

> Instead, you should just move the avail_read check until just after
> the existing rescind
> check.
> 
> Also, you shouldn't need to check for OPENED_STATE, just rescind is
> enough.

That rarely mitigated the race. channel->rescind flag is set on vmbus
exit - called on module unload - and when a rescind offer is received
from the host, which AFAICT doesn't happen on every call to
netvsc_device_remove, so it's quite possible that the ringbuffer is
accessed before it's allocated again on channel open and hence the
check for OPENED_STAT - which is only set after all vmbus data is
initialized.

> 
> 
> 
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-14 Thread Dan Carpenter
We need a changelog.  How does this affect user space?  What bug does
this fix?

On Tue, Mar 13, 2018 at 09:00:54PM +0100, Peter Seiderer wrote:
> Signed-off-by: Peter Seiderer 
> ---
>  drivers/staging/media/imx/imx-media-csi.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/staging/media/imx/imx-media-csi.c 
> b/drivers/staging/media/imx/imx-media-csi.c
> index 5a195f80a24d..3a6a645b9dce 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -111,6 +111,7 @@ struct csi_priv {
>   struct v4l2_ctrl_handler ctrl_hdlr;
>  
>   int stream_count; /* streaming counter */
> + __u32 frame_sequence; /* frame sequence counter */

Use u32 because this is not a user space header.

>   bool last_eof;   /* waiting for last EOF at stream off */
>   bool nfb4eof;/* NFB4EOF encountered during streaming */
>   struct completion last_eof_comp;

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] hv_netvsc: Make sure out channel is fully opened on send

2018-03-14 Thread Dan Carpenter
On Tue, Mar 13, 2018 at 08:06:50PM +0100, Mohammed Gamal wrote:
> @@ -791,6 +791,7 @@ static inline int netvsc_send_pkt(
>  
> VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
>   }
>  
> + ring_avail = hv_ringbuf_avail_percent(_channel->outbound);
>   if (ret == 0) {
>   atomic_inc_return(>queue_sends);
>  

Could you move the assignment inside the "ret == 0" path closer to where
it's used?

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: ks7010: remove useless DPRINTK traces

2018-03-14 Thread Dan Carpenter
On Tue, Mar 13, 2018 at 05:55:20PM +0100, Sergio Paracuellos wrote:
> @@ -786,14 +723,6 @@ void hostif_connect_indication(struct ks_wlan_private 
> *priv)
>  
>   switch (connect_code) {
>   case RESULT_CONNECT:/* connect */
> - DPRINTK(3, "connect :: scan_ind_count=%d\n",
> - priv->scan_ind_count);
> - if (!(priv->connect_status & FORCE_DISCONNECT))
> - netif_carrier_on(netdev);
> - tmp = FORCE_DISCONNECT & priv->connect_status;
> - priv->connect_status = tmp + CONNECT_STATUS;
> - break;
> - case RESULT_DISCONNECT: /* disconnect */
>   DPRINTK(3, "disconnect :: scan_ind_count=%d\n",
>   priv->scan_ind_count);
>   netif_carrier_off(netdev);

I was on board until this chunk.  You got a bit carried away.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: staging/imx: fill vb2_v4l2_buffer sequence entry

2018-03-14 Thread Greg Kroah-Hartman
On Tue, Mar 13, 2018 at 09:00:54PM +0100, Peter Seiderer wrote:
> Signed-off-by: Peter Seiderer 
> ---
>  drivers/staging/media/imx/imx-media-csi.c | 5 +
>  1 file changed, 5 insertions(+)

I know I don't take patches with an empty changelog description, but
other maintainers might be much more forgiving... :)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel