RE: [PATCH] Add initial SX3000b platform code to MIPS arch

2017-03-23 Thread Amit Kama IL
Will be sending a revised version splitting the irqchip related code to a 
different patch and using a generic platform code...

-Original Message-
From: Amit Kama IL 
Sent: Wednesday, March 22, 2017 7:38 AM
To: 'r...@linux-mips.org' 
Cc: 'devicet...@vger.kernel.org' ; 
'linux-kernel@vger.kernel.org' ; 
'linux-m...@linux-mips.org' ; 't...@linutronix.de' 
; 'ja...@lakedaemon.net' ; 
'marc.zyng...@arm.com' ; 'linux-...@vger.kernel.org' 
; 'cor...@lwn.net' 
Subject: [PATCH] Add initial SX3000b platform code to MIPS arch

Add initial support for boards based on Satixfy's SX3000b (Catniss) SoC.
The SoC includes a MIPS interAptiv dual core 4 VPE processor and boots 
using device-tree.

Signed-off-by: Amit Kama 

The irqchip file (irq-sx3000b.c) is pertinent to the platform. 
IRQCHIP maintainers - is it possible to merge this through MIPS tree? 
 


diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
old mode 100666
new mode 100666
index a008a9f..1bcb300
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -551,6 +551,31 @@ config MACH_PIC32
  Microchip PIC32 is a family of general-purpose 32 bit MIPS core
  microcontrollers.

+config MACH_SX3000
+   bool "Satixfy SX3000 based boards"
+   select SYS_SUPPORTS_32BIT_KERNEL
+   select SYS_SUPPORTS_LITTLE_ENDIAN
+   select SYS_SUPPORTS_MIPS_CPS
+   select SYS_SUPPORTS_MULTITHREADING
+   select SYS_HAS_CPU_MIPS32_R2
+   select SYS_HAS_CPU_MIPS32_R3_5
+   select SYS_HAS_EARLY_PRINTK
+   select USE_GENERIC_EARLY_PRINTK_8250
+   select DMA_MAYBE_COHERENT
+   select ARCH_WANT_OPTIONAL_GPIOLIB
+   select LIBFDT
+   select USE_OF
+   select BUILTIN_DTB
+   select IRQ_MIPS_CPU
+   select MIPS_GIC
+   select SX3000_ICU
+   select MIPS_CPU_SCACHE
+   select CLKSRC_MIPS_GIC
+   select COMMON_CLK
+   select BOOT_RAW
+   help
+ This enables support for the Satixfy SX3000 SoC.
+
 config NEC_MARKEINS
bool "NEC EMMA2RH Mark-eins board"
select SOC_EMMA2RH
@@ -1022,6 +1047,7 @@ source "arch/mips/pmcs-msp71xx/Kconfig"
 source "arch/mips/ralink/Kconfig"
 source "arch/mips/sgi-ip27/Kconfig"
 source "arch/mips/sibyte/Kconfig"
+source "arch/mips/sx3000/Kconfig"
 source "arch/mips/txx9/Kconfig"
 source "arch/mips/vr41xx/Kconfig"
 source "arch/mips/cavium-octeon/Kconfig"
diff --git a/arch/mips/boot/dts/sx3000/Makefile 
b/arch/mips/boot/dts/sx3000/Makefile
new file mode 100666
index 000..8b73c39
--- /dev/null
+++ b/arch/mips/boot/dts/sx3000/Makefile
@@ -0,0 +1,13 @@
+dtb-$(CONFIG_SX3000_DEVBOARD)  += sx3000_devboard.dtb
+dtb-$(CONFIG_SX3000_BBB)   += sx3000_bbb.dtb
+dtb-$(SX3000_IDU3) += sx3000_idu3.dtb
+dtb-$(SX3000_IDU4) += sx3000_idu4.dtb
+
+
+obj-y  += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
+
+# Force kbuild to make empty built-in.o if necessary
+obj-   += dummy.o
+
+always := $(dtb-y)
+clean-files:= *.dtb *.dtb.S
diff --git a/arch/mips/boot/dts/sx3000/sx3000.dtsi 
b/arch/mips/boot/dts/sx3000/sx3000.dtsi
new file mode 100666
index 000..8557282
--- /dev/null
+++ b/arch/mips/boot/dts/sx3000/sx3000.dtsi
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2016 Satixfy Technologies
+ * Author: Amit Kama 
+ *
+ * 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 
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "satixfy,sx3000";
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "mti,interaptiv";
+   clocks  = <>;
+   reg = <0>;
+   };
+   };
+
+   gic: interrupt-controller@1d90 {
+   compatible = "mti,gic";
+   //reg = <0x1D90 0x2>;
+   memory-region = <_memory_mapped_area>;
+
+   interrupt-controller;
+   #interrupt-cells = <3>;
+   timer {
+   compatible = "mti,gic-timer";
+   interrupts = ;
+   clocks = <>;
+   };
+   };
+
+   icu: interrupt-controller@1d4d {
+   compatible = "sx,icu";
+   reg = <0x1D4D 0x1C0>;
+
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   interrupt-parent = <>;
+   interrupts = ;
+   };
+
+   uart0: uart@1D4D09C0 {
+   

RE: [PATCH] Add initial SX3000b platform code to MIPS arch

2017-03-23 Thread Amit Kama IL
Will be sending a revised version splitting the irqchip related code to a 
different patch and using a generic platform code...

-Original Message-
From: Amit Kama IL 
Sent: Wednesday, March 22, 2017 7:38 AM
To: 'r...@linux-mips.org' 
Cc: 'devicet...@vger.kernel.org' ; 
'linux-kernel@vger.kernel.org' ; 
'linux-m...@linux-mips.org' ; 't...@linutronix.de' 
; 'ja...@lakedaemon.net' ; 
'marc.zyng...@arm.com' ; 'linux-...@vger.kernel.org' 
; 'cor...@lwn.net' 
Subject: [PATCH] Add initial SX3000b platform code to MIPS arch

Add initial support for boards based on Satixfy's SX3000b (Catniss) SoC.
The SoC includes a MIPS interAptiv dual core 4 VPE processor and boots 
using device-tree.

Signed-off-by: Amit Kama 

The irqchip file (irq-sx3000b.c) is pertinent to the platform. 
IRQCHIP maintainers - is it possible to merge this through MIPS tree? 
 


diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
old mode 100666
new mode 100666
index a008a9f..1bcb300
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -551,6 +551,31 @@ config MACH_PIC32
  Microchip PIC32 is a family of general-purpose 32 bit MIPS core
  microcontrollers.

+config MACH_SX3000
+   bool "Satixfy SX3000 based boards"
+   select SYS_SUPPORTS_32BIT_KERNEL
+   select SYS_SUPPORTS_LITTLE_ENDIAN
+   select SYS_SUPPORTS_MIPS_CPS
+   select SYS_SUPPORTS_MULTITHREADING
+   select SYS_HAS_CPU_MIPS32_R2
+   select SYS_HAS_CPU_MIPS32_R3_5
+   select SYS_HAS_EARLY_PRINTK
+   select USE_GENERIC_EARLY_PRINTK_8250
+   select DMA_MAYBE_COHERENT
+   select ARCH_WANT_OPTIONAL_GPIOLIB
+   select LIBFDT
+   select USE_OF
+   select BUILTIN_DTB
+   select IRQ_MIPS_CPU
+   select MIPS_GIC
+   select SX3000_ICU
+   select MIPS_CPU_SCACHE
+   select CLKSRC_MIPS_GIC
+   select COMMON_CLK
+   select BOOT_RAW
+   help
+ This enables support for the Satixfy SX3000 SoC.
+
 config NEC_MARKEINS
bool "NEC EMMA2RH Mark-eins board"
select SOC_EMMA2RH
@@ -1022,6 +1047,7 @@ source "arch/mips/pmcs-msp71xx/Kconfig"
 source "arch/mips/ralink/Kconfig"
 source "arch/mips/sgi-ip27/Kconfig"
 source "arch/mips/sibyte/Kconfig"
+source "arch/mips/sx3000/Kconfig"
 source "arch/mips/txx9/Kconfig"
 source "arch/mips/vr41xx/Kconfig"
 source "arch/mips/cavium-octeon/Kconfig"
diff --git a/arch/mips/boot/dts/sx3000/Makefile 
b/arch/mips/boot/dts/sx3000/Makefile
new file mode 100666
index 000..8b73c39
--- /dev/null
+++ b/arch/mips/boot/dts/sx3000/Makefile
@@ -0,0 +1,13 @@
+dtb-$(CONFIG_SX3000_DEVBOARD)  += sx3000_devboard.dtb
+dtb-$(CONFIG_SX3000_BBB)   += sx3000_bbb.dtb
+dtb-$(SX3000_IDU3) += sx3000_idu3.dtb
+dtb-$(SX3000_IDU4) += sx3000_idu4.dtb
+
+
+obj-y  += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
+
+# Force kbuild to make empty built-in.o if necessary
+obj-   += dummy.o
+
+always := $(dtb-y)
+clean-files:= *.dtb *.dtb.S
diff --git a/arch/mips/boot/dts/sx3000/sx3000.dtsi 
b/arch/mips/boot/dts/sx3000/sx3000.dtsi
new file mode 100666
index 000..8557282
--- /dev/null
+++ b/arch/mips/boot/dts/sx3000/sx3000.dtsi
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2016 Satixfy Technologies
+ * Author: Amit Kama 
+ *
+ * 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 
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "satixfy,sx3000";
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   cpu@0 {
+   device_type = "cpu";
+   compatible = "mti,interaptiv";
+   clocks  = <>;
+   reg = <0>;
+   };
+   };
+
+   gic: interrupt-controller@1d90 {
+   compatible = "mti,gic";
+   //reg = <0x1D90 0x2>;
+   memory-region = <_memory_mapped_area>;
+
+   interrupt-controller;
+   #interrupt-cells = <3>;
+   timer {
+   compatible = "mti,gic-timer";
+   interrupts = ;
+   clocks = <>;
+   };
+   };
+
+   icu: interrupt-controller@1d4d {
+   compatible = "sx,icu";
+   reg = <0x1D4D 0x1C0>;
+
+   interrupt-controller;
+   #interrupt-cells = <1>;
+
+   interrupt-parent = <>;
+   interrupts = ;
+   };
+
+   uart0: uart@1D4D09C0 {
+   compatible = "ns16550a";
+   reg = <0x1D4D09C0 0x100>;
+
+   interrupt-parent = <>;
+   interrupts = <3>;
+
+   clock-frequency = <27000>;
+
+   reg-shift = <2>;
+   reg-io-width = 

Re: [PATCH] Add initial SX3000b platform code to MIPS arch

2017-03-22 Thread Ralf Baechle
On Wed, Mar 22, 2017 at 05:38:09AM +, Amit Kama IL wrote:

> Add initial support for boards based on Satixfy's SX3000b (Catniss) SoC.
> The SoC includes a MIPS interAptiv dual core 4 VPE processor and boots 
> using device-tree.
> 
> Signed-off-by: Amit Kama 
> 
> The irqchip file (irq-sx3000b.c) is pertinent to the platform. 
> IRQCHIP maintainers - is it possible to merge this through MIPS tree? 


First thig, run your patch through scripts/checkpatch.pl and fix the
resulting pile of errors and warnings.

sx3000_machine_halt() will consume plenty of power if implemented as a
empty loop:

+static void sx3000_machine_halt(void)
+{
+   while (true);
+}

Something like:

static void sx3000_machine_halt(void)
{
local_irq_disable();
while (1) {
if (cpu_wait)
cpu_wait();
}
}

will make the function much "greener".

  Ralf


Re: [PATCH] Add initial SX3000b platform code to MIPS arch

2017-03-22 Thread Ralf Baechle
On Wed, Mar 22, 2017 at 05:38:09AM +, Amit Kama IL wrote:

> Add initial support for boards based on Satixfy's SX3000b (Catniss) SoC.
> The SoC includes a MIPS interAptiv dual core 4 VPE processor and boots 
> using device-tree.
> 
> Signed-off-by: Amit Kama 
> 
> The irqchip file (irq-sx3000b.c) is pertinent to the platform. 
> IRQCHIP maintainers - is it possible to merge this through MIPS tree? 


First thig, run your patch through scripts/checkpatch.pl and fix the
resulting pile of errors and warnings.

sx3000_machine_halt() will consume plenty of power if implemented as a
empty loop:

+static void sx3000_machine_halt(void)
+{
+   while (true);
+}

Something like:

static void sx3000_machine_halt(void)
{
local_irq_disable();
while (1) {
if (cpu_wait)
cpu_wait();
}
}

will make the function much "greener".

  Ralf


Re: [PATCH] Add initial SX3000b platform code to MIPS arch

2017-03-22 Thread Marc Zyngier
Hi Amit,

On 22/03/17 05:38, Amit Kama IL wrote:
> Add initial support for boards based on Satixfy's SX3000b (Catniss) SoC.
> The SoC includes a MIPS interAptiv dual core 4 VPE processor and boots 
> using device-tree.
> 
> Signed-off-by: Amit Kama 
> 
> The irqchip file (irq-sx3000b.c) is pertinent to the platform. 
> IRQCHIP maintainers - is it possible to merge this through MIPS tree? 

Can you please send something that is the result of "git format-patch"?
You should have a diff-stat before the patch itself...

Also, this file (irq-sx3000b.c) doesn't seem to be in this huge patch,
which doesn't seem to concern the irqchip subsystem (it all looks
platform code to me). Wrong patch?

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...


Re: [PATCH] Add initial SX3000b platform code to MIPS arch

2017-03-22 Thread Marc Zyngier
Hi Amit,

On 22/03/17 05:38, Amit Kama IL wrote:
> Add initial support for boards based on Satixfy's SX3000b (Catniss) SoC.
> The SoC includes a MIPS interAptiv dual core 4 VPE processor and boots 
> using device-tree.
> 
> Signed-off-by: Amit Kama 
> 
> The irqchip file (irq-sx3000b.c) is pertinent to the platform. 
> IRQCHIP maintainers - is it possible to merge this through MIPS tree? 

Can you please send something that is the result of "git format-patch"?
You should have a diff-stat before the patch itself...

Also, this file (irq-sx3000b.c) doesn't seem to be in this huge patch,
which doesn't seem to concern the irqchip subsystem (it all looks
platform code to me). Wrong patch?

Thanks,

M.
-- 
Jazz is not dead. It just smells funny...