[PATCH v1] configs: amr64: k3-j721e-evm-linux: Fix GPIO failures

2019-12-24 Thread 'Nikhil Devshatwar' via Jailhouse
For K3-J721e devices, gpio virtualization is achieved by
replicating copies of GPIO controller.

Each cell gets a dedicated GPIO controller. However, there is
additional field in the pinctrl to select the GPIO group.

Add the mem_regions for main_gpio2 and main_gpio3
Program gpio_group in the pinctrl node for SW10 gpio_keys

Signed-off-by: Nikhil Devshatwar 
---
 configs/arm64/dts/inmate-k3-j721e-evm.dts |  3 ++-
 configs/arm64/k3-j721e-evm-linux-demo.c   | 16 +++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/configs/arm64/dts/inmate-k3-j721e-evm.dts 
b/configs/arm64/dts/inmate-k3-j721e-evm.dts
index 51470a57..7edecda1 100644
--- a/configs/arm64/dts/inmate-k3-j721e-evm.dts
+++ b/configs/arm64/dts/inmate-k3-j721e-evm.dts
@@ -403,7 +403,8 @@
 _pmx0 {
sw10_button_pins_default: sw10_button_pins_default {
pinctrl-single,pins = <
-   J721E_IOPAD(0x0, PIN_INPUT, 7) /* (AC18) 
EXTINTn.GPIO0_0 */
+   /* PADCONFIG[5:4] = GPIO group select = 1 */
+   J721E_IOPAD(0x0, PIN_INPUT, 23) /* (AC18) 
EXTINTn.GPIO2_0 */
>;
};
 
diff --git a/configs/arm64/k3-j721e-evm-linux-demo.c 
b/configs/arm64/k3-j721e-evm-linux-demo.c
index 12351ab3..55938b85 100644
--- a/configs/arm64/k3-j721e-evm-linux-demo.c
+++ b/configs/arm64/k3-j721e-evm-linux-demo.c
@@ -24,7 +24,7 @@
 struct {
struct jailhouse_cell_desc cell;
__u64 cpus[1];
-   struct jailhouse_memory mem_regions[20];
+   struct jailhouse_memory mem_regions[22];
struct jailhouse_irqchip irqchips[4];
struct jailhouse_pci_device pci_devices[1];
 } __attribute__((packed)) config = {
@@ -89,6 +89,20 @@ struct {
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
JAILHOUSE_MEM_IO | JAILHOUSE_MEM_ROOTSHARED,
},
+   /* main_gpio2 */ {
+   .phys_start = 0x0061,
+   .virt_start = 0x0061,
+   .size = 0x1000,
+   .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+   JAILHOUSE_MEM_IO,
+   },
+   /* main_gpio3 */ {
+   .phys_start = 0x00611000,
+   .virt_start = 0x00611000,
+   .size = 0x1000,
+   .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
+   JAILHOUSE_MEM_IO,
+   },
/* main sproxy target_data host_id=A72_3 */ {
.phys_start = 0x3240f000,
.virt_start = 0x3240f000,
-- 
2.17.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20191224121333.10214-1-nikhil.nd%40ti.com.


Re: [PATCH v4 4/4] configs: arm64: Add Linux demo for j721-evm board

2019-12-24 Thread Jan Kiszka

On 24.12.19 11:04, 'Lokesh Vutla' via Jailhouse wrote:



On 24/12/19 3:18 PM, Nikhil Devshatwar wrote:



On 24/12/19 9:42 am, Lokesh Vutla wrote:

On 23/12/19 8:43 PM, Nikhil Devshatwar wrote:

Add the linux demo cell config for j721e-evm board.
Also add the required device tree for booting Linux kernel
in the inmate cell.

This cell config acts as a reference for partitioning
devices across the 2 Linux cells.
This will be updated as support for more devices get added.

Signed-off-by: Lokesh Vutla 
Signed-off-by: Nikhil Devshatwar 
---

Notes:
 Changes from v3:
 * Add gpio, emmc and USB device in the DTS with upstream bindings
 * Describe the irqmap for easy understanding and verification
 * Update power-domains properties

 Changes from v2:
 * Only add the DT entries for devices with stable bindings
 * Organize the DTS to match the bus topology with upstream kernel

 Changes from v1:
 * Split up the peripheral mem_region to match with kernel dts
 * Add GPU, multimedia decoder and display devices

  configs/arm64/dts/inmate-k3-j721e-evm.dts | 433 ++
  configs/arm64/k3-j721e-evm-linux-demo.c   | 262 +
  2 files changed, 695 insertions(+)
  create mode 100644 configs/arm64/dts/inmate-k3-j721e-evm.dts
  create mode 100644 configs/arm64/k3-j721e-evm-linux-demo.c

diff --git a/configs/arm64/dts/inmate-k3-j721e-evm.dts 
b/configs/arm64/dts/inmate-k3-j721e-evm.dts
new file mode 100644
index ..51470a57
--- /dev/null
+++ b/configs/arm64/dts/inmate-k3-j721e-evm.dts
@@ -0,0 +1,433 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for J721E Jailhouse inmate kernel
+ *
+ * Copyright (C) 2016-2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+/dts-v1/;
+ surprised how they can
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Texas Instruments J721E Inmate Model";
+   compatible = "ti,j721e-evm", "ti,j721e";
+   interrupt-parent = <>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   aliases {
+   serial3 = _uart1;
+   };
+
+   chosen {
+   stdout-path = "serial3:115200n8";
+   };
+
+   hypervisor {
+   compatible = "jailhouse,cell";
+   };
+

[..snip..]


+
+   cbass_main_navss: interconnect0 {
+   compatible = "simple-bus";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   main_navss_intr: interrupt-controller1 {
+   compatible = "ti,sci-intr";
+   ti,intr-trigger-type = <4>;
+   interrupt-controller;
+   interrupt-parent = <>;
+   #interrupt-cells = <2>;
+   ti,sci = <>;
+   ti,sci-dst-id = <14>;
+   ti,sci-rm-range-girq = <4>;
+   };
+
+   main_udmass_inta: interrupt-controller@33d0 {
+   compatible = "ti,sci-inta";
+   reg = <0x0 0x33d0 0x0 0x10>;
+   interrupt-controller;
+   interrupt-parent = <_navss_intr>;
+   msi-controller;
+   ti,sci = <>;
+   ti,sci-dev-id = <209>;
+   ti,sci-rm-range-vint = <0xa>;
+   ti,sci-rm-range-global-event = <0xd>;
+   };

You should drop this node. The address is not mapped in
k3-j721e-evm-linux-demo.c and there are no users in this DT. You should be very
careful when virtualizing inta and udmass.

I am waiting for mcasp bindings to be supported in mainline kernel.
Once it is done, we will start using UDMA, inta, intr from linux-demo cell


+   };
+
+   secure_proxy_main: mailbox@32c0 {
+   compatible = "ti,am654-secure-proxy";
+   #mbox-cells = <1>;
+   reg-names = "target_data", "rt", "scfg";
+   reg = <0x00 0x32c0 0x00 0x10>,
+ <0x00 0x3240 0x00 0x10>,
+ <0x00 0x3280 0x00 0x10>;
+   interrupt-names = "rx_016";
+   interrupts = ;
+   };
+

[..snip..]


+
+/ {
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   autorepeat;
+   pinctrl-names = "default";
+   pinctrl-0 = <_button_pins_default>;
+
+   sw10 {
+   label = "GPIO Key USER1";
+   linux,code = ;
+   gpios = <_gpio2 0 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+_pmx0 {
+   sw10_button_pins_default: sw10_button_pins_default {
+   pinctrl-single,pins = <
+   J721E_IOPAD(0x0, PIN_INPUT, 7) /* (AC18) 
EXTINTn.GPIO0_0 */

hmm..is this working? IIRC GPIO group should be selected along with mux mode,
else it will be routed 

Re: [PATCH v4 4/4] configs: arm64: Add Linux demo for j721-evm board

2019-12-24 Thread 'Lokesh Vutla' via Jailhouse



On 24/12/19 3:18 PM, Nikhil Devshatwar wrote:
> 
> 
> On 24/12/19 9:42 am, Lokesh Vutla wrote:
>> On 23/12/19 8:43 PM, Nikhil Devshatwar wrote:
>>> Add the linux demo cell config for j721e-evm board.
>>> Also add the required device tree for booting Linux kernel
>>> in the inmate cell.
>>>
>>> This cell config acts as a reference for partitioning
>>> devices across the 2 Linux cells.
>>> This will be updated as support for more devices get added.
>>>
>>> Signed-off-by: Lokesh Vutla 
>>> Signed-off-by: Nikhil Devshatwar 
>>> ---
>>>
>>> Notes:
>>> Changes from v3:
>>> * Add gpio, emmc and USB device in the DTS with upstream bindings
>>> * Describe the irqmap for easy understanding and verification
>>> * Update power-domains properties
>>> 
>>> Changes from v2:
>>> * Only add the DT entries for devices with stable bindings
>>> * Organize the DTS to match the bus topology with upstream kernel
>>> 
>>> Changes from v1:
>>> * Split up the peripheral mem_region to match with kernel dts
>>> * Add GPU, multimedia decoder and display devices
>>>
>>>  configs/arm64/dts/inmate-k3-j721e-evm.dts | 433 ++
>>>  configs/arm64/k3-j721e-evm-linux-demo.c   | 262 +
>>>  2 files changed, 695 insertions(+)
>>>  create mode 100644 configs/arm64/dts/inmate-k3-j721e-evm.dts
>>>  create mode 100644 configs/arm64/k3-j721e-evm-linux-demo.c
>>>
>>> diff --git a/configs/arm64/dts/inmate-k3-j721e-evm.dts 
>>> b/configs/arm64/dts/inmate-k3-j721e-evm.dts
>>> new file mode 100644
>>> index ..51470a57
>>> --- /dev/null
>>> +++ b/configs/arm64/dts/inmate-k3-j721e-evm.dts
>>> @@ -0,0 +1,433 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +/*
>>> + * Device Tree Source for J721E Jailhouse inmate kernel
>>> + *
>>> + * Copyright (C) 2016-2019 Texas Instruments Incorporated - 
>>> http://www.ti.com/
>>> + */
>>> +
>>> +/dts-v1/;
>>> + surprised how they can 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +/ {
>>> +   model = "Texas Instruments J721E Inmate Model";
>>> +   compatible = "ti,j721e-evm", "ti,j721e";
>>> +   interrupt-parent = <>;
>>> +   #address-cells = <2>;
>>> +   #size-cells = <2>;
>>> +
>>> +   aliases {
>>> +   serial3 = _uart1;
>>> +   };
>>> +
>>> +   chosen {
>>> +   stdout-path = "serial3:115200n8";
>>> +   };
>>> +
>>> +   hypervisor {
>>> +   compatible = "jailhouse,cell";
>>> +   };
>>> +
>> [..snip..]
>>
>>> +
>>> +   cbass_main_navss: interconnect0 {
>>> +   compatible = "simple-bus";
>>> +   #address-cells = <2>;
>>> +   #size-cells = <2>;
>>> +   ranges;
>>> +
>>> +   main_navss_intr: interrupt-controller1 {
>>> +   compatible = "ti,sci-intr";
>>> +   ti,intr-trigger-type = <4>;
>>> +   interrupt-controller;
>>> +   interrupt-parent = <>;
>>> +   #interrupt-cells = <2>;
>>> +   ti,sci = <>;
>>> +   ti,sci-dst-id = <14>;
>>> +   ti,sci-rm-range-girq = <4>;
>>> +   };
>>> +
>>> +   main_udmass_inta: interrupt-controller@33d0 {
>>> +   compatible = "ti,sci-inta";
>>> +   reg = <0x0 0x33d0 0x0 0x10>;
>>> +   interrupt-controller;
>>> +   interrupt-parent = <_navss_intr>;
>>> +   msi-controller;
>>> +   ti,sci = <>;
>>> +   ti,sci-dev-id = <209>;
>>> +   ti,sci-rm-range-vint = <0xa>;
>>> +   ti,sci-rm-range-global-event = <0xd>;
>>> +   };
>> You should drop this node. The address is not mapped in
>> k3-j721e-evm-linux-demo.c and there are no users in this DT. You should be 
>> very
>> careful when virtualizing inta and udmass.
> I am waiting for mcasp bindings to be supported in mainline kernel.
> Once it is done, we will start using UDMA, inta, intr from linux-demo cell
> 
>>> +   };
>>> +
>>> +   secure_proxy_main: mailbox@32c0 {
>>> +   compatible = "ti,am654-secure-proxy";
>>> +   #mbox-cells = <1>;
>>> +   reg-names = "target_data", "rt", "scfg";
>>> +   reg = <0x00 0x32c0 0x00 0x10>,
>>> + <0x00 0x3240 0x00 0x10>,
>>> + <0x00 0x3280 0x00 0x10>;
>>> +   interrupt-names = "rx_016";
>>> +   interrupts = ;
>>> +   };
>>> +
>> [..snip..]
>>
>>> +
>>> +/ {
>>> +
>>> +   gpio-keys {
>>> +   compatible = "gpio-keys";
>>> +   autorepeat;
>>> +   pinctrl-names = "default";
>>> +   pinctrl-0 = <_button_pins_default>;
>>> +
>>> +   sw10 {
>>> +   label = "GPIO Key USER1";
>>> +   linux,code = ;
>>> +   gpios = <_gpio2 0 GPIO_ACTIVE_LOW>;
>>> +   };
>>> +   };
>>> +};
>>> +
>>> +_pmx0 {
>>> +   sw10_button_pins_default: 

Re: [PATCH v4 4/4] configs: arm64: Add Linux demo for j721-evm board

2019-12-24 Thread 'Nikhil Devshatwar' via Jailhouse



On 24/12/19 9:42 am, Lokesh Vutla wrote:


On 23/12/19 8:43 PM, Nikhil Devshatwar wrote:

Add the linux demo cell config for j721e-evm board.
Also add the required device tree for booting Linux kernel
in the inmate cell.

This cell config acts as a reference for partitioning
devices across the 2 Linux cells.
This will be updated as support for more devices get added.

Signed-off-by: Lokesh Vutla 
Signed-off-by: Nikhil Devshatwar 
---

Notes:
 Changes from v3:
 * Add gpio, emmc and USB device in the DTS with upstream bindings
 * Describe the irqmap for easy understanding and verification
 * Update power-domains properties
 
 Changes from v2:

 * Only add the DT entries for devices with stable bindings
 * Organize the DTS to match the bus topology with upstream kernel
 
 Changes from v1:

 * Split up the peripheral mem_region to match with kernel dts
 * Add GPU, multimedia decoder and display devices

  configs/arm64/dts/inmate-k3-j721e-evm.dts | 433 ++
  configs/arm64/k3-j721e-evm-linux-demo.c   | 262 +
  2 files changed, 695 insertions(+)
  create mode 100644 configs/arm64/dts/inmate-k3-j721e-evm.dts
  create mode 100644 configs/arm64/k3-j721e-evm-linux-demo.c

diff --git a/configs/arm64/dts/inmate-k3-j721e-evm.dts 
b/configs/arm64/dts/inmate-k3-j721e-evm.dts
new file mode 100644
index ..51470a57
--- /dev/null
+++ b/configs/arm64/dts/inmate-k3-j721e-evm.dts
@@ -0,0 +1,433 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for J721E Jailhouse inmate kernel
+ *
+ * Copyright (C) 2016-2019 Texas Instruments Incorporated - http://www.ti.com/
+ */
+
+/dts-v1/;
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/ {
+   model = "Texas Instruments J721E Inmate Model";
+   compatible = "ti,j721e-evm", "ti,j721e";
+   interrupt-parent = <>;
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   aliases {
+   serial3 = _uart1;
+   };
+
+   chosen {
+   stdout-path = "serial3:115200n8";
+   };
+
+   hypervisor {
+   compatible = "jailhouse,cell";
+   };
+

[..snip..]


+
+   cbass_main_navss: interconnect0 {
+   compatible = "simple-bus";
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+
+   main_navss_intr: interrupt-controller1 {
+   compatible = "ti,sci-intr";
+   ti,intr-trigger-type = <4>;
+   interrupt-controller;
+   interrupt-parent = <>;
+   #interrupt-cells = <2>;
+   ti,sci = <>;
+   ti,sci-dst-id = <14>;
+   ti,sci-rm-range-girq = <4>;
+   };
+
+   main_udmass_inta: interrupt-controller@33d0 {
+   compatible = "ti,sci-inta";
+   reg = <0x0 0x33d0 0x0 0x10>;
+   interrupt-controller;
+   interrupt-parent = <_navss_intr>;
+   msi-controller;
+   ti,sci = <>;
+   ti,sci-dev-id = <209>;
+   ti,sci-rm-range-vint = <0xa>;
+   ti,sci-rm-range-global-event = <0xd>;
+   };

You should drop this node. The address is not mapped in
k3-j721e-evm-linux-demo.c and there are no users in this DT. You should be very
careful when virtualizing inta and udmass.

I am waiting for mcasp bindings to be supported in mainline kernel.
Once it is done, we will start using UDMA, inta, intr from linux-demo cell




+   };
+
+   secure_proxy_main: mailbox@32c0 {
+   compatible = "ti,am654-secure-proxy";
+   #mbox-cells = <1>;
+   reg-names = "target_data", "rt", "scfg";
+   reg = <0x00 0x32c0 0x00 0x10>,
+ <0x00 0x3240 0x00 0x10>,
+ <0x00 0x3280 0x00 0x10>;
+   interrupt-names = "rx_016";
+   interrupts = ;
+   };
+

[..snip..]


+
+/ {
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   autorepeat;
+   pinctrl-names = "default";
+   pinctrl-0 = <_button_pins_default>;
+
+   sw10 {
+   label = "GPIO Key USER1";
+   linux,code = ;
+   gpios = <_gpio2 0 GPIO_ACTIVE_LOW>;
+   };
+   };
+};
+
+_pmx0 {
+   sw10_button_pins_default: sw10_button_pins_default {
+   pinctrl-single,pins = <
+   J721E_IOPAD(0x0, PIN_INPUT, 7) /* (AC18) 
EXTINTn.GPIO0_0 */

hmm..is this working? IIRC GPIO group should be selected along with mux mode,
else it will be routed to GPIO0.
Good catch. Since many configs are not enabled in mainline kernel, I 
missed these failures.
I enabled