diff --git a/Readme.md b/Readme.md index 9569fdb..b917ab6 100644 --- a/Readme.md +++ b/Readme.md @@ -48,6 +48,7 @@ Install + [DE0-Nano-SoC](doc/install/de0-nano-soc.md) + [Dual Boot(ZYBO and DE0-Nano-SoC)](doc/install/zynq-zybo-de0-nano-soc.md) * [Install Device Drivers and Services](doc/install/device-drivers.md) +* [Upgrade to v0.5.4 from v0.5.3](doc/install/upgrade-v0.5.4.md) Tutorial ------------------------------------------------------------------------------------ @@ -55,6 +56,10 @@ Tutorial * [uio_irq_sample](doc/tutorial/uio_irq_sample.md) * [accumulator](doc/tutorial/accumulator.md) * [fibonacci](doc/tutorial/fibonacci.md) +* FPGA-SoC-Linux-Example-1 + - [FPGA-SoC-Linux-Example-1-ZYBO](https://github.com/ikwzm/FPGA-SoC-Linux-Example-1-ZYBO) + - [FPGA-SoC-Linux-Example-1-ZYBO-Z7](https://github.com/ikwzm/FPGA-SoC-Linux-Example-1-ZYBO-Z7) + - [FPGA-SoC-Linux-Example-1-PYNQ-Z1](https://github.com/ikwzm/FPGA-SoC-Linux-Example-1-PYNQ-Z1) Build ------------------------------------------------------------------------------------ diff --git a/doc/build/device-drivers.md b/doc/build/device-drivers.md index 0e6e35d..971e2a9 100644 --- a/doc/build/device-drivers.md +++ b/doc/build/device-drivers.md @@ -18,7 +18,7 @@ shell$ git clone https://github.com/ikwzm/PTTY_AXI4 ``` shell$ git archive --remote dtbocfg --prefix=dtbocfg/ --format=tar v0.0.3 | tar xf - -C drivers -shell$ git archive --remote fclkcfg --prefix=fclkcfg/ --format=tar v0.0.1 | tar xf - -C drivers +shell$ git archive --remote fclkcfg --prefix=fclkcfg/ --format=tar v0.0.2 | tar xf - -C drivers shell$ git archive --remote udmabuf --prefix=udmabuf/ --format=tar v0.8.0 | tar xf - -C drivers shell$ cd PTTY_AXI4; git checkout v1.0.0; cp -r src/drivers/zptty ../drivers; cd .. ``` diff --git a/doc/install/de0-nano-soc.md b/doc/install/de0-nano-soc.md index 200dc64..aefc726 100644 --- a/doc/install/de0-nano-soc.md +++ b/doc/install/de0-nano-soc.md @@ -5,7 +5,7 @@ ``` shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux shell$ cd FPGA-SoC-Linux -shell$ git checkout v0.5.3 +shell$ git checkout v0.5.4 shell$ git lfs pull ``` @@ -25,8 +25,8 @@ shell$ git lfs pull * debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS) * linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Image Package (use Git LFS) * linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Headers Package (use Git LFS) - * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb : Device Drivers Package (use Git LFS) - * fpga-soc-linux-services_0.0.7-1_armhf.deb : Device Services Package (use Git LFS) + * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb : Device Drivers Package (use Git LFS) + * fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS) #### Format SD-Card @@ -51,8 +51,8 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u shell# mkdir /mnt/usb2/home/fpga/debian shell# cp linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian shell# cp linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-services_0.0.7-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian shell$ cp -r target/de0-nano-soc/examples /mnt/usb2/home/fpga shell# umount mnt/usb1 shell# umount mnt/usb2 diff --git a/doc/install/device-drivers.md b/doc/install/device-drivers.md index 3d7326a..ce351d5 100644 --- a/doc/install/device-drivers.md +++ b/doc/install/device-drivers.md @@ -22,25 +22,36 @@ root@debian-fpga:~# ``` fpga@debian-fpga:~$ cd /home/fpga/debian -fpga@debian-fpga:~$ sudo dpkg -i fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb +fpga@debian-fpga:~$ sudo dpkg -i fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb Selecting previously unselected package fpga-soc-linux-drivers-4.12.14-armv7-fpga. (Reading database ... 39197 files and directories currently installed.) -Preparing to unpack fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb ... -Unpacking fpga-soc-linux-drivers-4.12.14-armv7-fpga (0.0.8-1) ... -Setting up fpga-soc-linux-drivers-4.12.14-armv7-fpga (0.0.8-1) ... +Preparing to unpack fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb ... +Unpacking fpga-soc-linux-drivers-4.12.14-armv7-fpga (0.0.9-1) ... +Setting up fpga-soc-linux-drivers-4.12.14-armv7-fpga (0.0.9-1) ... ``` ``` fpga@debian-fpga:~$ cd /home/fpga/debian -fpga@debian-fpga:~$ sudo dpkg -i fpga-soc-linux-services_0.0.7-1_armhf.deb +fpga@debian-fpga:~$ sudo dpkg -i fpga-soc-linux-services_0.0.9-1_armhf.deb Selecting previously unselected package fpga-soc-linux-services. -(Reading database ... 39210 files and directories currently installed.) -Preparing to unpack fpga-soc-linux-services_0.0.5-1_armhf.deb ... -Unpacking fpga-soc-linux-services (0.0.7-1) ... -Setting up fpga-soc-linux-services (0.0.7-1) ... -Created symlink from /etc/systemd/system/multi-user.target.wants/device-tree-overlay.service to /etc/systemd/system/device-tree-overlay.service. -Created symlink from /etc/systemd/system/multi-user.target.wants/udmabuf.service to /etc/systemd/system/udmabuf.service. -Created symlink from /etc/systemd/system/multi-user.target.wants/zptty.service to /etc/systemd/system/zptty.service. +(Reading database ... 42746 files and directories currently installed.) +Preparing to unpack fpga-soc-linux-services_0.0.9-1_armhf.deb ... +Unpacking fpga-soc-linux-services (0.0.9-1) ... +Setting up fpga-soc-linux-services (0.0.9-1) ... +Created symlink /etc/systemd/system/multi-user.target.wants/device-tree-overlay.service → /etc/systemd/system/device-tree-overlay.service. +[ 403.906219] systemd[1]: apt-daily-upgrade.timer: Adding 33min 27.360172s random time. +[ 403.918062] systemd[1]: apt-daily.timer: Adding 11h 12min 56.053554s random time. +Created symlink /etc/systemd/system/multi-user.target.wants/udmabuf.service → /etc/systemd/system/udmabuf.service. +[ 404.327393] systemd[1]: apt-daily-upgrade.timer: Adding 42min 35.340818s random time. +[ 404.339211] systemd[1]: apt-daily.timer: Adding 9h 23min 10.482115s random time. +Created symlink /etc/systemd/system/multi-user.target.wants/fpga-clock.service → /etc/systemd/system/fpga-clock.service. +[ 404.745385] systemd[1]: apt-daily-upgrade.timer: Adding 50min 4.974227s random time. +[ 404.757136] systemd[1]: apt-daily.timer: Adding 3h 26min 46.127644s random time. +Created symlink /etc/systemd/system/multi-user.target.wants/zptty.service → /etc/systemd/system/zptty.service. +[ 405.176330] systemd[1]: apt-daily-upgrade.timer: Adding 21min 31.965437s random time. +[ 405.188405] systemd[1]: apt-daily.timer: Adding 20min 1.691993s random time. +[ 405.279856] dtbocfg_module_init +[ 405.283061] dtbocfg_module_init: OK ``` #### Check Installed Device Drivers and Services Package @@ -48,9 +59,10 @@ Created symlink from /etc/systemd/system/multi-user.target.wants/zptty.service t ``` fpga@debian-fpga:~$ sudo lsmod Module Size Used by -zptty 8529 0 -udmabuf 10177 0 -dtbocfg 3200 2 +zptty 16384 0 +fclkcfg 16384 0 +udmabuf 20480 0 +dtbocfg 16384 0 ``` ``` diff --git a/doc/install/upgrade-v0.5.4.md b/doc/install/upgrade-v0.5.4.md new file mode 100644 index 0000000..00b7033 --- /dev/null +++ b/doc/install/upgrade-v0.5.4.md @@ -0,0 +1,83 @@ +### Upgrade to v0.5.4 from v0.5.3 + +#### Boot ZYBO or DE0-Nano-SoC and login fpga or root user + +fpga'password is "fpga". + +``` +debian-fpga login: fpga +Password: +fpga@debian-fpga:~$ +``` + +root'password is "admin". + +``` +debian-fpga login: root +Password: +root@debian-fpga:~# +``` + +#### Remove Old Services Package + +``` +fpga@debian-fpga:~$ sudo dpkg --remove fpga-soc-linux-services +(Reading database ... 42754 files and directories currently installed.) +Removing fpga-soc-linux-services (0.0.7-1) ... +Removed /etc/systemd/system/multi-user.target.wants/zptty.service. +[ 53.753171] systemd[1]: apt-daily-upgrade.timer: Adding 11min 43.270095s random time. +[ 53.765507] systemd[1]: apt-daily.timer: Adding 36min 25.436252s random time. +Removed /etc/systemd/system/multi-user.target.wants/udmabuf.service. +[ 54.235643] systemd[1]: apt-daily-upgrade.timer: Adding 55.242551s random time. +[ 54.247159] systemd[1]: apt-daily.timer: Adding 9h 13min 49.218879s random time. +Removed /etc/systemd/system/multi-user.target.wants/device-tree-overlay.service. +[ 54.676455] systemd[1]: apt-daily-upgrade.timer: Adding 52min 48.054844s random time. +[ 54.688334] systemd[1]: apt-daily.timer: Adding 6h 36min 45.912649s random time. +``` + +#### Remove Old Device Drivers + +``` +fpga@debian-fpga:~$ sudo dpkg --remove fpga-soc-linux-drivers-4.12.14-armv7-fpga +(Reading database ... 42746 files and directories currently installed.) +Removing fpga-soc-linux-drivers-4.12.14-armv7-fpga (0.0.8-1) ... +``` + +#### Install New Device Drivers + +``` +fpga@debian-fpga:~$ cd /home/fpga/debian +fpga@debian-fpga:~$ sudo dpkg -i fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb +Selecting previously unselected package fpga-soc-linux-drivers-4.12.14-armv7-fpga. +(Reading database ... 39197 files and directories currently installed.) +Preparing to unpack fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb ... +Unpacking fpga-soc-linux-drivers-4.12.14-armv7-fpga (0.0.9-1) ... +Setting up fpga-soc-linux-drivers-4.12.14-armv7-fpga (0.0.9-1) ... +``` + +#### Install New Services Package + + +``` +fpga@debian-fpga:~$ cd /home/fpga/debian +Selecting previously unselected package fpga-soc-linux-services. +(Reading database ... 42746 files and directories currently installed.) +Preparing to unpack fpga-soc-linux-services_0.0.9-1_armhf.deb ... +Unpacking fpga-soc-linux-services (0.0.9-1) ... +Setting up fpga-soc-linux-services (0.0.9-1) ... +Created symlink /etc/systemd/system/multi-user.target.wants/device-tree-overlay.service → /etc/systemd/system/device-tree-overlay.service. +[ 403.906219] systemd[1]: apt-daily-upgrade.timer: Adding 33min 27.360172s random time. +[ 403.918062] systemd[1]: apt-daily.timer: Adding 11h 12min 56.053554s random time. +Created symlink /etc/systemd/system/multi-user.target.wants/udmabuf.service → /etc/systemd/system/udmabuf.service. +[ 404.327393] systemd[1]: apt-daily-upgrade.timer: Adding 42min 35.340818s random time. +[ 404.339211] systemd[1]: apt-daily.timer: Adding 9h 23min 10.482115s random time. +Created symlink /etc/systemd/system/multi-user.target.wants/fpga-clock.service → /etc/systemd/system/fpga-clock.service. +[ 404.745385] systemd[1]: apt-daily-upgrade.timer: Adding 50min 4.974227s random time. +[ 404.757136] systemd[1]: apt-daily.timer: Adding 3h 26min 46.127644s random time. +Created symlink /etc/systemd/system/multi-user.target.wants/zptty.service → /etc/systemd/system/zptty.service. +[ 405.176330] systemd[1]: apt-daily-upgrade.timer: Adding 21min 31.965437s random time. +[ 405.188405] systemd[1]: apt-daily.timer: Adding 20min 1.691993s random time. +[ 405.279856] dtbocfg_module_init +[ 405.283061] dtbocfg_module_init: OK +``` + diff --git a/doc/install/zynq-pynqz1.md b/doc/install/zynq-pynqz1.md index f79c87e..f42abc7 100644 --- a/doc/install/zynq-pynqz1.md +++ b/doc/install/zynq-pynqz1.md @@ -5,7 +5,7 @@ ``` shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux shell$ cd FPGA-SoC-Linux -shell$ git checkout v0.5.3 +shell$ git checkout v0.5.4 shell$ git lfs pull ``` @@ -23,8 +23,8 @@ shell$ git lfs pull * debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS) * linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Image Package (use Git LFS) * linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Headers Package (use Git LFS) - * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb : Device Drivers Package (use Git LFS) - * fpga-soc-linux-services_0.0.7-1_armhf.deb : Device Services Package (use Git LFS) + * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb : Device Drivers Package (use Git LFS) + * fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS) #### Format SD-Card @@ -47,8 +47,8 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u shell# mkdir /mnt/usb2/home/fpga/debian shell# cp linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian shell# cp linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-services_0.0.7-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian shell$ cp -r target/zynq-pynqz1/examples /mnt/usb2/home/fpga shell# umount mnt/usb1 shell# umount mnt/usb2 diff --git a/doc/install/zynq-zybo-de0-nano-soc.md b/doc/install/zynq-zybo-de0-nano-soc.md index 79d4647..68201f0 100644 --- a/doc/install/zynq-zybo-de0-nano-soc.md +++ b/doc/install/zynq-zybo-de0-nano-soc.md @@ -7,7 +7,7 @@ It corresponds to boot of both ZYBO and DE0-Nano-SoC in one SD-Card. ``` shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux shell$ cd FPGA-SoC-Linux -shell$ git checkout v0.5.3 +shell$ git checkout v0.5.4 shell$ git lfs pull ``` #### Build boot files @@ -59,8 +59,8 @@ cp ../de0-nano-soc//u-boot/u-boot.img u-boot/u-boot.img * debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS) * linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Image Package (use Git LFS) * linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Headers Package (use Git LFS) - * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb : Device Drivers Package (use Git LFS) - * fpga-soc-linux-services_0.0.7-1_armhf.deb : Device Services Package (use Git LFS) + * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb : Device Drivers Package (use Git LFS) + * fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS) #### Format SD-Card @@ -85,8 +85,8 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u shell# mkdir /mnt/usb2/home/fpga/debian shell# cp linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian shell# cp linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-services_0.0.7-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian shell# umount mnt/usb1 shell# umount mnt/usb2 ```` diff --git a/doc/install/zynq-zybo-z7.md b/doc/install/zynq-zybo-z7.md index 1b5de94..02c1b5f 100644 --- a/doc/install/zynq-zybo-z7.md +++ b/doc/install/zynq-zybo-z7.md @@ -5,7 +5,7 @@ ``` shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux shell$ cd FPGA-SoC-Linux -shell$ git checkout v0.5.3 +shell$ git checkout v0.5.4 shell$ git lfs pull ``` @@ -22,8 +22,8 @@ shell$ git lfs pull * debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS) * linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Image Package (use Git LFS) * linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Headers Package (use Git LFS) - * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb : Device Drivers Package (use Git LFS) - * fpga-soc-linux-services_0.0.7-1_armhf.deb : Device Services Package (use Git LFS) + * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb : Device Drivers Package (use Git LFS) + * fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS) #### Format SD-Card @@ -46,8 +46,8 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u shell# mkdir /mnt/usb2/home/fpga/debian shell# cp linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian shell# cp linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-services_0.0.7-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian shell# umount mnt/usb1 shell# umount mnt/usb2 ```` diff --git a/doc/install/zynq-zybo.md b/doc/install/zynq-zybo.md index 2b7b31c..03852bd 100644 --- a/doc/install/zynq-zybo.md +++ b/doc/install/zynq-zybo.md @@ -5,7 +5,7 @@ ``` shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux shell$ cd FPGA-SoC-Linux -shell$ git checkout v0.5.3 +shell$ git checkout v0.5.4 shell$ git lfs pull ``` @@ -24,8 +24,8 @@ shell$ git lfs pull * debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS) * linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Image Package (use Git LFS) * linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Headers Package (use Git LFS) - * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb : Device Drivers Package (use Git LFS) - * fpga-soc-linux-services_0.0.7-1_armhf.deb : Device Services Package (use Git LFS) + * fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb : Device Drivers Package (use Git LFS) + * fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS) #### Format SD-Card @@ -48,8 +48,8 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u shell# mkdir /mnt/usb2/home/fpga/debian shell# cp linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian shell# cp linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb /mnt/usb2/home/fpga/debian -shell# cp fpga-soc-linux-services_0.0.7-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian +shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian shell# cp -r target/zynq-zybo/examples /mnt/usb2/home/fpga shell# umount mnt/usb1 shell# umount mnt/usb2 diff --git a/drivers/debian/changelog b/drivers/debian/changelog index d112247..ea79104 100644 --- a/drivers/debian/changelog +++ b/drivers/debian/changelog @@ -1,3 +1,10 @@ +fpga-soc-linux-drivers (0.0.9-1) unstable; urgency=low + + * Update fclkcfg v0.0.2 + + -- ichiro Thu, 12 Dec 2017 13:10:00 +0900 + + fpga-soc-linux-drivers (0.0.8-1) unstable; urgency=low * Update Linux-Kernel diff --git a/drivers/fclkcfg/Readme.md b/drivers/fclkcfg/Readme.md index 1c7f81a..adafa70 100644 --- a/drivers/fclkcfg/Readme.md +++ b/drivers/fclkcfg/Readme.md @@ -37,9 +37,10 @@ insmod で fclkcfg のカーネルドライバをロードします。その際 ````shell zynq# insmod fclkcfg.ko [ 102.044387] fclkcfg amba:fclk0: driver installed. -[ 102.049016] fclkcfg amba:fclk0: device name : fclk0 -[ 102.053949] fclkcfg amba:fclk0: clock name : fclk0 -[ 102.058748] fclkcfg amba:fclk0: clock rate : 100000000 +[ 102.049016] fclkcfg amba:fclk0: device name : fclk0 +[ 102.053949] fclkcfg amba:fclk0: clock name : fclk0 +[ 102.058748] fclkcfg amba:fclk0: clock rate : 100000000 +[ 102.058748] fclkcfg amba:fclk0: clock enable : 1 ```` アンインストールするには rmmod を使います。 @@ -51,7 +52,71 @@ zynq# rmmod fclkcfg ## デバイスツリー -### ZYBO での例1 +### プロパティ + +#### clocks + +clocks プロパティで制御するクロックを指定します。clocks の詳細は後述の例を参照してください。 + +````devicetree:devicetree.dts + fclk0 { + compatible = "ikwzm,fclkcfg-0.10.a"; + clocks = <&clkc 15>; + }; +```` + +#### insert-rate + +insert-rate は、このデバイスがインストールされた時に設定する周波数を指定します。設定する周波数は、10進数の文字列で指定します。insert-rate が指定されていない時は、インストール時に周波数は変更されません。例えば次のようにデバイスツリーに記述することで、インストール時に周波数を 100MHz に設定します。 + +````devicetree:devicetree.dts + fclk0 { + compatible = "ikwzm,fclkcfg-0.10.a"; + clocks = <&clkc 15>; + insert-rate = "100000000"; + }; +```` + +#### insert-enable + +insert-enable は、このデバイスがインストールされた時にクロックを出力するかしないかを指定します。設定する値は、出力する時は```<1>```を、出力しない時は```<0>```を指定します。insert-enable が指定されていない時は、インストール時に出力の制御をしません。例えば次のようにデバイスツリーに記述することで、インストール時にクロックを出力するようにします。 + +````devicetree:devicetree.dts + fclk0 { + compatible = "ikwzm,fclkcfg-0.10.a"; + clocks = <&clkc 15>; + insert-enable = <1>; + }; +```` + +#### remove-rate + +remove-rate は、このデバイスがリムーブされた時に設定する周波数を指定します。設定する周波数は、10進数の文字列で指定します。 +remove-rate が指定されていない時は、リムーブされた時に周波数は変更されません。例えば次のようにデバイスツリーに記述することで、リムーブ時に周波数を 1MHz に設定します。 + +````devicetree:devicetree.dts + fclk0 { + compatible = "ikwzm,fclkcfg-0.10.a"; + clocks = <&clkc 15>; + remove-rate = "1000000"; + }; +```` + +#### remove-enable + +remove-enable は、このデバイスがリムーブされた時にクロックを出力するかしないかを指定します。設定する値は、出力する時は```<1>```を、出力しない時は```<0>```を指定します。insert-enable が指定されていない時は、リムーブ時に出力の制御をしません。例えば次のようにデバイスツリーに記述することで、リムーブ時にクロックの出力を停止します。 + +````devicetree:devicetree.dts + fclk0 { + compatible = "ikwzm,fclkcfg-0.10.a"; + clocks = <&clkc 15>; + remove-enable = <0>; + }; +```` + +### 例 + +#### ZYBO での例1 ZYBO+linux(v4.4.4) で、デバイスツリーに次のような項目を追加します。 @@ -100,7 +165,7 @@ clocks で PL のクロックを指定します。 clocks = \<\&clkc 15\> と記述することにより、fclk0 は clkc が管理しているクロックの15番目のクロック(これが PL Clock 0を指す)を制御することを指定します。 -### ZYBO での例2 +#### ZYBO での例2 \&clkc の代わりに phandle を使って指定することもできます。 @@ -139,7 +204,7 @@ clocks = \<\&clkc 15\> と記述することにより、fclk0 は clkc が管理 この例では clkc は phandle = \<0x1\> に設定されています。したがって fclk0 の clocks の第一引数は 0x1 を指定します。 -### ZYBO での例3 +#### ZYBO での例3 [「FPGA+SoC+LinuxでDevice Tree Overlayを試してみた」](http://qiita.com/ikwzm/items/ec514e955c16076327ce)で説明したように、Device Tree Overlay を使うこともできます。この場合は次のようなデバイスツリーを用意します。 @@ -168,9 +233,10 @@ zynq# mkdir /config/device-tree/overlay/fclk0 zynq# dtc -I dts -O dtb -o /config/device-tree/overlay/fclk0/dtbo fclk0-zynq-zybo.dts zynq# echo 1 >/config/device-tree/overlays/fclk0/status [ 3361.788836] fclkcfg amba:fclk0: driver installed. -[ 3361.794680] fclkcfg amba:fclk0: device name : fclk0 -[ 3361.799542] fclkcfg amba:fclk0: clock name : fclk0 -[ 3361.804344] fclkcfg amba:fclk0: clock rate : 100000000 +[ 3361.794680] fclkcfg amba:fclk0: device name : fclk0 +[ 3361.799542] fclkcfg amba:fclk0: clock name : fclk0 +[ 3361.804344] fclkcfg amba:fclk0: clock rate : 100000000 +[ 3361.804344] fclkcfg amba:fclk0: clock enable : 1 ```` ## デバイスファイル diff --git a/drivers/fclkcfg/dts/fclk0-zynq-zybo.dts b/drivers/fclkcfg/dts/fclk0-zynq-zybo.dts index 13e11e4..022ec3f 100644 --- a/drivers/fclkcfg/dts/fclk0-zynq-zybo.dts +++ b/drivers/fclkcfg/dts/fclk0-zynq-zybo.dts @@ -4,8 +4,12 @@ target-path = "/amba"; __overlay__ { fclk0 { - compatible = "ikwzm,fclkcfg-0.10.a"; - clocks = <1 15>; + compatible = "ikwzm,fclkcfg-0.10.a"; + clocks = <1 15>; + insert-rate = "100000000"; + insert-enable = <1>; + remove-rate = "1000000"; + remove-enable = <0>; }; }; }; diff --git a/drivers/fclkcfg/fclkcfg.c b/drivers/fclkcfg/fclkcfg.c index 03c7f68..b5f5130 100644 --- a/drivers/fclkcfg/fclkcfg.c +++ b/drivers/fclkcfg/fclkcfg.c @@ -1,6 +1,6 @@ /********************************************************************************* * - * Copyright (C) 2016 Ichiro Kawazome + * Copyright (C) 2016-2017 Ichiro Kawazome * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,8 +65,57 @@ struct fclk_driver_data { struct clk* clk; dev_t device_number; unsigned long round_rate; + unsigned long insert_rate; + unsigned long remove_rate; + bool insert_enable; + bool remove_enable; + bool remove_rate_valid; + bool remove_enable_valid; }; +/** + * __fclk_set_enable() + */ +static int __fclk_set_enable(struct fclk_driver_data* this, bool enable) +{ + int status = 0; + + if (enable == true) { + if (__clk_is_enabled(this->clk) == false) { + status = clk_prepare_enable(this->clk); + if (status) + dev_err(this->device, "enable failed."); + else + dev_dbg(this->device, "enable success."); + } + } else { + if (__clk_is_enabled(this->clk) == true) { + clk_disable_unprepare(this->clk); + dev_dbg(this->device, "disable done."); + } + } + return status; +} + +/** + * __fclk_set_rate() + */ +static int __fclk_set_rate(struct fclk_driver_data* this, unsigned long rate) +{ + int status; + unsigned long round_rate; + + round_rate = clk_round_rate(this->clk, rate); + status = clk_set_rate(this->clk, round_rate); + + if (status) + dev_err(this->device, "set_rate(%lu=>%lu) failed." , rate, round_rate); + else + dev_dbg(this->device, "set_rate(%lu=>%lu) success.", rate, round_rate); + + return status; +} + /** * fclk_show_enable() @@ -82,34 +131,18 @@ static ssize_t fclk_show_enable(struct device *dev, struct device_attribute *att */ static ssize_t fclk_set_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { - ssize_t status = 0; + ssize_t get_status = 0; + int set_status = 0; unsigned long enable; struct fclk_driver_data* this = dev_get_drvdata(dev); - if (0 != (status = kstrtoul(buf, 0, &enable))) - return status; + if (0 != (get_status = kstrtoul(buf, 0, &enable))) + return get_status; - if (enable) { - if (__clk_is_enabled(this->clk) == false) { - status = clk_prepare_enable(this->clk); - if (status) { - dev_err(this->device, "enable failed."); - return status; - } - else { - dev_dbg(this->device, "enable success."); - return size; - } - } else { - return size; - } - } else { - if (__clk_is_enabled(this->clk) == true) { - clk_disable_unprepare(this->clk); - dev_dbg(this->device, "disable done."); - } - return size; - } + if (0 != (set_status = __fclk_set_enable(this, (enable != 0)))) + return (ssize_t)set_status; + + return size; } /** @@ -126,24 +159,18 @@ static ssize_t fclk_show_rate(struct device *dev, struct device_attribute *attr, */ static ssize_t fclk_set_rate(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { - ssize_t status; + ssize_t get_status; + int set_status; unsigned long rate; - unsigned long round_rate; struct fclk_driver_data* this = dev_get_drvdata(dev); - if (0 != (status = kstrtoul(buf, 0, &rate))) - return status; + if (0 != (get_status = kstrtoul(buf, 0, &rate))) + return get_status; - round_rate = clk_round_rate(this->clk, rate); - status = clk_set_rate(this->clk, round_rate); + if (0 != (set_status = __fclk_set_rate(this, rate))) + return (ssize_t)set_status; - if (status) { - dev_err(this->device, "set_rate(%lu=>%lu) failed." , rate, round_rate); - return status; - } else { - dev_dbg(this->device, "set_rate(%lu=>%lu) success.", rate, round_rate); - return size; - } + return size; } /** @@ -294,12 +321,100 @@ static int fclkcfg_platform_driver_probe(struct platform_device *pdev) } dev_dbg(&pdev->dev, "device_create done\n"); + /* + * insert_rate + */ + dev_dbg(&pdev->dev, "get insert-rate start.\n"); + { + const char* prop; + + prop = of_get_property(pdev->dev.of_node, "insert-rate", NULL); + + if (!IS_ERR_OR_NULL(prop)) { + ssize_t prop_status; + unsigned long rate; + if (0 != (prop_status = kstrtoul(prop, 0, &rate))) + dev_err(&pdev->dev, "invalid insert-rate.\n"); + else + __fclk_set_rate(this, rate); + } + this->insert_rate = clk_get_rate(this->clk); + } + dev_dbg(&pdev->dev, "get insert-rate done.\n"); + + /* + * insert_enable + */ + dev_dbg(&pdev->dev, "get insert-enable start.\n"); + { + int status; + unsigned int enable; + + status = of_property_read_u32(pdev->dev.of_node, "insert-enable", &enable); + + if (status == 0) + __fclk_set_enable(this, (enable != 0)); + + this->insert_enable = __clk_is_enabled(this->clk); + } + dev_dbg(&pdev->dev, "get insert-rate done.\n"); + + /* + * remove_rate + */ + dev_dbg(&pdev->dev, "get remove-rate start.\n"); + { + const char* prop; + + this->remove_rate = 0; + this->remove_rate_valid = false; + prop = of_get_property(pdev->dev.of_node, "remove-rate", NULL); + + if (!IS_ERR_OR_NULL(prop)) { + ssize_t prop_status; + unsigned long rate; + if (0 != (prop_status = kstrtoul(prop, 0, &rate))) + dev_err(&pdev->dev, "invalid remove-rate.\n"); + else { + this->remove_rate = clk_round_rate(this->clk, rate); + this->remove_rate_valid = true; + } + } + } + dev_dbg(&pdev->dev, "get remove-rate done.\n"); + + /* + * remove_enable + */ + dev_dbg(&pdev->dev, "get remove-enable start.\n"); + { + int status; + unsigned int enable; + + status = of_property_read_u32(pdev->dev.of_node, "remove-enable", &enable); + + if (status == 0) { + this->remove_enable_valid = true; + this->remove_enable = (enable != 0); + } else { + this->remove_enable_valid = false; + this->remove_enable = 0; + } + } + dev_dbg(&pdev->dev, "get remove-rate done.\n"); + dev_set_drvdata(&pdev->dev, this); dev_info(&pdev->dev, "driver installed.\n"); - dev_info(&pdev->dev, "device name : %s\n" , device_name); - dev_info(&pdev->dev, "clock name : %s\n" , __clk_get_name(this->clk)); - dev_info(&pdev->dev, "clock rate : %lu\n", clk_get_rate(this->clk)); + dev_info(&pdev->dev, "device name : %s\n" , device_name); + dev_info(&pdev->dev, "clock name : %s\n" , __clk_get_name(this->clk)); + dev_info(&pdev->dev, "clock rate : %lu\n", clk_get_rate(this->clk)); + dev_info(&pdev->dev, "clock enabled : %d\n" , __clk_is_enabled(this->clk)); + if (this->remove_rate_valid == true) + dev_info(&pdev->dev, "remove rate : %lu\n", this->remove_rate); + if (this->remove_enable_valid == true) + dev_info(&pdev->dev, "remove enable : %d\n" , this->remove_enable); + return 0; failed: @@ -337,6 +452,14 @@ static int fclkcfg_platform_driver_remove(struct platform_device *pdev) if (!this) return -ENODEV; if (this->clk ) { + if (this->remove_rate_valid == true) { + __fclk_set_rate(this, this->remove_rate); + dev_info(&pdev->dev, "change rate : %lu\n", clk_get_rate(this->clk)); + } + if (this->remove_enable_valid == true) { + __fclk_set_enable(this, this->remove_enable); + dev_info(&pdev->dev, "change enable : %d\n" , __clk_is_enabled(this->clk)); + } clk_put(this->clk); this->clk = NULL; } diff --git a/fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb b/fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb deleted file mode 100644 index af5cfe3..0000000 --- a/fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.8-1_armhf.deb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0447a9f2426d79a679bc9591151a8000dda1fa59545e1c7843fd385cf87c361c -size 137596 diff --git a/fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb b/fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb new file mode 100644 index 0000000..7d55e90 --- /dev/null +++ b/fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8d47eb7e6fec08c9040ade82cc831d763ebf53bb9370400ca1b92e4df8a25c8 +size 138688 diff --git a/fpga-soc-linux-services_0.0.7-1_armhf.deb b/fpga-soc-linux-services_0.0.7-1_armhf.deb deleted file mode 100644 index cc11d65..0000000 --- a/fpga-soc-linux-services_0.0.7-1_armhf.deb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5746de2469e62e7c160d7d681c5f8707f745f84baf5f5c729768953297b33706 -size 4806 diff --git a/fpga-soc-linux-services_0.0.9-1_armhf.deb b/fpga-soc-linux-services_0.0.9-1_armhf.deb new file mode 100644 index 0000000..4c523fb --- /dev/null +++ b/fpga-soc-linux-services_0.0.9-1_armhf.deb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:364a6a0a9a147e966d1324ccb6ba50e96d28c9d34da4beb0d19adaf6868a918d +size 4876 diff --git a/services/Makefile b/services/Makefile index 39cd165..3403bce 100644 --- a/services/Makefile +++ b/services/Makefile @@ -14,5 +14,6 @@ install: all install -m 0755 ../drivers/dtbocfg/dtbocfg.rb $(prefix)/usr/bin/ install -m 0644 systemd/device-tree-overlay.service $(prefix)/etc/systemd/system/ install -m 0644 systemd/udmabuf.service $(prefix)/etc/systemd/system/ + install -m 0644 systemd/fpga-clock.service $(prefix)/etc/systemd/system/ install -m 0644 systemd/zptty.service $(prefix)/etc/systemd/system/ diff --git a/services/debian/changelog b/services/debian/changelog index 4265f3c..8371915 100644 --- a/services/debian/changelog +++ b/services/debian/changelog @@ -1,3 +1,10 @@ +fpga-soc-linux-services (0.0.9-1) unstable; urgency=low + + * add fpga-clock.service + + -- ichiro Thu, 12 Dec 2017 13:10:00 +0900 + + fpga-soc-linux-services (0.0.7-1) unstable; urgency=low * Remove fpga-manager.service diff --git a/services/debian/postinst b/services/debian/postinst index c9e5d88..6cd93ff 100755 --- a/services/debian/postinst +++ b/services/debian/postinst @@ -2,10 +2,12 @@ systemctl enable device-tree-overlay.service systemctl enable udmabuf.service +systemctl enable fpga-clock.service systemctl enable zptty.service systemctl start device-tree-overlay.service systemctl start udmabuf.service +systemctl start fpga-clock.service systemctl start zptty.service diff --git a/services/debian/prerm b/services/debian/prerm index 1ea6ac0..4682af8 100755 --- a/services/debian/prerm +++ b/services/debian/prerm @@ -2,9 +2,11 @@ systemctl stop zptty.service systemctl stop udmabuf.service +systemctl stop fpga-clock.service systemctl stop device-tree-overlay.service systemctl disable zptty.service systemctl disable udmabuf.service +systemctl disable fpga-clock.service systemctl disable device-tree-overlay.service diff --git a/services/systemd/fpga-clock.service b/services/systemd/fpga-clock.service new file mode 100644 index 0000000..33b14f6 --- /dev/null +++ b/services/systemd/fpga-clock.service @@ -0,0 +1,16 @@ +[Unit] +Description=FPGA Clock Service. +After=udev.target +After=dbus.target +After=avahi.target +After=syslog.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/sbin/modprobe fclkcfg +ExecStop=/sbin/rmmod fclkcfg + +[Install] +WantedBy=multi-user.target +