Re: [PATCH] arc: Removed local initramfs source file from axs101 configuration.

2016-01-11 Thread Alexey Brodkin
Hi Vineet,

On Mon, 2016-01-11 at 07:47 +, Vineet Gupta wrote:
> On Saturday 09 January 2016 05:55 AM, Carlos Palminha wrote:
> > Hi Alexey,
> > 
> > Probably my e-mail comments before the patch mislead you...
> > If you download the kernel source and try to compile it, it won't work 
> > because of the INITRAMFS pointing to a non
> > -existing directory. (check log below)
> > 
> > That's why that option should be removed from the standard kernel.
> 
> Since the axs101 DT cmdline lacks any reference to root device - how does this
> unmodified kernel boot anyways w/o changing DT. Does uboot provide the 
> cmdline for
> rootfs ?

Indeed if initramfs is not built-in vmlinux/uImage then kernel command-line
must be adjusted to point to real root device.

This could be done in 2 ways:

 [1] Manually modify "bootargs" value in arch/arc/boot/dts/axs10{1|3}.dts
 [2] In case of U-Boot it's possible to load device tree blob together with 
uImage
 and in that case U-Boot's "bootargs" env variable will override the one in 
.dtb

-Alexey
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v3 0/2] adding PCI support to AXS10x

2016-01-11 Thread Joao Pinto

Hi Bjorn,

On 1/8/2016 8:33 PM, Bjorn Helgaas wrote:
> Hi Joao,
> 
> On Mon, Dec 21, 2015 at 03:44:14PM +, Joao Pinto wrote:
>> This patch set has the goal to add suppport for DesignWare PCIe RC in ARC
>> AXS10x. It includes the necessary tweaks to the ARC architecture, necessary
>> tweaks to the PCI subsystem and a new driver (pcie-snpsdev).
>> This new driver will be used extensively in the PCIe RC Prototyping Kit.
>>
>> The patches were produced against Bjorn Helgaas' repository. It was properly
>> tested in an IP Prototyping Kit.
>>
>> Joao Pinto (2):
>>   PCI support added to ARC
>>   add new platform driver for PCI RC
>>
>>  .../devicetree/bindings/pci/pcie-snpsdev.txt   |  33 +++
>>  MAINTAINERS|   7 +
>>  arch/arc/Kconfig   |  23 ++
>>  arch/arc/include/asm/dma.h |   5 +
>>  arch/arc/include/asm/io.h  |  10 +
>>  arch/arc/include/asm/pci.h |  43 
>>  arch/arc/kernel/Makefile   |   1 +
>>  arch/arc/kernel/pcibios.c  |  55 
>>  arch/arc/mm/ioremap.c  |  10 +-
>>  arch/arc/plat-axs10x/Kconfig   |   1 +
>>  drivers/pci/Makefile   |   1 +
>>  drivers/pci/host/Kconfig   |   5 +
>>  drivers/pci/host/Makefile  |   1 +
>>  drivers/pci/host/pcie-designware.c |  11 +
>>  drivers/pci/host/pcie-designware.h |   1 +
>>  drivers/pci/host/pcie-snpsdev.c| 286 
>> +
>>  16 files changed, 492 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
>>  create mode 100644 arch/arc/include/asm/pci.h
>>  create mode 100644 arch/arc/kernel/pcibios.c
>>  create mode 100644 drivers/pci/host/pcie-snpsdev.c
> 
> This failed the kbuild test, so I'm waiting for a refresh to fix that.
> 
> Bjorn
> 

I am going to check what happened and send you an update ASAP.

Joao

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v3 0/2] adding PCI support to AXS10x

2016-01-11 Thread Joao Pinto
Hi Bjorn,

On 1/8/2016 8:33 PM, Bjorn Helgaas wrote:
> Hi Joao,
> 
> On Mon, Dec 21, 2015 at 03:44:14PM +, Joao Pinto wrote:
>> This patch set has the goal to add suppport for DesignWare PCIe RC in ARC
>> AXS10x. It includes the necessary tweaks to the ARC architecture, necessary
>> tweaks to the PCI subsystem and a new driver (pcie-snpsdev).
>> This new driver will be used extensively in the PCIe RC Prototyping Kit.
>>
>> The patches were produced against Bjorn Helgaas' repository. It was properly
>> tested in an IP Prototyping Kit.
>>
>> Joao Pinto (2):
>>   PCI support added to ARC
>>   add new platform driver for PCI RC
>>
>>  .../devicetree/bindings/pci/pcie-snpsdev.txt   |  33 +++
>>  MAINTAINERS|   7 +
>>  arch/arc/Kconfig   |  23 ++
>>  arch/arc/include/asm/dma.h |   5 +
>>  arch/arc/include/asm/io.h  |  10 +
>>  arch/arc/include/asm/pci.h |  43 
>>  arch/arc/kernel/Makefile   |   1 +
>>  arch/arc/kernel/pcibios.c  |  55 
>>  arch/arc/mm/ioremap.c  |  10 +-
>>  arch/arc/plat-axs10x/Kconfig   |   1 +
>>  drivers/pci/Makefile   |   1 +
>>  drivers/pci/host/Kconfig   |   5 +
>>  drivers/pci/host/Makefile  |   1 +
>>  drivers/pci/host/pcie-designware.c |  11 +
>>  drivers/pci/host/pcie-designware.h |   1 +
>>  drivers/pci/host/pcie-snpsdev.c| 286 
>> +
>>  16 files changed, 492 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
>>  create mode 100644 arch/arc/include/asm/pci.h
>>  create mode 100644 arch/arc/kernel/pcibios.c
>>  create mode 100644 drivers/pci/host/pcie-snpsdev.c
> 
> This failed the kbuild test, so I'm waiting for a refresh to fix that.

Just checked the kbuild robot error and it is happening in ARC git tree when
built for i386 arch and the problem is independent from my patches. The build
error is the following:

   drivers/pci/host/pcie-designware.c: In function 'dw_pcie_host_init':
>> drivers/pci/host/pcie-designware.c:556:7: error: implicit declaration of 
>> function
'pci_has_flag' [-Werror=implicit-function-declaration]
 if (!pci_has_flag(PCI_PROBE_ONLY)) {
  ^
>> drivers/pci/host/pcie-designware.c:556:20: error: 'PCI_PROBE_ONLY' undeclared
(first use in
this function)
 if (!pci_has_flag(PCI_PROBE_ONLY)) {
   ^
This problem has been already identified by Stephen Rothwell as you can see in
the following mailing list thread:

http://www.gossamer-threads.com/lists/linux/kernel/2341200

If there's something for me to do please let me know.

> 
> Bjorn
> 

Thanks,
Joao


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v3 0/2] adding PCI support to AXS10x

2016-01-11 Thread Bjorn Helgaas
On Mon, Jan 11, 2016 at 02:31:51PM +, Joao Pinto wrote:
> Hi Bjorn,
> 
> On 1/8/2016 8:33 PM, Bjorn Helgaas wrote:
> > Hi Joao,
> > 
> > On Mon, Dec 21, 2015 at 03:44:14PM +, Joao Pinto wrote:
> >> This patch set has the goal to add suppport for DesignWare PCIe RC in ARC
> >> AXS10x. It includes the necessary tweaks to the ARC architecture, necessary
> >> tweaks to the PCI subsystem and a new driver (pcie-snpsdev).
> >> This new driver will be used extensively in the PCIe RC Prototyping Kit.
> >>
> >> The patches were produced against Bjorn Helgaas' repository. It was 
> >> properly
> >> tested in an IP Prototyping Kit.
> >>
> >> Joao Pinto (2):
> >>   PCI support added to ARC
> >>   add new platform driver for PCI RC
> >>
> >>  .../devicetree/bindings/pci/pcie-snpsdev.txt   |  33 +++
> >>  MAINTAINERS|   7 +
> >>  arch/arc/Kconfig   |  23 ++
> >>  arch/arc/include/asm/dma.h |   5 +
> >>  arch/arc/include/asm/io.h  |  10 +
> >>  arch/arc/include/asm/pci.h |  43 
> >>  arch/arc/kernel/Makefile   |   1 +
> >>  arch/arc/kernel/pcibios.c  |  55 
> >>  arch/arc/mm/ioremap.c  |  10 +-
> >>  arch/arc/plat-axs10x/Kconfig   |   1 +
> >>  drivers/pci/Makefile   |   1 +
> >>  drivers/pci/host/Kconfig   |   5 +
> >>  drivers/pci/host/Makefile  |   1 +
> >>  drivers/pci/host/pcie-designware.c |  11 +
> >>  drivers/pci/host/pcie-designware.h |   1 +
> >>  drivers/pci/host/pcie-snpsdev.c| 286 
> >> +
> >>  16 files changed, 492 insertions(+), 1 deletion(-)
> >>  create mode 100644 Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
> >>  create mode 100644 arch/arc/include/asm/pci.h
> >>  create mode 100644 arch/arc/kernel/pcibios.c
> >>  create mode 100644 drivers/pci/host/pcie-snpsdev.c
> > 
> > This failed the kbuild test, so I'm waiting for a refresh to fix that.
> 
> Just checked the kbuild robot error and it is happening in ARC git tree when
> built for i386 arch and the problem is independent from my patches. The build
> error is the following:
> 
>drivers/pci/host/pcie-designware.c: In function 'dw_pcie_host_init':
> >> drivers/pci/host/pcie-designware.c:556:7: error: implicit declaration of 
> >> function
> 'pci_has_flag' [-Werror=implicit-function-declaration]
>  if (!pci_has_flag(PCI_PROBE_ONLY)) {
>   ^
> >> drivers/pci/host/pcie-designware.c:556:20: error: 'PCI_PROBE_ONLY' 
> >> undeclared
> (first use in
> this function)
>  if (!pci_has_flag(PCI_PROBE_ONLY)) {
>^
> This problem has been already identified by Stephen Rothwell as you can see in
> the following mailing list thread:
> 
> http://www.gossamer-threads.com/lists/linux/kernel/2341200

Stephen saw that problem while building the Qualcomm driver
(CONFIG_PCIE_QCOM), and we fixed it by changing Kconfig so we won't build
that driver on x86.

That fix only affects CONFIG_PCIE_QCOM, so it won't help your driver.

You need some improvements to your drivers/pci/host/Kconfig patch -- some
help text and probably some dependencies.

Bjorn

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v3 0/2] adding PCI support to AXS10x

2016-01-11 Thread Joao Pinto

Hi,
I am going to add dependencies to the driver' kconfig to avoid this problem. I
will send you a new patch version today.

Thanks.

On 1/11/2016 2:53 PM, Bjorn Helgaas wrote:
> On Mon, Jan 11, 2016 at 02:31:51PM +, Joao Pinto wrote:
>> Hi Bjorn,
>>
>> On 1/8/2016 8:33 PM, Bjorn Helgaas wrote:
>>> Hi Joao,
>>>
>>> On Mon, Dec 21, 2015 at 03:44:14PM +, Joao Pinto wrote:
 This patch set has the goal to add suppport for DesignWare PCIe RC in ARC
 AXS10x. It includes the necessary tweaks to the ARC architecture, necessary
 tweaks to the PCI subsystem and a new driver (pcie-snpsdev).
 This new driver will be used extensively in the PCIe RC Prototyping Kit.

 The patches were produced against Bjorn Helgaas' repository. It was 
 properly
 tested in an IP Prototyping Kit.

 Joao Pinto (2):
   PCI support added to ARC
   add new platform driver for PCI RC

  .../devicetree/bindings/pci/pcie-snpsdev.txt   |  33 +++
  MAINTAINERS|   7 +
  arch/arc/Kconfig   |  23 ++
  arch/arc/include/asm/dma.h |   5 +
  arch/arc/include/asm/io.h  |  10 +
  arch/arc/include/asm/pci.h |  43 
  arch/arc/kernel/Makefile   |   1 +
  arch/arc/kernel/pcibios.c  |  55 
  arch/arc/mm/ioremap.c  |  10 +-
  arch/arc/plat-axs10x/Kconfig   |   1 +
  drivers/pci/Makefile   |   1 +
  drivers/pci/host/Kconfig   |   5 +
  drivers/pci/host/Makefile  |   1 +
  drivers/pci/host/pcie-designware.c |  11 +
  drivers/pci/host/pcie-designware.h |   1 +
  drivers/pci/host/pcie-snpsdev.c| 286 
 +
  16 files changed, 492 insertions(+), 1 deletion(-)
  create mode 100644 Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
  create mode 100644 arch/arc/include/asm/pci.h
  create mode 100644 arch/arc/kernel/pcibios.c
  create mode 100644 drivers/pci/host/pcie-snpsdev.c
>>>
>>> This failed the kbuild test, so I'm waiting for a refresh to fix that.
>>
>> Just checked the kbuild robot error and it is happening in ARC git tree when
>> built for i386 arch and the problem is independent from my patches. The build
>> error is the following:
>>
>>drivers/pci/host/pcie-designware.c: In function 'dw_pcie_host_init':
 drivers/pci/host/pcie-designware.c:556:7: error: implicit declaration of 
 function
>> 'pci_has_flag' [-Werror=implicit-function-declaration]
>>  if (!pci_has_flag(PCI_PROBE_ONLY)) {
>>   ^
 drivers/pci/host/pcie-designware.c:556:20: error: 'PCI_PROBE_ONLY' 
 undeclared
>> (first use in
>> this function)
>>  if (!pci_has_flag(PCI_PROBE_ONLY)) {
>>^
>> This problem has been already identified by Stephen Rothwell as you can see 
>> in
>> the following mailing list thread:
>>
>> http://www.gossamer-threads.com/lists/linux/kernel/2341200
> 
> Stephen saw that problem while building the Qualcomm driver
> (CONFIG_PCIE_QCOM), and we fixed it by changing Kconfig so we won't build
> that driver on x86.
> 
> That fix only affects CONFIG_PCIE_QCOM, so it won't help your driver.
> 
> You need some improvements to your drivers/pci/host/Kconfig patch -- some
> help text and probably some dependencies.
> 
> Bjorn
> 


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH v4 2/2] add new platform driver for PCI RC

2016-01-11 Thread Joao Pinto
This patch adds a new driver that will be the reference platform driver for all
PCI RC IP Protoyping Kits based on ARC SDP. This patch is composed by:

-Changes to pcie-designware driver add a function that enables the feature of
starting the LTSSM (Link Train Status State) used by the new driver
-MAINTAINERS file was updated to include the new driver
-Documentation/devicetree/bindings/pci was updated to include the new driver
documentation
-New driver called pcie-snpsdev

Signed-off-by: Joao Pinto 
---
Changes v3 -> v4 (Bjorn Helgaas):
- ARCH dependencies were added to the drivers/pci/host/kconfig for the
PCIE_SNPSDEV.
Changes v2 -> v3 (Bjorn Helgaas):
- link init stuff was moved to a snpsdev_pcie_establish_link() function in
pcie-snpsdev
- pcie-snpsdev driver declaration was changed to be more 
standard (Bjorn Helgaas)
- pcie-designware' dw_pcie_link_retrain() now use standard registers from
pci-regs.h (Bjorn Helgaas)
- pcie-snpsdev.txt was complemented with more info (Mark Rutland)
Changes v1 -> v2 (Bjorn Helgaas):
- Fixups snpsdev_pcie_fixup_bridge() and snpsdev_pcie_fixup_res() were removed
from the driver (these functions were for specific tests only and not usefull
in mainline)
- Driver' comments were reviewed (fix Typos and excessive comments removal)
- Removed unnecessary definitions in the driver source (PCIE_PHY_CTRL and
PCIE_PHY_STAT)

 .../devicetree/bindings/pci/pcie-snpsdev.txt   |  33 +++
 MAINTAINERS|   7 +
 drivers/pci/host/Kconfig   |   8 +
 drivers/pci/host/Makefile  |   1 +
 drivers/pci/host/pcie-designware.c |  11 +
 drivers/pci/host/pcie-designware.h |   1 +
 drivers/pci/host/pcie-snpsdev.c| 286 +
 7 files changed, 347 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
 create mode 100644 drivers/pci/host/pcie-snpsdev.c

diff --git a/Documentation/devicetree/bindings/pci/pcie-snpsdev.txt 
b/Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
new file mode 100644
index 000..cae548b
--- /dev/null
+++ b/Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
@@ -0,0 +1,33 @@
+Synopsys PCI RC IP Prototyping Kit
+--
+
+This is the reference platform driver to be used in the Synopsys PCI Root
+Complex IP Prototyping Kit.
+
+Required properties:
+- compatible: set to "snps,pcie-snpsdev";
+- reg: base address and length of the pcie controller registers.
+- #address-cells: set to <3>
+- #size-cells: set to <2>
+- device_type: set to "pci"
+- ranges: ranges for the PCI memory and I/O regions.
+- interrupts: one interrupt source for MSI interrupts, followed by interrupt
+   source for hardware related interrupts.
+- #interrupt-cells: set to <1>
+- num-lanes: set to <1>;
+
+Example configuration:
+
+   pcie: pcie@0xd000 {
+   compatible = "snps,pcie-snpsdev";
+   reg = <0xd000 0x1000>;
+   #address-cells = <3>;
+   #size-cells = <2>;
+   device_type = "pci";
+   ranges = <0x0800 0 0xd000 0xd000 0 0x2000>,
+<0x8100 0 0x 0xde00 0 0x0001>,
+<0x8200 0 0xd040 0xd040 0 0x0d00>;
+   interrupts = <25>, <24>;
+   #interrupt-cells = <1>;
+   num-lanes = <1>;
+   };
diff --git a/MAINTAINERS b/MAINTAINERS
index e9caa4b..d2e4506 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8230,6 +8230,13 @@ S:   Maintained
 F: Documentation/devicetree/bindings/pci/hisilicon-pcie.txt
 F: drivers/pci/host/pcie-hisi.c
 
+PCI DRIVER FOR SYNOPSYS PROTOTYPING DEVICE
+M: Joao Pinto 
+L: linux-...@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
+F: drivers/pci/host/pcie-snpsdev.c
+
 PCMCIA SUBSYSTEM
 P: Linux PCMCIA Team
 L: linux-pcm...@lists.infradead.org
diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig
index f131ba9..589bc15 100644
--- a/drivers/pci/host/Kconfig
+++ b/drivers/pci/host/Kconfig
@@ -172,4 +172,12 @@ config PCI_HISI
help
  Say Y here if you want PCIe controller support on HiSilicon HIP05 SoC
 
+config PCIE_SNPSDEV
+   bool "Platform Driver for Synopsys Device"
+   depends on ARC && OF
+   select PCIEPORTBUS
+   select PCIE_DW
+   help
+ Say Y here if you want to enable PCIe controller support on the
+ Synopsys IP Prototyping Kits.
 endmenu
diff --git a/drivers/pci/host/Makefile b/drivers/pci/host/Makefile
index 9d4d3c6..e422f65 100644
--- a/drivers/pci/host/Makefile
+++ b/drivers/pci/host/Makefile
@@ -20,3 +20,4 @@ obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o
 obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
 obj-$(CONFIG_PCIE_ALTERA_MSI) += pcie-altera-msi.o
 obj-$(CONFIG_PCI_HISI) += pcie-hisi.o
+obj-$(CON

[PATCH v4 1/2] PCI support added to ARC

2016-01-11 Thread Joao Pinto
This patch adds PCI support to ARC and updates drivers/pci Makefile enabling
the ARC arch to use the generic PCI setup functions.

Signed-off-by: Joao Pinto 
---
Change v3 -> v4:
- Nothing changed (just to keep up with patch set version).
Change v2 -> v3 (Bjorn Helgaas):
- arch/arc/kernel/pcibios.c unused functions were removed and also the
arch/arc/include/asm/mach/pci.h was removed because was no longer necessary
Change v1 -> v2:
- In arch/arc/Kconfig, the new menu entry (Bus Configuration) was moved to the
slot between sourcing of drivers/Kconfig and fs/Kconfig (Vineet Gupta)
- In arch/arc/plat-axs10x/Kconfig the "select MIGHT_HAVE_PCI" option was placed
in order as suggested (Vineet Gupta)
- ioport_map() and ioport_unmap() were static inlined and included in
the io.h (Vineet Gupta)
- pcibios_min_io and pcibios_min_mem declaration moved to
pcibios.c (Vineet Gupta)
- pr_err() replaced by dev_err() in pcibios_enable_device() (Bjorn Helgaas)
- string simplified in pcibios_enable_device() (Vineet Gupta)
- pci_host_bridge_window structure was replaced by resource_entry structure, and
list_for_each_entry() for resource_list_for_each_entry() in pcibios.c

 arch/arc/Kconfig | 23 ++
 arch/arc/include/asm/dma.h   |  5 
 arch/arc/include/asm/io.h| 10 
 arch/arc/include/asm/pci.h   | 43 ++
 arch/arc/kernel/Makefile |  1 +
 arch/arc/kernel/pcibios.c| 55 
 arch/arc/mm/ioremap.c| 10 +++-
 arch/arc/plat-axs10x/Kconfig |  1 +
 drivers/pci/Makefile |  1 +
 9 files changed, 148 insertions(+), 1 deletion(-)
 create mode 100644 arch/arc/include/asm/pci.h
 create mode 100644 arch/arc/kernel/pcibios.c

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 2c2ac3f..98b32c1 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -19,6 +19,7 @@ config ARC
select GENERIC_FIND_FIRST_BIT
# for now, we don't need GENERIC_IRQ_PROBE, CONFIG_GENERIC_IRQ_CHIP
select GENERIC_IRQ_SHOW
+   select GENERIC_PCI_IOMAP
select GENERIC_PENDING_IRQ if SMP
select GENERIC_SMP_IDLE_THREAD
select HAVE_ARCH_KGDB
@@ -39,6 +40,9 @@ config ARC
select PERF_USE_VMALLOC
select HAVE_DEBUG_STACKOVERFLOW
 
+config MIGHT_HAVE_PCI
+   bool
+
 config TRACE_IRQFLAGS_SUPPORT
def_bool y
 
@@ -570,6 +574,25 @@ endmenu # "ARC Architecture Configuration"
 source "mm/Kconfig"
 source "net/Kconfig"
 source "drivers/Kconfig"
+
+menu "Bus Support"
+
+config PCI
+   bool "PCI support" if MIGHT_HAVE_PCI
+   help
+ PCI is the name of a bus system, i.e. the way the CPU talks to the 
other stuff inside
+ your box.Find out if your board/platform have PCI.
+ Note: PCIE support for Synopsys Device will be available only when
+ HAPS DX is configured with PCIE RC bitmap. If you have PCI, say Y, 
otherwise N.
+
+config PCI_SYSCALL
+   def_bool PCI
+
+source "drivers/pci/Kconfig"
+source "drivers/pci/pcie/Kconfig"
+
+endmenu
+
 source "fs/Kconfig"
 source "arch/arc/Kconfig.debug"
 source "security/Kconfig"
diff --git a/arch/arc/include/asm/dma.h b/arch/arc/include/asm/dma.h
index ca7c451..37942fa 100644
--- a/arch/arc/include/asm/dma.h
+++ b/arch/arc/include/asm/dma.h
@@ -10,5 +10,10 @@
 #define ASM_ARC_DMA_H
 
 #define MAX_DMA_ADDRESS 0xC000
+#ifdef CONFIG_PCI
+extern int isa_dma_bridge_buggy;
+#else
+#define isa_dma_bridge_buggy(0)
+#endif
 
 #endif
diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
index 694ece8..2ec3cf4 100644
--- a/arch/arc/include/asm/io.h
+++ b/arch/arc/include/asm/io.h
@@ -16,7 +16,17 @@
 extern void __iomem *ioremap(unsigned long physaddr, unsigned long size);
 extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
  unsigned long flags);
+static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
+{
+   return (void __iomem *)port;
+}
+
+static inline void ioport_unmap(void __iomem *addr)
+{
+}
+
 extern void iounmap(const void __iomem *addr);
+extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);
 
 #define ioremap_nocache(phy, sz)   ioremap(phy, sz)
 #define ioremap_wc(phy, sz)ioremap(phy, sz)
diff --git a/arch/arc/include/asm/pci.h b/arch/arc/include/asm/pci.h
new file mode 100644
index 000..a0a0fa5
--- /dev/null
+++ b/arch/arc/include/asm/pci.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com)
+ *
+ * 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.
+ */
+
+#ifndef _ASM_ARC_PCI_H
+#define _ASM_ARC_PCI_H
+
+#ifdef __KERNEL__
+#include 
+#include 
+
+#include 
+
+extern unsigned long pcibios_min_io;
+#define PCIBIOS_MIN_IO pcibios_min_io
+extern unsigned long pcibios_min_mem;
+#define PCI

[PATCH v4 0/2] adding PCI support to AXS10x

2016-01-11 Thread Joao Pinto
This patch set has the goal to add suppport for DesignWare PCIe RC in ARC
AXS10x. It includes the necessary tweaks to the ARC architecture, necessary
tweaks to the PCI subsystem and a new driver (pcie-snpsdev).
This new driver will be used extensively in the PCIe RC Prototyping Kit.

The patches were produced against Bjorn Helgaas' repository. It was properly
tested in an IP Prototyping Kit.

Joao Pinto (2):
  PCI support added to ARC
  add new platform driver for PCI RC

 .../devicetree/bindings/pci/pcie-snpsdev.txt   |  33 +++
 MAINTAINERS|   7 +
 arch/arc/Kconfig   |  23 ++
 arch/arc/include/asm/dma.h |   5 +
 arch/arc/include/asm/io.h  |  10 +
 arch/arc/include/asm/pci.h |  43 
 arch/arc/kernel/Makefile   |   1 +
 arch/arc/kernel/pcibios.c  |  55 
 arch/arc/mm/ioremap.c  |  10 +-
 arch/arc/plat-axs10x/Kconfig   |   1 +
 drivers/pci/Makefile   |   1 +
 drivers/pci/host/Kconfig   |   8 +
 drivers/pci/host/Makefile  |   1 +
 drivers/pci/host/pcie-designware.c |  11 +
 drivers/pci/host/pcie-designware.h |   1 +
 drivers/pci/host/pcie-snpsdev.c| 286 +
 16 files changed, 495 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/pci/pcie-snpsdev.txt
 create mode 100644 arch/arc/include/asm/pci.h
 create mode 100644 arch/arc/kernel/pcibios.c
 create mode 100644 drivers/pci/host/pcie-snpsdev.c

-- 
1.8.1.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v4 1/2] PCI support added to ARC

2016-01-11 Thread Vineet Gupta
On Monday 11 January 2016 10:54 PM, Joao Pinto wrote:
> This patch adds PCI support to ARC and updates drivers/pci Makefile enabling
> the ARC arch to use the generic PCI setup functions.
> ...
>  
> diff --git a/arch/arc/include/asm/io.h b/arch/arc/include/asm/io.h
> index 694ece8..2ec3cf4 100644
> --- a/arch/arc/include/asm/io.h
> +++ b/arch/arc/include/asm/io.h
> @@ -16,7 +16,17 @@
>  extern void __iomem *ioremap(unsigned long physaddr, unsigned long size);
>  extern void __iomem *ioremap_prot(phys_addr_t offset, unsigned long size,
> unsigned long flags);
> +static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
> +{
> + return (void __iomem *)port;
> +}
> +
> +static inline void ioport_unmap(void __iomem *addr)
> +{
> +}
> +
>  extern void iounmap(const void __iomem *addr);
> +extern int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr);

Can u just define the one liner here ?

>  #define ioremap_nocache(phy, sz) ioremap(phy, sz)
>  #define ioremap_wc(phy, sz)  ioremap(phy, sz)
> diff --git a/arch/arc/include/asm/pci.h b/arch/arc/include/asm/pci.h
> new file mode 100644
> index 000..a0a0fa5
> --- /dev/null
> +++ b/arch/arc/include/asm/pci.h
> @@ -0,0 +1,43 @@
> +/*
> + * Copyright (C) 2015-2016 Synopsys, Inc. (www.synopsys.com)
> + *
> + * 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.
> + */
> +
> +#ifndef _ASM_ARC_PCI_H
> +#define _ASM_ARC_PCI_H
> +
> +#ifdef __KERNEL__
> +#include 
> +#include 
> +
> +#include 
> +
> +extern unsigned long pcibios_min_io;
> +#define PCIBIOS_MIN_IO pcibios_min_io
> +extern unsigned long pcibios_min_mem;
> +#define PCIBIOS_MIN_MEM pcibios_min_mem
> +
> +#define pcibios_assign_all_busses()  1
> +/*
> + * The PCI address space does equal the physical memory address space.
> + * The networking and block device layers use this boolean for bounce
> + * buffer decisions.
> + */
> +#define PCI_DMA_BUS_IS_PHYS (1)
> +
> +/*
> + * Setup early fixed I/O mapping.
> + */
> +#if defined(CONFIG_PCI)
> +extern void pci_map_io_early(unsigned long pfn);
> +#else
> +static inline void pci_map_io_early(unsigned long pfn) {}
> +#endif

I don't see this being used - leftover from ARM copy/paste ?

> +
> +#endif /* __KERNEL__ */
> +
> +#endif /* _ASM_ARC_PCI_H */
> +
> diff --git a/arch/arc/kernel/Makefile b/arch/arc/kernel/Makefile
> index e7f3625..1bc2036 100644
> --- a/arch/arc/kernel/Makefile
> +++ b/arch/arc/kernel/Makefile
> @@ -12,6 +12,7 @@ obj-y   := arcksyms.o setup.o irq.o time.o reset.o 
> ptrace.o process.o devtree.o
>  obj-y+= signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o 
> clk.o
>  obj-$(CONFIG_ISA_ARCOMPACT)  += entry-compact.o intc-compact.o
>  obj-$(CONFIG_ISA_ARCV2)  += entry-arcv2.o intc-arcv2.o
> +obj-$(CONFIG_PCI)+= pcibios.o
>  
>  obj-$(CONFIG_MODULES)+= arcksyms.o module.o
>  obj-$(CONFIG_SMP)+= smp.o
> diff --git a/arch/arc/kernel/pcibios.c b/arch/arc/kernel/pcibios.c
> new file mode 100644
> index 000..99ee329
> --- /dev/null
> +++ b/arch/arc/kernel/pcibios.c
> @@ -0,0 +1,55 @@
> +/*
> + * Copyright (C) 2014-2015 Synopsys, Inc. (www.synopsys.com)
> + *
> + * 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 

I doubt if you really need all these includes ?

> +
> +#include 
> +
> +unsigned long pcibios_min_io = 0x100;
> +EXPORT_SYMBOL(pcibios_min_io);
> +
> +unsigned long pcibios_min_mem = 0x10;
> +EXPORT_SYMBOL(pcibios_min_mem);

These numbers and their magic values again seem to be used in ARM code only.
Please get rid of them (here as well as in header above)

> +
> +/*
> + * We don't have to worry about legacy ISA devices, so nothing to do here
> + */
> +resource_size_t pcibios_align_resource(void *data, const struct resource 
> *res,
> + resource_size_t size, resource_size_t align)
> +{
> + return res->start;
> +}
> +
> +/*
> + * If the bus contains any of these devices, then we must not turn on
> + * parity checking of any kind.  Currently this is CyberPro 20x0 only.
> + */
> +static inline int pdev_bad_for_parity(struct pci_dev *dev)
> +{
> + return ((dev->vendor == PCI_VENDOR_ID_INTERG &&
> +  (dev->device == PCI_DEVICE_ID_INTERG_2000 ||
> +   dev->device == PCI_DEVICE_ID_INTERG_2010)) ||
> + (dev->vendor == PCI_VENDOR_ID_ITE &&
> +  dev->device == PCI_DEVICE_ID_ITE_8152));
> +
> +}

static inline in a "C" file with no caller - please remove !

Re: [PATCH v4 1/2] PCI support added to ARC

2016-01-11 Thread Vineet Gupta
On Monday 11 January 2016 10:54 PM, Joao Pinto wrote:
> This patch adds PCI support to ARC and updates drivers/pci Makefile enabling
> the ARC arch to use the generic PCI setup functions.
> 
> Signed-off-by: Joao Pinto 

BTW this patch has whitespace errors still - can you make sure they are not in 
the
next version(s)

-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v4 05/19] irqchip: add nps Internal and external irqchips

2016-01-11 Thread Vineet Gupta
Hi Marc,

On Wednesday 30 December 2015 05:05 PM, Vineet Gupta wrote:
> On Friday 18 December 2015 10:01 PM, Marc Zyngier wrote:
>> On 18/12/15 14:29, Noam Camus wrote:
 From: Marc Zyngier [mailto:marc.zyng...@arm.com] 
 Sent: Friday, December 18, 2015 1:21 PM
>>>
> I need this for my per CPU irqs such timer and IPI which do not come 
> from some external device but from CPUs. For these IRQs I am calling 
> to irq_create_mapping() from my platform at arch/arc and at that point 
> I got no irqdomain and using irq_find_host() is not good since I got 
> no device_node (at most I can have DT root).
>>>
 That's a problem. You should never do that for your timer (doing a 
 request_irq will do the right thing, and that's what your timer driver 
 already does).
>>>
>>> Please be more specific, from all that I wrote what is the problem?
>>
>> Calling irq_create_mapping out of the blue like you do it here:
>>
>> +static void eznps_init_per_cpu(int cpu)
>> +{
>> +/* Create mapping for all per cpu IRQs */
>> +if (cpu == 0) {
>> +irq_create_mapping(NULL, TIMER0_IRQ);
>> +irq_create_mapping(NULL, IPI_IRQ);
>> +}
>>
>> is simply not acceptable.
>>
>>> When I use request_irq() it fail without the mapping and mapping fail 
>>> without a domain.
>>
>> Grmbl...
>>
>> That's not completely surprising:
>>
>> +timer {
>> +compatible = "ezchip,nps400-timer";
>> +clocks = <&sysclk>;
>> +clock-names="sysclk";
>> +};
>>
>> Where is the interrupt?
>>
>>> Never do what?
>>> What should I do then?
>>
>> Maybe you should start by looking how the other architectures have
>> solved that exact problem at least half a dozen time.
>>
>>>
 As for initializing your IPIs, they are usually outside of the IRQ
 space, so you should handle them separately (and get your irqchip
 to initialize them).
>>> I am handling all my IRQs within same irqchip, which is the only one 
>>> I have. So I am not sure what you expect here. Please be more 
>>> elaborate.
>>
>> Do not create a mapping for IPIs. Full stop. Handle them independently
>> from your normal IRQs.
>>
>
> Another thing I'm not seeing here is where is the interrupt actually 
> taken. This code only contains the EOI part, but not the ACK side, as 
> well as the reverse lookup hwirq -> irq). Where is that code?
>
> ACK is an optional handler and is not needed by my platform.
> I will add comment that since my IRQs are EOI based I do not need an ACK.
>>>
 What I'm talking about is not the irq_ack method that the irqchip can 
 provide, but the action your perform on your interrupt controller to 
 extract the hwirq number and find out what corresponding Linux interrupt 
 has fired.
>>>
>
> I do not understand reverse lookup remark, where is it missing?
> Could you point me to an example for such reverse lookup? 
>>>
 See for example:
>>>
 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/irqchip/irq-sun4i.c#n136
>>>
 This is the function (sun4i_handle_irq) that is executed almost 
 immediately after the IRQ is asserted. The CPU reads the hwirq from the 
 interrupt controller, and use handle_domain_irq() to call the 
 corresponding handler (by doing a lookup in the domain).
>>>
 I couldn't find out in your platform code where you are doing that.
>>>
>>> OK, this is seem much like exclusively ARM stuff.
>>
>> No, this is not. Can you please stop looking at the surface of things
>> and start taking an interest in how things actually *work*? Almost
>> *nothing* in the interrupt handling code is architecture specific.
>>
>>> Note that I am working with ARC (seem alike) here and we do not
>>> define CONFIG_HANDLE_DOMAIN_IRQ and do not implement
>>> set_handle_irq().
>>>
>>> So for ARC this reverse mapping is something we can leave without
>>> (maybe because we are kind of a legacy domain).
>>
>> Yeah, I just located the crap: arch_do_IRQ() happily takes a hwirq (the
>> vector number), and uses that as a Linux IRQ. This looks a lot like ARM
>> pre-DT, about 10 years ago.
>>
>> Well, time to meet the 21st century. If you intend to use DT, please fix
>> your arch port. Otherwise, just hardcode everything in your platform and
>> don't pretend to support device tree.
> 
> Hi Marc,
> 
> Taking your rant in a positive stride and I'm all up for making this as
> nice/modern as possible. I don't have issues with enabling
> CONFIG_HANDLE_DOMAIN_IRQ for ARC (although it might add a few cycles o/h to 
> each ISR)
> 
> However currently (4.4-rcX) it is only enabled for arm/arm64/openrisc and 
> from the
> looks of it in drivers/irqchip, only ARM based SoCs use the 
> handle_domain_irq()
> calls by plugging into ARM top level handler.
> 
> Why is that not a problem for other arches like PPC/MIPS which also use DT
> heavily. Or perhaps they ar