Skip to content

Commit 74bd963

Browse files
committed
Merge branch 'build-v0.6.x'
2 parents 1ad6344 + 7da5b7c commit 74bd963

12 files changed

+97
-42
lines changed

doc/build/device-drivers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ shell$ git clone https://github.com/ikwzm/PTTY_AXI4
1717
#### Copy Source Files to drivers/
1818

1919
```console
20-
shell$ git archive --remote dtbocfg --prefix=dtbocfg/ --format=tar v0.0.3 | tar xf - -C drivers
21-
shell$ git archive --remote fclkcfg --prefix=fclkcfg/ --format=tar v0.0.3 | tar xf - -C drivers
22-
shell$ git archive --remote udmabuf --prefix=udmabuf/ --format=tar v0.9.0 | tar xf - -C drivers
20+
shell$ git archive --remote dtbocfg --prefix=dtbocfg/ --format=tar v0.0.3 | tar xf - -C drivers
21+
shell$ git archive --remote fclkcfg --prefix=fclkcfg/ --format=tar v0.0.3 | tar xf - -C drivers
22+
shell$ git archive --remote udmabuf --prefix=udmabuf/ --format=tar v0.10.0 | tar xf - -C drivers
2323
shell$ cd PTTY_AXI4; git checkout v1.0.0; cp -r src/drivers/zptty ../drivers; cd ..
2424
```
2525

doc/install/de0-nano-soc.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```console
66
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
77
shell$ cd FPGA-SoC-Linux
8-
shell$ git checkout v0.6.0
8+
shell$ git checkout v0.6.1
99
shell$ git lfs pull
1010
```
1111

@@ -25,7 +25,7 @@ shell$ git lfs pull
2525
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
2626
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
2727
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
28-
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
28+
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb : Device Drivers Package (use Git LFS)
2929
* fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS)
3030

3131
#### Format SD-Card
@@ -51,7 +51,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
5151
shell# mkdir /mnt/usb2/home/fpga/debian
5252
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
5353
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
54-
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
54+
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb /mnt/usb2/home/fpga/debian
5555
shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian
5656
shell$ cp -r target/de0-nano-soc/examples /mnt/usb2/home/fpga
5757
shell# umount mnt/usb1

doc/install/device-drivers.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ Setting up linux-image-4.14.13-armv7-fpga (4.14.13-armv7-fpga-1) ...
3333

3434
```console
3535
fpga@debian-fpga:~$ cd /home/fpga/debian
36-
fpga@debian-fpga:~/debian$ sudo dpkg -i fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb
36+
fpga@debian-fpga:~/debian$ sudo dpkg -i fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb
3737
Selecting previously unselected package fpga-soc-linux-drivers-4.14.13-armv7-fpga.
38-
(Reading database ... 62097 files and directories currently installed.)
39-
Preparing to unpack fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb ...
40-
Unpacking fpga-soc-linux-drivers-4.14.13-armv7-fpga (0.1.0-1) ...
41-
Setting up fpga-soc-linux-drivers-4.14.13-armv7-fpga (0.1.0-1) ...
38+
(Reading database ... 62106 files and directories currently installed.)
39+
Preparing to unpack fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb ...
40+
Unpacking fpga-soc-linux-drivers-4.14.13-armv7-fpga (0.1.1-1) ...
41+
Setting up fpga-soc-linux-drivers-4.14.13-armv7-fpga (0.1.1-1) ...
4242
```
4343

4444
```console

doc/install/zynq-pynqz1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```console
66
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
77
shell$ cd FPGA-SoC-Linux
8-
shell$ git checkout v0.6.0
8+
shell$ git checkout v0.6.1
99
shell$ git lfs pull
1010
```
1111

@@ -23,7 +23,7 @@ shell$ git lfs pull
2323
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
2424
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
2525
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
26-
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
26+
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb : Device Drivers Package (use Git LFS)
2727
* fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS)
2828

2929
#### Format SD-Card
@@ -47,7 +47,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
4747
shell# mkdir /mnt/usb2/home/fpga/debian
4848
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
4949
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
50-
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
50+
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb /mnt/usb2/home/fpga/debian
5151
shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian
5252
shell$ cp -r target/zynq-pynqz1/examples /mnt/usb2/home/fpga
5353
shell# umount mnt/usb1

doc/install/zynq-zybo-de0-nano-soc.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ It corresponds to boot of both ZYBO and DE0-Nano-SoC in one SD-Card.
77
```console
88
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
99
shell$ cd FPGA-SoC-Linux
10-
shell$ git checkout v0.6.0
10+
shell$ git checkout v0.6.1
1111
shell$ git lfs pull
1212
```
1313
#### Build boot files
@@ -59,7 +59,7 @@ cp ../de0-nano-soc//u-boot/u-boot.img u-boot/u-boot.img
5959
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
6060
* linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Image Package (use Git LFS)
6161
* linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb : Linux Headers Package (use Git LFS)
62-
* fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb : Device Drivers Package (use Git LFS)
62+
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb : Device Drivers Package (use Git LFS)
6363
* fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS)
6464

6565
#### Format SD-Card
@@ -85,7 +85,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
8585
shell# mkdir /mnt/usb2/home/fpga/debian
8686
shell# cp linux-image-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian
8787
shell# cp linux-headers-4.12.14-armv7-fpga_4.12.14-armv7-fpga-3_armhf.deb /mnt/usb2/home/fpga/debian
88-
shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian
88+
shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.1.1-1_armhf.deb /mnt/usb2/home/fpga/debian
8989
shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian
9090
shell# umount mnt/usb1
9191
shell# umount mnt/usb2

doc/install/zynq-zybo-z7.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```console
66
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
77
shell$ cd FPGA-SoC-Linux
8-
shell$ git checkout v0.6.0
8+
shell$ git checkout v0.6.1
99
shell$ git lfs pull
1010
```
1111

@@ -22,7 +22,7 @@ shell$ git lfs pull
2222
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
2323
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
2424
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
25-
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
25+
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb : Device Drivers Package (use Git LFS)
2626
* fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS)
2727

2828
#### Format SD-Card
@@ -46,7 +46,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
4646
shell# mkdir /mnt/usb2/home/fpga/debian
4747
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
4848
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
49-
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
49+
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb /mnt/usb2/home/fpga/debian
5050
shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian
5151
shell# umount mnt/usb1
5252
shell# umount mnt/usb2

doc/install/zynq-zybo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```console
66
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
77
shell$ cd FPGA-SoC-Linux
8-
shell$ git checkout v0.6.0
8+
shell$ git checkout v0.6.1
99
shell$ git lfs pull
1010
```
1111

@@ -24,7 +24,7 @@ shell$ git lfs pull
2424
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
2525
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
2626
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
27-
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
27+
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb : Device Drivers Package (use Git LFS)
2828
* fpga-soc-linux-services_0.0.9-1_armhf.deb : Device Services Package (use Git LFS)
2929

3030
#### Format SD-Card
@@ -48,7 +48,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
4848
shell# mkdir /mnt/usb2/home/fpga/debian
4949
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
5050
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
51-
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
51+
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb /mnt/usb2/home/fpga/debian
5252
shell# cp fpga-soc-linux-services_0.0.9-1_armhf.deb /mnt/usb2/home/fpga/debian
5353
shell# cp -r target/zynq-zybo/examples /mnt/usb2/home/fpga
5454
shell# umount mnt/usb1

drivers/debian/changelog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
fpga-soc-linux-drivers (0.1.1-1) unstable; urgency=low
2+
3+
* Update udmabuf v0.10.0
4+
5+
-- ichiro <ichiro_k@ca2.so-net.ne.jp> Sat, 20 Jan 2018 13:10:00 +0900
6+
7+
18
fpga-soc-linux-drivers (0.1.0-1) unstable; urgency=low
29

310
* Update Linux-Kernel

drivers/udmabuf/udmabuf.c

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,28 @@
9191
#define USE_DEV_GROUPS 0
9292
#endif
9393

94+
#if ((LINUX_VERSION_CODE >= 0x040100) && defined(CONFIG_OF))
95+
#define USE_OF_RESERVED_MEM 1
96+
#else
97+
#define USE_OF_RESERVED_MEM 0
98+
#endif
99+
100+
#if ((LINUX_VERSION_CODE >= 0x040100) && defined(CONFIG_OF))
101+
#define USE_OF_DMA_CONFIG 1
102+
#else
103+
#define USE_OF_DMA_CONFIG 0
104+
#endif
105+
94106
#if (UDMABUF_DEBUG == 1)
95107
#define UDMABUF_DEBUG_CHECK(this,debug) (this->debug)
96108
#else
97109
#define UDMABUF_DEBUG_CHECK(this,debug) (0)
98110
#endif
99111

112+
#if (USE_OF_RESERVED_MEM == 1)
113+
#include <linux/of_reserved_mem.h>
114+
#endif
115+
100116
static struct class* udmabuf_sys_class = NULL;
101117
static dev_t udmabuf_device_number = 0;
102118
static int dma_mask_bit = 32;
@@ -116,7 +132,6 @@ struct udmabuf_driver_data {
116132
size_t alloc_size;
117133
void* virt_addr;
118134
dma_addr_t phys_addr;
119-
u64 dma_mask;
120135
#if (SYNC_ENABLE == 1)
121136
int sync_mode;
122137
int sync_offset;
@@ -126,6 +141,9 @@ struct udmabuf_driver_data {
126141
int sync_for_cpu;
127142
int sync_for_device;
128143
#endif
144+
#if (USE_OF_RESERVED_MEM == 1)
145+
bool of_reserved_mem;
146+
#endif
129147
#if ((UDMABUF_DEBUG == 1) && (USE_VMA_FAULT == 1))
130148
bool debug_vma;
131149
#endif
@@ -645,6 +663,7 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
645663
const unsigned int DONE_CHRDEV_ADD = (1 << 1);
646664
const unsigned int DONE_ALLOC_CMA = (1 << 2);
647665
const unsigned int DONE_DEVICE_CREATE = (1 << 3);
666+
const unsigned int DONE_RESERVED_MEM = (1 << 4);
648667
/*
649668
* alloc device_minor_number
650669
*/
@@ -690,6 +709,11 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
690709
this->sync_for_device = 0;
691710
}
692711
#endif
712+
#if (USE_OF_RESERVED_MEM == 1)
713+
{
714+
this->of_reserved_mem = 0;
715+
}
716+
#endif
693717
#if ((UDMABUF_DEBUG == 1) && (USE_VMA_FAULT == 1))
694718
{
695719
this->debug_vma = 0;
@@ -723,23 +747,39 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
723747
*/
724748
if (parent != NULL) {
725749
this->dma_dev = parent;
750+
#if (USE_OF_RESERVED_MEM == 1)
751+
{
752+
int retval = of_reserved_mem_device_init(parent);
753+
if (retval == 0) {
754+
this->of_reserved_mem = 1;
755+
done |= DONE_RESERVED_MEM;
756+
} else if (retval != -ENODEV) {
757+
printk(KERN_ERR "of_reserved_mem_device_init() failed\n");
758+
goto failed;
759+
}
760+
}
761+
#endif
726762
} else {
727763
this->dma_dev = this->sys_dev;
728-
#if ((LINUX_VERSION_CODE >= 0x040100) && defined(CONFIG_OF))
764+
#if (USE_OF_DMA_CONFIG == 1)
729765
of_dma_configure(this->dma_dev, NULL);
730-
#else
731-
if (this->dma_dev->dma_mask == NULL) {
732-
this->dma_dev->dma_mask = &this->dma_mask;
733-
}
734-
if (dma_set_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit)) == 0) {
735-
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit));
736-
} else {
737-
printk(KERN_WARNING "dma_set_mask(DMA_BIT_MASK(%d)) failed\n", dma_mask_bit);
738-
dma_set_mask(this->dma_dev, DMA_BIT_MASK(32));
739-
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(32));
740-
}
741766
#endif
742767
}
768+
769+
/*
770+
* setup dma_mask and coherent_dma_mask
771+
*/
772+
if (this->dma_dev->dma_mask == NULL) {
773+
this->dma_dev->dma_mask = &this->dma_dev->coherent_dma_mask;
774+
}
775+
if (dma_set_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit)) == 0) {
776+
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit));
777+
} else {
778+
printk(KERN_WARNING "dma_set_mask(DMA_BIT_MASK(%d)) failed\n", dma_mask_bit);
779+
dma_set_mask(this->dma_dev, DMA_BIT_MASK(32));
780+
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(32));
781+
}
782+
743783
/*
744784
* dma buffer allocation
745785
*/
@@ -787,6 +827,9 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
787827
failed:
788828
if (done & DONE_CHRDEV_ADD ) { cdev_del(&this->cdev); }
789829
if (done & DONE_ALLOC_CMA ) { dma_free_coherent(this->dma_dev, this->alloc_size, this->virt_addr, this->phys_addr);}
830+
#if (USE_OF_RESERVED_MEM == 1)
831+
if (done & DONE_RESERVED_MEM ) { of_reserved_mem_device_release(parent); }
832+
#endif
790833
if (done & DONE_DEVICE_CREATE) { device_destroy(udmabuf_sys_class, this->device_number);}
791834
if (done & DONE_ALLOC_MINOR ) { udmabuf_device_minor_number_free(minor);}
792835
if (this != NULL) { kfree(this); }
@@ -811,6 +854,11 @@ static int udmabuf_driver_destroy(struct udmabuf_driver_data* this)
811854
dev_info(this->sys_dev, "driver uninstalled\n");
812855
}
813856
dma_free_coherent(this->dma_dev, this->alloc_size, this->virt_addr, this->phys_addr);
857+
#if (USE_OF_RESERVED_MEM == 1)
858+
if (this->of_reserved_mem) {
859+
of_reserved_mem_device_release(this->dma_dev);
860+
}
861+
#endif
814862
device_destroy(udmabuf_sys_class, this->device_number);
815863
cdev_del(&this->cdev);
816864
kfree(this);

fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)