Skip to content

Commit

Permalink
Merge branch 'build-v0.6.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
ikwzm committed Jan 20, 2018
2 parents 1ad6344 + 7da5b7c commit 74bd963
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 42 deletions.
6 changes: 3 additions & 3 deletions doc/build/device-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ shell$ git clone https://github.com/ikwzm/PTTY_AXI4
#### Copy Source Files to drivers/

```console
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.3 | tar xf - -C drivers
shell$ git archive --remote udmabuf --prefix=udmabuf/ --format=tar v0.9.0 | tar xf - -C drivers
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.3 | tar xf - -C drivers
shell$ git archive --remote udmabuf --prefix=udmabuf/ --format=tar v0.10.0 | tar xf - -C drivers
shell$ cd PTTY_AXI4; git checkout v1.0.0; cp -r src/drivers/zptty ../drivers; cd ..
```

Expand Down
6 changes: 3 additions & 3 deletions doc/install/de0-nano-soc.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```console
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
shell$ cd FPGA-SoC-Linux
shell$ git checkout v0.6.0
shell$ git checkout v0.6.1
shell$ git lfs pull
```

Expand All @@ -25,7 +25,7 @@ shell$ git lfs pull
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand All @@ -51,7 +51,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
shell# mkdir /mnt/usb2/home/fpga/debian
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand Down
10 changes: 5 additions & 5 deletions doc/install/device-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ Setting up linux-image-4.14.13-armv7-fpga (4.14.13-armv7-fpga-1) ...

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

```console
Expand Down
6 changes: 3 additions & 3 deletions doc/install/zynq-pynqz1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```console
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
shell$ cd FPGA-SoC-Linux
shell$ git checkout v0.6.0
shell$ git checkout v0.6.1
shell$ git lfs pull
```

Expand All @@ -23,7 +23,7 @@ shell$ git lfs pull
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand All @@ -47,7 +47,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
shell# mkdir /mnt/usb2/home/fpga/debian
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand Down
6 changes: 3 additions & 3 deletions doc/install/zynq-zybo-de0-nano-soc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It corresponds to boot of both ZYBO and DE0-Nano-SoC in one SD-Card.
```console
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
shell$ cd FPGA-SoC-Linux
shell$ git checkout v0.6.0
shell$ git checkout v0.6.1
shell$ git lfs pull
```
#### Build boot files
Expand Down Expand Up @@ -59,7 +59,7 @@ 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.9-1_armhf.deb : Device Drivers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand All @@ -85,7 +85,7 @@ 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.9-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.12.14-armv7-fpga_0.1.1-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
Expand Down
6 changes: 3 additions & 3 deletions doc/install/zynq-zybo-z7.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```console
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
shell$ cd FPGA-SoC-Linux
shell$ git checkout v0.6.0
shell$ git checkout v0.6.1
shell$ git lfs pull
```

Expand All @@ -22,7 +22,7 @@ shell$ git lfs pull
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand All @@ -46,7 +46,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
shell# mkdir /mnt/usb2/home/fpga/debian
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand Down
6 changes: 3 additions & 3 deletions doc/install/zynq-zybo.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```console
shell$ git clone git://github.com/ikwzm/FPGA-SoC-Linux
shell$ cd FPGA-SoC-Linux
shell$ git checkout v0.6.0
shell$ git checkout v0.6.1
shell$ git lfs pull
```

Expand All @@ -24,7 +24,7 @@ shell$ git lfs pull
* debian9-rootfs-vanilla.tgz : Debian9 Root File System (use Git LFS)
* linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Image Package (use Git LFS)
* linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb : Linux Headers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb : Device Drivers Package (use Git LFS)
* fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand All @@ -48,7 +48,7 @@ shell# tar xfz debian9-rootfs-vanilla.tgz -C /mnt/u
shell# mkdir /mnt/usb2/home/fpga/debian
shell# cp linux-image-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp linux-headers-4.14.13-armv7-fpga_4.14.13-armv7-fpga-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb /mnt/usb2/home/fpga/debian
shell# cp fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-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
Expand Down
7 changes: 7 additions & 0 deletions drivers/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
fpga-soc-linux-drivers (0.1.1-1) unstable; urgency=low

* Update udmabuf v0.10.0

-- ichiro <[email protected]> Sat, 20 Jan 2018 13:10:00 +0900


fpga-soc-linux-drivers (0.1.0-1) unstable; urgency=low

* Update Linux-Kernel
Expand Down
74 changes: 61 additions & 13 deletions drivers/udmabuf/udmabuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,28 @@
#define USE_DEV_GROUPS 0
#endif

#if ((LINUX_VERSION_CODE >= 0x040100) && defined(CONFIG_OF))
#define USE_OF_RESERVED_MEM 1
#else
#define USE_OF_RESERVED_MEM 0
#endif

#if ((LINUX_VERSION_CODE >= 0x040100) && defined(CONFIG_OF))
#define USE_OF_DMA_CONFIG 1
#else
#define USE_OF_DMA_CONFIG 0
#endif

#if (UDMABUF_DEBUG == 1)
#define UDMABUF_DEBUG_CHECK(this,debug) (this->debug)
#else
#define UDMABUF_DEBUG_CHECK(this,debug) (0)
#endif

#if (USE_OF_RESERVED_MEM == 1)
#include <linux/of_reserved_mem.h>
#endif

static struct class* udmabuf_sys_class = NULL;
static dev_t udmabuf_device_number = 0;
static int dma_mask_bit = 32;
Expand All @@ -116,7 +132,6 @@ struct udmabuf_driver_data {
size_t alloc_size;
void* virt_addr;
dma_addr_t phys_addr;
u64 dma_mask;
#if (SYNC_ENABLE == 1)
int sync_mode;
int sync_offset;
Expand All @@ -126,6 +141,9 @@ struct udmabuf_driver_data {
int sync_for_cpu;
int sync_for_device;
#endif
#if (USE_OF_RESERVED_MEM == 1)
bool of_reserved_mem;
#endif
#if ((UDMABUF_DEBUG == 1) && (USE_VMA_FAULT == 1))
bool debug_vma;
#endif
Expand Down Expand Up @@ -645,6 +663,7 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
const unsigned int DONE_CHRDEV_ADD = (1 << 1);
const unsigned int DONE_ALLOC_CMA = (1 << 2);
const unsigned int DONE_DEVICE_CREATE = (1 << 3);
const unsigned int DONE_RESERVED_MEM = (1 << 4);
/*
* alloc device_minor_number
*/
Expand Down Expand Up @@ -690,6 +709,11 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
this->sync_for_device = 0;
}
#endif
#if (USE_OF_RESERVED_MEM == 1)
{
this->of_reserved_mem = 0;
}
#endif
#if ((UDMABUF_DEBUG == 1) && (USE_VMA_FAULT == 1))
{
this->debug_vma = 0;
Expand Down Expand Up @@ -723,23 +747,39 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
*/
if (parent != NULL) {
this->dma_dev = parent;
#if (USE_OF_RESERVED_MEM == 1)
{
int retval = of_reserved_mem_device_init(parent);
if (retval == 0) {
this->of_reserved_mem = 1;
done |= DONE_RESERVED_MEM;
} else if (retval != -ENODEV) {
printk(KERN_ERR "of_reserved_mem_device_init() failed\n");
goto failed;
}
}
#endif
} else {
this->dma_dev = this->sys_dev;
#if ((LINUX_VERSION_CODE >= 0x040100) && defined(CONFIG_OF))
#if (USE_OF_DMA_CONFIG == 1)
of_dma_configure(this->dma_dev, NULL);
#else
if (this->dma_dev->dma_mask == NULL) {
this->dma_dev->dma_mask = &this->dma_mask;
}
if (dma_set_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit)) == 0) {
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit));
} else {
printk(KERN_WARNING "dma_set_mask(DMA_BIT_MASK(%d)) failed\n", dma_mask_bit);
dma_set_mask(this->dma_dev, DMA_BIT_MASK(32));
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(32));
}
#endif
}

/*
* setup dma_mask and coherent_dma_mask
*/
if (this->dma_dev->dma_mask == NULL) {
this->dma_dev->dma_mask = &this->dma_dev->coherent_dma_mask;
}
if (dma_set_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit)) == 0) {
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(dma_mask_bit));
} else {
printk(KERN_WARNING "dma_set_mask(DMA_BIT_MASK(%d)) failed\n", dma_mask_bit);
dma_set_mask(this->dma_dev, DMA_BIT_MASK(32));
dma_set_coherent_mask(this->dma_dev, DMA_BIT_MASK(32));
}

/*
* dma buffer allocation
*/
Expand Down Expand Up @@ -787,6 +827,9 @@ static struct udmabuf_driver_data* udmabuf_driver_create(const char* name, struc
failed:
if (done & DONE_CHRDEV_ADD ) { cdev_del(&this->cdev); }
if (done & DONE_ALLOC_CMA ) { dma_free_coherent(this->dma_dev, this->alloc_size, this->virt_addr, this->phys_addr);}
#if (USE_OF_RESERVED_MEM == 1)
if (done & DONE_RESERVED_MEM ) { of_reserved_mem_device_release(parent); }
#endif
if (done & DONE_DEVICE_CREATE) { device_destroy(udmabuf_sys_class, this->device_number);}
if (done & DONE_ALLOC_MINOR ) { udmabuf_device_minor_number_free(minor);}
if (this != NULL) { kfree(this); }
Expand All @@ -811,6 +854,11 @@ static int udmabuf_driver_destroy(struct udmabuf_driver_data* this)
dev_info(this->sys_dev, "driver uninstalled\n");
}
dma_free_coherent(this->dma_dev, this->alloc_size, this->virt_addr, this->phys_addr);
#if (USE_OF_RESERVED_MEM == 1)
if (this->of_reserved_mem) {
of_reserved_mem_device_release(this->dma_dev);
}
#endif
device_destroy(udmabuf_sys_class, this->device_number);
cdev_del(&this->cdev);
kfree(this);
Expand Down
3 changes: 0 additions & 3 deletions fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.0-1_armhf.deb

This file was deleted.

3 changes: 3 additions & 0 deletions fpga-soc-linux-drivers-4.14.13-armv7-fpga_0.1.1-1_armhf.deb
Git LFS file not shown
6 changes: 3 additions & 3 deletions scripts/build-fpga-linux-driver-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ git clone https://github.com/ikwzm/PTTY_AXI4

### Copy Source Files to drivers/

git archive --remote dtbocfg --prefix=dtbocfg/ --format=tar v0.0.3 | tar xf - -C drivers
git archive --remote fclkcfg --prefix=fclkcfg/ --format=tar v0.0.3 | tar xf - -C drivers
git archive --remote udmabuf --prefix=udmabuf/ --format=tar v0.9.0 | tar xf - -C drivers
git archive --remote dtbocfg --prefix=dtbocfg/ --format=tar v0.0.3 | tar xf - -C drivers
git archive --remote fclkcfg --prefix=fclkcfg/ --format=tar v0.0.3 | tar xf - -C drivers
git archive --remote udmabuf --prefix=udmabuf/ --format=tar v0.10.0 | tar xf - -C drivers
cd PTTY_AXI4; git checkout v1.0.0; cp -r src/drivers/zptty ../drivers; cd ..

### Build Device Driver debian package
Expand Down

0 comments on commit 74bd963

Please sign in to comment.