Re: [PATCH v2] usb: dwc3: OCTEON: add support for device tree

2016-09-09 Thread kbuild test robot
Hi Steven,

[auto build test WARNING on balbi-usb/next]
[also build test WARNING on v4.8-rc5 next-20160909]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Steven-J-Hill/usb-dwc3-OCTEON-add-support-for-device-tree/20160910-003135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/usb/dwc3/dwc3-octeon.c: In function 'dwc3_octeon_probe':
>> drivers/usb/dwc3/dwc3-octeon.c:61:19: warning: cast from pointer to integer 
>> of different size [-Wpointer-to-int-cast]
 octeon->index = ((u64)octeon->usbctl >> 24) & 1;
  ^

vim +61 drivers/usb/dwc3/dwc3-octeon.c

45   * "dma-ranges" or "dma-coherent" properties.
46   */
47  ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
48  if (ret)
49  return ret;
50  
51  platform_set_drvdata(pdev, octeon);
52  octeon->dev = dev;
53  
54  /* Resources for lower level OCTEON USB control. */
55  res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
56  octeon->usbctl = devm_ioremap_resource(dev, res);
57  if (IS_ERR(octeon->usbctl))
58  return PTR_ERR(octeon->usbctl);
59  
60  /* Controller index. */
  > 61  octeon->index = ((u64)octeon->usbctl >> 24) & 1;
62  
63  return 0;
64  }
65  
66  static const struct of_device_id octeon_dwc3_match[] = {
67  { .compatible = "cavium,octeon-7130-usb-uctl", },
68  {},
69  };

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


.config.gz
Description: Binary data


Re: [PATCH v2] usb: dwc3: OCTEON: add support for device tree

2016-09-09 Thread kbuild test robot
Hi Steven,

[auto build test WARNING on balbi-usb/next]
[also build test WARNING on v4.8-rc5 next-20160909]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]
[Suggest to use git(>=2.9.0) format-patch --base= (or --base=auto for 
convenience) to record what (public, well-known) commit your patch series was 
built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:
https://github.com/0day-ci/linux/commits/Steven-J-Hill/usb-dwc3-OCTEON-add-support-for-device-tree/20160910-003135
base:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/usb/dwc3/dwc3-octeon.c: In function 'dwc3_octeon_probe':
>> drivers/usb/dwc3/dwc3-octeon.c:61:19: warning: cast from pointer to integer 
>> of different size [-Wpointer-to-int-cast]
 octeon->index = ((u64)octeon->usbctl >> 24) & 1;
  ^

vim +61 drivers/usb/dwc3/dwc3-octeon.c

45   * "dma-ranges" or "dma-coherent" properties.
46   */
47  ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
48  if (ret)
49  return ret;
50  
51  platform_set_drvdata(pdev, octeon);
52  octeon->dev = dev;
53  
54  /* Resources for lower level OCTEON USB control. */
55  res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
56  octeon->usbctl = devm_ioremap_resource(dev, res);
57  if (IS_ERR(octeon->usbctl))
58  return PTR_ERR(octeon->usbctl);
59  
60  /* Controller index. */
  > 61  octeon->index = ((u64)octeon->usbctl >> 24) & 1;
62  
63  return 0;
64  }
65  
66  static const struct of_device_id octeon_dwc3_match[] = {
67  { .compatible = "cavium,octeon-7130-usb-uctl", },
68  {},
69  };

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


.config.gz
Description: Binary data


[PATCH v2] usb: dwc3: OCTEON: add support for device tree

2016-09-09 Thread Steven J. Hill
This patch adds support to parse the data for
the dwc3-octeon driver using device tree. The
DWC3 IP core is found on OCTEON III processors.

Signed-off-by: Steven J. Hill 

Changes in v2:
- Changed comment block to acurately describe why the DMA
  properties are being set.
- Deleted 'dwc3_octeon_remove()' function as it serves
  no purpose. Also changed driver from tristate to a
  boolen as we have no plans to make it modular.
- Changed driver dependency from CAVIUM_OCTEON_SOC to
  CPU_CAVIUM_OCTEON || COMPILE_TEST per Balbi's request.

---
 drivers/usb/dwc3/Kconfig   | 10 +
 drivers/usb/dwc3/Makefile  |  1 +
 drivers/usb/dwc3/dwc3-octeon.c | 85 ++
 3 files changed, 96 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-octeon.c

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index a64ce1c..f2cb24b 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -105,4 +105,14 @@ config USB_DWC3_ST
  inside (i.e. STiH407).
  Say 'Y' or 'M' if you have one such device.

+config USB_DWC3_OCTEON
+   bool "Cavium OCTEON III Platforms"
+   depends on CPU_CAVIUM_OCTEON || COMPILE_TEST
+   depends on OF
+   default USB_DWC3
+   help
+ Cavium OCTEON III SoCs with one DesignWare Core USB3 IP
+ inside (i.e. cn71xx and cn78xx).
+ Say 'Y' or 'M' if you have one such device.
+
 endif
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 22420e1..f1a7a3e 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_USB_DWC3_PCI)+= dwc3-pci.o
 obj-$(CONFIG_USB_DWC3_KEYSTONE)+= dwc3-keystone.o
 obj-$(CONFIG_USB_DWC3_OF_SIMPLE)   += dwc3-of-simple.o
 obj-$(CONFIG_USB_DWC3_ST)  += dwc3-st.o
+obj-$(CONFIG_USB_DWC3_OCTEON)  += dwc3-octeon.o
diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
new file mode 100644
index 000..de46939
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-octeon.c
@@ -0,0 +1,85 @@
+/**
+ * dwc3-octeon.c - Cavium OCTEON III DWC3 Specific Glue Layer
+ *
+ * Copyright (C) 2016 Cavium Networks
+ *
+ * Author: Steven J. Hill 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Inspired by dwc3-exynos.c and dwc3-st.c files.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct dwc3_octeon {
+   struct device   *dev;
+   void __iomem*usbctl;
+   int index;
+};
+
+static int dwc3_octeon_probe(struct platform_device *pdev)
+{
+   struct device   *dev = >dev;
+   struct resource *res;
+   struct dwc3_octeon  *octeon;
+   int ret;
+
+   octeon = devm_kzalloc(dev, sizeof(*octeon), GFP_KERNEL);
+   if (!octeon)
+   return - ENOMEM;
+
+   /*
+* Right now device-tree probed devices do not provide
+* "dma-ranges" or "dma-coherent" properties.
+*/
+   ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+   if (ret)
+   return ret;
+
+   platform_set_drvdata(pdev, octeon);
+   octeon->dev = dev;
+
+   /* Resources for lower level OCTEON USB control. */
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   octeon->usbctl = devm_ioremap_resource(dev, res);
+   if (IS_ERR(octeon->usbctl))
+   return PTR_ERR(octeon->usbctl);
+
+   /* Controller index. */
+   octeon->index = ((u64)octeon->usbctl >> 24) & 1;
+
+   return 0;
+}
+
+static const struct of_device_id octeon_dwc3_match[] = {
+   { .compatible = "cavium,octeon-7130-usb-uctl", },
+   {},
+};
+MODULE_DEVICE_TABLE(of, octeon_dwc3_match);
+
+static struct platform_driver dwc3_octeon_driver = {
+   .probe  = dwc3_octeon_probe,
+   .driver = {
+   .name   = "octeon-dwc3",
+   .of_match_table = octeon_dwc3_match,
+   .pm = NULL,
+   },
+};
+module_platform_driver(dwc3_octeon_driver);
+
+MODULE_ALIAS("platform:octeon-dwc3");
+MODULE_AUTHOR("Steven J. Hill 

[PATCH v2] usb: dwc3: OCTEON: add support for device tree

2016-09-09 Thread Steven J. Hill
This patch adds support to parse the data for
the dwc3-octeon driver using device tree. The
DWC3 IP core is found on OCTEON III processors.

Signed-off-by: Steven J. Hill 

Changes in v2:
- Changed comment block to acurately describe why the DMA
  properties are being set.
- Deleted 'dwc3_octeon_remove()' function as it serves
  no purpose. Also changed driver from tristate to a
  boolen as we have no plans to make it modular.
- Changed driver dependency from CAVIUM_OCTEON_SOC to
  CPU_CAVIUM_OCTEON || COMPILE_TEST per Balbi's request.

---
 drivers/usb/dwc3/Kconfig   | 10 +
 drivers/usb/dwc3/Makefile  |  1 +
 drivers/usb/dwc3/dwc3-octeon.c | 85 ++
 3 files changed, 96 insertions(+)
 create mode 100644 drivers/usb/dwc3/dwc3-octeon.c

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index a64ce1c..f2cb24b 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -105,4 +105,14 @@ config USB_DWC3_ST
  inside (i.e. STiH407).
  Say 'Y' or 'M' if you have one such device.

+config USB_DWC3_OCTEON
+   bool "Cavium OCTEON III Platforms"
+   depends on CPU_CAVIUM_OCTEON || COMPILE_TEST
+   depends on OF
+   default USB_DWC3
+   help
+ Cavium OCTEON III SoCs with one DesignWare Core USB3 IP
+ inside (i.e. cn71xx and cn78xx).
+ Say 'Y' or 'M' if you have one such device.
+
 endif
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 22420e1..f1a7a3e 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -39,3 +39,4 @@ obj-$(CONFIG_USB_DWC3_PCI)+= dwc3-pci.o
 obj-$(CONFIG_USB_DWC3_KEYSTONE)+= dwc3-keystone.o
 obj-$(CONFIG_USB_DWC3_OF_SIMPLE)   += dwc3-of-simple.o
 obj-$(CONFIG_USB_DWC3_ST)  += dwc3-st.o
+obj-$(CONFIG_USB_DWC3_OCTEON)  += dwc3-octeon.o
diff --git a/drivers/usb/dwc3/dwc3-octeon.c b/drivers/usb/dwc3/dwc3-octeon.c
new file mode 100644
index 000..de46939
--- /dev/null
+++ b/drivers/usb/dwc3/dwc3-octeon.c
@@ -0,0 +1,85 @@
+/**
+ * dwc3-octeon.c - Cavium OCTEON III DWC3 Specific Glue Layer
+ *
+ * Copyright (C) 2016 Cavium Networks
+ *
+ * Author: Steven J. Hill 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Inspired by dwc3-exynos.c and dwc3-st.c files.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct dwc3_octeon {
+   struct device   *dev;
+   void __iomem*usbctl;
+   int index;
+};
+
+static int dwc3_octeon_probe(struct platform_device *pdev)
+{
+   struct device   *dev = >dev;
+   struct resource *res;
+   struct dwc3_octeon  *octeon;
+   int ret;
+
+   octeon = devm_kzalloc(dev, sizeof(*octeon), GFP_KERNEL);
+   if (!octeon)
+   return - ENOMEM;
+
+   /*
+* Right now device-tree probed devices do not provide
+* "dma-ranges" or "dma-coherent" properties.
+*/
+   ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
+   if (ret)
+   return ret;
+
+   platform_set_drvdata(pdev, octeon);
+   octeon->dev = dev;
+
+   /* Resources for lower level OCTEON USB control. */
+   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   octeon->usbctl = devm_ioremap_resource(dev, res);
+   if (IS_ERR(octeon->usbctl))
+   return PTR_ERR(octeon->usbctl);
+
+   /* Controller index. */
+   octeon->index = ((u64)octeon->usbctl >> 24) & 1;
+
+   return 0;
+}
+
+static const struct of_device_id octeon_dwc3_match[] = {
+   { .compatible = "cavium,octeon-7130-usb-uctl", },
+   {},
+};
+MODULE_DEVICE_TABLE(of, octeon_dwc3_match);
+
+static struct platform_driver dwc3_octeon_driver = {
+   .probe  = dwc3_octeon_probe,
+   .driver = {
+   .name   = "octeon-dwc3",
+   .of_match_table = octeon_dwc3_match,
+   .pm = NULL,
+   },
+};
+module_platform_driver(dwc3_octeon_driver);
+
+MODULE_ALIAS("platform:octeon-dwc3");
+MODULE_AUTHOR("Steven J. Hill