Re: [PATCH] staging: lustre: lprocfs_status.h: fix sparse error: symbol redeclared with different type

2016-10-07 Thread Samuele Baisi



Il giorno ven 7 ott 2016 alle 5:55, Greg KH 
 ha scritto:

On Thu, Oct 06, 2016 at 06:52:07PM +0200, Samuele Baisi wrote:
 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1554:5: 
error:
 symbol 'lprocfs_wr_root_squash' redeclared with different type 
(originally
 declared at 
drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:704)

 - incompatible argument 1 (different address spaces)

 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:1618:5: 
error:
 symbol 'lprocfs_wr_nosquash_nids' redeclared with different type 
(originally
 declared at 
drivers/staging/lustre/lustre/obdclass/../include/lprocfs_status.h:706)

 - incompatible argument 1 (different address spaces)

 Added __user annotation to the header definitions arguments (which 
are

 indeed userspace buffers).


Are they really?  Have you tested this?  The last time this was looked
at, it was a non-trivial problem...


No, I haven't really tested it, I just saw they're treated like 
userspace

buffers (copy_from_user) in the function body.

if (copy_from_user(kernbuf, buffer, count)) {
 errmsg = "bad address";
 rc = -EFAULT;
 goto failed_noprint;
}

if (copy_from_user(kernbuf, buffer, count)) {
 errmsg = "bad address";
 rc = -EFAULT;
 goto failed;
}


And any reason you didn't cc the lustre maintainers with this change?
If you think it is correct, please resend it with the testing
information and cc: them.


No, it was a mistake on my part, I thought to CC lustre-devel, but it 
seems not to be

public access and then I forgot to add a Lustre mantainer.

Anyway, I do not think I'm going to have a chanche to really test it, 
so it's probably

better to dismiss the matter.

Sorry for having wasted your time.



thanks,

greg k-h


Thank you and best regards.

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


Re: [patch] staging: ion: use two separate locks for heaps and clients in ion_device

2016-10-07 Thread YiPing Xu



On 2016/10/5 2:02, Laura Abbott wrote:

On 09/30/2016 01:18 AM, Xu YiPing wrote:

ion_alloc may get into slow path to get free page,
the call stack:

__alloc_pages_slowpath
ion_page_pool_alloc_pages
alloc_buffer_page
ion_system_heap_allocate
ion_buffer_create  <-- hold ion_device->lock
ion_alloc

after that, kernel invokes low-memory killer to kill some apps in
order to free memory in android system. However, sometimes, the
killing is blocked,
the app's call stack:

rwsem_down_write_failed
down_write
ion_client_destroy
ion_release
fput
do_signal

the killing is blocked because ion_device->lock is held by ion_alloc.

ion_alloc hold the lock for accessing the heaps list,
ion_destroy_client hold the lock for accessing the clients list.

so, we can use two separate locks for heaps and clients, to avoid the
unnecessary race.



I've reviewed this and it looks okay at first pass but I don't want it
applied just yet. Ion locking is a bit of a mess and has been added


yes, and now "debugfs_mutex" and "ion_root_client" is redundant, after 
commit 49d200deaa680501f19a247b1fffb29301e51d2b and 
9fd4dcece43a53e5a9e65a973df5693702ee6401.



once piece at a time. It needs a fundamental review. There will be Ion
discussions at plumbers at the end of October. Let's come back to this
after plumbers.


Signed-off-by: Xu YiPing 
---
 drivers/staging/android/ion/ion.c | 37
-
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c
b/drivers/staging/android/ion/ion.c
index a2cf93b..331ad0f 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -46,7 +46,8 @@
  * @dev:the actual misc device
  * @buffers:an rb tree of all the existing buffers
  * @buffer_lock:lock protecting the tree of buffers
- * @lock:rwsem protecting the tree of heaps and clients
+ * @client_lock:rwsem protecting the tree of clients
+ * @heap_lock:rwsem protecting the tree of heaps
  * @heaps:list of all the heaps in the system
  * @user_clients:list of all the clients created from userspace
  */
@@ -54,7 +55,8 @@ struct ion_device {
 struct miscdevice dev;
 struct rb_root buffers;
 struct mutex buffer_lock;
-struct rw_semaphore lock;
+struct rw_semaphore client_lock;
+struct rw_semaphore heap_lock;
 struct plist_head heaps;
 long (*custom_ioctl)(struct ion_client *client, unsigned int cmd,
  unsigned long arg);
@@ -146,7 +148,7 @@ static inline void ion_buffer_page_clean(struct
page **page)
 *page = (struct page *)((unsigned long)(*page) & ~(1UL));
 }

-/* this function should only be called while dev->lock is held */
+/* this function should only be called while dev->heap_lock is held */
 static void ion_buffer_add(struct ion_device *dev,
struct ion_buffer *buffer)
 {
@@ -172,7 +174,7 @@ static void ion_buffer_add(struct ion_device *dev,
 rb_insert_color(&buffer->node, &dev->buffers);
 }

-/* this function should only be called while dev->lock is held */
+/* this function should only be called while dev->heap_lock is held */
 static struct ion_buffer *ion_buffer_create(struct ion_heap *heap,
  struct ion_device *dev,
  unsigned long len,
@@ -511,7 +513,7 @@ struct ion_handle *ion_alloc(struct ion_client
*client, size_t len,
 if (!len)
 return ERR_PTR(-EINVAL);

-down_read(&dev->lock);
+down_read(&dev->heap_lock);
 plist_for_each_entry(heap, &dev->heaps, node) {
 /* if the caller didn't specify this heap id */
 if (!((1 << heap->id) & heap_id_mask))
@@ -520,7 +522,7 @@ struct ion_handle *ion_alloc(struct ion_client
*client, size_t len,
 if (!IS_ERR(buffer))
 break;
 }
-up_read(&dev->lock);
+up_read(&dev->heap_lock);

 if (buffer == NULL)
 return ERR_PTR(-ENODEV);
@@ -713,7 +715,7 @@ static int is_client_alive(struct ion_client *client)
 node = ion_root_client->rb_node;
 dev = container_of(ion_root_client, struct ion_device, clients);

-down_read(&dev->lock);
+down_read(&dev->client_lock);
 while (node) {
 tmp = rb_entry(node, struct ion_client, node);
 if (client < tmp) {
@@ -721,12 +723,12 @@ static int is_client_alive(struct ion_client
*client)
 } else if (client > tmp) {
 node = node->rb_right;
 } else {
-up_read(&dev->lock);
+up_read(&dev->client_lock);
 return 1;
 }
 }

-up_read(&dev->lock);
+up_read(&dev->client_lock);
 return 0;
 }

@@ -841,12 +843,12 @@ struct ion_client *ion_client_create(struct
ion_device *dev,
 if (!client->name)
 goto err_free_client;

-down_write(&dev->lock);
+down_write(&dev->client_lock);
 client->display_serial = ion_get_client_serial(&dev->clients, name);
 client->display_name = kasprintf(
 GFP_KERNEL, "%s-%d"

Re: [PATCH] staging: sm750fb: Fix printk() style warning

2016-10-07 Thread Mike Rapoport
On Thu, Oct 06, 2016 at 09:27:36PM -0700, Edward Lipinsky wrote:
> On Sun, Oct 02, 2016 at 08:13:01PM +0200, Greg KH wrote:
> > On Sun, Oct 02, 2016 at 11:05:05AM -0700, Edward Lipinsky wrote:
> > > This patch fixes the checkpatch.pl warning:
> > > 
> > > WARNING: printk() should include KERN_ facility level
> > > 
> > > Signed-off-by: Edward Lipinsky 
> > > ---
> > >  drivers/staging/sm750fb/ddk750_help.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/sm750fb/ddk750_help.c 
> > > b/drivers/staging/sm750fb/ddk750_help.c
> > > index 9637dd3..e72a29c 100644
> > > --- a/drivers/staging/sm750fb/ddk750_help.c
> > > +++ b/drivers/staging/sm750fb/ddk750_help.c
> > > @@ -11,7 +11,7 @@ void ddk750_set_mmio(void __iomem *addr, unsigned short 
> > > devId, char revId)
> > >   devId750 = devId;
> > >   revId750 = revId;
> > >   if (revId == 0xfe)
> > > - printk("found sm750le\n");
> > > + pr_info("found sm750le\n");
> > 
> > Why can't you use dev_info() here?
> > 
> > thanks,
> > 
> > greg k-h
> 
> It should work, but I'm not sure what should change in the header files to
> do it--esp. to make the dev parameter available in ddk750_help.c.  (Only
> sm750.c uses dev_ style logging now, the rest of the driver still uses pr_*.)

This printk can be moved to lynxfb_pci_probe, and then it should be no
problem to use dev_info. Just make sure to update the commit message
appropriately. 
 
> Thanks,
> 
> Ed Lipinsky

--
Sincerely yours,
Mike.

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


[PATCH] staging: ks7010: remove unnecessary else statement

2016-10-07 Thread Ebru Akagunduz
This patch removes else statement which is not
usefull after a return. Issue found by checkpatch.pl.

Signed-off-by: Ebru Akagunduz 
---
 drivers/staging/ks7010/ks_wlan_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
b/drivers/staging/ks7010/ks_wlan_net.c
index b2b4fa4..1136f15 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -3426,8 +3426,8 @@ int ks_wlan_open(struct net_device *dev)
if (!priv->mac_address_valid) {
netdev_err(dev, "ks_wlan : %s Not READY !!\n", dev->name);
return -EBUSY;
-   } else
-   netif_start_queue(dev);
+   }
+   netif_start_queue(dev);
 
return 0;
 }
-- 
1.9.1

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


Re: [RFC 0/3] Add support for led triggers on phy link state change

2016-10-07 Thread Pavel Machek
Hi!

> Some drivers that include phy.h defined LED_OFF which conflicts with
> definition in leds.h. phy led support uses leds.h so the two namespaces are no
> longer isolated.
> The first two patches fix the two net drivers that declared enum constants 
> that
> conflict with enum constants in linux/leds.h.

Perhaps led patches should be cced to led mainainters?

LED SUBSYSTEM
M:  Richard Purdie 
M:  Jacek Anaszewski 
L:  linux-l...@vger.kernel.org

Pavel


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


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


[PATCH 2/3] staging: jnx: Common Juniper PCI methods

2016-10-07 Thread Pantelis Antoniou
From: Rajat Jain 

All Juniper PTX platforms, whether powerpc or x86 based, use
similar PCI bridges (PLX & IDT). We don't want to duplicate
code in different arch directories, so put them here.

Signed-off-by: Debjit Ghosh 
Signed-off-by: Guenter Roeck 
Signed-off-by: JawaharBalaji Thirumalaisamy 
Signed-off-by: Rajat Jain 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/staging/jnx/Kconfig  |   6 +
 drivers/staging/jnx/Makefile |   1 +
 drivers/staging/jnx/jnx_common_pci.c | 244 +++
 include/linux/jnx/jnx_common_pci.h   |  49 +++
 4 files changed, 300 insertions(+)
 create mode 100644 drivers/staging/jnx/jnx_common_pci.c
 create mode 100644 include/linux/jnx/jnx_common_pci.h

diff --git a/drivers/staging/jnx/Kconfig b/drivers/staging/jnx/Kconfig
index f01ef54..507f10d 100644
--- a/drivers/staging/jnx/Kconfig
+++ b/drivers/staging/jnx/Kconfig
@@ -21,6 +21,12 @@ config JNX_SYSTEM
 
 endmenu
 
+config JNX_COMMON_PCI
+   bool
+   ---help---
+ JNX common PCI code used by the quircks for configuring the PCIe
+ switches in the system.
+
 config JNX_CHIP_PCI_QUIRKS
bool
select PCI_MMCONFIG
diff --git a/drivers/staging/jnx/Makefile b/drivers/staging/jnx/Makefile
index b29699c..0171476 100644
--- a/drivers/staging/jnx/Makefile
+++ b/drivers/staging/jnx/Makefile
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_JNX_SYSTEM)   += jnx-subsys.o jnx-board-core.o
 obj-$(CONFIG_JNX_CHIP_PCI_QUIRKS)+= jnx-chip-pci-quirks.o
+obj-$(CONFIG_JNX_COMMON_PCI)   += jnx_common_pci.o
diff --git a/drivers/staging/jnx/jnx_common_pci.c 
b/drivers/staging/jnx/jnx_common_pci.c
new file mode 100644
index 000..d234465
--- /dev/null
+++ b/drivers/staging/jnx/jnx_common_pci.c
@@ -0,0 +1,244 @@
+/*
+ * Common PTXPMB Board Setup - PCI fixup code
+ *
+ * Guenter Roeck 
+ * Copyright 2012-2014 Juniper Networks
+ *
+ * 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 
+
+#define IDT_GASAADDR   0x0FF8  /* IDT Global Access Addr Reg */
+#define IDT_GASADATA   0x0FFC  /* IDT Global Access Data Reg */
+#define IDT_SWCTL  0x0003E000  /* IDT Switch Ctl Register */
+#define IDT_SWCTL_REGUNLOCKBIT(3)  /* "Unlock" bit in Switch Ctl */
+
+#define PLX_MAGIC_REG  0x660
+#define PLX_MAGIC_BIT  BIT(30)
+
+/*
+ * Use undocumented PLX technique to unlock all registers
+ * (Including the "Read only" ones)
+ */
+void plx_unlock_registers(struct pci_dev *dev)
+{
+   u32 reg32;
+
+   pci_read_config_dword(dev, PLX_MAGIC_REG, ®32);
+   pci_write_config_dword(dev, PLX_MAGIC_REG, reg32 | PLX_MAGIC_BIT);
+   pci_read_config_dword(dev, PLX_MAGIC_REG, ®32);
+}
+
+/*
+ * Lock back the Read only registers
+ */
+void plx_lock_registers(struct pci_dev *dev)
+{
+   u32 reg32;
+
+   pci_read_config_dword(dev, PLX_MAGIC_REG, ®32);
+   /*
+* This is a hack. For some reason, if I lock it back, the
+* INTERRUPT_PIN register is not getting cleared. Will need to talk to
+* PLX about this. For now, leave it unlocked.
+* pci_write_config_dword(dev, PLX_MAGIC_REG, reg32 & ~PLX_MAGIC_BIT);
+*/
+   pci_write_config_dword(dev, PLX_MAGIC_REG, reg32 | PLX_MAGIC_BIT);
+   pci_read_config_dword(dev, PLX_MAGIC_REG, ®32);
+}
+
+/*
+ * Unlock all IDT registers (include read only registers)
+ */
+void idt_48H12G2_unlock_registers(struct pci_dev *dev)
+{
+   u32 reg32;
+
+   pci_write_config_dword(dev, IDT_GASAADDR, IDT_SWCTL);
+   pci_read_config_dword(dev, IDT_GASADATA, ®32);
+   pci_write_config_dword(dev, IDT_GASAADDR, IDT_SWCTL);
+   pci_write_config_dword(dev, IDT_GASADATA, reg32 | IDT_SWCTL_REGUNLOCK);
+}
+
+/*
+ * Lock back the read only registers.
+ */
+void idt_48H12G2_lock_registers(struct pci_dev *dev)
+{
+   u32 reg32;
+
+   pci_write_config_dword(dev, IDT_GASAADDR, IDT_SWCTL);
+   pci_read_config_dword(dev, IDT_GASADATA, ®32);
+   pci_write_config_dword(dev, IDT_GASAADDR, IDT_SWCTL);
+   pci_write_config_dword(dev, IDT_GASADATA, reg32 & ~IDT_SWCTL_REGUNLOCK);
+}
+
+/*
+ * Turn a downstream port into hot-pluggable slot (to be managed by hot-plug
+ * driver) by setting the required bits in the capability registers. The
+ * function ensures that only ports with link change notification capability
+ * are turned into hotpluggable slots.
+ */
+static void make_hotpluggable_slot(struct pci_dev *dev)
+{
+   u32 reg32, psn;
+   u16 reg16;
+
+   /*
+* Only configure downstream ports as hot-pluggable
+*/
+   if (!pci_find_capability(dev

[PATCH 1/3] staging: jnx: PCI quirks for all Juniper platforms

2016-10-07 Thread Pantelis Antoniou
From: Rajat Jain 

PCI quirks for all juniper platforms. This is located here
since the same PCI devices are present on both PPC and x86
platforms, so per-arch quirks are not appropriate.

Signed-off-by: Debjit Ghosh 
Signed-off-by: Georgi Vlaev 
Signed-off-by: Guenter Roeck 
Signed-off-by: JawaharBalaji Thirumalaisamy 
Signed-off-by: Rajat Jain 
Signed-off-by: Shyamshankar Dharmarajan 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/staging/jnx/Kconfig   |   6 ++
 drivers/staging/jnx/Makefile  |   1 +
 drivers/staging/jnx/jnx-chip-pci-quirks.c | 105 ++
 3 files changed, 112 insertions(+)
 create mode 100644 drivers/staging/jnx/jnx-chip-pci-quirks.c

diff --git a/drivers/staging/jnx/Kconfig b/drivers/staging/jnx/Kconfig
index 5d2b207..f01ef54 100644
--- a/drivers/staging/jnx/Kconfig
+++ b/drivers/staging/jnx/Kconfig
@@ -21,4 +21,10 @@ config JNX_SYSTEM
 
 endmenu
 
+config JNX_CHIP_PCI_QUIRKS
+   bool
+   select PCI_MMCONFIG
+   ---help---
+ PCI quirks for the Juniper chips (ASICs, CPLDs, FPGAs)
+
 endif # JNX_DEVICES
diff --git a/drivers/staging/jnx/Makefile b/drivers/staging/jnx/Makefile
index 52b8286..b29699c 100644
--- a/drivers/staging/jnx/Makefile
+++ b/drivers/staging/jnx/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_JNX_SYSTEM)   += jnx-subsys.o jnx-board-core.o
+obj-$(CONFIG_JNX_CHIP_PCI_QUIRKS)+= jnx-chip-pci-quirks.o
diff --git a/drivers/staging/jnx/jnx-chip-pci-quirks.c 
b/drivers/staging/jnx/jnx-chip-pci-quirks.c
new file mode 100644
index 000..f90b4c7
--- /dev/null
+++ b/drivers/staging/jnx/jnx-chip-pci-quirks.c
@@ -0,0 +1,105 @@
+/*
+ * Common Juniper ASICs - PCI fixup code
+ *
+ * Guenter Roeck 
+ * Copyright 2012-2014 Juniper Networks
+ *
+ * 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 
+
+#define INTEL_DEBUG_REG 0x8F8
+#define INTEL_DEBUG_REG_IGNORE_GEN  BIT(3)
+
+static void jnx_init_fpga(struct pci_dev *dev)
+{
+   /*
+* PCI class reported by Juniper FPGAs (SAM/PAM) is
+* "Unassigned class [ff00]". Change it to something more appropriate.
+*/
+   dev->class = PCI_CLASS_SYSTEM_OTHER << 8;
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JUNIPER, PCI_DEVICE_ID_JNX_SAM,
+   jnx_init_fpga);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JUNIPER, PCI_DEVICE_ID_JNX_SAM_OMEGA,
+   jnx_init_fpga);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JUNIPER, PCI_DEVICE_ID_JNX_SAM_X,
+   jnx_init_fpga);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JUNIPER, PCI_DEVICE_ID_JNX_PAM,
+   jnx_init_fpga);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JUNIPER, PCI_DEVICE_ID_JNX_CBC,
+   jnx_init_fpga);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JUNIPER, PCI_DEVICE_ID_JNX_CBC_P2,
+   jnx_init_fpga);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JUNIPER, PCI_DEVICE_ID_JNX_OMG_CBC,
+   jnx_init_fpga);
+
+static struct dmi_system_id jnx_asic_pci_bug_affected_platforms[] = {
+   {
+   .ident = "Juniper Networks PTX MLC Card",
+   .matches = {
+   DMI_MATCH(DMI_BOARD_VENDOR, "Juniper Networks Inc."),
+   DMI_MATCH(DMI_BOARD_NAME, "0C0A")
+   },
+   },
+   {},
+};
+MODULE_DEVICE_TABLE(dmi, jnx_asic_pci_bug_affected_platforms);
+
+/*
+ * Juniper Broadway ASICs have an issue where they report incorrect gen type
+ * (Gen-1 / Gen-2) for the PCIe link to the root port.
+ * This workaround needs to be applied to each Intel root port which connects
+ * to a juniper ASIC. It causes the root port to ignore the incorrect fields.
+ */
+static void fixup_intel_root_port(struct pci_dev *dev)
+{
+   struct pci_dev *rootport = dev;
+   u32 tmp32;
+   int ret = 0;
+
+   while (!pci_is_root_bus(rootport->bus))
+   rootport = pci_upstream_bridge(rootport);
+
+   if (rootport->vendor != PCI_VENDOR_ID_INTEL)
+   return;
+
+   ret = pci_read_config_dword(rootport, INTEL_DEBUG_REG, &tmp32);
+   tmp32 |= INTEL_DEBUG_REG_IGNORE_GEN;
+   ret |= pci_write_config_dword(rootport, INTEL_DEBUG_REG, tmp32);
+   if (ret)
+   dev_err(&rootport->dev,
+   "Error applying Intel root port quirk! 
CONFIG_PCI_MMCONFIG not selected?\n");
+}
+
+/*
+ * The TL/TQ ASICs report their device class as PCI_CLASS_NOT_DEFINED.
+ * Linux does not configure memory access for this class,
+ * so we have to ajust it to something acceptable.
+ */
+static void jnx_init_asic(struct pci_dev *dev)
+{
+   dev->class = PCI_CLASS_NETWORK_OTHER << 8;
+
+   if (dmi_check_system(jnx_asic_pci_bug_affected_platforms))
+   fixup_intel_root

[PATCH 3/3] staging: jnx: pex8xxx I2C interface driver

2016-10-07 Thread Pantelis Antoniou
From: Rajat Jain 

Some Juniper platforms contain an Avago PEX8614, PEX8616 or PEX8713
PCI express switch which is controlled via a I2C interface.

This driver provides a sysfs interface for configuration from
user-space.

Signed-off-by: Guenter Roeck 
Signed-off-by: Rajat Jain 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/staging/jnx/Kconfig   |   7 +
 drivers/staging/jnx/Makefile  |   1 +
 drivers/staging/jnx/pex8xxx_i2c.c | 509 ++
 3 files changed, 517 insertions(+)
 create mode 100644 drivers/staging/jnx/pex8xxx_i2c.c

diff --git a/drivers/staging/jnx/Kconfig b/drivers/staging/jnx/Kconfig
index 507f10d..b57e93b 100644
--- a/drivers/staging/jnx/Kconfig
+++ b/drivers/staging/jnx/Kconfig
@@ -33,4 +33,11 @@ config JNX_CHIP_PCI_QUIRKS
---help---
  PCI quirks for the Juniper chips (ASICs, CPLDs, FPGAs)
 
+config JNX_PEX8XXX_I2C
+   tristate "PLX PEX8xxx switch I2C driver"
+   depends on I2C
+   ---help---
+ Driver for the I2C interface of PLX PEX8XXX devices
+ (Currently supports PEX8614, PEX8618, PEX8713)
+
 endif # JNX_DEVICES
diff --git a/drivers/staging/jnx/Makefile b/drivers/staging/jnx/Makefile
index 0171476..90526b1 100644
--- a/drivers/staging/jnx/Makefile
+++ b/drivers/staging/jnx/Makefile
@@ -5,3 +5,4 @@
 obj-$(CONFIG_JNX_SYSTEM)   += jnx-subsys.o jnx-board-core.o
 obj-$(CONFIG_JNX_CHIP_PCI_QUIRKS)+= jnx-chip-pci-quirks.o
 obj-$(CONFIG_JNX_COMMON_PCI)   += jnx_common_pci.o
+obj-$(CONFIG_JNX_PEX8XXX_I2C)  += pex8xxx_i2c.o
diff --git a/drivers/staging/jnx/pex8xxx_i2c.c 
b/drivers/staging/jnx/pex8xxx_i2c.c
new file mode 100644
index 000..2414121
--- /dev/null
+++ b/drivers/staging/jnx/pex8xxx_i2c.c
@@ -0,0 +1,509 @@
+/*
+ * An I2C driver for the PEX8xxx I2C slave interface
+ *
+ * Rajat Jain 
+ * Copyright 2014 Juniper Networks
+ *
+ * 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 
+
+/* Supported devices */
+enum chips { pex8614, pex8618, pex8713 };
+
+#define MAXSTN 2
+#define MAXMODE4
+
+/* Common Register defines */
+#define PEX8XXX_CMD(val)   (((val) & 7) << 24)
+#define PEX8XXX_CMD_WR 0x03
+#define PEX8XXX_CMD_RD 0x04
+
+#define PEX8XXX_BYTE_ENA(val)  (((val) & 0xF) << 10)
+#define BYTE0  0x01
+#define BYTE1  0x02
+#define BYTE2  0x04
+#define BYTE3  0x08
+#define BYTE_ALL   0x0F
+
+#define PEX8XXX_REG(val)   (((val) >> 2) & 0x3FF)
+
+/* PEX8614/8618 Device specific register defines */
+#define PEX861X_PORT(val)  (((val) & 0x1F) << 15)
+
+#define PEX861X_I2C_CMD(cmd, port, mode, stn, reg, mask)   \
+   (PEX8XXX_CMD(cmd) | \
+PEX861X_PORT(port) |   \
+PEX8XXX_BYTE_ENA(mask) |   \
+PEX8XXX_REG(reg))
+
+/* PEX8713 Device specific register defines */
+#define PEX8713_MODE(val)  (((val) & 3) << 20)
+#define PEX8713_MODE_TRANSPARENT0x00
+#define PEX8713_MODE_NT_LINK   0x01
+#define PEX8713_MODE_NT_VIRT   0x02
+#define PEX8713_MODE_DMA   0x03
+
+#define PEX8713_STN(val)   (((val) & 3) << 18)
+
+#define PEX8713_PORT(val)  (((val) & 7) << 15)
+
+#define PEX8713_I2C_CMD(cmd, port, mode, stn, reg, mask)   \
+   (PEX8XXX_CMD(cmd) | \
+PEX8713_MODE(mode) |   \
+PEX8713_STN(stn) | \
+PEX8713_PORT(port) |   \
+PEX8XXX_BYTE_ENA(mask) |   \
+PEX8XXX_REG(reg))
+
+struct pex8xxx_dev {
+   enum chips  devtype;
+   u32 reg_addr;
+   u8  port_num;
+   u8  port_mode;  /* PEX8713 only */
+   u8  port_stn;   /* PEX8713 only */
+   struct attribute_group  attr_group;
+   bool (*port_is_valid)(u8 port);
+};
+
+static inline struct pex8xxx_dev *pex8xxx_get_drvdata(struct device *dev)
+{
+   struct i2c_client *client = to_i2c_client(dev);
+
+   return i2c_get_clientdata(client);
+}
+
+static int pex8xxx_read(struct i2c_client *client, u8 stn, u8 mode, u8 mask,
+   u8 port, u32 reg, u32 *val)
+{
+   struct pex8xxx_dev *pex8xxx = i2c_get_clientdata(client);
+   __be32 cmd, data;
+   int ret;
+
+   struct i2c_msg msgs[2] = {
+   {
+   .addr = client->addr,
+   .len = 4,
+   .flags = 0,
+ 

[PATCH 0/2] Juniper infrastructure

2016-10-07 Thread Pantelis Antoniou
Introduce a staging driver containing all the bit and
pieces of Juniper's board support infrastructure that don't quite
fit in any other place.

The Juniper series of routers comprise of both x86 and powerpc
platforms that contain similar hardware components necessitating
common support methods.

Note that this is the first submission and we expect things to be
moved around as required.

This patchset is against mainline as of today: v4.8-9431-g3477d16
and is dependent on the "Juniper prerequisites" patchset sent
earlier.

Rajat Jain (1):
  jnx: Introduce include/linux/jnx/pci_ids.h

Tom Kavanagh (1):
  staging: jnx: Juniper subsystem & board core APIs

 Documentation/ABI/testing/sysfs-platform-jnx | 170 +++
 drivers/staging/Kconfig  |   2 +
 drivers/staging/Makefile |   1 +
 drivers/staging/jnx/Kconfig  |  24 +
 drivers/staging/jnx/Makefile |   5 +
 drivers/staging/jnx/jnx-board-core.c | 247 ++
 drivers/staging/jnx/jnx-subsys-private.h |  35 ++
 drivers/staging/jnx/jnx-subsys.c | 655 +++
 include/linux/jnx/jnx-board-core.h   |  41 ++
 include/linux/jnx/jnx-subsys.h   |  94 
 include/linux/jnx/pci_ids.h  |  66 +++
 11 files changed, 1340 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-jnx
 create mode 100644 drivers/staging/jnx/Kconfig
 create mode 100644 drivers/staging/jnx/Makefile
 create mode 100644 drivers/staging/jnx/jnx-board-core.c
 create mode 100644 drivers/staging/jnx/jnx-subsys-private.h
 create mode 100644 drivers/staging/jnx/jnx-subsys.c
 create mode 100644 include/linux/jnx/jnx-board-core.h
 create mode 100644 include/linux/jnx/jnx-subsys.h
 create mode 100644 include/linux/jnx/pci_ids.h

-- 
1.9.1

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


[PATCH 2/2] jnx: Introduce include/linux/jnx/pci_ids.h

2016-10-07 Thread Pantelis Antoniou
From: Rajat Jain 

Add this header to contain the PCI device IDs that we cannot add in
the linux pci_ids.h. This would contain PCI device IDs of
Juniper devices as well as any PCIe switches etc.

Signed-off-by: Rajat Jain 
Signed-off-by: Debjit Ghosh 
Signed-off-by: Georgi Vlaev 
Signed-off-by: Guenter Roeck 
Signed-off-by: Mohammad Kamil 
Signed-off-by: Shyamshankar Dharmarajan 
Signed-off-by: Tom Kavanagh 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 include/linux/jnx/pci_ids.h | 66 +
 1 file changed, 66 insertions(+)
 create mode 100644 include/linux/jnx/pci_ids.h

diff --git a/include/linux/jnx/pci_ids.h b/include/linux/jnx/pci_ids.h
new file mode 100644
index 000..8c86aa8
--- /dev/null
+++ b/include/linux/jnx/pci_ids.h
@@ -0,0 +1,66 @@
+/*
+ * Juniper PCI ID(s) - for devices on Juniper Boards
+ *
+ * Rajat Jain 
+ * Copyright 2014 Juniper Networks
+ *
+ * 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.
+ */
+
+#ifndef __JNX_PCI_IDS_H__
+#define __JNX_PCI_IDS_H__
+
+#define PCI_VENDOR_ID_JUNIPER  0x1304
+
+/*
+ * PTX SAM FPGA, device ID as present on various Juniper boards, such as
+ * - Sangria FPC
+ * - Hendricks FPC
+ * - Sangria 24x10GE PIC
+ * - Gladiator FPC
+ */
+#define PCI_DEVICE_ID_JNX_SAM  0x0004
+
+/* Juniper Broadway ASIC family */
+#define PCI_DEVICE_ID_JNX_TF   0x003c
+#define PCI_DEVICE_ID_JNX_TL   0x003d
+#define PCI_DEVICE_ID_JNX_TQ   0x003e
+#define PCI_DEVICE_ID_JNX_OTN_FRAMER   0x0055
+#define PCI_DEVICE_ID_JNX_PE   0x005e
+#define PCI_DEVICE_ID_JNX_PF   0x005f  /* Juniper Paradise ASIC */
+
+/* Juniper SAM FPGA - Omega SIB, Sochu SHAM, Gladiator SIB */
+#define PCI_DEVICE_ID_JNX_SAM_OMEGA0x006a
+
+/* Juniper SAM FPGA - present on GLD FPC board */
+#define PCI_DEVICE_ID_JNX_SAM_X0x006b
+
+/* Juniper PAM FPGA - present on PTX MLC board */
+#define PCI_DEVICE_ID_JNX_PAM  0x006c
+/* Juniper CBC FPGA - present on PTX1K RCB */
+#define PCI_DEVICE_ID_JNX_CBC  0x006e
+#define PCI_DEVICE_ID_JNX_CBC_P2   0x0079
+#define PCI_DEVICE_ID_JNX_OMG_CBC  0x0083
+
+/* Other Vendors' devices */
+#define PCI_DEVICE_ID_IDT_PES12NT3_TRANS_AB0x8058
+#define PCI_DEVICE_ID_IDT_PES12NT3_TRANS_C 0x8059
+#define PCI_DEVICE_ID_IDT_PES12NT3_INT_NTB_C   0x805a
+#define PCI_DEVICE_ID_IDT_48H12G2  0x807a
+#define PCI_DEVICE_ID_IDT_PES24NT24G2  0x808e
+#define PCI_DEVICE_ID_IDT_PES16NT16G2  0x8090
+
+#define PCI_DEVICE_ID_PLX_8614 0x8614
+#define PCI_DEVICE_ID_PLX_8618 0x8618
+#define PCI_DEVICE_ID_PLX_8713 0x8713
+
+/*
+ *  Juniper CBD FPGA Device ID(s)
+ */
+#define JNX_CBD_FPGA_DID_09B3   0x004D
+#define JNX_CBD_FPGA_DID_0BA8   0x005A
+
+#endif /* __JNX_PCI_IDS_H__ */
-- 
1.9.1

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


[PATCH 0/3] Juniper PCI methods

2016-10-07 Thread Pantelis Antoniou
Introduce PCI methods and infrastructure dealing with the
peculiarities of Juniper PTX series of routers.

The Juniper series of routers comprise of both x86 and powerpc
platforms that contain similar hardware components necessitating
common support methods.

Note that this is the first submission and we expect things to be
moved around as required.

This patchset is against mainline as of today: v4.8-9431-g3477d16
and is dependent on the "Juniper prerequisites" and
"Juniper infrastructure" patchsets sent earlier.

Rajat Jain (3):
  staging: jnx: PCI quirks for all Juniper platforms
  staging: jnx: Common Juniper PCI methods
  staging: jnx: pex8xxx I2C interface driver

 drivers/staging/jnx/Kconfig   |  19 ++
 drivers/staging/jnx/Makefile  |   3 +
 drivers/staging/jnx/jnx-chip-pci-quirks.c | 105 ++
 drivers/staging/jnx/jnx_common_pci.c  | 244 ++
 drivers/staging/jnx/pex8xxx_i2c.c | 509 ++
 include/linux/jnx/jnx_common_pci.h|  49 +++
 6 files changed, 929 insertions(+)
 create mode 100644 drivers/staging/jnx/jnx-chip-pci-quirks.c
 create mode 100644 drivers/staging/jnx/jnx_common_pci.c
 create mode 100644 drivers/staging/jnx/pex8xxx_i2c.c
 create mode 100644 include/linux/jnx/jnx_common_pci.h

-- 
1.9.1

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


Re: [PATCH 0/2] Juniper infrastructure

2016-10-07 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2016 at 06:15:44PM +0300, Pantelis Antoniou wrote:
> Introduce a staging driver containing all the bit and
> pieces of Juniper's board support infrastructure that don't quite
> fit in any other place.

Why staging?

> The Juniper series of routers comprise of both x86 and powerpc
> platforms that contain similar hardware components necessitating
> common support methods.
> 
> Note that this is the first submission and we expect things to be
> moved around as required.
> 
> This patchset is against mainline as of today: v4.8-9431-g3477d16
> and is dependent on the "Juniper prerequisites" patchset sent
> earlier.

sent where?  Why not just make a single patch series?

> Rajat Jain (1):
>   jnx: Introduce include/linux/jnx/pci_ids.h
> 
> Tom Kavanagh (1):
>   staging: jnx: Juniper subsystem & board core APIs
> 
>  Documentation/ABI/testing/sysfs-platform-jnx | 170 +++
>  drivers/staging/Kconfig  |   2 +
>  drivers/staging/Makefile |   1 +
>  drivers/staging/jnx/Kconfig  |  24 +
>  drivers/staging/jnx/Makefile |   5 +
>  drivers/staging/jnx/jnx-board-core.c | 247 ++
>  drivers/staging/jnx/jnx-subsys-private.h |  35 ++
>  drivers/staging/jnx/jnx-subsys.c | 655 
> +++
>  include/linux/jnx/jnx-board-core.h   |  41 ++
>  include/linux/jnx/jnx-subsys.h   |  94 
>  include/linux/jnx/pci_ids.h  |  66 +++


staging drivers have to be self-contained, no files outside of your
subdirectory please.

Once they have "passed" proper review, then you can move files out.

Also, I need a TODO file listing what needs to be done, who to contact,
and other info about the code.

And again, why not just submit this to the real part of the kernel?

thanks,

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


[PATCH 2/6] gpio: Add support for PTX1K CBC FPGA spare GPIOs

2016-10-07 Thread Pantelis Antoniou
From: Georgi Vlaev 

Add support for the GPIO block in Juniper's CBC FPGA.

A number of GPIOs exported by different kind of boards
is supported.

Signed-off-by: Georgi Vlaev 
Signed-off-by: Guenter Roeck 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/gpio/Kconfig|  11 +++
 drivers/gpio/Makefile   |   1 +
 drivers/gpio/gpio-cbc.c | 236 
 3 files changed, 248 insertions(+)
 create mode 100644 drivers/gpio/gpio-cbc.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 281029b..b29f521 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -147,6 +147,17 @@ config GPIO_BRCMSTB
help
  Say yes here to enable GPIO support for Broadcom STB (BCM7XXX) SoCs.
 
+config GPIO_CBC
+   tristate "Juniper Networks PTX1K CBC GPIO support"
+   depends on MFD_JUNIPER_CBC
+   default y if MFD_JUNIPER_CBC
+   help
+ This driver supports the spare GPIO interfaces on the Juniper
+ PTX1K CBC.
+
+ This driver can also be built as a module.  If so, the module
+ will be called gpio-cbc.
+
 config GPIO_CLPS711X
tristate "CLPS711X GPIO support"
depends on ARCH_CLPS711X || COMPILE_TEST
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index ec890c7..78dd0d4 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_GPIO_AXP209) += gpio-axp209.o
 obj-$(CONFIG_GPIO_BCM_KONA)+= gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)   += gpio-bt8xx.o
+obj-$(CONFIG_GPIO_CBC) += gpio-cbc.o
 obj-$(CONFIG_GPIO_CLPS711X)+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_CS5535)  += gpio-cs5535.o
 obj-$(CONFIG_GPIO_CRYSTAL_COVE)+= gpio-crystalcove.o
diff --git a/drivers/gpio/gpio-cbc.c b/drivers/gpio/gpio-cbc.c
new file mode 100644
index 000..d698f00
--- /dev/null
+++ b/drivers/gpio/gpio-cbc.c
@@ -0,0 +1,236 @@
+/*
+ * Polaris CBC 8614, 8112, SIB, FPC, FTC Spare GPIO driver
+ *
+ * Copyright 2014 Juniper Networks
+ *
+ * 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 
+
+#define CBC_GPIO_DIR   0x00
+#define CBC_GPIO_OUTPUT0x04
+#define CBC_GPIO_INPUT 0x08
+
+struct cbc_gpio {
+   u32 reg;/* start register offset */
+   u32 ngpio;  /* number of GPIOs */
+   u32 offset; /* start offset of the fisrt GPIO */
+};
+
+#define CBC_GPIO(r, n, o) { .reg = r, .ngpio = n, .offset = o }
+
+static struct cbc_gpio cbc_gpios[] = {
+   CBC_GPIO(CBC_TOP_REGS_GPIO_CTRL, 12, 0), /* GPIO_8614-GPIO_8112 */
+   CBC_GPIO(CBC_TOP_REGS_SIB_SPARE_OUTPUTENABLE, 18, 0), /* SIB_SPARE */
+   CBC_GPIO(CBC_TOP_REGS_FPC_SPARE_OUTPUTENABLE, 32, 0), /* FPC_SPARE */
+   CBC_GPIO(CBC_TOP_REGS_OTHER_SPARE_OUTPUTENABLE, 10, 1) /* OTHER_SPARE */
+};
+
+/*
+ * struct cbc_gpio_chip
+ */
+struct cbc_gpio_chip {
+   void __iomem *base;
+   struct device *dev;
+   struct gpio_chip chip;
+   u32 gpio_state;
+   u32 gpio_dir;
+   u32 offset;
+   spinlock_t gpio_lock;
+};
+
+/*
+ * cbc_gpio_get - Read the specified signal of the GPIO device.
+ */
+static int cbc_gpio_get(struct gpio_chip *gc, unsigned int gpio)
+{
+   struct cbc_gpio_chip *chip =
+   container_of(gc, struct cbc_gpio_chip, chip);
+
+   return !!(ioread32(chip->base + CBC_GPIO_INPUT) &
+   BIT(gpio));
+}
+
+/*
+ * cbc_gpio_set - Write the specified signal of the GPIO device.
+ */
+static void cbc_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+   unsigned long flags;
+   struct cbc_gpio_chip *chip =
+   container_of(gc, struct cbc_gpio_chip, chip);
+
+   spin_lock_irqsave(&chip->gpio_lock, flags);
+
+   /* Write to GPIO signal and set its direction to output */
+   if (val)
+   chip->gpio_state |= BIT(gpio);
+   else
+   chip->gpio_state &= ~BIT(gpio);
+
+   iowrite32(chip->gpio_state, chip->base + CBC_GPIO_OUTPUT);
+
+   spin_unlock_irqrestore(&chip->gpio_lock, flags);
+}
+
+/*
+ * cbc_gpio_dir_in - Set the direction of the specified GPIO signal as input.
+ */
+static int cbc_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
+{
+   unsigned long flags;
+   struct cbc_gpio_chip *chip =
+   container_of(gc, struct cbc_gpio_chip, chip);
+
+   spin_lock_irqsave(&chip->gpio_lock, flags);
+
+   chip->gpio_dir &= ~BIT(gpio);
+   iowrite32(chip->gpio_dir, chip->base + CBC_GPIO_DIR);
+
+   spin_unlock_irqrestore(&chip->gpio_lock, flags);
+
+   return 0;
+}
+
+/*
+ * cbc_gpio_dir_out - Set the direction of the specified GPIO signal as output.
+ */

[PATCH 6/6] staging: jnx: CBD-FPGA infrastructure

2016-10-07 Thread Pantelis Antoniou
From: Tom Kavanagh 

Every Juniper platform contains a CBD (Control Board) FPGA.

While each CBD FPGA is different, a common abstact API makes
handling them common for every platform and the same parts
they have can be factored out.

The supported CBDs are PTX1K, PTX21K, PTX3K & PTX5K.

Signed-off-by: Georgi Vlaev 
Signed-off-by: Guenter Roeck 
Signed-off-by: JawaharBalaji Thirumalaisamy 
Signed-off-by: Mohammad Kamil 
Signed-off-by: Tom Kavanagh 
Signed-off-by: Debjit Ghosh 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/staging/jnx/Kconfig |  34 ++
 drivers/staging/jnx/Makefile|   5 +
 drivers/staging/jnx/jnx-cbc-ptx1k.c | 242 +
 drivers/staging/jnx/jnx-cbd-fpga-common.c   | 332 +
 drivers/staging/jnx/jnx-cbd-fpga-common.h   |  27 ++
 drivers/staging/jnx/jnx-cbd-fpga-core.c | 540 
 drivers/staging/jnx/jnx-cbd-fpga-core.h |  68 
 drivers/staging/jnx/jnx-cbd-fpga-platdata.h |  51 +++
 drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c| 134 +++
 drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c   | 143 
 drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c| 111 ++
 drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c| 107 ++
 12 files changed, 1794 insertions(+)
 create mode 100644 drivers/staging/jnx/jnx-cbc-ptx1k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-common.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-common.h
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-core.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-core.h
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-platdata.h
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c

diff --git a/drivers/staging/jnx/Kconfig b/drivers/staging/jnx/Kconfig
index 4c38fc2..cd29276 100644
--- a/drivers/staging/jnx/Kconfig
+++ b/drivers/staging/jnx/Kconfig
@@ -34,6 +34,40 @@ config JNX_CONNECTOR
  This driver can also be built as a module.  If so, the module
  will be called jnx-connector.
 
+config JNX_CBD_FPGA
+   tristate "Juniper Generic CBD FPGA"
+   select I2C_MUX
+   help
+ Driver to support the Juniper Control Board (CBD) FPGA.  Provides all
+ common functionality for device across all supported juniper 
platforms.
+
+ This driver can also be built as a module.  If so, the module
+ will be called jnx-cbd-fpga.
+
+config JNX_CBD_FPGA_PTX21K
+   tristate "Juniper PTX21K CBC FPGA"
+   depends on JNX_SYSTEM && MFD_JUNIPER_CBC && JNX_PTX21K_BOARDS
+   depends on JNX_PTX21K_RCB
+   default m
+   help
+ Driver to support the Juniper Control Board (CBC) FPGA in PTX21K.
+ Provides hooks for the common fpga handling core for these
+ particular Juniper Boards.
+
+ When compiled as a module it is included in jnx-cbd-fpga.
+
+config JNX_CBD_FPGA_PTX1K
+   tristate "Juniper PTX1K CBC FPGA"
+   depends on JNX_SYSTEM && MFD_JUNIPER_CBC && JNX_PTX1K_BOARDS
+   depends on JNX_CBD_FPGA_PTX21K
+   help
+ Driver to support the Juniper Control Board (CBC) FPGA in PTX1K.
+ Provides all common functionality for device across platforms and
+ hooks for the common fpga handling core for these particular
+ Juniper Boards.
+
+ When compiled as a module it is included in jnx-cbd-fpga.
+
 endmenu
 
 config JNX_COMMON_PCI
diff --git a/drivers/staging/jnx/Makefile b/drivers/staging/jnx/Makefile
index c89e701..b937896 100644
--- a/drivers/staging/jnx/Makefile
+++ b/drivers/staging/jnx/Makefile
@@ -7,3 +7,8 @@ obj-$(CONFIG_JNX_CHIP_PCI_QUIRKS)+= jnx-chip-pci-quirks.o
 obj-$(CONFIG_JNX_COMMON_PCI)   += jnx_common_pci.o
 obj-$(CONFIG_JNX_PEX8XXX_I2C)  += pex8xxx_i2c.o
 obj-$(CONFIG_JNX_CONNECTOR)+= jnx-connector.o
+obj-$(CONFIG_JNX_CBD_FPGA) += jnx-cbd-fpga.o jnx-cbd-fpga-common.o
+obj-$(CONFIG_JNX_CBD_FPGA_PTX1K)+= jnx-cbd-ptx1k.o
+obj-$(CONFIG_JNX_CBD_FPGA_PTX21K)+= jnx-cbd-fpga-ptx21k.o
+jnx-cbd-fpga-y := jnx-cbd-fpga-core.o jnx-cbd-fpga-ptx5k.o jnx-cbd-fpga-ptx3k.o
+jnx-cbd-ptx1k-y := jnx-cbc-ptx1k.o jnx-cbd-fpga-ptx1k.o
diff --git a/drivers/staging/jnx/jnx-cbc-ptx1k.c 
b/drivers/staging/jnx/jnx-cbc-ptx1k.c
new file mode 100644
index 000..7eff5ce
--- /dev/null
+++ b/drivers/staging/jnx/jnx-cbc-ptx1k.c
@@ -0,0 +1,242 @@
+/*
+ * Juniper Generic Control Board (CB) FPGA Driver
+ *
+ * Copyright (C) 2012, 2013, 2014 Juniper Networks. All rights reserved.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it w

[PATCH 3/6] gpio: gpio-cbc: Document bindings of CBC FPGA GPIO block

2016-10-07 Thread Pantelis Antoniou
From: Georgi Vlaev 

Add device tree bindings document for the GPIO driver of
Juniper's CBC FPGA.

Signed-off-by: Georgi Vlaev 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 .../devicetree/bindings/gpio/jnx,gpio-cbc.txt  | 30 ++
 1 file changed, 30 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/jnx,gpio-cbc.txt

diff --git a/Documentation/devicetree/bindings/gpio/jnx,gpio-cbc.txt 
b/Documentation/devicetree/bindings/gpio/jnx,gpio-cbc.txt
new file mode 100644
index 000..d205d0b
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/jnx,gpio-cbc.txt
@@ -0,0 +1,30 @@
+Juniper CBC FPGA GPIO block
+
+Required properties:
+
+- compatible:
+Must be "jnx,cbc-gpio"
+
+Optional properties:
+
+- reg:
+Address and length of the register set for the device. This is optional 
since
+usually the parent MFD driver fills it in.
+
+- #gpio-cells:
+Should be <2>.  The first cell is the pin number (within the controller's
+pin space), and the second is used for the following flags:
+   bit[0]: direction (0 = out, 1 = in)
+   bit[1]: init high
+   bit[2]: active low
+
+- gpio-controller:
+Specifies that the node is a GPIO controller.
+
+Example:
+
+gpio_cbc {
+   compatible = "jnx,gpio-cbc";
+   #gpio-cells = <2>;
+   gpio-controller;
+};
-- 
1.9.1

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


[RFC 2/2] staging: jnx-connector: add device tree binding

2016-10-07 Thread Pantelis Antoniou
From: Guenter Roeck 

Add documentation for the Juniper connector driver.

Signed-off-by: Alon Ronen 
Signed-off-by: Guenter Roeck 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 .../devicetree/bindings/jnx/jnx-connector  | 59 ++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/jnx/jnx-connector

diff --git a/Documentation/devicetree/bindings/jnx/jnx-connector 
b/Documentation/devicetree/bindings/jnx/jnx-connector
new file mode 100644
index 000..9262752
--- /dev/null
+++ b/Documentation/devicetree/bindings/jnx/jnx-connector
@@ -0,0 +1,59 @@
+Device-Tree bindings for Juniper connector driver
+
+Required properties:
+   - compatible - Must be one of
+ - "jnx,pic-connector"
+ - "jnx,sib-connector"
+ - "jnx,fpc-connector"
+ - "jnx,cb-connector"
+ - "jnx,psm-connector"
+ - "jnx,fan-connector"
+ - "jnx,mp-connector"
+ - "jnx,fpm-connector"
+ - "jnx,spmb-connector"
+ "simple-bus" must also be specified to facilitate instantiation.
+   - slot - slot number
+
+Optional properties:
+   - assembly-id - Static assembly ID to be used for all adapters.
+   If specified, it is assumed that no ID eeprom is
+   present, and the provided assembly ID will always be
+   used to identify the adapter and the devicetree overlay
+   to load.
+   - presence-detect-gpios - presence detect gpio pin
+ If not provided, card is assumed
+ to be always present.
+   - attention-button-gpios - request button gpio pin
+   - attention-button-ignore - set if kernel shall ignore
+   attention button events
+   - attention-button-holdtime - button hold time in milli-seconds
+ (3s default)
+   - activation-timeout - activation timeout in milli-seconds (10s default)
+   - debounce-interval - debounce interval in milli-seconds
+   (applies to presence detect pin).
+   - power-enable-gpios - power enable gpio pin
+   - power-status-gpios - power status gpio pin (mandatory if
+  power-enable-gpios is provided)
+   - power-enable-timeout - power enable timeout in ms (1s default)
+   - poweron-reset-delay - delay to be applied after poweron in
+   milli-seconds (default none)
+   - reset-gpios - board reset gpio pin
+   - led-green - phandle pointing to green LED
+   - led-red - phandle pointing to red LED
+   - sysfs-linkname - name to be user for the symbolic link under jnx/card
+
+Example node:
+
+   pic0 {
+   compatible = "jnx,pic-connector", "simple-bus";
+   slot = <0>;
+   presence-detect-gpios = <&gpio1 148 0x10013>;
+   attention-button-gpios = <&gpio20 150 0x10013>;
+   power-enable-gpios = <&gpio1 154 0x0>;
+   power-status-gpios = <&gpio1 151 0x3>;
+   reset-gpios = <&gpio1 153 0x1>;
+   power-enable-timeout = <2000>;
+   debounce-interval = <1>;
+   led-green = <&pic0_green>;
+   led-red = <&pic0_red>;
+   };
-- 
1.9.1

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


[PATCH 4/6] gpio: cbc-presence: Add CBC presence detect as GPIO driver

2016-10-07 Thread Pantelis Antoniou
From: Georgi Vlaev 

This driver exports the CB FPGA presence detect bits from a
single 32bit CB register as GPIOs.

Signed-off-by: Georgi Vlaev 
Signed-off-by: Guenter Roeck 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/gpio/Kconfig |  12 +
 drivers/gpio/Makefile|   1 +
 drivers/gpio/gpio-cbc-presence.c | 460 +++
 3 files changed, 473 insertions(+)
 create mode 100644 drivers/gpio/gpio-cbc-presence.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index b29f521..ef8f408 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -158,6 +158,18 @@ config GPIO_CBC
  This driver can also be built as a module.  If so, the module
  will be called gpio-cbc.
 
+config GPIO_CBC_PRESENCE
+   tristate "Juniper Networks PTX1K CBC presence detect as GPIO"
+   depends on MFD_JUNIPER_CBC && OF
+   default y if JNX_CONNECTOR
+   help
+ This driver exports the CH_PRS and OTHER_CH_PRS presence detect
+ bits of the PTX1K RCB CBC FPGA as GPIOs on the relevant Juniper
+ platforms. Select if JNX_CONNECTOR is selected.
+
+ This driver can also be built as a module.  If so, the module
+ will be called gpio-cbc-presence.
+
 config GPIO_CLPS711X
tristate "CLPS711X GPIO support"
depends on ARCH_CLPS711X || COMPILE_TEST
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 78dd0d4..825c2636 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_GPIO_BCM_KONA)   += gpio-bcm-kona.o
 obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o
 obj-$(CONFIG_GPIO_BT8XX)   += gpio-bt8xx.o
 obj-$(CONFIG_GPIO_CBC) += gpio-cbc.o
+obj-$(CONFIG_GPIO_CBC_PRESENCE)+= gpio-cbc-presence.o
 obj-$(CONFIG_GPIO_CLPS711X)+= gpio-clps711x.o
 obj-$(CONFIG_GPIO_CS5535)  += gpio-cs5535.o
 obj-$(CONFIG_GPIO_CRYSTAL_COVE)+= gpio-crystalcove.o
diff --git a/drivers/gpio/gpio-cbc-presence.c b/drivers/gpio/gpio-cbc-presence.c
new file mode 100644
index 000..ab16c0b
--- /dev/null
+++ b/drivers/gpio/gpio-cbc-presence.c
@@ -0,0 +1,460 @@
+/*
+ * Juniper Networks PTX1K CBC presence detect as GPIO driver
+ *
+ * Copyright (c) 2014, Juniper Networks
+ * Author: Georgi Vlaev 
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * PTX1K RCB CBC:
+ * We have 26 presence bits in 2 regs.
+ * Interrupts are raised per bit change in a reg (2 ints)
+ *
+ * CBC_TOP_REGS_CH_PRS:
+ * FPC[7:0] -> FPC[7:0]
+ * FAN[16] -> FAN[0]
+ * CB[22:21] -> CB[1:0]
+ * FPD[23]
+ * OTHER_RE[26]
+ *
+ * CBC_TOP_REGS_OTHER_CH_PRS:
+ * PSM[4:0]
+ * SIB[10:5] -> SIB[5:0]
+ * SFPP[21:20] -> SFPP[1:0]
+ */
+
+/*
+ * struct cbc_presence_gpio - GPIO private data structure.
+ * @base: PCI base address of Memory mapped I/O register.
+ * @dev: Pointer to device structure.
+ * @gpio: Data for GPIO infrastructure.
+ */
+struct cbc_presence_gpio {
+   void __iomem *base;
+   struct device *dev;
+   struct gpio_chip gpio;
+   struct mutex irq_lock;
+   struct mutex work_lock;
+   struct irq_domain *domain;
+   int irq;
+   u32 reg;
+   unsigned long presence_cache;
+   unsigned long presence_irq_enabled;
+   unsigned long mask;
+   unsigned long always_present;
+   unsigned long poll_interval;
+   u8 irq_type[32];
+   struct delayed_work work;
+};
+
+static u32 cbc_presence_read(struct cbc_presence_gpio *cpg)
+{
+   return ioread32(cpg->base + cpg->reg) | cpg->always_present;
+}
+
+static int cbc_presence_gpio_get(struct gpio_chip *gc, unsigned int nr)
+{
+   struct cbc_presence_gpio *cpg =
+   container_of(gc, struct cbc_presence_gpio, gpio);
+   unsigned long data, pos, ord = 0;
+
+   data = cbc_presence_read(cpg);
+   for_each_set_bit(pos, &cpg->mask, fls(cpg->mask)) {
+   if (ord == nr)
+   return !!test_bit(ord, &data);
+   ord++;
+   }
+   return 0;
+}
+
+static int cbc_presence_gpio_direction_input(struct gpio_chip *gc,
+unsigned int nr)
+{
+   /* all pins are input pins */
+   return 0;
+}
+
+static int cbc_presence_gpio_to_irq(struct gpio_chip *gc, unsigned int offset)
+{
+   struct cbc_presence_gpio *cpg = container_of(gc,
+  

Re: [PATCH 2/2] jnx: Introduce include/linux/jnx/pci_ids.h

2016-10-07 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2016 at 06:15:46PM +0300, Pantelis Antoniou wrote:
> From: Rajat Jain 
> 
> Add this header to contain the PCI device IDs that we cannot add in
> the linux pci_ids.h.

Why can't you?

> This would contain PCI device IDs of Juniper devices as well as any
> PCIe switches etc.

Why do you need a .h file for this?  Is the values in it shared across
drivers?  If not, you don't nee a .h file at all.  If so, then it
belongs in pci_ids.h as the top of that file describes.

thanks,

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


[PATCH 0/6] Introduce Juniper CBC FPGA

2016-10-07 Thread Pantelis Antoniou
Add Juniper's PTX1K CBC FPGA driver. Those FPGAs
are present in Juniper's PTX series of routers.

The MFD driver provices a gpio device and a special
driver for Juniper's board infrastucture.
The FPGA infrastucture driver is providing an interface
for user-space handling of the FPGA in those platforms.

There are full device tree binding documents for the
master mfd driver and for the slave driver.

This patchset is against mainline as of today: v4.8-9431-g3477d16
and is dependent on the "Juniper prerequisites" and
"Juniper infrastructure" patchsets sent earlier.

Georgi Vlaev (5):
  mfd: Add support for the PTX1K CBC FPGA
  gpio: Add support for PTX1K CBC FPGA spare GPIOs
  gpio: gpio-cbc: Document bindings of CBC FPGA GPIO block
  gpio: cbc-presence: Add CBC presence detect as GPIO driver
  gpio: gpio-cbc-presense: Document bindings of CBC FPGA presence

Tom Kavanagh (1):
  staging: jnx: CBD-FPGA infrastructure

 .../bindings/gpio/jnx,gpio-cbc-presense.txt|  31 +
 .../devicetree/bindings/gpio/jnx,gpio-cbc.txt  |  30 +
 drivers/gpio/Kconfig   |  23 +
 drivers/gpio/Makefile  |   2 +
 drivers/gpio/gpio-cbc-presence.c   | 460 ++
 drivers/gpio/gpio-cbc.c| 236 +
 drivers/mfd/Kconfig|  16 +
 drivers/mfd/Makefile   |   1 +
 drivers/mfd/cbc-core.c | 971 +
 drivers/staging/jnx/Kconfig|  34 +
 drivers/staging/jnx/Makefile   |   5 +
 drivers/staging/jnx/jnx-cbc-ptx1k.c| 242 +
 drivers/staging/jnx/jnx-cbd-fpga-common.c  | 332 +++
 drivers/staging/jnx/jnx-cbd-fpga-common.h  |  27 +
 drivers/staging/jnx/jnx-cbd-fpga-core.c| 540 
 drivers/staging/jnx/jnx-cbd-fpga-core.h|  68 ++
 drivers/staging/jnx/jnx-cbd-fpga-platdata.h|  51 ++
 drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c   | 134 +++
 drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c  | 143 +++
 drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c   | 111 +++
 drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c   | 107 +++
 include/linux/mfd/cbc-core.h   | 181 
 22 files changed, 3745 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/gpio/jnx,gpio-cbc-presense.txt
 create mode 100644 Documentation/devicetree/bindings/gpio/jnx,gpio-cbc.txt
 create mode 100644 drivers/gpio/gpio-cbc-presence.c
 create mode 100644 drivers/gpio/gpio-cbc.c
 create mode 100644 drivers/mfd/cbc-core.c
 create mode 100644 drivers/staging/jnx/jnx-cbc-ptx1k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-common.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-common.h
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-core.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-core.h
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-platdata.h
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c
 create mode 100644 drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c
 create mode 100644 include/linux/mfd/cbc-core.h

-- 
1.9.1

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


Re: [PATCH 0/3] Juniper PCI methods

2016-10-07 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2016 at 06:15:53PM +0300, Pantelis Antoniou wrote:
> Introduce PCI methods and infrastructure dealing with the
> peculiarities of Juniper PTX series of routers.



Same comments as my previous ones, why is this in staging, and make it
all one patch series please.

thanks,

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


Re: [RFC 0/2] Juniper DT based connector driver

2016-10-07 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2016 at 06:16:10PM +0300, Pantelis Antoniou wrote:
> Introduce a Juniper PTX router series DT overlay based
> connector driver.
> 
> This is submitted as an RFC since some OF infrastructure
> patches (like changeset helpers etc) are not yet mainlined.

staging drivers almost always need to at least build (or if not, have a
good reason why not.)

So don't post code until people can at least test-build it, otherwise no
one will care about it.  Would you review such code?

thanks,

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


[PATCH 5/6] gpio: gpio-cbc-presense: Document bindings of CBC FPGA presence

2016-10-07 Thread Pantelis Antoniou
From: Georgi Vlaev 

Add device tree bindings document for the presence virtual GPIOs
on Juniper's CBC FPGA.

Signed-off-by: Georgi Vlaev 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 .../bindings/gpio/jnx,gpio-cbc-presense.txt| 31 ++
 1 file changed, 31 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/gpio/jnx,gpio-cbc-presense.txt

diff --git a/Documentation/devicetree/bindings/gpio/jnx,gpio-cbc-presense.txt 
b/Documentation/devicetree/bindings/gpio/jnx,gpio-cbc-presense.txt
new file mode 100644
index 000..f44e5a0
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/jnx,gpio-cbc-presense.txt
@@ -0,0 +1,31 @@
+Juniper CBC FPGA GPIO presence block
+
+Required properties:
+
+- compatible:
+Must be one of "jnx,gpio-cbc-presence", "jnx,gpio-cbc-presence-other",
+"jnx,gpio-cbc-presence-sib"
+
+Optional properties:
+
+- reg:
+Address and length of the register set for the device. This is optional 
since
+usually the parent MFD driver fills it in.
+
+- #gpio-cells:
+Should be <2>.  The first cell is the pin number (within the controller's
+pin space), and the second is used for the following flags:
+   bit[0]: direction (0 = out, 1 = in)
+   bit[1]: init high
+   bit[2]: active low
+
+- gpio-controller:
+Specifies that the node is a GPIO controller.
+
+Example:
+
+gpio_cbc_presense {
+   compatible = "jnx,gpio-cbc-presense";
+   #gpio-cells = <2>;
+   gpio-controller;
+};
-- 
1.9.1

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


[PATCH 1/6] mfd: Add support for the PTX1K CBC FPGA

2016-10-07 Thread Pantelis Antoniou
From: Georgi Vlaev 

The CBC intergrates CB and SAM on single FPGA. This is a PCI MFD driver
and provides support for the following functions as subdrivers:

* SAM I2C accelerator
* SAM MTD flash
* CBC spare GPIOs
* CBC JNX infrastructure

Signed-off-by: Georgi Vlaev 
Signed-off-by: Guenter Roeck 
Signed-off-by: Rajat Jain 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/mfd/Kconfig  |  16 +
 drivers/mfd/Makefile |   1 +
 drivers/mfd/cbc-core.c   | 971 +++
 include/linux/mfd/cbc-core.h | 181 
 4 files changed, 1169 insertions(+)
 create mode 100644 drivers/mfd/cbc-core.c
 create mode 100644 include/linux/mfd/cbc-core.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 7e1fa14..6107f7a 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1384,6 +1384,22 @@ config MFD_JUNIPER_EXT_CPLD
  called "ptxpmb-ext-cpld"
 
 
+config MFD_JUNIPER_CBC
+   tristate "Juniper PTX1K CBC FPGA"
+   depends on JNX_PTX1K_RCB
+   default y if JNX_PTX1K_RCB
+   select MFD_CORE
+   select MTD
+   select MTD_SAM_FLASH
+   select I2C_SAM
+   select GPIO_CBC_PRESENCE if JNX_CONNECTOR
+   help
+ Select this to enable the CBC FPGA multi-function kernel driver.
+ This FPGA is present on the PTX1K RCB Juniper platform.
+
+ This driver can be built as a module. If built as a module it will be
+ called "cbc-core"
+
 config MFD_TWL4030_AUDIO
bool "TI TWL4030 Audio"
depends on TWL4030_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index da94482..0ea6dc6 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -151,6 +151,7 @@ obj-$(CONFIG_AB8500_GPADC)  += ab8500-gpadc.o
 obj-$(CONFIG_MFD_JUNIPER_CPLD) += ptxpmb-cpld-core.o
 obj-$(CONFIG_MFD_JUNIPER_SAM)  += sam-core.o
 obj-$(CONFIG_MFD_JUNIPER_EXT_CPLD) += ptxpmb-ext-cpld-core.o
+obj-$(CONFIG_MFD_JUNIPER_CBC)  += cbc-core.o
 obj-$(CONFIG_MFD_DB8500_PRCMU) += db8500-prcmu.o
 # ab8500-core need to come after db8500-prcmu (which provides the channel)
 obj-$(CONFIG_AB8500_CORE)  += ab8500-core.o ab8500-sysctrl.o
diff --git a/drivers/mfd/cbc-core.c b/drivers/mfd/cbc-core.c
new file mode 100644
index 000..1e6c95b
--- /dev/null
+++ b/drivers/mfd/cbc-core.c
@@ -0,0 +1,971 @@
+/*
+ * drivers/mfd/cbc-core.c
+ *
+ * Copyright (c) 2014, Juniper Networks
+ * Author: Georgi Vlaev 
+ * Based on: sam-core.c
+ *
+ * The CBC FPGA intergrates the PTX1K CB and some functions of
+ * the SAM FPGA on single device. We're reusing the SAM I2C,
+ * MTD flash drivers. The JNX CB logic is implemented in
+ * drivers/jnx/jnx-cbc-ptx1k.c and drivers/jnx/jnx-cbd-fpga-ptx1k.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 published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_DEBUG_FS
+#include 
+#include 
+#endif
+
+enum {
+   CBC_CELL_SAM_I2C,   /* SAM I2C accelerator */
+   CBC_CELL_SAM_MTD,   /* SAM EPCS64 config flash */
+   CBC_CELL_GPIO,  /* CBC spare GPIO */
+   CBC_CELL_JNX_CBD,   /* CBC CB JNX driver */
+   CBC_CELL_GPIO_PRS,  /* CBC presence as GPIO (CH_PRS) */
+   CBC_CELL_GPIO_PRS_OTHER,/* CBC presence ss GPIO (OTHER_CH_PRS) */
+   CBC_CELL_GPIO_PRS_SIB,  /* CBC presence as GPIO (CH_PRS_SIB) */
+   CBC_NUM_MFD_CELLS
+};
+
+#define CBC_IRQ_NR 31
+#define CBC_RES_NR 2 /* iomem, irq */
+#define CBC_RES_NR_NOIRQ   1 /* iomem */
+
+struct cbc_fpga_data {
+   void __iomem *membase;
+   struct pci_dev *pdev;
+   u32 fpga_rev;   /* CBC revision */
+   u32 fpga_date;  /* CBC revision date */
+   int i2c_mstr_count; /* CBC/I2C SAM master count */
+   struct irq_domain *irq_domain;
+   u32 int_src; /* interrupt src reg (MSI, legacy) */
+   u32 int_en; /* interrupt en reg (MSI, legacy) */
+   spinlock_t irq_lock;
+   struct mfd_cell mfd_cells[CBC_NUM_MFD_CELLS];
+   struct resource mfd_i2c_resources[CBC_RES_NR];
+   struct resource mfd_mtd_resources[CBC_RES_NR_NOIRQ];
+   struct resource mfd_gpio_resources[CBC_RES_NR_NOIRQ];
+   struct resource mfd_jnx_resources[CBC_RES_NR_NOIRQ];
+   struct resource mfd_gpio_prs_resources[CBC_RES_NR_NOIRQ];
+#ifdef CONFIG_DEBUG_FS
+   struct dentry *cbc_debugfs_dir;
+   u32 debug_address; /* any register offsset */
+   struct debugfs_regset32 *regset; /* all regs */
+   u32 test_int_cnt; /* TEST_INT counter */
+   u32 i2c_accel_cnt; /* INT_I2C_ACCEL cnt */
+   u32 i2c_accel_empty_cnt; /* INT_I2C_ACCEL cnt && !CBC_STATUS_IRQ_EN */
+#endif
+};
+
+/* debugfs */
+/* TODO: split into a separate file */
+#

[RFC 1/2] staging: jnx: Add Juniper connector driver

2016-10-07 Thread Pantelis Antoniou
From: Guenter Roeck 

Driver to manage connectors in various Juniper devices.
Currently supports PIC and SIB as well as various RE boards.

Supports and uses device tree overlay as well as LED triggers.
State changes are reported to userspace with sysfs poll events
as well as with udev events.

Signed-off-by: Guenter Roeck 
Signed-off-by: Georgi Vlaev 
Signed-off-by: Alon Ronen 
Signed-off-by: Debjit Ghosh 
Signed-off-by: Dhruva Diveneni 
Signed-off-by: Yu-Lin Lu 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 drivers/staging/jnx/Kconfig |   15 +
 drivers/staging/jnx/Makefile|1 +
 drivers/staging/jnx/jnx-connector.c | 2172 +++
 3 files changed, 2188 insertions(+)
 create mode 100644 drivers/staging/jnx/jnx-connector.c

diff --git a/drivers/staging/jnx/Kconfig b/drivers/staging/jnx/Kconfig
index b57e93b..4c38fc2 100644
--- a/drivers/staging/jnx/Kconfig
+++ b/drivers/staging/jnx/Kconfig
@@ -19,6 +19,21 @@ config JNX_SYSTEM
 
  This driver can not be compiled as a module.
 
+config JNX_CONNECTOR
+   tristate "Juniper Connector Driver"
+   depends on JNX_SYSTEM && OF
+   default m
+   select LEDS_TRIGGERS
+   select OF_OVERLAY
+   help
+ This driver adds support connectors on various Juniper boards.
+ PIC and SIB conenctors are currently supported, but the driver
+ should really work for all connectors with GPIO pins used for
+ detection and status.
+
+ This driver can also be built as a module.  If so, the module
+ will be called jnx-connector.
+
 endmenu
 
 config JNX_COMMON_PCI
diff --git a/drivers/staging/jnx/Makefile b/drivers/staging/jnx/Makefile
index 90526b1..c89e701 100644
--- a/drivers/staging/jnx/Makefile
+++ b/drivers/staging/jnx/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_JNX_SYSTEM)+= jnx-subsys.o jnx-board-core.o
 obj-$(CONFIG_JNX_CHIP_PCI_QUIRKS)+= jnx-chip-pci-quirks.o
 obj-$(CONFIG_JNX_COMMON_PCI)   += jnx_common_pci.o
 obj-$(CONFIG_JNX_PEX8XXX_I2C)  += pex8xxx_i2c.o
+obj-$(CONFIG_JNX_CONNECTOR)+= jnx-connector.o
diff --git a/drivers/staging/jnx/jnx-connector.c 
b/drivers/staging/jnx/jnx-connector.c
new file mode 100644
index 000..1dd48d0
--- /dev/null
+++ b/drivers/staging/jnx/jnx-connector.c
@@ -0,0 +1,2172 @@
+/*
+ * jnx-connector.c
+ *
+ * Connector driver for Juniper devices
+ *
+ * Copyright (C) 2013 Juniper Networks
+ * Author: Guenter Roeck 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "jnx-subsys-private.h"
+
+enum jnx_conn_state { empty, standby, insert_wait, loading0, present,
+ poweron, power, loading, abort, active,
+ failed };
+enum jnx_conn_event { invalid_ev, insert_ev, insert_done_ev, remove_ev,
+ loaded_ev, timeout_ev, enoent_ev, failure_ev,
+ poweroff_ev, button_ev, poweron_ev,
+ powergood_ev, powerbad_ev, master_ev, standby_ev };
+
+enum jnx_conn_button_state { idle, pressed, wait_release };
+enum jnx_conn_button_event { button_state_change_ev, button_timeout_ev };
+
+/*
+ * OF defined i2c client register sequence of 5
+ * u32 values: 
+ *
+ * 1. For i2c device @addr(smbus): reg = (reg & ~clr) | set;
+ * 2. Wait  msec and jump to the next register.
+ */
+struct jnx_i2c_power_seq {
+   u32 *seq;   /* seq :=  */
+   int count;  /* count of sequences */
+   int pos;/* current position */
+};
+
+#define JNX_OV_DEVICES 0
+#define JNX_OV_POWER   1
+#define NUM_OVERLAYS   2
+
+struct jnx_conn_data {
+   struct device *dev; /* parent (platform) device */
+   const char *name[NUM_OVERLAYS]; /* overlay file names */
+   bool enabled;   /* true if can handle interrupts */
+   bool poweron;   /* true if assumed to be powered on */
+   int ov[NUM_OVERLAYS];   /* overlay IDs */
+   const struct firmware *ovfw[NUM_OVERLAYS]; /* overlay blobs */
+   struct notifier_block nb;
+   const char *sysfs_linkname; /* FRU symbolic-link name */
+   const char *led_green_name;
+   const char *led_red_name;
+   struct led_trigger *led_green;
+   struct led_trigger *led_red;
+   int attention_button;   /* attention button

Re: [PATCH 1/2] staging: jnx: Juniper subsystem & board core APIs

2016-10-07 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2016 at 06:15:45PM +0300, Pantelis Antoniou wrote:
> From: Tom Kavanagh 

Minor nit:

> +config JNX_DEVICES
> + bool
> + default n

n is always the default.

And how about a help entry?

> +if JNX_DEVICES
> +
> +menu "Juniper Devices and Infrastructure"
> +
> +config JNX_SYSTEM
> + bool "Juniper System Infrastructure"
> + default y

Only make something 'y' if you have to boot a bare-bones machine with
it.  That means almost no driver fits that category, and a staging
driver should never have this set either.

> + help
> +   This driver adds support for Juniper System Infrastructure. It creates
> +   platform devices for the platform, chassis and cards and provides 
> sysfs
> +   attributes for these devices.
> +
> +   This driver can not be compiled as a module.
> +
> +endmenu
> +
> +endif # JNX_DEVICES
> diff --git a/drivers/staging/jnx/Makefile b/drivers/staging/jnx/Makefile
> new file mode 100644
> index 000..52b8286
> --- /dev/null
> +++ b/drivers/staging/jnx/Makefile
> @@ -0,0 +1,5 @@
> +#
> +# Makefile for Juniper devices that really don't fit anywhere else.
> +#
> +
> +obj-$(CONFIG_JNX_SYSTEM) += jnx-subsys.o jnx-board-core.o
> diff --git a/drivers/staging/jnx/jnx-board-core.c 
> b/drivers/staging/jnx/jnx-board-core.c
> new file mode 100644
> index 000..218a8b7
> --- /dev/null
> +++ b/drivers/staging/jnx/jnx-board-core.c
> @@ -0,0 +1,247 @@
> +/*
> + * Juniper Generic Board APIs
> + *
> + * Copyright (C) 2012, 2013, 2014 Juniper Networks. All rights reserved.
> + *
> + * 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.

Really "any later version"?  I have to ask.

> + *
> + * 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.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "jnx-subsys-private.h"
> +
> +#define DRIVER_VERSION  "0.01.0"
> +#define DRIVER_DESC "Board Generic HW"
> +
> +static LIST_HEAD(jnx_i2c_notify_list);
> +static DEFINE_MUTEX(jnx_i2c_notify_lock);
> +
> +static int jnx_i2c_adap_name_match(struct device *dev, void *data)
> +{
> + struct i2c_adapter *adap = i2c_verify_adapter(dev);
> + char *name = data;
> +
> + if (!adap)
> + return false;
> +
> + return !strncmp(adap->name, name, strlen(name));
> +}
> +
> +struct i2c_adapter *jnx_i2c_find_adapter(char *name)
> +{
> + struct device *dev;
> + struct i2c_adapter *adap;
> +
> + dev = bus_find_device(&i2c_bus_type, NULL, name,
> +   jnx_i2c_adap_name_match);
> + if (!dev)
> + return NULL;
> +
> + adap = i2c_verify_adapter(dev);
> + if (!adap)
> + put_device(dev);
> +
> + return adap;
> +}
> +EXPORT_SYMBOL(jnx_i2c_find_adapter);

EXPORT_SYMBOL_GPL()?  Same for other exports.  I have to ask.

thanks,

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


Re: [PATCH 0/6] Introduce Juniper CBC FPGA

2016-10-07 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2016 at 06:20:08PM +0300, Pantelis Antoniou wrote:
> Add Juniper's PTX1K CBC FPGA driver. Those FPGAs
> are present in Juniper's PTX series of routers.
> 
> The MFD driver provices a gpio device and a special
> driver for Juniper's board infrastucture.
> The FPGA infrastucture driver is providing an interface
> for user-space handling of the FPGA in those platforms.
> 
> There are full device tree binding documents for the
> master mfd driver and for the slave driver.
> 
> This patchset is against mainline as of today: v4.8-9431-g3477d16
> and is dependent on the "Juniper prerequisites" and
> "Juniper infrastructure" patchsets sent earlier.
> 
> Georgi Vlaev (5):
>   mfd: Add support for the PTX1K CBC FPGA
>   gpio: Add support for PTX1K CBC FPGA spare GPIOs
>   gpio: gpio-cbc: Document bindings of CBC FPGA GPIO block
>   gpio: cbc-presence: Add CBC presence detect as GPIO driver
>   gpio: gpio-cbc-presense: Document bindings of CBC FPGA presence
> 
> Tom Kavanagh (1):
>   staging: jnx: CBD-FPGA infrastructure
> 
>  .../bindings/gpio/jnx,gpio-cbc-presense.txt|  31 +
>  .../devicetree/bindings/gpio/jnx,gpio-cbc.txt  |  30 +
>  drivers/gpio/Kconfig   |  23 +
>  drivers/gpio/Makefile  |   2 +
>  drivers/gpio/gpio-cbc-presence.c   | 460 ++
>  drivers/gpio/gpio-cbc.c| 236 +
>  drivers/mfd/Kconfig|  16 +
>  drivers/mfd/Makefile   |   1 +
>  drivers/mfd/cbc-core.c | 971 
> +
>  drivers/staging/jnx/Kconfig|  34 +
>  drivers/staging/jnx/Makefile   |   5 +
>  drivers/staging/jnx/jnx-cbc-ptx1k.c| 242 +
>  drivers/staging/jnx/jnx-cbd-fpga-common.c  | 332 +++
>  drivers/staging/jnx/jnx-cbd-fpga-common.h  |  27 +
>  drivers/staging/jnx/jnx-cbd-fpga-core.c| 540 
>  drivers/staging/jnx/jnx-cbd-fpga-core.h|  68 ++
>  drivers/staging/jnx/jnx-cbd-fpga-platdata.h|  51 ++
>  drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c   | 134 +++
>  drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c  | 143 +++
>  drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c   | 111 +++
>  drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c   | 107 +++
>  include/linux/mfd/cbc-core.h   | 181 
>  22 files changed, 3745 insertions(+)

Please don't mix driver submissions like this.  Staging stuff needs to
go to the staging maintainer, gpio to that one, mfd to that one, and so
on.

there's almost nothing anyone can do with this series as-is, sorry.

please split it up.

thanks,

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


[PATCH] Staging:fbtft/fb_s6d02a1.c: fixed 80 character line limit coding

2016-10-07 Thread Nadim Almas
style issue

Fixed coding style issue

Signed-off-by: Nadim Almas 
---
 drivers/staging/fbtft/fb_s6d02a1.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fbtft/fb_s6d02a1.c 
b/drivers/staging/fbtft/fb_s6d02a1.c
index 774b0ff..bc0c48f 100644
--- a/drivers/staging/fbtft/fb_s6d02a1.c
+++ b/drivers/staging/fbtft/fb_s6d02a1.c
@@ -30,20 +30,27 @@ static int default_init_sequence[] = {
 
-1, 0xfc, 0x5a, 0x5a,
 
-   -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A, 
0x3A, 0x3A, 0x3d, 0x02, 0x01,
+   -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A,
+   0x3A, 0x3A, 0x3d, 0x02, 0x01,
 
-   -1, 0xfb, 0x21, 0x00, 0x02, 0x04, 0x07, 0x0a, 0x0b, 0x0c, 0x0c, 0x16, 
0x1e, 0x30, 0x3f, 0x01, 0x02,
+   -1, 0xfb, 0x21, 0x00, 0x02, 0x04, 0x07, 0x0a, 0x0b, 0x0c, 0x0c, 0x16,
+   0x1e, 0x30, 0x3f, 0x01, 0x02,
 
/* power setting sequence */
-   -1, 0xfd, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x01, 0x01, 0x00, 0x1f, 
0x1f,
+   -1, 0xfd, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x01, 0x01, 0x00, 0x1f,
+   0x1f,
 
-   -1, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 
0x36, 0x00, 0x3C, 0x36, 0x00,
+   -1, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C,
+   0x36, 0x00, 0x3C, 0x36, 0x00,
 
-   -1, 0xf5, 0x00, 0x70, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x6d, 0x66, 0x06,
+   -1, 0xf5, 0x00, 0x70, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x6d, 0x66, 0x06,
 
-   -1, 0xf6, 0x02, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x01, 
0x00,
+   -1, 0xf6, 0x02, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x01,
+   0x00,
 
-   -1, 0xf2, 0x00, 0x01, 0x03, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x01, 0x00, 0x00, 0x04, 0x08, 0x08,
+   -1, 0xf2, 0x00, 0x01, 0x03, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x08, 0x08,
 
-1, 0xf8, 0x11,
 
@@ -63,7 +70,8 @@ static int default_init_sequence[] = {
-1, 0xf3, 0x00, 0x0f,
-2, 50,
 
-   -1, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 
0x36, 0x00, 0x3C, 0x36, 0x00,
+   -1, 0xf4, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07,
+   0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00,
-2, 50,
 
-1, 0xf3, 0x00, 0x1f,
@@ -74,9 +82,11 @@ static int default_init_sequence[] = {
-1, 0xf3, 0x00, 0xff,
-2, 50,
 
-   -1, 0xfd, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x00, 0x01, 0x00, 0x16, 
0x16,
+   -1, 0xfd, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x00, 0x01,
+   0x00, 0x16, 0x16,
 
-   -1, 0xf4, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 
0x36, 0x00, 0x3C, 0x36, 0x00,
+   -1, 0xf4, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C,
+   0x36, 0x00, 0x3C, 0x36, 0x00,
 
/* initializing sequence */
 
-- 
2.7.4

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


Re: [PATCH 0/6] Introduce Juniper CBC FPGA

2016-10-07 Thread Pantelis Antoniou

> On Oct 7, 2016, at 18:39 , Greg Kroah-Hartman  
> wrote:
> 
> On Fri, Oct 07, 2016 at 06:20:08PM +0300, Pantelis Antoniou wrote:
>> Add Juniper's PTX1K CBC FPGA driver. Those FPGAs
>> are present in Juniper's PTX series of routers.
>> 
>> The MFD driver provices a gpio device and a special
>> driver for Juniper's board infrastucture.
>> The FPGA infrastucture driver is providing an interface
>> for user-space handling of the FPGA in those platforms.
>> 
>> There are full device tree binding documents for the
>> master mfd driver and for the slave driver.
>> 
>> This patchset is against mainline as of today: v4.8-9431-g3477d16
>> and is dependent on the "Juniper prerequisites" and
>> "Juniper infrastructure" patchsets sent earlier.
>> 
>> Georgi Vlaev (5):
>>  mfd: Add support for the PTX1K CBC FPGA
>>  gpio: Add support for PTX1K CBC FPGA spare GPIOs
>>  gpio: gpio-cbc: Document bindings of CBC FPGA GPIO block
>>  gpio: cbc-presence: Add CBC presence detect as GPIO driver
>>  gpio: gpio-cbc-presense: Document bindings of CBC FPGA presence
>> 
>> Tom Kavanagh (1):
>>  staging: jnx: CBD-FPGA infrastructure
>> 
>> .../bindings/gpio/jnx,gpio-cbc-presense.txt|  31 +
>> .../devicetree/bindings/gpio/jnx,gpio-cbc.txt  |  30 +
>> drivers/gpio/Kconfig   |  23 +
>> drivers/gpio/Makefile  |   2 +
>> drivers/gpio/gpio-cbc-presence.c   | 460 ++
>> drivers/gpio/gpio-cbc.c| 236 +
>> drivers/mfd/Kconfig|  16 +
>> drivers/mfd/Makefile   |   1 +
>> drivers/mfd/cbc-core.c | 971 
>> +
>> drivers/staging/jnx/Kconfig|  34 +
>> drivers/staging/jnx/Makefile   |   5 +
>> drivers/staging/jnx/jnx-cbc-ptx1k.c| 242 +
>> drivers/staging/jnx/jnx-cbd-fpga-common.c  | 332 +++
>> drivers/staging/jnx/jnx-cbd-fpga-common.h  |  27 +
>> drivers/staging/jnx/jnx-cbd-fpga-core.c| 540 
>> drivers/staging/jnx/jnx-cbd-fpga-core.h|  68 ++
>> drivers/staging/jnx/jnx-cbd-fpga-platdata.h|  51 ++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c   | 134 +++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c  | 143 +++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c   | 111 +++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c   | 107 +++
>> include/linux/mfd/cbc-core.h   | 181 
>> 22 files changed, 3745 insertions(+)
> 
> Please don't mix driver submissions like this.  Staging stuff needs to
> go to the staging maintainer, gpio to that one, mfd to that one, and so
> on.
> 
> there's almost nothing anyone can do with this series as-is, sorry.
> 
> please split it up.
> 

Well, it’s an MFD driver, there is dependence; will split up.
> thanks,
> 
> greg k-h

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


[RFC 0/2] Juniper DT based connector driver

2016-10-07 Thread Pantelis Antoniou
Introduce a Juniper PTX router series DT overlay based
connector driver.

This is submitted as an RFC since some OF infrastructure
patches (like changeset helpers etc) are not yet mainlined.

The Juniper series of routers comprise of both x86 and powerpc
platforms that contain similar hardware components necessitating
common support methods.

Note that this is the first submission and we expect things to be
moved around as required.

This patchset is against mainline as of today: v4.8-9431-g3477d16
and is dependent on the "Juniper prerequisites",
"Juniper infrastructure" and "Juniper PCI methods" patchsets
sent earlier.

Guenter Roeck (2):
  staging: jnx: Add Juniper connector driver
  staging: jnx-connector: add device tree binding

 .../devicetree/bindings/jnx/jnx-connector  |   59 +
 drivers/staging/jnx/Kconfig|   15 +
 drivers/staging/jnx/Makefile   |1 +
 drivers/staging/jnx/jnx-connector.c| 2172 
 4 files changed, 2247 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/jnx/jnx-connector
 create mode 100644 drivers/staging/jnx/jnx-connector.c

-- 
1.9.1

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


[PATCH 1/2] staging: jnx: Juniper subsystem & board core APIs

2016-10-07 Thread Pantelis Antoniou
From: Tom Kavanagh 

The Juniper System Infrastructure subsystem creates platform devices
for the platform, chassis and cards and provides sysfs attributes for
these devices.

Each board contains I2C ID EEPROMs which contain information about the
chassis, platform, type and assembly IDs.

All Juniper local boards that run Linux contain a CBD (Control Board)
FPGA that provides I2C interfaces (among other things) that the other
boards use to connect their ID EEPROMs to.

A set of APIs for boards/modules is provided. These APIs provide:

- The ability to "listen" for the addition/deletion of any new board
  and schedule work to be done upon notification.
- The query of mastership in the dual failover environment these
  platform operate in.
- Registering boards and chassis.

A user-space API is provided by sysfs device files and it is described
in the relevant ABI documentation file.

Signed-off-by: Georgi Vlaev 
Signed-off-by: Guenter Roeck 
Signed-off-by: Mohammad Kamil 
Signed-off-by: Rajat Jain 
Signed-off-by: Tom Kavanagh 
Signed-off-by: Pantelis Antoniou 
[Ported from Juniper kernel]
Signed-off-by: Pantelis Antoniou 
---
 Documentation/ABI/testing/sysfs-platform-jnx | 170 +++
 drivers/staging/Kconfig  |   2 +
 drivers/staging/Makefile |   1 +
 drivers/staging/jnx/Kconfig  |  24 +
 drivers/staging/jnx/Makefile |   5 +
 drivers/staging/jnx/jnx-board-core.c | 247 ++
 drivers/staging/jnx/jnx-subsys-private.h |  35 ++
 drivers/staging/jnx/jnx-subsys.c | 655 +++
 include/linux/jnx/jnx-board-core.h   |  41 ++
 include/linux/jnx/jnx-subsys.h   |  94 
 10 files changed, 1274 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-platform-jnx
 create mode 100644 drivers/staging/jnx/Kconfig
 create mode 100644 drivers/staging/jnx/Makefile
 create mode 100644 drivers/staging/jnx/jnx-board-core.c
 create mode 100644 drivers/staging/jnx/jnx-subsys-private.h
 create mode 100644 drivers/staging/jnx/jnx-subsys.c
 create mode 100644 include/linux/jnx/jnx-board-core.h
 create mode 100644 include/linux/jnx/jnx-subsys.h

diff --git a/Documentation/ABI/testing/sysfs-platform-jnx 
b/Documentation/ABI/testing/sysfs-platform-jnx
new file mode 100644
index 000..9bc7adc
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-platform-jnx
@@ -0,0 +1,170 @@
+What:  /sys/devices/platform/jnx/chassis/platform
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Read only numeric platform ID of the Juniper platform we're
+   running on. Valid platforms IDs are:
+   SANGRIA 85
+   HENDRICKS   156
+   POLARIS 171
+   OMEGA   181
+
+What:  /sys/devices/platform/jnx/chassis/chassis_no
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Read only chassis number.
+
+What:  /sys/devices/platform/jnx/chassis/multichassis
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Read only multichassis status
+   1 if we're on a multichassis system
+   0 otherwise
+
+What:  /sys/devices/platform/jnx/chassis/master
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Read only numeric ID of the master slot.
+
+What:  /sys/devices/platform/jnx/chassis/mastership
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Read for returning non zero if current RE is master
+   Write for relinquishing mastership to other RE
+
+What:  /sys/devices/platform/jnx/chassis/mastership_alive
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Write to update the mastership watchdog alive.
+   The watchdog period is CBD FPGA specific.
+
+What:  /sys/devices/platform/jnx/chassis/mastership_alive_cnt
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Read to return the mastership count number
+   Write to set the mastership count number
+
+What:  /sys/devices/platform/jnx/card/foo[n]
+Date:  Sep 2016
+KernelVersion: 4.8.0-rc7
+Contact:   Georgi Vlaev 
+Description:
+   Symbolic link of the jnx board with the given type
+   foo with an option index number. For instance the
+   first two fan type cards would link like this:
+
+   /sys/devices/platform/jnx/card/fan0 -> ../jnx-09cc.0
+   /sys/devices/platform/jnx/card/fan1 -> ../jnx-09cc.1
+
+What:  /sys/devices/platform/jnx/jnx-.N/id
+Date:  Sep 2016
+KernelVe

Re: [PATCH 2/3] staging: jnx: Common Juniper PCI methods

2016-10-07 Thread Joe Perches

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


[PATCH 1/3] Staging: i4l: Warning "Prefer "pr_debug over printk(KERN_DEBUG... " fixed

2016-10-07 Thread Harman Kalra
Warning "Prefer "pr_debug over printk(KERN_DEBUG... " and "few line more than 
80 character" fixed
Signed-off-by: Harman Kalra 
---
 drivers/staging/i4l/icn/icn.h |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/i4l/icn/icn.h b/drivers/staging/i4l/icn/icn.h
index f8f2e76..aa4c593 100644
--- a/drivers/staging/i4l/icn/icn.h
+++ b/drivers/staging/i4l/icn/icn.h
@@ -54,7 +54,8 @@
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) \
+   {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
-- 
1.7.9.5

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


[PATCH 2/3] Staging: i4l: Error "open brace { should be on the previous line" fixed.

2016-10-07 Thread Harman Kalra
Errors "open brace { should be on the previous line" caught by checkpatch.pl  
fixed.
Signed-off-by: Harman Kalra 
---
 drivers/staging/i4l/icn/icn.h |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/i4l/icn/icn.h b/drivers/staging/i4l/icn/icn.h
index aa4c593..8d0182c 100644
--- a/drivers/staging/i4l/icn/icn.h
+++ b/drivers/staging/i4l/icn/icn.h
@@ -187,8 +187,7 @@
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12};  /* for 
icn_map_channel() */
 
 static icn_dev dev;
 
-- 
1.7.9.5

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


[PATCH 3/3] Staging: i4l: Error "open brace { should be on the previous line" fixed.

2016-10-07 Thread Harman Kalra
Error "open brace { should be on the previous line" caught by checkpatch.pl 
fixed.
Signed-off-by: Harman Kalra 
---
 drivers/staging/i4l/icn/icn.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/i4l/icn/icn.c b/drivers/staging/i4l/icn/icn.c
index 514bfc2..3750ba3 100644
--- a/drivers/staging/i4l/icn/icn.c
+++ b/drivers/staging/i4l/icn/icn.c
@@ -411,8 +411,7 @@
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{"BCON_",  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{"BDIS_",  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
-- 
1.7.9.5

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


Re: [PATCH] Staging:fbtft/fb_s6d02a1.c: fixed 80 character line limit coding

2016-10-07 Thread Greg KH
On Fri, Oct 07, 2016 at 08:43:02AM -0700, Nadim Almas wrote:
> style issue
> 
> Fixed coding style issue

This does not seem like valid sentances that mean much to me.  Do they
to you?

> 
> Signed-off-by: Nadim Almas 
> ---
>  drivers/staging/fbtft/fb_s6d02a1.c | 30 --
>  1 file changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/staging/fbtft/fb_s6d02a1.c 
> b/drivers/staging/fbtft/fb_s6d02a1.c
> index 774b0ff..bc0c48f 100644
> --- a/drivers/staging/fbtft/fb_s6d02a1.c
> +++ b/drivers/staging/fbtft/fb_s6d02a1.c
> @@ -30,20 +30,27 @@ static int default_init_sequence[] = {
>  
>   -1, 0xfc, 0x5a, 0x5a,
>  
> - -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A, 
> 0x3A, 0x3A, 0x3d, 0x02, 0x01,
> + -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A,
> + 0x3A, 0x3A, 0x3d, 0x02, 0x01,

This looks worse to me now, remember, checkpatch.pl is a "hint", not a
hard-and-fast-rule.  Use it wisely.

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


[PATCH] fbtft: Convert int arrays to s16

2016-10-07 Thread Joe Perches
These arrays use -1, -2, and -3 as initiators for various types of
writes to initialize hardware.

No values are used that conflict with using these arrays as s16
instead of int and reducing overall data is good.

$ size drivers/staging/fbtft/built-in.o*
   textdata bss dec hex filename
 116120   328724152  153144   25638 drivers/staging/fbtft/built-in.o.new
 116104   363446200  158648   26bb8 drivers/staging/fbtft/built-in.o.old

Miscellaneous:

o Realign some of the arrays to make reading a bit easier

Signed-off-by: Joe Perches 
---
 drivers/staging/fbtft/fb_ili9481.c   |   2 +-
 drivers/staging/fbtft/fb_ili9486.c   |   2 +-
 drivers/staging/fbtft/fb_s6d02a1.c   |   2 +-
 drivers/staging/fbtft/fb_st7735r.c   |   2 +-
 drivers/staging/fbtft/fbtft-core.c   |   2 +-
 drivers/staging/fbtft/fbtft.h|   4 +-
 drivers/staging/fbtft/fbtft_device.c |  12 +-
 drivers/staging/fbtft/flexfb.c   | 372 +--
 8 files changed, 323 insertions(+), 75 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ili9481.c 
b/drivers/staging/fbtft/fb_ili9481.c
index 242adb3859bd..4e75f5abe2f9 100644
--- a/drivers/staging/fbtft/fb_ili9481.c
+++ b/drivers/staging/fbtft/fb_ili9481.c
@@ -27,7 +27,7 @@
 #define WIDTH  320
 #define HEIGHT 480
 
-static int default_init_sequence[] = {
+static s16 default_init_sequence[] = {
/* SLP_OUT - Sleep out */
-1, MIPI_DCS_EXIT_SLEEP_MODE,
-2, 50,
diff --git a/drivers/staging/fbtft/fb_ili9486.c 
b/drivers/staging/fbtft/fb_ili9486.c
index fa38d8885f0b..f4b314265f9e 100644
--- a/drivers/staging/fbtft/fb_ili9486.c
+++ b/drivers/staging/fbtft/fb_ili9486.c
@@ -26,7 +26,7 @@
 #define HEIGHT 480
 
 /* this init sequence matches PiScreen */
-static int default_init_sequence[] = {
+static s16 default_init_sequence[] = {
/* Interface Mode Control */
-1, 0xb0, 0x0,
-1, MIPI_DCS_EXIT_SLEEP_MODE,
diff --git a/drivers/staging/fbtft/fb_s6d02a1.c 
b/drivers/staging/fbtft/fb_s6d02a1.c
index 774b0ff69e6d..eb712aa0d692 100644
--- a/drivers/staging/fbtft/fb_s6d02a1.c
+++ b/drivers/staging/fbtft/fb_s6d02a1.c
@@ -24,7 +24,7 @@
 
 #define DRVNAME "fb_s6d02a1"
 
-static int default_init_sequence[] = {
+static s16 default_init_sequence[] = {
 
-1, 0xf0, 0x5a, 0x5a,
 
diff --git a/drivers/staging/fbtft/fb_st7735r.c 
b/drivers/staging/fbtft/fb_st7735r.c
index 6670f2bb62ec..710b74bbba97 100644
--- a/drivers/staging/fbtft/fb_st7735r.c
+++ b/drivers/staging/fbtft/fb_st7735r.c
@@ -25,7 +25,7 @@
 #define DEFAULT_GAMMA   "0F 1A 0F 18 2F 28 20 22 1F 1B 23 37 00 07 02 10\n" \
"0F 1B 0F 17 33 2C 29 2E 30 30 39 3F 00 07 03 10"
 
-static int default_init_sequence[] = {
+static s16 default_init_sequence[] = {
-1, MIPI_DCS_SOFT_RESET,
-2, 150,   /* delay */
 
diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index 587f68aa466c..df4464fc4530 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -660,7 +660,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct 
fbtft_display *display,
unsigned int bpp = display->bpp;
unsigned int fps = display->fps;
int vmem_size, i;
-   int *init_sequence = display->init_sequence;
+   s16 *init_sequence = display->init_sequence;
char *gamma = display->gamma;
unsigned long *gamma_curves = NULL;
 
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 89c4b5b76ce6..aacdde92cc2e 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -124,7 +124,7 @@ struct fbtft_display {
unsigned int bpp;
unsigned int fps;
int txbuflen;
-   int *init_sequence;
+   s16 *init_sequence;
char *gamma;
int gamma_num;
int gamma_len;
@@ -229,7 +229,7 @@ struct fbtft_par {
int led[16];
int aux[16];
} gpio;
-   int *init_sequence;
+   s16 *init_sequence;
struct {
struct mutex lock;
unsigned long *curves;
diff --git a/drivers/staging/fbtft/fbtft_device.c 
b/drivers/staging/fbtft/fbtft_device.c
index e9211831b6a1..de46f8d988d2 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -96,9 +96,9 @@ static unsigned int buswidth = 8;
 module_param(buswidth, uint, 0);
 MODULE_PARM_DESC(buswidth, "Display bus width, used with the custom argument");
 
-static int init[FBTFT_MAX_INIT_SEQUENCE];
+static s16 init[FBTFT_MAX_INIT_SEQUENCE];
 static int init_num;
-module_param_array(init, int, &init_num, 0);
+module_param_array(init, short, &init_num, 0);
 MODULE_PARM_DESC(init, "Init sequence, used with the custom argument");
 
 static unsigned long debug;
@@ -131,7 +131,7 @@ static void adafruit18_green_tab_set_addr_win(struct 
fbtft_par *par,
"D0 00 14 15 13 2C 42 43 4E 09

Re: [RFC 1/2] staging: jnx: Add Juniper connector driver

2016-10-07 Thread Joe Perches
On Fri, 2016-10-07 at 18:16 +0300, Pantelis Antoniou wrote:
> diff --git a/drivers/staging/jnx/jnx-connector.c 
> b/drivers/staging/jnx/jnx-connector.c
[]
> +struct jnx_conn_data {
> + struct device *dev; /* parent (platform) device */
> + const char *name[NUM_OVERLAYS]; /* overlay file names */
> + bool enabled;   /* true if can handle interrupts */
> + bool poweron;   /* true if assumed to be powered on */

maybe use pahole and remove some of the wasteful padding

> + int attention_button;   /* attention button gpio pin */
> + bool have_attention_button; /* true if attention button exists */
> + unsigned long attention_button_holdtime;/* button hold time, jiffies */
> + bool attention_ignore;  /* true if handled by user space */
> + int power_enable;   /* power enable gpio pin */
> + bool auto_enable;   /* true if board should auto-enable */
> + struct jnx_i2c_power_seq pon;   /* power-on sequence */
[]
> + u32 gpio_flags;
> + u16 assembly_id;
> + int slot;   /* slot number */
> + int type;   /* card type */
> + bool static_assembly_id;/* true if assembly_id is static */
> + bool assembly_id_valid; /* true if assembly_id is valid */
> + int adapter;/* parent i2c adapter number */
[]
> + struct mutex mutex; /* mutex to protect state changes */
> + bool synchronous;   /* true if state changes are ok */
> + struct mutex fdt_mutex; /* mutex to protect fdt accesses */
[]
> + bool standby_to_master; /* standby:master_ev processing */
> +};
[]
> +/*
> + * jnx_conn_insert_ideeprom()
> + *   Inserts ideeprom with a parent from OF prop
> + */
> +static int jnx_conn_insert_ideeprom(struct jnx_conn_data *data,
> + struct i2c_adapter *adap,
> + struct device_node *node,
> + struct i2c_board_info *info)
> +{
> + struct device *dev = data->dev;
> + struct i2c_adapter *parent = NULL;
> + struct i2c_client *client;
> + struct device_node *anode;
> + struct at24_platform_data at24_pdata = {
> + .byte_len = 256,
> + .page_size = 4,
> + .setup = jnx_conn_at24_callback,
> + .context = data,
> + };
> +
> + info->platform_data = &at24_pdata;

Assigning a temporary address through a pointer argument?
Isn't there a better way?

> +/*
> + * jnx_conn_verify_overlay()
> + *
> + * Verify if overlay is compatible with this board/slot
> + */
> +static int jnx_conn_verify_overlay(struct jnx_conn_data *data,
> +struct device_node *np)
> +{
[]
> + ret = of_property_read_u32(np, "type", &var);
> + if (ret) {
> + dev_err(dev, "Missing type property\n");
> + return ret;
> + }
> + if (var != data->type) {
> + dev_err(dev, "Wrong type: Expected %d, got %d\n",
> + data->type, var);
> + return -EINVAL;
> + }
> +
> + /*
> +  * 'assembly-ids' property must exist, and one of its entries must match
> +  * the card assembly id
> +  */
> + assembly_ids = of_get_property(np, "assembly-ids", &size);
> + if (!assembly_ids || size < sizeof(u32)) {
> + dev_err(dev, "Bad assembly-ids property\n");
> + return -EINVAL;
> + }
> + ret = -EINVAL;
> + for (i = 0; i < size / sizeof(u32); i++) {
> + if (be32_to_cpu(assembly_ids[i]) == data->assembly_id) {
> + ret = 0;
> + break;
> + }
> + }
> + if (ret) {
> + dev_err(dev, "Assembly ID 0x%x not supported by overlay\n",
> + data->assembly_id);
> + return ret;
> + }

Given all the direct returns above here, perhaps

for (i = 0; i < size / sizeof(u32); i++) {
if (be32_to_cpu(assembly_ids[i]) == data->assembly_id)
return 0;
}

dev_err(...);
return -EINVAL;


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


[PATCH 25/34] staging:r8188eu: remove prhdr local variable from rtw_free_stainfo function

2016-10-07 Thread Ivan Safonov
This variable is unnecessary.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index a71e252..941d1a0 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -310,7 +310,6 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct 
sta_info *psta)
/* for A-MPDU Rx reordering buffer control, cancel 
reordering_ctrl_timer */
for (i = 0; i < 16; i++) {
struct list_head *phead, *plist;
-   struct recv_frame *prhdr;
struct recv_frame *prframe;
struct __queue *ppending_recvframe_queue;
struct __queue *pfree_recv_queue = 
&padapter->recvpriv.free_recv_queue;
@@ -327,8 +326,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct 
sta_info *psta)
plist = phead->next;
 
while (!list_empty(phead)) {
-   prhdr = container_of(plist, struct recv_frame, list);
-   prframe = (struct recv_frame *)prhdr;
+   prframe = container_of(plist, struct recv_frame, list);
 
plist = plist->next;
 
-- 
2.7.3

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


[PATCH 13/34] staging:r8188eu: remove ExternalPA member of hal_data_8188e structure

2016-10-07 Thread Ivan Safonov
ExternalPA always is false.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/rf.c   | 2 --
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rf.c 
b/drivers/staging/rtl8188eu/hal/rf.c
index 2f3edf0..eddd075 100644
--- a/drivers/staging/rtl8188eu/hal/rf.c
+++ b/drivers/staging/rtl8188eu/hal/rf.c
@@ -61,8 +61,6 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
*adapt, u8 *powerlevel)
  (powerlevel[idx1]<<8) |
  (powerlevel[idx1]<<16) |
  (powerlevel[idx1]<<24);
-   if (tx_agc[idx1] > 0x20 && hal_data->ExternalPA)
-   tx_agc[idx1] = 0x20;
}
} else {
if (pdmpriv->DynamicTxHighPowerLvl == TxHighPwrLevel_Level1) {
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index 19264a2..942ce91 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -268,7 +268,6 @@ struct hal_data_8188e {
u32 AntennaTxPath;  /*  Antenna path Tx */
u32 AntennaRxPath;  /*  Antenna path Rx */
u8  BluetoothCoexist;
-   u8  ExternalPA;
 
u8  b1x1RecvCombine;/*  for 1T1R receive combining */
 
-- 
2.7.3

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


[PATCH 27/34] staging:r8188eu: remove pallocated_recv_buf member of the recv_priv structure

2016-10-07 Thread Ivan Safonov
recv_priv used instead.
recv_priv does not changed after assigning
and it can be used as kfree argument

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 10 +++---
 drivers/staging/rtl8188eu/include/rtw_recv.h   |  1 -
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index d3d64fa..0fc093e 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -37,18 +37,14 @@ int rtw_hal_init_recv_priv(struct adapter *padapter)
/* init recv_buf */
_rtw_init_queue(&precvpriv->free_recv_buf_queue);
 
-   precvpriv->pallocated_recv_buf =
+   precvpriv->precv_buf =
kcalloc(NR_RECVBUFF, sizeof(struct recv_buf), GFP_KERNEL);
-   if (!precvpriv->pallocated_recv_buf) {
+   if (!precvpriv->precv_buf) {
res = _FAIL;
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
("alloc recv_buf fail!\n"));
goto exit;
}
-
-   precvpriv->precv_buf = (struct recv_buf 
*)precvpriv->pallocated_recv_buf;
-
-
precvbuf = precvpriv->precv_buf;
 
for (i = 0; i < NR_RECVBUFF; i++) {
@@ -93,7 +89,7 @@ void rtw_hal_free_recv_priv(struct adapter *padapter)
precvbuf++;
}
 
-   kfree(precvpriv->pallocated_recv_buf);
+   kfree(precvpriv->precv_buf);
 
if (skb_queue_len(&precvpriv->rx_skb_queue))
DBG_88E(KERN_WARNING "rx_skb_queue not empty\n");
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 8fa3b81..e95f4f2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -180,7 +180,6 @@ struct recv_priv {
struct tasklet_struct recv_tasklet;
struct sk_buff_head free_recv_skb_queue;
struct sk_buff_head rx_skb_queue;
-   u8 *pallocated_recv_buf;
struct recv_buf *precv_buf;/*  4 alignment */
struct __queue free_recv_buf_queue;
/* For display the phy informatiom */
-- 
2.7.3

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


[PATCH 21/34] staging:r8188eu: remove ANTTEST(ALL|A|B) definitions

2016-10-07 Thread Ivan Safonov
These defintions does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/odm.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/odm.h 
b/drivers/staging/rtl8188eu/include/odm.h
index 0c15e5f..4fb3bb0 100644
--- a/drivers/staging/rtl8188eu/include/odm.h
+++ b/drivers/staging/rtl8188eu/include/odm.h
@@ -80,11 +80,6 @@
 #define DM_DIG_FA_TH2_LPS  30 /*  30 lps */
 #define RSSI_OFFSET_DIG0x05;
 
-/* ANT Test */
-#define ANTTESTALL 0x00/* Ant A or B will be Testing */
-#define ANTTESTA   0x01/* Ant A will be Testing */
-#define ANTTESTB   0x02/* Ant B will be testing */
-
 struct rtw_dig {
u8  Dig_Enable_Flag;
u8  Dig_Ext_Port_Stage;
-- 
2.7.3

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


[PATCH 01/34] staging:r8188eu: remove rtw_os_recv_resource_alloc function

2016-10-07 Thread Ivan Safonov
This simple function does not allocate any resource.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 3 +--
 drivers/staging/rtl8188eu/include/recv_osdep.h | 2 --
 drivers/staging/rtl8188eu/os_dep/recv_linux.c  | 6 --
 3 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index b87cbbb..65ae11e 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -83,8 +83,7 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
list_add_tail(&(precvframe->list),
 &(precvpriv->free_recv_queue.queue));
 
-   rtw_os_recv_resource_alloc(precvframe);
-
+   precvframe->pkt = NULL;
precvframe->len = 0;
 
precvframe->adapter = padapter;
diff --git a/drivers/staging/rtl8188eu/include/recv_osdep.h 
b/drivers/staging/rtl8188eu/include/recv_osdep.h
index 7550d58..9b43a13 100644
--- a/drivers/staging/rtl8188eu/include/recv_osdep.h
+++ b/drivers/staging/rtl8188eu/include/recv_osdep.h
@@ -29,8 +29,6 @@ int rtw_recv_indicatepkt(struct adapter *adapter,
 
 void rtw_handle_tkip_mic_err(struct adapter *padapter, u8 bgroup);
 
-void rtw_os_recv_resource_alloc(struct recv_frame *recvfr);
-
 int rtw_os_recvbuf_resource_alloc(struct adapter *adapt, struct recv_buf *buf);
 
 void rtw_init_recv_timer(struct recv_reorder_ctrl *preorder_ctrl);
diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index 103cdb4..b85824e 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -21,12 +21,6 @@
 #include 
 #include 
 
-/* alloc os related resource in struct recv_frame */
-void rtw_os_recv_resource_alloc(struct recv_frame *precvframe)
-{
-   precvframe->pkt = NULL;
-}
-
 /* alloc os related resource in struct recv_buf */
 int rtw_os_recvbuf_resource_alloc(struct adapter *padapter,
  struct recv_buf *precvbuf)
-- 
2.7.3

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


[PATCH 02/34] staging:r8188eu: remove wrappers for rtw_hal_inirp_init function

2016-10-07 Thread Ivan Safonov
There is no reason to use these wrappers.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/drv_types.h |  1 -
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   |  6 ++
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   | 10 --
 3 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/drv_types.h 
b/drivers/staging/rtl8188eu/include/drv_types.h
index 32326fd..5eb56b1 100644
--- a/drivers/staging/rtl8188eu/include/drv_types.h
+++ b/drivers/staging/rtl8188eu/include/drv_types.h
@@ -156,7 +156,6 @@ struct adapter {
u8  hw_init_completed;
 
void *cmdThread;
-   void (*intf_start)(struct adapter *adapter);
void (*intf_stop)(struct adapter *adapter);
struct  net_device *pnetdev;
struct  net_device *pmondev;
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index 40691f1..8d96e51 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -596,8 +596,7 @@ static int _netdev_open(struct net_device *pnetdev)
pr_info("can't init mlme_ext_priv\n");
goto netdev_open_error;
}
-   if (padapter->intf_start)
-   padapter->intf_start(padapter);
+   rtw_hal_inirp_init(padapter);
 
rtw_led_control(padapter, LED_CTL_NO_LINK);
 
@@ -658,8 +657,7 @@ static int  ips_netdrv_open(struct adapter *padapter)
goto netdev_open_error;
}
 
-   if (padapter->intf_start)
-   padapter->intf_start(padapter);
+   rtw_hal_inirp_init(padapter);
 
rtw_set_pwr_state_check_timer(&padapter->pwrctrlpriv);
mod_timer(&padapter->mlmepriv.dynamic_chk_timer,
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 68e1e6b..4996332 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -141,15 +141,6 @@ static void usb_dvobj_deinit(struct usb_interface 
*usb_intf)
 
 }
 
-static void usb_intf_start(struct adapter *padapter)
-{
-   RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+usb_intf_start\n"));
-
-   rtw_hal_inirp_init(padapter);
-
-   RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("-usb_intf_start\n"));
-}
-
 static void usb_intf_stop(struct adapter *padapter)
 {
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+usb_intf_stop\n"));
@@ -366,7 +357,6 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv 
*dvobj,
if (!padapter->HalData)
DBG_88E("cant not alloc memory for HAL DATA\n");
 
-   padapter->intf_start = &usb_intf_start;
padapter->intf_stop = &usb_intf_stop;
 
/* step read_chip_version */
-- 
2.7.3

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


[PATCH 04/34] staging:r8188eu: remove free_recv_buf_queue_cnt member of recv_priv structure

2016-10-07 Thread Ivan Safonov
This variable does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 1 -
 drivers/staging/rtl8188eu/hal/usb_halinit.c| 1 -
 drivers/staging/rtl8188eu/include/rtw_recv.h   | 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index d0495a1..67a765a 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -58,7 +58,6 @@ int   rtw_hal_init_recv_priv(struct adapter *padapter)
precvbuf->adapter = padapter;
precvbuf++;
}
-   precvpriv->free_recv_buf_queue_cnt = NR_RECVBUFF;
skb_queue_head_init(&precvpriv->rx_skb_queue);
{
int i;
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 7692ca4..a09c68f 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -1006,7 +1006,6 @@ u32 rtw_hal_inirp_init(struct adapter *Adapter)
}
 
precvbuf++;
-   precvpriv->free_recv_buf_queue_cnt--;
}
 
 exit:
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 49d9738..a8874a2 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -186,7 +186,6 @@ struct recv_priv {
u8 *pallocated_recv_buf;
u8 *precv_buf;/*  4 alignment */
struct __queue free_recv_buf_queue;
-   u32 free_recv_buf_queue_cnt;
/* For display the phy informatiom */
u8 is_signal_dbg;   /*  for debug */
u8 signal_strength_dbg; /*  for debug */
-- 
2.7.3

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


[PATCH 03/34] staging:r8188eu: remove pm_netdev_open function

2016-10-07 Thread Ivan Safonov
netdev_open and ips_netdrv_open are used instead of pm_netdev_open.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c   |  2 +-
 drivers/staging/rtl8188eu/include/osdep_intf.h |  3 ++-
 drivers/staging/rtl8188eu/os_dep/os_intfs.c| 16 ++--
 drivers/staging/rtl8188eu/os_dep/usb_intf.c|  2 +-
 4 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index 0b70fe7..fc6385b 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -94,7 +94,7 @@ static int rtw_hw_resume(struct adapter *padapter)
pwrpriv->bips_processing = true;
rtw_reset_drv_sw(padapter);
 
-   if (pm_netdev_open(pnetdev, false) != 0) {
+   if (ips_netdrv_open((struct adapter *)rtw_netdev_priv(pnetdev)) != 
_SUCCESS) {
mutex_unlock(&pwrpriv->mutex_lock);
goto error_exit;
}
diff --git a/drivers/staging/rtl8188eu/include/osdep_intf.h 
b/drivers/staging/rtl8188eu/include/osdep_intf.h
index dbd7dc4..97d3d85 100644
--- a/drivers/staging/rtl8188eu/include/osdep_intf.h
+++ b/drivers/staging/rtl8188eu/include/osdep_intf.h
@@ -35,7 +35,8 @@ int rtw_init_netdev_name(struct net_device *pnetdev, const 
char *ifname);
 struct net_device *rtw_init_netdev(struct adapter *padapter);
 u16 rtw_recv_select_queue(struct sk_buff *skb);
 
-int pm_netdev_open(struct net_device *pnetdev, u8 bnormal);
+int netdev_open(struct net_device *pnetdev);
+int ips_netdrv_open(struct adapter *padapter);
 void rtw_ips_dev_unload(struct adapter *padapter);
 int rtw_ips_pwr_up(struct adapter *padapter);
 void rtw_ips_pwr_down(struct adapter *padapter);
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index 8d96e51..2a1e63d 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -144,7 +144,6 @@ static bool rtw_monitor_enable;
 module_param_named(monitor_enable, rtw_monitor_enable, bool, 0444);
 MODULE_PARM_DESC(monitor_enable, "Enable monitor inferface (default: false)");
 
-static int netdev_open(struct net_device *pnetdev);
 static int netdev_close(struct net_device *pnetdev);
 
 static void loadparam(struct adapter *padapter, struct net_device *pnetdev)
@@ -629,7 +628,7 @@ netdev_open_error:
return -1;
 }
 
-static int netdev_open(struct net_device *pnetdev)
+int netdev_open(struct net_device *pnetdev)
 {
int ret;
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
@@ -641,7 +640,7 @@ static int netdev_open(struct net_device *pnetdev)
return ret;
 }
 
-static int  ips_netdrv_open(struct adapter *padapter)
+int  ips_netdrv_open(struct adapter *padapter)
 {
int status = _SUCCESS;
 
@@ -718,17 +717,6 @@ void rtw_ips_dev_unload(struct adapter *padapter)
rtw_hal_deinit(padapter);
 }
 
-int pm_netdev_open(struct net_device *pnetdev, u8 bnormal)
-{
-   int status;
-
-   if (bnormal)
-   status = netdev_open(pnetdev);
-   else
-   status =  (_SUCCESS == ips_netdrv_open((struct adapter 
*)rtw_netdev_priv(pnetdev))) ? (0) : (-1);
-   return status;
-}
-
 static int netdev_close(struct net_device *pnetdev)
 {
struct adapter *padapter = (struct adapter *)rtw_netdev_priv(pnetdev);
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 4996332..94dac53 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -285,7 +285,7 @@ static int rtw_resume_process(struct adapter *padapter)
pwrpriv->bkeepfwalive = false;
 
pr_debug("bkeepfwalive(%x)\n", pwrpriv->bkeepfwalive);
-   if (pm_netdev_open(pnetdev, true) != 0) {
+   if (netdev_open(pnetdev) != 0) {
mutex_unlock(&pwrpriv->mutex_lock);
goto exit;
}
-- 
2.7.3

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


[PATCH 09/34] staging:r8188eu: remove wrappers for LedControl8188eu function

2016-10-07 Thread Ivan Safonov
There is no reason to use these wrappers.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c  | 6 +++---
 drivers/staging/rtl8188eu/core/rtw_mlme.c | 4 ++--
 drivers/staging/rtl8188eu/core/rtw_pwrctrl.c  | 2 +-
 drivers/staging/rtl8188eu/core/rtw_recv.c | 4 ++--
 drivers/staging/rtl8188eu/core/rtw_xmit.c | 2 +-
 drivers/staging/rtl8188eu/hal/rtl8188eu_led.c | 1 -
 drivers/staging/rtl8188eu/include/rtw_led.h   | 8 
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   | 8 
 8 files changed, 13 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index f1f4788..36109ce 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -308,7 +308,7 @@ u8 rtw_sitesurvey_cmd(struct adapter  *padapter, struct 
ndis_802_11_ssid *ssid,
mod_timer(&pmlmepriv->scan_to_timer,
  jiffies + msecs_to_jiffies(SCANNING_TIMEOUT));
 
-   rtw_led_control(padapter, LED_CTL_SITE_SURVEY);
+   LedControl8188eu(padapter, LED_CTL_SITE_SURVEY);
 
pmlmepriv->scan_interval = SCAN_INTERVAL;/*  30*2 sec = 60sec */
} else {
@@ -335,7 +335,7 @@ u8 rtw_createbss_cmd(struct adapter  *padapter)
u8  res = _SUCCESS;
 
 
-   rtw_led_control(padapter, LED_CTL_START_TO_LINK);
+   LedControl8188eu(padapter, LED_CTL_START_TO_LINK);
 
if (pmlmepriv->assoc_ssid.SsidLength == 0)
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, (" createbss for 
Any SSid:%s\n", pmlmepriv->assoc_ssid.Ssid));
@@ -379,7 +379,7 @@ u8 rtw_joinbss_cmd(struct adapter  *padapter, struct 
wlan_network *pnetwork)
struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
 
 
-   rtw_led_control(padapter, LED_CTL_START_TO_LINK);
+   LedControl8188eu(padapter, LED_CTL_START_TO_LINK);
 
if (pmlmepriv->assoc_ssid.SsidLength == 0)
RT_TRACE(_module_rtl871x_cmd_c_, _drv_info_, ("+Join cmd: Any 
SSid\n"));
diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index ee2dcd0..032f783 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -801,7 +801,7 @@ void rtw_indicate_connect(struct adapter *padapter)
if (!check_fwstate(&padapter->mlmepriv, _FW_LINKED)) {
set_fwstate(pmlmepriv, _FW_LINKED);
 
-   rtw_led_control(padapter, LED_CTL_LINK);
+   LedControl8188eu(padapter, LED_CTL_LINK);
 
rtw_os_indicate_connect(padapter);
}
@@ -833,7 +833,7 @@ void rtw_indicate_disconnect(struct adapter *padapter)
rtw_os_indicate_disconnect(padapter);
 
_clr_fwstate_(pmlmepriv, _FW_LINKED);
-   rtw_led_control(padapter, LED_CTL_NO_LINK);
+   LedControl8188eu(padapter, LED_CTL_NO_LINK);
rtw_clear_scan_deny(padapter);
}
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c 
b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
index fc6385b..4032121 100644
--- a/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8188eu/core/rtw_pwrctrl.c
@@ -56,7 +56,7 @@ static int rtw_hw_suspend(struct adapter *padapter)
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
_clr_fwstate_(pmlmepriv, _FW_LINKED);
 
-   rtw_led_control(padapter, LED_CTL_NO_LINK);
+   LedControl8188eu(padapter, LED_CTL_NO_LINK);
 
rtw_os_indicate_disconnect(padapter);
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 65ae11e..1b544e6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -1293,7 +1293,7 @@ static int validate_recv_frame(struct adapter *adapter,
retval = _FAIL; /*  only data frame return _SUCCESS */
break;
case WIFI_DATA_TYPE: /* data */
-   rtw_led_control(adapter, LED_CTL_RX);
+   LedControl8188eu(adapter, LED_CTL_RX);
pattrib->qos = (subtype & BIT(7)) ? 1 : 0;
retval = validate_recv_data_frame(adapter, precv_frame);
if (retval == _FAIL) {
@@ -1988,7 +1988,7 @@ static int recv_func_posthandle(struct adapter *padapter,
struct __queue *pfree_recv_queue = &padapter->recvpriv.free_recv_queue;
 
/*  DATA FRAME */
-   rtw_led_control(padapter, LED_CTL_RX);
+   LedControl8188eu(padapter, LED_CTL_RX);
 
prframe = decryptor(padapter, prframe);
if (prframe == NULL) {
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 0f8b8e0..2b641f5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -16

[PATCH 32/34] staging:r8188eu: change poiter type from u8 to void for pallocated_frame_buf member of recv_priv structure

2016-10-07 Thread Ivan Safonov
pallocated_frame_buf used only to preserve pointer for vfree function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c| 2 +-
 drivers/staging/rtl8188eu/include/rtw_recv.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index a1b30a5..3e6edb6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -71,7 +71,7 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
if (!precvpriv->pallocated_frame_buf)
return _FAIL;
 
-   precvframe = (struct recv_frame 
*)PTR_ALIGN(precvpriv->pallocated_frame_buf, RXFRAME_ALIGN_SZ);
+   precvframe = PTR_ALIGN(precvpriv->pallocated_frame_buf, 
RXFRAME_ALIGN_SZ);
 
for (i = 0; i < NR_RECVFRAME; i++) {
INIT_LIST_HEAD(&(precvframe->list));
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 979961d..052af7b 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -164,7 +164,7 @@ struct recv_priv {
struct __queue free_recv_queue;
struct __queue recv_pending_queue;
struct __queue uc_swdec_pending_queue;
-   u8 *pallocated_frame_buf;
+   void *pallocated_frame_buf;
struct adapter  *adapter;
u32 bIsAnyNonBEPkts;
u64 rx_bytes;
-- 
2.7.3

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


[PATCH 17/34] staging:r8188eu: remove RF_TYPE_8190P enumeration

2016-10-07 Thread Ivan Safonov
This enumeration does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h 
b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
index 0976a76..550ad62 100644
--- a/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
+++ b/drivers/staging/rtl8188eu/include/Hal8188EPhyCfg.h
@@ -99,17 +99,6 @@ enum phy_rate_tx_offset_area {
RA_OFFSET_HT_CCK,
 };
 
-/* BB/RF related */
-enum RF_TYPE_8190P {
-   RF_TYPE_MIN,/*  0 */
-   RF_8225 = 1,/*  1 11b/g RF for verification only */
-   RF_8256 = 2,/*  2 11b/g/n */
-   RF_8258 = 3,/*  3 11a/b/g/n RF */
-   RF_6052 = 4,/*  4 11b/g/n RF */
-   /*  TODO: We should remove this psudo PHY RF after we get new RF. */
-   RF_PSEUDO_11N = 5,  /*  5, It is a temporality RF. */
-};
-
 struct bb_reg_def {
u32 rfintfs;/*  set software control: */
/*  0x870~0x877[8 bytes] */
-- 
2.7.3

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


[PATCH 08/34] staging:r8188eu: remove ff_hwaddr member of recv_priv structure

2016-10-07 Thread Ivan Safonov
Its value used instead.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c  | 4 +---
 drivers/staging/rtl8188eu/include/rtw_recv.h | 1 -
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 6 +++---
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 95bbeca..dfb78bb 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -994,12 +994,10 @@ u32 rtw_hal_inirp_init(struct adapter *Adapter)
RT_TRACE(_module_hci_hal_init_c_, _drv_info_,
 ("===> usb_inirp_init\n"));
 
-   precvpriv->ff_hwaddr = RECV_BULK_IN_ADDR;
-
/* issue Rx irp to receive data */
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
-   if (usb_read_port(Adapter, precvpriv->ff_hwaddr, precvbuf) == 
false) {
+   if (usb_read_port(Adapter, RECV_BULK_IN_ADDR, precvbuf) == 
false) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, 
("usb_rx_init: usb_read_port error\n"));
status = _FAIL;
goto exit;
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index c868863..e871ebb 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -174,7 +174,6 @@ struct recv_priv {
u64 rx_drop;
u64 last_rx_bytes;
 
-   uintff_hwaddr;
u8  rx_pending_cnt;
 
struct tasklet_struct irq_prepare_beacon_tasklet;
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 24d2250..175c1ae 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -403,7 +403,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
 ("usb_read_port_complete: (purb->actual_length 
> MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n"));
precvbuf->reuse = true;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, precvbuf);
+   usb_read_port(adapt, RECV_BULK_IN_ADDR, precvbuf);
DBG_88E("%s()-%d: RX Warning!\n", __func__, __LINE__);
} else {
skb_put(precvbuf->pskb, purb->actual_length);
@@ -414,7 +414,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
 
precvbuf->pskb = NULL;
precvbuf->reuse = false;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, precvbuf);
+   usb_read_port(adapt, RECV_BULK_IN_ADDR, precvbuf);
}
} else {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, 
("usb_read_port_complete : purb->status(%d) != 0\n", purb->status));
@@ -437,7 +437,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
case -EOVERFLOW:
adapt->HalData->srestpriv.Wifi_Error_Status = 
USB_READ_PORT_FAIL;
precvbuf->reuse = true;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, precvbuf);
+   usb_read_port(adapt, RECV_BULK_IN_ADDR, precvbuf);
break;
case -EINPROGRESS:
DBG_88E("ERROR: URB IS IN PROGRESS!\n");
-- 
2.7.3

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


[PATCH 16/34] staging:r8188eu: remove rf_chip member of hal_data_8188e structure

2016-10-07 Thread Ivan Safonov
This member is constant.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/phy.c  | 13 +
 drivers/staging/rtl8188eu/hal/usb_halinit.c  |  6 --
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h |  1 -
 3 files changed, 1 insertion(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 5192ef7..84ffc01 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -210,13 +210,6 @@ static void phy_set_bw_mode_callback(struct adapter *adapt)
u8 reg_bw_opmode;
u8 reg_prsr_rsc;
 
-   if (hal_data->rf_chip == RF_PSEUDO_11N)
-   return;
-
-   /*  There is no 40MHz mode in RF_8225. */
-   if (hal_data->rf_chip == RF_8225)
-   return;
-
if (adapt->bDriverStopped)
return;
 
@@ -265,8 +258,7 @@ static void phy_set_bw_mode_callback(struct adapter *adapt)
}
 
/* Set RF related register */
-   if (hal_data->rf_chip == RF_6052)
-   rtl88eu_phy_rf6052_set_bandwidth(adapt, 
hal_data->CurrentChannelBW);
+   rtl88eu_phy_rf6052_set_bandwidth(adapt, hal_data->CurrentChannelBW);
 }
 
 void rtw_hal_set_bwmode(struct adapter *adapt, enum ht_channel_width bandwidth,
@@ -307,9 +299,6 @@ void rtw_hal_set_chan(struct adapter *adapt, u8 channel)
struct hal_data_8188e *hal_data = adapt->HalData;
u8 tmpchannel = hal_data->CurrentChannel;
 
-   if (hal_data->rf_chip == RF_PSEUDO_11N)
-   return;
-
if (channel == 0)
channel = 1;
 
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 87e379e..71d6ade 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -1096,18 +1096,12 @@ static void _ReadPROMContent(
readAdapterInfo_8188EU(Adapter);
 }
 
-static void _ReadRFType(struct adapter *Adapter)
-{
-   Adapter->HalData->rf_chip = RF_6052;
-}
-
 void rtw_hal_read_chip_info(struct adapter *Adapter)
 {
unsigned long start = jiffies;
 
MSG_88E("> %s\n", __func__);
 
-   _ReadRFType(Adapter);/* rf_chip -> _InitRFType() */
_ReadPROMContent(Adapter);
 
MSG_88E("< %s in %d ms\n", __func__,
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index 53c975a..226e89b 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -201,7 +201,6 @@ struct hal_data_8188e {
u16 BasicRateSet;
 
/* rf_ctrl */
-   u8  rf_chip;
u8  NumTotalRFPath;
 
u8  BoardType;
-- 
2.7.3

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


[PATCH 12/34] staging:r8188eu: remove bLedOpenDrain member of hal_data_8188e structure

2016-10-07 Thread Ivan Safonov
bLedOpenDrain always is true.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_led.c| 18 ++
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h |  2 --
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c
index a6d775b..12879af 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c
@@ -46,16 +46,12 @@ void SwLedOff(struct adapter *padapter, struct LED_871x 
*pLed)
 
LedCfg = usb_read8(padapter, REG_LEDCFG2);/* 0x4E */
 
-   if (padapter->HalData->bLedOpenDrain) {
-   /*  Open-drain arrangement for controlling the LED) */
-   LedCfg &= 0x90; /*  Set to software control. */
-   usb_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
-   LedCfg = usb_read8(padapter, REG_MAC_PINMUX_CFG);
-   LedCfg &= 0xFE;
-   usb_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
-   } else {
-   usb_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3) | BIT(5) | 
BIT(6)));
-   }
+   /*  Open-drain arrangement for controlling the LED) */
+   LedCfg &= 0x90; /*  Set to software control. */
+   usb_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
+   LedCfg = usb_read8(padapter, REG_MAC_PINMUX_CFG);
+   LedCfg &= 0xFE;
+   usb_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
 exit:
pLed->bLedOn = false;
 }
@@ -69,8 +65,6 @@ void rtw_hal_sw_led_init(struct adapter *padapter)
 {
struct led_priv *pledpriv = &(padapter->ledpriv);
 
-   padapter->HalData->bLedOpenDrain = true;
-
InitLed871x(padapter, &(pledpriv->SwLed0));
 }
 
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index 7c81e3f..19264a2 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -270,8 +270,6 @@ struct hal_data_8188e {
u8  BluetoothCoexist;
u8  ExternalPA;
 
-   u8  bLedOpenDrain; /* Open-drain support for controlling the LED.*/
-
u8  b1x1RecvCombine;/*  for 1T1R receive combining */
 
u32 AcParam_BE; /* Original parameter for BE, use for EDCA turbo. */
-- 
2.7.3

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


[PATCH 22/34] staging:r8188eu: remove rtw_endofpktfile function

2016-10-07 Thread Ivan Safonov
rtw_endofpktfile is one-line function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 2 +-
 drivers/staging/rtl8188eu/include/xmit_osdep.h | 1 -
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c  | 5 -
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 2b641f5..ca65f00 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1064,7 +1064,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, 
struct sk_buff *pkt, struct
 
frg_inx++;
 
-   if (bmcst || rtw_endofpktfile(&pktfile)) {
+   if (bmcst || pktfile.pkt_len == 0) {
pattrib->nr_frags = frg_inx;
 
pattrib->last_txcmdsz = pattrib->hdrlen + 
pattrib->iv_len + ((pattrib->nr_frags == 1) ? llc_sz : 0) +
diff --git a/drivers/staging/rtl8188eu/include/xmit_osdep.h 
b/drivers/staging/rtl8188eu/include/xmit_osdep.h
index f96ca6a..f9b3841 100644
--- a/drivers/staging/rtl8188eu/include/xmit_osdep.h
+++ b/drivers/staging/rtl8188eu/include/xmit_osdep.h
@@ -47,7 +47,6 @@ void rtw_os_xmit_resource_free(struct adapter *padapter,
 uint rtw_remainder_len(struct pkt_file *pfile);
 void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
 uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
-int rtw_endofpktfile(struct pkt_file *pfile);
 
 void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);
 void rtw_os_xmit_complete(struct adapter *padapter,
diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c 
b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
index 4b1b04e..019ded9 100644
--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
@@ -59,11 +59,6 @@ uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, 
uint rlen)
return len;
 }
 
-int rtw_endofpktfile(struct pkt_file *pfile)
-{
-   return pfile->pkt_len == 0;
-}
-
 int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf 
*pxmitbuf, u32 alloc_sz)
 {
int i;
-- 
2.7.3

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


[PATCH 30/34] staging:r8188eu: remove rx_pending_cnt member of recv_priv structure

2016-10-07 Thread Ivan Safonov
Value of this variable does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c| 2 --
 drivers/staging/rtl8188eu/include/rtw_recv.h | 2 --
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 4 
 3 files changed, 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index b5aeb8d..f046c41 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -87,8 +87,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
precvframe->adapter = padapter;
precvframe++;
}
-   precvpriv->rx_pending_cnt = 1;
-
res = rtw_hal_init_recv_priv(padapter);
 
setup_timer(&precvpriv->signal_stat_timer,
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index 40f9728..ffbbbd1 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -173,8 +173,6 @@ struct recv_priv {
u64 rx_drop;
u64 last_rx_bytes;
 
-   u8  rx_pending_cnt;
-
struct tasklet_struct irq_prepare_beacon_tasklet;
struct tasklet_struct recv_tasklet;
struct sk_buff_head free_recv_skb_queue;
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index b87663b..9347dcd 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -384,8 +384,6 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
 
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, 
("usb_read_port_complete!!!\n"));
 
-   precvpriv->rx_pending_cnt--;
-
if (adapt->bSurpriseRemoved || adapt->bDriverStopped || 
adapt->bReadPortCancel) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
 ("usb_read_port_complete:bDriverStopped(%d) OR 
bSurpriseRemoved(%d)\n",
@@ -490,8 +488,6 @@ u32 usb_read_port(struct adapter *adapter, u32 addr, struct 
recv_buf *precvbuf)
precvbuf->reuse = false;
}
 
-   precvpriv->rx_pending_cnt++;
-
purb = precvbuf->purb;
 
/* translate DMA FIFO addr to pipehandle */
-- 
2.7.3

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


[PATCH 20/34] staging:r8188eu: remove bTXPowerTrackingInit member of odm_rf_cal structure

2016-10-07 Thread Ivan Safonov
bTXPowerTrackingInit assigned, but not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/odm.c | 1 -
 drivers/staging/rtl8188eu/hal/phy.c | 1 -
 drivers/staging/rtl8188eu/include/odm.h | 1 -
 3 files changed, 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/odm.c 
b/drivers/staging/rtl8188eu/hal/odm.c
index d983a80..16476e7 100644
--- a/drivers/staging/rtl8188eu/hal/odm.c
+++ b/drivers/staging/rtl8188eu/hal/odm.c
@@ -991,7 +991,6 @@ void odm_TXPowerTrackingThermalMeterInit(struct 
odm_dm_struct *pDM_Odm)
 {
pDM_Odm->RFCalibrateInfo.bTXPowerTracking = true;
pDM_Odm->RFCalibrateInfo.TXPowercount = 0;
-   pDM_Odm->RFCalibrateInfo.bTXPowerTrackingInit = false;
if (*(pDM_Odm->mp_mode) != 1)
pDM_Odm->RFCalibrateInfo.TxPowerTrackControl = true;
MSG_88E("pDM_Odm TxPowerTrackControl = %d\n", 
pDM_Odm->RFCalibrateInfo.TxPowerTrackControl);
diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 126547e..109c2d7 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -412,7 +412,6 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
dm_txpwr_track_setpwr(dm_odm);
 
dm_odm->RFCalibrateInfo.TXPowerTrackingCallbackCnt++;
-   dm_odm->RFCalibrateInfo.bTXPowerTrackingInit = true;
 
dm_odm->RFCalibrateInfo.RegA24 = 0x090e1317;
 
diff --git a/drivers/staging/rtl8188eu/include/odm.h 
b/drivers/staging/rtl8188eu/include/odm.h
index 805f52e..0c15e5f 100644
--- a/drivers/staging/rtl8188eu/include/odm.h
+++ b/drivers/staging/rtl8188eu/include/odm.h
@@ -590,7 +590,6 @@ struct odm_rf_cal {
s32 RegEBC;
 
u8  TXPowercount;
-   boolbTXPowerTrackingInit;
boolbTXPowerTracking;
u8  TxPowerTrackControl; /* for mp mode, turn off txpwrtracking
  * as default */
-- 
2.7.3

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


[PATCH 31/34] staging:r8188eu: remove precv_frame_buf member of recv_priv structure

2016-10-07 Thread Ivan Safonov
precv_frame_buf is used as local variable only in one function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c| 4 +---
 drivers/staging/rtl8188eu/include/rtw_recv.h | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index f046c41..a1b30a5 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -71,9 +71,7 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
if (!precvpriv->pallocated_frame_buf)
return _FAIL;
 
-   precvpriv->precv_frame_buf = PTR_ALIGN(precvpriv->pallocated_frame_buf, 
RXFRAME_ALIGN_SZ);
-
-   precvframe = (struct recv_frame *)precvpriv->precv_frame_buf;
+   precvframe = (struct recv_frame 
*)PTR_ALIGN(precvpriv->pallocated_frame_buf, RXFRAME_ALIGN_SZ);
 
for (i = 0; i < NR_RECVFRAME; i++) {
INIT_LIST_HEAD(&(precvframe->list));
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index ffbbbd1..979961d 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -165,7 +165,6 @@ struct recv_priv {
struct __queue recv_pending_queue;
struct __queue uc_swdec_pending_queue;
u8 *pallocated_frame_buf;
-   u8 *precv_frame_buf;
struct adapter  *adapter;
u32 bIsAnyNonBEPkts;
u64 rx_bytes;
-- 
2.7.3

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


[PATCH 28/34] staging:r8188eu: remove intf_stop member of adapter structure

2016-10-07 Thread Ivan Safonov
call usb_intf_stop directly.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/drv_types.h | 1 -
 drivers/staging/rtl8188eu/include/hal_intf.h  | 1 +
 drivers/staging/rtl8188eu/os_dep/os_intfs.c   | 3 +--
 drivers/staging/rtl8188eu/os_dep/usb_intf.c   | 7 ++-
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/drv_types.h 
b/drivers/staging/rtl8188eu/include/drv_types.h
index 5eb56b1..e86419e 100644
--- a/drivers/staging/rtl8188eu/include/drv_types.h
+++ b/drivers/staging/rtl8188eu/include/drv_types.h
@@ -156,7 +156,6 @@ struct adapter {
u8  hw_init_completed;
 
void *cmdThread;
-   void (*intf_stop)(struct adapter *adapter);
struct  net_device *pnetdev;
struct  net_device *pmondev;
 
diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h 
b/drivers/staging/rtl8188eu/include/hal_intf.h
index fa032b0..e1114a9 100644
--- a/drivers/staging/rtl8188eu/include/hal_intf.h
+++ b/drivers/staging/rtl8188eu/include/hal_intf.h
@@ -190,6 +190,7 @@ void rtw_hal_set_odm_var(struct adapter *padapter,
 
 u32rtw_hal_inirp_init(struct adapter *padapter);
 void   rtw_hal_inirp_deinit(struct adapter *padapter);
+void usb_intf_stop(struct adapter *padapter);
 
 s32rtw_hal_xmit(struct adapter *padapter, struct xmit_frame *pxmitframe);
 s32rtw_hal_mgnt_xmit(struct adapter *padapter,
diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index c933883..8fc3fad 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -709,8 +709,7 @@ void rtw_ips_dev_unload(struct adapter *padapter)
 
rtw_hal_set_hwreg(padapter, HW_VAR_FIFO_CLEARN_UP, NULL);
 
-   if (padapter->intf_stop)
-   padapter->intf_stop(padapter);
+   usb_intf_stop(padapter);
 
/* s5. */
if (!padapter->bSurpriseRemoved)
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 94dac53..c6316ff 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -141,7 +141,7 @@ static void usb_dvobj_deinit(struct usb_interface *usb_intf)
 
 }
 
-static void usb_intf_stop(struct adapter *padapter)
+void usb_intf_stop(struct adapter *padapter)
 {
RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+usb_intf_stop\n"));
 
@@ -174,8 +174,7 @@ static void rtw_dev_unload(struct adapter *padapter)
if (padapter->xmitpriv.ack_tx)
rtw_ack_tx_done(&padapter->xmitpriv, 
RTW_SCTX_DONE_DRV_STOP);
/* s3. */
-   if (padapter->intf_stop)
-   padapter->intf_stop(padapter);
+   usb_intf_stop(padapter);
/* s4. */
if (!padapter->pwrctrlpriv.bInternalAutoSuspend)
rtw_stop_drv_threads(padapter);
@@ -357,8 +356,6 @@ static struct adapter *rtw_usb_if1_init(struct dvobj_priv 
*dvobj,
if (!padapter->HalData)
DBG_88E("cant not alloc memory for HAL DATA\n");
 
-   padapter->intf_stop = &usb_intf_stop;
-
/* step read_chip_version */
rtw_hal_read_chip_version(padapter);
 
-- 
2.7.3

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


[PATCH 10/34] staging:r8188eu: remove bRegUseLed member of led_priv structure

2016-10-07 Thread Ivan Safonov
bRegUseLed always is true.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_led.c  | 5 -
 drivers/staging/rtl8188eu/hal/rtl8188eu_led.c | 1 -
 drivers/staging/rtl8188eu/include/rtw_led.h   | 1 -
 3 files changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c 
b/drivers/staging/rtl8188eu/core/rtw_led.c
index 14461cf..d26b795 100644
--- a/drivers/staging/rtl8188eu/core/rtw_led.c
+++ b/drivers/staging/rtl8188eu/core/rtw_led.c
@@ -475,15 +475,10 @@ void BlinkHandler(struct LED_871x *pLed)
 
 void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 {
-   struct led_priv *ledpriv = &(padapter->ledpriv);
-
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped) ||
   (!padapter->hw_init_completed))
return;
 
-   if (!ledpriv->bRegUseLed)
-   return;
-
if ((padapter->pwrctrlpriv.rf_pwrstate != rf_on &&
 padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) &&
(LedAction == LED_CTL_TX || LedAction == LED_CTL_RX ||
diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c
index fe075ad..a6d775b 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_led.c
@@ -69,7 +69,6 @@ void rtw_hal_sw_led_init(struct adapter *padapter)
 {
struct led_priv *pledpriv = &(padapter->ledpriv);
 
-   pledpriv->bRegUseLed = true;
padapter->HalData->bLedOpenDrain = true;
 
InitLed871x(padapter, &(pledpriv->SwLed0));
diff --git a/drivers/staging/rtl8188eu/include/rtw_led.h 
b/drivers/staging/rtl8188eu/include/rtw_led.h
index 79f318f..217ca00 100644
--- a/drivers/staging/rtl8188eu/include/rtw_led.h
+++ b/drivers/staging/rtl8188eu/include/rtw_led.h
@@ -91,7 +91,6 @@ void LedControl8188eu(struct adapter *padapter, enum 
LED_CTL_MODE LedAction);
 struct led_priv {
/* add for led control */
struct LED_871x SwLed0;
-   u8  bRegUseLed;
/* add for led control */
 };
 
-- 
2.7.3

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


[PATCH 26/34] staging:r8188eu: change type of the precv_buf member of recv_priv structure

2016-10-07 Thread Ivan Safonov
To avoid unnecessary typecast.
To use compiler type checking.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c   | 6 +++---
 drivers/staging/rtl8188eu/hal/usb_halinit.c  | 2 +-
 drivers/staging/rtl8188eu/include/rtw_recv.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index 1c7a9a0..d3d64fa 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -46,10 +46,10 @@ int rtw_hal_init_recv_priv(struct adapter *padapter)
goto exit;
}
 
-   precvpriv->precv_buf = precvpriv->pallocated_recv_buf;
+   precvpriv->precv_buf = (struct recv_buf 
*)precvpriv->pallocated_recv_buf;
 
 
-   precvbuf = (struct recv_buf *)precvpriv->precv_buf;
+   precvbuf = precvpriv->precv_buf;
 
for (i = 0; i < NR_RECVBUFF; i++) {
res = rtw_os_recvbuf_resource_alloc(padapter, precvbuf);
@@ -86,7 +86,7 @@ void rtw_hal_free_recv_priv(struct adapter *padapter)
struct recv_buf *precvbuf;
struct recv_priv*precvpriv = &padapter->recvpriv;
 
-   precvbuf = (struct recv_buf *)precvpriv->precv_buf;
+   precvbuf = precvpriv->precv_buf;
 
for (i = 0; i < NR_RECVBUFF; i++) {
usb_free_urb(precvbuf->purb);
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 71d6ade..3675edb 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -987,7 +987,7 @@ u32 rtw_hal_inirp_init(struct adapter *Adapter)
 ("===> usb_inirp_init\n"));
 
/* issue Rx irp to receive data */
-   precvbuf = (struct recv_buf *)precvpriv->precv_buf;
+   precvbuf = precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
if (usb_read_port(Adapter, RECV_BULK_IN_ADDR, precvbuf) == 
false) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, 
("usb_rx_init: usb_read_port error\n"));
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index e871ebb..8fa3b81 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -181,7 +181,7 @@ struct recv_priv {
struct sk_buff_head free_recv_skb_queue;
struct sk_buff_head rx_skb_queue;
u8 *pallocated_recv_buf;
-   u8 *precv_buf;/*  4 alignment */
+   struct recv_buf *precv_buf;/*  4 alignment */
struct __queue free_recv_buf_queue;
/* For display the phy informatiom */
u8 is_signal_dbg;   /*  for debug */
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 175c1ae..b87663b 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -521,7 +521,7 @@ void rtw_hal_inirp_deinit(struct adapter *padapter)
int i;
struct recv_buf *precvbuf;
 
-   precvbuf = (struct recv_buf *)padapter->recvpriv.precv_buf;
+   precvbuf = padapter->recvpriv.precv_buf;
 
DBG_88E("%s\n", __func__);
 
-- 
2.7.3

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


[PATCH 18/34] staging:r8188eu: remove NumTotalRFPath member of hal_data_8188e structure

2016-10-07 Thread Ivan Safonov
NumTotalRFPath is 1 for r8188eu chip.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/phy.c   | 11 ++--
 drivers/staging/rtl8188eu/hal/rf.c| 20 +++
 drivers/staging/rtl8188eu/hal/rf_cfg.c| 70 ---
 drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c | 51 -
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h  |  3 -
 5 files changed, 49 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 84ffc01..8e0e685 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -278,7 +278,6 @@ void rtw_hal_set_bwmode(struct adapter *adapt, enum 
ht_channel_width bandwidth,
 
 static void phy_sw_chnl_callback(struct adapter *adapt, u8 channel)
 {
-   u8 rf_path;
u32 param1, param2;
struct hal_data_8188e *hal_data = adapt->HalData;
 
@@ -286,12 +285,10 @@ static void phy_sw_chnl_callback(struct adapter *adapt, 
u8 channel)
 
param1 = RF_CHNLBW;
param2 = channel;
-   for (rf_path = 0; rf_path < hal_data->NumTotalRFPath; rf_path++) {
-   hal_data->RfRegChnlVal[rf_path] = 
(hal_data->RfRegChnlVal[rf_path] &
- 0xfc00) | param2;
-   phy_set_rf_reg(adapt, (enum rf_radio_path)rf_path, param1,
-  bRFRegOffsetMask, 
hal_data->RfRegChnlVal[rf_path]);
-   }
+   hal_data->RfRegChnlVal[0] = (hal_data->RfRegChnlVal[0] &
+ 0xfc00) | param2;
+   phy_set_rf_reg(adapt, 0, param1,
+  bRFRegOffsetMask, hal_data->RfRegChnlVal[0]);
 }
 
 void rtw_hal_set_chan(struct adapter *adapt, u8 channel)
diff --git a/drivers/staging/rtl8188eu/hal/rf.c 
b/drivers/staging/rtl8188eu/hal/rf.c
index eddd075..8f8c9de 100644
--- a/drivers/staging/rtl8188eu/hal/rf.c
+++ b/drivers/staging/rtl8188eu/hal/rf.c
@@ -137,17 +137,15 @@ static void getpowerbase88e(struct adapter *adapt, u8 
*pwr_level_ofdm,
 (powerbase0<<8) | powerbase0;
*(ofdmbase+i) = powerbase0;
}
-   for (i = 0; i < adapt->HalData->NumTotalRFPath; i++) {
-   /* Check HT20 to HT40 diff */
-   if (adapt->HalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
-   powerlevel[i] = pwr_level_bw20[i];
-   else
-   powerlevel[i] = pwr_level_bw40[i];
-   powerbase1 = powerlevel[i];
-   powerbase1 = (powerbase1<<24) | (powerbase1<<16) |
-(powerbase1<<8) | powerbase1;
-   *(mcs_base+i) = powerbase1;
-   }
+   /* Check HT20 to HT40 diff */
+   if (adapt->HalData->CurrentChannelBW == HT_CHANNEL_WIDTH_20)
+   powerlevel[0] = pwr_level_bw20[0];
+   else
+   powerlevel[0] = pwr_level_bw40[0];
+   powerbase1 = powerlevel[0];
+   powerbase1 = (powerbase1<<24) | (powerbase1<<16) |
+(powerbase1<<8) | powerbase1;
+   *mcs_base = powerbase1;
 }
 static void get_rx_power_val_by_reg(struct adapter *adapt, u8 channel,
u8 index, u32 *powerbase0, u32 *powerbase1,
diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c 
b/drivers/staging/rtl8188eu/hal/rf_cfg.c
index dde6441..9712d7b 100644
--- a/drivers/staging/rtl8188eu/hal/rf_cfg.c
+++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c
@@ -230,79 +230,33 @@ static bool rf6052_conf_para(struct adapter *adapt)
 {
struct hal_data_8188e *hal_data = adapt->HalData;
u32 u4val = 0;
-   u8 rfpath;
bool rtstatus = true;
struct bb_reg_def *pphyreg;
 
-   for (rfpath = 0; rfpath < hal_data->NumTotalRFPath; rfpath++) {
-   pphyreg = &hal_data->PHYRegDef[rfpath];
+   pphyreg = &hal_data->PHYRegDef[RF90_PATH_A];
+   u4val = phy_query_bb_reg(adapt, pphyreg->rfintfs, BRFSI_RFENV);
 
-   switch (rfpath) {
-   case RF90_PATH_A:
-   case RF90_PATH_C:
-   u4val = phy_query_bb_reg(adapt, pphyreg->rfintfs,
-BRFSI_RFENV);
-   break;
-   case RF90_PATH_B:
-   case RF90_PATH_D:
-   u4val = phy_query_bb_reg(adapt, pphyreg->rfintfs,
-BRFSI_RFENV << 16);
-   break;
-   }
+   phy_set_bb_reg(adapt, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1);
+   udelay(1);
 
-   phy_set_bb_reg(adapt, pphyreg->rfintfe, BRFSI_RFENV << 16, 0x1);
-   udelay(1);
+   phy_set_bb_reg(adapt, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
+   udelay(1);
 
-   phy_set_bb_reg(adapt, pphyreg->rfintfo, BRFSI_RFENV, 0x1);
-   udelay(1);
+   phy_set_bb_reg(adapt, pphyreg->rfHSSIPara2, B3W

[PATCH 23/34] staging:r8188eu: remove padapter and free_sz arguments of rtw_os_xmit_resource_free function

2016-10-07 Thread Ivan Safonov
These argumets does not used by rtw_os_xmit_resource_free function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 5 ++---
 drivers/staging/rtl8188eu/include/xmit_osdep.h | 3 +--
 drivers/staging/rtl8188eu/os_dep/xmit_linux.c  | 3 +--
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index ca65f00..b60b126 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -220,7 +220,6 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
struct adapter *padapter = pxmitpriv->adapter;
struct xmit_frame *pxmitframe = (struct xmit_frame 
*)pxmitpriv->pxmit_frame_buf;
struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
-   u32 max_xmit_extbuf_size = MAX_XMIT_EXTBUF_SZ;
u32 num_xmit_extbuf = NR_XMIT_EXTBUFF;
 
if (pxmitpriv->pxmit_frame_buf == NULL)
@@ -233,7 +232,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
}
 
for (i = 0; i < NR_XMITBUFF; i++) {
-   rtw_os_xmit_resource_free(padapter, pxmitbuf, (MAX_XMITBUF_SZ + 
XMITBUF_ALIGN_SZ));
+   rtw_os_xmit_resource_free(pxmitbuf);
pxmitbuf++;
}
 
@@ -243,7 +242,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
/*  free xmit extension buff */
pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmit_extbuf;
for (i = 0; i < num_xmit_extbuf; i++) {
-   rtw_os_xmit_resource_free(padapter, pxmitbuf, 
(max_xmit_extbuf_size + XMITBUF_ALIGN_SZ));
+   rtw_os_xmit_resource_free(pxmitbuf);
pxmitbuf++;
}
 
diff --git a/drivers/staging/rtl8188eu/include/xmit_osdep.h 
b/drivers/staging/rtl8188eu/include/xmit_osdep.h
index f9b3841..959ef4b 100644
--- a/drivers/staging/rtl8188eu/include/xmit_osdep.h
+++ b/drivers/staging/rtl8188eu/include/xmit_osdep.h
@@ -41,8 +41,7 @@ void rtw_os_xmit_schedule(struct adapter *padapter);
 
 int rtw_os_xmit_resource_alloc(struct adapter *padapter,
   struct xmit_buf *pxmitbuf, u32 alloc_sz);
-void rtw_os_xmit_resource_free(struct adapter *padapter,
-  struct xmit_buf *pxmitbuf, u32 free_sz);
+void rtw_os_xmit_resource_free(struct xmit_buf *pxmitbuf);
 
 uint rtw_remainder_len(struct pkt_file *pfile);
 void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
diff --git a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c 
b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
index 019ded9..e097c61 100644
--- a/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/xmit_linux.c
@@ -80,8 +80,7 @@ int rtw_os_xmit_resource_alloc(struct adapter *padapter, 
struct xmit_buf *pxmitb
return _SUCCESS;
 }
 
-void rtw_os_xmit_resource_free(struct adapter *padapter,
-  struct xmit_buf *pxmitbuf, u32 free_sz)
+void rtw_os_xmit_resource_free(struct xmit_buf *pxmitbuf)
 {
int i;
 
-- 
2.7.3

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


[PATCH 05/34] staging:r8188eu: remove skb data alignment in r8188eu driver code

2016-10-07 Thread Ivan Safonov
(__)netdev_alloc_skb align skb data.
Also this function set skb device.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c   | 10 +-
 drivers/staging/rtl8188eu/include/rtw_recv.h |  2 --
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c |  8 +---
 3 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index 67a765a..1c7a9a0 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -61,23 +61,15 @@ int rtw_hal_init_recv_priv(struct adapter *padapter)
skb_queue_head_init(&precvpriv->rx_skb_queue);
{
int i;
-   size_t tmpaddr = 0;
-   size_t alignm = 0;
struct sk_buff *pskb = NULL;
 
skb_queue_head_init(&precvpriv->free_recv_skb_queue);
 
for (i = 0; i < NR_PREALLOC_RECV_SKB; i++) {
pskb = __netdev_alloc_skb(padapter->pnetdev,
-   MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ,
-   GFP_KERNEL);
+   MAX_RECVBUF_SZ, GFP_KERNEL);
if (pskb) {
kmemleak_not_leak(pskb);
-   pskb->dev = padapter->pnetdev;
-   tmpaddr = (size_t)pskb->data;
-   alignm = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
-   skb_reserve(pskb, (RECVBUFF_ALIGN_SZ - alignm));
-
skb_queue_tail(&precvpriv->free_recv_skb_queue,
pskb);
}
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index a8874a2..c868863 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -139,8 +139,6 @@ struct rx_pkt_attrib {
 #define SN_EQUAL(a, b) (a == b)
 #define REORDER_WAIT_TIME  (50) /*  (ms) */
 
-#define RECVBUFF_ALIGN_SZ 8
-
 #define RXDESC_SIZE24
 #define RXDESC_OFFSET RXDESC_SIZE
 
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index d0d5915..b820482 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -457,8 +457,6 @@ u32 usb_read_port(struct adapter *adapter, u32 addr, u32 
cnt, u8 *rmem)
struct usb_device   *pusbd = pdvobj->pusbdev;
int err;
unsigned int pipe;
-   size_t tmpaddr = 0;
-   size_t alignment = 0;
u32 ret = _SUCCESS;
 
 
@@ -483,16 +481,12 @@ u32 usb_read_port(struct adapter *adapter, u32 addr, u32 
cnt, u8 *rmem)
 
/* re-assign for linux based on skb */
if ((!precvbuf->reuse) || (precvbuf->pskb == NULL)) {
-   precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, 
MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
+   precvbuf->pskb = netdev_alloc_skb(adapter->pnetdev, 
MAX_RECVBUF_SZ);
if (precvbuf->pskb == NULL) {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, 
("init_recvbuf(): alloc_skb fail!\n"));
DBG_88E(" usb_read_port() alloc_skb fail!#\n");
return _FAIL;
}
-
-   tmpaddr = (size_t)precvbuf->pskb->data;
-   alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
-   skb_reserve(precvbuf->pskb, (RECVBUFF_ALIGN_SZ - alignment));
} else { /* reuse skb */
precvbuf->reuse = false;
}
-- 
2.7.3

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


[PATCH 29/34] staging:r8188eu: remove free_recvframe_cnt member of recv_priv structure

2016-10-07 Thread Ivan Safonov
Value of free_recvframe_cnt does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_recv.c| 33 ++--
 drivers/staging/rtl8188eu/include/rtw_recv.h |  1 -
 2 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 1b544e6..b5aeb8d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -66,8 +66,6 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct 
adapter *padapter)
 
precvpriv->adapter = padapter;
 
-   precvpriv->free_recvframe_cnt = NR_RECVFRAME;
-
precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct 
recv_frame) + RXFRAME_ALIGN_SZ);
 
if (!precvpriv->pallocated_frame_buf)
@@ -119,20 +117,11 @@ void _rtw_free_recv_priv(struct recv_priv *precvpriv)
 struct recv_frame *_rtw_alloc_recvframe(struct __queue *pfree_recv_queue)
 {
struct recv_frame *hdr;
-   struct adapter *padapter;
-   struct recv_priv *precvpriv;
 
hdr = list_first_entry_or_null(&pfree_recv_queue->queue,
   struct recv_frame, list);
-   if (hdr) {
+   if (hdr)
list_del_init(&hdr->list);
-   padapter = hdr->adapter;
-   if (padapter) {
-   precvpriv = &padapter->recvpriv;
-   if (pfree_recv_queue == &precvpriv->free_recv_queue)
-   precvpriv->free_recvframe_cnt--;
-   }
-   }
 
return hdr;
 }
@@ -153,13 +142,8 @@ struct recv_frame *rtw_alloc_recvframe(struct __queue 
*pfree_recv_queue)
 int rtw_free_recvframe(struct recv_frame *precvframe,
   struct __queue *pfree_recv_queue)
 {
-   struct adapter *padapter;
-   struct recv_priv *precvpriv;
-
if (!precvframe)
return _FAIL;
-   padapter = precvframe->adapter;
-   precvpriv = &padapter->recvpriv;
if (precvframe->pkt) {
dev_kfree_skb_any(precvframe->pkt);/* free skb by driver */
precvframe->pkt = NULL;
@@ -173,29 +157,16 @@ int rtw_free_recvframe(struct recv_frame *precvframe,
 
list_add_tail(&(precvframe->list), get_list_head(pfree_recv_queue));
 
-   if (padapter != NULL) {
-   if (pfree_recv_queue == &precvpriv->free_recv_queue)
-   precvpriv->free_recvframe_cnt++;
-   }
-
-  spin_unlock_bh(&pfree_recv_queue->lock);
+   spin_unlock_bh(&pfree_recv_queue->lock);
 
return _SUCCESS;
 }
 
 int _rtw_enqueue_recvframe(struct recv_frame *precvframe, struct __queue 
*queue)
 {
-   struct adapter *padapter = precvframe->adapter;
-   struct recv_priv *precvpriv = &padapter->recvpriv;
-
list_del_init(&(precvframe->list));
list_add_tail(&(precvframe->list), get_list_head(queue));
 
-   if (padapter != NULL) {
-   if (queue == &precvpriv->free_recv_queue)
-   precvpriv->free_recvframe_cnt++;
-   }
-
return _SUCCESS;
 }
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h 
b/drivers/staging/rtl8188eu/include/rtw_recv.h
index e95f4f2..40f9728 100644
--- a/drivers/staging/rtl8188eu/include/rtw_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtw_recv.h
@@ -166,7 +166,6 @@ struct recv_priv {
struct __queue uc_swdec_pending_queue;
u8 *pallocated_frame_buf;
u8 *precv_frame_buf;
-   uint free_recvframe_cnt;
struct adapter  *adapter;
u32 bIsAnyNonBEPkts;
u64 rx_bytes;
-- 
2.7.3

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


[PATCH 11/34] staging:r8188eu: remove bLedStartToLinkBlinkInProgress and bSWLedCtrl members of LED_871x structure

2016-10-07 Thread Ivan Safonov
These members of LED_871x structure does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_led.c| 1 -
 drivers/staging/rtl8188eu/include/rtw_led.h | 3 ---
 2 files changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c 
b/drivers/staging/rtl8188eu/core/rtw_led.c
index d26b795..a046a02 100644
--- a/drivers/staging/rtl8188eu/core/rtw_led.c
+++ b/drivers/staging/rtl8188eu/core/rtw_led.c
@@ -60,7 +60,6 @@ void ResetLedStatus(struct LED_871x *pLed)
 
pLed->bLedNoLinkBlinkInProgress = false;
pLed->bLedLinkBlinkInProgress = false;
-   pLed->bLedStartToLinkBlinkInProgress = false;
pLed->bLedScanBlinkInProgress = false;
 }
 
diff --git a/drivers/staging/rtl8188eu/include/rtw_led.h 
b/drivers/staging/rtl8188eu/include/rtw_led.h
index 217ca00..607d1ba 100644
--- a/drivers/staging/rtl8188eu/include/rtw_led.h
+++ b/drivers/staging/rtl8188eu/include/rtw_led.h
@@ -70,12 +70,9 @@ struct LED_871x {
 
struct timer_list BlinkTimer; /*  Timer object for led blinking. */
 
-   u8 bSWLedCtrl;
-
/*  ALPHA, added by chiyoko, 20090106 */
u8 bLedNoLinkBlinkInProgress;
u8 bLedLinkBlinkInProgress;
-   u8 bLedStartToLinkBlinkInProgress;
u8 bLedScanBlinkInProgress;
struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer to
   * manipulate H/W to blink LED. */
-- 
2.7.3

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


[PATCH 15/34] staging:r8188eu: remove Antenna_(Lfet|Right) enumeration items

2016-10-07 Thread Ivan Safonov
These defintions does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index b1740cf..87e379e 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -601,11 +601,6 @@ static void _BBTurnOnBlock(struct adapter *Adapter)
phy_set_bb_reg(Adapter, rFPGA0_RFMOD, bOFDMEn, 0x1);
 }
 
-enum {
-   Antenna_Lfet = 1,
-   Antenna_Right = 2,
-};
-
 static void _InitAntenna_Selection(struct adapter *Adapter)
 {
struct hal_data_8188e *haldata = Adapter->HalData;
-- 
2.7.3

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


[PATCH 33/34] staging:r8188eu: refactor recvbuf2recvframe function

2016-10-07 Thread Ivan Safonov
Reduce number of nesting levels.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 31 
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 9347dcd..cc52082 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -172,22 +172,21 @@ static int recvbuf2recvframe(struct adapter *adapt, 
struct sk_buff *pskb)
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
("recvbuf2recvframe: 
rtw_recv_entry(precvframe) != _SUCCESS\n"));
}
-   } else {
-   /* enqueue recvframe to txrtp queue */
-   if (pattrib->pkt_rpt_type == TX_REPORT1) {
-   /* CCX-TXRPT ack for xmit mgmt frames. */
-   handle_txrpt_ccx_88e(adapt, 
precvframe->rx_data);
-   } else if (pattrib->pkt_rpt_type == TX_REPORT2) {
-   ODM_RA_TxRPT2Handle_8188E(
-   &haldata->odmpriv,
-   precvframe->rx_data,
-   pattrib->pkt_len,
-   
pattrib->MacIDValidEntry[0],
-   
pattrib->MacIDValidEntry[1]
-   );
-   } else if (pattrib->pkt_rpt_type == HIS_REPORT) {
-   interrupt_handler_8188eu(adapt, 
pattrib->pkt_len, precvframe->rx_data);
-   }
+   } else if (pattrib->pkt_rpt_type == TX_REPORT1) {
+   /* CCX-TXRPT ack for xmit mgmt frames. */
+   handle_txrpt_ccx_88e(adapt, precvframe->rx_data);
+   rtw_free_recvframe(precvframe, pfree_recv_queue);
+   } else if (pattrib->pkt_rpt_type == TX_REPORT2) {
+   ODM_RA_TxRPT2Handle_8188E(
+   &haldata->odmpriv,
+   precvframe->rx_data,
+   pattrib->pkt_len,
+   pattrib->MacIDValidEntry[0],
+   pattrib->MacIDValidEntry[1]
+   );
+   rtw_free_recvframe(precvframe, pfree_recv_queue);
+   } else if (pattrib->pkt_rpt_type == HIS_REPORT) {
+   interrupt_handler_8188eu(adapt, pattrib->pkt_len, 
precvframe->rx_data);
rtw_free_recvframe(precvframe, pfree_recv_queue);
}
pkt_cnt--;
-- 
2.7.3

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


[PATCH 14/34] staging:r8188eu: remove unused members of hal_data_8188e structure

2016-10-07 Thread Ivan Safonov
These members of hal_data_8188e structure does not used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c  |  3 ---
 drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 13 -
 2 files changed, 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index dfb78bb..b1740cf 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -562,9 +562,6 @@ static void InitUsbAggregationSetting(struct adapter 
*Adapter)
 
/*  Rx aggregation setting */
usb_AggSettingRxUpdate(Adapter);
-
-   /*  201/12/10 MH Add for USB agg mode dynamic switch. */
-   Adapter->HalData->UsbRxHighSpeedMode = false;
 }
 
 static void _InitBeaconParameters(struct adapter *Adapter)
diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
index 942ce91..53c975a 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h
@@ -265,11 +265,6 @@ struct hal_data_8188e {
u32 CCKTxPowerLevelOriginalOffset;
 
u8  CrystalCap;
-   u32 AntennaTxPath;  /*  Antenna path Tx */
-   u32 AntennaRxPath;  /*  Antenna path Rx */
-   u8  BluetoothCoexist;
-
-   u8  b1x1RecvCombine;/*  for 1T1R receive combining */
 
u32 AcParam_BE; /* Original parameter for BE, use for EDCA turbo. */
 
@@ -313,14 +308,6 @@ struct hal_data_8188e {
u8  OutEpQueueSel;
u8  OutEpNumber;
 
-   /*  Add for USB aggreation mode dynamic shceme. */
-   boolUsbRxHighSpeedMode;
-
-   /*  2010/11/22 MH Add for slim combo debug mode selective. */
-   /*  This is used for fix the drawback of CU TSMC-A/UMC-A cut.
-* HW auto suspend ability. Close BT clock. */
-   boolSlimComboDbg;
-
u16 EfuseUsedBytes;
 
/*  Auto FSM to Turn On, include clock, isolation, power control
-- 
2.7.3

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


[PATCH 24/34] staging:r8188eu: remove unused function declerations

2016-10-07 Thread Ivan Safonov
rtl8188eu_recv_hdl and rtl8188e_query_rx_phy_status doesn't used.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/rtl8188e_recv.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_recv.h 
b/drivers/staging/rtl8188eu/include/rtl8188e_recv.h
index 80832a5..0d8bf51 100644
--- a/drivers/staging/rtl8188eu/include/rtl8188e_recv.h
+++ b/drivers/staging/rtl8188eu/include/rtl8188e_recv.h
@@ -51,9 +51,7 @@ enum rx_packet_type {
 };
 
 #define INTERRUPT_MSG_FORMAT_LEN 60
-void rtl8188eu_recv_hdl(struct adapter *padapter, struct recv_buf *precvbuf);
 void rtl8188eu_recv_tasklet(void *priv);
-void rtl8188e_query_rx_phy_status(struct recv_frame *fr, struct phy_stat *phy);
 void rtl8188e_process_phy_info(struct adapter *padapter,
   struct recv_frame *prframe);
 void update_recvframe_phyinfo_88e(struct recv_frame *fra, struct phy_stat 
*phy);
-- 
2.7.3

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


[PATCH 07/34] staging:r8188eu: remove (u32 cnt) argument of usb_read_port function

2016-10-07 Thread Ivan Safonov
This argument does not used by usb_read_port function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c   | 2 +-
 drivers/staging/rtl8188eu/include/usb_ops_linux.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c  | 8 
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index 4d0e3f9..95bbeca 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -999,7 +999,7 @@ u32 rtw_hal_inirp_init(struct adapter *Adapter)
/* issue Rx irp to receive data */
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
-   if (usb_read_port(Adapter, precvpriv->ff_hwaddr, 0, precvbuf) 
== false) {
+   if (usb_read_port(Adapter, precvpriv->ff_hwaddr, precvbuf) == 
false) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, 
("usb_rx_init: usb_read_port error\n"));
status = _FAIL;
goto exit;
diff --git a/drivers/staging/rtl8188eu/include/usb_ops_linux.h 
b/drivers/staging/rtl8188eu/include/usb_ops_linux.h
index 4fc2e2d..fb586365 100644
--- a/drivers/staging/rtl8188eu/include/usb_ops_linux.h
+++ b/drivers/staging/rtl8188eu/include/usb_ops_linux.h
@@ -53,7 +53,7 @@ u8 usb_read8(struct adapter *adapter, u32 addr);
 u16 usb_read16(struct adapter *adapter, u32 addr);
 u32 usb_read32(struct adapter *adapter, u32 addr);
 
-u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, struct recv_buf 
*precvbuf);
+u32 usb_read_port(struct adapter *adapter, u32 addr, struct recv_buf 
*precvbuf);
 void usb_read_port_cancel(struct adapter *adapter);
 
 int usb_write8(struct adapter *adapter, u32 addr, u8 val);
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index 22777b1..24d2250 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -403,7 +403,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
 ("usb_read_port_complete: (purb->actual_length 
> MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n"));
precvbuf->reuse = true;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, precvbuf);
+   usb_read_port(adapt, precvpriv->ff_hwaddr, precvbuf);
DBG_88E("%s()-%d: RX Warning!\n", __func__, __LINE__);
} else {
skb_put(precvbuf->pskb, purb->actual_length);
@@ -414,7 +414,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
 
precvbuf->pskb = NULL;
precvbuf->reuse = false;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, precvbuf);
+   usb_read_port(adapt, precvpriv->ff_hwaddr, precvbuf);
}
} else {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, 
("usb_read_port_complete : purb->status(%d) != 0\n", purb->status));
@@ -437,7 +437,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
case -EOVERFLOW:
adapt->HalData->srestpriv.Wifi_Error_Status = 
USB_READ_PORT_FAIL;
precvbuf->reuse = true;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, precvbuf);
+   usb_read_port(adapt, precvpriv->ff_hwaddr, precvbuf);
break;
case -EINPROGRESS:
DBG_88E("ERROR: URB IS IN PROGRESS!\n");
@@ -448,7 +448,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
}
 }
 
-u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, struct recv_buf 
*precvbuf)
+u32 usb_read_port(struct adapter *adapter, u32 addr, struct recv_buf *precvbuf)
 {
struct urb *purb = NULL;
struct dvobj_priv   *pdvobj = adapter_to_dvobj(adapter);
-- 
2.7.3

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


[PATCH 19/34] staging:r8188eu: refactor rtl88eu_dm_txpower_tracking_callback_thermalmeter function

2016-10-07 Thread Ivan Safonov
Remove is2t and rf local variables from this function.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/phy.c | 34 +++---
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c 
b/drivers/staging/rtl8188eu/hal/phy.c
index 8e0e685..126547e 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -393,9 +393,8 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
s8 ofdm_index[2], cck_index = 0;
s8 ofdm_index_old[2] = {0, 0}, cck_index_old = 0;
u32 i = 0, j = 0;
-   bool is2t = false;
 
-   u8 ofdm_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB 
*/
+   u8 ofdm_min_index = 6; /* OFDM BB Swing should be less than +3.0dB */
s8 ofdm_index_mapping[2][index_mapping_NUM_88E] = {
/* 2.4G, decrease power */
{0, 0, 2, 3, 4, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11},
@@ -420,11 +419,6 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
thermal_val = (u8)rtw_hal_read_rfreg(adapt, RF_PATH_A,
   RF_T_METER_88E, 0xfc00);
 
-   if (is2t)
-   rf = 2;
-   else
-   rf = 1;
-
if (thermal_val) {
/* Query OFDM path A default setting */
ele_d = phy_query_bb_reg(adapt, rOFDM0_XATxIQImbalance, 
bMaskDWord)&bMaskOFDM_D;
@@ -436,17 +430,6 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
}
}
 
-   /* Query OFDM path B default setting */
-   if (is2t) {
-   ele_d = phy_query_bb_reg(adapt, rOFDM0_XBTxIQImbalance, 
bMaskDWord)&bMaskOFDM_D;
-   for (i = 0; i < OFDM_TABLE_SIZE_92D; i++) {
-   if (ele_d == (OFDMSwingTable[i]&bMaskOFDM_D)) {
-   ofdm_index_old[1] = (u8)i;
-   break;
-   }
-   }
-   }
-
/* Query CCK default setting From 0xa24 */
temp_cck = dm_odm->RFCalibrateInfo.RegA24;
 
@@ -465,8 +448,7 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
dm_odm->RFCalibrateInfo.ThermalValue_LCK = thermal_val;
dm_odm->RFCalibrateInfo.ThermalValue_IQK = thermal_val;
 
-   for (i = 0; i < rf; i++)
-   dm_odm->RFCalibrateInfo.OFDM_index[i] = 
ofdm_index_old[i];
+   dm_odm->RFCalibrateInfo.OFDM_index[0] = 
ofdm_index_old[0];
dm_odm->RFCalibrateInfo.CCK_index = cck_index_old;
}
 
@@ -525,13 +507,11 @@ void 
rtl88eu_dm_txpower_tracking_callback_thermalmeter(struct adapter *adapt)
offset = index_mapping_NUM_88E-1;
 
/* Updating ofdm_index values with new OFDM / CCK 
offset */
-   for (i = 0; i < rf; i++) {
-   ofdm_index[i] = 
dm_odm->RFCalibrateInfo.OFDM_index[i] + ofdm_index_mapping[j][offset];
-   if (ofdm_index[i] > OFDM_TABLE_SIZE_92D-1)
-   ofdm_index[i] = OFDM_TABLE_SIZE_92D-1;
-   else if (ofdm_index[i] < ofdm_min_index)
-   ofdm_index[i] = ofdm_min_index;
-   }
+   ofdm_index[0] = dm_odm->RFCalibrateInfo.OFDM_index[0] + 
ofdm_index_mapping[j][offset];
+   if (ofdm_index[0] > OFDM_TABLE_SIZE_92D-1)
+   ofdm_index[0] = OFDM_TABLE_SIZE_92D-1;
+   else if (ofdm_index[0] < ofdm_min_index)
+   ofdm_index[0] = ofdm_min_index;
 
cck_index = dm_odm->RFCalibrateInfo.CCK_index + 
ofdm_index_mapping[j][offset];
if (cck_index > CCK_TABLE_SIZE-1)
-- 
2.7.3

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


[PATCH 34/34] staging:r8188eu: remove unnecessary type cast for update_recvframe_phyinfo_88e argument

2016-10-07 Thread Ivan Safonov
pphy_status alreay is (struct phy_stat *).

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index cc52082..34198fe 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -167,7 +167,7 @@ static int recvbuf2recvframe(struct adapter *adapt, struct 
sk_buff *pskb)
}
if (pattrib->pkt_rpt_type == NORMAL_RX) { /* Normal rx packet */
if (pattrib->physt)
-   update_recvframe_phyinfo_88e(precvframe, 
(struct phy_stat *)pphy_status);
+   update_recvframe_phyinfo_88e(precvframe, 
pphy_status);
if (rtw_recv_entry(precvframe) != _SUCCESS) {
RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
("recvbuf2recvframe: 
rtw_recv_entry(precvframe) != _SUCCESS\n"));
-- 
2.7.3

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


[PATCH 06/34] staging:r8188eu: change usb_read_port last argument type to (struct *recv_buf)

2016-10-07 Thread Ivan Safonov
To avoid unnecessary typecasts.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/hal/usb_halinit.c   | 2 +-
 drivers/staging/rtl8188eu/include/usb_ops_linux.h | 2 +-
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c  | 9 -
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c 
b/drivers/staging/rtl8188eu/hal/usb_halinit.c
index a09c68f..4d0e3f9 100644
--- a/drivers/staging/rtl8188eu/hal/usb_halinit.c
+++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c
@@ -999,7 +999,7 @@ u32 rtw_hal_inirp_init(struct adapter *Adapter)
/* issue Rx irp to receive data */
precvbuf = (struct recv_buf *)precvpriv->precv_buf;
for (i = 0; i < NR_RECVBUFF; i++) {
-   if (usb_read_port(Adapter, precvpriv->ff_hwaddr, 0, (unsigned 
char *)precvbuf) == false) {
+   if (usb_read_port(Adapter, precvpriv->ff_hwaddr, 0, precvbuf) 
== false) {
RT_TRACE(_module_hci_hal_init_c_, _drv_err_, 
("usb_rx_init: usb_read_port error\n"));
status = _FAIL;
goto exit;
diff --git a/drivers/staging/rtl8188eu/include/usb_ops_linux.h 
b/drivers/staging/rtl8188eu/include/usb_ops_linux.h
index 78d9b6e..4fc2e2d 100644
--- a/drivers/staging/rtl8188eu/include/usb_ops_linux.h
+++ b/drivers/staging/rtl8188eu/include/usb_ops_linux.h
@@ -53,7 +53,7 @@ u8 usb_read8(struct adapter *adapter, u32 addr);
 u16 usb_read16(struct adapter *adapter, u32 addr);
 u32 usb_read32(struct adapter *adapter, u32 addr);
 
-u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem);
+u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, struct recv_buf 
*precvbuf);
 void usb_read_port_cancel(struct adapter *adapter);
 
 int usb_write8(struct adapter *adapter, u32 addr, u8 val);
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index b820482..22777b1 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -403,7 +403,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
RT_TRACE(_module_hci_ops_os_c_, _drv_err_,
 ("usb_read_port_complete: (purb->actual_length 
> MAX_RECVBUF_SZ) || (purb->actual_length < RXDESC_SIZE)\n"));
precvbuf->reuse = true;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, (unsigned 
char *)precvbuf);
+   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, precvbuf);
DBG_88E("%s()-%d: RX Warning!\n", __func__, __LINE__);
} else {
skb_put(precvbuf->pskb, purb->actual_length);
@@ -414,7 +414,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
 
precvbuf->pskb = NULL;
precvbuf->reuse = false;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, (unsigned 
char *)precvbuf);
+   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, precvbuf);
}
} else {
RT_TRACE(_module_hci_ops_os_c_, _drv_err_, 
("usb_read_port_complete : purb->status(%d) != 0\n", purb->status));
@@ -437,7 +437,7 @@ static void usb_read_port_complete(struct urb *purb, struct 
pt_regs *regs)
case -EOVERFLOW:
adapt->HalData->srestpriv.Wifi_Error_Status = 
USB_READ_PORT_FAIL;
precvbuf->reuse = true;
-   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, (unsigned 
char *)precvbuf);
+   usb_read_port(adapt, precvpriv->ff_hwaddr, 0, precvbuf);
break;
case -EINPROGRESS:
DBG_88E("ERROR: URB IS IN PROGRESS!\n");
@@ -448,10 +448,9 @@ static void usb_read_port_complete(struct urb *purb, 
struct pt_regs *regs)
}
 }
 
-u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *rmem)
+u32 usb_read_port(struct adapter *adapter, u32 addr, u32 cnt, struct recv_buf 
*precvbuf)
 {
struct urb *purb = NULL;
-   struct recv_buf *precvbuf = (struct recv_buf *)rmem;
struct dvobj_priv   *pdvobj = adapter_to_dvobj(adapter);
struct recv_priv*precvpriv = &adapter->recvpriv;
struct usb_device   *pusbd = pdvobj->pusbdev;
-- 
2.7.3

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


Re: [PATCH 0/6] Introduce Juniper CBC FPGA

2016-10-07 Thread Pantelis Antoniou
Hi Greg,

> On Oct 7, 2016, at 18:39 , Greg Kroah-Hartman  
> wrote:
> 
> On Fri, Oct 07, 2016 at 06:20:08PM +0300, Pantelis Antoniou wrote:
>> Add Juniper's PTX1K CBC FPGA driver. Those FPGAs
>> are present in Juniper's PTX series of routers.
>> 
>> The MFD driver provices a gpio device and a special
>> driver for Juniper's board infrastucture.
>> The FPGA infrastucture driver is providing an interface
>> for user-space handling of the FPGA in those platforms.
>> 
>> There are full device tree binding documents for the
>> master mfd driver and for the slave driver.
>> 
>> This patchset is against mainline as of today: v4.8-9431-g3477d16
>> and is dependent on the "Juniper prerequisites" and
>> "Juniper infrastructure" patchsets sent earlier.
>> 
>> Georgi Vlaev (5):
>>  mfd: Add support for the PTX1K CBC FPGA
>>  gpio: Add support for PTX1K CBC FPGA spare GPIOs
>>  gpio: gpio-cbc: Document bindings of CBC FPGA GPIO block
>>  gpio: cbc-presence: Add CBC presence detect as GPIO driver
>>  gpio: gpio-cbc-presense: Document bindings of CBC FPGA presence
>> 
>> Tom Kavanagh (1):
>>  staging: jnx: CBD-FPGA infrastructure
>> 
>> .../bindings/gpio/jnx,gpio-cbc-presense.txt|  31 +
>> .../devicetree/bindings/gpio/jnx,gpio-cbc.txt  |  30 +
>> drivers/gpio/Kconfig   |  23 +
>> drivers/gpio/Makefile  |   2 +
>> drivers/gpio/gpio-cbc-presence.c   | 460 ++
>> drivers/gpio/gpio-cbc.c| 236 +
>> drivers/mfd/Kconfig|  16 +
>> drivers/mfd/Makefile   |   1 +
>> drivers/mfd/cbc-core.c | 971 
>> +
>> drivers/staging/jnx/Kconfig|  34 +
>> drivers/staging/jnx/Makefile   |   5 +
>> drivers/staging/jnx/jnx-cbc-ptx1k.c| 242 +
>> drivers/staging/jnx/jnx-cbd-fpga-common.c  | 332 +++
>> drivers/staging/jnx/jnx-cbd-fpga-common.h  |  27 +
>> drivers/staging/jnx/jnx-cbd-fpga-core.c| 540 
>> drivers/staging/jnx/jnx-cbd-fpga-core.h|  68 ++
>> drivers/staging/jnx/jnx-cbd-fpga-platdata.h|  51 ++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c   | 134 +++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c  | 143 +++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c   | 111 +++
>> drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c   | 107 +++
>> include/linux/mfd/cbc-core.h   | 181 
>> 22 files changed, 3745 insertions(+)
> 
> Please don't mix driver submissions like this.  Staging stuff needs to
> go to the staging maintainer, gpio to that one, mfd to that one, and so
> on.
> 
> there's almost nothing anyone can do with this series as-is, sorry.
> 
> please split it up.
> 

Now I’m confused, this is a typical MFD submission:

https://lwn.net/Articles/587032/

Looks like it’s normal for a single patchset against multiple subsystems.

Do we have a definitive form for this?

> thanks,
> 
> greg k-h

Regards

— Pantelis

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


Re: [PATCH] Staging:fbtft/fb_s6d02a1.c: fixed 80 character line limit coding

2016-10-07 Thread Nadim Almas
why its seems worst to you i am just removing  "80 character line
limit coding style"
for the last 3 months I am trying to submit my first patch but patch
is not accepted by you by giving reason i can't able to understand
please help me

On Fri, Oct 7, 2016 at 10:37 PM, Greg KH  wrote:
> On Fri, Oct 07, 2016 at 08:43:02AM -0700, Nadim Almas wrote:
>> style issue
>>
>> Fixed coding style issue
>
> This does not seem like valid sentances that mean much to me.  Do they
> to you?
>
>>
>> Signed-off-by: Nadim Almas 
>> ---
>>  drivers/staging/fbtft/fb_s6d02a1.c | 30 --
>>  1 file changed, 20 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/staging/fbtft/fb_s6d02a1.c 
>> b/drivers/staging/fbtft/fb_s6d02a1.c
>> index 774b0ff..bc0c48f 100644
>> --- a/drivers/staging/fbtft/fb_s6d02a1.c
>> +++ b/drivers/staging/fbtft/fb_s6d02a1.c
>> @@ -30,20 +30,27 @@ static int default_init_sequence[] = {
>>
>>   -1, 0xfc, 0x5a, 0x5a,
>>
>> - -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A, 
>> 0x3A, 0x3A, 0x3d, 0x02, 0x01,
>> + -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A,
>> + 0x3A, 0x3A, 0x3d, 0x02, 0x01,
>
> This looks worse to me now, remember, checkpatch.pl is a "hint", not a
> hard-and-fast-rule.  Use it wisely.
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC 1/2] staging: jnx: Add Juniper connector driver

2016-10-07 Thread Pantelis Antoniou
Hi Joe,

> On Oct 7, 2016, at 19:25 , Joe Perches  wrote:
> 
> On Fri, 2016-10-07 at 18:16 +0300, Pantelis Antoniou wrote:
>> diff --git a/drivers/staging/jnx/jnx-connector.c 
>> b/drivers/staging/jnx/jnx-connector.c
> []
>> +struct jnx_conn_data {
>> +struct device *dev; /* parent (platform) device */
>> +const char *name[NUM_OVERLAYS]; /* overlay file names */
>> +bool enabled;   /* true if can handle interrupts */
>> +bool poweron;   /* true if assumed to be powered on */
> 
> maybe use pahole and remove some of the wasteful padding
> 

Yes, good idea; this structure sorta grew organically.

>> +int attention_button;   /* attention button gpio pin */
>> +bool have_attention_button; /* true if attention button exists */
>> +unsigned long attention_button_holdtime;/* button hold time, jiffies */
>> +bool attention_ignore;  /* true if handled by user space */
>> +int power_enable;   /* power enable gpio pin */
>> +bool auto_enable;   /* true if board should auto-enable */
>> +struct jnx_i2c_power_seq pon;   /* power-on sequence */
> []
>> +u32 gpio_flags;
>> +u16 assembly_id;
>> +int slot;   /* slot number */
>> +int type;   /* card type */
>> +bool static_assembly_id;/* true if assembly_id is static */
>> +bool assembly_id_valid; /* true if assembly_id is valid */
>> +int adapter;/* parent i2c adapter number */
> []
>> +struct mutex mutex; /* mutex to protect state changes */
>> +bool synchronous;   /* true if state changes are ok */
>> +struct mutex fdt_mutex; /* mutex to protect fdt accesses */
> []
>> +bool standby_to_master; /* standby:master_ev processing */
>> +};
> []
>> +/*
>> + * jnx_conn_insert_ideeprom()
>> + *   Inserts ideeprom with a parent from OF prop
>> + */
>> +static int jnx_conn_insert_ideeprom(struct jnx_conn_data *data,
>> +struct i2c_adapter *adap,
>> +struct device_node *node,
>> +struct i2c_board_info *info)
>> +{
>> +struct device *dev = data->dev;
>> +struct i2c_adapter *parent = NULL;
>> +struct i2c_client *client;
>> +struct device_node *anode;
>> +struct at24_platform_data at24_pdata = {
>> +.byte_len = 256,
>> +.page_size = 4,
>> +.setup = jnx_conn_at24_callback,
>> +.context = data,
>> +};
>> +
>> +info->platform_data = &at24_pdata;
> 
> Assigning a temporary address through a pointer argument?
> Isn't there a better way?
> 

Yeah, it is weird; it works but its risky.

I’ll change it.

>> +/*
>> + * jnx_conn_verify_overlay()
>> + *
>> + * Verify if overlay is compatible with this board/slot
>> + */
>> +static int jnx_conn_verify_overlay(struct jnx_conn_data *data,
>> +   struct device_node *np)
>> +{
> []
>> +ret = of_property_read_u32(np, "type", &var);
>> +if (ret) {
>> +dev_err(dev, "Missing type property\n");
>> +return ret;
>> +}
>> +if (var != data->type) {
>> +dev_err(dev, "Wrong type: Expected %d, got %d\n",
>> +data->type, var);
>> +return -EINVAL;
>> +}
>> +
>> +/*
>> + * 'assembly-ids' property must exist, and one of its entries must match
>> + * the card assembly id
>> + */
>> +assembly_ids = of_get_property(np, "assembly-ids", &size);
>> +if (!assembly_ids || size < sizeof(u32)) {
>> +dev_err(dev, "Bad assembly-ids property\n");
>> +return -EINVAL;
>> +}
>> +ret = -EINVAL;
>> +for (i = 0; i < size / sizeof(u32); i++) {
>> +if (be32_to_cpu(assembly_ids[i]) == data->assembly_id) {
>> +ret = 0;
>> +break;
>> +}
>> +}
>> +if (ret) {
>> +dev_err(dev, "Assembly ID 0x%x not supported by overlay\n",
>> +data->assembly_id);
>> +return ret;
>> +}
> 
> Given all the direct returns above here, perhaps
> 
>   for (i = 0; i < size / sizeof(u32); i++) {
>   if (be32_to_cpu(assembly_ids[i]) == data->assembly_id)
>   return 0;
>   }
> 

It does look better.

>   dev_err(...);
>   return -EINVAL;
> 
> 


Regards

— Pantelis

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


[staging:staging-testing 4/6] ERROR: "v6_dma_map_area" [drivers/staging/vc04_services/vchiq.ko] undefined!

2016-10-07 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   4d76986a55999546d4ef4f14e2a7a5c770be38f0
commit: 69b5c631ef53ada80d8796f2db3e2b8c4bdf0d4a [4/6] staging/vchi: Remove 
dependency on CONFIG_BROKEN.
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 69b5c631ef53ada80d8796f2db3e2b8c4bdf0d4a
# save the attached .config to linux build tree
make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> ERROR: "v6_dma_map_area" [drivers/staging/vc04_services/vchiq.ko] undefined!
>> ERROR: "v6_dma_unmap_area" [drivers/staging/vc04_services/vchiq.ko] 
>> undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging:fbtft/fb_s6d02a1.c: fixed 80 character line limit coding

2016-10-07 Thread Joe Perches
On Sat, 2016-10-08 at 00:25 +0530, Nadim Almas wrote:
> why its seems worst to you i am just removing  "80 character line
> limit coding style"
> for the last 3 months I am trying to submit my first patch but patch
> is not accepted by you by giving reason i can't able to understand
> please help me

Taste in improving code is a difficult thing to acquire,
determine and utilize.

Keep on trying to improve the code and not just in ways
that shut-up brainless tools.

Please consider the difference between your initial patch
and this proposal: https://patchwork.kernel.org/patch/9367167/

Apologies for not cc'ing you as your patch was what caused me
to look at this code at all.


> On Fri, Oct 7, 2016 at 10:37 PM, Greg KH  wrote:
> > On Fri, Oct 07, 2016 at 08:43:02AM -0700, Nadim Almas wrote:
> > > style issue
> > > 
> > > Fixed coding style issue
> > 
> > 
> > This does not seem like valid sentances that mean much to me.  Do they
> > to you?
> > 
> > > 
> > > Signed-off-by: Nadim Almas 
> > > ---
> > >  drivers/staging/fbtft/fb_s6d02a1.c | 30 --
> > >  1 file changed, 20 insertions(+), 10 deletions(-)
> > > 
> > > diff --git a/drivers/staging/fbtft/fb_s6d02a1.c 
> > > b/drivers/staging/fbtft/fb_s6d02a1.c
> > > index 774b0ff..bc0c48f 100644
> > > --- a/drivers/staging/fbtft/fb_s6d02a1.c
> > > +++ b/drivers/staging/fbtft/fb_s6d02a1.c
> > > @@ -30,20 +30,27 @@ static int default_init_sequence[] = {
> > > 
> > >   -1, 0xfc, 0x5a, 0x5a,
> > > 
> > > - -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 
> > > 0x3A, 0x3A, 0x3A, 0x3d, 0x02, 0x01,
> > > + -1, 0xfa, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 
> > > 0x3A,
> > > + 0x3A, 0x3A, 0x3d, 0x02, 
> > > 0x01,
> > 
> > 
> > This looks worse to me now, remember, checkpatch.pl is a "hint", not a
> > hard-and-fast-rule.  Use it wisely.

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


[PATCH] Staging:greybus:arche-apb-ctrl: fix trailing */ Block comments and 80 character line limit coding style issue

2016-10-07 Thread Nadim Almas
Fixed coding style issue

Signed-off-by: Nadim Almas 
---
 drivers/staging/greybus/arche-apb-ctrl.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index 70323aa..eeba912 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -168,7 +168,10 @@ static int standby_boot_seq(struct platform_device *pdev)
if (apb->init_disabled)
return 0;
 
-   /* Even if it is in OFF state, then we do not want to change the state 
*/
+   /*
+*Even if it is in OFF state,
+*then we do not want to change the state
+*/
if (apb->state == ARCHE_PLATFORM_STATE_STANDBY ||
apb->state == ARCHE_PLATFORM_STATE_OFF)
return 0;
@@ -183,7 +186,7 @@ static int standby_boot_seq(struct platform_device *pdev)
 * Pasted from WDM spec,
 *  - A falling edge on POWEROFF_L is detected (a)
 *  - WDM enters standby mode, but no output signals are changed
-* */
+*/
 
/* TODO: POWEROFF_L is input to WDM module  */
apb->state = ARCHE_PLATFORM_STATE_STANDBY;
@@ -286,7 +289,8 @@ static ssize_t state_store(struct device *dev,
return count;
 
/* First we want to make sure we power off everything
-* and then enter FW flashing state */
+* and then enter FW flashing state
+*/
poweroff_seq(pdev);
ret = fw_flashing_seq(pdev);
} else {
-- 
2.7.4

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


Re: [PATCH] Staging:greybus:arche-apb-ctrl: fix trailing */ Block comments and 80 character line limit coding style issue

2016-10-07 Thread Joe Perches
On Fri, 2016-10-07 at 13:23 -0700, Nadim Almas wrote:
> Fixed coding style issue
> diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
> b/drivers/staging/greybus/arche-apb-ctrl.c
[]
> @@ -168,7 +168,10 @@ static int standby_boot_seq(struct platform_device *pdev)
>   if (apb->init_disabled)
>   return 0;
>  
> - /* Even if it is in OFF state, then we do not want to change the state 
> */
> + /*
> +  *Even if it is in OFF state,
> +  *then we do not want to change the state
> +  */

block comments use a space after the leading *

/*
 * Even if it is in the OFF state,
 * then we do not want to change the state
 */

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


Re: [PATCH 0/6] Introduce Juniper CBC FPGA

2016-10-07 Thread Greg Kroah-Hartman
On Fri, Oct 07, 2016 at 09:53:29PM +0300, Pantelis Antoniou wrote:
> Hi Greg,
> 
> > On Oct 7, 2016, at 18:39 , Greg Kroah-Hartman  
> > wrote:
> > 
> > On Fri, Oct 07, 2016 at 06:20:08PM +0300, Pantelis Antoniou wrote:
> >> Add Juniper's PTX1K CBC FPGA driver. Those FPGAs
> >> are present in Juniper's PTX series of routers.
> >> 
> >> The MFD driver provices a gpio device and a special
> >> driver for Juniper's board infrastucture.
> >> The FPGA infrastucture driver is providing an interface
> >> for user-space handling of the FPGA in those platforms.
> >> 
> >> There are full device tree binding documents for the
> >> master mfd driver and for the slave driver.
> >> 
> >> This patchset is against mainline as of today: v4.8-9431-g3477d16
> >> and is dependent on the "Juniper prerequisites" and
> >> "Juniper infrastructure" patchsets sent earlier.
> >> 
> >> Georgi Vlaev (5):
> >>  mfd: Add support for the PTX1K CBC FPGA
> >>  gpio: Add support for PTX1K CBC FPGA spare GPIOs
> >>  gpio: gpio-cbc: Document bindings of CBC FPGA GPIO block
> >>  gpio: cbc-presence: Add CBC presence detect as GPIO driver
> >>  gpio: gpio-cbc-presense: Document bindings of CBC FPGA presence
> >> 
> >> Tom Kavanagh (1):
> >>  staging: jnx: CBD-FPGA infrastructure
> >> 
> >> .../bindings/gpio/jnx,gpio-cbc-presense.txt|  31 +
> >> .../devicetree/bindings/gpio/jnx,gpio-cbc.txt  |  30 +
> >> drivers/gpio/Kconfig   |  23 +
> >> drivers/gpio/Makefile  |   2 +
> >> drivers/gpio/gpio-cbc-presence.c   | 460 ++
> >> drivers/gpio/gpio-cbc.c| 236 +
> >> drivers/mfd/Kconfig|  16 +
> >> drivers/mfd/Makefile   |   1 +
> >> drivers/mfd/cbc-core.c | 971 
> >> +
> >> drivers/staging/jnx/Kconfig|  34 +
> >> drivers/staging/jnx/Makefile   |   5 +
> >> drivers/staging/jnx/jnx-cbc-ptx1k.c| 242 +
> >> drivers/staging/jnx/jnx-cbd-fpga-common.c  | 332 +++
> >> drivers/staging/jnx/jnx-cbd-fpga-common.h  |  27 +
> >> drivers/staging/jnx/jnx-cbd-fpga-core.c| 540 
> >> drivers/staging/jnx/jnx-cbd-fpga-core.h|  68 ++
> >> drivers/staging/jnx/jnx-cbd-fpga-platdata.h|  51 ++
> >> drivers/staging/jnx/jnx-cbd-fpga-ptx1k.c   | 134 +++
> >> drivers/staging/jnx/jnx-cbd-fpga-ptx21k.c  | 143 +++
> >> drivers/staging/jnx/jnx-cbd-fpga-ptx3k.c   | 111 +++
> >> drivers/staging/jnx/jnx-cbd-fpga-ptx5k.c   | 107 +++
> >> include/linux/mfd/cbc-core.h   | 181 
> >> 22 files changed, 3745 insertions(+)
> > 
> > Please don't mix driver submissions like this.  Staging stuff needs to
> > go to the staging maintainer, gpio to that one, mfd to that one, and so
> > on.
> > 
> > there's almost nothing anyone can do with this series as-is, sorry.
> > 
> > please split it up.
> > 
> 
> Now I’m confused, this is a typical MFD submission:
> 
> https://lwn.net/Articles/587032/
> 
> Looks like it’s normal for a single patchset against multiple subsystems.

Not when it crosses the drivers/staging/ boundry.

> Do we have a definitive form for this?

Either submit all of this stuff "properly", or put it in staging, don't
cross the boundry if at all possible, it just causes a lot of confusion
and headache as the staging stuff could be deleted at any time.

You still haven't explained why you feel drivers/staging/ is the right
place for this codebase.  Again, why not just submit it "properly"?

thanks,

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


Re: [PATCH 1/3] Staging: i4l: Warning "Prefer "pr_debug over printk(KERN_DEBUG... " fixed

2016-10-07 Thread Joe Perches
On Fri, 2016-10-07 at 22:27 +0530, Harman Kalra wrote:
> Warning "Prefer "pr_debug over printk(KERN_DEBUG... " and "few line more than 
> 80 character" fixed

The commit subject and message doesn't match the code change.

> diff --git a/drivers/staging/i4l/icn/icn.h b/drivers/staging/i4l/icn/icn.h
[]
> @@ -54,7 +54,8 @@
>  
>  /* some useful macros for debugging */
>  #ifdef ICN_DEBUG_PORT
> -#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, 
> p); outb_p(v, p);}
> +#define OUTB_P(v, p) \
> + {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
> outb_p(v, p); }

This would be better with a do {...} while (0) guard

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


[PATCH v2 1/2] Staging:greybus:arche-apb-ctrl: fix trailing */ Block comments and 80 character line limit coding style issue

2016-10-07 Thread Nadim Almas
Fixed coding style issue

Signed-off-by: Nadim Almas 
---
Changes in v2:
  - Used space after leading * in block comments.

 drivers/staging/greybus/arche-apb-ctrl.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index 70323aa..eeba912 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -168,7 +168,10 @@ static int standby_boot_seq(struct platform_device *pdev)
if (apb->init_disabled)
return 0;
 
-   /* Even if it is in OFF state, then we do not want to change the state 
*/
+   /*
+* Even if it is in OFF state,
+* then we do not want to change the state
+*/
if (apb->state == ARCHE_PLATFORM_STATE_STANDBY ||
apb->state == ARCHE_PLATFORM_STATE_OFF)
return 0;
@@ -183,7 +186,7 @@ static int standby_boot_seq(struct platform_device *pdev)
 * Pasted from WDM spec,
 *  - A falling edge on POWEROFF_L is detected (a)
 *  - WDM enters standby mode, but no output signals are changed
-* */
+*/
 
/* TODO: POWEROFF_L is input to WDM module  */
apb->state = ARCHE_PLATFORM_STATE_STANDBY;
@@ -286,7 +289,8 @@ static ssize_t state_store(struct device *dev,
return count;
 
/* First we want to make sure we power off everything
-* and then enter FW flashing state */
+* and then enter FW flashing state
+*/
poweroff_seq(pdev);
ret = fw_flashing_seq(pdev);
} else {
-- 
2.7.4

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


[PATCH 0/3] Add support for led triggers on phy link state change

2016-10-07 Thread Zach Brown
Fix skge driver that declared enum contants that conflicted with enum
constants in linux/leds.h

Create function that encapsulates actions taken during the adjust phy link step
of phy state changes.

Add support for led triggers on phy link state changes by adding
a config option. When set the config option will create a set of led triggers
for each phy device. Users can use the led triggers to represent link state
changes on the phy.

v2:
 * New patch that creates phy_adjust_link function to encapsulate actions taken
   when adjusting phy link during phy state changes
 * led trigger speed strings changed to match existing phy speed strings
 * New function that maps speeds to led triggers
 * Replace magic constants with definitions when declaring trigger name
   buffer and number of triggers.
v3:
 * Changed LED_ON to LED_REG_ON in skge driver to avoid possible future
   conflict and improve consistency.
 * Dropped rtl8712 patch that was accepted separately.

Josh Cartwright (1):
  phy,leds: add support for led triggers on phy link state change

Zach Brown (2):
  skge: Change LED_OFF to LED_REG_OFF in marvel skge driver to avoid
conflicts with leds namespace
  phy: Encapsulate actions performed during link state changes into
function phy_adjust_link

 drivers/net/ethernet/marvell/skge.c |   6 +-
 drivers/net/ethernet/marvell/skge.h |   4 +-
 drivers/net/phy/Kconfig |  13 +++-
 drivers/net/phy/Makefile|   1 +
 drivers/net/phy/phy.c   |  22 ---
 drivers/net/phy/phy_device.c|   4 ++
 drivers/net/phy/phy_led_triggers.c  | 121 
 include/linux/phy.h |   9 +++
 include/linux/phy_led_triggers.h|  52 
 9 files changed, 218 insertions(+), 14 deletions(-)
 create mode 100644 drivers/net/phy/phy_led_triggers.c
 create mode 100644 include/linux/phy_led_triggers.h

--
2.7.4

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


[RFC v3 1/3] skge: Rename LED_OFF and LED_ON in marvel skge driver to avoid conflicts with leds namespace

2016-10-07 Thread Zach Brown
Adding led support for phy causes namespace conflicts for some
phy drivers.

The marvel skge driver declared an enum for representing the states of
Link LED Register. The enum contained constant LED_OFF which conflicted
with declartation found in linux/leds.h.
LED_OFF changed to LED_REG_OFF
Also changed LED_ON to LED_REG_ON to avoid possible future conflict and
for consistency.

Signed-off-by: Zach Brown 
---
 drivers/net/ethernet/marvell/skge.c | 6 +++---
 drivers/net/ethernet/marvell/skge.h | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/marvell/skge.c 
b/drivers/net/ethernet/marvell/skge.c
index 7173836..783df01 100644
--- a/drivers/net/ethernet/marvell/skge.c
+++ b/drivers/net/ethernet/marvell/skge.c
@@ -1048,7 +1048,7 @@ static const char *skge_pause(enum pause_status status)
 static void skge_link_up(struct skge_port *skge)
 {
skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG),
-   LED_BLK_OFF|LED_SYNC_OFF|LED_ON);
+   LED_BLK_OFF|LED_SYNC_OFF|LED_REG_ON);
 
netif_carrier_on(skge->netdev);
netif_wake_queue(skge->netdev);
@@ -1062,7 +1062,7 @@ static void skge_link_up(struct skge_port *skge)
 
 static void skge_link_down(struct skge_port *skge)
 {
-   skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
+   skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_REG_OFF);
netif_carrier_off(skge->netdev);
netif_stop_queue(skge->netdev);
 
@@ -2668,7 +2668,7 @@ static int skge_down(struct net_device *dev)
if (hw->ports == 1)
free_irq(hw->pdev->irq, hw);
 
-   skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
+   skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_REG_OFF);
if (is_genesis(hw))
genesis_stop(skge);
else
diff --git a/drivers/net/ethernet/marvell/skge.h 
b/drivers/net/ethernet/marvell/skge.h
index a2eb341..3ea151f 100644
--- a/drivers/net/ethernet/marvell/skge.h
+++ b/drivers/net/ethernet/marvell/skge.h
@@ -662,8 +662,8 @@ enum {
LED_BLK_OFF = 1<<4, /* Link LED Blinking Off */
LED_SYNC_ON = 1<<3, /* Use Sync Wire to switch LED */
LED_SYNC_OFF= 1<<2, /* Disable Sync Wire Input */
-   LED_ON  = 1<<1, /* switch LED on */
-   LED_OFF = 1<<0, /* switch LED off */
+   LED_REG_ON  = 1<<1, /* switch LED on */
+   LED_REG_OFF = 1<<0, /* switch LED off */
 };
 
 /* Receive GMAC FIFO (YUKON) */
-- 
2.7.4

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


[RFC v3 3/3] phy, leds: add support for led triggers on phy link state change

2016-10-07 Thread Zach Brown
From: Josh Cartwright 

Create an option CONFIG_LED_TRIGGER_PHY (default n), which will
create a set of led triggers for each instantiated PHY device.  There is
one LED trigger per link-speed, per-phy.

This allows for a user to configure their system to allow a set of LEDs
to represent link state changes on the phy.

Signed-off-by: Josh Cartwright 
Signed-off-by: Nathan Sullivan 
Signed-off-by: Zach Brown 
---
 drivers/net/phy/Kconfig|  13 +++-
 drivers/net/phy/Makefile   |   1 +
 drivers/net/phy/phy.c  |   1 +
 drivers/net/phy/phy_device.c   |   4 ++
 drivers/net/phy/phy_led_triggers.c | 121 +
 include/linux/phy.h|   9 +++
 include/linux/phy_led_triggers.h   |  52 
 7 files changed, 200 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/phy_led_triggers.c
 create mode 100644 include/linux/phy_led_triggers.h

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 5078a0d..4fd912d 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -25,6 +25,18 @@ config MDIO_BCM_IPROC
  This module provides a driver for the MDIO busses found in the
  Broadcom iProc SoC's.
 
+config LED_TRIGGER_PHY
+   bool "Support LED triggers for tracking link state"
+   depends on LEDS_TRIGGERS
+   ---help---
+ Adds support for a set of LED trigger events per-PHY.  Link
+ state change will trigger the events, for consumption by an
+ LED class driver.  There are triggers for each link speed,
+ and are of the form:
+  ::
+
+ Where speed is one of: 10Mbps, 100Mbps, 1Gbps, 2.5Gbps, or 10Gbps.
+
 config MDIO_BCM_UNIMAC
tristate "Broadcom UniMAC MDIO bus controller"
depends on HAS_IOMEM
@@ -40,7 +52,6 @@ config MDIO_BITBANG
  This module implements the MDIO bus protocol in software,
  for use by low level drivers that export the ability to
  drive the relevant pins.
-
  If in doubt, say N.
 
 config MDIO_BUS_MUX
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index e58667d..86d12cd 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -2,6 +2,7 @@
 
 libphy-y   := phy.o phy_device.o mdio_bus.o mdio_device.o
 libphy-$(CONFIG_SWPHY) += swphy.o
+libphy-$(CONFIG_LED_TRIGGER_PHY)   += phy_led_triggers.o
 
 obj-$(CONFIG_PHYLIB)   += libphy.o
 
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index f5721db..e5f9fee7 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -896,6 +896,7 @@ EXPORT_SYMBOL(phy_start);
 static void phy_adjust_link(struct phy_device *phydev)
 {
phydev->adjust_link(phydev->attached_dev);
+   phy_led_trigger_change_speed(phydev);
 }
 
 /**
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index e977ba9..4671c13 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,6 +58,7 @@ static void phy_mdio_device_free(struct mdio_device *mdiodev)
 
 static void phy_device_release(struct device *dev)
 {
+   phy_led_triggers_unregister(to_phy_device(dev));
kfree(to_phy_device(dev));
 }
 
@@ -345,6 +347,8 @@ struct phy_device *phy_device_create(struct mii_bus *bus, 
int addr, int phy_id,
 
dev->state = PHY_DOWN;
 
+   phy_led_triggers_register(dev);
+
mutex_init(&dev->lock);
INIT_DELAYED_WORK(&dev->state_queue, phy_state_machine);
INIT_WORK(&dev->phy_queue, phy_change);
diff --git a/drivers/net/phy/phy_led_triggers.c 
b/drivers/net/phy/phy_led_triggers.c
new file mode 100644
index 000..32326d7
--- /dev/null
+++ b/drivers/net/phy/phy_led_triggers.c
@@ -0,0 +1,121 @@
+/* Copyright (C) 2016 National Instruments Corp.
+ *
+ * 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.
+ *
+ * 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.
+ */
+#include 
+#include 
+#include 
+
+static struct phy_led_trigger *phy_speed_to_led_trigger(struct phy_device *phy,
+   unsigned int speed)
+{
+   switch (speed) {
+   case SPEED_10:
+   return &phy->phy_led_trigger[0];
+   case SPEED_100:
+   return &phy->phy_led_trigger[1];
+   case SPEED_1000:
+   return &phy->phy_led_trigger[2];
+   case SPEED_2500:
+   return &phy->phy_led_trigger[3];
+   case SPEED_1:
+  

[RFC v3 2/3] phy: Encapsulate actions performed during link state changes into function phy_adjust_link

2016-10-07 Thread Zach Brown
During phy state machine state transitions some set of actions should
occur whenever the link state changes. These actions should be
encapsulated into a single function

This patch adds the phy_adjust_link function, which is called whenever
phydev->adjust_link would have been called before. Actions that should
occur whenever the phy link is adjusted can now be added to the
phy_adjust_link function.

Signed-off-by: Zach Brown 
---
 drivers/net/phy/phy.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c6f6683..f5721db 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -893,6 +893,11 @@ void phy_start(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(phy_start);
 
+static void phy_adjust_link(struct phy_device *phydev)
+{
+   phydev->adjust_link(phydev->attached_dev);
+}
+
 /**
  * phy_state_machine - Handle the state machine
  * @work: work_struct that describes the work to be done
@@ -935,7 +940,7 @@ void phy_state_machine(struct work_struct *work)
if (!phydev->link) {
phydev->state = PHY_NOLINK;
netif_carrier_off(phydev->attached_dev);
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
break;
}
 
@@ -948,7 +953,7 @@ void phy_state_machine(struct work_struct *work)
if (err > 0) {
phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
 
} else if (0 == phydev->link_timeout--)
needs_aneg = true;
@@ -975,7 +980,7 @@ void phy_state_machine(struct work_struct *work)
}
phydev->state = PHY_RUNNING;
netif_carrier_on(phydev->attached_dev);
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
}
break;
case PHY_FORCING:
@@ -991,7 +996,7 @@ void phy_state_machine(struct work_struct *work)
needs_aneg = true;
}
 
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
break;
case PHY_RUNNING:
/* Only register a CHANGE if we are polling and link changed
@@ -1020,7 +1025,7 @@ void phy_state_machine(struct work_struct *work)
netif_carrier_off(phydev->attached_dev);
}
 
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
 
if (phy_interrupt_is_valid(phydev))
err = phy_config_interrupt(phydev,
@@ -1030,7 +1035,7 @@ void phy_state_machine(struct work_struct *work)
if (phydev->link) {
phydev->link = 0;
netif_carrier_off(phydev->attached_dev);
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
do_suspend = true;
}
break;
@@ -1054,7 +1059,7 @@ void phy_state_machine(struct work_struct *work)
} else  {
phydev->state = PHY_NOLINK;
}
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
} else {
phydev->state = PHY_AN;
phydev->link_timeout = PHY_AN_TIMEOUT;
@@ -1070,7 +1075,7 @@ void phy_state_machine(struct work_struct *work)
} else  {
phydev->state = PHY_NOLINK;
}
-   phydev->adjust_link(phydev->attached_dev);
+   phy_adjust_link(phydev);
}
break;
}
-- 
2.7.4

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


[PATCH] drivers: staging: greybus: Fixed CHECKS for brace issues

2016-10-07 Thread Chase Metzger
Added braces to else statements where checkpatch complained.

Signed-off-by: Chase Metzger 
---
 drivers/staging/greybus/audio_codec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/audio_codec.c 
b/drivers/staging/greybus/audio_codec.c
index 8a0744b..1bdf849 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -655,8 +655,10 @@ static int gbcodec_mute_stream(struct snd_soc_dai *dai, 
int mute, int stream)
ret = gb_audio_apbridgea_shutdown_rx(data->connection,
 0);
params->state = GBAUDIO_CODEC_STOP;
-   } else
+   } else {
ret = -EINVAL;
+   }
+
if (ret)
dev_err_ratelimited(dai->dev,
"%s:Error during %s %s stream:%d\n",
-- 
2.1.4

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