qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: pisa@cmp.felk.cvut.cz
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Marek Vasut <marex@denx.de>,
	Oliver Hartkopp <socketcan@hartkopp.net>,
	Jiri Novak <jnovak@fel.cvut.cz>,
	Stefan Hajnoczi <stefanha@gmail.com>,
	Deniz Eren <deniz.eren@icloud.com>,
	Markus Armbruster <armbru@redhat.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Konrad Frederic <frederic.konrad@adacore.com>,
	Jan Charvat <charvj10@fel.cvut.cz>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Ondrej Ille <ondrej.ille@gmail.com>,
	Pavel Pisa <pisa@cmp.felk.cvut.cz>
Subject: [PATCH v1 6/6] hw/net/can: Documentation for CTU CAN FD IP open hardware core emulation.
Date: Tue, 14 Jul 2020 14:20:19 +0200	[thread overview]
Message-ID: <54a135d7017f3a98dc6c6f8e6b20917779e4c345.1594725647.git.pisa@cmp.felk.cvut.cz> (raw)
In-Reply-To: <cover.1594725647.git.pisa@cmp.felk.cvut.cz>

From: Pavel Pisa <pisa@cmp.felk.cvut.cz>

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
---
 MAINTAINERS  |   8 ++++
 docs/can.txt | 113 ++++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 110 insertions(+), 11 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index fe8139f367..d554a1cb41 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2058,6 +2058,14 @@ F: hw/rx/
 F: include/hw/intc/rx_icu.h
 F: include/hw/rx/
 
+CAN bus subsystem and hardware
+M: Pavel Pisa <pisa@cmp.felk.cvut.cz>
+S: Maintained
+W: https://canbus.pages.fel.cvut.cz/
+F: net/can/*
+F: hw/net/can/*
+F: include/net/can_*.h
+
 Subsystems
 ----------
 Audio
diff --git a/docs/can.txt b/docs/can.txt
index 11ed8f2d68..5838f6620c 100644
--- a/docs/can.txt
+++ b/docs/can.txt
@@ -8,13 +8,22 @@ can be connected to host system CAN API (at this time only Linux
 SocketCAN is supported).
 
 The concept of busses is generic and different CAN controllers
-can be implemented for it but at this time only SJA1000 chip
-controller is implemented.
+can be implemented.
+
+The initial submission implemented SJA1000 controller which
+is common and well supported by by drivers for the most operating
+systems.
 
 The PCI addon card hardware has been selected as the first CAN
 interface to implement because such device can be easily connected
 to systems with different CPU architectures (x86, PowerPC, Arm, etc.).
 
+In 2020, CTU CAN FD controller model has been added as part
+of the bachelor theses of Jan Charvat. This controller is complete
+open-source/design/hardware solution. The core designer
+of the project is Ondrej Ille, the financial support has been
+provided by CTU, and more companies including Volkswagen subsidiaries.
+
 The project has been initially started in frame of RTEMS GSoC 2013
 slot by Jin Yang under our mentoring  The initial idea was to provide generic
 CAN subsystem for RTEMS. But lack of common environment for code and RTEMS
@@ -22,8 +31,8 @@ testing lead to goal change to provide environment which provides complete
 emulated environment for testing and RTEMS GSoC slot has been donated
 to work on CAN hardware emulation on QEMU.
 
-Examples how to use CAN emulation
-=================================
+Examples how to use CAN emulation for SJA1000 based borads
+==========================================================
 
 When QEMU with CAN PCI support is compiled then one of the next
 CAN boards can be selected
@@ -90,18 +99,100 @@ traffic with "candump" command which is included in "can-utils".
 
   candump can0
 
+CTU CAN FD support examples
+===========================
+
+This open-source core provides CAN FD support. CAN FD drames are
+delivered even to the host systems when SocketCAN interface is found
+CAN FD capable.
+
+The PCIe borad emulation is provided for now (the device identifier is
+ctucan_pci). The defauld build defines two CTU CAN FD cores
+on the board.
+
+Example how to connect the canbus0-bus (virtual wire) to the host
+Linux system (SocketCAN used) and to both CTU CAN FD cores emulated
+on the corresponding PCI card expects that host system CAN bus
+is setup according to the previous SJA1000 section.
+
+  qemu-system-x86_64 -enable-kvm -kernel /boot/vmlinuz-4.19.52+ \
+      -initrd ramdisk.cpio \
+      -virtfs local,path=shareddir,security_model=none,mount_tag=shareddir \
+      -vga cirrus \
+      -append "console=ttyS0" \
+      -object can-bus,id=canbus0-bus \
+      -object can-host-socketcan,if=can0,canbus=canbus0-bus,id=canbus0-socketcan \
+      -device ctucan_pci,canbus0=canbus0-bus,canbus1=canbus0-bus \
+      -nographic
+
+Setup of CTU CAN FD controller in a guest Linux system
+
+  insmod ctucanfd.ko || modprobe ctucanfd
+  insmod ctucanfd_pci.ko || modprobe ctucanfd_pci
+
+  for ifc in /sys/class/net/can* ; do
+    if [ -e  $ifc/device/vendor ] ; then
+      if ! grep -q 0x1760 $ifc/device/vendor ; then
+        continue;
+      fi
+    else
+      continue;
+    fi
+    if [ -e  $ifc/device/device ] ; then
+       if ! grep -q 0xff00 $ifc/device/device ; then
+         continue;
+       fi
+    else
+      continue;
+    fi
+    ifc=$(basename $ifc)
+    /bin/ip link set $ifc type can bitrate 1000000 dbitrate 10000000 fd on
+    /bin/ip link set $ifc up
+  done
+
+The test can run for example
+
+  candump can1
+
+in the guest system and next commands in the host system for basic CAN
+
+  cangen can0
+
+for CAN FD without bitrate switch
+
+  cangen can0 -f
+
+and with bitrate switch
+
+  cangen can0 -b
+
+The test can be run viceversa, generate messages in the guest system and capture them
+in the host one and much more combinations.
+
 Links to other resources
 ========================
 
- (1) Repository with development branch can-pci at Czech Technical University
-     https://gitlab.fel.cvut.cz/canbus/qemu-canbus
- (2) GitHub repository with can-pci and our other changes included
+ (1) CAN related projects at Czech Technical University, Faculty of Electrical Engineering
+     http://canbus.pages.fel.cvut.cz/
+ (2) Repository with development can-pci branch at Czech Technical University
      https://gitlab.fel.cvut.cz/canbus/qemu-canbus
  (3) RTEMS page describing project
      https://devel.rtems.org/wiki/Developer/Simulators/QEMU/CANEmulation
  (4) RTLWS 2015 article about the project and its use with CANopen emulation
-     http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can.pdf
-     Slides
-     http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can-slides.pdf
- (5) Linux SocketCAN utilities
+     http://cmp.felk.cvut.cz/~pisa/can/doc/rtlws-17-pisa-qemu-can.pdf
+ (5) GNU/Linux, CAN and CANopen in Real-time Control Applications
+     Slides from LinuxDays 2017 (include updated RTLWS 2015 content)
+     https://www.linuxdays.cz/2017/video/Pavel_Pisa-CAN_canopen.pdf
+ (6) Linux SocketCAN utilities
      https://github.com/linux-can/can-utils/
+ (7) CTU CAN FD project including core VHDL design, Linux driver,
+     test utilities etc.
+     https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core
+ (8) CTU CAN FD Core Datasheet Documentation
+     http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/Progdokum.pdf
+ (9) CTU CAN FD Core System Architecture Documentation
+     http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/ctu_can_fd_architecture.pdf
+ (10) CTU CAN FD Driver Documentation
+     http://canbus.pages.fel.cvut.cz/ctucanfd_ip_core/driver_doc/ctucanfd-driver.html
+ (11) Integration with PCIe interfacing for Intel/Altera Cyclone IV based board
+     https://gitlab.fel.cvut.cz/canbus/pcie-ctu_can_fd
-- 
2.20.1



  parent reply	other threads:[~2020-07-14 12:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 12:20 [PATCH v1 0/6] CTU CAN FD core support pisa
2020-07-14 12:20 ` [PATCH v1 1/6] net/can: Initial host SocketCan support for CAN FD pisa
2020-09-01 20:01   ` Vikram Garhwal
2020-09-02  7:51     ` Pavel Pisa
2020-09-03  5:20       ` Vikram Garhwal
2020-09-03  5:29         ` Vikram Garhwal
2020-07-14 12:20 ` [PATCH v1 2/6] hw/net/can: sja1000 ignore CAN FD frames pisa
2020-09-01 17:07   ` Vikram Garhwal
2020-07-14 12:20 ` [PATCH v1 3/6] net/can: Add can_dlc2len and can_len2dlc for CAN FD pisa
2020-09-03  5:43   ` Vikram Garhwal
2020-09-03  6:12     ` Pavel Pisa
2020-09-03  6:38       ` Vikram Garhwal
2020-07-14 12:20 ` [PATCH v1 4/6] hw/net/can/ctucafd: Add CTU CAN FD core register definitions pisa
2020-07-14 12:20 ` [PATCH v1 5/6] hw/net/can: CTU CAN FD IP open hardware core emulation pisa
2020-07-24  9:46   ` Pavel Pisa
2020-07-14 12:20 ` pisa [this message]
2020-07-14 12:47 ` [PATCH v1 0/6] CTU CAN FD core support no-reply
2020-07-14 13:45   ` [PATCH v1 0/6] CTU CAN FD core support - patchew report Pavel Pisa
2020-07-14 12:48 ` [PATCH v1 0/6] CTU CAN FD core support no-reply
2020-07-30 15:29 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54a135d7017f3a98dc6c6f8e6b20917779e4c345.1594725647.git.pisa@cmp.felk.cvut.cz \
    --to=pisa@cmp.felk.cvut.cz \
    --cc=armbru@redhat.com \
    --cc=charvj10@fel.cvut.cz \
    --cc=deniz.eren@icloud.com \
    --cc=frederic.konrad@adacore.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jnovak@fel.cvut.cz \
    --cc=marex@denx.de \
    --cc=o.rempel@pengutronix.de \
    --cc=ondrej.ille@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=socketcan@hartkopp.net \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).